@arclux/arc-ui 1.0.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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/package.json +186 -0
  4. package/src/content/accordion-item.js +27 -0
  5. package/src/content/accordion.js +151 -0
  6. package/src/content/animated-number.js +160 -0
  7. package/src/content/aspect-ratio.js +78 -0
  8. package/src/content/avatar-group.js +101 -0
  9. package/src/content/avatar.js +92 -0
  10. package/src/content/badge.js +98 -0
  11. package/src/content/callout.js +141 -0
  12. package/src/content/card.js +75 -0
  13. package/src/content/carousel.js +300 -0
  14. package/src/content/code-block.js +152 -0
  15. package/src/content/collapsible.js +142 -0
  16. package/src/content/color-swatch.js +86 -0
  17. package/src/content/column.js +28 -0
  18. package/src/content/data-table.js +332 -0
  19. package/src/content/divider.js +153 -0
  20. package/src/content/empty-state.js +78 -0
  21. package/src/content/feature-card.js +142 -0
  22. package/src/content/highlight.js +63 -0
  23. package/src/content/icon-library.js +30 -0
  24. package/src/content/icon-registry.js +39 -0
  25. package/src/content/icon.js +95 -0
  26. package/src/content/index.js +44 -0
  27. package/src/content/infinite-scroll.js +144 -0
  28. package/src/content/kbd.js +40 -0
  29. package/src/content/markdown.js +294 -0
  30. package/src/content/marquee.js +166 -0
  31. package/src/content/meter.js +167 -0
  32. package/src/content/scroll-area.js +107 -0
  33. package/src/content/skeleton.js +85 -0
  34. package/src/content/spinner.js +77 -0
  35. package/src/content/stack.js +68 -0
  36. package/src/content/stat.js +72 -0
  37. package/src/content/step.js +22 -0
  38. package/src/content/stepper.js +202 -0
  39. package/src/content/table.js +134 -0
  40. package/src/content/tag.js +156 -0
  41. package/src/content/text.js +111 -0
  42. package/src/content/timeline-item.js +29 -0
  43. package/src/content/timeline.js +170 -0
  44. package/src/content/truncate.js +161 -0
  45. package/src/content/value-card.js +94 -0
  46. package/src/feedback/alert.js +187 -0
  47. package/src/feedback/command-item.js +28 -0
  48. package/src/feedback/command-palette.js +346 -0
  49. package/src/feedback/context-menu.js +299 -0
  50. package/src/feedback/dialog.js +298 -0
  51. package/src/feedback/dropdown-menu.js +259 -0
  52. package/src/feedback/hover-card.js +186 -0
  53. package/src/feedback/index.js +17 -0
  54. package/src/feedback/modal.js +226 -0
  55. package/src/feedback/notification-panel.js +196 -0
  56. package/src/feedback/popover.js +184 -0
  57. package/src/feedback/progress.js +169 -0
  58. package/src/feedback/sheet.js +249 -0
  59. package/src/feedback/toast.js +207 -0
  60. package/src/feedback/tooltip.js +189 -0
  61. package/src/icons/lucide.d.ts +1915 -0
  62. package/src/icons/lucide.js +1915 -0
  63. package/src/icons/phosphor.d.ts +1517 -0
  64. package/src/icons/phosphor.js +1517 -0
  65. package/src/icons/types.d.ts +8 -0
  66. package/src/index.js +9 -0
  67. package/src/input/button.js +127 -0
  68. package/src/input/calendar.js +340 -0
  69. package/src/input/checkbox.js +159 -0
  70. package/src/input/chip.js +120 -0
  71. package/src/input/color-picker.js +461 -0
  72. package/src/input/combobox.js +295 -0
  73. package/src/input/copy-button.js +144 -0
  74. package/src/input/date-picker.js +534 -0
  75. package/src/input/file-upload.js +333 -0
  76. package/src/input/form.js +179 -0
  77. package/src/input/icon-button.js +179 -0
  78. package/src/input/index.js +31 -0
  79. package/src/input/input.js +158 -0
  80. package/src/input/multi-select.js +392 -0
  81. package/src/input/number-input.js +239 -0
  82. package/src/input/otp-input.js +221 -0
  83. package/src/input/pin-input.js +294 -0
  84. package/src/input/radio-group.js +177 -0
  85. package/src/input/radio.js +28 -0
  86. package/src/input/rating.js +195 -0
  87. package/src/input/search.js +371 -0
  88. package/src/input/segmented-control.js +174 -0
  89. package/src/input/select.js +267 -0
  90. package/src/input/slider.js +217 -0
  91. package/src/input/sortable-list.js +345 -0
  92. package/src/input/suggestion.js +26 -0
  93. package/src/input/textarea.js +203 -0
  94. package/src/input/theme-toggle.js +196 -0
  95. package/src/input/toggle.js +166 -0
  96. package/src/layout/app-shell.js +266 -0
  97. package/src/layout/auth-shell.js +153 -0
  98. package/src/layout/container.js +37 -0
  99. package/src/layout/dashboard-grid.js +62 -0
  100. package/src/layout/index.js +15 -0
  101. package/src/layout/page-header.js +100 -0
  102. package/src/layout/page-layout.js +112 -0
  103. package/src/layout/resizable.js +221 -0
  104. package/src/layout/section.js +54 -0
  105. package/src/layout/settings-layout.js +91 -0
  106. package/src/layout/split-pane.js +172 -0
  107. package/src/layout/status-bar.js +84 -0
  108. package/src/layout/toolbar.js +92 -0
  109. package/src/navigation/breadcrumb-item.js +26 -0
  110. package/src/navigation/breadcrumb.js +129 -0
  111. package/src/navigation/drawer.js +183 -0
  112. package/src/navigation/footer.js +99 -0
  113. package/src/navigation/index.js +22 -0
  114. package/src/navigation/link.js +120 -0
  115. package/src/navigation/nav-item.js +46 -0
  116. package/src/navigation/navigation-menu.js +687 -0
  117. package/src/navigation/pagination.js +186 -0
  118. package/src/navigation/scroll-spy.js +198 -0
  119. package/src/navigation/scroll-to-top.js +163 -0
  120. package/src/navigation/sidebar-link.js +28 -0
  121. package/src/navigation/sidebar-section.js +45 -0
  122. package/src/navigation/sidebar.js +336 -0
  123. package/src/navigation/spy-link.js +26 -0
  124. package/src/navigation/tab.js +26 -0
  125. package/src/navigation/tabs.js +202 -0
  126. package/src/navigation/top-bar.js +263 -0
  127. package/src/navigation/tree-item.js +38 -0
  128. package/src/navigation/tree-view.js +255 -0
  129. package/src/shared/index.js +6 -0
  130. package/src/shared/menu-divider.js +9 -0
  131. package/src/shared/menu-item.js +30 -0
  132. package/src/shared/option.js +31 -0
  133. package/src/shared-styles.js +81 -0
  134. package/src/tokens.js +445 -0
  135. package/types/index.d.ts +973 -0
@@ -0,0 +1,186 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ export class ArcPagination extends LitElement {
5
+ static properties = {
6
+ total: { type: Number },
7
+ current: { type: Number, reflect: true },
8
+ siblings: { type: Number },
9
+ };
10
+
11
+ static styles = [
12
+ tokenStyles,
13
+ css`
14
+ :host { display: inline-flex; }
15
+
16
+ .pagination {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: var(--space-xs);
20
+ font-family: var(--font-body);
21
+ }
22
+
23
+ .pagination__btn {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ min-width: 32px;
28
+ height: 32px;
29
+ padding: 0 var(--space-sm);
30
+ border: 1px solid var(--border-default);
31
+ border-radius: var(--radius-sm);
32
+ background: transparent;
33
+ color: var(--text-secondary);
34
+ font-family: var(--font-body);
35
+ font-size: var(--text-sm);
36
+ cursor: pointer;
37
+ transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
38
+ user-select: none;
39
+ }
40
+
41
+ .pagination__btn:hover:not(:disabled):not(.is-active) {
42
+ border-color: var(--border-bright);
43
+ color: var(--text-primary);
44
+ background: var(--bg-hover);
45
+ }
46
+
47
+ .pagination__btn:focus-visible {
48
+ outline: none;
49
+ box-shadow: var(--focus-glow);
50
+ }
51
+
52
+ .pagination__btn:disabled {
53
+ opacity: 0.3;
54
+ cursor: not-allowed;
55
+ }
56
+
57
+ .pagination__btn.is-active {
58
+ background: var(--accent-primary);
59
+ border-color: var(--accent-primary);
60
+ color: var(--text-primary);
61
+ box-shadow: 0 0 12px rgba(var(--accent-primary-rgb), 0.4);
62
+ }
63
+
64
+ .pagination__ellipsis {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ min-width: 32px;
69
+ height: 32px;
70
+ color: var(--text-muted);
71
+ font-size: var(--text-sm);
72
+ user-select: none;
73
+ }
74
+
75
+ @media (prefers-reduced-motion: reduce) {
76
+ :host *,
77
+ :host *::before,
78
+ :host *::after {
79
+ animation-duration: 0.01ms !important;
80
+ animation-iteration-count: 1 !important;
81
+ transition-duration: 0.01ms !important;
82
+ }
83
+ }
84
+ `,
85
+ ];
86
+
87
+ constructor() {
88
+ super();
89
+ this.total = 1;
90
+ this.current = 1;
91
+ this.siblings = 1;
92
+ }
93
+
94
+ _getPageRange() {
95
+ const total = Math.max(1, this.total);
96
+ const current = Math.min(Math.max(1, this.current), total);
97
+ const siblings = Math.max(0, this.siblings);
98
+
99
+ // Always show first, last, current, and siblings around current
100
+ const pages = new Set();
101
+ pages.add(1);
102
+ pages.add(total);
103
+
104
+ const start = Math.max(2, current - siblings);
105
+ const end = Math.min(total - 1, current + siblings);
106
+ for (let i = start; i <= end; i++) {
107
+ pages.add(i);
108
+ }
109
+
110
+ const sorted = [...pages].sort((a, b) => a - b);
111
+
112
+ // Insert ellipsis markers
113
+ const result = [];
114
+ let prev = 0;
115
+ for (const page of sorted) {
116
+ if (page - prev > 1) {
117
+ result.push('...');
118
+ }
119
+ result.push(page);
120
+ prev = page;
121
+ }
122
+
123
+ return result;
124
+ }
125
+
126
+ _goToPage(page) {
127
+ if (page < 1 || page > this.total || page === this.current) return;
128
+ this.current = page;
129
+ this.dispatchEvent(new CustomEvent('arc-change', {
130
+ detail: { value: this.current },
131
+ bubbles: true,
132
+ composed: true,
133
+ }));
134
+ }
135
+
136
+ _prev() { this._goToPage(this.current - 1); }
137
+ _next() { this._goToPage(this.current + 1); }
138
+
139
+ render() {
140
+ const pages = this._getPageRange();
141
+
142
+ return html`
143
+ <nav class="pagination" role="navigation" aria-label="Pagination" part="pagination">
144
+ <button
145
+ class="pagination__btn"
146
+ @click=${this._prev}
147
+ ?disabled=${this.current <= 1}
148
+ aria-label="Previous page"
149
+ part="prev"
150
+ >
151
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
152
+ <path d="M10.78 3.22a.75.75 0 010 1.06L7.06 8l3.72 3.72a.75.75 0 11-1.06 1.06l-4.25-4.25a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 0z"/>
153
+ </svg>
154
+ </button>
155
+
156
+ ${pages.map(page =>
157
+ page === '...'
158
+ ? html`<span class="pagination__ellipsis" part="ellipsis" aria-hidden="true">&hellip;</span>`
159
+ : html`
160
+ <button
161
+ class="pagination__btn ${page === this.current ? 'is-active' : ''}"
162
+ @click=${() => this._goToPage(page)}
163
+ aria-label="Page ${page}"
164
+ aria-current=${page === this.current ? 'page' : 'false'}
165
+ part="page"
166
+ >${page}</button>
167
+ `
168
+ )}
169
+
170
+ <button
171
+ class="pagination__btn"
172
+ @click=${this._next}
173
+ ?disabled=${this.current >= this.total}
174
+ aria-label="Next page"
175
+ part="next"
176
+ >
177
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
178
+ <path d="M5.22 12.78a.75.75 0 010-1.06L8.94 8 5.22 4.28a.75.75 0 011.06-1.06l4.25 4.25a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06 0z"/>
179
+ </svg>
180
+ </button>
181
+ </nav>
182
+ `;
183
+ }
184
+ }
185
+
186
+ customElements.define('arc-pagination', ArcPagination);
@@ -0,0 +1,198 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+ import './spy-link.js';
4
+
5
+ export class ArcScrollSpy extends LitElement {
6
+ static properties = {
7
+ active: { type: String, reflect: true },
8
+ offset: { type: Number },
9
+ _active: { state: true },
10
+ _links: { state: true },
11
+ };
12
+
13
+ static styles = [
14
+ tokenStyles,
15
+ css`
16
+ :host {
17
+ display: block;
18
+ }
19
+
20
+ .scroll-spy {
21
+ padding: 0 var(--space-md);
22
+ }
23
+
24
+ .scroll-spy__heading {
25
+ font-family: var(--font-accent);
26
+ font-weight: var(--section-title-weight);
27
+ font-size: var(--section-title-size);
28
+ letter-spacing: var(--section-title-spacing);
29
+ text-transform: uppercase;
30
+ color: var(--text-ghost);
31
+ margin-bottom: var(--space-sm);
32
+ }
33
+
34
+ .scroll-spy__list {
35
+ list-style: none;
36
+ margin: 0;
37
+ padding: 0;
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: 2px; /* cosmetic micro-spacing */
41
+ }
42
+
43
+ .scroll-spy__item {
44
+ display: block;
45
+ }
46
+
47
+ .scroll-spy__link {
48
+ display: flex;
49
+ align-items: center;
50
+ font-family: var(--font-body);
51
+ font-size: var(--text-sm);
52
+ line-height: 1.4;
53
+ color: var(--text-ghost);
54
+ text-decoration: none;
55
+ padding: var(--space-xs) var(--space-sm);
56
+ border-radius: var(--radius-sm);
57
+ cursor: pointer;
58
+ transition:
59
+ color var(--transition-fast),
60
+ background var(--transition-fast),
61
+ box-shadow var(--transition-fast);
62
+ background: none;
63
+ border: none;
64
+ width: 100%;
65
+ text-align: left;
66
+ min-height: var(--touch-min);
67
+ }
68
+
69
+ .scroll-spy__link:hover {
70
+ color: var(--text-secondary);
71
+ background: rgba(var(--white-rgb), 0.03);
72
+ }
73
+
74
+ .scroll-spy__link[aria-current="true"] {
75
+ color: var(--text-primary);
76
+ background: rgba(var(--accent-primary-rgb), 0.06);
77
+ box-shadow: 0 0 12px rgba(var(--accent-primary-rgb), 0.08);
78
+ }
79
+
80
+ .scroll-spy__slot-host { display: none; }
81
+
82
+ @media (prefers-reduced-motion: reduce) {
83
+ :host *,
84
+ :host *::before,
85
+ :host *::after {
86
+ animation-duration: 0.01ms !important;
87
+ animation-iteration-count: 1 !important;
88
+ transition-duration: 0.01ms !important;
89
+ }
90
+ }
91
+ `,
92
+ ];
93
+
94
+ constructor() {
95
+ super();
96
+ this.active = '';
97
+ this.offset = 80;
98
+ this._active = '';
99
+ this._links = [];
100
+ this._observer = null;
101
+ this._rafId = null;
102
+ }
103
+
104
+ connectedCallback() {
105
+ super.connectedCallback();
106
+ this._setupObserver();
107
+ }
108
+
109
+ disconnectedCallback() {
110
+ super.disconnectedCallback();
111
+ if (this._rafId) cancelAnimationFrame(this._rafId);
112
+ if (this._observer) {
113
+ this._observer.disconnect();
114
+ this._observer = null;
115
+ }
116
+ }
117
+
118
+ _onSlotChange(e) {
119
+ this._links = e.target.assignedElements({ flatten: true })
120
+ .filter(el => el.tagName === 'ARC-SPY-LINK');
121
+ this._setupObserver();
122
+ }
123
+
124
+ updated(changed) {
125
+ if (changed.has('_links')) {
126
+ this._setupObserver();
127
+ }
128
+ }
129
+
130
+ _setupObserver() {
131
+ if (typeof IntersectionObserver === 'undefined') return;
132
+
133
+ if (this._observer) {
134
+ this._observer.disconnect();
135
+ }
136
+
137
+ this._observer = new IntersectionObserver(
138
+ (entries) => {
139
+ for (const entry of entries) {
140
+ if (entry.isIntersecting) {
141
+ this._active = entry.target.id;
142
+ this.active = entry.target.id;
143
+ this.dispatchEvent(new CustomEvent('arc-change', {
144
+ detail: { value: this._active },
145
+ bubbles: true,
146
+ composed: true,
147
+ }));
148
+ }
149
+ }
150
+ },
151
+ { rootMargin: `-${this.offset}px 0px -60% 0px` }
152
+ );
153
+
154
+ this._rafId = requestAnimationFrame(() => {
155
+ this._rafId = null;
156
+ if (!this._observer) return;
157
+ for (const link of this._links) {
158
+ if (!link.target) continue;
159
+ const el = document.getElementById(link.target);
160
+ if (el) this._observer.observe(el);
161
+ }
162
+ });
163
+ }
164
+
165
+ _handleClick(target) {
166
+ const el = document.getElementById(target);
167
+ if (el) {
168
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' });
169
+ }
170
+ this._active = target;
171
+ this.active = target;
172
+ }
173
+
174
+ render() {
175
+ return html`
176
+ <div class="scroll-spy__slot-host">
177
+ <slot @slotchange=${this._onSlotChange}></slot>
178
+ </div>
179
+ <nav class="scroll-spy" part="scroll-spy" aria-label="Table of contents">
180
+ <div class="scroll-spy__heading" part="heading">On this page</div>
181
+ <ul class="scroll-spy__list" part="list">
182
+ ${this._links.map((link) => html`
183
+ <li class="scroll-spy__item">
184
+ <button
185
+ class="scroll-spy__link"
186
+ aria-current=${this._active === link.target ? 'true' : 'false'}
187
+ @click=${() => this._handleClick(link.target)}
188
+ part="link"
189
+ >${link.label}</button>
190
+ </li>
191
+ `)}
192
+ </ul>
193
+ </nav>
194
+ `;
195
+ }
196
+ }
197
+
198
+ customElements.define('arc-scroll-spy', ArcScrollSpy);
@@ -0,0 +1,163 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { tokenStyles } from '../shared-styles.js';
3
+
4
+ /**
5
+ * @arc-prism interactive
6
+ */
7
+ export class ArcScrollToTop extends LitElement {
8
+ static properties = {
9
+ threshold: { type: Number },
10
+ smooth: { type: Boolean },
11
+ position: { type: String, reflect: true },
12
+ offset: { type: String },
13
+ _visible: { state: true },
14
+ };
15
+
16
+ static styles = [
17
+ tokenStyles,
18
+ css`
19
+ :host { display: block; }
20
+
21
+ .scroll-to-top {
22
+ position: fixed;
23
+ z-index: 1000;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ width: 40px;
28
+ height: 40px;
29
+ padding: 0;
30
+ border: 1px solid var(--border-subtle);
31
+ border-radius: var(--radius-full);
32
+ background: var(--bg-elevated);
33
+ box-shadow: var(--shadow-md);
34
+ color: var(--text-muted);
35
+ cursor: pointer;
36
+ opacity: 0;
37
+ transform: translateY(12px);
38
+ pointer-events: none;
39
+ transition:
40
+ opacity var(--transition-fast),
41
+ transform var(--transition-fast),
42
+ background var(--transition-fast),
43
+ border-color var(--transition-fast),
44
+ color var(--transition-fast),
45
+ box-shadow var(--transition-fast);
46
+ }
47
+
48
+ .scroll-to-top.visible {
49
+ opacity: 1;
50
+ transform: translateY(0);
51
+ pointer-events: auto;
52
+ }
53
+
54
+ .scroll-to-top:hover {
55
+ background: var(--accent-primary-subtle);
56
+ border-color: var(--accent-primary-border);
57
+ color: var(--accent-primary);
58
+ }
59
+
60
+ .scroll-to-top:active {
61
+ transform: scale(0.95);
62
+ }
63
+
64
+ .scroll-to-top.visible:active {
65
+ transform: scale(0.95);
66
+ }
67
+
68
+ .scroll-to-top:focus-visible {
69
+ outline: none;
70
+ box-shadow: var(--focus-glow);
71
+ }
72
+
73
+ .scroll-to-top svg {
74
+ width: 18px;
75
+ height: 18px;
76
+ fill: none;
77
+ stroke: currentColor;
78
+ stroke-width: 2;
79
+ stroke-linecap: round;
80
+ stroke-linejoin: round;
81
+ }
82
+
83
+ /* Position variants */
84
+ :host(:not([position])) .scroll-to-top,
85
+ :host([position="bottom-right"]) .scroll-to-top {
86
+ bottom: var(--_offset);
87
+ right: var(--_offset);
88
+ }
89
+
90
+ :host([position="bottom-left"]) .scroll-to-top {
91
+ bottom: var(--_offset);
92
+ left: var(--_offset);
93
+ }
94
+
95
+ @media (prefers-reduced-motion: reduce) {
96
+ .scroll-to-top {
97
+ transition: none;
98
+ }
99
+ }
100
+ `,
101
+ ];
102
+
103
+ constructor() {
104
+ super();
105
+ this.threshold = 300;
106
+ this.smooth = true;
107
+ this.position = 'bottom-right';
108
+ this.offset = 'var(--space-lg)';
109
+ this._visible = false;
110
+ this._onScroll = this._onScroll.bind(this);
111
+ this._ticking = false;
112
+ }
113
+
114
+ connectedCallback() {
115
+ super.connectedCallback();
116
+ window.addEventListener('scroll', this._onScroll, { passive: true });
117
+ // Check initial scroll position
118
+ this._checkScroll();
119
+ }
120
+
121
+ disconnectedCallback() {
122
+ super.disconnectedCallback();
123
+ window.removeEventListener('scroll', this._onScroll);
124
+ }
125
+
126
+ _onScroll() {
127
+ if (!this._ticking) {
128
+ this._ticking = true;
129
+ requestAnimationFrame(() => {
130
+ this._checkScroll();
131
+ this._ticking = false;
132
+ });
133
+ }
134
+ }
135
+
136
+ _checkScroll() {
137
+ this._visible = window.scrollY > this.threshold;
138
+ }
139
+
140
+ _scrollToTop() {
141
+ const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
142
+ const behavior = this.smooth && !prefersReducedMotion ? 'smooth' : 'instant';
143
+ window.scrollTo({ top: 0, behavior });
144
+ }
145
+
146
+ render() {
147
+ return html`
148
+ <button
149
+ class="scroll-to-top ${this._visible ? 'visible' : ''}"
150
+ style="--_offset: ${this.offset}"
151
+ @click=${this._scrollToTop}
152
+ aria-label="Scroll to top"
153
+ part="button"
154
+ >
155
+ <svg viewBox="0 0 24 24" aria-hidden="true">
156
+ <polyline points="18 15 12 9 6 15"></polyline>
157
+ </svg>
158
+ </button>
159
+ `;
160
+ }
161
+ }
162
+
163
+ customElements.define('arc-scroll-to-top', ArcScrollToTop);
@@ -0,0 +1,28 @@
1
+ import { LitElement, html, css } from 'lit';
2
+
3
+ export class ArcSidebarLink extends LitElement {
4
+ static properties = {
5
+ href: { type: String, reflect: true },
6
+ active: { type: Boolean, reflect: true },
7
+ };
8
+
9
+ static styles = css`
10
+ :host { display: none; }
11
+ `;
12
+
13
+ constructor() {
14
+ super();
15
+ this.href = '';
16
+ this.active = false;
17
+ }
18
+
19
+ get label() {
20
+ return this.textContent.trim();
21
+ }
22
+
23
+ render() {
24
+ return html`<slot></slot>`;
25
+ }
26
+ }
27
+
28
+ customElements.define('arc-sidebar-link', ArcSidebarLink);
@@ -0,0 +1,45 @@
1
+ import { LitElement, html, css } from 'lit';
2
+
3
+ /**
4
+ * @arc-prism interactive — sidebar section, child of arc-sidebar
5
+ */
6
+ export class ArcSidebarSection extends LitElement {
7
+ static properties = {
8
+ heading: { type: String, reflect: true },
9
+ collapsible: { type: Boolean, reflect: true },
10
+ open: { type: Boolean, reflect: true },
11
+ };
12
+
13
+ static styles = css`
14
+ :host { display: contents; }
15
+ `;
16
+
17
+ constructor() {
18
+ super();
19
+ this.heading = '';
20
+ this.collapsible = false;
21
+ this.open = true;
22
+ }
23
+
24
+ /** Get child arc-sidebar-link elements */
25
+ get links() {
26
+ return [...this.querySelectorAll(':scope > arc-sidebar-link')];
27
+ }
28
+
29
+ toggle() {
30
+ if (this.collapsible) {
31
+ this.open = !this.open;
32
+ this.dispatchEvent(new CustomEvent('arc-toggle', {
33
+ detail: { open: this.open },
34
+ bubbles: true,
35
+ composed: true,
36
+ }));
37
+ }
38
+ }
39
+
40
+ render() {
41
+ return html`<slot></slot>`;
42
+ }
43
+ }
44
+
45
+ customElements.define('arc-sidebar-section', ArcSidebarSection);