@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.
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/package.json +186 -0
- package/src/content/accordion-item.js +27 -0
- package/src/content/accordion.js +151 -0
- package/src/content/animated-number.js +160 -0
- package/src/content/aspect-ratio.js +78 -0
- package/src/content/avatar-group.js +101 -0
- package/src/content/avatar.js +92 -0
- package/src/content/badge.js +98 -0
- package/src/content/callout.js +141 -0
- package/src/content/card.js +75 -0
- package/src/content/carousel.js +300 -0
- package/src/content/code-block.js +152 -0
- package/src/content/collapsible.js +142 -0
- package/src/content/color-swatch.js +86 -0
- package/src/content/column.js +28 -0
- package/src/content/data-table.js +332 -0
- package/src/content/divider.js +153 -0
- package/src/content/empty-state.js +78 -0
- package/src/content/feature-card.js +142 -0
- package/src/content/highlight.js +63 -0
- package/src/content/icon-library.js +30 -0
- package/src/content/icon-registry.js +39 -0
- package/src/content/icon.js +95 -0
- package/src/content/index.js +44 -0
- package/src/content/infinite-scroll.js +144 -0
- package/src/content/kbd.js +40 -0
- package/src/content/markdown.js +294 -0
- package/src/content/marquee.js +166 -0
- package/src/content/meter.js +167 -0
- package/src/content/scroll-area.js +107 -0
- package/src/content/skeleton.js +85 -0
- package/src/content/spinner.js +77 -0
- package/src/content/stack.js +68 -0
- package/src/content/stat.js +72 -0
- package/src/content/step.js +22 -0
- package/src/content/stepper.js +202 -0
- package/src/content/table.js +134 -0
- package/src/content/tag.js +156 -0
- package/src/content/text.js +111 -0
- package/src/content/timeline-item.js +29 -0
- package/src/content/timeline.js +170 -0
- package/src/content/truncate.js +161 -0
- package/src/content/value-card.js +94 -0
- package/src/feedback/alert.js +187 -0
- package/src/feedback/command-item.js +28 -0
- package/src/feedback/command-palette.js +346 -0
- package/src/feedback/context-menu.js +299 -0
- package/src/feedback/dialog.js +298 -0
- package/src/feedback/dropdown-menu.js +259 -0
- package/src/feedback/hover-card.js +186 -0
- package/src/feedback/index.js +17 -0
- package/src/feedback/modal.js +226 -0
- package/src/feedback/notification-panel.js +196 -0
- package/src/feedback/popover.js +184 -0
- package/src/feedback/progress.js +169 -0
- package/src/feedback/sheet.js +249 -0
- package/src/feedback/toast.js +207 -0
- package/src/feedback/tooltip.js +189 -0
- package/src/icons/lucide.d.ts +1915 -0
- package/src/icons/lucide.js +1915 -0
- package/src/icons/phosphor.d.ts +1517 -0
- package/src/icons/phosphor.js +1517 -0
- package/src/icons/types.d.ts +8 -0
- package/src/index.js +9 -0
- package/src/input/button.js +127 -0
- package/src/input/calendar.js +340 -0
- package/src/input/checkbox.js +159 -0
- package/src/input/chip.js +120 -0
- package/src/input/color-picker.js +461 -0
- package/src/input/combobox.js +295 -0
- package/src/input/copy-button.js +144 -0
- package/src/input/date-picker.js +534 -0
- package/src/input/file-upload.js +333 -0
- package/src/input/form.js +179 -0
- package/src/input/icon-button.js +179 -0
- package/src/input/index.js +31 -0
- package/src/input/input.js +158 -0
- package/src/input/multi-select.js +392 -0
- package/src/input/number-input.js +239 -0
- package/src/input/otp-input.js +221 -0
- package/src/input/pin-input.js +294 -0
- package/src/input/radio-group.js +177 -0
- package/src/input/radio.js +28 -0
- package/src/input/rating.js +195 -0
- package/src/input/search.js +371 -0
- package/src/input/segmented-control.js +174 -0
- package/src/input/select.js +267 -0
- package/src/input/slider.js +217 -0
- package/src/input/sortable-list.js +345 -0
- package/src/input/suggestion.js +26 -0
- package/src/input/textarea.js +203 -0
- package/src/input/theme-toggle.js +196 -0
- package/src/input/toggle.js +166 -0
- package/src/layout/app-shell.js +266 -0
- package/src/layout/auth-shell.js +153 -0
- package/src/layout/container.js +37 -0
- package/src/layout/dashboard-grid.js +62 -0
- package/src/layout/index.js +15 -0
- package/src/layout/page-header.js +100 -0
- package/src/layout/page-layout.js +112 -0
- package/src/layout/resizable.js +221 -0
- package/src/layout/section.js +54 -0
- package/src/layout/settings-layout.js +91 -0
- package/src/layout/split-pane.js +172 -0
- package/src/layout/status-bar.js +84 -0
- package/src/layout/toolbar.js +92 -0
- package/src/navigation/breadcrumb-item.js +26 -0
- package/src/navigation/breadcrumb.js +129 -0
- package/src/navigation/drawer.js +183 -0
- package/src/navigation/footer.js +99 -0
- package/src/navigation/index.js +22 -0
- package/src/navigation/link.js +120 -0
- package/src/navigation/nav-item.js +46 -0
- package/src/navigation/navigation-menu.js +687 -0
- package/src/navigation/pagination.js +186 -0
- package/src/navigation/scroll-spy.js +198 -0
- package/src/navigation/scroll-to-top.js +163 -0
- package/src/navigation/sidebar-link.js +28 -0
- package/src/navigation/sidebar-section.js +45 -0
- package/src/navigation/sidebar.js +336 -0
- package/src/navigation/spy-link.js +26 -0
- package/src/navigation/tab.js +26 -0
- package/src/navigation/tabs.js +202 -0
- package/src/navigation/top-bar.js +263 -0
- package/src/navigation/tree-item.js +38 -0
- package/src/navigation/tree-view.js +255 -0
- package/src/shared/index.js +6 -0
- package/src/shared/menu-divider.js +9 -0
- package/src/shared/menu-item.js +30 -0
- package/src/shared/option.js +31 -0
- package/src/shared-styles.js +81 -0
- package/src/tokens.js +445 -0
- package/types/index.d.ts +973 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcTruncate extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
lines: { type: Number, reflect: true },
|
|
7
|
+
expanded: { type: Boolean, reflect: true },
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
tokenStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host { display: block; }
|
|
14
|
+
|
|
15
|
+
.truncate__content {
|
|
16
|
+
color: var(--text-secondary);
|
|
17
|
+
font-family: var(--font-body);
|
|
18
|
+
font-size: var(--body-size);
|
|
19
|
+
line-height: var(--body-lh);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.truncate__content--clamped {
|
|
23
|
+
display: -webkit-box;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.truncate__toggle {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
margin-top: var(--space-xs);
|
|
31
|
+
background: none;
|
|
32
|
+
border: none;
|
|
33
|
+
padding: 0;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
font-family: var(--font-accent);
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
font-size: var(--text-xs);
|
|
38
|
+
letter-spacing: 1px;
|
|
39
|
+
text-transform: uppercase;
|
|
40
|
+
color: var(--accent-primary);
|
|
41
|
+
transition: color var(--transition-fast);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.truncate__toggle:hover {
|
|
45
|
+
color: var(--text-primary);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.truncate__toggle:focus-visible {
|
|
49
|
+
outline: none;
|
|
50
|
+
box-shadow: var(--focus-ring);
|
|
51
|
+
border-radius: var(--radius-sm);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-reduced-motion: reduce) {
|
|
55
|
+
:host *,
|
|
56
|
+
:host *::before,
|
|
57
|
+
:host *::after {
|
|
58
|
+
animation-duration: 0.01ms !important;
|
|
59
|
+
animation-iteration-count: 1 !important;
|
|
60
|
+
transition-duration: 0.01ms !important;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`,
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
constructor() {
|
|
67
|
+
super();
|
|
68
|
+
this.lines = 3;
|
|
69
|
+
this.expanded = false;
|
|
70
|
+
this._overflows = false;
|
|
71
|
+
this._resizeObserver = null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
connectedCallback() {
|
|
75
|
+
super.connectedCallback();
|
|
76
|
+
this._resizeObserver = new ResizeObserver(() => this._checkOverflow());
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
disconnectedCallback() {
|
|
80
|
+
super.disconnectedCallback();
|
|
81
|
+
this._resizeObserver?.disconnect();
|
|
82
|
+
this._resizeObserver = null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
firstUpdated() {
|
|
86
|
+
const content = this.shadowRoot.querySelector('.truncate__content');
|
|
87
|
+
if (content) {
|
|
88
|
+
this._resizeObserver?.observe(content);
|
|
89
|
+
}
|
|
90
|
+
this._checkOverflow();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
updated(changed) {
|
|
94
|
+
if (changed.has('lines') || changed.has('expanded')) {
|
|
95
|
+
this._checkOverflow();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_checkOverflow() {
|
|
100
|
+
const content = this.shadowRoot.querySelector('.truncate__content');
|
|
101
|
+
if (!content) return;
|
|
102
|
+
|
|
103
|
+
if (this.expanded) {
|
|
104
|
+
// When expanded, we need to temporarily clamp to check if it would overflow
|
|
105
|
+
const prev = content.style.webkitLineClamp;
|
|
106
|
+
const prevDisplay = content.style.display;
|
|
107
|
+
const prevOrient = content.style.webkitBoxOrient;
|
|
108
|
+
const prevOverflow = content.style.overflow;
|
|
109
|
+
|
|
110
|
+
content.style.display = '-webkit-box';
|
|
111
|
+
content.style.webkitBoxOrient = 'vertical';
|
|
112
|
+
content.style.overflow = 'hidden';
|
|
113
|
+
content.style.webkitLineClamp = String(this.lines);
|
|
114
|
+
|
|
115
|
+
this._overflows = content.scrollHeight > content.clientHeight;
|
|
116
|
+
|
|
117
|
+
content.style.webkitLineClamp = prev;
|
|
118
|
+
content.style.display = prevDisplay;
|
|
119
|
+
content.style.webkitBoxOrient = prevOrient;
|
|
120
|
+
content.style.overflow = prevOverflow;
|
|
121
|
+
} else {
|
|
122
|
+
// When clamped, CSS handles the clamp; check if content overflows
|
|
123
|
+
this._overflows = content.scrollHeight > content.clientHeight;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this.requestUpdate();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_toggle() {
|
|
130
|
+
this.expanded = !this.expanded;
|
|
131
|
+
this.dispatchEvent(new CustomEvent('arc-toggle', {
|
|
132
|
+
detail: { expanded: this.expanded },
|
|
133
|
+
bubbles: true,
|
|
134
|
+
composed: true,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
render() {
|
|
139
|
+
const clamped = !this.expanded;
|
|
140
|
+
const clampStyle = clamped ? `-webkit-line-clamp: ${this.lines};` : '';
|
|
141
|
+
|
|
142
|
+
return html`
|
|
143
|
+
<div
|
|
144
|
+
class="truncate__content ${clamped ? 'truncate__content--clamped' : ''}"
|
|
145
|
+
style=${clampStyle}
|
|
146
|
+
part="content"
|
|
147
|
+
>
|
|
148
|
+
<slot></slot>
|
|
149
|
+
</div>
|
|
150
|
+
${this._overflows || this.expanded ? html`
|
|
151
|
+
<button
|
|
152
|
+
class="truncate__toggle"
|
|
153
|
+
@click=${this._toggle}
|
|
154
|
+
part="toggle"
|
|
155
|
+
>${this.expanded ? 'Show less' : 'Show more'}</button>
|
|
156
|
+
` : ''}
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
customElements.define('arc-truncate', ArcTruncate);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcValueCard extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
icon: { type: String },
|
|
7
|
+
heading: { type: String },
|
|
8
|
+
description: { type: String },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
static styles = [
|
|
12
|
+
tokenStyles,
|
|
13
|
+
css`
|
|
14
|
+
:host { display: flex; flex-direction: column; height: 100%; }
|
|
15
|
+
|
|
16
|
+
.card {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
gap: var(--space-lg);
|
|
21
|
+
padding: var(--space-lg);
|
|
22
|
+
flex: 1;
|
|
23
|
+
border: 1px solid var(--border-subtle);
|
|
24
|
+
border-radius: var(--radius-lg);
|
|
25
|
+
transition: border-color var(--transition-base), box-shadow var(--transition-base);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.card:hover {
|
|
29
|
+
border-color: var(--border-bright);
|
|
30
|
+
box-shadow: 0 0 20px rgba(var(--accent-secondary-rgb),0.06);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.card__icon {
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
color: var(--accent-secondary);
|
|
36
|
+
font-size: 24px; /* icon size, not text */
|
|
37
|
+
line-height: 1;
|
|
38
|
+
padding-top: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.card__text {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--space-sm);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.card__title {
|
|
48
|
+
font-size: 17px; /* heading size, keep hardcoded */
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: var(--text-primary);
|
|
51
|
+
margin: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.card__desc {
|
|
55
|
+
color: var(--text-secondary);
|
|
56
|
+
font-family: var(--font-body);
|
|
57
|
+
font-size: var(--text-sm);
|
|
58
|
+
line-height: 1.7;
|
|
59
|
+
margin: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
:host *,
|
|
64
|
+
:host *::before,
|
|
65
|
+
:host *::after {
|
|
66
|
+
animation-duration: 0.01ms !important;
|
|
67
|
+
animation-iteration-count: 1 !important;
|
|
68
|
+
transition-duration: 0.01ms !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
constructor() {
|
|
75
|
+
super();
|
|
76
|
+
this.icon = '';
|
|
77
|
+
this.heading = '';
|
|
78
|
+
this.description = '';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
return html`
|
|
83
|
+
<div class="card" part="card">
|
|
84
|
+
<div class="card__icon" part="icon"><slot name="icon">${this.icon}</slot></div>
|
|
85
|
+
<div class="card__text">
|
|
86
|
+
<h3 class="card__title" part="title">${this.heading}</h3>
|
|
87
|
+
<p class="card__desc" part="description">${this.description}</p>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
customElements.define('arc-value-card', ArcValueCard);
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcAlert extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
variant: { type: String, reflect: true },
|
|
7
|
+
dismissible: { type: Boolean },
|
|
8
|
+
heading: { type: String },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
static styles = [
|
|
12
|
+
tokenStyles,
|
|
13
|
+
css`
|
|
14
|
+
:host { display: block; }
|
|
15
|
+
|
|
16
|
+
.alert {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: var(--space-md);
|
|
20
|
+
padding: var(--space-lg);
|
|
21
|
+
border-radius: var(--radius-lg);
|
|
22
|
+
border: 1px solid var(--border-subtle);
|
|
23
|
+
background: var(--bg-card);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Top gradient rule */
|
|
28
|
+
.alert::before {
|
|
29
|
+
content: '';
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
right: 0;
|
|
34
|
+
height: 2px;
|
|
35
|
+
background: var(--gradient-divider);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([variant="info"]) .alert::before {
|
|
39
|
+
background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
|
|
40
|
+
box-shadow: 0 0 12px rgba(var(--accent-primary-rgb), 0.15);
|
|
41
|
+
}
|
|
42
|
+
:host([variant="success"]) .alert::before {
|
|
43
|
+
background: linear-gradient(90deg, transparent, var(--color-success), transparent);
|
|
44
|
+
box-shadow: 0 0 12px rgba(var(--color-success-rgb), 0.15);
|
|
45
|
+
}
|
|
46
|
+
:host([variant="warning"]) .alert::before {
|
|
47
|
+
background: linear-gradient(90deg, transparent, var(--color-warning), transparent);
|
|
48
|
+
box-shadow: 0 0 12px rgba(var(--color-warning-rgb), 0.15);
|
|
49
|
+
}
|
|
50
|
+
:host([variant="error"]) .alert::before {
|
|
51
|
+
background: linear-gradient(90deg, transparent, var(--color-error), transparent);
|
|
52
|
+
box-shadow: 0 0 12px rgba(var(--color-error-rgb), 0.15);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.alert__icon-wrap {
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
width: 32px;
|
|
58
|
+
height: 32px;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
border-radius: var(--radius-md);
|
|
63
|
+
font-size: var(--text-md);
|
|
64
|
+
transition: box-shadow var(--transition-base);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([variant="info"]) .alert__icon-wrap {
|
|
68
|
+
background: rgba(var(--accent-primary-rgb), 0.08);
|
|
69
|
+
border: 1px solid rgba(var(--accent-primary-rgb), 0.15);
|
|
70
|
+
color: var(--accent-primary);
|
|
71
|
+
box-shadow: 0 0 16px rgba(var(--accent-primary-rgb), 0.1);
|
|
72
|
+
}
|
|
73
|
+
:host([variant="success"]) .alert__icon-wrap {
|
|
74
|
+
background: rgba(var(--color-success-rgb), 0.08);
|
|
75
|
+
border: 1px solid rgba(var(--color-success-rgb), 0.15);
|
|
76
|
+
color: var(--color-success);
|
|
77
|
+
box-shadow: 0 0 16px rgba(var(--color-success-rgb), 0.1);
|
|
78
|
+
}
|
|
79
|
+
:host([variant="warning"]) .alert__icon-wrap {
|
|
80
|
+
background: rgba(var(--color-warning-rgb), 0.08);
|
|
81
|
+
border: 1px solid rgba(var(--color-warning-rgb), 0.15);
|
|
82
|
+
color: var(--color-warning);
|
|
83
|
+
box-shadow: 0 0 16px rgba(var(--color-warning-rgb), 0.1);
|
|
84
|
+
}
|
|
85
|
+
:host([variant="error"]) .alert__icon-wrap {
|
|
86
|
+
background: rgba(var(--color-error-rgb), 0.08);
|
|
87
|
+
border: 1px solid rgba(var(--color-error-rgb), 0.15);
|
|
88
|
+
color: var(--color-error);
|
|
89
|
+
box-shadow: 0 0 16px rgba(var(--color-error-rgb), 0.1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.alert__body { flex: 1; min-width: 0; }
|
|
93
|
+
|
|
94
|
+
.alert__heading {
|
|
95
|
+
font-family: var(--font-body);
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
font-size: var(--text-md);
|
|
98
|
+
color: var(--text-primary);
|
|
99
|
+
margin: 0 0 var(--space-xs);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.alert__content {
|
|
103
|
+
font-family: var(--font-body);
|
|
104
|
+
font-size: var(--text-sm);
|
|
105
|
+
line-height: 1.6;
|
|
106
|
+
color: var(--text-secondary);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.alert__dismiss {
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: var(--space-sm);
|
|
112
|
+
right: var(--space-sm);
|
|
113
|
+
background: none;
|
|
114
|
+
border: none;
|
|
115
|
+
color: var(--text-ghost);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
font-size: var(--text-md);
|
|
118
|
+
width: 32px;
|
|
119
|
+
height: 32px;
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
border-radius: var(--radius-sm);
|
|
124
|
+
transition: color var(--transition-fast), background var(--transition-fast);
|
|
125
|
+
line-height: 1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.alert__dismiss:hover {
|
|
129
|
+
color: var(--text-primary);
|
|
130
|
+
background: var(--bg-hover);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.alert__dismiss:focus-visible {
|
|
134
|
+
outline: none;
|
|
135
|
+
box-shadow: var(--focus-ring);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@media (prefers-reduced-motion: reduce) {
|
|
139
|
+
:host *,
|
|
140
|
+
:host *::before,
|
|
141
|
+
:host *::after {
|
|
142
|
+
animation-duration: 0.01ms !important;
|
|
143
|
+
animation-iteration-count: 1 !important;
|
|
144
|
+
transition-duration: 0.01ms !important;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`,
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
constructor() {
|
|
151
|
+
super();
|
|
152
|
+
this.variant = 'info';
|
|
153
|
+
this.dismissible = false;
|
|
154
|
+
this.heading = '';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
_getIcon() {
|
|
158
|
+
switch (this.variant) {
|
|
159
|
+
case 'success': return '\u2713';
|
|
160
|
+
case 'warning': return '\u26A0';
|
|
161
|
+
case 'error': return '\u2717';
|
|
162
|
+
default: return '\u2139';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
_dismiss() {
|
|
167
|
+
this.dispatchEvent(new CustomEvent('arc-dismiss', { bubbles: true, composed: true }));
|
|
168
|
+
this.style.display = 'none';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
render() {
|
|
172
|
+
return html`
|
|
173
|
+
<div class="alert" role="alert" part="alert">
|
|
174
|
+
<div class="alert__icon-wrap" part="icon">${this._getIcon()}</div>
|
|
175
|
+
<div class="alert__body">
|
|
176
|
+
${this.heading ? html`<p class="alert__heading" part="heading">${this.heading}</p>` : ''}
|
|
177
|
+
<div class="alert__content" part="content"><slot></slot></div>
|
|
178
|
+
</div>
|
|
179
|
+
${this.dismissible ? html`
|
|
180
|
+
<button class="alert__dismiss" aria-label="Dismiss" @click=${this._dismiss} part="dismiss">×</button>
|
|
181
|
+
` : ''}
|
|
182
|
+
</div>
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
customElements.define('arc-alert', ArcAlert);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export class ArcCommandItem extends LitElement {
|
|
4
|
+
static properties = {
|
|
5
|
+
shortcut: { type: String, reflect: true },
|
|
6
|
+
icon: { type: String },
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
static styles = css`
|
|
10
|
+
:host { display: none; }
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.shortcut = '';
|
|
16
|
+
this.icon = '';
|
|
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-command-item', ArcCommandItem);
|