@arclux/arc-ui 1.1.0 → 1.3.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 +1 -1
- package/src/content/badge.js +14 -5
- package/src/content/tag.js +11 -3
- package/src/input/button.js +46 -7
- package/src/input/input.js +67 -14
- package/src/input/toggle.js +5 -5
package/package.json
CHANGED
package/src/content/badge.js
CHANGED
|
@@ -4,6 +4,7 @@ import { tokenStyles } from '../shared-styles.js';
|
|
|
4
4
|
export class ArcBadge extends LitElement {
|
|
5
5
|
static properties = {
|
|
6
6
|
variant: { type: String, reflect: true },
|
|
7
|
+
color: { type: String },
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
static styles = [
|
|
@@ -15,11 +16,11 @@ export class ArcBadge extends LitElement {
|
|
|
15
16
|
display: inline-flex;
|
|
16
17
|
align-items: center;
|
|
17
18
|
gap: var(--space-xs);
|
|
18
|
-
font-family: var(--font-
|
|
19
|
-
font-weight:
|
|
19
|
+
font-family: var(--font-mono);
|
|
20
|
+
font-weight: 500;
|
|
20
21
|
font-size: var(--text-xs);
|
|
21
|
-
letter-spacing:
|
|
22
|
-
text-transform:
|
|
22
|
+
letter-spacing: normal;
|
|
23
|
+
text-transform: none;
|
|
23
24
|
color: var(--text-muted);
|
|
24
25
|
padding: var(--space-xs) var(--space-sm);
|
|
25
26
|
border: 1px solid var(--border-default);
|
|
@@ -88,10 +89,18 @@ export class ArcBadge extends LitElement {
|
|
|
88
89
|
constructor() {
|
|
89
90
|
super();
|
|
90
91
|
this.variant = 'default';
|
|
92
|
+
this.color = '';
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
render() {
|
|
94
|
-
|
|
96
|
+
const colorStyle = this.color
|
|
97
|
+
? `border-color: rgba(${this.color}, 0.2); color: rgb(${this.color}); background: rgba(${this.color}, 0.06);`
|
|
98
|
+
: '';
|
|
99
|
+
|
|
100
|
+
return html`<span class="badge" part="badge" style=${colorStyle}
|
|
101
|
+
@mouseenter=${this.color ? (e) => { e.currentTarget.style.boxShadow = `0 0 12px rgba(${this.color}, 0.15)`; } : null}
|
|
102
|
+
@mouseleave=${this.color ? (e) => { e.currentTarget.style.boxShadow = ''; } : null}
|
|
103
|
+
><slot></slot></span>`;
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
106
|
|
package/src/content/tag.js
CHANGED
|
@@ -6,6 +6,7 @@ export class ArcTag extends LitElement {
|
|
|
6
6
|
variant: { type: String, reflect: true },
|
|
7
7
|
removable: { type: Boolean, reflect: true },
|
|
8
8
|
disabled: { type: Boolean, reflect: true },
|
|
9
|
+
color: { type: String },
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
static styles = [
|
|
@@ -24,13 +25,12 @@ export class ArcTag extends LitElement {
|
|
|
24
25
|
letter-spacing: 2px;
|
|
25
26
|
text-transform: uppercase;
|
|
26
27
|
color: var(--text-muted);
|
|
27
|
-
padding: var(--space-
|
|
28
|
+
padding: var(--space-sm) calc(var(--space-sm) + var(--space-xs));
|
|
28
29
|
border: 1px solid var(--border-default);
|
|
29
30
|
border-radius: var(--radius-full);
|
|
30
31
|
background: var(--bg-hover);
|
|
31
32
|
transition: box-shadow var(--transition-base), border-color var(--transition-base);
|
|
32
33
|
line-height: 1.4;
|
|
33
|
-
min-height: var(--touch-min);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
:host([variant="primary"]) .tag {
|
|
@@ -120,6 +120,7 @@ export class ArcTag extends LitElement {
|
|
|
120
120
|
this.variant = 'default';
|
|
121
121
|
this.removable = false;
|
|
122
122
|
this.disabled = false;
|
|
123
|
+
this.color = '';
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
_remove(e) {
|
|
@@ -132,8 +133,15 @@ export class ArcTag extends LitElement {
|
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
render() {
|
|
136
|
+
const colorStyle = this.color
|
|
137
|
+
? `border-color: rgba(${this.color}, 0.2); color: rgb(${this.color}); background: rgba(${this.color}, 0.06);`
|
|
138
|
+
: '';
|
|
139
|
+
|
|
135
140
|
return html`
|
|
136
|
-
<span class="tag" part="tag"
|
|
141
|
+
<span class="tag" part="tag" style=${colorStyle}
|
|
142
|
+
@mouseenter=${this.color ? (e) => { e.currentTarget.style.boxShadow = `0 0 12px rgba(${this.color}, 0.15)`; } : null}
|
|
143
|
+
@mouseleave=${this.color ? (e) => { e.currentTarget.style.boxShadow = ''; } : null}
|
|
144
|
+
>
|
|
137
145
|
<span class="tag__label" part="label"><slot></slot></span>
|
|
138
146
|
${this.removable ? html`
|
|
139
147
|
<button
|
package/src/input/button.js
CHANGED
|
@@ -3,11 +3,13 @@ import { tokenStyles } from '../shared-styles.js';
|
|
|
3
3
|
|
|
4
4
|
export class ArcButton extends LitElement {
|
|
5
5
|
static properties = {
|
|
6
|
-
variant:
|
|
7
|
-
size:
|
|
8
|
-
href:
|
|
9
|
-
disabled:
|
|
10
|
-
type:
|
|
6
|
+
variant: { type: String, reflect: true },
|
|
7
|
+
size: { type: String, reflect: true },
|
|
8
|
+
href: { type: String },
|
|
9
|
+
disabled: { type: Boolean, reflect: true },
|
|
10
|
+
type: { type: String },
|
|
11
|
+
_hasPrefix: { state: true },
|
|
12
|
+
_hasSuffix: { state: true },
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
static styles = [
|
|
@@ -95,6 +97,21 @@ export class ArcButton extends LitElement {
|
|
|
95
97
|
/* Disabled */
|
|
96
98
|
:host([disabled]) .btn { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
|
|
97
99
|
|
|
100
|
+
/* Prefix / Suffix */
|
|
101
|
+
.btn__prefix,
|
|
102
|
+
.btn__suffix {
|
|
103
|
+
display: inline-flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.btn__prefix--empty,
|
|
108
|
+
.btn__suffix--empty { display: none; }
|
|
109
|
+
|
|
110
|
+
::slotted([slot="prefix"]),
|
|
111
|
+
::slotted([slot="suffix"]) {
|
|
112
|
+
display: flex;
|
|
113
|
+
}
|
|
114
|
+
|
|
98
115
|
@media (prefers-reduced-motion: reduce) {
|
|
99
116
|
:host *,
|
|
100
117
|
:host *::before,
|
|
@@ -114,13 +131,35 @@ export class ArcButton extends LitElement {
|
|
|
114
131
|
this.href = '';
|
|
115
132
|
this.disabled = false;
|
|
116
133
|
this.type = 'button';
|
|
134
|
+
this._hasPrefix = false;
|
|
135
|
+
this._hasSuffix = false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
_onPrefixSlotChange(e) {
|
|
139
|
+
this._hasPrefix = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_onSuffixSlotChange(e) {
|
|
143
|
+
this._hasSuffix = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
_renderContent() {
|
|
147
|
+
return html`
|
|
148
|
+
<span class="btn__prefix ${this._hasPrefix ? '' : 'btn__prefix--empty'}">
|
|
149
|
+
<slot name="prefix" @slotchange=${this._onPrefixSlotChange}></slot>
|
|
150
|
+
</span>
|
|
151
|
+
<slot></slot>
|
|
152
|
+
<span class="btn__suffix ${this._hasSuffix ? '' : 'btn__suffix--empty'}">
|
|
153
|
+
<slot name="suffix" @slotchange=${this._onSuffixSlotChange}></slot>
|
|
154
|
+
</span>
|
|
155
|
+
`;
|
|
117
156
|
}
|
|
118
157
|
|
|
119
158
|
render() {
|
|
120
159
|
if (this.href) {
|
|
121
|
-
return html`<a class="btn" href=${this.href} part="button"
|
|
160
|
+
return html`<a class="btn" href=${this.href} part="button">${this._renderContent()}</a>`;
|
|
122
161
|
}
|
|
123
|
-
return html`<button class="btn" type=${this.type} ?disabled=${this.disabled} part="button"
|
|
162
|
+
return html`<button class="btn" type=${this.type} ?disabled=${this.disabled} part="button">${this._renderContent()}</button>`;
|
|
124
163
|
}
|
|
125
164
|
}
|
|
126
165
|
|
package/src/input/input.js
CHANGED
|
@@ -16,6 +16,8 @@ export class ArcInput extends LitElement {
|
|
|
16
16
|
required: { type: Boolean },
|
|
17
17
|
multiline: { type: Boolean },
|
|
18
18
|
rows: { type: Number },
|
|
19
|
+
_hasPrefix: { state: true },
|
|
20
|
+
_hasSuffix: { state: true },
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
static styles = [
|
|
@@ -38,15 +40,12 @@ export class ArcInput extends LitElement {
|
|
|
38
40
|
color: var(--text-muted);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
.input-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
font-weight: 300;
|
|
45
|
-
color: var(--text-primary);
|
|
43
|
+
.input-group__wrapper {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
46
|
background: var(--bg-surface);
|
|
47
47
|
border: 1px solid var(--border-default);
|
|
48
48
|
border-radius: var(--radius-md);
|
|
49
|
-
padding: var(--space-sm) var(--space-md);
|
|
50
49
|
transition:
|
|
51
50
|
border-color var(--transition-fast),
|
|
52
51
|
box-shadow var(--transition-fast),
|
|
@@ -55,17 +54,53 @@ export class ArcInput extends LitElement {
|
|
|
55
54
|
width: 100%;
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.input-group__field::placeholder { color: var(--text-ghost); }
|
|
61
|
-
.input-group__field:hover:not(:focus) { border-color: var(--border-bright); }
|
|
62
|
-
.input-group__field:focus {
|
|
63
|
-
outline: none;
|
|
57
|
+
.input-group__wrapper:hover:not(:focus-within) { border-color: var(--border-bright); }
|
|
58
|
+
.input-group__wrapper:focus-within {
|
|
64
59
|
border-color: rgba(var(--accent-primary-rgb), 0.4);
|
|
65
60
|
box-shadow: var(--focus-glow);
|
|
66
61
|
background: var(--bg-card);
|
|
67
62
|
}
|
|
68
|
-
|
|
63
|
+
|
|
64
|
+
:host([disabled]) .input-group__wrapper { opacity: 0.4; cursor: not-allowed; }
|
|
65
|
+
|
|
66
|
+
.input-group__field {
|
|
67
|
+
font-family: var(--font-body);
|
|
68
|
+
font-size: var(--body-size);
|
|
69
|
+
font-weight: 300;
|
|
70
|
+
color: var(--text-primary);
|
|
71
|
+
background: transparent;
|
|
72
|
+
border: none;
|
|
73
|
+
padding: var(--space-sm) var(--space-md);
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
width: 100%;
|
|
76
|
+
min-width: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.input-group__field:focus { outline: none; }
|
|
80
|
+
.input-group__field::placeholder { color: var(--text-ghost); }
|
|
81
|
+
.input-group__field:disabled { cursor: not-allowed; }
|
|
82
|
+
|
|
83
|
+
textarea.input-group__field { resize: vertical; }
|
|
84
|
+
|
|
85
|
+
.input-group__prefix,
|
|
86
|
+
.input-group__suffix {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
color: var(--text-muted);
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.input-group__prefix { padding-left: var(--space-md); }
|
|
94
|
+
.input-group__suffix { padding-right: var(--space-md); }
|
|
95
|
+
|
|
96
|
+
.input-group__prefix--empty,
|
|
97
|
+
.input-group__suffix--empty { display: none; }
|
|
98
|
+
|
|
99
|
+
::slotted([slot="prefix"]),
|
|
100
|
+
::slotted([slot="suffix"]) {
|
|
101
|
+
width: 20px;
|
|
102
|
+
height: 20px;
|
|
103
|
+
}
|
|
69
104
|
|
|
70
105
|
@media (prefers-reduced-motion: reduce) {
|
|
71
106
|
:host *,
|
|
@@ -92,6 +127,8 @@ export class ArcInput extends LitElement {
|
|
|
92
127
|
this.multiline = false;
|
|
93
128
|
this.rows = 5;
|
|
94
129
|
this._fieldId = `arc-input-${++inputIdCounter}`;
|
|
130
|
+
this._hasPrefix = false;
|
|
131
|
+
this._hasSuffix = false;
|
|
95
132
|
}
|
|
96
133
|
|
|
97
134
|
updated(changed) {
|
|
@@ -112,6 +149,14 @@ export class ArcInput extends LitElement {
|
|
|
112
149
|
this.dispatchEvent(new CustomEvent('arc-change', { detail: { value: this.value }, bubbles: true, composed: true }));
|
|
113
150
|
}
|
|
114
151
|
|
|
152
|
+
_onPrefixSlotChange(e) {
|
|
153
|
+
this._hasPrefix = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
_onSuffixSlotChange(e) {
|
|
157
|
+
this._hasSuffix = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
115
160
|
render() {
|
|
116
161
|
const id = this.name || this._fieldId;
|
|
117
162
|
const field = this.multiline
|
|
@@ -149,7 +194,15 @@ export class ArcInput extends LitElement {
|
|
|
149
194
|
return html`
|
|
150
195
|
<div class="input-group">
|
|
151
196
|
${this.label ? html`<label class="input-group__label" for=${id} part="label">${this.label}</label>` : ''}
|
|
152
|
-
|
|
197
|
+
<div class="input-group__wrapper" part="wrapper">
|
|
198
|
+
<div class="input-group__prefix ${this._hasPrefix ? '' : 'input-group__prefix--empty'}" part="prefix">
|
|
199
|
+
<slot name="prefix" @slotchange=${this._onPrefixSlotChange}></slot>
|
|
200
|
+
</div>
|
|
201
|
+
${field}
|
|
202
|
+
<div class="input-group__suffix ${this._hasSuffix ? '' : 'input-group__suffix--empty'}" part="suffix">
|
|
203
|
+
<slot name="suffix" @slotchange=${this._onSuffixSlotChange}></slot>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
153
206
|
</div>
|
|
154
207
|
`;
|
|
155
208
|
}
|
package/src/input/toggle.js
CHANGED
|
@@ -81,11 +81,11 @@ export class ArcToggle extends LitElement {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.toggle__label {
|
|
84
|
-
font-family: var(--font-
|
|
85
|
-
font-size: var(--
|
|
86
|
-
font-weight:
|
|
87
|
-
letter-spacing:
|
|
88
|
-
text-transform:
|
|
84
|
+
font-family: var(--font-body);
|
|
85
|
+
font-size: var(--body-size);
|
|
86
|
+
font-weight: 400;
|
|
87
|
+
letter-spacing: normal;
|
|
88
|
+
text-transform: none;
|
|
89
89
|
color: var(--text-muted);
|
|
90
90
|
user-select: none;
|
|
91
91
|
}
|