@spectrum-web-components/card 1.0.1-alpha.67 → 1.0.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 (50) hide show
  1. package/README.md +95 -90
  2. package/custom-elements.json +480 -141
  3. package/package.json +52 -38
  4. package/sp-card.dev.js +5 -0
  5. package/sp-card.dev.js.map +7 -0
  6. package/sp-card.js +2 -14
  7. package/sp-card.js.map +7 -1
  8. package/src/Card.d.ts +26 -6
  9. package/src/Card.dev.js +303 -0
  10. package/src/Card.dev.js.map +7 -0
  11. package/src/Card.js +56 -201
  12. package/src/Card.js.map +7 -1
  13. package/src/card-overrides.css.d.ts +2 -0
  14. package/src/card-overrides.css.dev.js +7 -0
  15. package/src/card-overrides.css.dev.js.map +7 -0
  16. package/src/card-overrides.css.js +4 -0
  17. package/src/card-overrides.css.js.map +7 -0
  18. package/src/card.css.dev.js +7 -0
  19. package/src/card.css.dev.js.map +7 -0
  20. package/src/card.css.js +4 -21
  21. package/src/card.css.js.map +7 -1
  22. package/src/index.dev.js +3 -0
  23. package/src/index.dev.js.map +7 -0
  24. package/src/index.js +2 -13
  25. package/src/index.js.map +7 -1
  26. package/src/spectrum-card.css.dev.js +7 -0
  27. package/src/spectrum-card.css.dev.js.map +7 -0
  28. package/src/spectrum-card.css.js +4 -21
  29. package/src/spectrum-card.css.js.map +7 -1
  30. package/src/spectrum-config.js +54 -96
  31. package/stories/card.stories.js +385 -0
  32. package/stories/card.stories.js.map +7 -0
  33. package/stories/images.js +4 -0
  34. package/stories/images.js.map +7 -0
  35. package/test/benchmark/test-basic.js +16 -0
  36. package/test/benchmark/test-basic.js.map +7 -0
  37. package/test/card-memory.test.js +5 -0
  38. package/test/card-memory.test.js.map +7 -0
  39. package/test/card.test-vrt.js +5 -0
  40. package/test/card.test-vrt.js.map +7 -0
  41. package/test/card.test.js +353 -0
  42. package/test/card.test.js.map +7 -0
  43. package/CHANGELOG.md +0 -123
  44. package/src/Card.ts +0 -237
  45. package/src/card.css +0 -58
  46. package/src/card.css.ts +0 -20
  47. package/src/index.ts +0 -12
  48. package/src/spectrum-card.css +0 -843
  49. package/src/spectrum-card.css.ts +0 -20
  50. package/src/spectrum-vars.json +0 -49
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["card.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/card/sp-card.js';\nimport { Card } from '@spectrum-web-components/card';\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport {\n Default,\n Horizontal,\n href,\n StoryArgs,\n} from '../stories/card.stories.js';\nimport { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';\nimport { spy } from 'sinon';\nimport { spaceEvent } from '../../../test/testing-helpers.js';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('card', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<Card>(\n html`\n <sp-card heading=\"Card Heading\" subheading=\"JPG\">\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n )\n );\n it('loads', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card heading=\"Card Heading\" subheading=\"JPG\">\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [quiet]', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card\n variant=\"quiet\"\n heading=\"Card Heading\"\n subheading=\"JPG\"\n >\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('loads - [quiet][small]', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card\n size=\"s\"\n heading=\"Card Heading\"\n subheading=\"JPG\"\n variant=\"quiet\"\n style=\"width: 115px;\"\n >\n <img\n src=\"https://picsum.photos/300/400\"\n alt=\"Demo Graphic\"\n slot=\"preview\"\n />\n <div slot=\"footer\">Footer</div>\n <sp-action-menu\n slot=\"actions\"\n placement=\"bottom-end\"\n label=\"More Actions\"\n quiet\n >\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n </sp-action-menu>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [gallery]', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card\n variant=\"gallery\"\n heading=\"Card Heading\"\n subheading=\"JPG\"\n >\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [horizontal]', async () => {\n const el = await fixture<Card>(\n Horizontal(Horizontal.args as StoryArgs)\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('[href] is clickable', async () => {\n const clickSpy = spy();\n const el = await fixture<Card>(href({}));\n\n await elementUpdated(el);\n\n el.addEventListener('click', (event: Event) => {\n const composedTarget = event.composedPath()[0] as HTMLElement;\n if (composedTarget.id !== 'like-anchor') return;\n clickSpy();\n });\n\n el.click();\n\n expect(clickSpy.callCount).to.equal(1);\n\n (el.shadowRoot.querySelector('#like-anchor') as HTMLElement).click();\n\n expect(clickSpy.callCount).to.equal(2);\n\n const img = el.querySelector('img') as HTMLImageElement;\n const boundingRect = img.getBoundingClientRect();\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n {\n type: 'down',\n },\n {\n type: 'up',\n },\n ],\n });\n\n expect(clickSpy.callCount).to.equal(3);\n });\n it('links in [href] do not pass their click', async () => {\n const clickSpy = spy();\n const el = await fixture<Card>(href({}));\n el.setAttribute(\n 'style',\n [\n 'width: 200px;',\n 'display: inline-flex;',\n '--mod-card-preview-minimum-height: 136px;',\n '--mod-actionbutton-height: 32px;',\n '--spectrum-icon-tshirt-size-height: 18px;',\n '--spectrum-icon-tshirt-size-width: 18px;',\n ].join('')\n );\n\n await elementUpdated(el);\n el.addEventListener('click', (event: Event) => {\n event.preventDefault();\n const path = event.composedPath();\n const hasLikeAnchor = path.some(\n (el) => (el as HTMLElement).id === 'like-anchor'\n );\n if (!hasLikeAnchor) return;\n clickSpy();\n });\n\n el.click();\n\n expect(clickSpy.callCount).to.equal(1);\n\n const footer = el.querySelector('[slot=\"footer\"]') as HTMLElement;\n let boundingRect = footer.getBoundingClientRect();\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [boundingRect.x, boundingRect.y],\n },\n ],\n });\n\n expect(clickSpy.callCount).to.equal(2);\n\n const link = el.querySelector(\n 'sp-link[href=\"https://google.com\"]'\n ) as HTMLElement;\n link.setAttribute('style', 'display: block');\n boundingRect = link.getBoundingClientRect();\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [boundingRect.x + 2, boundingRect.y + 2],\n },\n ],\n });\n\n expect(clickSpy.callCount).to.equal(2);\n });\n it('converts `Space` to `click` event', async () => {\n const clickSpy = spy();\n const handleClick = (): void => clickSpy();\n const el = await fixture<Card>(Default(Default.args));\n el.addEventListener('click', handleClick);\n\n await elementUpdated(el);\n expect(el.focused, 'default focused').to.be.false;\n\n el.dispatchEvent(new Event('focusin'));\n await elementUpdated(el);\n expect(el.focused, 'first time focused').to.be.true;\n\n el.dispatchEvent(spaceEvent());\n await elementUpdated(el);\n expect(el.focused, 'still focused').to.be.true;\n expect(clickSpy.called).to.be.true;\n expect(clickSpy.calledOnce).to.be.true;\n });\n it('can be `[toggles]`', async () => {\n const el = await fixture<Card>(Default(Default.args));\n el.toggles = true;\n\n await elementUpdated(el);\n\n const checkbox = el.shadowRoot.querySelector('sp-checkbox') as Checkbox;\n expect(el.focused, 'default focused').to.be.false;\n expect(el.selected, 'default selected').to.be.false;\n\n el.dispatchEvent(new Event('focusin'));\n\n await elementUpdated(el);\n expect(el.focused, 'first time focused').to.be.true;\n expect(el.selected, 'still not selected').to.be.false;\n\n el.dispatchEvent(spaceEvent());\n\n await elementUpdated(el);\n expect(el.focused, 'still focused').to.be.true;\n expect(el.selected, 'first selected').to.be.true;\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.dispatchEvent(spaceEvent());\n\n await elementUpdated(el);\n expect(el.focused, 'still focused after default prevented').to.be.true;\n expect(el.selected, 'first selected after default prevented').to.be\n .true;\n\n checkbox.dispatchEvent(\n new Event('focusin', {\n composed: true,\n bubbles: true,\n })\n );\n checkbox.focus();\n\n await elementUpdated(el);\n expect(el.focused, 'still focused, again').to.be.true;\n expect(el.selected, 'still selected').to.be.true;\n\n el.dispatchEvent(new Event('focusin'));\n\n await elementUpdated(el);\n expect(el.focused, 'focused, again').to.be.true;\n expect(el.selected, 'still selected, again').to.be.true;\n\n el.dispatchEvent(new Event('focusout'));\n\n await elementUpdated(el);\n expect(el.focused, 'still not focused, again').to.be.false;\n expect(el.selected, 'still selected, again 2').to.be.true;\n\n el.dispatchEvent(new Event('focusout'));\n\n checkbox.click();\n\n await elementUpdated(el);\n expect(el.focused, 'still not focused, again 2').to.be.false;\n // change event is prevented\n expect(el.selected, 'still selected, again 3').to.be.true;\n });\n\n it('announces when `[toggles]`', async () => {\n const changeSpy = spy();\n const el = await fixture<Card>(Default(Default.args));\n el.toggles = true;\n el.addEventListener('change', changeSpy);\n\n await elementUpdated(el);\n\n const checkbox = el.shadowRoot.querySelector('sp-checkbox') as Checkbox;\n expect(el.selected, 'default to not selected').to.be.false;\n checkbox.click();\n await elementUpdated(el);\n\n expect(el.selected, 'selected').to.be.true;\n expect(changeSpy.callCount).to.equal(1);\n checkbox.click();\n await elementUpdated(el);\n\n expect(el.selected, 'no longer selected').to.be.false;\n expect(changeSpy.callCount).to.equal(2);\n });\n it('displays the `heading` attribute as `.title`', async () => {\n const testHeading = 'This is a test heading';\n const el = await fixture<Card>(\n html`\n <sp-card heading=${testHeading} subheading=\"JPG\">\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const headingEl = root.querySelector('.title');\n\n expect(headingEl, 'did not find title element').to.not.be.null;\n expect((headingEl as HTMLDivElement).textContent).to.contain(\n testHeading,\n 'the heading renders in the element'\n );\n });\n it('displays the slotted content as `.title`', async () => {\n const testHeading = 'This is a test heading';\n const el = await fixture<Card>(\n html`\n <sp-card subheading=\"JPG\">\n <h1 slot=\"heading\">${testHeading}</h1>\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const headingSlot = root.querySelector(\n '.title [name=\"heading\"]'\n ) as HTMLSlotElement;\n\n expect(headingSlot, 'did not find slot element').to.not.be.null;\n const nodes = headingSlot.assignedNodes();\n const h1Element = nodes.find(\n (node) => (node as HTMLElement).tagName === 'H1'\n );\n expect(h1Element, 'did not find H1 element').to.not.be.null;\n expect((h1Element as HTMLHeadingElement).textContent).to.contain(\n testHeading,\n 'the slotted content renders in the element'\n );\n });\n});\n"],
5
+ "mappings": ";AAYA,OAAO;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AAEP,SAAS,WAAW;AACpB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;AAEtC,SAAS,QAAQ,MAAM;AACnB;AAAA,IACI,YACI,MAAM;AAAA,MACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUJ;AAAA,EACR;AACA,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,mBAAmB,YAAY;AAC9B,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAeJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO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A;AAAA,IAS5C;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,GAAG,aAAa,GAAG,aAAa;AAC7C,UAAM,cAAc,KAAK;AAAA,MACrB;AAAA,IACJ;AAEA,WAAO,aAAa,2BAA2B,EAAE,GAAG,IAAI,GAAG;AAC3D,UAAM,QAAQ,YAAY,cAAc;AACxC,UAAM,YAAY,MAAM;AAAA,MACpB,CAAC,SAAU,KAAqB,YAAY;AAAA,IAChD;AACA,WAAO,WAAW,yBAAyB,EAAE,GAAG,IAAI,GAAG;AACvD,WAAQ,UAAiC,WAAW,EAAE,GAAG;AAAA,MACrD;AAAA,MACA;AAAA,IACJ;AAAA,EACJ,CAAC;AACL,CAAC;",
6
+ "names": ["el"]
7
+ }
package/CHANGELOG.md DELETED
@@ -1,123 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [1.0.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.5.4...@spectrum-web-components/card@1.0.0) (2020-11-20)
7
-
8
- ### Bug Fixes
9
-
10
- - switch to heading/subheading instead of title ([d182a0f](https://github.com/adobe/spectrum-web-components/commit/d182a0f829b21296f07b50f37c8aecda2c0ed137))
11
- - tests weren't fully updated ([22bf3b1](https://github.com/adobe/spectrum-web-components/commit/22bf3b14d304a9106525a05a8c0dc16834648356))
12
- - these selectors didn't actually change ([a5ac275](https://github.com/adobe/spectrum-web-components/commit/a5ac275dfc9873ba65abf7a4d9631cc67fd65aa1))
13
-
14
- ### BREAKING CHANGES
15
-
16
- - renamed title/subtitle attributes and slot.
17
-
18
- ## [0.5.4](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.5.3...@spectrum-web-components/card@0.5.4) (2020-10-12)
19
-
20
- **Note:** Version bump only for package @spectrum-web-components/card
21
-
22
- ## [0.5.3](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.5.2...@spectrum-web-components/card@0.5.3) (2020-10-12)
23
-
24
- ### Bug Fixes
25
-
26
- - **card:** include dependencies ([18beaf6](https://github.com/adobe/spectrum-web-components/commit/18beaf61c9af0aeb88b1801e821c1f1c5abb3d63))
27
- - include default export in the "exports" fields ([f32407d](https://github.com/adobe/spectrum-web-components/commit/f32407d7bbfd18e72c35b6f27740549e79957858))
28
-
29
- ## [0.5.2](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.5.1...@spectrum-web-components/card@0.5.2) (2020-09-25)
30
-
31
- ### Bug Fixes
32
-
33
- - update side effect listings ([8160d3a](https://github.com/adobe/spectrum-web-components/commit/8160d3ab2c4f5ea11ac40897a5cf1fdaa357f4a8))
34
-
35
- ## [0.5.1](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.5.0...@spectrum-web-components/card@0.5.1) (2020-09-14)
36
-
37
- **Note:** Version bump only for package @spectrum-web-components/card
38
-
39
- # [0.5.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.4.3...@spectrum-web-components/card@0.5.0) (2020-08-31)
40
-
41
- ### Features
42
-
43
- - **card:** upgrade to Spectrum CSS v3.0.0 ([84cf1a9](https://github.com/adobe/spectrum-web-components/commit/84cf1a9758b1e357f18efac5763d17d6a4db0578))
44
-
45
- ## [0.4.3](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.4.2...@spectrum-web-components/card@0.4.3) (2020-08-19)
46
-
47
- **Note:** Version bump only for package @spectrum-web-components/card
48
-
49
- ## [0.4.2](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.4.1...@spectrum-web-components/card@0.4.2) (2020-07-27)
50
-
51
- **Note:** Version bump only for package @spectrum-web-components/card
52
-
53
- ## [0.4.1](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.4.0...@spectrum-web-components/card@0.4.1) (2020-07-22)
54
-
55
- **Note:** Version bump only for package @spectrum-web-components/card
56
-
57
- # [0.4.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.3.5...@spectrum-web-components/card@0.4.0) (2020-07-17)
58
-
59
- ### Features
60
-
61
- - leverage "exports" field in package.json ([321abd7](https://github.com/adobe/spectrum-web-components/commit/321abd7b7e78ccd9157cff75a1fa3dbd06e81f79))
62
-
63
- ## [0.3.5](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.3.4...@spectrum-web-components/card@0.3.5) (2020-06-08)
64
-
65
- **Note:** Version bump only for package @spectrum-web-components/card
66
-
67
- ## [0.3.4](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.3.3...@spectrum-web-components/card@0.3.4) (2020-05-08)
68
-
69
- ### Bug Fixes
70
-
71
- - **card:** correctly apply :focus-visible styling to variants ([d7c7539](https://github.com/adobe/spectrum-web-components/commit/d7c7539727d70f22243bd50bdaf8fbe0d0bbbb80))
72
-
73
- ## [0.3.3](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.3.2...@spectrum-web-components/card@0.3.3) (2020-04-16)
74
-
75
- ### Performance Improvements
76
-
77
- - use "sideEffects" listing in package.json ([7271614](https://github.com/adobe/spectrum-web-components/commit/7271614c0ca3ccf3566583bb59467eb15a6199cd))
78
-
79
- ## [0.3.2](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.3.1...@spectrum-web-components/card@0.3.2) (2020-04-07)
80
-
81
- **Note:** Version bump only for package @spectrum-web-components/card
82
-
83
- ## [0.3.1](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.3.0...@spectrum-web-components/card@0.3.1) (2020-03-11)
84
-
85
- **Note:** Version bump only for package @spectrum-web-components/card
86
-
87
- # [0.3.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.2.3...@spectrum-web-components/card@0.3.0) (2020-02-05)
88
-
89
- ### Features
90
-
91
- - allow slotted title for card ([aaf7157](https://github.com/adobe/spectrum-web-components/commit/aaf7157))
92
-
93
- ## [0.2.3](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.2.2...@spectrum-web-components/card@0.2.3) (2020-01-30)
94
-
95
- **Note:** Version bump only for package @spectrum-web-components/card
96
-
97
- ## [0.2.2](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.2.1...@spectrum-web-components/card@0.2.2) (2020-01-06)
98
-
99
- **Note:** Version bump only for package @spectrum-web-components/card
100
-
101
- ## [0.2.1](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.2.0...@spectrum-web-components/card@0.2.1) (2019-11-27)
102
-
103
- ### Bug Fixes
104
-
105
- - include "type" in package.json, generate custom-elements.json ([1a8d716](https://github.com/adobe/spectrum-web-components/commit/1a8d716))
106
-
107
- # [0.2.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.1.4...@spectrum-web-components/card@0.2.0) (2019-11-19)
108
-
109
- ### Features
110
-
111
- - add screenshot regression testing to CI ([8205dfe](https://github.com/adobe/spectrum-web-components/commit/8205dfe))
112
- - use :focus-visable (via polyfill) instead of :focus ([11c6fc7](https://github.com/adobe/spectrum-web-components/commit/11c6fc7))
113
- - use @adobe/spectrum-css@2.15.1 ([3918888](https://github.com/adobe/spectrum-web-components/commit/3918888))
114
-
115
- ## [0.1.4](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/card@0.1.3...@spectrum-web-components/card@0.1.4) (2019-10-14)
116
-
117
- ### Performance Improvements
118
-
119
- - use imported TypeScript helpers instead of inlining them ([cc2bd0a](https://github.com/adobe/spectrum-web-components/commit/cc2bd0a))
120
-
121
- ## 0.1.3 (2019-10-03)
122
-
123
- **Note:** Version bump only for package @spectrum-web-components/card
package/src/Card.ts DELETED
@@ -1,237 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
-
13
- import {
14
- html,
15
- SpectrumElement,
16
- property,
17
- CSSResultArray,
18
- TemplateResult,
19
- PropertyValues,
20
- ifDefined,
21
- } from '@spectrum-web-components/base';
22
- import { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';
23
- import '@spectrum-web-components/asset/sp-asset.js';
24
-
25
- import { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';
26
- import '@spectrum-web-components/checkbox/sp-checkbox.js';
27
- import '@spectrum-web-components/quick-actions/sp-quick-actions.js';
28
- import cardStyles from './card.css.js';
29
- import headingStyles from '@spectrum-web-components/styles/heading.js';
30
- import detailStyles from '@spectrum-web-components/styles/detail.js';
31
-
32
- /**
33
- * @element sp-card
34
- *
35
- * @fires change - Announces a change in the `selected` property of a card
36
- * @slot preview - This is the preview image for Gallery Cards
37
- * @slot cover-photo - This is the cover photo for Default and Quiet Cards
38
- * @slot heading - HTML content to be listed as the heading
39
- * @slot subheading - HTML content to be listed as the subheading
40
- * @slot description - A description of the card
41
- * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object
42
- * @slot footer - Footer text
43
- */
44
- export class Card extends FocusVisiblePolyfillMixin(SpectrumElement) {
45
- public static get styles(): CSSResultArray {
46
- return [headingStyles, detailStyles, cardStyles];
47
- }
48
-
49
- @property()
50
- public asset?: 'file' | 'folder';
51
-
52
- @property({ reflect: true })
53
- public variant: 'standard' | 'gallery' | 'quiet' = 'standard';
54
-
55
- @property({ type: Boolean, reflect: true })
56
- public selected = false;
57
-
58
- @property()
59
- public heading = '';
60
-
61
- @property({ type: Boolean, reflect: true })
62
- public horizontal = false;
63
-
64
- @property({ type: Boolean, reflect: true })
65
- public small = false;
66
-
67
- @property({ type: Boolean, reflect: true })
68
- public focused = false;
69
-
70
- @property({ type: Boolean, reflect: true })
71
- public toggles = false;
72
-
73
- @property()
74
- public subheading = '';
75
-
76
- public constructor() {
77
- super();
78
- this.addEventListener('focusin', this.handleFocusin);
79
- this.shadowRoot.addEventListener('focusin', this.handleFocusin);
80
- this.addEventListener('focusout', this.handleFocusout);
81
- }
82
-
83
- private handleFocusin = (event: Event): void => {
84
- this.focused = true;
85
- const target = event.composedPath()[0];
86
- if (target !== this) {
87
- this.removeEventListener('keydown', this.handleKeydown);
88
- return;
89
- }
90
- this.addEventListener('keydown', this.handleKeydown);
91
- };
92
-
93
- private handleFocusout(event: Event): void {
94
- this.focused = false;
95
- const target = event.composedPath()[0];
96
- if (target === this) {
97
- this.removeEventListener('keydown', this.handleKeydown);
98
- }
99
- }
100
-
101
- private handleKeydown(event: KeyboardEvent): void {
102
- const { code } = event;
103
- /* istanbul ignore else */
104
- if (code === 'Space') {
105
- this.toggleSelected();
106
- }
107
- }
108
-
109
- private handleSelectedChange(event: Event & { target: Checkbox }): void {
110
- const { target } = event;
111
- this.selected = target.checked;
112
- }
113
-
114
- public toggleSelected(): void {
115
- if (!this.toggles) {
116
- this.dispatchEvent(
117
- new Event('click', {
118
- bubbles: true,
119
- composed: true,
120
- })
121
- );
122
- return;
123
- }
124
- this.selected = !this.selected;
125
- const applyDefault = this.dispatchEvent(
126
- new Event('change', {
127
- cancelable: true,
128
- })
129
- );
130
- if (!applyDefault) {
131
- this.selected = !this.selected;
132
- }
133
- }
134
-
135
- protected get renderHeading(): TemplateResult {
136
- return html`
137
- <div class="title spectrum-Heading spectrum-Heading--sizeXS">
138
- <slot name="heading">
139
- ${this.heading}
140
- </slot>
141
- </div>
142
- `;
143
- }
144
-
145
- protected get renderPreviewImage(): TemplateResult {
146
- return html`
147
- <sp-asset id="preview" variant=${ifDefined(this.asset)}>
148
- <slot name="preview"></slot>
149
- </sp-asset>
150
- `;
151
- }
152
-
153
- private renderImage(): TemplateResult {
154
- if (this.horizontal) {
155
- return this.renderPreviewImage;
156
- }
157
- if (this.variant === 'standard') {
158
- return html`
159
- <sp-asset id="cover-photo" variant=${ifDefined(this.asset)}>
160
- <slot name="cover-photo"></slot>
161
- </sp-asset>
162
- `;
163
- }
164
- return this.renderPreviewImage;
165
- }
166
-
167
- private get renderSubtitleAndDescription(): TemplateResult {
168
- return html`
169
- <div class="subtitle spectrum-Detail spectrum-Detail--sizeS">
170
- <slot name="subheading">
171
- ${this.subheading}
172
- </slot>
173
- </div>
174
- <slot name="description"></slot>
175
- `;
176
- }
177
-
178
- protected render(): TemplateResult {
179
- return html`
180
- ${this.toggles
181
- ? html`
182
- <sp-quick-actions
183
- class="spectrum-QuickActions quickActions"
184
- >
185
- <sp-checkbox
186
- tabindex="-1"
187
- class="checkbox"
188
- @change=${this.handleSelectedChange}
189
- ?checked=${this.selected}
190
- ></sp-checkbox>
191
- </sp-quick-actions>
192
- `
193
- : html``}
194
- ${this.variant === 'quiet' && this.small
195
- ? html`
196
- <sp-quick-actions class="spectrum-QuickActions actions">
197
- <slot name="actions"></slot>
198
- </sp-quick-actions>
199
- `
200
- : html``}
201
- ${this.renderImage()}
202
- <div class="body">
203
- <div class="header">
204
- ${this.renderHeading}
205
- ${this.variant === 'gallery'
206
- ? this.renderSubtitleAndDescription
207
- : html``}
208
- ${this.variant !== 'quiet' || !this.small
209
- ? html`
210
- <div class="actionButton">
211
- <slot name="actions"></slot>
212
- </div>
213
- `
214
- : html``}
215
- </div>
216
- ${this.variant !== 'gallery'
217
- ? html`
218
- <div class="content">
219
- ${this.renderSubtitleAndDescription}
220
- </div>
221
- `
222
- : html``}
223
- </div>
224
- ${this.variant === 'standard'
225
- ? html`
226
- <slot name="footer"></slot>
227
- `
228
- : html``}
229
- `;
230
- }
231
-
232
- protected firstUpdated(changes: PropertyValues): void {
233
- super.firstUpdated(changes);
234
- this.setAttribute('role', 'figure');
235
- this.tabIndex = 0;
236
- }
237
- }
package/src/card.css DELETED
@@ -1,58 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
-
13
- @import './spectrum-card.css';
14
-
15
- /* The description slot has a psuedo-element that also needs to receive the font styling.
16
- We need to add the declaration to the slot as well */
17
- slot[name='description'] {
18
- font-size: var(
19
- --spectrum-card-subtitle-text-size,
20
- var(--spectrum-global-dimension-font-size-50)
21
- );
22
- }
23
-
24
- #preview,
25
- #cover-photo {
26
- overflow: hidden;
27
- }
28
-
29
- #preview ::slotted(*),
30
- #cover-photo ::slotted(*) {
31
- width: 100%;
32
- display: block;
33
-
34
- /* Since we're using <img> tags instead of background-image for the cover photo,
35
- we need an additional object-fit property to preserve the aspect ratio of the image
36
- In spectrum-css, background-size is used */
37
- object-fit: cover;
38
- }
39
-
40
- :host(:not([variant='gallery'])) #preview ::slotted(*) {
41
- height: 100%;
42
- }
43
-
44
- :host([horizontal]) #preview {
45
- width: auto;
46
- }
47
-
48
- sp-quick-actions {
49
- z-index: 1;
50
- }
51
-
52
- /**
53
- * Allow that the heading element will take specified use of the available width whether
54
- * "actions" are supplied to the element or not.
55
- **/
56
- .title {
57
- width: var(--spectrum-card-title-width);
58
- }
package/src/card.css.ts DELETED
@@ -1,20 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { css } from '@spectrum-web-components/base';
13
- const styles = css`
14
- :host{position:relative;display:inline-flex;flex-direction:column;box-sizing:border-box;min-width:var(--spectrum-card-min-width,var(--spectrum-global-dimension-size-3000));border:var(--spectrum-card-border-size,var(--spectrum-alias-border-size-thin)) solid transparent;border-radius:var(--spectrum-card-border-radius,var(--spectrum-alias-border-radius-regular));text-decoration:none}:host(:focus){outline:none}:host(:focus) .actions,:host(:focus) .quickActions,:host(:hover) .actions,:host(:hover) .quickActions,:host([focused]) .actions,:host([focused]) .quickActions,:host([selected]) .actions,:host([selected]) .quickActions{visibility:visible;opacity:1;pointer-events:all}:host([dir=ltr]) .actions{right:var(--spectrum-card-actions-margin,var(--spectrum-global-dimension-size-125))}:host([dir=rtl]) .actions{left:var(--spectrum-card-actions-margin,var(--spectrum-global-dimension-size-125))}.actions{position:absolute;top:var(--spectrum-card-actions-margin,var(--spectrum-global-dimension-size-125));height:var(--spectrum-quickactions-height,var(--spectrum-global-dimension-size-500));visibility:hidden}:host([dir=ltr]) .quickActions{left:var(--spectrum-card-checkbox-margin,var(--spectrum-global-dimension-size-200))}:host([dir=rtl]) .quickActions{right:var(--spectrum-card-checkbox-margin,var(--spectrum-global-dimension-size-200))}.quickActions{position:absolute;top:var(--spectrum-card-checkbox-margin,var(--spectrum-global-dimension-size-200));width:var(--spectrum-quickactions-height,var(--spectrum-global-dimension-size-500));height:var(--spectrum-quickactions-height,var(--spectrum-global-dimension-size-500));visibility:hidden}:host([dir=ltr]) .quickActions .checkbox,:host([dir=rtl]) .quickActions .checkbox{margin:0}#cover-photo{height:var(--spectrum-card-coverphoto-height,var(--spectrum-global-dimension-size-1700));box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-bottom:var(--spectrum-card-coverphoto-border-bottom-size,var(--spectrum-alias-border-size-thin)) solid transparent;border-top-left-radius:calc(var(--spectrum-card-border-radius,
15
- var(--spectrum-alias-border-radius-regular)) - 1px);border-top-right-radius:calc(var(--spectrum-card-border-radius,
16
- var(--spectrum-alias-border-radius-regular)) - 1px);border-bottom-right-radius:0;border-bottom-left-radius:0;background-size:cover;background-position:50%}:host([dir=ltr]) .body{padding-right:var(--spectrum-card-body-padding-right,var(--spectrum-global-dimension-size-300))}:host([dir=rtl]) .body{padding-left:var(--spectrum-card-body-padding-right,var(--spectrum-global-dimension-size-300))}:host([dir=ltr]) .body{padding-left:var(--spectrum-card-body-padding-left,var(--spectrum-global-dimension-size-300))}:host([dir=rtl]) .body{padding-right:var(--spectrum-card-body-padding-left,var(--spectrum-global-dimension-size-300))}.body{padding-top:var(--spectrum-card-body-padding-top,var(--spectrum-global-dimension-size-250));padding-bottom:var(--spectrum-card-body-padding-bottom,var(--spectrum-global-dimension-size-250))}.body:last-child{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:var(--spectrum-card-border-radius,var(--spectrum-alias-border-radius-regular));border-bottom-left-radius:var(--spectrum-card-border-radius,var(--spectrum-alias-border-radius-regular))}#preview{overflow:hidden;border-top-left-radius:calc(var(--spectrum-card-border-radius,
17
- var(--spectrum-alias-border-radius-regular)) - 1px);border-top-right-radius:calc(var(--spectrum-card-border-radius,
18
- var(--spectrum-alias-border-radius-regular)) - 1px);border-bottom-right-radius:0;border-bottom-left-radius:0}.header{height:var(--spectrum-card-body-header-height,var(--spectrum-global-dimension-size-225))}.content{display:flex;height:var(--spectrum-card-body-content-height,var(--spectrum-global-dimension-size-175));margin-top:var(--spectrum-card-body-content-margin-top,var(--spectrum-global-dimension-size-75))}:host([dir=ltr]) .title{padding-right:var(--spectrum-card-title-padding-right,var(--spectrum-global-dimension-size-100))}:host([dir=rtl]) .title{padding-left:var(--spectrum-card-title-padding-right,var(--spectrum-global-dimension-size-100))}.title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([dir=ltr]) .subtitle{padding-right:var(--spectrum-card-subtitle-padding-right,var(--spectrum-global-dimension-size-100))}:host([dir=rtl]) .subtitle{padding-left:var(--spectrum-card-subtitle-padding-right,var(--spectrum-global-dimension-size-100))}::slotted([slot=description]){font-size:var(--spectrum-card-subtitle-text-size,var(--spectrum-global-dimension-font-size-50))}:host([dir=ltr]) .subtitle+::slotted([slot=description]):before{padding-right:var(--spectrum-card-subtitle-padding-right,var(--spectrum-global-dimension-size-100))}:host([dir=rtl]) .subtitle+::slotted([slot=description]):before{padding-left:var(--spectrum-card-subtitle-padding-right,var(--spectrum-global-dimension-size-100))}.subtitle+::slotted([slot=description]):before{content:"•"}:host([dir=ltr]) ::slotted([slot=footer]){margin-right:var(--spectrum-card-body-padding-right,var(--spectrum-global-dimension-size-300))}:host([dir=rtl]) ::slotted([slot=footer]){margin-left:var(--spectrum-card-body-padding-right,var(--spectrum-global-dimension-size-300))}:host([dir=ltr]) ::slotted([slot=footer]){margin-left:var(--spectrum-card-body-padding-left,var(--spectrum-global-dimension-size-300))}:host([dir=rtl]) ::slotted([slot=footer]){margin-right:var(--spectrum-card-body-padding-left,var(--spectrum-global-dimension-size-300))}::slotted([slot=footer]){padding-top:var(--spectrum-card-footer-padding-top,var(--spectrum-global-dimension-size-175));padding-bottom:var(--spectrum-card-body-padding-bottom,var(--spectrum-global-dimension-size-250));border-top:var(--spectrum-card-footer-border-top-size,var(--spectrum-global-dimension-size-10)) solid}.header{display:flex;align-items:baseline}.actionButton{flex:1;align-self:center;display:flex;justify-content:flex-end}:host([variant=quiet]) #preview{min-height:var(--spectrum-card-quiet-min-size,var(--spectrum-global-dimension-size-1700))}:host([variant=gallery]),:host([variant=quiet]){width:100%;height:100%;min-width:var(--spectrum-card-quiet-min-size,var(--spectrum-global-dimension-size-1700));border-width:0;border-radius:0;overflow:visible}:host([variant=gallery]) #preview,:host([variant=quiet]) #preview{width:100%;flex:1;padding:var(--spectrum-card-quiet-preview-padding,var(--spectrum-global-dimension-size-250));margin:0 auto;box-sizing:border-box;border-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular));position:relative;transition:background-color var(--spectrum-global-animation-duration-100,.13s);overflow:visible}:host([dir=ltr][variant=gallery]) #preview:before,:host([dir=ltr][variant=quiet]) #preview:before{left:0}:host([dir=rtl][variant=gallery]) #preview:before,:host([dir=rtl][variant=quiet]) #preview:before{right:0}:host([variant=gallery]) #preview:before,:host([variant=quiet]) #preview:before{content:"";position:absolute;top:0;width:100%;height:100%;box-sizing:border-box;border-radius:inherit;border:var(--spectrum-card-quiet-border-size,var(--spectrum-alias-border-size-thin)) solid transparent}:host([variant=gallery][drop-target]) #preview,:host([variant=quiet][drop-target]) #preview{transition:none}:host([variant=gallery]) .header,:host([variant=quiet]) .header{height:var(--spectrum-card-quiet-body-header-height,var(--spectrum-global-dimension-size-225));margin-top:var(--spectrum-card-quiet-body-header-margin-top,var(--spectrum-global-dimension-size-175))}:host([variant=gallery]) .body,:host([variant=quiet]) .body{padding:0}:host([small]){min-width:var(--spectrum-card-quiet-small-min-size,var(--spectrum-global-dimension-size-900))}:host([dir=ltr][small]) .quickActions{left:var(--spectrum-card-quiet-small-checkbox-margin,var(--spectrum-global-dimension-size-125))}:host([dir=rtl][small]) .quickActions{right:var(--spectrum-card-quiet-small-checkbox-margin,var(--spectrum-global-dimension-size-125))}:host([small]) .quickActions{top:var(--spectrum-card-quiet-small-checkbox-margin,var(--spectrum-global-dimension-size-125))}:host([small]) #preview{padding:var(--spectrum-card-quiet-small-preview-padding,var(--spectrum-global-dimension-size-150));min-height:var(--spectrum-card-quiet-small-min-size,var(--spectrum-global-dimension-size-900))}:host([small]) .header{margin-top:var(--spectrum-card-quiet-small-body-margin-top,var(--spectrum-global-dimension-size-100));height:var(--spectrum-card-quiet-small-body-header-height,var(--spectrum-global-dimension-size-150))}:host([small]) .title{font-size:var(--spectrum-card-quiet-small-title-text-size,var(--spectrum-global-dimension-font-size-100))}:host([horizontal]){flex-direction:row}:host([dir=ltr][horizontal]) #preview{border-top-left-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular))}:host([dir=rtl][horizontal]) #preview{border-top-right-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular))}:host([dir=ltr][horizontal]) #preview{border-top-right-radius:0}:host([dir=rtl][horizontal]) #preview{border-top-left-radius:0}:host([dir=ltr][horizontal]) #preview{border-bottom-left-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular))}:host([dir=rtl][horizontal]) #preview{border-bottom-right-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular))}:host([dir=ltr][horizontal]) #preview{border-bottom-right-radius:0}:host([dir=rtl][horizontal]) #preview{border-bottom-left-radius:0}:host([dir=ltr][horizontal]) #preview{border-right:var(--spectrum-card-border-size,var(--spectrum-alias-border-size-thin)) solid transparent}:host([dir=rtl][horizontal]) #preview{border-left:var(--spectrum-card-border-size,var(--spectrum-alias-border-size-thin)) solid transparent}:host([horizontal]) #preview{flex-shrink:0;min-height:0;display:flex;align-items:center;justify-content:center;padding:var(--spectrum-global-dimension-size-175)}:host([horizontal]) .content,:host([horizontal]) .header{margin-top:0;height:auto}:host([dir=ltr][horizontal]) .title{padding-right:0}:host([dir=rtl][horizontal]) .title{padding-left:0}:host([horizontal]) .body{flex-shrink:0;display:flex;justify-content:center;flex-direction:column;padding-top:0;padding-bottom:0;padding-left:var(--spectrum-global-dimension-size-200);padding-right:var(--spectrum-global-dimension-size-200)}:host([variant=gallery]){min-width:0}:host([variant=gallery]) #preview{padding:0;border-radius:0}:host{border-color:var(--spectrum-card-border-color,var(--spectrum-global-color-gray-200));background-color:var(--spectrum-card-background-color,var(--spectrum-global-color-gray-50))}:host(:hover){border-color:var(--spectrum-card-border-color-hover,var(--spectrum-global-color-gray-400))}:host(.focus-visible),:host(.focus-visible),:host([drop-target]),:host([selected]){border-color:var(--spectrum-card-border-color-key-focus,var(--spectrum-alias-border-color-focus));box-shadow:0 0 0 1px var(--spectrum-card-border-color-key-focus,var(--spectrum-alias-border-color-focus))}:host(.focus-visible),:host(:focus-visible),:host([drop-target]),:host([selected]){border-color:var(--spectrum-card-border-color-key-focus,var(--spectrum-alias-border-color-focus));box-shadow:0 0 0 1px var(--spectrum-card-border-color-key-focus,var(--spectrum-alias-border-color-focus))}:host([drop-target]){background-color:var(--spectrum-alias-highlight-selected)}.subtitle,::slotted([slot=description]){color:var(--spectrum-card-description-text-color,var(--spectrum-global-color-gray-700))}#cover-photo{background-color:var(--spectrum-card-coverphoto-background-color,var(--spectrum-global-color-gray-200));border-bottom-color:var(--spectrum-card-coverphoto-border-color,var(--spectrum-global-color-gray-200))}::slotted([slot=footer]){border-color:var(--spectrum-card-border-color,var(--spectrum-global-color-gray-200))}:host([variant=gallery]),:host([variant=quiet]){border-color:transparent;background-color:initial}:host([variant=gallery]) #preview,:host([variant=quiet]) #preview{background-color:var(--spectrum-card-quiet-preview-background-color,var(--spectrum-global-color-gray-200))}:host([variant=gallery]:hover),:host([variant=quiet]:hover){border-color:transparent}:host([variant=gallery]:hover) #preview,:host([variant=quiet]:hover) #preview{background-color:var(--spectrum-card-quiet-preview-background-color-hover,var(--spectrum-global-color-gray-300))}:host([variant=gallery].focus-visible),:host([variant=gallery].focus-visible),:host([variant=gallery][selected]),:host([variant=quiet].focus-visible),:host([variant=quiet].focus-visible),:host([variant=quiet][selected]){border-color:transparent;box-shadow:none}:host([variant=gallery].focus-visible),:host([variant=gallery]:focus-visible),:host([variant=gallery][selected]),:host([variant=quiet].focus-visible),:host([variant=quiet]:focus-visible),:host([variant=quiet][selected]){border-color:transparent;box-shadow:none}:host([variant=gallery].focus-visible) #preview,:host([variant=gallery].focus-visible) #preview,:host([variant=gallery][selected]) #preview,:host([variant=quiet].focus-visible) #preview,:host([variant=quiet].focus-visible) #preview,:host([variant=quiet][selected]) #preview{background-color:var(--spectrum-card-quiet-preview-background-color,var(--spectrum-global-color-gray-200))}:host([variant=gallery].focus-visible) #preview,:host([variant=gallery]:focus-visible) #preview,:host([variant=gallery][selected]) #preview,:host([variant=quiet].focus-visible) #preview,:host([variant=quiet]:focus-visible) #preview,:host([variant=quiet][selected]) #preview{background-color:var(--spectrum-card-quiet-preview-background-color,var(--spectrum-global-color-gray-200))}:host([variant=gallery].focus-visible) #preview:before,:host([variant=gallery].focus-visible) #preview:before,:host([variant=gallery][selected]) #preview:before,:host([variant=quiet].focus-visible) #preview:before,:host([variant=quiet].focus-visible) #preview:before,:host([variant=quiet][selected]) #preview:before{border-color:var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500));box-shadow:0 0 0 1px var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500))}:host([variant=gallery].focus-visible) #preview:before,:host([variant=gallery]:focus-visible) #preview:before,:host([variant=gallery][selected]) #preview:before,:host([variant=quiet].focus-visible) #preview:before,:host([variant=quiet]:focus-visible) #preview:before,:host([variant=quiet][selected]) #preview:before{border-color:var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500));box-shadow:0 0 0 1px var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500))}:host([variant=gallery][drop-target]),:host([variant=quiet][drop-target]){border-color:transparent;background-color:initial;box-shadow:none}:host([variant=gallery][drop-target]) #preview,:host([variant=quiet][drop-target]) #preview{background-color:var(--spectrum-alias-highlight-selected)}:host([variant=gallery][drop-target]) #preview:before,:host([variant=quiet][drop-target]) #preview:before{border-color:var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500));box-shadow:0 0 0 1px var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500))}:host([variant=gallery][drop-target]) .spectrum-Asset-fileBackground,:host([variant=gallery][drop-target]) .spectrum-Asset-folderBackground,:host([variant=quiet][drop-target]) .spectrum-Asset-fileBackground,:host([variant=quiet][drop-target]) .spectrum-Asset-folderBackground{fill:var(--spectrum-alias-highlight-selected)}:host([variant=gallery][drop-target]) .spectrum-Asset-fileOutline,:host([variant=gallery][drop-target]) .spectrum-Asset-folderOutline,:host([variant=quiet][drop-target]) .spectrum-Asset-fileOutline,:host([variant=quiet][drop-target]) .spectrum-Asset-folderOutline{fill:var(--spectrum-card-quiet-border-color-selected,var(--spectrum-global-color-blue-500))}:host([variant=gallery]) .title,:host([variant=quiet]) .title{color:var(--spectrum-card-quiet-title-text-color,var(--spectrum-global-color-gray-800))}:host([variant=gallery]) .subtitle,:host([variant=quiet]) .subtitle{color:var(--spectrum-card-quiet-subtitle-text-color,var(--spectrum-global-color-gray-700))}:host([horizontal]:hover) #preview{border-color:var(--spectrum-card-border-color-hover,var(--spectrum-global-color-gray-400))}:host([horizontal]) #preview{background-color:var(--spectrum-card-quiet-preview-background-color,var(--spectrum-global-color-gray-200));border-color:var(--spectrum-card-border-color,var(--spectrum-global-color-gray-200))}slot[name=description]{font-size:var(--spectrum-card-subtitle-text-size,var(--spectrum-global-dimension-font-size-50))}#cover-photo,#preview{overflow:hidden}#cover-photo ::slotted(*),#preview ::slotted(*){width:100%;display:block;object-fit:cover}:host(:not([variant=gallery])) #preview ::slotted(*){height:100%}:host([horizontal]) #preview{width:auto}sp-quick-actions{z-index:1}.title{width:var(--spectrum-card-title-width)}
19
- `;
20
- export default styles;
package/src/index.ts DELETED
@@ -1,12 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- export * from './Card.js';