@nuralyui/timeline 0.0.4 → 0.0.5
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/bundle.js +252 -2
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -3,9 +3,259 @@ import{css as e,LitElement as t,html as i,nothing as l}from"lit";import{property
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
|
-
*/const c=e
|
|
6
|
+
*/const c=e`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
font-family: var(--nuraly-font-family);
|
|
10
|
+
font-size: var(--nuraly-font-size-base, 14px);
|
|
11
|
+
line-height: 1.5715;
|
|
12
|
+
color: var(--nuraly-color-text);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.timeline {
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
list-style: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Timeline Item */
|
|
22
|
+
.timeline-item {
|
|
23
|
+
position: relative;
|
|
24
|
+
padding-bottom: var(--nuraly-timeline-item-padding-bottom, 20px);
|
|
25
|
+
list-style: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.timeline-item:last-child {
|
|
29
|
+
padding-bottom: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Timeline Tail (connecting line) */
|
|
33
|
+
.timeline-item-tail {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 10px;
|
|
36
|
+
left: 4px;
|
|
37
|
+
height: calc(100% - 10px);
|
|
38
|
+
border-left: var(--nuraly-timeline-tail-width, 2px) solid var(--nuraly-timeline-tail-color, rgba(5, 5, 5, 0.06));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.timeline-item:last-child .timeline-item-tail {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.timeline-item.pending .timeline-item-tail {
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Timeline Head (dot container) */
|
|
50
|
+
.timeline-item-head {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 5.5px;
|
|
53
|
+
left: 0;
|
|
54
|
+
width: 10px;
|
|
55
|
+
height: 10px;
|
|
56
|
+
background-color: var(--nuraly-timeline-dot-bg, #ffffff);
|
|
57
|
+
border: var(--nuraly-timeline-dot-border-width, 2px) solid transparent;
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Timeline Head Colors */
|
|
62
|
+
.timeline-item-head.blue {
|
|
63
|
+
border-color: var(--nuraly-color-primary, #1890ff);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.timeline-item-head.red {
|
|
67
|
+
border-color: var(--nuraly-color-error, #ff4d4f);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.timeline-item-head.green {
|
|
71
|
+
border-color: var(--nuraly-color-success, #52c41a);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.timeline-item-head.gray {
|
|
75
|
+
border-color: var(--nuraly-color-text-disabled, #d9d9d9);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Custom Head (with icon or custom content) */
|
|
79
|
+
.timeline-item-head-custom {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 5.5px;
|
|
82
|
+
left: 0;
|
|
83
|
+
width: auto;
|
|
84
|
+
height: auto;
|
|
85
|
+
margin-top: 0;
|
|
86
|
+
padding: 3px 1px;
|
|
87
|
+
line-height: 1;
|
|
88
|
+
text-align: center;
|
|
89
|
+
border: 0;
|
|
90
|
+
border-radius: 0;
|
|
91
|
+
transform: translate(-50%, -50%);
|
|
92
|
+
top: 10px;
|
|
93
|
+
left: 5px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.timeline-item-head-custom nr-icon {
|
|
97
|
+
font-size: 16px;
|
|
98
|
+
vertical-align: middle;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Timeline Content */
|
|
102
|
+
.timeline-item-content {
|
|
103
|
+
position: relative;
|
|
104
|
+
top: calc(-1 * var(--nuraly-font-size-base, 14px) * 1.5715 - 2px);
|
|
105
|
+
margin: 0 0 0 26px;
|
|
106
|
+
word-break: break-word;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Timeline Label */
|
|
110
|
+
.timeline-item-label {
|
|
111
|
+
position: absolute;
|
|
112
|
+
top: calc(-1 * var(--nuraly-font-size-base, 14px) * 1.5715 / 2);
|
|
113
|
+
width: calc(50% - 12px);
|
|
114
|
+
text-align: right;
|
|
115
|
+
color: var(--nuraly-color-text-secondary, rgba(0, 0, 0, 0.45));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Pending Item */
|
|
119
|
+
.timeline-item.pending .timeline-item-head {
|
|
120
|
+
border-color: var(--nuraly-color-primary, #1890ff);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.timeline-item.pending .timeline-item-content {
|
|
124
|
+
color: var(--nuraly-color-text-secondary, rgba(0, 0, 0, 0.45));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Right Mode */
|
|
128
|
+
:host([mode="right"]) .timeline-item-tail {
|
|
129
|
+
left: auto;
|
|
130
|
+
right: 4px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host([mode="right"]) .timeline-item-head,
|
|
134
|
+
:host([mode="right"]) .timeline-item-head-custom {
|
|
135
|
+
left: auto;
|
|
136
|
+
right: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host([mode="right"]) .timeline-item-head-custom {
|
|
140
|
+
right: 5px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:host([mode="right"]) .timeline-item-content {
|
|
144
|
+
margin: 0 26px 0 0;
|
|
145
|
+
text-align: right;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Alternate Mode */
|
|
149
|
+
:host([mode="alternate"]) .timeline,
|
|
150
|
+
:host([mode="alternate"]) .timeline-item {
|
|
151
|
+
display: block;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([mode="alternate"]) .timeline-item-tail,
|
|
155
|
+
:host([mode="alternate"]) .timeline-item-head,
|
|
156
|
+
:host([mode="alternate"]) .timeline-item-head-custom {
|
|
157
|
+
left: 50%;
|
|
158
|
+
margin-left: -1px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([mode="alternate"]) .timeline-item-head {
|
|
162
|
+
margin-left: -5px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([mode="alternate"]) .timeline-item-head-custom {
|
|
166
|
+
margin-left: -5px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([mode="alternate"]) .timeline-item-left .timeline-item-content {
|
|
170
|
+
left: calc(50% - 4px);
|
|
171
|
+
width: calc(50% - 14px);
|
|
172
|
+
text-align: left;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host([mode="alternate"]) .timeline-item-right .timeline-item-content {
|
|
176
|
+
left: auto;
|
|
177
|
+
right: calc(50% - 4px);
|
|
178
|
+
width: calc(50% - 14px);
|
|
179
|
+
text-align: right;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Alternate with Label */
|
|
183
|
+
:host([mode="alternate"]) .timeline-item-left .timeline-item-label {
|
|
184
|
+
left: calc(50% + 14px);
|
|
185
|
+
width: calc(50% - 14px);
|
|
186
|
+
text-align: left;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host([mode="alternate"]) .timeline-item-right .timeline-item-label {
|
|
190
|
+
right: calc(50% + 14px);
|
|
191
|
+
width: calc(50% - 14px);
|
|
192
|
+
text-align: right;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Reverse Mode */
|
|
196
|
+
:host([reverse]) .timeline {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column-reverse;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* RTL Support */
|
|
202
|
+
:host([dir="rtl"]) .timeline-item-tail {
|
|
203
|
+
left: auto;
|
|
204
|
+
right: 4px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
:host([dir="rtl"]) .timeline-item-head,
|
|
208
|
+
:host([dir="rtl"]) .timeline-item-head-custom {
|
|
209
|
+
left: auto;
|
|
210
|
+
right: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
:host([dir="rtl"]) .timeline-item-content {
|
|
214
|
+
margin: 0 26px 0 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
:host([dir="rtl"]) .timeline-item-label {
|
|
218
|
+
text-align: left;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* Dark theme support */
|
|
222
|
+
:host([data-theme*="dark"]) .timeline-item-tail {
|
|
223
|
+
border-color: var(--nuraly-timeline-tail-color, rgba(255, 255, 255, 0.12));
|
|
224
|
+
}
|
|
225
|
+
`
|
|
7
226
|
/**
|
|
8
227
|
* @license
|
|
9
228
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
10
229
|
* SPDX-License-Identifier: MIT
|
|
11
|
-
*/;var h=function(e,t,i,l){for(var r,n=arguments.length,o=n<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,i):l,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let p=class extends(s(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.mode="left",this.items=[],this.reverse=!1}getItemPosition(e,t){return"alternate"!==this.mode?"left":e.position?e.position:t%2==0?"left":"right"}isPresetColor(e){if(!e)return!1;return["blue","red","green","gray"].includes(e)}getCustomColorStyle(e){return!e||this.isPresetColor(e)?{}:{borderColor:e}}renderDot(e){const t=!!e.dot,l=e.color||"blue",r=this.isPresetColor(l);if(t)return i
|
|
230
|
+
*/;var h=function(e,t,i,l){for(var r,n=arguments.length,o=n<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,i):l,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let p=class extends(s(t)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.mode="left",this.items=[],this.reverse=!1}getItemPosition(e,t){return"alternate"!==this.mode?"left":e.position?e.position:t%2==0?"left":"right"}isPresetColor(e){if(!e)return!1;return["blue","red","green","gray"].includes(e)}getCustomColorStyle(e){return!e||this.isPresetColor(e)?{}:{borderColor:e}}renderDot(e){const t=!!e.dot,l=e.color||"blue",r=this.isPresetColor(l);if(t)return i`
|
|
231
|
+
<div class="timeline-item-head-custom">
|
|
232
|
+
<nr-icon name="${d(e.dot)}"></nr-icon>
|
|
233
|
+
</div>
|
|
234
|
+
`;const n={"timeline-item-head":!0,[l]:r},a=this.getCustomColorStyle(l);return i`
|
|
235
|
+
<div class=${o(n)} style=${m(a)}></div>
|
|
236
|
+
`}renderItem(e,t){const r=this.getItemPosition(e,t),n={"timeline-item":!0,"timeline-item-left":"left"===r,"timeline-item-right":"right"===r,[e.className||""]:!!e.className};return i`
|
|
237
|
+
<li class=${o(n)}>
|
|
238
|
+
<div class="timeline-item-tail"></div>
|
|
239
|
+
${this.renderDot(e)}
|
|
240
|
+
<div class="timeline-item-content">
|
|
241
|
+
${e.label&&"alternate"===this.mode?i`<div class="timeline-item-label">${e.label}</div>`:l}
|
|
242
|
+
<div>${e.children}</div>
|
|
243
|
+
${e.label&&"alternate"!==this.mode?i`<div style="color: var(--nuraly-color-text-secondary); margin-top: 4px;">${e.label}</div>`:l}
|
|
244
|
+
</div>
|
|
245
|
+
</li>
|
|
246
|
+
`}renderPendingItem(){const e="string"==typeof this.pending?this.pending:"Loading...",t=this.pendingDot||"loading";return i`
|
|
247
|
+
<li class="timeline-item pending">
|
|
248
|
+
<div class="timeline-item-tail"></div>
|
|
249
|
+
<div class="timeline-item-head-custom">
|
|
250
|
+
<nr-icon name="${t}"></nr-icon>
|
|
251
|
+
</div>
|
|
252
|
+
<div class="timeline-item-content">
|
|
253
|
+
${e}
|
|
254
|
+
</div>
|
|
255
|
+
</li>
|
|
256
|
+
`}render(){return this.items&&0!==this.items.length?i`
|
|
257
|
+
<ul class="timeline">
|
|
258
|
+
${a(this.items,((e,t)=>this.renderItem(e,t)))}
|
|
259
|
+
${this.pending?this.renderPendingItem():l}
|
|
260
|
+
</ul>
|
|
261
|
+
`:l}};p.styles=c,h([r({type:String,reflect:!0})],p.prototype,"mode",void 0),h([r({type:Array})],p.prototype,"items",void 0),h([r({type:String})],p.prototype,"pending",void 0),h([r({type:String,attribute:"pending-dot"})],p.prototype,"pendingDot",void 0),h([r({type:Boolean,reflect:!0})],p.prototype,"reverse",void 0),p=h([n("nr-timeline")],p);export{p as NrTimelineElement};
|