@getflip/swirl-components 0.34.2 → 0.35.0
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/components.json +246 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-card.cjs.entry.js +23 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-text.cjs.entry.js +181 -10
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +22 -0
- package/dist/collection/components/swirl-card/swirl-card.js +133 -1
- package/dist/collection/components/swirl-text/swirl-text.js +19 -10
- package/dist/components/assets/pdfjs/pdf.worker.min.js +22 -0
- package/dist/components/swirl-card.js +28 -1
- package/dist/components/swirl-text2.js +181 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-card.entry.js +23 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-text.entry.js +181 -10
- package/dist/swirl-components/p-5f05c203.entry.js +8 -0
- package/dist/swirl-components/p-c9a34a56.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-card/swirl-card.d.ts +6 -0
- package/dist/types/components/swirl-text/swirl-text.d.ts +1 -0
- package/dist/types/components.d.ts +12 -2
- package/package.json +2 -1
- package/vscode-data.json +165 -0
- package/dist/swirl-components/p-0f186daa.entry.js +0 -1
- package/dist/swirl-components/p-80610550.entry.js +0 -1
|
@@ -17,6 +17,11 @@ export class SwirlCard {
|
|
|
17
17
|
this.interactive = undefined;
|
|
18
18
|
this.justifyContent = "start";
|
|
19
19
|
this.linkTarget = undefined;
|
|
20
|
+
this.padding = undefined;
|
|
21
|
+
this.paddingBlockEnd = undefined;
|
|
22
|
+
this.paddingBlockStart = undefined;
|
|
23
|
+
this.paddingInlineEnd = undefined;
|
|
24
|
+
this.paddingInlineStart = undefined;
|
|
20
25
|
this.swirlAriaLabel = undefined;
|
|
21
26
|
}
|
|
22
27
|
render() {
|
|
@@ -28,6 +33,23 @@ export class SwirlCard {
|
|
|
28
33
|
: this.borderRadius,
|
|
29
34
|
height: this.height,
|
|
30
35
|
};
|
|
36
|
+
const bodyStyles = {
|
|
37
|
+
padding: Boolean(this.padding)
|
|
38
|
+
? `var(--s-space-${this.padding})`
|
|
39
|
+
: undefined,
|
|
40
|
+
paddingBlockEnd: Boolean(this.paddingBlockEnd)
|
|
41
|
+
? `var(--s-space-${this.paddingBlockEnd})`
|
|
42
|
+
: undefined,
|
|
43
|
+
paddingBlockStart: Boolean(this.paddingBlockStart)
|
|
44
|
+
? `var(--s-space-${this.paddingBlockStart})`
|
|
45
|
+
: undefined,
|
|
46
|
+
paddingInlineEnd: Boolean(this.paddingInlineEnd)
|
|
47
|
+
? `var(--s-space-${this.paddingInlineEnd})`
|
|
48
|
+
: undefined,
|
|
49
|
+
paddingInlineStart: Boolean(this.paddingInlineStart)
|
|
50
|
+
? `var(--s-space-${this.paddingInlineStart})`
|
|
51
|
+
: undefined,
|
|
52
|
+
};
|
|
31
53
|
const className = classnames("card", `card--justify-content-${this.justifyContent}`, {
|
|
32
54
|
"card--elevated": this.elevated,
|
|
33
55
|
"card--has-image": hasImage,
|
|
@@ -37,7 +59,7 @@ export class SwirlCard {
|
|
|
37
59
|
});
|
|
38
60
|
return (h(Host, { styles: { height: this.height } }, h(Tag, { "aria-label": this.swirlAriaLabel, class: className, href: this.href, rel: Boolean(this.href) && this.linkTarget === "_blank"
|
|
39
61
|
? "noreferrer"
|
|
40
|
-
: undefined, style: styles, target: this.linkTarget }, h("div", { class: "card__image", style: { aspectRatio: this.imageAspectRatio } }, h("slot", { name: "image" })), h("div", { class: "card__body" }, h("div", { class: "card__content" }, h("slot", { name: "content" }))))));
|
|
62
|
+
: undefined, style: styles, target: this.linkTarget }, h("div", { class: "card__image", style: { aspectRatio: this.imageAspectRatio } }, h("slot", { name: "image" })), h("div", { class: "card__body", style: bodyStyles }, h("div", { class: "card__content" }, h("slot", { name: "content" }))))));
|
|
41
63
|
}
|
|
42
64
|
static get is() { return "swirl-card"; }
|
|
43
65
|
static get encapsulation() { return "shadow"; }
|
|
@@ -253,6 +275,116 @@ export class SwirlCard {
|
|
|
253
275
|
"attribute": "link-target",
|
|
254
276
|
"reflect": false
|
|
255
277
|
},
|
|
278
|
+
"padding": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"mutable": false,
|
|
281
|
+
"complexType": {
|
|
282
|
+
"original": "SwirlCardPadding",
|
|
283
|
+
"resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"32\" | \"4\" | \"8\"",
|
|
284
|
+
"references": {
|
|
285
|
+
"SwirlCardPadding": {
|
|
286
|
+
"location": "local",
|
|
287
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-card/swirl-card.tsx"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
"required": false,
|
|
292
|
+
"optional": true,
|
|
293
|
+
"docs": {
|
|
294
|
+
"tags": [],
|
|
295
|
+
"text": ""
|
|
296
|
+
},
|
|
297
|
+
"attribute": "padding",
|
|
298
|
+
"reflect": false
|
|
299
|
+
},
|
|
300
|
+
"paddingBlockEnd": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"mutable": false,
|
|
303
|
+
"complexType": {
|
|
304
|
+
"original": "SwirlCardPadding",
|
|
305
|
+
"resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"32\" | \"4\" | \"8\"",
|
|
306
|
+
"references": {
|
|
307
|
+
"SwirlCardPadding": {
|
|
308
|
+
"location": "local",
|
|
309
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-card/swirl-card.tsx"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"required": false,
|
|
314
|
+
"optional": true,
|
|
315
|
+
"docs": {
|
|
316
|
+
"tags": [],
|
|
317
|
+
"text": ""
|
|
318
|
+
},
|
|
319
|
+
"attribute": "padding-block-end",
|
|
320
|
+
"reflect": false
|
|
321
|
+
},
|
|
322
|
+
"paddingBlockStart": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"mutable": false,
|
|
325
|
+
"complexType": {
|
|
326
|
+
"original": "SwirlCardPadding",
|
|
327
|
+
"resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"32\" | \"4\" | \"8\"",
|
|
328
|
+
"references": {
|
|
329
|
+
"SwirlCardPadding": {
|
|
330
|
+
"location": "local",
|
|
331
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-card/swirl-card.tsx"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
"required": false,
|
|
336
|
+
"optional": true,
|
|
337
|
+
"docs": {
|
|
338
|
+
"tags": [],
|
|
339
|
+
"text": ""
|
|
340
|
+
},
|
|
341
|
+
"attribute": "padding-block-start",
|
|
342
|
+
"reflect": false
|
|
343
|
+
},
|
|
344
|
+
"paddingInlineEnd": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "SwirlCardPadding",
|
|
349
|
+
"resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"32\" | \"4\" | \"8\"",
|
|
350
|
+
"references": {
|
|
351
|
+
"SwirlCardPadding": {
|
|
352
|
+
"location": "local",
|
|
353
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-card/swirl-card.tsx"
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"required": false,
|
|
358
|
+
"optional": true,
|
|
359
|
+
"docs": {
|
|
360
|
+
"tags": [],
|
|
361
|
+
"text": ""
|
|
362
|
+
},
|
|
363
|
+
"attribute": "padding-inline-end",
|
|
364
|
+
"reflect": false
|
|
365
|
+
},
|
|
366
|
+
"paddingInlineStart": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"mutable": false,
|
|
369
|
+
"complexType": {
|
|
370
|
+
"original": "SwirlCardPadding",
|
|
371
|
+
"resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"32\" | \"4\" | \"8\"",
|
|
372
|
+
"references": {
|
|
373
|
+
"SwirlCardPadding": {
|
|
374
|
+
"location": "local",
|
|
375
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-card/swirl-card.tsx"
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"required": false,
|
|
380
|
+
"optional": true,
|
|
381
|
+
"docs": {
|
|
382
|
+
"tags": [],
|
|
383
|
+
"text": ""
|
|
384
|
+
},
|
|
385
|
+
"attribute": "padding-inline-start",
|
|
386
|
+
"reflect": false
|
|
387
|
+
},
|
|
256
388
|
"swirlAriaLabel": {
|
|
257
389
|
"type": "string",
|
|
258
390
|
"mutable": false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import balanceText from "balance-text";
|
|
4
|
+
import shave from "shave";
|
|
4
5
|
export class SwirlText {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.align = "start";
|
|
@@ -15,9 +16,23 @@ export class SwirlText {
|
|
|
15
16
|
}
|
|
16
17
|
componentDidRender() {
|
|
17
18
|
this.rebalance();
|
|
19
|
+
this.handleTruncation();
|
|
18
20
|
}
|
|
19
21
|
onWindowResize() {
|
|
20
22
|
this.rebalance();
|
|
23
|
+
this.handleTruncation();
|
|
24
|
+
}
|
|
25
|
+
handleTruncation() {
|
|
26
|
+
if (!this.truncate || !Boolean(this.lines) || this.lines === 1) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const lineHeight = +window
|
|
30
|
+
.getComputedStyle(this.textEl, null)
|
|
31
|
+
.getPropertyValue("line-height")
|
|
32
|
+
.replace("px", "");
|
|
33
|
+
if (lineHeight > 0) {
|
|
34
|
+
shave(this.textEl, lineHeight * this.lines);
|
|
35
|
+
}
|
|
21
36
|
}
|
|
22
37
|
rebalance() {
|
|
23
38
|
if (!this.balance || !Boolean(this.textEl)) {
|
|
@@ -27,16 +42,10 @@ export class SwirlText {
|
|
|
27
42
|
}
|
|
28
43
|
render() {
|
|
29
44
|
const Tag = this.as;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"-webkit-box-orient": "vertical",
|
|
35
|
-
whiteSpace: "normal",
|
|
36
|
-
}
|
|
37
|
-
: undefined;
|
|
38
|
-
const className = classnames("text", `text--align-${this.align}`, `text--color-${this.color}`, `text--font-style-${this.fontStyle}`, `text--size-${this.size}`, `text--weight-${this.weight}`, { "text--truncate": this.truncate });
|
|
39
|
-
return (h(Host, null, h(Tag, { class: className, ref: (el) => (this.textEl = el), style: styles }, h("slot", null))));
|
|
45
|
+
const className = classnames("text", `text--align-${this.align}`, `text--color-${this.color}`, `text--font-style-${this.fontStyle}`, `text--size-${this.size}`, `text--weight-${this.weight}`, {
|
|
46
|
+
"text--truncate": this.truncate && (!Boolean(this.lines) || this.lines === 1),
|
|
47
|
+
});
|
|
48
|
+
return (h(Host, null, h(Tag, { class: className, ref: (el) => (this.textEl = el) }, h("slot", null))));
|
|
40
49
|
}
|
|
41
50
|
static get is() { return "swirl-text"; }
|
|
42
51
|
static get encapsulation() { return "scoped"; }
|