@proximus/lavender-timeline 1.0.0-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +113 -0
  2. package/package.json +40 -0
package/dist/index.js ADDED
@@ -0,0 +1,113 @@
1
+ const l = ".timeline{list-style:none;margin:0;padding:0}", o = new CSSStyleSheet();
2
+ o.replaceSync(l);
3
+ class c extends HTMLElement {
4
+ template() {
5
+ return `
6
+ <ol class="timeline" role="list">
7
+ <slot></slot>
8
+ </ol>
9
+ `;
10
+ }
11
+ constructor() {
12
+ super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [o];
13
+ }
14
+ static get observedAttributes() {
15
+ return ["inverted"];
16
+ }
17
+ connectedCallback() {
18
+ this.configureChildren();
19
+ }
20
+ attributeChangedCallback(t, e, i) {
21
+ if (e !== i)
22
+ switch (t) {
23
+ case "inverted":
24
+ for (let r = 0; r < this.$children.length; r++)
25
+ this.$children[r].toggleAttribute("inverted");
26
+ break;
27
+ }
28
+ }
29
+ configureChildren() {
30
+ const t = this.$children[this.$children.length - 1];
31
+ t == null || t.toggleAttribute("lastchild");
32
+ for (let e = 0; e < this.$children.length; e++)
33
+ this.$children[e].setAttribute("item", `${e + 1}`);
34
+ }
35
+ get $el() {
36
+ return this.shadowRoot.querySelector(".timeline");
37
+ }
38
+ get $children() {
39
+ return this.querySelectorAll("px-timeline-item");
40
+ }
41
+ get inverted() {
42
+ return this.getAttribute("inverted");
43
+ }
44
+ set inverted(t) {
45
+ this.setAttribute("inverted", t);
46
+ }
47
+ }
48
+ customElements.get("px-timeline") || customElements.define("px-timeline", c);
49
+ const d = '.timeline-item{display:flex;gap:var(--px-spacing-text-to-icon-horizontal);font-family:var(--px-font-family);font-size:var(--px-text-size-base-mobile);line-height:var(--px-line-height-m)}.indicator-area{position:relative}.indicator-area:before{display:block;content:"";position:absolute;top:26px;left:12px;width:var(--px-border-m);height:calc(100% - 26px);background:var(--px-color-border-main-default)}.indicator-area .indicator{display:flex;align-items:center;justify-content:center;text-align:center;width:26px;height:26px;font-weight:700;font-size:var(--px-text-size-s-mobile);color:var(--px-color-icon-body-default);border-radius:var(--px-radius-pill);background:var(--px-color-bg-container-weak-default)}.content-area{margin-bottom:var(--px-spacing-component-default-vertical)}.content-area ::slotted([slot="title"]){font-weight:700;color:var(--px-color-txt-body-default)}.content-area ::slotted([slot="content"]){font-weight:400;color:var(--px-color-txt-details-default);margin-top:var(--px-spacing-under-text-vertical)}:host([lastchild]) .indicator-area:before{display:none}:host([lastchild]) .content-area{margin-bottom:0}:host([inverted]) .indicator-area:before{background:var(--px-color-border-main-inverted)}:host([inverted]) .indicator-area .indicator{color:var(--px-color-icon-body-inverted);background:var(--px-color-bg-container-weak-inverted)}:host([inverted]) .content-area ::slotted([slot="title"]){color:var(--px-color-txt-body-inverted)}:host([inverted]) .content-area ::slotted([slot="content"]){color:var(--px-color-txt-details-inverted)}@media only screen and (min-width: 64rem){.timeline-item{font-size:var(--px-text-size-base-tablet)}.indicator-area .indicator{font-size:var(--px-text-size-s-tablet)}}@media only screen and (min-width: 90rem){.timeline-item{font-size:var(--px-text-size-base-desktop)}.indicator-area .indicator{font-size:var(--px-text-size-s-desktop)}}', a = new CSSStyleSheet();
50
+ a.replaceSync(d);
51
+ let n = "1";
52
+ class h extends HTMLElement {
53
+ template() {
54
+ return `
55
+ <li class="timeline-item" role="listitem">
56
+ <div class="indicator-area">
57
+ <div class="indicator"></div>
58
+ </div>
59
+ <div class="content-area">
60
+ <slot name="title"></slot>
61
+ <slot name="content"></slot>
62
+ </div>
63
+ </li>
64
+ `;
65
+ }
66
+ constructor() {
67
+ super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [a];
68
+ }
69
+ static get observedAttributes() {
70
+ return ["inverted", "lastchild", "item"];
71
+ }
72
+ attributeChangedCallback(t, e, i) {
73
+ if (e !== i)
74
+ switch (t) {
75
+ case "item":
76
+ this.updateItem(e, i), this.updateIndicator(n);
77
+ break;
78
+ }
79
+ }
80
+ updateItem(t, e) {
81
+ t !== null && t !== "" && (n = t), e !== null && e !== "" && (n = e);
82
+ }
83
+ updateIndicator(t) {
84
+ const e = this.$el.querySelector(".indicator");
85
+ e.innerHTML = t;
86
+ }
87
+ get $el() {
88
+ return this.shadowRoot.querySelector(".timeline-item");
89
+ }
90
+ get inverted() {
91
+ return this.getAttribute("inverted");
92
+ }
93
+ set inverted(t) {
94
+ this.setAttribute("inverted", t);
95
+ }
96
+ get lastchild() {
97
+ return this.getAttribute("lastchild");
98
+ }
99
+ set lastchild(t) {
100
+ this.setAttribute("lastchild", t);
101
+ }
102
+ get item() {
103
+ return this.getAttribute("item");
104
+ }
105
+ set item(t) {
106
+ this.setAttribute("item", t);
107
+ }
108
+ }
109
+ customElements.get("px-timeline-item") || customElements.define("px-timeline-item", h);
110
+ export {
111
+ c as Timeline,
112
+ h as TimelineItem
113
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@proximus/lavender-timeline",
3
+ "version": "1.0.0-alpha.16",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./src/index.ts",
9
+ "development": "./src/index.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./src/*.css": {
13
+ "development": "src/*.css"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "type": "module",
20
+ "scripts": {
21
+ "build": "rm -rf dist;tsc; vite build",
22
+ "test": "vitest run --coverage"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "gitHead": "15a231df98020f83813279639a9a7712a5a5e759",
28
+ "lerna": {
29
+ "command": {
30
+ "publish": {
31
+ "assets": [
32
+ "CHANGELOG.md",
33
+ "package.json",
34
+ "dist/*.js",
35
+ "dist/css/**/*.css"
36
+ ]
37
+ }
38
+ }
39
+ }
40
+ }