@zanichelli/albe-web-components 18.7.2 → 18.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-card.cjs.entry.js +1 -1
- package/dist/cjs/z-card.cjs.entry.js.map +1 -1
- package/dist/cjs/z-result-card.cjs.entry.js +7 -8
- package/dist/cjs/z-result-card.cjs.entry.js.map +1 -1
- package/dist/collection/components/result-card/z-result-card/index.js +23 -4
- package/dist/collection/components/result-card/z-result-card/index.js.map +1 -1
- package/dist/collection/components/result-card/z-result-card/styles.css +75 -0
- package/dist/collection/components/result-card/z-result-card/z-result-card.stories.js +43 -0
- package/dist/collection/components/result-card/z-result-card/z-result-card.stories.js.map +1 -1
- package/dist/collection/components/z-card/styles.css +3 -0
- package/dist/components/z-card.js +1 -1
- package/dist/components/z-card.js.map +1 -1
- package/dist/components/z-result-card.js +9 -9
- package/dist/components/z-result-card.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-card.entry.js +1 -1
- package/dist/esm/z-card.entry.js.map +1 -1
- package/dist/esm/z-result-card.entry.js +7 -8
- package/dist/esm/z-result-card.entry.js.map +1 -1
- package/dist/types/components/result-card/z-result-card/index.d.ts +5 -0
- package/dist/types/components/result-card/z-result-card/z-result-card.stories.d.ts +2 -0
- package/dist/types/components.d.ts +8 -0
- package/dist/web-components-library/p-ae6604b8.entry.js +2 -0
- package/dist/web-components-library/p-ae6604b8.entry.js.map +1 -0
- package/dist/web-components-library/p-ee695830.entry.js +2 -0
- package/dist/web-components-library/p-ee695830.entry.js.map +1 -0
- package/dist/web-components-library/web-components-library.css +0 -70
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/dist/web-components-library/web-components-library.esm.js.map +1 -1
- package/package.json +1 -1
- package/www/build/{p-3cb315f8.js → p-ab9c93f9.js} +1 -1
- package/www/build/p-ae6604b8.entry.js +2 -0
- package/www/build/p-ae6604b8.entry.js.map +1 -0
- package/www/build/{p-6f397468.css → p-dbdf8ca8.css} +0 -70
- package/www/build/p-ee695830.entry.js +2 -0
- package/www/build/p-ee695830.entry.js.map +1 -0
- package/www/build/web-components-library.css +0 -70
- package/www/build/web-components-library.esm.js +1 -1
- package/www/build/web-components-library.esm.js.map +1 -1
- package/www/index.html +1 -1
- package/dist/collection/components/css-components/z-cover/index.stories.js +0 -40
- package/dist/collection/components/css-components/z-cover/index.stories.js.map +0 -1
- package/dist/collection/components/css-components/z-cover/styles.css +0 -69
- package/dist/types/components/css-components/z-cover/index.stories.d.ts +0 -12
- package/dist/web-components-library/p-d47fcf2b.entry.js +0 -2
- package/dist/web-components-library/p-d47fcf2b.entry.js.map +0 -1
- package/dist/web-components-library/p-d5a77fd2.entry.js +0 -2
- package/dist/web-components-library/p-d5a77fd2.entry.js.map +0 -1
- package/www/build/p-d47fcf2b.entry.js +0 -2
- package/www/build/p-d47fcf2b.entry.js.map +0 -1
- package/www/build/p-d5a77fd2.entry.js +0 -2
- package/www/build/p-d5a77fd2.entry.js.map +0 -1
|
@@ -8,14 +8,15 @@ export class ZResultCard {
|
|
|
8
8
|
this.setTooltipTitle(this.subtitleRef);
|
|
9
9
|
};
|
|
10
10
|
this.renderOperaCard = () => {
|
|
11
|
-
|
|
11
|
+
const title = this.titleHtmlTag ? `<${this.titleHtmlTag}>${this.cardTitle}</${this.titleHtmlTag}>` : this.cardTitle;
|
|
12
|
+
return (h(Host, { tabIndex: 0 }, h("div", { class: `z-cover-container ${this.hasMultipleCovers ? "has-multiple" : ""}` }, h("div", { class: "z-cover-stack" }, this.hasMultipleCovers && (h("div", null, h("div", { class: "z-cover-shadow z-shadow-2" }), h("div", { class: "z-cover-shadow z-shadow-1" }))), h("div", { class: "z-cover-img" }, h("img", { src: this.cover || this.fallbackCover || defaultFallbackCover, alt: "", onError: () => {
|
|
12
13
|
if (this.fallbackCover) {
|
|
13
14
|
this.cover = this.fallbackCover;
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
17
|
this.cover = defaultFallbackCover;
|
|
17
18
|
}
|
|
18
|
-
} }))), h("div", { class: "info-container" }, this.authors && (h("span", { class: "authors-label", ref: (el) => (this.authorsRef = el) }, this.authors)), h("
|
|
19
|
+
} })))), h("div", { class: "info-container" }, this.authors && (h("span", { class: "authors-label", ref: (el) => (this.authorsRef = el) }, this.authors)), h("div", { class: "card-title", ref: (el) => (this.titleRef = el), innerHTML: title }), h("span", { class: "card-subtitle", ref: (el) => (this.subtitleRef = el) }, this.cardSubtitle), h("div", { class: "tags-container" }, h("slot", { name: "tags" })), h("div", { class: "volumes-label" }, h("slot", { name: "volumes" })))));
|
|
19
20
|
};
|
|
20
21
|
this.renderInfoCard = () => {
|
|
21
22
|
return (h(Host, { tabIndex: 0, class: "info-card" }, h("div", { class: "info-icon-column" }, h("div", { class: "info-icon-container" }, h("z-icon", { class: "info-icon", name: "link", width: 18, height: 18 }))), h("div", { class: "info-container" }, h("span", { class: "card-title info-title", ref: (el) => (this.titleRef = el) }, this.cardTitle), h("span", { class: "card-subtitle info-subtitle", ref: (el) => (this.subtitleRef = el) }, this.cardSubtitle))));
|
|
@@ -27,6 +28,7 @@ export class ZResultCard {
|
|
|
27
28
|
this.fallbackCover = undefined;
|
|
28
29
|
this.hasMultipleCovers = false;
|
|
29
30
|
this.isInfoCard = false;
|
|
31
|
+
this.titleHtmlTag = undefined;
|
|
30
32
|
}
|
|
31
33
|
setTooltipTitle(el) {
|
|
32
34
|
if (!el) {
|
|
@@ -72,12 +74,12 @@ export class ZResultCard {
|
|
|
72
74
|
static get encapsulation() { return "shadow"; }
|
|
73
75
|
static get originalStyleUrls() {
|
|
74
76
|
return {
|
|
75
|
-
"$": ["styles.css"
|
|
77
|
+
"$": ["styles.css"]
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
static get styleUrls() {
|
|
79
81
|
return {
|
|
80
|
-
"$": ["styles.css"
|
|
82
|
+
"$": ["styles.css"]
|
|
81
83
|
};
|
|
82
84
|
}
|
|
83
85
|
static get properties() {
|
|
@@ -202,6 +204,23 @@ export class ZResultCard {
|
|
|
202
204
|
"attribute": "is-info-card",
|
|
203
205
|
"reflect": false,
|
|
204
206
|
"defaultValue": "false"
|
|
207
|
+
},
|
|
208
|
+
"titleHtmlTag": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"mutable": false,
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "string",
|
|
213
|
+
"resolved": "string",
|
|
214
|
+
"references": {}
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"optional": true,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [],
|
|
220
|
+
"text": "[optional]\nUse for insert heading when needed."
|
|
221
|
+
},
|
|
222
|
+
"attribute": "title-html-tag",
|
|
223
|
+
"reflect": false
|
|
205
224
|
}
|
|
206
225
|
};
|
|
207
226
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/result-card/z-result-card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,oBAAoB,MAAM,kDAAkD,CAAC;AAOpF,MAAM,OAAO,WAAW;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/result-card/z-result-card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,oBAAoB,MAAM,kDAAkD,CAAC;AAOpF,MAAM,OAAO,WAAW;;QA8Fd,kBAAa,GAAG,GAAS,EAAE;YACjC,IAAI,CAAC,eAAe,CAAC,IAAI,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gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACxD,CAAC;IAED,oBAAoB;QAClB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3D,CAAC;IA+FD,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1E,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Host, Prop, h} from \"@stencil/core\";\nimport defaultFallbackCover from \"../../../assets/images/png/placeholder-cover.png\";\n\n@Component({\n tag: \"z-result-card\",\n styleUrls: [\"styles.css\"],\n shadow: true,\n})\nexport class ZResultCard {\n @Element() hostElement: HTMLZResultCardElement;\n\n /**\n * The title of the card.\n */\n @Prop()\n cardTitle: string;\n\n /**\n * The subtitle of the card.\n */\n @Prop()\n cardSubtitle: string;\n\n /**\n * The authors of the opera.\n */\n @Prop()\n authors?: string;\n\n /**\n * The URL of the cover image.\n * This is used to display the cover image of the opera.\n */\n @Prop()\n cover?: string;\n\n /** [optional] Fallback cover URL */\n @Prop()\n fallbackCover?: string;\n\n /**\n * Indicates whether the card has multiple covers.\n * This is used to apply specific styles when there are multiple covers.\n */\n @Prop()\n hasMultipleCovers = false;\n\n /**\n * Indicates whether the card is an info page.\n * This can be used to apply specific styles or behaviors for info pages.\n */\n @Prop()\n isInfoCard = false;\n\n /**\n * [optional]\n * Use for insert heading when needed.\n */\n @Prop()\n titleHtmlTag?: string;\n\n private authorsRef: HTMLElement;\n\n private titleRef: HTMLElement;\n\n private subtitleRef: HTMLElement;\n\n private setTooltipTitle(el: HTMLElement): void {\n if (!el) {\n return;\n }\n\n // Check if element uses line-clamp\n const style = window.getComputedStyle(el);\n const hasLineClamp = style.getPropertyValue(\"-webkit-line-clamp\") !== \"none\";\n\n let isTruncated;\n if (hasLineClamp) {\n // For elements with line-clamp, check if content height exceeds line-clamp height\n const lineHeight = parseInt(style.lineHeight);\n const maxLines = parseInt(style.getPropertyValue(\"-webkit-line-clamp\"));\n const maxHeight = lineHeight * maxLines;\n\n isTruncated = el.scrollHeight > maxHeight;\n } else {\n // Original check for elements without line-clamp\n isTruncated = el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight;\n }\n\n if (isTruncated) {\n el.setAttribute(\"title\", el.textContent.trim());\n } else {\n el.removeAttribute(\"title\");\n }\n }\n\n componentDidRender(): void {\n this.setTooltipTitle(this.authorsRef);\n this.setTooltipTitle(this.titleRef);\n this.setTooltipTitle(this.subtitleRef);\n }\n\n private resizeHandler = (): void => {\n this.setTooltipTitle(this.authorsRef);\n this.setTooltipTitle(this.titleRef);\n this.setTooltipTitle(this.subtitleRef);\n };\n\n componentDidLoad(): void {\n window.addEventListener(\"resize\", this.resizeHandler);\n }\n\n disconnectedCallback(): void {\n window.removeEventListener(\"resize\", this.resizeHandler);\n }\n\n private renderOperaCard = (): HTMLZResultCardElement => {\n const title = this.titleHtmlTag ? `<${this.titleHtmlTag}>${this.cardTitle}</${this.titleHtmlTag}>` : this.cardTitle;\n\n return (\n <Host tabIndex={0}>\n <div class={`z-cover-container ${this.hasMultipleCovers ? \"has-multiple\" : \"\"}`}>\n <div class=\"z-cover-stack\">\n {this.hasMultipleCovers && (\n <div>\n <div class=\"z-cover-shadow z-shadow-2\" />\n <div class=\"z-cover-shadow z-shadow-1\" />\n </div>\n )}\n <div class=\"z-cover-img\">\n <img\n src={this.cover || this.fallbackCover || defaultFallbackCover}\n alt=\"\"\n onError={() => {\n if (this.fallbackCover) {\n this.cover = this.fallbackCover;\n } else {\n this.cover = defaultFallbackCover;\n }\n }}\n />\n </div>\n </div>\n </div>\n <div class=\"info-container\">\n {this.authors && (\n <span\n class=\"authors-label\"\n ref={(el) => (this.authorsRef = el as HTMLElement)}\n >\n {this.authors}\n </span>\n )}\n <div\n class=\"card-title\"\n ref={(el) => (this.titleRef = el as HTMLElement)}\n innerHTML={title}\n ></div>\n <span\n class=\"card-subtitle\"\n ref={(el) => (this.subtitleRef = el as HTMLElement)}\n >\n {this.cardSubtitle}\n </span>\n <div class=\"tags-container\">\n <slot name=\"tags\"></slot>\n </div>\n <div class=\"volumes-label\">\n <slot name=\"volumes\"></slot>\n </div>\n </div>\n </Host>\n );\n };\n\n private renderInfoCard = (): HTMLZResultCardElement => {\n return (\n <Host\n tabIndex={0}\n class=\"info-card\"\n >\n <div class=\"info-icon-column\">\n <div class=\"info-icon-container\">\n <z-icon\n class=\"info-icon\"\n name=\"link\"\n width={18}\n height={18}\n />\n </div>\n </div>\n <div class=\"info-container\">\n <span\n class=\"card-title info-title\"\n ref={(el) => (this.titleRef = el as HTMLElement)}\n >\n {this.cardTitle}\n </span>\n <span\n class=\"card-subtitle info-subtitle\"\n ref={(el) => (this.subtitleRef = el as HTMLElement)}\n >\n {this.cardSubtitle}\n </span>\n </div>\n </Host>\n );\n };\n\n render(): HTMLZResultCardElement {\n return this.isInfoCard ? this.renderInfoCard() : this.renderOperaCard();\n }\n}\n"]}
|
|
@@ -17,6 +17,77 @@
|
|
|
17
17
|
outline: none;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.z-cover-container {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: flex;
|
|
23
|
+
width: 119px;
|
|
24
|
+
height: 158px;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.z-cover-stack {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Base sizes for single cover */
|
|
35
|
+
.z-cover-shadow,
|
|
36
|
+
.z-cover-img {
|
|
37
|
+
width: 117px;
|
|
38
|
+
height: 156px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Scaled sizes for multiple covers */
|
|
42
|
+
.z-cover-container.has-multiple .z-cover-shadow,
|
|
43
|
+
.z-cover-container.has-multiple .z-cover-img {
|
|
44
|
+
width: 105px;
|
|
45
|
+
height: 140px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.z-cover-shadow {
|
|
49
|
+
position: absolute;
|
|
50
|
+
z-index: 1;
|
|
51
|
+
background-color: var(--color-white);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.z-shadow-1 {
|
|
55
|
+
z-index: 0;
|
|
56
|
+
top: var(--space-unit);
|
|
57
|
+
right: 6px;
|
|
58
|
+
border: var(--border-size-small) solid black;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.z-shadow-2 {
|
|
62
|
+
z-index: 0;
|
|
63
|
+
top: calc(var(--space-unit) * 2);
|
|
64
|
+
right: 12px;
|
|
65
|
+
border: var(--border-size-small) solid black;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.z-cover-img {
|
|
69
|
+
position: absolute;
|
|
70
|
+
z-index: 0;
|
|
71
|
+
top: 0;
|
|
72
|
+
right: 0;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: start;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
border: var(--border-size-small) solid black;
|
|
77
|
+
background-color: var(--color-white);
|
|
78
|
+
object-fit: cover;
|
|
79
|
+
object-position: left;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.z-cover-img > img {
|
|
83
|
+
max-width: 100%;
|
|
84
|
+
max-height: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.z-cover-container.has-multiple .z-cover-img {
|
|
88
|
+
left: 12px;
|
|
89
|
+
}
|
|
90
|
+
|
|
20
91
|
:host(.info-card:focus:focus-visible) {
|
|
21
92
|
z-index: 1;
|
|
22
93
|
box-shadow: var(--shadow-focus-primary);
|
|
@@ -53,6 +124,10 @@
|
|
|
53
124
|
word-break: break-word;
|
|
54
125
|
}
|
|
55
126
|
|
|
127
|
+
.card-title > * {
|
|
128
|
+
all: unset;
|
|
129
|
+
}
|
|
130
|
+
|
|
56
131
|
.card-subtitle {
|
|
57
132
|
overflow: hidden;
|
|
58
133
|
color: var(--color-default-text);
|
|
@@ -22,6 +22,7 @@ const args = {
|
|
|
22
22
|
fallbackCover: "https://staticmy.zanichelli.it/copertine/dashboard/Dashboard_Book_Placeholder.jpg",
|
|
23
23
|
hasMultipleCovers: false,
|
|
24
24
|
isInfoCard: false,
|
|
25
|
+
titleHtmlTag: "h2",
|
|
25
26
|
};
|
|
26
27
|
export const SingleCover = {
|
|
27
28
|
args: Object.assign({}, args),
|
|
@@ -34,6 +35,25 @@ export const SingleCover = {
|
|
|
34
35
|
fallback-cover=${args.fallbackCover}
|
|
35
36
|
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
36
37
|
.isInfoCard=${args.isInfoCard}
|
|
38
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
39
|
+
>
|
|
40
|
+
<span slot="tags">Example tag</span>
|
|
41
|
+
<span slot="volumes">2 volumes</span>
|
|
42
|
+
</z-result-card>
|
|
43
|
+
`,
|
|
44
|
+
};
|
|
45
|
+
export const SingleCoverLateralSpaces = {
|
|
46
|
+
args: Object.assign({}, args),
|
|
47
|
+
render: (args) => html `
|
|
48
|
+
<z-result-card
|
|
49
|
+
.cardTitle=${args.cardTitle}
|
|
50
|
+
.cardSubtitle=${args.cardSubtitle}
|
|
51
|
+
.authors=${args.authors}
|
|
52
|
+
cover="https://statictestmy.zanichelli.it/catalogo/assets/small/m40003.9788808075475.jpg"
|
|
53
|
+
fallback-cover=${args.fallbackCover}
|
|
54
|
+
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
55
|
+
.isInfoCard=${args.isInfoCard}
|
|
56
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
37
57
|
>
|
|
38
58
|
<span slot="tags">Example tag</span>
|
|
39
59
|
<span slot="volumes">2 volumes</span>
|
|
@@ -51,6 +71,26 @@ export const MultipleCovers = {
|
|
|
51
71
|
fallback-cover=${args.fallbackCover}
|
|
52
72
|
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
53
73
|
.isInfoCard=${args.isInfoCard}
|
|
74
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
75
|
+
>
|
|
76
|
+
<span slot="tags">Example tag</span>
|
|
77
|
+
<span slot="tags">Example tag</span>
|
|
78
|
+
<span slot="volumes">2 volumes</span>
|
|
79
|
+
</z-result-card>
|
|
80
|
+
`,
|
|
81
|
+
};
|
|
82
|
+
export const MultipleCoversLateralSpaces = {
|
|
83
|
+
args: Object.assign(Object.assign({}, args), { hasMultipleCovers: true }),
|
|
84
|
+
render: (args) => html `
|
|
85
|
+
<z-result-card
|
|
86
|
+
.cardTitle=${args.cardTitle}
|
|
87
|
+
.cardSubtitle=${args.cardSubtitle}
|
|
88
|
+
.authors=${args.authors}
|
|
89
|
+
cover=https://statictestmy.zanichelli.it/catalogo/assets/small/m40003.9788808075475.jpg
|
|
90
|
+
fallback-cover=${args.fallbackCover}
|
|
91
|
+
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
92
|
+
.isInfoCard=${args.isInfoCard}
|
|
93
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
54
94
|
>
|
|
55
95
|
<span slot="tags">Example tag</span>
|
|
56
96
|
<span slot="tags">Example tag</span>
|
|
@@ -69,6 +109,7 @@ export const LongTitleAndSubtitle = {
|
|
|
69
109
|
fallback-cover=${args.fallbackCover}
|
|
70
110
|
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
71
111
|
.isInfoCard=${args.isInfoCard}
|
|
112
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
72
113
|
>
|
|
73
114
|
<span slot="tags">Example tag</span>
|
|
74
115
|
<span slot="volumes">2 volumes</span>
|
|
@@ -85,6 +126,7 @@ export const OnlyTitleAndSubtitle = {
|
|
|
85
126
|
fallback-cover=${args.fallbackCover}
|
|
86
127
|
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
87
128
|
.isInfoCard=${args.isInfoCard}
|
|
129
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
88
130
|
/>
|
|
89
131
|
`,
|
|
90
132
|
};
|
|
@@ -99,6 +141,7 @@ export const InfoCard = {
|
|
|
99
141
|
fallback-cover=${args.fallbackCover}
|
|
100
142
|
.hasMultipleCovers=${args.hasMultipleCovers}
|
|
101
143
|
.isInfoCard=${args.isInfoCard}
|
|
144
|
+
.titleHtmlTag=${args.titleHtmlTag}
|
|
102
145
|
/>
|
|
103
146
|
`,
|
|
104
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"z-result-card.stories.js","sourceRoot":"","sources":["../../../../../src/components/result-card/z-result-card/z-result-card.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,SAAS,CAAC;AAEjB,MAAM,SAAS,GAAS;IACtB,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE;QACR,SAAS,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAC5B,YAAY,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAC/B,OAAO,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAC1B,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QACxB,aAAa,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAChC,iBAAiB,EAAE,EAAC,OAAO,EAAE,SAAS,EAAC;QACvC,UAAU,EAAE,EAAC,OAAO,EAAE,SAAS,EAAC;KACjC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC;AAIzB,MAAM,IAAI,GAAG;IACX,SAAS,EAAE,OAAO;IAClB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,mEAAmE;IAC1E,aAAa,EAAE,mFAAmF;IAClG,iBAAiB,EAAE,KAAK;IACxB,UAAU,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"z-result-card.stories.js","sourceRoot":"","sources":["../../../../../src/components/result-card/z-result-card/z-result-card.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,SAAS,CAAC;AAEjB,MAAM,SAAS,GAAS;IACtB,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE;QACR,SAAS,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAC5B,YAAY,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAC/B,OAAO,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAC1B,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QACxB,aAAa,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC;QAChC,iBAAiB,EAAE,EAAC,OAAO,EAAE,SAAS,EAAC;QACvC,UAAU,EAAE,EAAC,OAAO,EAAE,SAAS,EAAC;KACjC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC;AAIzB,MAAM,IAAI,GAAG;IACX,SAAS,EAAE,OAAO;IAClB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,mEAAmE;IAC1E,aAAa,EAAE,mFAAmF;IAClG,iBAAiB,EAAE,KAAK;IACxB,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,IAAI,oBACC,IAAI,CACR;IAED,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;mBAEL,IAAI,CAAC,SAAS;sBACX,IAAI,CAAC,YAAY;iBACtB,IAAI,CAAC,OAAO;eACd,IAAI,CAA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ACzC,IAAI,kCACC,IAAI,KACP,SAAS,EACP,iKAAiK,EACnK,YAAY,EACV,uVAAuV,EACzV,iBAAiB,EAAE,IAAI,GACxB;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;mBAEL,IAAI,CAAC,SAAS;sBACX,IAAI,CAAC,YAAY;iBACtB,IAAI,CAAC,OAAO;eACd,IAAI,CAAC,KAAK;uBACF,IAAI,CAAC,aAAa;2BACd,IAAI,CAAC,iBAAiB;oBAC7B,IAAI,CAAC,UAAU;sBACb,IAAI,CAAC,YAAY;;;;;GAKpC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAU;IACzC,IAAI,kCACC,IAAI,KACP,MAAM,EAAE,SAAS,GAClB;IAED,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;mBAEL,IAAI,CAAC,SAAS;sBACX,IAAI,CAAC,YAAY;eACxB,IAAI,CAAC,KAAK;uBACF,IAAI,CAAC,aAAa;2BACd,IAAI,CAAC,iBAAiB;oBAC7B,IAAI,CAAC,UAAU;sBACb,IAAI,CAAC,YAAY;;GAEpC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,kCACC,IAAI,KACP,SAAS,EAAE,iBAAiB,EAC5B,YAAY,EACV,2OAA2O,EAC7O,UAAU,EAAE,IAAI,GACjB;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;mBAEL,IAAI,CAAC,SAAS;sBACX,IAAI,CAAC,YAAY;iBACtB,IAAI,CAAC,OAAO;eACd,IAAI,CAAC,KAAK;uBACF,IAAI,CAAC,aAAa;2BACd,IAAI,CAAC,iBAAiB;oBAC7B,IAAI,CAAC,UAAU;sBACb,IAAI,CAAC,YAAY;;GAEpC;CACF,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport \"./index\";\n\nconst StoryMeta: Meta = {\n title: \"ZResultCard\",\n component: \"z-result-card\",\n argTypes: {\n cardTitle: {control: \"text\"},\n cardSubtitle: {control: \"text\"},\n authors: {control: \"text\"},\n cover: {control: \"text\"},\n fallbackCover: {control: \"text\"},\n hasMultipleCovers: {control: \"boolean\"},\n isInfoCard: {control: \"boolean\"},\n },\n};\n\nexport default StoryMeta;\n\ntype Story = StoryObj;\n\nconst args = {\n cardTitle: \"Title\",\n cardSubtitle: \"Subtitle\",\n authors: \"John Doe\",\n cover: \"https://place.abh.ai/s3fs-public/placeholder/DSC_0199_400x400.JPG\",\n fallbackCover: \"https://staticmy.zanichelli.it/copertine/dashboard/Dashboard_Book_Placeholder.jpg\",\n hasMultipleCovers: false,\n isInfoCard: false,\n titleHtmlTag: \"h2\",\n};\n\nexport const SingleCover: Story = {\n args: {\n ...args,\n },\n\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .authors=${args.authors}\n .cover=${args.cover}\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n >\n <span slot=\"tags\">Example tag</span>\n <span slot=\"volumes\">2 volumes</span>\n </z-result-card>\n `,\n};\n\nexport const SingleCoverLateralSpaces: Story = {\n args: {\n ...args,\n },\n\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .authors=${args.authors}\n cover=\"https://statictestmy.zanichelli.it/catalogo/assets/small/m40003.9788808075475.jpg\"\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n >\n <span slot=\"tags\">Example tag</span>\n <span slot=\"volumes\">2 volumes</span>\n </z-result-card>\n `,\n};\n\nexport const MultipleCovers: Story = {\n args: {\n ...args,\n hasMultipleCovers: true,\n },\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .authors=${args.authors}\n .cover=${args.cover}\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n >\n <span slot=\"tags\">Example tag</span>\n <span slot=\"tags\">Example tag</span>\n <span slot=\"volumes\">2 volumes</span>\n </z-result-card>\n `,\n};\n\nexport const MultipleCoversLateralSpaces: Story = {\n args: {\n ...args,\n hasMultipleCovers: true,\n },\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .authors=${args.authors}\n cover=https://statictestmy.zanichelli.it/catalogo/assets/small/m40003.9788808075475.jpg\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n >\n <span slot=\"tags\">Example tag</span>\n <span slot=\"tags\">Example tag</span>\n <span slot=\"volumes\">2 volumes</span>\n </z-result-card>\n `,\n};\n\nexport const LongTitleAndSubtitle: Story = {\n args: {\n ...args,\n cardTitle:\n \"This is a very long title that should wrap to the next line if it exceeds the width of the card, it goes on two rows for desktop devices and one row for mobile\",\n cardSubtitle:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tincidunt maximus tellus, eget dapibus nulla blandit sed. Nullam augue ipsum, mattis sit amet diam ut, finibus posuere libero. Fusce nec erat eu risus fermentum mattis. Nunc volutpat viverra felis, eu iaculis ipsum tempus mattis. Phasellus euismod quam eget nisl pellentesque.\",\n hasMultipleCovers: true,\n },\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .authors=${args.authors}\n .cover=${args.cover}\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n >\n <span slot=\"tags\">Example tag</span>\n <span slot=\"volumes\">2 volumes</span>\n </z-result-card>\n `,\n};\n\nexport const OnlyTitleAndSubtitle: Story = {\n args: {\n ...args,\n author: undefined,\n },\n\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .cover=${args.cover}\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n />\n `,\n};\n\nexport const InfoCard: Story = {\n args: {\n ...args,\n cardTitle: \"Info Card Title\",\n cardSubtitle:\n \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tincidunt maximus tellus, eget dapibus nulla blandit sed. Nullam augue ipsum, mattis sit amet diam ut, finibus posuere libero. Fusce nec erat eu risus fermentum mattis.\",\n isInfoCard: true,\n },\n render: (args) => html`\n <z-result-card\n .cardTitle=${args.cardTitle}\n .cardSubtitle=${args.cardSubtitle}\n .authors=${args.authors}\n .cover=${args.cover}\n fallback-cover=${args.fallbackCover}\n .hasMultipleCovers=${args.hasMultipleCovers}\n .isInfoCard=${args.isInfoCard}\n .titleHtmlTag=${args.titleHtmlTag}\n />\n `,\n};\n"]}
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
|
|
|
2
2
|
import { C as CardVariant } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$2 } from './index9.js';
|
|
4
4
|
|
|
5
|
-
const stylesCss = ":host{--aspect-ratio:1.62;--z-card--border-color:var(--gray200);--z-card--color-cover-background:var(--color-surface01);--z-card--text-background:var(--color-surface01);--z-card--text-border-radius:none;--z-card--text-border:none;--z-card--text-padding:calc(var(--space-unit) * 2) var(--space-unit);position:relative;display:flex;flex-direction:column;font-family:var(--font-family-sans);font-weight:var(--font-rg)}*,::slotted(*){box-sizing:border-box}*:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host(:not([variant=\"overlay\"])) .cover-container{position:relative;width:100%}.cover-container{padding-bottom:calc(100% / var(--aspect-ratio))}::slotted([slot=\"cover\"]),.color-cover{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:center}.cover-container>z-icon{--z-icon-width:calc(var(--space-unit) * 11);--z-icon-height:var(--z-icon-width);position:absolute;top:calc(50% - calc(var(--z-icon-height) / 2));left:calc(50% - calc(var(--z-icon-width) / 2));fill:var(--color-primary01)}.color-cover{background-color:var(--z-card--color-cover-background)}.content{display:flex;flex-direction:column;padding-top:var(--space-unit)}.color-cover .cover-content{display:flex;height:100%;flex-direction:column;justify-content:flex-end;padding:var(--space-unit)}::slotted([slot=\"metadata\"]),::slotted([slot=\"title\"]),::slotted([slot=\"text\"]){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}::slotted([slot=\"title\"]:not(:last-child)),::slotted([slot=\"text\"]:not(:last-child)){margin-bottom:var(--space-unit)}::slotted([slot=\"title\"])::before{position:absolute;z-index:1;top:0;right:0;bottom:0;left:0;content:\"\"}::slotted([slot=\"metadata\"]){width:100%;-webkit-line-clamp:1;line-clamp:1;text-transform:uppercase}::slotted([slot=\"metadata\"]:not(:last-child)){margin:0 0 calc(var(--space-unit) * 0.25)}::slotted([slot=\"title\"]){margin:0;font-size:var(--font-size-3);font-weight:var(--font-sb);-webkit-line-clamp:2;line-clamp:2;text-decoration:none}::slotted([slot=\"title\"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary);outline:none}::slotted([slot=\"text\"]){width:100%;margin:0;-webkit-line-clamp:3;line-clamp:3}.actions{display:flex;align-items:center
|
|
5
|
+
const stylesCss = ":host{--aspect-ratio:1.62;--z-card--border-color:var(--gray200);--z-card--color-cover-background:var(--color-surface01);--z-card--text-background:var(--color-surface01);--z-card--text-border-radius:none;--z-card--text-border:none;--z-card--text-padding:calc(var(--space-unit) * 2) var(--space-unit);position:relative;display:flex;flex-direction:column;font-family:var(--font-family-sans);font-weight:var(--font-rg)}*,::slotted(*){box-sizing:border-box}*:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host(:not([variant=\"overlay\"])) .cover-container{position:relative;width:100%}.cover-container{padding-bottom:calc(100% / var(--aspect-ratio))}::slotted([slot=\"cover\"]),.color-cover{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:center}.cover-container>z-icon{--z-icon-width:calc(var(--space-unit) * 11);--z-icon-height:var(--z-icon-width);position:absolute;top:calc(50% - calc(var(--z-icon-height) / 2));left:calc(50% - calc(var(--z-icon-width) / 2));fill:var(--color-primary01)}.color-cover{background-color:var(--z-card--color-cover-background)}.content{display:flex;flex-direction:column;padding-top:var(--space-unit)}.color-cover .cover-content{display:flex;height:100%;flex-direction:column;justify-content:flex-end;padding:var(--space-unit)}::slotted([slot=\"metadata\"]),::slotted([slot=\"title\"]),::slotted([slot=\"text\"]){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}::slotted([slot=\"title\"]:not(:last-child)),::slotted([slot=\"text\"]:not(:last-child)){margin-bottom:var(--space-unit)}::slotted([slot=\"title\"])::before{position:absolute;z-index:1;top:0;right:0;bottom:0;left:0;content:\"\"}::slotted([slot=\"metadata\"]){width:100%;-webkit-line-clamp:1;line-clamp:1;text-transform:uppercase}::slotted([slot=\"metadata\"]:not(:last-child)){margin:0 0 calc(var(--space-unit) * 0.25)}::slotted([slot=\"title\"]){margin:0;font-size:var(--font-size-3);font-weight:var(--font-sb);-webkit-line-clamp:2;line-clamp:2;text-decoration:none}::slotted([slot=\"title\"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary);outline:none}::slotted([slot=\"text\"]){width:100%;margin:0;-webkit-line-clamp:3;line-clamp:3}.actions{display:flex;align-items:center}:host(:not([variant=\"overlay\"])) .actions{margin-top:auto}::slotted([slot=\"action\"]){position:relative;z-index:2}::slotted([slot=\"action\"]:not(:last-child)){margin-right:calc(var(--space-unit) * 2)}::slotted([slot=\"action\"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary);outline:none !important}:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible){box-shadow:none !important;outline:none !important}:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible)::before{box-shadow:var(--shadow-focus-primary)}:host([variant=\"text\"]){border:var(--z-card--text-border);background-color:var(--z-card--text-background);border-radius:var(--z-card--text-border-radius)}:host([variant=\"text\"]) [slot=\"text\"]::before{border-radius:var(--z-card--text-border-radius)}:host([show-shadow])>.content,:host([variant=\"border\"])>.content,:host([variant=\"shadow\"])>.content{height:100%;padding:var(--space-unit) var(--space-unit) calc(var(--space-unit) * 2)}:host([variant=\"text\"])>.content{padding:var(--z-card--text-padding)}:host([variant=\"border\"]){border:var(--border-size-small) solid var(--z-card--border-color)}:host([variant=\"border\"][clickable]:hover)>.content{background:var(--color-background)}:host([variant=\"border\"][clickable]:focus:focus-visible){box-shadow:var(--shadow-focus-primary)}:host([variant=\"border\"][clickable]:active){border-color:transparent}:host([variant=\"shadow\"]),:host([show-shadow]){box-shadow:var(--shadow-2)}:host([variant=\"shadow\"][clickable]:hover),:host([clickable][show-shadow]:hover){box-shadow:var(--shadow-4)}:host([variant=\"shadow\"][clickable]:focus:focus-visible),:host([clickable][show-shadow]:focus:focus-visible){box-shadow:var(--shadow-focus-primary)}:host([variant=\"shadow\"][clickable]:active),:host([clickable][show-shadow]:active){box-shadow:none}:host([variant=\"overlay\"]) .content{position:absolute;top:0;right:0;bottom:0;left:0;justify-content:flex-end;padding:var(--space-unit);background-image:linear-gradient(to top, rgb(0 0 0 / 100%), rgb(0 0 0 / 0%));color:var(--color-text-inverse);fill:var(--color-text-inverse)}";
|
|
6
6
|
const ZCardStyle0 = stylesCss;
|
|
7
7
|
|
|
8
8
|
const ZCard$1 = /*@__PURE__*/ proxyCustomElement(class ZCard extends HTMLElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"z-card.js","mappings":";;;;AAAA,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AAO,KAAK,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,IAAI,cAAQ,IAAI,EAAE,IAAI,CAAC,SAAS,GAAW;aAClG,EACA,CAAC,IAAI,CAAC,aAAa,IAAI,WAAK,KAAK,EAAC,aAAa,GAAO,CACnD,EACL,IAAI,CAAC,aAAa,EAAE,CAChB,EACP;SACH;QAED,OAAO,EAAC,IAAI,QAAE,IAAI,CAAC,oBAAoB,EAAE,CAAQ,CAAC;KACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ZCard"],"sources":["src/components/z-card/styles.css?tag=z-card&encapsulation=shadow","src/components/z-card/index.tsx"],"sourcesContent":[":host {\n --aspect-ratio: 1.62;\n --z-card--border-color: var(--gray200);\n --z-card--color-cover-background: var(--color-surface01);\n --z-card--text-background: var(--color-surface01);\n --z-card--text-border-radius: none;\n --z-card--text-border: none;\n --z-card--text-padding: calc(var(--space-unit) * 2) var(--space-unit);\n\n position: relative;\n display: flex;\n flex-direction: column;\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n*,\n::slotted(*) {\n box-sizing: border-box;\n}\n\n*:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n:host(:not([variant=\"overlay\"])) .cover-container {\n position: relative;\n width: 100%;\n}\n\n/* Old good trick with percentage padding to keep the aspect ratio.\nUnfortunately the `aspect-ratio` property is still experimental */\n.cover-container {\n padding-bottom: calc(100% / var(--aspect-ratio));\n}\n\n::slotted([slot=\"cover\"]),\n.color-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center;\n}\n\n.cover-container > z-icon {\n --z-icon-width: calc(var(--space-unit) * 11);\n --z-icon-height: var(--z-icon-width);\n\n position: absolute;\n top: calc(50% - calc(var(--z-icon-height) / 2));\n left: calc(50% - calc(var(--z-icon-width) / 2));\n fill: var(--color-primary01);\n}\n\n.color-cover {\n background-color: var(--z-card--color-cover-background);\n}\n\n.content {\n display: flex;\n flex-direction: column;\n padding-top: var(--space-unit);\n}\n\n.color-cover .cover-content {\n display: flex;\n height: 100%;\n flex-direction: column;\n justify-content: flex-end;\n padding: var(--space-unit);\n}\n\n/* Truncates overflowing text */\n::slotted([slot=\"metadata\"]),\n::slotted([slot=\"title\"]),\n::slotted([slot=\"text\"]) {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n}\n\n::slotted([slot=\"title\"]:not(:last-child)),\n::slotted([slot=\"text\"]:not(:last-child)) {\n margin-bottom: var(--space-unit);\n}\n\n::slotted([slot=\"title\"])::before {\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n content: \"\";\n}\n\n::slotted([slot=\"metadata\"]) {\n width: 100%;\n -webkit-line-clamp: 1;\n line-clamp: 1;\n text-transform: uppercase;\n}\n\n::slotted([slot=\"metadata\"]:not(:last-child)) {\n margin: 0 0 calc(var(--space-unit) * 0.25);\n}\n\n::slotted([slot=\"title\"]) {\n margin: 0;\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n -webkit-line-clamp: 2;\n line-clamp: 2;\n text-decoration: none;\n}\n\n::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n::slotted([slot=\"text\"]) {\n width: 100%;\n margin: 0;\n -webkit-line-clamp: 3;\n line-clamp: 3;\n}\n\n.actions {\n display: flex;\n align-items: center;\n margin-top: auto;\n}\n\n::slotted([slot=\"action\"]) {\n position: relative;\n z-index: 2;\n}\n\n::slotted([slot=\"action\"]:not(:last-child)) {\n margin-right: calc(var(--space-unit) * 2);\n}\n\n::slotted([slot=\"action\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n outline: none !important;\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: none !important;\n outline: none !important;\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible)::before {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"text\"]) {\n border: var(--z-card--text-border);\n background-color: var(--z-card--text-background);\n border-radius: var(--z-card--text-border-radius);\n}\n\n:host([variant=\"text\"]) [slot=\"text\"]::before {\n border-radius: var(--z-card--text-border-radius);\n}\n\n:host([show-shadow]) > .content,\n:host([variant=\"border\"]) > .content,\n:host([variant=\"shadow\"]) > .content {\n height: 100%;\n padding: var(--space-unit) var(--space-unit) calc(var(--space-unit) * 2);\n}\n\n:host([variant=\"text\"]) > .content {\n padding: var(--z-card--text-padding);\n}\n\n/* Border */\n:host([variant=\"border\"]) {\n border: var(--border-size-small) solid var(--z-card--border-color);\n}\n\n:host([variant=\"border\"][clickable]:hover) > .content {\n background: var(--color-background);\n}\n\n:host([variant=\"border\"][clickable]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"border\"][clickable]:active) {\n border-color: transparent;\n}\n\n/* Shadow */\n:host([variant=\"shadow\"]),\n:host([show-shadow]) {\n box-shadow: var(--shadow-2);\n}\n\n:host([variant=\"shadow\"][clickable]:hover),\n:host([clickable][show-shadow]:hover) {\n box-shadow: var(--shadow-4);\n}\n\n:host([variant=\"shadow\"][clickable]:focus:focus-visible),\n:host([clickable][show-shadow]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"shadow\"][clickable]:active),\n:host([clickable][show-shadow]:active) {\n box-shadow: none;\n}\n\n/* Overlay */\n:host([variant=\"overlay\"]) .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n justify-content: flex-end;\n padding: var(--space-unit);\n background-image: linear-gradient(to top, rgb(0 0 0 / 100%), rgb(0 0 0 / 0%));\n color: var(--color-text-inverse);\n fill: var(--color-text-inverse);\n}\n","import {Component, Element, Host, Prop, State, h} from \"@stencil/core\";\nimport {CardVariant} from \"../../beans\";\n\n/**\n * ZCard component.\n * The width of the card must be set by its container, following the grid indications of the design.\n *\n * @cssprop --aspect-ratio - Cover aspect ratio. Default: `1.62`\n * @cssprop --z-card--border-color - Default: `var(--gray200)`\n * @cssprop --z-card--color-cover-background - Cover color. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-background - Background color for the `text` variant. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-border-radius - Default: `none`\n * @cssprop --z-card--text-border - Configure CSS `border`. Default: `none`\n * @cssprop --z-card--text-padding - Configure CSS `padding`. Default: `none`\n * @slot cover - Image cover\n * @slot metadata - Metadata\n * @slot title - Using an `<a>` tag here will make the whole card clickable as if the link was wrapping it.\n * @slot text\n * @slot action - Interactive elements to place at the bottom of the card. To put non-interactive elements here when using an `<a>` tag in the `title` slot, and use this as a sort of \"footer\", set `z-index: 0` on each of those elements.\n */\n@Component({\n tag: \"z-card\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZCard {\n /**\n * Card variant.\n * Can be one of \"text\", \"border\", \"shadow\", \"overlay\".\n * Leave it undefined for the default card.\n */\n @Prop({reflect: true})\n variant: CardVariant;\n\n /** Name of the icon to place over the image cover */\n @Prop()\n coverIcon: string;\n\n /** Enable shadow. Default: false. */\n @Prop({reflect: true})\n showShadow = false;\n\n /**\n * Enable \"clickable\" styles like hover background and cursor, focus shadow on the whole card, etc.\n * Always set this to `true` when putting an `<a>` tag in the `title` slot.\n */\n @Prop({reflect: true})\n clickable = false;\n\n @Element() host: HTMLZCardElement;\n\n @State()\n hasCoverImage: boolean;\n\n componentWillLoad(): void {\n this.hasCoverImage = this.host.querySelector('[slot=\"cover\"]') !== null;\n }\n\n /**\n * Template for a card without image cover.\n * A colored background replaces the image and some data is moved over it.\n */\n private renderColorCoverCard(): HTMLDivElement[] {\n return [\n <div class=\"cover-container\">\n <div class=\"color-cover\">\n <div class=\"cover-content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n </div>\n </div>\n </div>,\n <div class=\"content\">\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>,\n ];\n }\n\n /**\n * Template for the content.\n */\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n );\n }\n\n render(): HTMLZCardElement {\n if (this.variant === CardVariant.TEXT) {\n return <Host>{this.renderContent()}</Host>;\n }\n\n if (this.variant === CardVariant.OVERLAY || this.hasCoverImage) {\n return (\n <Host>\n <div class=\"cover-container\">\n {this.hasCoverImage && [\n <slot name=\"cover\"></slot>,\n this.variant !== CardVariant.OVERLAY && this.coverIcon && <z-icon name={this.coverIcon}></z-icon>,\n ]}\n {!this.hasCoverImage && <div class=\"color-cover\"></div>}\n </div>\n {this.renderContent()}\n </Host>\n );\n }\n\n return <Host>{this.renderColorCoverCard()}</Host>;\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"z-card.js","mappings":";;;;AAAA,MAAM,SAAS,GAAG,myIAAmyI,CAAC;AACtzI,oBAAe,SAAS;;MCwBXA,OAAK;;;;;;;0BAeH,KAAK;yBAON,KAAK;;;IAOjB,iBAAiB;QACf,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;KACzE;;;;;IAMO,oBAAoB;QAC1B,OAAO;YACL,WAAK,KAAK,EAAC,iBAAiB,IAC1B,WAAK,KAAK,EAAC,aAAa,IACtB,WAAK,KAAK,EAAC,eAAe,IACxB,YAAM,IAAI,EAAC,UAAU,GAAQ,EAC7B,YAAM,IAAI,EAAC,OAAO,GAAQ,CACtB,CACF,CACF;YACN,WAAK,KAAK,EAAC,SAAS,IAClB,YAAM,IAAI,EAAC,MAAM,GAAQ,EACzB,WAAK,KAAK,EAAC,SAAS,IAClB,YAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF;SACP,CAAC;KACH;;;;IAKO,aAAa;QACnB,QACE,WAAK,KAAK,EAAC,SAAS,IAClB,YAAM,IAAI,EAAC,UAAU,GAAQ,EAC7B,YAAM,IAAI,EAAC,OAAO,GAAQ,EAC1B,YAAM,IAAI,EAAC,MAAM,GAAQ,EACzB,WAAK,KAAK,EAAC,SAAS,IAClB,YAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF,EACN;KACH;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,OAAO,KAAK,WAAW,CAAC,IAAI,EAAE;YACrC,OAAO,EAAC,IAAI,QAAE,IAAI,CAAC,aAAa,EAAE,CAAQ,CAAC;SAC5C;QAED,IAAI,IAAI,CAAC,OAAO,KAAK,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE;YAC9D,QACE,EAAC,IAAI,QACH,WAAK,KAAK,EAAC,iBAAiB,IACzB,IAAI,CAAC,aAAa,IAAI;gBACrB,YAAM,IAAI,EAAC,OAAO,GAAQ;gBAC1B,IAAI,CAAC,OAAO,KAAK,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,IAAI,cAAQ,IAAI,EAAE,IAAI,CAAC,SAAS,GAAW;aAClG,EACA,CAAC,IAAI,CAAC,aAAa,IAAI,WAAK,KAAK,EAAC,aAAa,GAAO,CACnD,EACL,IAAI,CAAC,aAAa,EAAE,CAChB,EACP;SACH;QAED,OAAO,EAAC,IAAI,QAAE,IAAI,CAAC,oBAAoB,EAAE,CAAQ,CAAC;KACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ZCard"],"sources":["src/components/z-card/styles.css?tag=z-card&encapsulation=shadow","src/components/z-card/index.tsx"],"sourcesContent":[":host {\n --aspect-ratio: 1.62;\n --z-card--border-color: var(--gray200);\n --z-card--color-cover-background: var(--color-surface01);\n --z-card--text-background: var(--color-surface01);\n --z-card--text-border-radius: none;\n --z-card--text-border: none;\n --z-card--text-padding: calc(var(--space-unit) * 2) var(--space-unit);\n\n position: relative;\n display: flex;\n flex-direction: column;\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n*,\n::slotted(*) {\n box-sizing: border-box;\n}\n\n*:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n:host(:not([variant=\"overlay\"])) .cover-container {\n position: relative;\n width: 100%;\n}\n\n/* Old good trick with percentage padding to keep the aspect ratio.\nUnfortunately the `aspect-ratio` property is still experimental */\n.cover-container {\n padding-bottom: calc(100% / var(--aspect-ratio));\n}\n\n::slotted([slot=\"cover\"]),\n.color-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center;\n}\n\n.cover-container > z-icon {\n --z-icon-width: calc(var(--space-unit) * 11);\n --z-icon-height: var(--z-icon-width);\n\n position: absolute;\n top: calc(50% - calc(var(--z-icon-height) / 2));\n left: calc(50% - calc(var(--z-icon-width) / 2));\n fill: var(--color-primary01);\n}\n\n.color-cover {\n background-color: var(--z-card--color-cover-background);\n}\n\n.content {\n display: flex;\n flex-direction: column;\n padding-top: var(--space-unit);\n}\n\n.color-cover .cover-content {\n display: flex;\n height: 100%;\n flex-direction: column;\n justify-content: flex-end;\n padding: var(--space-unit);\n}\n\n/* Truncates overflowing text */\n::slotted([slot=\"metadata\"]),\n::slotted([slot=\"title\"]),\n::slotted([slot=\"text\"]) {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n}\n\n::slotted([slot=\"title\"]:not(:last-child)),\n::slotted([slot=\"text\"]:not(:last-child)) {\n margin-bottom: var(--space-unit);\n}\n\n::slotted([slot=\"title\"])::before {\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n content: \"\";\n}\n\n::slotted([slot=\"metadata\"]) {\n width: 100%;\n -webkit-line-clamp: 1;\n line-clamp: 1;\n text-transform: uppercase;\n}\n\n::slotted([slot=\"metadata\"]:not(:last-child)) {\n margin: 0 0 calc(var(--space-unit) * 0.25);\n}\n\n::slotted([slot=\"title\"]) {\n margin: 0;\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n -webkit-line-clamp: 2;\n line-clamp: 2;\n text-decoration: none;\n}\n\n::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n::slotted([slot=\"text\"]) {\n width: 100%;\n margin: 0;\n -webkit-line-clamp: 3;\n line-clamp: 3;\n}\n\n.actions {\n display: flex;\n align-items: center;\n}\n\n:host(:not([variant=\"overlay\"])) .actions {\n margin-top: auto;\n}\n\n::slotted([slot=\"action\"]) {\n position: relative;\n z-index: 2;\n}\n\n::slotted([slot=\"action\"]:not(:last-child)) {\n margin-right: calc(var(--space-unit) * 2);\n}\n\n::slotted([slot=\"action\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n outline: none !important;\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: none !important;\n outline: none !important;\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible)::before {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"text\"]) {\n border: var(--z-card--text-border);\n background-color: var(--z-card--text-background);\n border-radius: var(--z-card--text-border-radius);\n}\n\n:host([variant=\"text\"]) [slot=\"text\"]::before {\n border-radius: var(--z-card--text-border-radius);\n}\n\n:host([show-shadow]) > .content,\n:host([variant=\"border\"]) > .content,\n:host([variant=\"shadow\"]) > .content {\n height: 100%;\n padding: var(--space-unit) var(--space-unit) calc(var(--space-unit) * 2);\n}\n\n:host([variant=\"text\"]) > .content {\n padding: var(--z-card--text-padding);\n}\n\n/* Border */\n:host([variant=\"border\"]) {\n border: var(--border-size-small) solid var(--z-card--border-color);\n}\n\n:host([variant=\"border\"][clickable]:hover) > .content {\n background: var(--color-background);\n}\n\n:host([variant=\"border\"][clickable]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"border\"][clickable]:active) {\n border-color: transparent;\n}\n\n/* Shadow */\n:host([variant=\"shadow\"]),\n:host([show-shadow]) {\n box-shadow: var(--shadow-2);\n}\n\n:host([variant=\"shadow\"][clickable]:hover),\n:host([clickable][show-shadow]:hover) {\n box-shadow: var(--shadow-4);\n}\n\n:host([variant=\"shadow\"][clickable]:focus:focus-visible),\n:host([clickable][show-shadow]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"shadow\"][clickable]:active),\n:host([clickable][show-shadow]:active) {\n box-shadow: none;\n}\n\n/* Overlay */\n:host([variant=\"overlay\"]) .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n justify-content: flex-end;\n padding: var(--space-unit);\n background-image: linear-gradient(to top, rgb(0 0 0 / 100%), rgb(0 0 0 / 0%));\n color: var(--color-text-inverse);\n fill: var(--color-text-inverse);\n}\n","import {Component, Element, Host, Prop, State, h} from \"@stencil/core\";\nimport {CardVariant} from \"../../beans\";\n\n/**\n * ZCard component.\n * The width of the card must be set by its container, following the grid indications of the design.\n *\n * @cssprop --aspect-ratio - Cover aspect ratio. Default: `1.62`\n * @cssprop --z-card--border-color - Default: `var(--gray200)`\n * @cssprop --z-card--color-cover-background - Cover color. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-background - Background color for the `text` variant. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-border-radius - Default: `none`\n * @cssprop --z-card--text-border - Configure CSS `border`. Default: `none`\n * @cssprop --z-card--text-padding - Configure CSS `padding`. Default: `none`\n * @slot cover - Image cover\n * @slot metadata - Metadata\n * @slot title - Using an `<a>` tag here will make the whole card clickable as if the link was wrapping it.\n * @slot text\n * @slot action - Interactive elements to place at the bottom of the card. To put non-interactive elements here when using an `<a>` tag in the `title` slot, and use this as a sort of \"footer\", set `z-index: 0` on each of those elements.\n */\n@Component({\n tag: \"z-card\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZCard {\n /**\n * Card variant.\n * Can be one of \"text\", \"border\", \"shadow\", \"overlay\".\n * Leave it undefined for the default card.\n */\n @Prop({reflect: true})\n variant: CardVariant;\n\n /** Name of the icon to place over the image cover */\n @Prop()\n coverIcon: string;\n\n /** Enable shadow. Default: false. */\n @Prop({reflect: true})\n showShadow = false;\n\n /**\n * Enable \"clickable\" styles like hover background and cursor, focus shadow on the whole card, etc.\n * Always set this to `true` when putting an `<a>` tag in the `title` slot.\n */\n @Prop({reflect: true})\n clickable = false;\n\n @Element() host: HTMLZCardElement;\n\n @State()\n hasCoverImage: boolean;\n\n componentWillLoad(): void {\n this.hasCoverImage = this.host.querySelector('[slot=\"cover\"]') !== null;\n }\n\n /**\n * Template for a card without image cover.\n * A colored background replaces the image and some data is moved over it.\n */\n private renderColorCoverCard(): HTMLDivElement[] {\n return [\n <div class=\"cover-container\">\n <div class=\"color-cover\">\n <div class=\"cover-content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n </div>\n </div>\n </div>,\n <div class=\"content\">\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>,\n ];\n }\n\n /**\n * Template for the content.\n */\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n );\n }\n\n render(): HTMLZCardElement {\n if (this.variant === CardVariant.TEXT) {\n return <Host>{this.renderContent()}</Host>;\n }\n\n if (this.variant === CardVariant.OVERLAY || this.hasCoverImage) {\n return (\n <Host>\n <div class=\"cover-container\">\n {this.hasCoverImage && [\n <slot name=\"cover\"></slot>,\n this.variant !== CardVariant.OVERLAY && this.coverIcon && <z-icon name={this.coverIcon}></z-icon>,\n ]}\n {!this.hasCoverImage && <div class=\"color-cover\"></div>}\n </div>\n {this.renderContent()}\n </Host>\n );\n }\n\n return <Host>{this.renderColorCoverCard()}</Host>;\n }\n}\n"],"version":3}
|
|
@@ -2,11 +2,8 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
|
|
|
2
2
|
import { i as img } from './placeholder-cover.js';
|
|
3
3
|
import { d as defineCustomElement$2 } from './index9.js';
|
|
4
4
|
|
|
5
|
-
const stylesCss
|
|
6
|
-
const ZResultCardStyle0 = stylesCss
|
|
7
|
-
|
|
8
|
-
const stylesCss = ".z-cover-container{position:relative;display:flex;width:119px;height:158px;align-items:center;justify-items:center}.z-cover-stack{width:100%;height:100%}.z-cover-shadow,.z-cover-img{width:117px;min-width:117px;max-width:117px;height:156px;min-height:156px;max-height:156px}.z-cover-container.has-multiple .z-cover-shadow,.z-cover-container.has-multiple .z-cover-img{width:105px;min-width:105px;max-width:105px;height:140px;min-height:140px;max-height:140px}.z-cover-shadow{position:absolute;z-index:1;background-color:var(--color-white)}.z-shadow-1{z-index:0;top:var(--space-unit);right:6px;border:var(--border-size-small) solid black}.z-shadow-2{z-index:0;top:calc(var(--space-unit) * 2);right:12px;border:var(--border-size-small) solid black}.z-cover-img{position:absolute;z-index:0;top:0;right:0;border:var(--border-size-small) solid black;object-fit:cover;object-position:left}.z-cover-container.has-multiple .z-cover-img{left:12px}";
|
|
9
|
-
const ZResultCardStyle1 = stylesCss;
|
|
5
|
+
const stylesCss = ":host{display:flex;overflow:hidden;min-width:0;height:calc(174px - var(--space-unit) * 2);max-height:calc(174px - var(--space-unit) * 2);padding:var(--space-unit);border:var(--border-size-medium) solid var(--color-surface02);border-radius:var(--border-size-large);cursor:pointer;font-family:var(--font-family-sans)}:host(:focus:focus-visible){z-index:1;box-shadow:var(--shadow-focus-primary);outline:none}.z-cover-container{position:relative;display:flex;width:119px;height:158px;align-items:center;justify-items:center}.z-cover-stack{width:100%;height:100%}.z-cover-shadow,.z-cover-img{width:117px;height:156px}.z-cover-container.has-multiple .z-cover-shadow,.z-cover-container.has-multiple .z-cover-img{width:105px;height:140px}.z-cover-shadow{position:absolute;z-index:1;background-color:var(--color-white)}.z-shadow-1{z-index:0;top:var(--space-unit);right:6px;border:var(--border-size-small) solid black}.z-shadow-2{z-index:0;top:calc(var(--space-unit) * 2);right:12px;border:var(--border-size-small) solid black}.z-cover-img{position:absolute;z-index:0;top:0;right:0;display:flex;align-items:start;justify-content:center;border:var(--border-size-small) solid black;background-color:var(--color-white);object-fit:cover;object-position:left}.z-cover-img>img{max-width:100%;max-height:100%}.z-cover-container.has-multiple .z-cover-img{left:12px}:host(.info-card:focus:focus-visible){z-index:1;box-shadow:var(--shadow-focus-primary);outline:none}.info-container{display:flex;overflow:hidden;min-width:0;flex:1;flex-direction:column;padding-left:calc(var(--space-unit) * 2)}.authors-label{overflow:hidden;color:var(--color-default-text);font-size:var(--font-size-2);font-weight:var(--font-rg);text-overflow:ellipsis;white-space:nowrap}.card-title{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;font-size:var(--font-size-3);font-weight:var(--font-bd);-webkit-line-clamp:2;line-clamp:2;line-height:1.5;word-break:break-word}.card-title>*{all:unset}.card-subtitle{overflow:hidden;color:var(--color-default-text);text-overflow:ellipsis;white-space:nowrap}.card-subtitle.info-subtitle{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;line-height:1.2;white-space:normal;word-break:break-word}.tags-container{display:flex;max-width:100%;flex-wrap:wrap;margin-top:calc(var(--space-unit) * 2);gap:var(--space-unit)}.volumes-label{display:flex;height:auto;flex-direction:column;margin-top:auto;color:var(--color-default-text);font-size:var(--font-size-1)}:host(.info-card){display:flex;height:calc(76px - var(--space-unit) * 2);max-height:calc(76px - var(--space-unit) * 2)}.info-icon-column{display:flex;width:50px;height:100%;align-items:center;justify-content:center}.info-icon-container{display:flex;width:34px;height:34px;align-items:center;justify-content:center;margin-bottom:calc(var(--space-unit) * 3);background-color:var(--gray50);border-radius:var(--border-size-large)}.card-title.info-title{display:-webkit-box;overflow:hidden;min-width:0;max-width:100%;max-height:2.4em;margin-top:0;margin-bottom:4px;-webkit-box-orient:vertical;font-size:var(--font-size-3);font-weight:var(--font-bd);-webkit-line-clamp:1;line-clamp:1;line-height:1.2;word-break:break-word}.info-icon{width:18px;height:18px;color:var(--color-default-text)}@media (max-width: 768px){.card-title{display:block;overflow:hidden;line-height:normal;text-overflow:ellipsis;white-space:nowrap}}";
|
|
6
|
+
const ZResultCardStyle0 = stylesCss;
|
|
10
7
|
|
|
11
8
|
const ZResultCard$1 = /*@__PURE__*/ proxyCustomElement(class ZResultCard extends HTMLElement {
|
|
12
9
|
constructor() {
|
|
@@ -19,14 +16,15 @@ const ZResultCard$1 = /*@__PURE__*/ proxyCustomElement(class ZResultCard extends
|
|
|
19
16
|
this.setTooltipTitle(this.subtitleRef);
|
|
20
17
|
};
|
|
21
18
|
this.renderOperaCard = () => {
|
|
22
|
-
|
|
19
|
+
const title = this.titleHtmlTag ? `<${this.titleHtmlTag}>${this.cardTitle}</${this.titleHtmlTag}>` : this.cardTitle;
|
|
20
|
+
return (h(Host, { tabIndex: 0 }, h("div", { class: `z-cover-container ${this.hasMultipleCovers ? "has-multiple" : ""}` }, h("div", { class: "z-cover-stack" }, this.hasMultipleCovers && (h("div", null, h("div", { class: "z-cover-shadow z-shadow-2" }), h("div", { class: "z-cover-shadow z-shadow-1" }))), h("div", { class: "z-cover-img" }, h("img", { src: this.cover || this.fallbackCover || img, alt: "", onError: () => {
|
|
23
21
|
if (this.fallbackCover) {
|
|
24
22
|
this.cover = this.fallbackCover;
|
|
25
23
|
}
|
|
26
24
|
else {
|
|
27
25
|
this.cover = img;
|
|
28
26
|
}
|
|
29
|
-
} }))), h("div", { class: "info-container" }, this.authors && (h("span", { class: "authors-label", ref: (el) => (this.authorsRef = el) }, this.authors)), h("
|
|
27
|
+
} })))), h("div", { class: "info-container" }, this.authors && (h("span", { class: "authors-label", ref: (el) => (this.authorsRef = el) }, this.authors)), h("div", { class: "card-title", ref: (el) => (this.titleRef = el), innerHTML: title }), h("span", { class: "card-subtitle", ref: (el) => (this.subtitleRef = el) }, this.cardSubtitle), h("div", { class: "tags-container" }, h("slot", { name: "tags" })), h("div", { class: "volumes-label" }, h("slot", { name: "volumes" })))));
|
|
30
28
|
};
|
|
31
29
|
this.renderInfoCard = () => {
|
|
32
30
|
return (h(Host, { tabIndex: 0, class: "info-card" }, h("div", { class: "info-icon-column" }, h("div", { class: "info-icon-container" }, h("z-icon", { class: "info-icon", name: "link", width: 18, height: 18 }))), h("div", { class: "info-container" }, h("span", { class: "card-title info-title", ref: (el) => (this.titleRef = el) }, this.cardTitle), h("span", { class: "card-subtitle info-subtitle", ref: (el) => (this.subtitleRef = el) }, this.cardSubtitle))));
|
|
@@ -38,6 +36,7 @@ const ZResultCard$1 = /*@__PURE__*/ proxyCustomElement(class ZResultCard extends
|
|
|
38
36
|
this.fallbackCover = undefined;
|
|
39
37
|
this.hasMultipleCovers = false;
|
|
40
38
|
this.isInfoCard = false;
|
|
39
|
+
this.titleHtmlTag = undefined;
|
|
41
40
|
}
|
|
42
41
|
setTooltipTitle(el) {
|
|
43
42
|
if (!el) {
|
|
@@ -80,7 +79,7 @@ const ZResultCard$1 = /*@__PURE__*/ proxyCustomElement(class ZResultCard extends
|
|
|
80
79
|
return this.isInfoCard ? this.renderInfoCard() : this.renderOperaCard();
|
|
81
80
|
}
|
|
82
81
|
get hostElement() { return this; }
|
|
83
|
-
static get style() { return ZResultCardStyle0
|
|
82
|
+
static get style() { return ZResultCardStyle0; }
|
|
84
83
|
}, [1, "z-result-card", {
|
|
85
84
|
"cardTitle": [1, "card-title"],
|
|
86
85
|
"cardSubtitle": [1, "card-subtitle"],
|
|
@@ -88,7 +87,8 @@ const ZResultCard$1 = /*@__PURE__*/ proxyCustomElement(class ZResultCard extends
|
|
|
88
87
|
"cover": [1],
|
|
89
88
|
"fallbackCover": [1, "fallback-cover"],
|
|
90
89
|
"hasMultipleCovers": [4, "has-multiple-covers"],
|
|
91
|
-
"isInfoCard": [4, "is-info-card"]
|
|
90
|
+
"isInfoCard": [4, "is-info-card"],
|
|
91
|
+
"titleHtmlTag": [1, "title-html-tag"]
|
|
92
92
|
}]);
|
|
93
93
|
function defineCustomElement$1() {
|
|
94
94
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"z-result-card.js","mappings":";;;;AAAA,MAAMA,WAAS,GAAG,25EAA25E,CAAC;AAC96E,0BAAeA,WAAS;;ACDxB,MAAM,SAAS,GAAG,06BAA06B,CAAC;AAC77B,0BAAe,SAAS;;MCOXC,aAAW;;;;;QAuFd,kBAAa,GAAG;YACtB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACxC,CAAC;QAUM,oBAAe,GAAG;YACxB,QACE,EAAC,IAAI,IAAC,QAAQ,EAAE,CAAC,IACf,WAAK,KAAK,EAAE,qBAAqB,IAAI,CAAC,iBAAiB,GAAG,cAAc,GAAG,EAAE,EAAE,IAC7E,WAAK,KAAK,EAAC,eAAe,IACvB,IAAI,CAAC,iBAAiB,KACrB,eACE,WAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,WAAK,KAAK,EAAC,2BAA2B,GAAG,CACrC,CACP,EACD,WACE,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,GAAG,EAAC,YAAY,EAChB,KAAK,EAAC,aAAa,EACnB,OAAO,EAAE;oBACP,IAAI,IAAI,CAAC,aAAa,EAAE;wBACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;qBACjC;yBAAM;wBACL,IAAI,CAAC,KAAK,GAAGC,GAAoB,CAAC;qBACnC;iBACF,GACD,CACE,CACF,EACN,WAAK,KAAK,EAAC,gBAAgB,IACxB,IAAI,CAAC,OAAO,KACX,YACE,KAAK,EAAC,eAAe,EACrB,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,UA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C,eAAe,EAAE,CAAC;KACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["stylesCss","ZResultCard","defaultFallbackCover"],"sources":["src/components/result-card/z-result-card/styles.css?tag=z-result-card&encapsulation=shadow","src/components/css-components/z-cover/styles.css?tag=z-result-card&encapsulation=shadow","src/components/result-card/z-result-card/index.tsx"],"sourcesContent":[":host {\n display: flex;\n overflow: hidden;\n min-width: 0;\n height: calc(174px - var(--space-unit) * 2);\n max-height: calc(174px - var(--space-unit) * 2);\n padding: var(--space-unit);\n border: var(--border-size-medium) solid var(--color-surface02);\n border-radius: var(--border-size-large);\n cursor: pointer;\n font-family: var(--font-family-sans);\n}\n\n:host(:focus:focus-visible) {\n z-index: 1;\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n:host(.info-card:focus:focus-visible) {\n z-index: 1;\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.info-container {\n display: flex;\n overflow: hidden;\n min-width: 0;\n flex: 1;\n flex-direction: column;\n padding-left: calc(var(--space-unit) * 2);\n}\n\n.authors-label {\n overflow: hidden;\n color: var(--color-default-text);\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.card-title {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n font-size: var(--font-size-3);\n font-weight: var(--font-bd);\n -webkit-line-clamp: 2;\n line-clamp: 2;\n line-height: 1.5;\n word-break: break-word;\n}\n\n.card-subtitle {\n overflow: hidden;\n color: var(--color-default-text);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.card-subtitle.info-subtitle {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n line-height: 1.2;\n white-space: normal;\n word-break: break-word;\n}\n\n.tags-container {\n display: flex;\n max-width: 100%;\n flex-wrap: wrap;\n margin-top: calc(var(--space-unit) * 2);\n gap: var(--space-unit);\n}\n\n.volumes-label {\n display: flex;\n height: auto;\n flex-direction: column;\n margin-top: auto;\n color: var(--color-default-text);\n font-size: var(--font-size-1);\n}\n\n:host(.info-card) {\n display: flex;\n height: calc(76px - var(--space-unit) * 2);\n max-height: calc(76px - var(--space-unit) * 2);\n}\n\n.info-icon-column {\n display: flex;\n width: 50px;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n\n.info-icon-container {\n display: flex;\n width: 34px;\n height: 34px;\n align-items: center;\n justify-content: center;\n margin-bottom: calc(var(--space-unit) * 3);\n background-color: var(--gray50);\n border-radius: var(--border-size-large);\n}\n\n.card-title.info-title {\n display: -webkit-box;\n overflow: hidden;\n min-width: 0;\n max-width: 100%;\n max-height: 2.4em;\n margin-top: 0;\n margin-bottom: 4px;\n -webkit-box-orient: vertical;\n font-size: var(--font-size-3);\n font-weight: var(--font-bd);\n -webkit-line-clamp: 1;\n line-clamp: 1;\n line-height: 1.2;\n word-break: break-word;\n}\n\n.info-icon {\n width: 18px;\n height: 18px;\n color: var(--color-default-text);\n}\n\n@media (max-width: 768px) {\n .card-title {\n display: block;\n overflow: hidden;\n line-height: normal;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n}\n",".z-cover-container {\n position: relative;\n display: flex;\n width: 119px;\n height: 158px;\n align-items: center;\n justify-items: center;\n}\n\n.z-cover-stack {\n width: 100%;\n height: 100%;\n}\n\n/* Base sizes for single cover */\n.z-cover-shadow,\n.z-cover-img {\n width: 117px;\n min-width: 117px;\n max-width: 117px;\n height: 156px;\n min-height: 156px;\n max-height: 156px;\n}\n\n/* Scaled sizes for multiple covers */\n.z-cover-container.has-multiple .z-cover-shadow,\n.z-cover-container.has-multiple .z-cover-img {\n width: 105px;\n min-width: 105px;\n max-width: 105px;\n height: 140px;\n min-height: 140px;\n max-height: 140px;\n}\n\n.z-cover-shadow {\n position: absolute;\n z-index: 1;\n background-color: var(--color-white);\n}\n\n.z-shadow-1 {\n z-index: 0;\n top: var(--space-unit);\n right: 6px;\n border: var(--border-size-small) solid black;\n}\n\n.z-shadow-2 {\n z-index: 0;\n top: calc(var(--space-unit) * 2);\n right: 12px;\n border: var(--border-size-small) solid black;\n}\n\n.z-cover-img {\n position: absolute;\n z-index: 0;\n top: 0;\n right: 0;\n border: var(--border-size-small) solid black;\n object-fit: cover;\n object-position: left;\n}\n\n.z-cover-container.has-multiple .z-cover-img {\n left: 12px;\n}\n","import {Component, Element, Host, Prop, h} from \"@stencil/core\";\nimport defaultFallbackCover from \"../../../assets/images/png/placeholder-cover.png\";\n\n@Component({\n tag: \"z-result-card\",\n styleUrls: [\"styles.css\", \"../../css-components/z-cover/styles.css\"],\n shadow: true,\n})\nexport class ZResultCard {\n @Element() hostElement: HTMLZResultCardElement;\n\n /**\n * The title of the card.\n */\n @Prop()\n cardTitle: string;\n\n /**\n * The subtitle of the card.\n */\n @Prop()\n cardSubtitle: string;\n\n /**\n * The authors of the opera.\n */\n @Prop()\n authors?: string;\n\n /**\n * The URL of the cover image.\n * This is used to display the cover image of the opera.\n */\n @Prop()\n cover?: string;\n\n /** [optional] Fallback cover URL */\n @Prop()\n fallbackCover?: string;\n\n /**\n * Indicates whether the card has multiple covers.\n * This is used to apply specific styles when there are multiple covers.\n */\n @Prop()\n hasMultipleCovers = false;\n\n /**\n * Indicates whether the card is an info page.\n * This can be used to apply specific styles or behaviors for info pages.\n */\n @Prop()\n isInfoCard = false;\n\n private authorsRef: HTMLElement;\n\n private titleRef: HTMLElement;\n\n private subtitleRef: HTMLElement;\n\n private setTooltipTitle(el: HTMLElement): void {\n if (!el) {\n return;\n }\n\n // Check if element uses line-clamp\n const style = window.getComputedStyle(el);\n const hasLineClamp = style.getPropertyValue(\"-webkit-line-clamp\") !== \"none\";\n\n let isTruncated;\n if (hasLineClamp) {\n // For elements with line-clamp, check if content height exceeds line-clamp height\n const lineHeight = parseInt(style.lineHeight);\n const maxLines = parseInt(style.getPropertyValue(\"-webkit-line-clamp\"));\n const maxHeight = lineHeight * maxLines;\n\n isTruncated = el.scrollHeight > maxHeight;\n } else {\n // Original check for elements without line-clamp\n isTruncated = el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight;\n }\n\n if (isTruncated) {\n el.setAttribute(\"title\", el.textContent.trim());\n } else {\n el.removeAttribute(\"title\");\n }\n }\n\n componentDidRender(): void {\n this.setTooltipTitle(this.authorsRef);\n this.setTooltipTitle(this.titleRef);\n this.setTooltipTitle(this.subtitleRef);\n }\n\n private resizeHandler = (): void => {\n this.setTooltipTitle(this.authorsRef);\n this.setTooltipTitle(this.titleRef);\n this.setTooltipTitle(this.subtitleRef);\n };\n\n componentDidLoad(): void {\n window.addEventListener(\"resize\", this.resizeHandler);\n }\n\n disconnectedCallback(): void {\n window.removeEventListener(\"resize\", this.resizeHandler);\n }\n\n private renderOperaCard = (): HTMLZResultCardElement => {\n return (\n <Host tabIndex={0}>\n <div class={`z-cover-container ${this.hasMultipleCovers ? \"has-multiple\" : \"\"}`}>\n <div class=\"z-cover-stack\">\n {this.hasMultipleCovers && (\n <div>\n <div class=\"z-cover-shadow z-shadow-2\" />\n <div class=\"z-cover-shadow z-shadow-1\" />\n </div>\n )}\n <img\n src={this.cover}\n alt=\"Book Cover\"\n class=\"z-cover-img\"\n onError={() => {\n if (this.fallbackCover) {\n this.cover = this.fallbackCover;\n } else {\n this.cover = defaultFallbackCover;\n }\n }}\n />\n </div>\n </div>\n <div class=\"info-container\">\n {this.authors && (\n <span\n class=\"authors-label\"\n ref={(el) => (this.authorsRef = el as HTMLElement)}\n >\n {this.authors}\n </span>\n )}\n <span\n class=\"card-title\"\n ref={(el) => (this.titleRef = el as HTMLElement)}\n >\n {this.cardTitle}\n </span>\n <span\n class=\"card-subtitle\"\n ref={(el) => (this.subtitleRef = el as HTMLElement)}\n >\n {this.cardSubtitle}\n </span>\n <div class=\"tags-container\">\n <slot name=\"tags\"></slot>\n </div>\n <div class=\"volumes-label\">\n <slot name=\"volumes\"></slot>\n </div>\n </div>\n </Host>\n );\n };\n\n private renderInfoCard = (): HTMLZResultCardElement => {\n return (\n <Host\n tabIndex={0}\n class=\"info-card\"\n >\n <div class=\"info-icon-column\">\n <div class=\"info-icon-container\">\n <z-icon\n class=\"info-icon\"\n name=\"link\"\n width={18}\n height={18}\n />\n </div>\n </div>\n <div class=\"info-container\">\n <span\n class=\"card-title info-title\"\n ref={(el) => (this.titleRef = el as HTMLElement)}\n >\n {this.cardTitle}\n </span>\n <span\n class=\"card-subtitle info-subtitle\"\n ref={(el) => (this.subtitleRef = el as HTMLElement)}\n >\n {this.cardSubtitle}\n </span>\n </div>\n </Host>\n );\n };\n\n render(): HTMLZResultCardElement {\n return this.isInfoCard ? this.renderInfoCard() : this.renderOperaCard();\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"z-result-card.js","mappings":";;;;AAAA,MAAM,SAAS,GAAG,i2GAAi2G,CAAC;AACp3G,0BAAe,SAAS;;MCOXA,aAAW;;;;;QA8Fd,kBAAa,GAAG;YACtB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACxC,CAAC;QAUM,oBAAe,GAAG;YACxB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,YAAY,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;YAEpH,QACE,EAAC,IAAI,IAAC,QAAQ,EAAE,CAAC,IACf,WAAK,KAAK,EAAE,qBAAqB,IAAI,CAAC,iBAAiB,GAAG,cAAc,GAAG,EAAE,EAAE,IAC7E,WAAK,KAAK,EAAC,eAAe,IACvB,IAAI,CAAC,iBAAiB,KACrB,eACE,WAAK,KAAK,EAAC,2BAA2B,GAAG,EACzC,WAAK,KAAK,EAAC,2BAA2B,GAAG,C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kBAAkB;QAChB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KACxC;IAQD,gBAAgB;QACd,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;KACvD;IAED,oBAAoB;QAClB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;KAC1D;IA+FD,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;KACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ZResultCard","defaultFallbackCover"],"sources":["src/components/result-card/z-result-card/styles.css?tag=z-result-card&encapsulation=shadow","src/components/result-card/z-result-card/index.tsx"],"sourcesContent":[":host {\n display: flex;\n overflow: hidden;\n min-width: 0;\n height: calc(174px - var(--space-unit) * 2);\n max-height: calc(174px - var(--space-unit) * 2);\n padding: var(--space-unit);\n border: var(--border-size-medium) solid var(--color-surface02);\n border-radius: var(--border-size-large);\n cursor: pointer;\n font-family: var(--font-family-sans);\n}\n\n:host(:focus:focus-visible) {\n z-index: 1;\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.z-cover-container {\n position: relative;\n display: flex;\n width: 119px;\n height: 158px;\n align-items: center;\n justify-items: center;\n}\n\n.z-cover-stack {\n width: 100%;\n height: 100%;\n}\n\n/* Base sizes for single cover */\n.z-cover-shadow,\n.z-cover-img {\n width: 117px;\n height: 156px;\n}\n\n/* Scaled sizes for multiple covers */\n.z-cover-container.has-multiple .z-cover-shadow,\n.z-cover-container.has-multiple .z-cover-img {\n width: 105px;\n height: 140px;\n}\n\n.z-cover-shadow {\n position: absolute;\n z-index: 1;\n background-color: var(--color-white);\n}\n\n.z-shadow-1 {\n z-index: 0;\n top: var(--space-unit);\n right: 6px;\n border: var(--border-size-small) solid black;\n}\n\n.z-shadow-2 {\n z-index: 0;\n top: calc(var(--space-unit) * 2);\n right: 12px;\n border: var(--border-size-small) solid black;\n}\n\n.z-cover-img {\n position: absolute;\n z-index: 0;\n top: 0;\n right: 0;\n display: flex;\n align-items: start;\n justify-content: center;\n border: var(--border-size-small) solid black;\n background-color: var(--color-white);\n object-fit: cover;\n object-position: left;\n}\n\n.z-cover-img > img {\n max-width: 100%;\n max-height: 100%;\n}\n\n.z-cover-container.has-multiple .z-cover-img {\n left: 12px;\n}\n\n:host(.info-card:focus:focus-visible) {\n z-index: 1;\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.info-container {\n display: flex;\n overflow: hidden;\n min-width: 0;\n flex: 1;\n flex-direction: column;\n padding-left: calc(var(--space-unit) * 2);\n}\n\n.authors-label {\n overflow: hidden;\n color: var(--color-default-text);\n font-size: var(--font-size-2);\n font-weight: var(--font-rg);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.card-title {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n font-size: var(--font-size-3);\n font-weight: var(--font-bd);\n -webkit-line-clamp: 2;\n line-clamp: 2;\n line-height: 1.5;\n word-break: break-word;\n}\n\n.card-title > * {\n all: unset;\n}\n\n.card-subtitle {\n overflow: hidden;\n color: var(--color-default-text);\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.card-subtitle.info-subtitle {\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n line-height: 1.2;\n white-space: normal;\n word-break: break-word;\n}\n\n.tags-container {\n display: flex;\n max-width: 100%;\n flex-wrap: wrap;\n margin-top: calc(var(--space-unit) * 2);\n gap: var(--space-unit);\n}\n\n.volumes-label {\n display: flex;\n height: auto;\n flex-direction: column;\n margin-top: auto;\n color: var(--color-default-text);\n font-size: var(--font-size-1);\n}\n\n:host(.info-card) {\n display: flex;\n height: calc(76px - var(--space-unit) * 2);\n max-height: calc(76px - var(--space-unit) * 2);\n}\n\n.info-icon-column {\n display: flex;\n width: 50px;\n height: 100%;\n align-items: center;\n justify-content: center;\n}\n\n.info-icon-container {\n display: flex;\n width: 34px;\n height: 34px;\n align-items: center;\n justify-content: center;\n margin-bottom: calc(var(--space-unit) * 3);\n background-color: var(--gray50);\n border-radius: var(--border-size-large);\n}\n\n.card-title.info-title {\n display: -webkit-box;\n overflow: hidden;\n min-width: 0;\n max-width: 100%;\n max-height: 2.4em;\n margin-top: 0;\n margin-bottom: 4px;\n -webkit-box-orient: vertical;\n font-size: var(--font-size-3);\n font-weight: var(--font-bd);\n -webkit-line-clamp: 1;\n line-clamp: 1;\n line-height: 1.2;\n word-break: break-word;\n}\n\n.info-icon {\n width: 18px;\n height: 18px;\n color: var(--color-default-text);\n}\n\n@media (max-width: 768px) {\n .card-title {\n display: block;\n overflow: hidden;\n line-height: normal;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n}\n","import {Component, Element, Host, Prop, h} from \"@stencil/core\";\nimport defaultFallbackCover from \"../../../assets/images/png/placeholder-cover.png\";\n\n@Component({\n tag: \"z-result-card\",\n styleUrls: [\"styles.css\"],\n shadow: true,\n})\nexport class ZResultCard {\n @Element() hostElement: HTMLZResultCardElement;\n\n /**\n * The title of the card.\n */\n @Prop()\n cardTitle: string;\n\n /**\n * The subtitle of the card.\n */\n @Prop()\n cardSubtitle: string;\n\n /**\n * The authors of the opera.\n */\n @Prop()\n authors?: string;\n\n /**\n * The URL of the cover image.\n * This is used to display the cover image of the opera.\n */\n @Prop()\n cover?: string;\n\n /** [optional] Fallback cover URL */\n @Prop()\n fallbackCover?: string;\n\n /**\n * Indicates whether the card has multiple covers.\n * This is used to apply specific styles when there are multiple covers.\n */\n @Prop()\n hasMultipleCovers = false;\n\n /**\n * Indicates whether the card is an info page.\n * This can be used to apply specific styles or behaviors for info pages.\n */\n @Prop()\n isInfoCard = false;\n\n /**\n * [optional]\n * Use for insert heading when needed.\n */\n @Prop()\n titleHtmlTag?: string;\n\n private authorsRef: HTMLElement;\n\n private titleRef: HTMLElement;\n\n private subtitleRef: HTMLElement;\n\n private setTooltipTitle(el: HTMLElement): void {\n if (!el) {\n return;\n }\n\n // Check if element uses line-clamp\n const style = window.getComputedStyle(el);\n const hasLineClamp = style.getPropertyValue(\"-webkit-line-clamp\") !== \"none\";\n\n let isTruncated;\n if (hasLineClamp) {\n // For elements with line-clamp, check if content height exceeds line-clamp height\n const lineHeight = parseInt(style.lineHeight);\n const maxLines = parseInt(style.getPropertyValue(\"-webkit-line-clamp\"));\n const maxHeight = lineHeight * maxLines;\n\n isTruncated = el.scrollHeight > maxHeight;\n } else {\n // Original check for elements without line-clamp\n isTruncated = el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight;\n }\n\n if (isTruncated) {\n el.setAttribute(\"title\", el.textContent.trim());\n } else {\n el.removeAttribute(\"title\");\n }\n }\n\n componentDidRender(): void {\n this.setTooltipTitle(this.authorsRef);\n this.setTooltipTitle(this.titleRef);\n this.setTooltipTitle(this.subtitleRef);\n }\n\n private resizeHandler = (): void => {\n this.setTooltipTitle(this.authorsRef);\n this.setTooltipTitle(this.titleRef);\n this.setTooltipTitle(this.subtitleRef);\n };\n\n componentDidLoad(): void {\n window.addEventListener(\"resize\", this.resizeHandler);\n }\n\n disconnectedCallback(): void {\n window.removeEventListener(\"resize\", this.resizeHandler);\n }\n\n private renderOperaCard = (): HTMLZResultCardElement => {\n const title = this.titleHtmlTag ? `<${this.titleHtmlTag}>${this.cardTitle}</${this.titleHtmlTag}>` : this.cardTitle;\n\n return (\n <Host tabIndex={0}>\n <div class={`z-cover-container ${this.hasMultipleCovers ? \"has-multiple\" : \"\"}`}>\n <div class=\"z-cover-stack\">\n {this.hasMultipleCovers && (\n <div>\n <div class=\"z-cover-shadow z-shadow-2\" />\n <div class=\"z-cover-shadow z-shadow-1\" />\n </div>\n )}\n <div class=\"z-cover-img\">\n <img\n src={this.cover || this.fallbackCover || defaultFallbackCover}\n alt=\"\"\n onError={() => {\n if (this.fallbackCover) {\n this.cover = this.fallbackCover;\n } else {\n this.cover = defaultFallbackCover;\n }\n }}\n />\n </div>\n </div>\n </div>\n <div class=\"info-container\">\n {this.authors && (\n <span\n class=\"authors-label\"\n ref={(el) => (this.authorsRef = el as HTMLElement)}\n >\n {this.authors}\n </span>\n )}\n <div\n class=\"card-title\"\n ref={(el) => (this.titleRef = el as HTMLElement)}\n innerHTML={title}\n ></div>\n <span\n class=\"card-subtitle\"\n ref={(el) => (this.subtitleRef = el as HTMLElement)}\n >\n {this.cardSubtitle}\n </span>\n <div class=\"tags-container\">\n <slot name=\"tags\"></slot>\n </div>\n <div class=\"volumes-label\">\n <slot name=\"volumes\"></slot>\n </div>\n </div>\n </Host>\n );\n };\n\n private renderInfoCard = (): HTMLZResultCardElement => {\n return (\n <Host\n tabIndex={0}\n class=\"info-card\"\n >\n <div class=\"info-icon-column\">\n <div class=\"info-icon-container\">\n <z-icon\n class=\"info-icon\"\n name=\"link\"\n width={18}\n height={18}\n />\n </div>\n </div>\n <div class=\"info-container\">\n <span\n class=\"card-title info-title\"\n ref={(el) => (this.titleRef = el as HTMLElement)}\n >\n {this.cardTitle}\n </span>\n <span\n class=\"card-subtitle info-subtitle\"\n ref={(el) => (this.subtitleRef = el as HTMLElement)}\n >\n {this.cardSubtitle}\n </span>\n </div>\n </Host>\n );\n };\n\n render(): HTMLZResultCardElement {\n return this.isInfoCard ? this.renderInfoCard() : this.renderOperaCard();\n }\n}\n"],"version":3}
|