@spectrum-web-components/card 1.0.0 → 1.0.1-color-testing

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/package.json +54 -38
  3. package/sp-card.dev.js +5 -0
  4. package/sp-card.dev.js.map +7 -0
  5. package/sp-card.js +2 -14
  6. package/sp-card.js.map +7 -1
  7. package/src/Card.d.ts +27 -6
  8. package/src/Card.dev.js +303 -0
  9. package/src/Card.dev.js.map +7 -0
  10. package/src/Card.js +60 -206
  11. package/src/Card.js.map +7 -1
  12. package/src/card-overrides.css.d.ts +2 -0
  13. package/src/card-overrides.css.dev.js +7 -0
  14. package/src/card-overrides.css.dev.js.map +7 -0
  15. package/src/card-overrides.css.js +4 -0
  16. package/src/card-overrides.css.js.map +7 -0
  17. package/src/card.css.dev.js +7 -0
  18. package/src/card.css.dev.js.map +7 -0
  19. package/src/card.css.js +4 -21
  20. package/src/card.css.js.map +7 -1
  21. package/src/index.dev.js +3 -0
  22. package/src/index.dev.js.map +7 -0
  23. package/src/index.js +2 -13
  24. package/src/index.js.map +7 -1
  25. package/src/spectrum-card.css.dev.js +7 -0
  26. package/src/spectrum-card.css.dev.js.map +7 -0
  27. package/src/spectrum-card.css.js +4 -21
  28. package/src/spectrum-card.css.js.map +7 -1
  29. package/src/spectrum-config.js +54 -96
  30. package/stories/card.stories.js +385 -0
  31. package/stories/card.stories.js.map +7 -0
  32. package/stories/images.js +4 -0
  33. package/stories/images.js.map +7 -0
  34. package/test/benchmark/test-basic.js +16 -0
  35. package/test/benchmark/test-basic.js.map +7 -0
  36. package/test/card-memory.test.js +5 -0
  37. package/test/card-memory.test.js.map +7 -0
  38. package/test/card.test-vrt.js +5 -0
  39. package/test/card.test-vrt.js.map +7 -0
  40. package/test/card.test.js +353 -0
  41. package/test/card.test.js.map +7 -0
  42. package/CHANGELOG.md +0 -123
  43. package/custom-elements.json +0 -153
  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 -812
  49. package/src/spectrum-card.css.ts +0 -20
  50. package/src/spectrum-vars.json +0 -52
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
@@ -1,153 +0,0 @@
1
- {
2
- "version": "experimental",
3
- "tags": [
4
- {
5
- "name": "sp-card",
6
- "path": "./sp-card.d.ts",
7
- "attributes": [
8
- {
9
- "name": "asset",
10
- "type": "\"file\" | \"folder\" | undefined"
11
- },
12
- {
13
- "name": "variant",
14
- "type": "\"standard\" | \"gallery\" | \"quiet\"",
15
- "default": "\"standard\""
16
- },
17
- {
18
- "name": "selected",
19
- "type": "boolean",
20
- "default": "false"
21
- },
22
- {
23
- "name": "heading",
24
- "type": "string",
25
- "default": "\"\""
26
- },
27
- {
28
- "name": "horizontal",
29
- "type": "boolean",
30
- "default": "false"
31
- },
32
- {
33
- "name": "small",
34
- "type": "boolean",
35
- "default": "false"
36
- },
37
- {
38
- "name": "focused",
39
- "type": "boolean",
40
- "default": "false"
41
- },
42
- {
43
- "name": "toggles",
44
- "type": "boolean",
45
- "default": "false"
46
- },
47
- {
48
- "name": "subheading",
49
- "type": "string",
50
- "default": "\"\""
51
- }
52
- ],
53
- "properties": [
54
- {
55
- "name": "asset",
56
- "attribute": "asset",
57
- "type": "\"file\" | \"folder\" | undefined"
58
- },
59
- {
60
- "name": "variant",
61
- "attribute": "variant",
62
- "type": "\"standard\" | \"gallery\" | \"quiet\"",
63
- "default": "\"standard\""
64
- },
65
- {
66
- "name": "selected",
67
- "attribute": "selected",
68
- "type": "boolean",
69
- "default": "false"
70
- },
71
- {
72
- "name": "heading",
73
- "attribute": "heading",
74
- "type": "string",
75
- "default": "\"\""
76
- },
77
- {
78
- "name": "horizontal",
79
- "attribute": "horizontal",
80
- "type": "boolean",
81
- "default": "false"
82
- },
83
- {
84
- "name": "small",
85
- "attribute": "small",
86
- "type": "boolean",
87
- "default": "false"
88
- },
89
- {
90
- "name": "focused",
91
- "attribute": "focused",
92
- "type": "boolean",
93
- "default": "false"
94
- },
95
- {
96
- "name": "toggles",
97
- "attribute": "toggles",
98
- "type": "boolean",
99
- "default": "false"
100
- },
101
- {
102
- "name": "subheading",
103
- "attribute": "subheading",
104
- "type": "string",
105
- "default": "\"\""
106
- },
107
- {
108
- "name": "shadowRoot",
109
- "type": "ShadowRoot"
110
- }
111
- ],
112
- "events": [
113
- {
114
- "name": "change",
115
- "description": "Announces a change in the `selected` property of a card"
116
- },
117
- {
118
- "name": "click"
119
- }
120
- ],
121
- "slots": [
122
- {
123
- "name": "preview",
124
- "description": "This is the preview image for Gallery Cards"
125
- },
126
- {
127
- "name": "cover-photo",
128
- "description": "This is the cover photo for Default and Quiet Cards"
129
- },
130
- {
131
- "name": "heading",
132
- "description": "HTML content to be listed as the heading"
133
- },
134
- {
135
- "name": "subheading",
136
- "description": "HTML content to be listed as the subheading"
137
- },
138
- {
139
- "name": "description",
140
- "description": "A description of the card"
141
- },
142
- {
143
- "name": "actions",
144
- "description": "an `sp-action-menu` element outlining actions to take on the represened object"
145
- },
146
- {
147
- "name": "footer",
148
- "description": "Footer text"
149
- }
150
- ]
151
- }
152
- ]
153
- }
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 { MoreIcon } from '@spectrum-web-components/icons-workflow';
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 { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';
30
-
31
- /**
32
- * @element sp-card
33
- *
34
- * @fires change - Announces a change in the `selected` property of a card
35
- * @slot preview - This is the preview image for Gallery Cards
36
- * @slot cover-photo - This is the cover photo for Default and Quiet Cards
37
- * @slot heading - HTML content to be listed as the heading
38
- * @slot subheading - HTML content to be listed as the subheading
39
- * @slot description - A description of the card
40
- * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object
41
- * @slot footer - Footer text
42
- */
43
- export class Card extends FocusVisiblePolyfillMixin(SpectrumElement) {
44
- public static get styles(): CSSResultArray {
45
- return [cardStyles];
46
- }
47
-
48
- @property()
49
- public asset?: 'file' | 'folder';
50
-
51
- @property({ reflect: true })
52
- public variant: 'standard' | 'gallery' | 'quiet' = 'standard';
53
-
54
- @property({ type: Boolean, reflect: true })
55
- public selected = false;
56
-
57
- @property()
58
- public heading = '';
59
-
60
- @property({ type: Boolean, reflect: true })
61
- public horizontal = false;
62
-
63
- @property({ type: Boolean, reflect: true })
64
- public small = false;
65
-
66
- @property({ type: Boolean, reflect: true })
67
- public focused = false;
68
-
69
- @property({ type: Boolean, reflect: true })
70
- public toggles = false;
71
-
72
- @property()
73
- public subheading = '';
74
-
75
- public constructor() {
76
- super();
77
- this.addEventListener('focusin', this.handleFocusin);
78
- this.shadowRoot.addEventListener('focusin', this.handleFocusin);
79
- this.addEventListener('focusout', this.handleFocusout);
80
- }
81
-
82
- private handleFocusin = (event: Event): void => {
83
- this.focused = true;
84
- const target = event.composedPath()[0];
85
- if (target !== this) {
86
- this.removeEventListener('keydown', this.handleKeydown);
87
- return;
88
- }
89
- this.addEventListener('keydown', this.handleKeydown);
90
- };
91
-
92
- private handleFocusout(event: Event): void {
93
- this.focused = false;
94
- const target = event.composedPath()[0];
95
- if (target === this) {
96
- this.removeEventListener('keydown', this.handleKeydown);
97
- }
98
- }
99
-
100
- private handleKeydown(event: KeyboardEvent): void {
101
- const { code } = event;
102
- /* istanbul ignore else */
103
- if (code === 'Space') {
104
- this.toggleSelected();
105
- }
106
- }
107
-
108
- private handleSelectedChange(event: Event & { target: Checkbox }): void {
109
- const { target } = event;
110
- this.selected = target.checked;
111
- }
112
-
113
- public toggleSelected(): void {
114
- if (!this.toggles) {
115
- this.dispatchEvent(
116
- new Event('click', {
117
- bubbles: true,
118
- composed: true,
119
- })
120
- );
121
- return;
122
- }
123
- this.selected = !this.selected;
124
- const applyDefault = this.dispatchEvent(
125
- new Event('change', {
126
- cancelable: true,
127
- })
128
- );
129
- if (!applyDefault) {
130
- this.selected = !this.selected;
131
- }
132
- }
133
-
134
- protected get renderHeading(): TemplateResult {
135
- return html`
136
- <div class="title">
137
- <slot name="heading">
138
- ${this.heading}
139
- </slot>
140
- </div>
141
- `;
142
- }
143
-
144
- protected get renderPreviewImage(): TemplateResult {
145
- return html`
146
- <sp-asset id="preview" variant=${ifDefined(this.asset)}>
147
- <slot name="preview"></slot>
148
- </sp-asset>
149
- `;
150
- }
151
-
152
- private renderImage(): TemplateResult {
153
- if (this.horizontal) {
154
- return this.renderPreviewImage;
155
- }
156
- if (this.variant === 'standard') {
157
- return html`
158
- <sp-asset id="cover-photo" variant=${ifDefined(this.asset)}>
159
- <slot name="cover-photo"></slot>
160
- </sp-asset>
161
- `;
162
- }
163
- return this.renderPreviewImage;
164
- }
165
-
166
- protected render(): TemplateResult {
167
- return html`
168
- ${this.toggles
169
- ? html`
170
- <sp-quick-actions
171
- class="spectrum-QuickActions quickActions"
172
- >
173
- <sp-checkbox
174
- tabindex="-1"
175
- class="checkbox"
176
- @change=${this.handleSelectedChange}
177
- ?checked=${this.selected}
178
- ></sp-checkbox>
179
- </sp-quick-actions>
180
- `
181
- : html``}
182
- ${this.variant === 'quiet' && this.small
183
- ? html`
184
- <sp-quick-actions class="spectrum-QuickActions actions">
185
- <slot name="actions"></slot>
186
- </sp-quick-actions>
187
- `
188
- : html``}
189
- ${this.renderImage()}
190
- <div class="body">
191
- <div class="header">
192
- ${this.renderHeading}
193
- ${this.variant === 'gallery'
194
- ? html`
195
- <div class="subtitle">
196
- <slot name="subheading">
197
- ${this.subheading}
198
- </slot>
199
- </div>
200
- <slot name="description"></slot>
201
- `
202
- : html``}
203
- ${this.variant !== 'quiet' || !this.small
204
- ? html`
205
- <div class="actionButton">
206
- <slot name="actions"></slot>
207
- </div>
208
- `
209
- : html``}
210
- </div>
211
- ${this.variant !== 'gallery'
212
- ? html`
213
- <div class="content">
214
- <div class="subtitle">
215
- <slot name="subheading">
216
- ${this.subheading}
217
- </slot>
218
- </div>
219
- <slot name="description"></slot>
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
- .heading {
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-color:transparent;border-radius:var(--spectrum-card-border-radius,var(--spectrum-alias-border-radius-regular));text-decoration:none;border:var(--spectrum-card-border-size,var(--spectrum-alias-border-size-thin)) solid 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(: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-color: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%;background-color:var(--spectrum-card-coverphoto-background-color,var(--spectrum-global-color-gray-200));border-bottom:var(--spectrum-card-coverphoto-border-bottom-size,var(--spectrum-alias-border-size-thin)) solid var(--spectrum-card-coverphoto-border-color,var(--spectrum-global-color-gray-200))}:host([dir=ltr]) .body{padding-right:var(--spectrum-card-body-padding-right,var(--spectrum-global-dimension-size-300));padding-left:var(--spectrum-card-body-padding-left,var(--spectrum-global-dimension-size-300))}:host([dir=rtl]) .body{padding-left:var(--spectrum-card-body-padding-right,var(--spectrum-global-dimension-size-300));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));display:flex;align-items:baseline}.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{font-size:var(--spectrum-card-title-text-size,var(--spectrum-global-dimension-font-size-100));white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--spectrum-alias-text-color,var(--spectrum-global-color-gray-800))}: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))}.subtitle{letter-spacing:var(--spectrum-card-subtitle-letter-spacing,var(--spectrum-global-font-letter-spacing-medium));text-transform:uppercase}.subtitle,::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));margin-left:var(--spectrum-card-body-padding-left,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));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;border-color:var(--spectrum-card-border-color,var(--spectrum-global-color-gray-200))}.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));border-top-right-radius:0;border-bottom-left-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular));border-bottom-right-radius:0;border-right:var(--spectrum-card-border-size,var(--spectrum-alias-border-size-thin)) solid transparent}:host([dir=rtl][horizontal]) #preview{border-top-right-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular));border-top-left-radius:0;border-bottom-right-radius:var(--spectrum-card-quiet-border-radius,var(--spectrum-alias-border-radius-regular));border-bottom-left-radius:0;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);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))}: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(:hover){border-color:var(--spectrum-card-border-color-hover,var(--spectrum-global-color-gray-400))}: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))}: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][selected]),:host([variant=quiet].focus-visible),:host([variant=quiet][selected]){border-color:transparent;box-shadow:none}:host([variant=gallery].focus-visible) #preview,:host([variant=gallery][selected]) #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][selected]) #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))}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}.heading{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';