@redvars/peacock 3.8.6 → 3.9.0

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "3.8.6",
5
+ "version": "3.9.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
package/readme.md CHANGED
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.6/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.9.0/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.6/dist/loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.9.0/dist/loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
package/src/index.ts CHANGED
@@ -42,6 +42,7 @@ export { Popover, PopoverContent } from './popover/index.js';
42
42
  export { Breadcrumb, BreadcrumbItem } from './breadcrumb/index.js';
43
43
  export { Menu, MenuItem, SubMenu } from './menu/index.js';
44
44
  export { List, ListItem } from './list/index.js';
45
+ export { Timeline, TimelineItem } from './timeline/index.js';
45
46
  export { Item } from './item/index.js';
46
47
 
47
48
  export { CodeHighlighter } from './code-highlighter/index.js';
package/src/loader.ts CHANGED
@@ -34,6 +34,8 @@ import { SubMenu } from '@/menu/sub-menu/sub-menu.js';
34
34
  import { Item } from '@/item/item.js';
35
35
  import { List } from '@/list/list.js';
36
36
  import { ListItem } from '@/list/list-item.js';
37
+ import { Timeline } from '@/timeline/timeline.js';
38
+ import { TimelineItem } from '@/timeline/timeline-item.js';
37
39
 
38
40
  import { Accordion } from '@/accordion/accordion.js';
39
41
  import { Link } from '@/link/link.js';
@@ -305,6 +307,12 @@ const loaderConfig: LoaderConfig = {
305
307
  'wc-list-item': {
306
308
  CustomElementClass: ListItem,
307
309
  },
310
+ 'wc-timeline': {
311
+ CustomElementClass: Timeline,
312
+ },
313
+ 'wc-timeline-item': {
314
+ CustomElementClass: TimelineItem,
315
+ },
308
316
  'wc-item': {
309
317
  CustomElementClass: Item,
310
318
  },
@@ -0,0 +1,2 @@
1
+ export { Timeline } from './timeline.js';
2
+ export { TimelineItem } from './timeline-item.js';
@@ -0,0 +1,108 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .timeline-item {
6
+ display: grid;
7
+ grid-template-columns: auto 1fr;
8
+ gap: 0.75rem;
9
+ align-items: stretch;
10
+ }
11
+
12
+ :host-context([orientation='horizontal']) .timeline-item {
13
+ display: grid;
14
+ grid-template-rows: auto 1fr;
15
+ grid-template-columns: 1fr;
16
+ gap: 0.75rem;
17
+ align-items: stretch;
18
+ min-height: auto;
19
+ }
20
+
21
+ .marker-column {
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ width: var(--timeline-dot-size, 2rem);
26
+ }
27
+
28
+ :host-context([orientation='horizontal']) .marker-column {
29
+ display: flex;
30
+ flex-direction: row;
31
+ align-items: center;
32
+ width: auto;
33
+ height: var(--timeline-dot-size, 2rem);
34
+ }
35
+
36
+ .marker {
37
+ position: relative;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ width: var(--timeline-dot-size, 2rem);
42
+ height: var(--timeline-dot-size, 2rem);
43
+ flex-shrink: 0;
44
+ }
45
+
46
+ .marker-dot {
47
+ width: var(--timeline-dot-size, 2rem);
48
+ height: var(--timeline-dot-size, 2rem);
49
+ min-width: var(--timeline-dot-size, 2rem);
50
+ border-radius: 50%;
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ background: var(--timeline-dot-bg, var(--color-primary));
55
+ --icon-color: var(--timeline-dot-color, var(--color-on-primary));
56
+ position: relative;
57
+ z-index: 2;
58
+ }
59
+
60
+ .marker-dot ::slotted(wc-icon) {
61
+ --icon-size: calc(var(--timeline-dot-size, 2rem) * 0.6);
62
+ }
63
+
64
+ .dot-spinner {
65
+ --progress-height: calc(var(--timeline-dot-size, 2rem) * 0.6);
66
+ }
67
+
68
+ /* Flexible connector line that stretches to fill remaining height */
69
+ .connector {
70
+ flex: 1;
71
+ min-height: 2rem;
72
+ width: 2px;
73
+ background: var(--timeline-line-color, var(--color-outline));
74
+ margin: auto;
75
+ margin-block: .25rem;
76
+ }
77
+
78
+ :host(:last-child) .connector {
79
+ display: none;
80
+ }
81
+
82
+ /* Horizontal orientation connector */
83
+ :host-context([orientation='horizontal']) .connector {
84
+ flex: 1;
85
+ min-width: 2rem;
86
+ width: auto;
87
+ height: 2px;
88
+ background: var(--timeline-line-color, var(--color-outline));
89
+ margin: auto;
90
+ margin-inline: .25rem;
91
+ }
92
+
93
+ :host-context([orientation='horizontal']):last-child .connector {
94
+ display: none;
95
+ }
96
+
97
+
98
+ .content {
99
+ display: flex;
100
+ flex-direction: column;
101
+ gap: 0.25rem;
102
+ }
103
+
104
+
105
+ .description {
106
+ color: var(--timeline-description-color, var(--color-on-surface-variant));
107
+ line-height: 1.4;
108
+ }
@@ -0,0 +1,62 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import styles from './timeline-item.scss';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
+
6
+ /**
7
+ * @label Timeline Item
8
+ * @tag wc-timeline-item
9
+ * @rawTag timeline-item
10
+ *
11
+ * @summary An item for use inside a timeline, with a dot/marker and description.
12
+ *
13
+ * @example
14
+ * ```html
15
+ * <wc-timeline-item description="Step completed">
16
+ * <span>Step title</span>
17
+ * <wc-icon slot="dot" name="check"></wc-icon>
18
+ * </wc-timeline-item>
19
+ * ```
20
+ * @tags display
21
+ */
22
+ @IndividualComponent
23
+ export class TimelineItem extends LitElement {
24
+ static styles = [styles];
25
+
26
+ @property({ type: Boolean, reflect: true }) loading = false;
27
+
28
+ connectedCallback() {
29
+ super.connectedCallback();
30
+ if (!this.hasAttribute('role')) {
31
+ this.setAttribute('role', 'listitem');
32
+ }
33
+ }
34
+
35
+ render() {
36
+ return html`
37
+ <div class="timeline-item">
38
+ <div class="marker-column">
39
+ <div class="marker">
40
+ <div class="marker-dot">
41
+ ${this.loading
42
+ ? html`<wc-circular-progress
43
+ class="dot-spinner"
44
+ indeterminate
45
+ aria-label="Loading"
46
+ ></wc-circular-progress>`
47
+ : html`<slot name="dot"></slot>`}
48
+ </div>
49
+ </div>
50
+ <div class="connector"></div>
51
+ </div>
52
+
53
+ <div class="content">
54
+ <div class="headline"><slot></slot></div>
55
+ <div class="description">
56
+ <slot name="content"></slot>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ `;
61
+ }
62
+ }
@@ -0,0 +1,21 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .timeline {
6
+ display: grid;
7
+ gap: 0;
8
+ position: relative;
9
+ padding-left: calc(var(--timeline-dot-size, 2rem) / 2);
10
+ }
11
+
12
+ :host([orientation='horizontal']) .timeline {
13
+ display: grid;
14
+ gap: 0;
15
+ position: relative;
16
+ padding-left: 0;
17
+ padding-top: calc(var(--timeline-dot-size, 2rem) / 2);
18
+ grid-auto-flow: column;
19
+ grid-template-rows: 1fr;
20
+ }
21
+
@@ -0,0 +1,43 @@
1
+ import { LitElement, html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import styles from './timeline.scss';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
+ import { TimelineItem } from './timeline-item.js';
6
+
7
+ /**
8
+ * @label Timeline
9
+ * @tag wc-timeline
10
+ * @rawTag timeline
11
+ *
12
+ * @summary A vertical timeline layout for a series of timeline items.
13
+ *
14
+ * @example
15
+ * ```html
16
+ * <wc-timeline>
17
+ * <wc-timeline-item description="Task completed">
18
+ * <span>Task title</span>
19
+ * <wc-icon slot="dot" name="check"></wc-icon>
20
+ * </wc-timeline-item>
21
+ * </wc-timeline>
22
+ * ```
23
+ * @tags display
24
+ */
25
+ @IndividualComponent
26
+ export class Timeline extends LitElement {
27
+ static styles = [styles];
28
+
29
+ static Item = TimelineItem;
30
+
31
+ @property({ type: String, reflect: true }) orientation: 'vertical' | 'horizontal' = 'vertical';
32
+
33
+ connectedCallback() {
34
+ super.connectedCallback();
35
+ if (!this.hasAttribute('role')) {
36
+ this.setAttribute('role', 'list');
37
+ }
38
+ }
39
+
40
+ render() {
41
+ return html`<div class="timeline"><slot></slot></div>`;
42
+ }
43
+ }