@getflip/swirl-components 0.175.1 → 0.177.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 +11 -3
- package/dist/cjs/swirl-description-list-item.cjs.entry.js +4 -2
- package/dist/cjs/swirl-theme-provider.cjs.entry.js +13 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-description-list/swirl-description-list.stories.js +3 -0
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.css +17 -4
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.js +4 -1
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.spec.js +11 -6
- package/dist/collection/components/swirl-theme-provider/swirl-theme-provider.js +14 -3
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-description-list-item.js +4 -2
- package/dist/components/swirl-theme-provider.js +13 -2
- package/dist/esm/swirl-description-list-item.entry.js +4 -2
- package/dist/esm/swirl-theme-provider.entry.js +13 -2
- package/dist/swirl-components/p-a2bc4735.entry.js +1 -0
- package/dist/swirl-components/p-d5c10d1e.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-description-list-item/swirl-description-list-item.d.ts +1 -0
- package/dist/types/components/swirl-theme-provider/swirl-theme-provider.types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-46697e8d.entry.js +0 -1
- package/dist/swirl-components/p-85eeb993.entry.js +0 -1
package/components.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2024-03-
|
|
2
|
+
"timestamp": "2024-03-26T08:32:38",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "3.3.1",
|
|
@@ -6375,6 +6375,10 @@
|
|
|
6375
6375
|
{
|
|
6376
6376
|
"name": "slot",
|
|
6377
6377
|
"text": "tools - Optional tools to be displayed on the right side of the item"
|
|
6378
|
+
},
|
|
6379
|
+
{
|
|
6380
|
+
"name": "slot",
|
|
6381
|
+
"text": "additional-content - Optional additional content displayed at the bottom of the item"
|
|
6378
6382
|
}
|
|
6379
6383
|
],
|
|
6380
6384
|
"usage": {},
|
|
@@ -6450,6 +6454,10 @@
|
|
|
6450
6454
|
"listeners": [],
|
|
6451
6455
|
"styles": [],
|
|
6452
6456
|
"slots": [
|
|
6457
|
+
{
|
|
6458
|
+
"name": "additional-content",
|
|
6459
|
+
"docs": "Optional additional content displayed at the bottom of the item"
|
|
6460
|
+
},
|
|
6453
6461
|
{
|
|
6454
6462
|
"name": "slot",
|
|
6455
6463
|
"docs": "The description"
|
|
@@ -39177,14 +39185,14 @@
|
|
|
39177
39185
|
"props": [
|
|
39178
39186
|
{
|
|
39179
39187
|
"name": "config",
|
|
39180
|
-
"type": "{ rootElement?: HTMLElement; storage?: SwirlThemeProviderStorage; themes?: SwirlThemes; }",
|
|
39188
|
+
"type": "{ enabledThemes?: (keyof SwirlThemes)[]; rootElement?: HTMLElement; storage?: SwirlThemeProviderStorage; themes?: SwirlThemes; }",
|
|
39181
39189
|
"mutable": false,
|
|
39182
39190
|
"reflectToAttr": false,
|
|
39183
39191
|
"docs": "",
|
|
39184
39192
|
"docsTags": [],
|
|
39185
39193
|
"values": [
|
|
39186
39194
|
{
|
|
39187
|
-
"type": "{ rootElement?: HTMLElement; storage?: SwirlThemeProviderStorage; themes?: SwirlThemes; }"
|
|
39195
|
+
"type": "{ enabledThemes?: (keyof SwirlThemes)[]; rootElement?: HTMLElement; storage?: SwirlThemeProviderStorage; themes?: SwirlThemes; }"
|
|
39188
39196
|
}
|
|
39189
39197
|
],
|
|
39190
39198
|
"optional": false,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-1de6abbd.js');
|
|
6
6
|
const index$1 = require('./index-2ddd0598.js');
|
|
7
7
|
|
|
8
|
-
const swirlDescriptionListItemCss = ":host{display:block}:host *{box-sizing:border-box}.description-list-
|
|
8
|
+
const swirlDescriptionListItemCss = ":host{display:block}:host *{box-sizing:border-box}.description-list-item__inner{display:flex;max-width:100%;padding-top:var(--s-space-8);padding-bottom:var(--s-space-8);align-items:flex-start;color:var(--s-text-default);line-height:var(--s-line-height-base);justfiy-content:space-between;gap:var(--s-space-16)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.description-list-item__inner{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.description-list-item--bordered{padding-top:var(--s-space-16);padding-bottom:var(--s-space-16);border-bottom:var(--s-border-width-default) solid var(--s-border-default)}.description-list-item:not(.description-list-item--has-tools) .description-list-item__tools{display:none}.description-list-item:not(.description-list-item--has-additional-content) .description-list-item__additional-content{display:none}.description-list-item__text-container{flex-grow:1}.description-list-item__term{display:block;margin-bottom:var(--s-space-4);font-weight:var(--s-font-weight-semibold);overflow-wrap:break-word}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.description-list-item__term{margin-bottom:var(--s-space-2)}}.description-list-item__tooltip{display:inline-flex;margin-left:var(--s-space-4);vertical-align:middle}.description-list-item__description{display:block;max-width:40rem;margin:0;overflow-wrap:break-word}.description-list-item__tools{display:flex;min-height:2.625rem;flex-shrink:0;align-items:center}.description-list-item__additional-content{padding-bottom:var(--s-space-8);flex-basis:100%;flex-shrink:0}";
|
|
9
9
|
|
|
10
10
|
const SwirlDescriptionListItem = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -17,11 +17,13 @@ const SwirlDescriptionListItem = class {
|
|
|
17
17
|
}
|
|
18
18
|
render() {
|
|
19
19
|
const hasTools = Boolean(this.el.querySelector('[slot="tools"]'));
|
|
20
|
+
const hasAdditionalContent = Boolean(this.el.querySelector('[slot="additional-content"]'));
|
|
20
21
|
const className = index$1.classnames("description-list-item", {
|
|
21
22
|
"description-list-item--bordered": this.bordered,
|
|
23
|
+
"description-list-item--has-additional-content": hasAdditionalContent,
|
|
22
24
|
"description-list-item--has-tools": hasTools,
|
|
23
25
|
});
|
|
24
|
-
return (index.h(index.Host, { role: "listitem" }, index.h("div", { class: className, part: "description-list-item", role: "group" }, index.h("div", { class: "description-list-item__text-container" }, index.h("div", { class: "description-list-item__term", part: "description-list-item__term", role: "term" }, this.term, this.tooltip && (index.h("span", { class: "description-list-item__tooltip" }, index.h("swirl-tooltip", { content: this.tooltip, position: "right" }, index.h("swirl-icon-info", { size: 16, tabIndex: 0 }))))), index.h("div", { style: { maxWidth: this.maxWidth }, class: "description-list-item__description", role: "definition" }, index.h("slot", null))), index.h("div", { class: "description-list-item__tools" }, index.h("slot", { name: "tools" })))));
|
|
26
|
+
return (index.h(index.Host, { role: "listitem" }, index.h("div", { class: className, part: "description-list-item", role: "group" }, index.h("div", { class: "description-list-item__inner" }, index.h("div", { class: "description-list-item__text-container" }, index.h("div", { class: "description-list-item__term", part: "description-list-item__term", role: "term" }, this.term, this.tooltip && (index.h("span", { class: "description-list-item__tooltip" }, index.h("swirl-tooltip", { content: this.tooltip, position: "right" }, index.h("swirl-icon-info", { size: 16, tabIndex: 0 }))))), index.h("div", { style: { maxWidth: this.maxWidth }, class: "description-list-item__description", role: "definition" }, index.h("slot", null))), index.h("div", { class: "description-list-item__tools" }, index.h("slot", { name: "tools" }))), index.h("div", { class: "description-list-item__additional-content" }, index.h("slot", { name: "additional-content" })))));
|
|
25
27
|
}
|
|
26
28
|
get el() { return index.getElement(this); }
|
|
27
29
|
};
|
|
@@ -47,7 +47,8 @@ const SwirlThemeProvider = class {
|
|
|
47
47
|
* the system theme.
|
|
48
48
|
*/
|
|
49
49
|
async setPreferredOSTheme(theme) {
|
|
50
|
-
if (!Boolean(this.resolvedConfig.storage)
|
|
50
|
+
if (!Boolean(this.resolvedConfig.storage) ||
|
|
51
|
+
!this.resolvedConfig.enabledThemes.includes(theme)) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
this.resolvedConfig.storage.setItem(preferredThemeStorageKey, theme);
|
|
@@ -66,9 +67,13 @@ const SwirlThemeProvider = class {
|
|
|
66
67
|
resolveConfig() {
|
|
67
68
|
this.resolvedConfig = {
|
|
68
69
|
...(this.config || {}),
|
|
70
|
+
enabledThemes: this.config?.enabledThemes || ["light", "dark"],
|
|
69
71
|
rootElement: this.config?.rootElement || document.documentElement,
|
|
70
72
|
storage: this.config?.storage || window?.localStorage,
|
|
71
73
|
};
|
|
74
|
+
if (!this.resolvedConfig.enabledThemes.includes("light")) {
|
|
75
|
+
throw new Error("[Swirl Theme Provider] Light theme must be enabled.");
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
determineOSTheme() {
|
|
74
79
|
if (!Boolean(window.matchMedia)) {
|
|
@@ -83,7 +88,13 @@ const SwirlThemeProvider = class {
|
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
async updateAppTheme() {
|
|
86
|
-
|
|
91
|
+
const newAppOSTheme = (await this.getPreferredOSTheme()) || this.osTheme;
|
|
92
|
+
if (!this.resolvedConfig.enabledThemes.includes(newAppOSTheme)) {
|
|
93
|
+
this.appOSTheme = "light";
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
this.appOSTheme = newAppOSTheme;
|
|
97
|
+
}
|
|
87
98
|
if (this.appOSTheme === "dark") {
|
|
88
99
|
document.documentElement.classList.remove("theme-light");
|
|
89
100
|
document.documentElement.classList.add("theme-dark");
|