@nuralyui/timeline 0.0.1 → 0.0.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/bundle.js +1 -1
- package/index.d.ts +0 -0
- package/index.js +0 -0
- package/index.js.map +0 -0
- package/package.json +4 -4
- package/react.d.ts +0 -0
- package/react.js +0 -0
- package/react.js.map +0 -0
- package/timeline.component.d.ts +1 -1
- package/timeline.component.js +1 -1
- package/timeline.component.js.map +1 -1
- package/timeline.style.d.ts +0 -0
- package/timeline.style.js +0 -0
- package/timeline.style.js.map +0 -0
- package/timeline.types.d.ts +0 -0
- package/timeline.types.js +0 -0
- package/timeline.types.js.map +0 -0
package/bundle.js
CHANGED
|
@@ -461,7 +461,7 @@ const Kc="important",Xc=" !"+Kc,Qc=$c(class extends _c{constructor(c){var a;if(s
|
|
|
461
461
|
|
|
462
462
|
/* Size properties with fallbacks */
|
|
463
463
|
--nuraly-icon-size-fallback: 18px;
|
|
464
|
-
--nuraly-icon-size-small-fallback:
|
|
464
|
+
--nuraly-icon-size-small-fallback: 14px;
|
|
465
465
|
--nuraly-icon-size-medium-fallback: 20px;
|
|
466
466
|
--nuraly-icon-size-large-fallback: 24px;
|
|
467
467
|
--nuraly-icon-size-xlarge-fallback: 32px;
|
package/index.d.ts
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
package/index.js.map
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuralyui/timeline",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Timeline component for NuralyUI library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/Nuralyio/NuralyUI.git",
|
|
28
28
|
"directory": "src/components/timeline"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"author": "Nuraly, Laabidi Aymen",
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"bugs": {
|
|
44
|
-
"url": "https://github.com/
|
|
44
|
+
"url": "https://github.com/Nuralyio/NuralyUI/issues"
|
|
45
45
|
},
|
|
46
|
-
"homepage": "https://github.com/
|
|
46
|
+
"homepage": "https://github.com/Nuralyio/NuralyUI#readme"
|
|
47
47
|
}
|
package/react.d.ts
CHANGED
|
File without changes
|
package/react.js
CHANGED
|
File without changes
|
package/react.js.map
CHANGED
|
File without changes
|
package/timeline.component.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { LitElement, nothing, TemplateResult } from 'lit';
|
|
7
7
|
import { TimelineMode, TimelineItem } from './timeline.types.js';
|
|
8
8
|
import '../icon/index.js';
|
|
9
|
-
declare const NrTimelineElement_base: (new (...args: any[]) => import("
|
|
9
|
+
declare const NrTimelineElement_base: (new (...args: any[]) => import("@nuralyui/common/mixins").DependencyAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").ThemeAware) & (new (...args: any[]) => import("@nuralyui/common/mixins").EventHandlerCapable) & typeof LitElement;
|
|
10
10
|
/**
|
|
11
11
|
* # Timeline Component
|
|
12
12
|
*
|
package/timeline.component.js
CHANGED
|
@@ -16,7 +16,7 @@ import { map } from 'lit/directives/map.js';
|
|
|
16
16
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
17
17
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
18
18
|
import { styles } from './timeline.style.js';
|
|
19
|
-
import { NuralyUIBaseMixin } from '
|
|
19
|
+
import { NuralyUIBaseMixin } from '@nuralyui/common/mixins';
|
|
20
20
|
import '../icon/index.js';
|
|
21
21
|
/**
|
|
22
22
|
* # Timeline Component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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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"]}
|
|
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,yBAAyB,CAAC;AAO5D,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,CA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C,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,IAAI,CAAA;;UAEL,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,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 '@nuralyui/common/mixins';\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"]}
|
package/timeline.style.d.ts
CHANGED
|
File without changes
|
package/timeline.style.js
CHANGED
|
File without changes
|
package/timeline.style.js.map
CHANGED
|
File without changes
|
package/timeline.types.d.ts
CHANGED
|
File without changes
|
package/timeline.types.js
CHANGED
|
File without changes
|
package/timeline.types.js.map
CHANGED
|
File without changes
|