@cas-smartdesign/list-item 7.2.2
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/LICENSE +8 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +456 -0
- package/dist/docs/icon.svg +1 -0
- package/dist/docs/index.html +25 -0
- package/dist/docs/long-content.js +1 -0
- package/dist/docs/script-created.js +1 -0
- package/dist/docs/script-drag-and-drop.js +1 -0
- package/dist/list-item-with-externals.js +101 -0
- package/dist/list-item-with-externals.js.map +7 -0
- package/dist/list-item.d.ts +50 -0
- package/dist/list-item.mjs +157 -0
- package/dist/list-item.mjs.map +1 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +34 -0
- package/readme.md +73 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { LitElement as m, css as v, unsafeCSS as g, html as a, nothing as f } from "lit";
|
|
2
|
+
import { property as r } from "lit/decorators/property.js";
|
|
3
|
+
import { unsafeHTML as b } from "lit/directives/unsafe-html.js";
|
|
4
|
+
import { ifDefined as d } from "lit/directives/if-defined.js";
|
|
5
|
+
import y from "@cas-smartdesign/image-tools";
|
|
6
|
+
const w = ':host{display:block;contain:strict;height:50px}:host([selected]){background-color:#d3e6fa}:host(:not([selected]):hover),:host(:not([selected])[focused]){background-color:#e7f1fa}@media (forced-colors: active){:host([selected]){outline:4px solid}:host(:not([selected]):hover){outline:4px dotted}:host(:not([selected])[focused]){outline:4px dashed}}:host([enable-line-clamp]) .labels>:only-child{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal;word-wrap:break-word}.container{display:flex;height:100%;box-sizing:border-box}.container .level-indicator{width:7px;height:100%}.container .level-indicator.level-0{background-color:#a0c3ef}.container .level-indicator.level-1{background-color:#e7c374}.container .level-indicator.level-2{background-color:#bfd596}.container .level-indicator.level-3{background-color:#fd998d}.container .level-indicator.level-4{background-color:#c6e8f5}.container .level-indicator.level-5{background-color:#fde3a4}.container .level-indicator.level-6{background-color:#dcbfe0}.side-content{display:flex;align-items:center;flex-grow:0}.labels{display:flex;flex-direction:column;justify-content:center;flex:1 1 0px;height:100%;line-height:normal;overflow:hidden;padding:var(--sd-list-item-label-content-padding, 0 8px)}.caption,.description{width:100%;font-family:var(--sd-list-item-font-family, "Segoe UI", "Lucida Sans", Arial, sans-serif);font-style:normal;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-webkit-user-select:none;user-select:none;text-decoration:var(--sd-list-item-text-decoration, inherit)}.caption em,.description em{font-weight:bolder}.caption{font-size:var(--sd-list-item-caption-font-size, 16px);color:var(--sd-list-item-caption-text-color, #111);font-weight:var(--sd-list-item-caption-font-weight, normal)}.description{font-size:var(--sd-list-item-description-font-size, 13px);color:var(--sd-list-item-description-text-color, #767676);font-weight:var(--sd-list-item-description-font-weight, normal)}.icon-wrapper{width:var(--sd-list-item-icon-wrapper-width, 45px);height:100%;display:flex;align-items:center;justify-content:center}.icon-wrapper .icon{min-height:var(--sd-list-item-icon-size, 24px);min-width:var(--sd-list-item-icon-size, 24px);background-repeat:no-repeat;background-position:center;background-size:cover}';
|
|
7
|
+
var x = Object.defineProperty, k = Object.getOwnPropertyDescriptor, l = (i, t, e, o) => {
|
|
8
|
+
for (var c = o > 1 ? void 0 : o ? k(t, e) : t, p = i.length - 1, h; p >= 0; p--)
|
|
9
|
+
(h = i[p]) && (c = (o ? h(t, e, c) : h(c)) || c);
|
|
10
|
+
return o && c && x(t, e, c), c;
|
|
11
|
+
}, s;
|
|
12
|
+
const n = (s = class extends m {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.contentMode = "text", this.role = "option";
|
|
15
|
+
}
|
|
16
|
+
static get styles() {
|
|
17
|
+
return [
|
|
18
|
+
v`
|
|
19
|
+
${g(w)}
|
|
20
|
+
`
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
return a`
|
|
25
|
+
<div class="container">
|
|
26
|
+
${this.getLevelIndicators().map(
|
|
27
|
+
(t, e) => a` <div class="level-indicator level-${e}"></div> `
|
|
28
|
+
)}
|
|
29
|
+
<div class="side-content">
|
|
30
|
+
<slot name="left-content"></slot>
|
|
31
|
+
${this.renderIcon()}
|
|
32
|
+
</div>
|
|
33
|
+
<div class="labels">
|
|
34
|
+
${this.renderLabel("caption", this.caption, this.captionAttrTitle)}
|
|
35
|
+
${this.renderLabel("description", this.description, this.descriptionAttrTitle)}
|
|
36
|
+
</div>
|
|
37
|
+
<div class="side-content">
|
|
38
|
+
<slot name="right-content"></slot>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
renderIcon() {
|
|
44
|
+
if (this.icon || this.iconPlaceholder) {
|
|
45
|
+
const t = this.iconBackgroundColor != null ? `background-color:${this.iconBackgroundColor}` : void 0;
|
|
46
|
+
return a`
|
|
47
|
+
<div
|
|
48
|
+
class="icon-wrapper"
|
|
49
|
+
@pointerdown="${this.handleIconClick}"
|
|
50
|
+
style="${d(t)}"
|
|
51
|
+
role="img"
|
|
52
|
+
aria-label="${d(this.iconAttrAriaLabel)}"
|
|
53
|
+
title="${d(this.iconAttrTitle)}"
|
|
54
|
+
>
|
|
55
|
+
<div class="icon"></div>
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
return f;
|
|
60
|
+
}
|
|
61
|
+
renderLabel(t, e, o) {
|
|
62
|
+
return e ? a`
|
|
63
|
+
<div class="${t}" title="${d(o)}">
|
|
64
|
+
${this.contentMode === "html" ? b(e) : e}
|
|
65
|
+
</div>
|
|
66
|
+
` : f;
|
|
67
|
+
}
|
|
68
|
+
updated(t) {
|
|
69
|
+
super.updated(t), (t.has("icon") || t.has("iconPlaceholder")) && (this.icon || this.iconPlaceholder) && y.showImage(this.shadowRoot.querySelector(".icon"), this.icon, this.iconPlaceholder), t.has("selected") && this.setAttribute("aria-selected", String(this.selected));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns the width in pixel which is missing to show the caption and description without ellipsis.
|
|
73
|
+
*/
|
|
74
|
+
get missingWidthForTexts() {
|
|
75
|
+
const t = this.enableLineClamp;
|
|
76
|
+
this.removeAttribute("enable-line-clamp");
|
|
77
|
+
let e = 0;
|
|
78
|
+
const o = this.shadowRoot.querySelector(".caption");
|
|
79
|
+
o && (e += o.scrollWidth - o.clientWidth);
|
|
80
|
+
const c = this.shadowRoot.querySelector(".description");
|
|
81
|
+
return c && (e = Math.max(e, c.scrollWidth - c.clientWidth)), e > 0 && e++, t && this.setAttribute("enable-line-clamp", ""), e;
|
|
82
|
+
}
|
|
83
|
+
handleIconClick(t) {
|
|
84
|
+
!this.disabled && !this.dispatchEvent(new PointerEvent("list-item-icon-click", t)) && t.preventDefault();
|
|
85
|
+
}
|
|
86
|
+
getLevelIndicators() {
|
|
87
|
+
return this.level ? Array(Number(this.level)).fill(null) : [];
|
|
88
|
+
}
|
|
89
|
+
}, s.ID = "sd-list-item", s.ensureDefined = () => {
|
|
90
|
+
customElements.get(s.ID) || customElements.define(s.ID, s);
|
|
91
|
+
}, s);
|
|
92
|
+
l([
|
|
93
|
+
r({ type: String })
|
|
94
|
+
], n.prototype, "caption", 2);
|
|
95
|
+
l([
|
|
96
|
+
r({ type: String })
|
|
97
|
+
], n.prototype, "description", 2);
|
|
98
|
+
l([
|
|
99
|
+
r({ type: Boolean })
|
|
100
|
+
], n.prototype, "selected", 2);
|
|
101
|
+
l([
|
|
102
|
+
r({ type: String })
|
|
103
|
+
], n.prototype, "icon", 2);
|
|
104
|
+
l([
|
|
105
|
+
r({ type: String })
|
|
106
|
+
], n.prototype, "iconBackgroundColor", 2);
|
|
107
|
+
l([
|
|
108
|
+
r({ type: String })
|
|
109
|
+
], n.prototype, "iconPlaceholder", 2);
|
|
110
|
+
l([
|
|
111
|
+
r({ type: Number })
|
|
112
|
+
], n.prototype, "level", 2);
|
|
113
|
+
l([
|
|
114
|
+
r()
|
|
115
|
+
], n.prototype, "contentMode", 2);
|
|
116
|
+
l([
|
|
117
|
+
r({ type: Boolean, reflect: !0, attribute: "enable-line-clamp" })
|
|
118
|
+
], n.prototype, "enableLineClamp", 2);
|
|
119
|
+
l([
|
|
120
|
+
r({ type: Boolean, reflect: !0, attribute: "aria-disabled" })
|
|
121
|
+
], n.prototype, "disabled", 2);
|
|
122
|
+
l([
|
|
123
|
+
r({ type: String, attribute: "icon-attr-aria-label" })
|
|
124
|
+
], n.prototype, "iconAttrAriaLabel", 2);
|
|
125
|
+
l([
|
|
126
|
+
r({ type: String, reflect: !0 })
|
|
127
|
+
], n.prototype, "role", 2);
|
|
128
|
+
l([
|
|
129
|
+
r({ type: String, attribute: "caption-attr-title" })
|
|
130
|
+
], n.prototype, "captionAttrTitle", 2);
|
|
131
|
+
l([
|
|
132
|
+
r({ type: String, attribute: "description-attr-title" })
|
|
133
|
+
], n.prototype, "descriptionAttrTitle", 2);
|
|
134
|
+
l([
|
|
135
|
+
r({ type: String, attribute: "icon-attr-title" })
|
|
136
|
+
], n.prototype, "iconAttrTitle", 2);
|
|
137
|
+
let u = n;
|
|
138
|
+
const $ = (i, t) => {
|
|
139
|
+
const e = document.createElement(u.ID);
|
|
140
|
+
if (i) {
|
|
141
|
+
if (e.caption = i.caption, e.description = i.description, e.icon = i.icon, e.iconBackgroundColor = i.iconBackgroundColor, e.iconPlaceholder = i.iconPlaceholder, e.level = i.level, e.disabled = i.disabled, i.contentMode && (e.contentMode = i.contentMode), i.leftContentGenerator) {
|
|
142
|
+
const o = i.leftContentGenerator(i, e);
|
|
143
|
+
o && (o.slot = "left-content", e.appendChild(o));
|
|
144
|
+
}
|
|
145
|
+
if (i.rightContentGenerator) {
|
|
146
|
+
const o = i.rightContentGenerator(i, e);
|
|
147
|
+
o && (o.slot = "right-content", e.appendChild(o));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return e;
|
|
151
|
+
};
|
|
152
|
+
u.ensureDefined();
|
|
153
|
+
export {
|
|
154
|
+
u as default,
|
|
155
|
+
$ as generator
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=list-item.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item.mjs","sources":["../list-item.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS, PropertyValues, css, nothing, TemplateResult } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [ListItem.ID]: ListItem;\n }\n}\n\nimport styles from \"./styles.scss?inline\";\n\nexport interface ItemData {\n caption?: string;\n description?: string;\n leftContentGenerator?: (data: ItemData, element: ListItem) => HTMLElement;\n rightContentGenerator?: (data: ItemData, element: ListItem) => HTMLElement;\n icon?: string;\n iconBackgroundColor?: string;\n iconPlaceholder?: string;\n level?: number;\n contentMode?: ContentMode;\n disabled?: boolean;\n}\n\nexport type ContentMode = \"text\" | \"html\";\n\nexport default class ListItem extends LitElement {\n public static readonly ID = \"sd-list-item\";\n public static ensureDefined = (): void => {\n if (!customElements.get(ListItem.ID)) {\n customElements.define(ListItem.ID, ListItem);\n }\n };\n\n @property({ type: String })\n public caption: string;\n @property({ type: String })\n public description: string;\n @property({ type: Boolean })\n public selected: boolean;\n @property({ type: String })\n public icon: string;\n @property({ type: String })\n public iconBackgroundColor: string;\n @property({ type: String })\n public iconPlaceholder: string;\n @property({ type: Number })\n public level: number;\n @property()\n public contentMode: ContentMode = \"text\";\n @property({ type: Boolean, reflect: true, attribute: \"enable-line-clamp\" })\n public enableLineClamp: boolean;\n @property({ type: Boolean, reflect: true, attribute: \"aria-disabled\" })\n public disabled: boolean;\n\n // aria attributes\n @property({ type: String, attribute: \"icon-attr-aria-label\" })\n public iconAttrAriaLabel: string;\n @property({ type: String, reflect: true })\n public role = \"option\";\n\n // title attributes\n @property({ type: String, attribute: \"caption-attr-title\" })\n public captionAttrTitle: string;\n @property({ type: String, attribute: \"description-attr-title\" })\n public descriptionAttrTitle: string;\n @property({ type: String, attribute: \"icon-attr-title\" })\n public iconAttrTitle: string;\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(styles)}\n `,\n ];\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"container\">\n ${this.getLevelIndicators().map(\n (_, level) => html` <div class=\"level-indicator level-${level}\"></div> `,\n )}\n <div class=\"side-content\">\n <slot name=\"left-content\"></slot>\n ${this.renderIcon()}\n </div>\n <div class=\"labels\">\n ${this.renderLabel(\"caption\", this.caption, this.captionAttrTitle)}\n ${this.renderLabel(\"description\", this.description, this.descriptionAttrTitle)}\n </div>\n <div class=\"side-content\">\n <slot name=\"right-content\"></slot>\n </div>\n </div>\n `;\n }\n\n private renderIcon() {\n if (this.icon || this.iconPlaceholder) {\n const iconBackgroundStyle =\n this.iconBackgroundColor != null ? `background-color:${this.iconBackgroundColor}` : undefined;\n return html`\n <div\n class=\"icon-wrapper\"\n @pointerdown=\"${this.handleIconClick}\"\n style=\"${ifDefined(iconBackgroundStyle)}\"\n role=\"img\"\n aria-label=\"${ifDefined(this.iconAttrAriaLabel)}\"\n title=\"${ifDefined(this.iconAttrTitle)}\"\n >\n <div class=\"icon\"></div>\n </div>\n `;\n }\n return nothing;\n }\n\n private renderLabel(className: string, value: string, title: string) {\n return value\n ? html`\n <div class=\"${className}\" title=\"${ifDefined(title)}\">\n ${this.contentMode === \"html\" ? unsafeHTML(value) : value}\n </div>\n `\n : nothing;\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (\n (changedProperties.has(\"icon\") || changedProperties.has(\"iconPlaceholder\")) &&\n (this.icon || this.iconPlaceholder)\n ) {\n ImageTools.showImage(this.shadowRoot.querySelector(\".icon\"), this.icon, this.iconPlaceholder);\n }\n if (changedProperties.has(\"selected\")) {\n this.setAttribute(\"aria-selected\", String(this.selected));\n }\n }\n\n /**\n * Returns the width in pixel which is missing to show the caption and description without ellipsis.\n */\n public get missingWidthForTexts(): number {\n const originalLineClamp = this.enableLineClamp;\n this.removeAttribute(\"enable-line-clamp\"); // Need to remove immediately, otherwise the calculation may fail.\n\n let requiredWidth = 0;\n\n const captionElement = this.shadowRoot.querySelector(\".caption\");\n if (captionElement) {\n requiredWidth += captionElement.scrollWidth - captionElement.clientWidth;\n }\n\n const descriptionElement = this.shadowRoot.querySelector(\".description\");\n if (descriptionElement) {\n requiredWidth = Math.max(requiredWidth, descriptionElement.scrollWidth - descriptionElement.clientWidth);\n }\n if (requiredWidth > 0) {\n requiredWidth++; // Additional one pixel to ensure ellipsis is not needed anymore.\n }\n if (originalLineClamp) {\n this.setAttribute(\"enable-line-clamp\", \"\");\n }\n return requiredWidth;\n }\n\n private handleIconClick(event: PointerEvent): void {\n if (!this.disabled && !this.dispatchEvent(new PointerEvent(\"list-item-icon-click\", event))) {\n event.preventDefault();\n }\n }\n\n private getLevelIndicators(): number[] {\n if (!this.level) {\n return [];\n }\n // fill is needed because the ArrayConstructor\n // result an array with \"empty\" values in it\n // which are skipped when iterating\n return Array(Number(this.level)).fill(null);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const generator = (data: ItemData, _index: number): ListItem => {\n const listItem = document.createElement(ListItem.ID) as ListItem;\n if (data) {\n listItem.caption = data.caption;\n listItem.description = data.description;\n listItem.icon = data.icon;\n listItem.iconBackgroundColor = data.iconBackgroundColor;\n listItem.iconPlaceholder = data.iconPlaceholder;\n listItem.level = data.level;\n listItem.disabled = data.disabled;\n if (data.contentMode) {\n listItem.contentMode = data.contentMode;\n }\n if (data.leftContentGenerator) {\n const leftContent = data.leftContentGenerator(data, listItem);\n if (leftContent) {\n leftContent.slot = \"left-content\";\n listItem.appendChild(leftContent);\n }\n }\n if (data.rightContentGenerator) {\n const rightContent = data.rightContentGenerator(data, listItem);\n if (rightContent) {\n rightContent.slot = \"right-content\";\n listItem.appendChild(rightContent);\n }\n }\n }\n return listItem;\n};\n\nListItem.ensureDefined();\n"],"names":["_ListItem","_a","LitElement","css","unsafeCSS","styles","html","_","level","iconBackgroundStyle","ifDefined","nothing","className","value","title","unsafeHTML","changedProperties","ImageTools","originalLineClamp","requiredWidth","captionElement","descriptionElement","event","__decorateClass","property","ListItem","generator","data","_index","listItem","leftContent","rightContent"],"mappings":";;;;;;;;;;;AA6BA,MAAqBA,KAArBC,IAAA,cAAsCC,EAAW;AAAA,EAAjD,cAAA;AAAA,UAAA,GAAA,SAAA,GAuBI,KAAO,cAA2B,QAUlC,KAAO,OAAO;AAAA,EAAA;AAAA,EAUd,WAAW,SAAS;AACT,WAAA;AAAA,MACHC;AAAA,kBACMC,EAAUC,CAAM,CAAC;AAAA;AAAA,IAAA;AAAA,EAG/B;AAAA,EAEO,SAAyB;AACrB,WAAAC;AAAA;AAAA,kBAEG,KAAK,qBAAqB;AAAA,MACxB,CAACC,GAAGC,MAAUF,uCAA0CE,CAAK;AAAA,IAAA,CAChE;AAAA;AAAA;AAAA,sBAGK,KAAK,YAAY;AAAA;AAAA;AAAA,sBAGjB,KAAK,YAAY,WAAW,KAAK,SAAS,KAAK,gBAAgB,CAAC;AAAA,sBAChE,KAAK,YAAY,eAAe,KAAK,aAAa,KAAK,oBAAoB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9F;AAAA,EAEQ,aAAa;AACb,QAAA,KAAK,QAAQ,KAAK,iBAAiB;AACnC,YAAMC,IACF,KAAK,uBAAuB,OAAO,oBAAoB,KAAK,mBAAmB,KAAK;AACjF,aAAAH;AAAA;AAAA;AAAA,oCAGiB,KAAK,eAAe;AAAA,6BAC3BI,EAAUD,CAAmB,CAAC;AAAA;AAAA,kCAEzBC,EAAU,KAAK,iBAAiB,CAAC;AAAA,6BACtCA,EAAU,KAAK,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKlD;AACO,WAAAC;AAAA,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enseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
|
+
},
|
|
7
|
+
"@rollup/plugin-node-resolve@15.2.3": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/rollup/plugins",
|
|
10
|
+
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
11
|
+
},
|
|
12
|
+
"@types/node@20.10.6": {
|
|
13
|
+
"licenses": "MIT",
|
|
14
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
15
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
16
|
+
},
|
|
17
|
+
"@types/postcss-prefix-selector@1.16.3": {
|
|
18
|
+
"licenses": "MIT",
|
|
19
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
|
+
},
|
|
22
|
+
"@typescript-eslint/eslint-plugin@6.17.0": {
|
|
23
|
+
"licenses": "MIT",
|
|
24
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
25
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/parser@6.17.0": {
|
|
28
|
+
"licenses": "BSD-2-Clause",
|
|
29
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
|
+
},
|
|
32
|
+
"@vitest/coverage-v8@1.1.1": {
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
35
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
36
|
+
},
|
|
37
|
+
"@vitest/ui@1.1.1": {
|
|
38
|
+
"licenses": "MIT",
|
|
39
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
|
+
},
|
|
42
|
+
"axe-core@4.8.3": {
|
|
43
|
+
"licenses": "MPL-2.0",
|
|
44
|
+
"repository": "https://github.com/dequelabs/axe-core",
|
|
45
|
+
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
46
|
+
},
|
|
47
|
+
"cypress-axe@1.5.0": {
|
|
48
|
+
"licenses": "MIT",
|
|
49
|
+
"repository": "https://github.com/component-driven/cypress-axe",
|
|
50
|
+
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
51
|
+
},
|
|
52
|
+
"cypress-real-events@1.13.0": {
|
|
53
|
+
"licenses": "MIT",
|
|
54
|
+
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
55
|
+
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
56
|
+
},
|
|
57
|
+
"cypress@13.6.2": {
|
|
58
|
+
"licenses": "MIT",
|
|
59
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
60
|
+
"licenseUrl": "https://cypress.io"
|
|
61
|
+
},
|
|
62
|
+
"esbuild@0.19.11": {
|
|
63
|
+
"licenses": "MIT",
|
|
64
|
+
"repository": "https://github.com/evanw/esbuild",
|
|
65
|
+
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
66
|
+
},
|
|
67
|
+
"eslint-config-google@0.14.0": {
|
|
68
|
+
"licenses": "Apache-2.0",
|
|
69
|
+
"repository": "https://github.com/google/eslint-config-google",
|
|
70
|
+
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
71
|
+
},
|
|
72
|
+
"eslint-config-prettier@9.1.0": {
|
|
73
|
+
"licenses": "MIT",
|
|
74
|
+
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
75
|
+
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
76
|
+
},
|
|
77
|
+
"eslint@8.56.0": {
|
|
78
|
+
"licenses": "MIT",
|
|
79
|
+
"repository": "https://github.com/eslint/eslint",
|
|
80
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
81
|
+
},
|
|
82
|
+
"github-markdown-css@5.5.0": {
|
|
83
|
+
"licenses": "MIT",
|
|
84
|
+
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
85
|
+
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
86
|
+
},
|
|
87
|
+
"highlight.js@11.9.0": {
|
|
88
|
+
"licenses": "BSD-3-Clause",
|
|
89
|
+
"repository": "https://github.com/highlightjs/highlight.js",
|
|
90
|
+
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
91
|
+
},
|
|
92
|
+
"junit-report-builder@3.1.0": {
|
|
93
|
+
"licenses": "MIT",
|
|
94
|
+
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
95
|
+
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
96
|
+
},
|
|
97
|
+
"lint-staged@15.2.0": {
|
|
98
|
+
"licenses": "MIT",
|
|
99
|
+
"repository": "https://github.com/okonet/lint-staged",
|
|
100
|
+
"licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
|
|
101
|
+
},
|
|
102
|
+
"lit@2.8.0": {
|
|
103
|
+
"licenses": "BSD-3-Clause",
|
|
104
|
+
"repository": "https://github.com/lit/lit",
|
|
105
|
+
"licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
|
|
106
|
+
},
|
|
107
|
+
"marked@11.1.1": {
|
|
108
|
+
"licenses": "MIT",
|
|
109
|
+
"repository": "https://github.com/markedjs/marked",
|
|
110
|
+
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
|
+
},
|
|
112
|
+
"postcss-prefix-selector@1.16.0": {
|
|
113
|
+
"licenses": "MIT",
|
|
114
|
+
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
|
+
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
|
+
},
|
|
117
|
+
"postcss@8.4.32": {
|
|
118
|
+
"licenses": "MIT",
|
|
119
|
+
"repository": "https://github.com/postcss/postcss",
|
|
120
|
+
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
|
+
},
|
|
122
|
+
"prettier@3.1.1": {
|
|
123
|
+
"licenses": "MIT",
|
|
124
|
+
"repository": "https://github.com/prettier/prettier",
|
|
125
|
+
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
126
|
+
},
|
|
127
|
+
"resolve-pkg@2.0.0": {
|
|
128
|
+
"licenses": "MIT",
|
|
129
|
+
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
|
+
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
|
+
},
|
|
132
|
+
"sass@1.69.6": {
|
|
133
|
+
"licenses": "MIT",
|
|
134
|
+
"repository": "https://github.com/sass/dart-sass",
|
|
135
|
+
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
|
+
},
|
|
137
|
+
"stylelint-config-recommended-scss@14.0.0": {
|
|
138
|
+
"licenses": "MIT",
|
|
139
|
+
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
|
+
},
|
|
142
|
+
"stylelint-config-standard@36.0.0": {
|
|
143
|
+
"licenses": "MIT",
|
|
144
|
+
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
|
+
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
|
+
},
|
|
147
|
+
"stylelint-scss@6.0.0": {
|
|
148
|
+
"licenses": "MIT",
|
|
149
|
+
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
|
+
},
|
|
152
|
+
"stylelint@16.1.0": {
|
|
153
|
+
"licenses": "MIT",
|
|
154
|
+
"repository": "https://github.com/stylelint/stylelint",
|
|
155
|
+
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
|
+
},
|
|
157
|
+
"tsup@8.0.1": {
|
|
158
|
+
"licenses": "MIT",
|
|
159
|
+
"repository": "https://github.com/egoist/tsup",
|
|
160
|
+
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
|
+
},
|
|
162
|
+
"turbo@1.11.2": {
|
|
163
|
+
"licenses": "MPL-2.0",
|
|
164
|
+
"repository": "https://github.com/vercel/turbo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript@5.3.3": {
|
|
168
|
+
"licenses": "Apache-2.0",
|
|
169
|
+
"repository": "https://github.com/Microsoft/TypeScript",
|
|
170
|
+
"licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
|
+
},
|
|
172
|
+
"vite-tsconfig-paths@4.2.3": {
|
|
173
|
+
"licenses": "MIT",
|
|
174
|
+
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
|
+
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
|
+
},
|
|
177
|
+
"vite@5.0.10": {
|
|
178
|
+
"licenses": "MIT",
|
|
179
|
+
"repository": "https://github.com/vitejs/vite",
|
|
180
|
+
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
|
+
},
|
|
182
|
+
"vitest@1.1.1": {
|
|
183
|
+
"licenses": "MIT",
|
|
184
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
|
+
},
|
|
187
|
+
"yargs@17.7.2": {
|
|
188
|
+
"licenses": "MIT",
|
|
189
|
+
"repository": "https://github.com/yargs/yargs",
|
|
190
|
+
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
|
191
|
+
}
|
|
192
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cas-smartdesign/list-item",
|
|
3
|
+
"version": "7.2.2",
|
|
4
|
+
"description": "A list item element based on LitElement",
|
|
5
|
+
"main": "dist/list-item-with-externals.js",
|
|
6
|
+
"module": "dist/list-item.mjs",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
8
|
+
"types": "dist/list-item.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"lit": "^2.8.0",
|
|
11
|
+
"@cas-smartdesign/image-tools": "^3.0.1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@cas-smartdesign/element-preview": "^0.2.1",
|
|
15
|
+
"@cas-smartdesign/license-generator": "^1.6.1"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"npm-third-party-licenses.json"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"registry": "https://registry.npmjs.org/",
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"version": "pnpm version",
|
|
27
|
+
"generate-declaration": "tsc -p tsconfig.types.json",
|
|
28
|
+
"build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
|
|
29
|
+
"build": "pnpm generate-license && pnpm build:no-license",
|
|
30
|
+
"watch": "vite build --watch",
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"generate-license": "sd-license-generator --r ../../"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @cas-smartdesign/list-item
|
|
2
|
+
|
|
3
|
+
A list item element based on [lit-element](https://github.com/Polymer/lit-element) with SmartDesign look & feel.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
The main entry point requires ES6 & support for Custom Elements v1
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
- `caption`: string
|
|
12
|
+
- Defines the text of the caption component of the item
|
|
13
|
+
- `description`: string
|
|
14
|
+
- Defines the text of the description component of the item
|
|
15
|
+
- `selected`: boolean
|
|
16
|
+
- Defines whether if the item is in selected state
|
|
17
|
+
- `icon`: string
|
|
18
|
+
- Defines the icon of the item
|
|
19
|
+
- `iconPlaceholder`: string
|
|
20
|
+
- Defines the placeholder icon of the item
|
|
21
|
+
- `iconBackgroundColor`: string
|
|
22
|
+
- Defines the background color to be used behind the icon of the item
|
|
23
|
+
- `contentMode`: ContentMode
|
|
24
|
+
- Defines the mode in which it should handle its content
|
|
25
|
+
- Possible values:
|
|
26
|
+
- text - renders the content as text
|
|
27
|
+
- html - renders the content as HTML
|
|
28
|
+
- `enableLineClamp`: boolean
|
|
29
|
+
- If set and the list item has only one label defined (caption or description) then long texts are wrapped to two lines and line-clamp property is applied to them.
|
|
30
|
+
- The corresponding attribute is `enable-line-clamp`
|
|
31
|
+
- aria attributes (the corresponding attribute is in camel-case)
|
|
32
|
+
- `role`: string (default is "listitem")
|
|
33
|
+
- `iconAttrAriaLabel`: string
|
|
34
|
+
- title attributes (the corresponding attribute is in camel-case)
|
|
35
|
+
- `captionAttrTitle`: string
|
|
36
|
+
- `descriptionAttrTitle`: string
|
|
37
|
+
- `iconAttrTitle`: string
|
|
38
|
+
- `disabled` (reflects `aria-disabled` attribute)
|
|
39
|
+
- A disabled item MAY indicate that changing the selected state is not allowed.
|
|
40
|
+
|
|
41
|
+
All of these properties can be defined with a corresponding (by default with lowercase) attribute as well.
|
|
42
|
+
|
|
43
|
+
## CSS Custom Properties
|
|
44
|
+
|
|
45
|
+
- `--sd-list-item-font-family`
|
|
46
|
+
- Defines the font family of the labels (default is "Segoe UI", "Lucida Sans", Arial, sans-serif)
|
|
47
|
+
- `--sd-list-item-label-content-padding`
|
|
48
|
+
- Defines the padding of the labels (default is 0 8px)
|
|
49
|
+
- `--sd-list-item-caption-font-size`
|
|
50
|
+
- Defines the font size of the caption (default is 16px)
|
|
51
|
+
- `--sd-list-item-caption-text-color`
|
|
52
|
+
- Defines the text color of the caption (default is #111)
|
|
53
|
+
- `--sd-list-item-caption-font-weight`
|
|
54
|
+
- Defines the font weight of the caption (default is 400)
|
|
55
|
+
- `--sd-list-item-description-font-size`
|
|
56
|
+
- Defines the font size of the description (default is 13px)
|
|
57
|
+
- `--sd-list-item-description-text-color`
|
|
58
|
+
- Defines the text color of the description (default is #999)
|
|
59
|
+
- `--sd-list-item-description-font-weight`
|
|
60
|
+
- Defines the font weight of the description (default is 400)
|
|
61
|
+
- `--sd-list-item-text-decoration`
|
|
62
|
+
- Defines the text-decoration applied on the caption and description (default is inherit)
|
|
63
|
+
- `--sd-list-item-icon-size`
|
|
64
|
+
- Defines the size of the icon (default is 24px)
|
|
65
|
+
- `--sd-list-item-icon-wrapper-width`
|
|
66
|
+
- Defines the width of the icon wrapper element (default is 45px)
|
|
67
|
+
|
|
68
|
+
## Custom events
|
|
69
|
+
|
|
70
|
+
- `list-item-icon-click`
|
|
71
|
+
- This event is dispatched when non-disabled list item icon is clicked
|
|
72
|
+
|
|
73
|
+
## Examples
|