@nuralyui/timeline 0.0.1

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/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './timeline.component.js';
2
+ //# sourceMappingURL=index.d.ts.map
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './timeline.component.js';
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/timeline/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './timeline.component.js';\n"]}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@nuralyui/timeline",
3
+ "version": "0.0.1",
4
+ "description": "Timeline component for NuralyUI library",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./index.js"
10
+ },
11
+ "./bundle": {
12
+ "import": "./bundle.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "*.js",
17
+ "*.d.ts",
18
+ "*.js.map",
19
+ "timeline.bundled.js",
20
+ "bundle.js"
21
+ ],
22
+ "scripts": {
23
+ "test": "echo \"Error: no test specified\" && exit 1"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/NuralyUI/NuralyUI.git",
28
+ "directory": "src/components/timeline"
29
+ },
30
+ "keywords": [
31
+ "timeline",
32
+ "chronology",
33
+ "history",
34
+ "events",
35
+ "vertical-timeline",
36
+ "web-components",
37
+ "lit-element",
38
+ "nuralyui",
39
+ "ui-components"
40
+ ],
41
+ "author": "Nuraly, Laabidi Aymen",
42
+ "license": "MIT",
43
+ "bugs": {
44
+ "url": "https://github.com/NuralyUI/NuralyUI/issues"
45
+ },
46
+ "homepage": "https://github.com/NuralyUI/NuralyUI#readme"
47
+ }
package/react.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { NrTimelineElement } from './timeline.component.js';
2
+ export declare const NrTimeline: import("@lit-labs/react").ReactWebComponent<NrTimelineElement, {}>;
3
+ //# sourceMappingURL=react.d.ts.map
package/react.js ADDED
@@ -0,0 +1,10 @@
1
+ import { createComponent } from '@lit-labs/react';
2
+ import * as React from 'react';
3
+ import { NrTimelineElement } from './timeline.component.js';
4
+ export const NrTimeline = createComponent({
5
+ tagName: 'nr-timeline',
6
+ elementClass: NrTimelineElement,
7
+ react: React,
8
+ events: {},
9
+ });
10
+ //# sourceMappingURL=react.js.map
package/react.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/timeline/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,iBAAiB;IAC/B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAE;CACX,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { NrTimelineElement } from './timeline.component.js';\nexport const NrTimeline = createComponent({\n tagName: 'nr-timeline',\n elementClass: NrTimelineElement,\n react: React,\n events: {},\n});\n"]}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { LitElement, nothing, TemplateResult } from 'lit';
7
+ import { TimelineMode, TimelineItem } from './timeline.types.js';
8
+ import '../icon/index.js';
9
+ declare const NrTimelineElement_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
10
+ /**
11
+ * # Timeline Component
12
+ *
13
+ * Vertical display timeline for showing a series of events in chronological order.
14
+ *
15
+ * ## Features
16
+ * - Multiple display modes (left, right, alternate)
17
+ * - Custom dot colors and icons
18
+ * - Label support for timestamps
19
+ * - Pending state for ongoing activities
20
+ * - Reverse order option
21
+ * - Custom positioning in alternate mode
22
+ * - Theme-aware styling
23
+ *
24
+ * ## Usage
25
+ * ```html
26
+ * <!-- Basic timeline -->
27
+ * <nr-timeline .items="${[
28
+ * { children: 'Create a services site', label: '2015-09-01' },
29
+ * { children: 'Solve initial network problems', label: '2015-09-01' },
30
+ * { children: 'Technical testing', label: '2015-09-01' }
31
+ * ]}"></nr-timeline>
32
+ *
33
+ * <!-- With custom colors -->
34
+ * <nr-timeline .items="${[
35
+ * { children: 'Success', color: 'green' },
36
+ * { children: 'Error', color: 'red' },
37
+ * { children: 'Processing', color: 'blue' }
38
+ * ]}"></nr-timeline>
39
+ *
40
+ * <!-- Alternate mode -->
41
+ * <nr-timeline mode="alternate" .items="${items}"></nr-timeline>
42
+ *
43
+ * <!-- With pending state -->
44
+ * <nr-timeline pending="Recording..." .items="${items}"></nr-timeline>
45
+ * ```
46
+ *
47
+ * @element nr-timeline
48
+ *
49
+ * @cssproperty --nuraly-timeline-item-padding-bottom - Bottom padding of timeline item
50
+ * @cssproperty --nuraly-timeline-tail-width - Width of connecting line
51
+ * @cssproperty --nuraly-timeline-tail-color - Color of connecting line
52
+ * @cssproperty --nuraly-timeline-dot-bg - Background color of dot
53
+ * @cssproperty --nuraly-timeline-dot-border-width - Border width of dot
54
+ */
55
+ export declare class NrTimelineElement extends NrTimelineElement_base {
56
+ static styles: import("lit").CSSResult;
57
+ requiredComponents: string[];
58
+ /**
59
+ * Timeline display mode
60
+ */
61
+ mode: TimelineMode;
62
+ /**
63
+ * Timeline items array
64
+ */
65
+ items: TimelineItem[];
66
+ /**
67
+ * Pending state - shows a pending item at the end
68
+ */
69
+ pending?: string;
70
+ /**
71
+ * Custom pending dot icon
72
+ */
73
+ pendingDot?: string;
74
+ /**
75
+ * Reverse timeline order
76
+ */
77
+ reverse: boolean;
78
+ /**
79
+ * Get item position for alternate mode
80
+ */
81
+ private getItemPosition;
82
+ /**
83
+ * Check if color is a preset color
84
+ */
85
+ private isPresetColor;
86
+ /**
87
+ * Get custom color style for dot
88
+ */
89
+ private getCustomColorStyle;
90
+ /**
91
+ * Render timeline item dot
92
+ */
93
+ private renderDot;
94
+ /**
95
+ * Render timeline item
96
+ */
97
+ private renderItem;
98
+ /**
99
+ * Render pending item
100
+ */
101
+ private renderPendingItem;
102
+ render(): TemplateResult<1> | typeof nothing;
103
+ }
104
+ declare global {
105
+ interface HTMLElementTagNameMap {
106
+ 'nr-timeline': NrTimelineElement;
107
+ }
108
+ }
109
+ export {};
110
+ //# sourceMappingURL=timeline.component.d.ts.map
@@ -0,0 +1,215 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
11
+ };
12
+ import { html, LitElement, nothing } from 'lit';
13
+ import { customElement, property } from 'lit/decorators.js';
14
+ import { classMap } from 'lit/directives/class-map.js';
15
+ import { map } from 'lit/directives/map.js';
16
+ import { styleMap } from 'lit/directives/style-map.js';
17
+ import { ifDefined } from 'lit/directives/if-defined.js';
18
+ import { styles } from './timeline.style.js';
19
+ import { NuralyUIBaseMixin } from '../../shared/base-mixin.js';
20
+ import '../icon/index.js';
21
+ /**
22
+ * # Timeline Component
23
+ *
24
+ * Vertical display timeline for showing a series of events in chronological order.
25
+ *
26
+ * ## Features
27
+ * - Multiple display modes (left, right, alternate)
28
+ * - Custom dot colors and icons
29
+ * - Label support for timestamps
30
+ * - Pending state for ongoing activities
31
+ * - Reverse order option
32
+ * - Custom positioning in alternate mode
33
+ * - Theme-aware styling
34
+ *
35
+ * ## Usage
36
+ * ```html
37
+ * <!-- Basic timeline -->
38
+ * <nr-timeline .items="${[
39
+ * { children: 'Create a services site', label: '2015-09-01' },
40
+ * { children: 'Solve initial network problems', label: '2015-09-01' },
41
+ * { children: 'Technical testing', label: '2015-09-01' }
42
+ * ]}"></nr-timeline>
43
+ *
44
+ * <!-- With custom colors -->
45
+ * <nr-timeline .items="${[
46
+ * { children: 'Success', color: 'green' },
47
+ * { children: 'Error', color: 'red' },
48
+ * { children: 'Processing', color: 'blue' }
49
+ * ]}"></nr-timeline>
50
+ *
51
+ * <!-- Alternate mode -->
52
+ * <nr-timeline mode="alternate" .items="${items}"></nr-timeline>
53
+ *
54
+ * <!-- With pending state -->
55
+ * <nr-timeline pending="Recording..." .items="${items}"></nr-timeline>
56
+ * ```
57
+ *
58
+ * @element nr-timeline
59
+ *
60
+ * @cssproperty --nuraly-timeline-item-padding-bottom - Bottom padding of timeline item
61
+ * @cssproperty --nuraly-timeline-tail-width - Width of connecting line
62
+ * @cssproperty --nuraly-timeline-tail-color - Color of connecting line
63
+ * @cssproperty --nuraly-timeline-dot-bg - Background color of dot
64
+ * @cssproperty --nuraly-timeline-dot-border-width - Border width of dot
65
+ */
66
+ let NrTimelineElement = class NrTimelineElement extends NuralyUIBaseMixin(LitElement) {
67
+ constructor() {
68
+ super(...arguments);
69
+ this.requiredComponents = ['nr-icon'];
70
+ /**
71
+ * Timeline display mode
72
+ */
73
+ this.mode = "left" /* TimelineMode.Left */;
74
+ /**
75
+ * Timeline items array
76
+ */
77
+ this.items = [];
78
+ /**
79
+ * Reverse timeline order
80
+ */
81
+ this.reverse = false;
82
+ }
83
+ /**
84
+ * Get item position for alternate mode
85
+ */
86
+ getItemPosition(item, index) {
87
+ if (this.mode !== "alternate" /* TimelineMode.Alternate */) {
88
+ return "left" /* TimelineItemPosition.Left */;
89
+ }
90
+ if (item.position) {
91
+ return item.position;
92
+ }
93
+ return index % 2 === 0 ? "left" /* TimelineItemPosition.Left */ : "right" /* TimelineItemPosition.Right */;
94
+ }
95
+ /**
96
+ * Check if color is a preset color
97
+ */
98
+ isPresetColor(color) {
99
+ if (!color)
100
+ return false;
101
+ const presetColors = ['blue', 'red', 'green', 'gray'];
102
+ return presetColors.includes(color);
103
+ }
104
+ /**
105
+ * Get custom color style for dot
106
+ */
107
+ getCustomColorStyle(color) {
108
+ if (!color || this.isPresetColor(color)) {
109
+ return {};
110
+ }
111
+ return {
112
+ borderColor: color,
113
+ };
114
+ }
115
+ /**
116
+ * Render timeline item dot
117
+ */
118
+ renderDot(item) {
119
+ const hasCustomDot = !!item.dot;
120
+ const color = item.color || "blue" /* TimelineItemColor.Blue */;
121
+ const isPreset = this.isPresetColor(color);
122
+ if (hasCustomDot) {
123
+ return html `
124
+ <div class="timeline-item-head-custom">
125
+ <nr-icon name="${ifDefined(item.dot)}"></nr-icon>
126
+ </div>
127
+ `;
128
+ }
129
+ const headClasses = {
130
+ 'timeline-item-head': true,
131
+ [color]: isPreset,
132
+ };
133
+ const headStyle = this.getCustomColorStyle(color);
134
+ return html `
135
+ <div class=${classMap(headClasses)} style=${styleMap(headStyle)}></div>
136
+ `;
137
+ }
138
+ /**
139
+ * Render timeline item
140
+ */
141
+ renderItem(item, index) {
142
+ const position = this.getItemPosition(item, index);
143
+ const itemClasses = {
144
+ 'timeline-item': true,
145
+ 'timeline-item-left': position === "left" /* TimelineItemPosition.Left */,
146
+ 'timeline-item-right': position === "right" /* TimelineItemPosition.Right */,
147
+ [item.className || '']: !!item.className,
148
+ };
149
+ return html `
150
+ <li class=${classMap(itemClasses)}>
151
+ <div class="timeline-item-tail"></div>
152
+ ${this.renderDot(item)}
153
+ <div class="timeline-item-content">
154
+ ${item.label && this.mode === "alternate" /* TimelineMode.Alternate */
155
+ ? html `<div class="timeline-item-label">${item.label}</div>`
156
+ : nothing}
157
+ <div>${item.children}</div>
158
+ ${item.label && this.mode !== "alternate" /* TimelineMode.Alternate */
159
+ ? html `<div style="color: var(--nuraly-color-text-secondary); margin-top: 4px;">${item.label}</div>`
160
+ : nothing}
161
+ </div>
162
+ </li>
163
+ `;
164
+ }
165
+ /**
166
+ * Render pending item
167
+ */
168
+ renderPendingItem() {
169
+ const pendingContent = typeof this.pending === 'string' ? this.pending : 'Loading...';
170
+ const pendingIconName = this.pendingDot || 'loading';
171
+ return html `
172
+ <li class="timeline-item pending">
173
+ <div class="timeline-item-tail"></div>
174
+ <div class="timeline-item-head-custom">
175
+ <nr-icon name="${pendingIconName}"></nr-icon>
176
+ </div>
177
+ <div class="timeline-item-content">
178
+ ${pendingContent}
179
+ </div>
180
+ </li>
181
+ `;
182
+ }
183
+ render() {
184
+ if (!this.items || this.items.length === 0) {
185
+ return nothing;
186
+ }
187
+ return html `
188
+ <ul class="timeline">
189
+ ${map(this.items, (item, index) => this.renderItem(item, index))}
190
+ ${this.pending ? this.renderPendingItem() : nothing}
191
+ </ul>
192
+ `;
193
+ }
194
+ };
195
+ NrTimelineElement.styles = styles;
196
+ __decorate([
197
+ property({ type: String, reflect: true })
198
+ ], NrTimelineElement.prototype, "mode", void 0);
199
+ __decorate([
200
+ property({ type: Array })
201
+ ], NrTimelineElement.prototype, "items", void 0);
202
+ __decorate([
203
+ property({ type: String })
204
+ ], NrTimelineElement.prototype, "pending", void 0);
205
+ __decorate([
206
+ property({ type: String, attribute: 'pending-dot' })
207
+ ], NrTimelineElement.prototype, "pendingDot", void 0);
208
+ __decorate([
209
+ property({ type: Boolean, reflect: true })
210
+ ], NrTimelineElement.prototype, "reverse", void 0);
211
+ NrTimelineElement = __decorate([
212
+ customElement('nr-timeline')
213
+ ], NrTimelineElement);
214
+ export { NrTimelineElement };
215
+ //# sourceMappingURL=timeline.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.component.js","sourceRoot":"","sources":["../../../src/components/timeline/timeline.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAO/D,OAAO,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAApE;;QAGW,uBAAkB,GAAG,CAAC,SAAS,CAAC,CAAC;QAE1C;;WAEG;QAEH,SAAI,kCAAmC;QAEvC;;WAEG;QAEH,UAAK,GAAmB,EAAE,CAAC;QAc3B;;WAEG;QAEH,YAAO,GAAG,KAAK,CAAC;IAgIlB,CAAC;IA9HC;;OAEG;IACK,eAAe,CAAC,IAAkB,EAAE,KAAa;QACvD,IAAI,IAAI,CAAC,IAAI,6CAA2B,EAAE;YACxC,8CAAiC;SAClC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QAED,OAAO,KAAK,GAAG,CAAC,K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AI,EAAE,KAAK,CAAC,CAAC;UAC9D,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,OAAO;;KAEtD,CAAC;IACJ,CAAC;CACF,CAAA;AAhKiB,wBAAM,GAAG,MAAO,CAAA;AAQhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACH;AAMvC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDACC;AAM3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACV;AAMjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;qDACjC;AAMpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAC3B;AAjCL,iBAAiB;IAD7B,aAAa,CAAC,aAAa,CAAC;GAChB,iBAAiB,CAiK7B;SAjKY,iBAAiB","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { html, LitElement, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { map } from 'lit/directives/map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styles } from './timeline.style.js';\nimport { NuralyUIBaseMixin } from '../../shared/base-mixin.js';\nimport {\n TimelineMode,\n TimelineItem,\n TimelineItemColor,\n TimelineItemPosition\n} from './timeline.types.js';\nimport '../icon/index.js';\n\n/**\n * # Timeline Component\n * \n * Vertical display timeline for showing a series of events in chronological order.\n * \n * ## Features\n * - Multiple display modes (left, right, alternate)\n * - Custom dot colors and icons\n * - Label support for timestamps\n * - Pending state for ongoing activities\n * - Reverse order option\n * - Custom positioning in alternate mode\n * - Theme-aware styling\n * \n * ## Usage\n * ```html\n * <!-- Basic timeline -->\n * <nr-timeline .items=\"${[\n * { children: 'Create a services site', label: '2015-09-01' },\n * { children: 'Solve initial network problems', label: '2015-09-01' },\n * { children: 'Technical testing', label: '2015-09-01' }\n * ]}\"></nr-timeline>\n * \n * <!-- With custom colors -->\n * <nr-timeline .items=\"${[\n * { children: 'Success', color: 'green' },\n * { children: 'Error', color: 'red' },\n * { children: 'Processing', color: 'blue' }\n * ]}\"></nr-timeline>\n * \n * <!-- Alternate mode -->\n * <nr-timeline mode=\"alternate\" .items=\"${items}\"></nr-timeline>\n * \n * <!-- With pending state -->\n * <nr-timeline pending=\"Recording...\" .items=\"${items}\"></nr-timeline>\n * ```\n * \n * @element nr-timeline\n * \n * @cssproperty --nuraly-timeline-item-padding-bottom - Bottom padding of timeline item\n * @cssproperty --nuraly-timeline-tail-width - Width of connecting line\n * @cssproperty --nuraly-timeline-tail-color - Color of connecting line\n * @cssproperty --nuraly-timeline-dot-bg - Background color of dot\n * @cssproperty --nuraly-timeline-dot-border-width - Border width of dot\n */\n@customElement('nr-timeline')\nexport class NrTimelineElement extends NuralyUIBaseMixin(LitElement) {\n static override styles = styles;\n\n override requiredComponents = ['nr-icon'];\n\n /**\n * Timeline display mode\n */\n @property({ type: String, reflect: true })\n mode: TimelineMode = TimelineMode.Left;\n\n /**\n * Timeline items array\n */\n @property({ type: Array })\n items: TimelineItem[] = [];\n\n /**\n * Pending state - shows a pending item at the end\n */\n @property({ type: String })\n pending?: string;\n\n /**\n * Custom pending dot icon\n */\n @property({ type: String, attribute: 'pending-dot' })\n pendingDot?: string;\n\n /**\n * Reverse timeline order\n */\n @property({ type: Boolean, reflect: true })\n reverse = false;\n\n /**\n * Get item position for alternate mode\n */\n private getItemPosition(item: TimelineItem, index: number): TimelineItemPosition {\n if (this.mode !== TimelineMode.Alternate) {\n return TimelineItemPosition.Left;\n }\n\n if (item.position) {\n return item.position;\n }\n\n return index % 2 === 0 ? TimelineItemPosition.Left : TimelineItemPosition.Right;\n }\n\n /**\n * Check if color is a preset color\n */\n private isPresetColor(color?: string): boolean {\n if (!color) return false;\n const presetColors = ['blue', 'red', 'green', 'gray'];\n return presetColors.includes(color);\n }\n\n /**\n * Get custom color style for dot\n */\n private getCustomColorStyle(color?: string): Record<string, string> {\n if (!color || this.isPresetColor(color)) {\n return {};\n }\n\n return {\n borderColor: color,\n };\n }\n\n /**\n * Render timeline item dot\n */\n private renderDot(item: TimelineItem): TemplateResult {\n const hasCustomDot = !!item.dot;\n const color = item.color || TimelineItemColor.Blue;\n const isPreset = this.isPresetColor(color);\n\n if (hasCustomDot) {\n return html`\n <div class=\"timeline-item-head-custom\">\n <nr-icon name=\"${ifDefined(item.dot)}\"></nr-icon>\n </div>\n `;\n }\n\n const headClasses = {\n 'timeline-item-head': true,\n [color]: isPreset,\n };\n\n const headStyle = this.getCustomColorStyle(color);\n\n return html`\n <div class=${classMap(headClasses)} style=${styleMap(headStyle)}></div>\n `;\n }\n\n /**\n * Render timeline item\n */\n private renderItem(item: TimelineItem, index: number): TemplateResult {\n const position = this.getItemPosition(item, index);\n const itemClasses = {\n 'timeline-item': true,\n 'timeline-item-left': position === TimelineItemPosition.Left,\n 'timeline-item-right': position === TimelineItemPosition.Right,\n [item.className || '']: !!item.className,\n };\n\n return html`\n <li class=${classMap(itemClasses)}>\n <div class=\"timeline-item-tail\"></div>\n ${this.renderDot(item)}\n <div class=\"timeline-item-content\">\n ${item.label && this.mode === TimelineMode.Alternate\n ? html`<div class=\"timeline-item-label\">${item.label}</div>`\n : nothing}\n <div>${item.children}</div>\n ${item.label && this.mode !== TimelineMode.Alternate\n ? html`<div style=\"color: var(--nuraly-color-text-secondary); margin-top: 4px;\">${item.label}</div>`\n : nothing}\n </div>\n </li>\n `;\n }\n\n /**\n * Render pending item\n */\n private renderPendingItem(): TemplateResult {\n const pendingContent = typeof this.pending === 'string' ? this.pending : 'Loading...';\n const pendingIconName = this.pendingDot || 'loading';\n\n return html`\n <li class=\"timeline-item pending\">\n <div class=\"timeline-item-tail\"></div>\n <div class=\"timeline-item-head-custom\">\n <nr-icon name=\"${pendingIconName}\"></nr-icon>\n </div>\n <div class=\"timeline-item-content\">\n ${pendingContent}\n </div>\n </li>\n `;\n }\n\n override render() {\n if (!this.items || this.items.length === 0) {\n return nothing;\n }\n\n return html`\n <ul class=\"timeline\">\n ${map(this.items, (item, index) => this.renderItem(item, index))}\n ${this.pending ? this.renderPendingItem() : nothing}\n </ul>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nr-timeline': NrTimelineElement;\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Timeline component styles for the Hybrid UI Library
8
+ * Using shared CSS variables from /src/shared/themes/
9
+ *
10
+ * This file contains all the styling for the nr-timeline component with
11
+ * clean CSS variable usage without local fallbacks and proper theme switching support.
12
+ */
13
+ export declare const styles: import("lit").CSSResult;
14
+ //# sourceMappingURL=timeline.style.d.ts.map
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { css } from 'lit';
7
+ /**
8
+ * Timeline component styles for the Hybrid UI Library
9
+ * Using shared CSS variables from /src/shared/themes/
10
+ *
11
+ * This file contains all the styling for the nr-timeline component with
12
+ * clean CSS variable usage without local fallbacks and proper theme switching support.
13
+ */
14
+ export const styles = css `
15
+ :host {
16
+ display: block;
17
+ font-family: var(--nuraly-font-family);
18
+ font-size: var(--nuraly-font-size-base, 14px);
19
+ line-height: 1.5715;
20
+ color: var(--nuraly-color-text);
21
+ }
22
+
23
+ .timeline {
24
+ margin: 0;
25
+ padding: 0;
26
+ list-style: none;
27
+ }
28
+
29
+ /* Timeline Item */
30
+ .timeline-item {
31
+ position: relative;
32
+ padding-bottom: var(--nuraly-timeline-item-padding-bottom, 20px);
33
+ list-style: none;
34
+ }
35
+
36
+ .timeline-item:last-child {
37
+ padding-bottom: 0;
38
+ }
39
+
40
+ /* Timeline Tail (connecting line) */
41
+ .timeline-item-tail {
42
+ position: absolute;
43
+ top: 10px;
44
+ left: 4px;
45
+ height: calc(100% - 10px);
46
+ border-left: var(--nuraly-timeline-tail-width, 2px) solid var(--nuraly-timeline-tail-color, rgba(5, 5, 5, 0.06));
47
+ }
48
+
49
+ .timeline-item:last-child .timeline-item-tail {
50
+ display: none;
51
+ }
52
+
53
+ .timeline-item.pending .timeline-item-tail {
54
+ display: block;
55
+ }
56
+
57
+ /* Timeline Head (dot container) */
58
+ .timeline-item-head {
59
+ position: absolute;
60
+ top: 5.5px;
61
+ left: 0;
62
+ width: 10px;
63
+ height: 10px;
64
+ background-color: var(--nuraly-timeline-dot-bg, #ffffff);
65
+ border: var(--nuraly-timeline-dot-border-width, 2px) solid transparent;
66
+ border-radius: 50%;
67
+ }
68
+
69
+ /* Timeline Head Colors */
70
+ .timeline-item-head.blue {
71
+ border-color: var(--nuraly-color-primary, #1890ff);
72
+ }
73
+
74
+ .timeline-item-head.red {
75
+ border-color: var(--nuraly-color-error, #ff4d4f);
76
+ }
77
+
78
+ .timeline-item-head.green {
79
+ border-color: var(--nuraly-color-success, #52c41a);
80
+ }
81
+
82
+ .timeline-item-head.gray {
83
+ border-color: var(--nuraly-color-text-disabled, #d9d9d9);
84
+ }
85
+
86
+ /* Custom Head (with icon or custom content) */
87
+ .timeline-item-head-custom {
88
+ position: absolute;
89
+ top: 5.5px;
90
+ left: 0;
91
+ width: auto;
92
+ height: auto;
93
+ margin-top: 0;
94
+ padding: 3px 1px;
95
+ line-height: 1;
96
+ text-align: center;
97
+ border: 0;
98
+ border-radius: 0;
99
+ transform: translate(-50%, -50%);
100
+ top: 10px;
101
+ left: 5px;
102
+ }
103
+
104
+ .timeline-item-head-custom nr-icon {
105
+ font-size: 16px;
106
+ vertical-align: middle;
107
+ }
108
+
109
+ /* Timeline Content */
110
+ .timeline-item-content {
111
+ position: relative;
112
+ top: calc(-1 * var(--nuraly-font-size-base, 14px) * 1.5715 - 2px);
113
+ margin: 0 0 0 26px;
114
+ word-break: break-word;
115
+ }
116
+
117
+ /* Timeline Label */
118
+ .timeline-item-label {
119
+ position: absolute;
120
+ top: calc(-1 * var(--nuraly-font-size-base, 14px) * 1.5715 / 2);
121
+ width: calc(50% - 12px);
122
+ text-align: right;
123
+ color: var(--nuraly-color-text-secondary, rgba(0, 0, 0, 0.45));
124
+ }
125
+
126
+ /* Pending Item */
127
+ .timeline-item.pending .timeline-item-head {
128
+ border-color: var(--nuraly-color-primary, #1890ff);
129
+ }
130
+
131
+ .timeline-item.pending .timeline-item-content {
132
+ color: var(--nuraly-color-text-secondary, rgba(0, 0, 0, 0.45));
133
+ }
134
+
135
+ /* Right Mode */
136
+ :host([mode="right"]) .timeline-item-tail {
137
+ left: auto;
138
+ right: 4px;
139
+ }
140
+
141
+ :host([mode="right"]) .timeline-item-head,
142
+ :host([mode="right"]) .timeline-item-head-custom {
143
+ left: auto;
144
+ right: 0;
145
+ }
146
+
147
+ :host([mode="right"]) .timeline-item-head-custom {
148
+ right: 5px;
149
+ }
150
+
151
+ :host([mode="right"]) .timeline-item-content {
152
+ margin: 0 26px 0 0;
153
+ text-align: right;
154
+ }
155
+
156
+ /* Alternate Mode */
157
+ :host([mode="alternate"]) .timeline,
158
+ :host([mode="alternate"]) .timeline-item {
159
+ display: block;
160
+ }
161
+
162
+ :host([mode="alternate"]) .timeline-item-tail,
163
+ :host([mode="alternate"]) .timeline-item-head,
164
+ :host([mode="alternate"]) .timeline-item-head-custom {
165
+ left: 50%;
166
+ margin-left: -1px;
167
+ }
168
+
169
+ :host([mode="alternate"]) .timeline-item-head {
170
+ margin-left: -5px;
171
+ }
172
+
173
+ :host([mode="alternate"]) .timeline-item-head-custom {
174
+ margin-left: -5px;
175
+ }
176
+
177
+ :host([mode="alternate"]) .timeline-item-left .timeline-item-content {
178
+ left: calc(50% - 4px);
179
+ width: calc(50% - 14px);
180
+ text-align: left;
181
+ }
182
+
183
+ :host([mode="alternate"]) .timeline-item-right .timeline-item-content {
184
+ left: auto;
185
+ right: calc(50% - 4px);
186
+ width: calc(50% - 14px);
187
+ text-align: right;
188
+ }
189
+
190
+ /* Alternate with Label */
191
+ :host([mode="alternate"]) .timeline-item-left .timeline-item-label {
192
+ left: calc(50% + 14px);
193
+ width: calc(50% - 14px);
194
+ text-align: left;
195
+ }
196
+
197
+ :host([mode="alternate"]) .timeline-item-right .timeline-item-label {
198
+ right: calc(50% + 14px);
199
+ width: calc(50% - 14px);
200
+ text-align: right;
201
+ }
202
+
203
+ /* Reverse Mode */
204
+ :host([reverse]) .timeline {
205
+ display: flex;
206
+ flex-direction: column-reverse;
207
+ }
208
+
209
+ /* RTL Support */
210
+ :host([dir="rtl"]) .timeline-item-tail {
211
+ left: auto;
212
+ right: 4px;
213
+ }
214
+
215
+ :host([dir="rtl"]) .timeline-item-head,
216
+ :host([dir="rtl"]) .timeline-item-head-custom {
217
+ left: auto;
218
+ right: 0;
219
+ }
220
+
221
+ :host([dir="rtl"]) .timeline-item-content {
222
+ margin: 0 26px 0 0;
223
+ }
224
+
225
+ :host([dir="rtl"]) .timeline-item-label {
226
+ text-align: left;
227
+ }
228
+
229
+ /* Dark theme support */
230
+ :host([data-theme*="dark"]) .timeline-item-tail {
231
+ border-color: var(--nuraly-timeline-tail-color, rgba(255, 255, 255, 0.12));
232
+ }
233
+ `;
234
+ //# sourceMappingURL=timeline.style.js.map