reke-ui 0.1.0 → 0.1.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/README.md +2 -0
- package/custom-elements.json +216 -116
- package/dist/components/reke-alert/reke-alert.js +53 -0
- package/dist/components/reke-alert/reke-alert.styles.d.ts.map +1 -1
- package/dist/components/reke-alert/reke-alert.styles.js +106 -0
- package/dist/components/reke-badge/reke-badge.d.ts +4 -2
- package/dist/components/reke-badge/reke-badge.d.ts.map +1 -1
- package/dist/components/reke-badge/reke-badge.js +44 -0
- package/dist/components/reke-badge/reke-badge.styles.d.ts.map +1 -1
- package/dist/components/reke-badge/reke-badge.styles.js +95 -0
- package/dist/components/reke-button/reke-button.js +64 -0
- package/dist/components/reke-button/reke-button.styles.d.ts.map +1 -1
- package/dist/components/reke-button/reke-button.styles.js +229 -0
- package/dist/components/reke-card/reke-card.d.ts +7 -0
- package/dist/components/reke-card/reke-card.d.ts.map +1 -1
- package/dist/components/reke-card/reke-card.js +70 -0
- package/dist/components/reke-card/reke-card.styles.d.ts.map +1 -1
- package/dist/components/reke-card/reke-card.styles.js +150 -0
- package/dist/components/reke-checkbox/reke-checkbox.js +64 -0
- package/dist/components/reke-checkbox/reke-checkbox.styles.js +81 -0
- package/dist/components/reke-chip/reke-chip.js +70 -0
- package/dist/components/reke-chip/reke-chip.styles.d.ts.map +1 -1
- package/dist/components/reke-chip/reke-chip.styles.js +125 -0
- package/dist/components/reke-date-range/reke-date-range.js +346 -0
- package/dist/components/reke-date-range/reke-date-range.styles.js +322 -0
- package/dist/components/reke-dialog/reke-dialog.js +90 -0
- package/dist/components/reke-dialog/reke-dialog.styles.js +134 -0
- package/dist/components/reke-file-upload/reke-file-upload.js +108 -0
- package/dist/components/reke-file-upload/reke-file-upload.styles.js +107 -0
- package/dist/components/reke-input/reke-input.js +73 -0
- package/dist/components/reke-input/reke-input.styles.js +80 -0
- package/dist/components/reke-select/reke-select.js +112 -0
- package/dist/components/reke-select/reke-select.styles.js +122 -0
- package/dist/components/reke-table/reke-table.d.ts +21 -1
- package/dist/components/reke-table/reke-table.d.ts.map +1 -1
- package/dist/components/reke-table/reke-table.js +191 -0
- package/dist/components/reke-table/reke-table.styles.js +207 -0
- package/dist/components/reke-textarea/reke-textarea.js +73 -0
- package/dist/components/reke-textarea/reke-textarea.styles.js +76 -0
- package/dist/components/reke-toast/reke-toast.js +92 -0
- package/dist/components/reke-toast/reke-toast.styles.d.ts.map +1 -1
- package/dist/components/reke-toast/reke-toast.styles.js +182 -0
- package/dist/components/reke-toggle/reke-toggle.js +57 -0
- package/dist/components/reke-toggle/reke-toggle.styles.js +71 -0
- package/dist/components/reke-tooltip/reke-tooltip.js +67 -0
- package/dist/components/reke-tooltip/reke-tooltip.styles.js +67 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -0
- package/dist/react.js +79 -64
- package/dist/shared/base-element.js +16 -0
- package/dist/shared/tailwind-styles.js +6 -0
- package/dist/shared/tailwind.css.js +4 -0
- package/dist/tokens/reke-tokens.css +23 -0
- package/package.json +6 -4
- package/dist/reke-chip-Xb0Y_Cqo.js +0 -3358
- package/dist/reke-ui.js +0 -20
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { tailwindStyles as r } from "../../shared/tailwind-styles.js";
|
|
2
|
+
import { css as e } from "lit";
|
|
3
|
+
const t = [
|
|
4
|
+
r,
|
|
5
|
+
e`
|
|
6
|
+
:host {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
position: relative;
|
|
9
|
+
font-family: var(--reke-font-mono, 'JetBrains Mono', ui-monospace, monospace);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host([disabled]) {
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* === Label === */
|
|
18
|
+
|
|
19
|
+
.label {
|
|
20
|
+
display: block;
|
|
21
|
+
margin-bottom: 6px;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
color: var(--reke-color-text-ghost, #737373);
|
|
24
|
+
transition: color 0.15s ease;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.label--active {
|
|
28
|
+
color: var(--reke-color-primary, #22C55E);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* === Trigger === */
|
|
32
|
+
|
|
33
|
+
.trigger {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 8px;
|
|
37
|
+
padding: 10px 16px;
|
|
38
|
+
background: var(--reke-color-surface, #1A1A1A);
|
|
39
|
+
border: 1px solid var(--reke-color-border, #252525);
|
|
40
|
+
border-radius: var(--reke-radius, 4px);
|
|
41
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
42
|
+
font-family: inherit;
|
|
43
|
+
font-size: 13px;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
transition: border-color 0.15s ease;
|
|
46
|
+
min-width: 200px;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.trigger:hover {
|
|
51
|
+
border-color: var(--reke-color-text-muted, #525252);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.trigger--open {
|
|
55
|
+
border-color: var(--reke-color-primary, #22C55E);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.trigger--error {
|
|
59
|
+
border-color: var(--reke-color-danger, #EF4444);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.trigger--placeholder {
|
|
63
|
+
color: var(--reke-color-text-muted, #525252);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.trigger__icon {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
width: 16px;
|
|
69
|
+
height: 16px;
|
|
70
|
+
color: var(--reke-color-text-muted, #525252);
|
|
71
|
+
transition: color 0.15s ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.trigger--open .trigger__icon {
|
|
75
|
+
color: var(--reke-color-primary, #22C55E);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.trigger__icon svg {
|
|
79
|
+
width: 16px;
|
|
80
|
+
height: 16px;
|
|
81
|
+
fill: none;
|
|
82
|
+
stroke: currentColor;
|
|
83
|
+
stroke-width: 2;
|
|
84
|
+
stroke-linecap: round;
|
|
85
|
+
stroke-linejoin: round;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.trigger__text {
|
|
89
|
+
flex: 1;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.trigger__separator {
|
|
96
|
+
color: var(--reke-color-text-disabled, #3B3B3B);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.trigger__chevron {
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
width: 16px;
|
|
102
|
+
height: 16px;
|
|
103
|
+
color: var(--reke-color-text-muted, #525252);
|
|
104
|
+
transition: transform 0.15s ease, color 0.15s ease;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.trigger--open .trigger__chevron {
|
|
108
|
+
transform: rotate(180deg);
|
|
109
|
+
color: var(--reke-color-primary, #22C55E);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.trigger__chevron svg {
|
|
113
|
+
width: 16px;
|
|
114
|
+
height: 16px;
|
|
115
|
+
fill: none;
|
|
116
|
+
stroke: currentColor;
|
|
117
|
+
stroke-width: 2;
|
|
118
|
+
stroke-linecap: round;
|
|
119
|
+
stroke-linejoin: round;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* === Calendar dropdown === */
|
|
123
|
+
|
|
124
|
+
.calendar {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 100%;
|
|
127
|
+
left: 0;
|
|
128
|
+
z-index: 50;
|
|
129
|
+
margin-top: 4px;
|
|
130
|
+
padding: 16px;
|
|
131
|
+
background: var(--reke-color-surface, #1A1A1A);
|
|
132
|
+
border: 1px solid var(--reke-color-border, #252525);
|
|
133
|
+
border-radius: 8px;
|
|
134
|
+
box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
|
|
135
|
+
min-width: 280px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* === Calendar header (month/year + nav) === */
|
|
139
|
+
|
|
140
|
+
.calendar__header {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: space-between;
|
|
144
|
+
margin-bottom: 12px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.calendar__title {
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.calendar__nav {
|
|
154
|
+
display: flex;
|
|
155
|
+
gap: 4px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.calendar__nav-btn {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
width: 24px;
|
|
163
|
+
height: 24px;
|
|
164
|
+
padding: 0;
|
|
165
|
+
border: none;
|
|
166
|
+
border-radius: var(--reke-radius, 4px);
|
|
167
|
+
background: transparent;
|
|
168
|
+
color: var(--reke-color-text-muted, #525252);
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
font-family: inherit;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.calendar__nav-btn:hover {
|
|
174
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
175
|
+
background: color-mix(in srgb, var(--reke-color-surface, #1A1A1A) 75%, var(--reke-color-border, #252525));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.calendar__nav-btn svg {
|
|
179
|
+
width: 14px;
|
|
180
|
+
height: 14px;
|
|
181
|
+
fill: none;
|
|
182
|
+
stroke: currentColor;
|
|
183
|
+
stroke-width: 2;
|
|
184
|
+
stroke-linecap: round;
|
|
185
|
+
stroke-linejoin: round;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* === Weekday header === */
|
|
189
|
+
|
|
190
|
+
.calendar__weekdays {
|
|
191
|
+
display: grid;
|
|
192
|
+
grid-template-columns: repeat(7, 1fr);
|
|
193
|
+
margin-bottom: 4px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.calendar__weekday {
|
|
197
|
+
text-align: center;
|
|
198
|
+
font-size: 9px;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
color: var(--reke-color-text-disabled, #3B3B3B);
|
|
201
|
+
padding: 4px 0;
|
|
202
|
+
text-transform: uppercase;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* === Day grid === */
|
|
206
|
+
|
|
207
|
+
.calendar__grid {
|
|
208
|
+
display: grid;
|
|
209
|
+
grid-template-columns: repeat(7, 1fr);
|
|
210
|
+
gap: 2px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.calendar__day {
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
height: 28px;
|
|
218
|
+
font-size: 11px;
|
|
219
|
+
border: none;
|
|
220
|
+
border-radius: var(--reke-radius, 4px);
|
|
221
|
+
background: transparent;
|
|
222
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
padding: 0;
|
|
225
|
+
font-family: inherit;
|
|
226
|
+
transition: background-color 0.1s ease;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.calendar__day:hover {
|
|
230
|
+
background: color-mix(in srgb, var(--reke-color-surface, #1A1A1A) 70%, var(--reke-color-border, #252525));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.calendar__day--other {
|
|
234
|
+
color: var(--reke-color-text-disabled, #3B3B3B);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.calendar__day--today {
|
|
238
|
+
font-weight: 600;
|
|
239
|
+
color: var(--reke-color-primary, #22C55E);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.calendar__day--selected {
|
|
243
|
+
background: var(--reke-color-primary, #22C55E);
|
|
244
|
+
color: var(--reke-color-on-primary, #0A0A0B);
|
|
245
|
+
font-weight: 600;
|
|
246
|
+
border-radius: 14px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.calendar__day--selected:hover {
|
|
250
|
+
background: color-mix(in srgb, var(--reke-color-primary, #22C55E) 85%, black);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.calendar__day--in-range {
|
|
254
|
+
background: color-mix(in srgb, var(--reke-color-primary, #22C55E) 10%, transparent);
|
|
255
|
+
border-radius: var(--reke-radius, 4px);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.calendar__day--range-start {
|
|
259
|
+
background: var(--reke-color-primary, #22C55E);
|
|
260
|
+
color: var(--reke-color-on-primary, #0A0A0B);
|
|
261
|
+
font-weight: 600;
|
|
262
|
+
border-radius: 14px 4px 4px 14px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.calendar__day--range-end {
|
|
266
|
+
background: var(--reke-color-primary, #22C55E);
|
|
267
|
+
color: var(--reke-color-on-primary, #0A0A0B);
|
|
268
|
+
font-weight: 600;
|
|
269
|
+
border-radius: 4px 14px 14px 4px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.calendar__day--range-start.calendar__day--range-end {
|
|
273
|
+
border-radius: 14px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.calendar__day--disabled {
|
|
277
|
+
color: var(--reke-color-text-disabled, #3B3B3B);
|
|
278
|
+
cursor: default;
|
|
279
|
+
pointer-events: none;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* === Calendar footer === */
|
|
283
|
+
|
|
284
|
+
.calendar__footer {
|
|
285
|
+
display: flex;
|
|
286
|
+
justify-content: space-between;
|
|
287
|
+
align-items: center;
|
|
288
|
+
margin-top: 8px;
|
|
289
|
+
padding-top: 8px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.calendar__action {
|
|
293
|
+
font-family: inherit;
|
|
294
|
+
font-size: 11px;
|
|
295
|
+
font-weight: 600;
|
|
296
|
+
border: none;
|
|
297
|
+
background: none;
|
|
298
|
+
cursor: pointer;
|
|
299
|
+
padding: 0;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.calendar__action--today {
|
|
303
|
+
color: var(--reke-color-primary, #22C55E);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.calendar__action--today:hover {
|
|
307
|
+
text-decoration: underline;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.calendar__action--clear {
|
|
311
|
+
color: var(--reke-color-text-muted, #525252);
|
|
312
|
+
font-weight: 400;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.calendar__action--clear:hover {
|
|
316
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
317
|
+
}
|
|
318
|
+
`
|
|
319
|
+
];
|
|
320
|
+
export {
|
|
321
|
+
t as styles
|
|
322
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { nothing as c, html as p } from "lit";
|
|
2
|
+
import { property as l, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { classMap as h } from "lit/directives/class-map.js";
|
|
4
|
+
import { RekeElement as v } from "../../shared/base-element.js";
|
|
5
|
+
import { styles as u } from "./reke-dialog.styles.js";
|
|
6
|
+
var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, a = (e, s, r, i) => {
|
|
7
|
+
for (var t = i > 1 ? void 0 : i ? g(s, r) : s, n = e.length - 1, d; n >= 0; n--)
|
|
8
|
+
(d = e[n]) && (t = (i ? d(s, r, t) : d(t)) || t);
|
|
9
|
+
return i && t && f(s, r, t), t;
|
|
10
|
+
};
|
|
11
|
+
let o = class extends v {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.open = !1, this.heading = "", this.variant = "modal", this.position = "right", this._handleKeydown = (e) => {
|
|
14
|
+
e.key === "Escape" && this.open && this.close();
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback(), document.addEventListener("keydown", this._handleKeydown);
|
|
19
|
+
}
|
|
20
|
+
disconnectedCallback() {
|
|
21
|
+
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown);
|
|
22
|
+
}
|
|
23
|
+
show() {
|
|
24
|
+
this.open = !0;
|
|
25
|
+
}
|
|
26
|
+
close() {
|
|
27
|
+
this.open = !1, this.emit("reke-close");
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
if (!this.open) return c;
|
|
31
|
+
const e = this.variant === "drawer", s = {
|
|
32
|
+
backdrop: !0,
|
|
33
|
+
"backdrop--drawer": e,
|
|
34
|
+
[`backdrop--${this.position}`]: e
|
|
35
|
+
}, r = {
|
|
36
|
+
dialog: !e,
|
|
37
|
+
drawer: e,
|
|
38
|
+
[`drawer--${this.position}`]: e
|
|
39
|
+
};
|
|
40
|
+
return p`
|
|
41
|
+
<div class=${h(s)} @click=${this.close}>
|
|
42
|
+
<div
|
|
43
|
+
class=${h(r)}
|
|
44
|
+
role="dialog"
|
|
45
|
+
aria-modal="true"
|
|
46
|
+
aria-label=${this.heading}
|
|
47
|
+
@click=${(i) => i.stopPropagation()}
|
|
48
|
+
>
|
|
49
|
+
${this.heading ? p`
|
|
50
|
+
<div class="dialog-header">
|
|
51
|
+
<h2 class="dialog-title">${this.heading}</h2>
|
|
52
|
+
<button
|
|
53
|
+
class="close-btn"
|
|
54
|
+
@click=${this.close}
|
|
55
|
+
aria-label="Close"
|
|
56
|
+
>
|
|
57
|
+
×
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
` : c}
|
|
61
|
+
<div class="dialog-body">
|
|
62
|
+
<slot></slot>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="dialog-footer">
|
|
65
|
+
<slot name="footer"></slot>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
o.styles = u;
|
|
73
|
+
a([
|
|
74
|
+
l({ type: Boolean, reflect: !0 })
|
|
75
|
+
], o.prototype, "open", 2);
|
|
76
|
+
a([
|
|
77
|
+
l()
|
|
78
|
+
], o.prototype, "heading", 2);
|
|
79
|
+
a([
|
|
80
|
+
l({ reflect: !0 })
|
|
81
|
+
], o.prototype, "variant", 2);
|
|
82
|
+
a([
|
|
83
|
+
l({ reflect: !0 })
|
|
84
|
+
], o.prototype, "position", 2);
|
|
85
|
+
o = a([
|
|
86
|
+
m("reke-dialog")
|
|
87
|
+
], o);
|
|
88
|
+
export {
|
|
89
|
+
o as RekeDialog
|
|
90
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { tailwindStyles as e } from "../../shared/tailwind-styles.js";
|
|
2
|
+
import { css as o } from "lit";
|
|
3
|
+
const i = [
|
|
4
|
+
e,
|
|
5
|
+
o`
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* === Backdrop === */
|
|
11
|
+
|
|
12
|
+
.backdrop {
|
|
13
|
+
position: fixed;
|
|
14
|
+
inset: 0;
|
|
15
|
+
background: rgba(0, 0, 0, 0.6);
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
z-index: 1000;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.backdrop--drawer {
|
|
23
|
+
align-items: stretch;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.backdrop--right {
|
|
27
|
+
justify-content: flex-end;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.backdrop--left {
|
|
31
|
+
justify-content: flex-start;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* === Modal === */
|
|
35
|
+
|
|
36
|
+
.dialog {
|
|
37
|
+
background: var(--reke-color-bg, #0f0f10);
|
|
38
|
+
border: 1px solid var(--reke-color-border, #252525);
|
|
39
|
+
border-radius: var(--reke-radius, 4px);
|
|
40
|
+
min-width: 400px;
|
|
41
|
+
max-width: 560px;
|
|
42
|
+
width: 100%;
|
|
43
|
+
max-height: 80vh;
|
|
44
|
+
overflow-y: auto;
|
|
45
|
+
font-family: var(
|
|
46
|
+
--reke-font-mono,
|
|
47
|
+
'JetBrains Mono',
|
|
48
|
+
ui-monospace,
|
|
49
|
+
monospace
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* === Drawer === */
|
|
54
|
+
|
|
55
|
+
.drawer {
|
|
56
|
+
background: var(--reke-color-bg, #0f0f10);
|
|
57
|
+
width: 400px;
|
|
58
|
+
max-width: 90vw;
|
|
59
|
+
height: 100%;
|
|
60
|
+
overflow-y: auto;
|
|
61
|
+
font-family: var(
|
|
62
|
+
--reke-font-mono,
|
|
63
|
+
'JetBrains Mono',
|
|
64
|
+
ui-monospace,
|
|
65
|
+
monospace
|
|
66
|
+
);
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.drawer--right {
|
|
72
|
+
border-left: 1px solid var(--reke-color-border, #252525);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.drawer--left {
|
|
76
|
+
border-right: 1px solid var(--reke-color-border, #252525);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* === Shared parts === */
|
|
80
|
+
|
|
81
|
+
.dialog-header {
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
align-items: center;
|
|
85
|
+
padding: 16px 20px;
|
|
86
|
+
border-bottom: 1px solid var(--reke-color-border, #252525);
|
|
87
|
+
flex-shrink: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dialog-title {
|
|
91
|
+
margin: 0;
|
|
92
|
+
font-size: var(--reke-font-size-md, 14px);
|
|
93
|
+
font-weight: var(--reke-font-weight-semibold, 600);
|
|
94
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.close-btn {
|
|
98
|
+
background: transparent;
|
|
99
|
+
border: none;
|
|
100
|
+
color: var(--reke-color-text-muted, #525252);
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
font-size: 20px;
|
|
103
|
+
padding: 4px 8px;
|
|
104
|
+
line-height: 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.close-btn:hover {
|
|
108
|
+
color: var(--reke-color-text, #E5E5E5);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.close-btn:focus-visible {
|
|
112
|
+
outline: 2px solid var(--reke-color-primary, #22C55E);
|
|
113
|
+
outline-offset: 2px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.dialog-body {
|
|
117
|
+
padding: 20px;
|
|
118
|
+
flex: 1;
|
|
119
|
+
overflow-y: auto;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.dialog-footer {
|
|
123
|
+
padding: 12px 20px;
|
|
124
|
+
border-top: 1px solid var(--reke-color-border, #252525);
|
|
125
|
+
display: flex;
|
|
126
|
+
justify-content: flex-end;
|
|
127
|
+
gap: 8px;
|
|
128
|
+
flex-shrink: 0;
|
|
129
|
+
}
|
|
130
|
+
`
|
|
131
|
+
];
|
|
132
|
+
export {
|
|
133
|
+
i as styles
|
|
134
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { nothing as d, html as o } from "lit";
|
|
2
|
+
import { property as s, state as c, query as f, customElement as g } from "lit/decorators.js";
|
|
3
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
|
4
|
+
import { RekeElement as u } from "../../shared/base-element.js";
|
|
5
|
+
import { styles as _ } from "./reke-file-upload.styles.js";
|
|
6
|
+
var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (e, t, p, l) => {
|
|
7
|
+
for (var a = l > 1 ? void 0 : l ? y(t, p) : t, n = e.length - 1, h; n >= 0; n--)
|
|
8
|
+
(h = e[n]) && (a = (l ? h(t, p, a) : h(a)) || a);
|
|
9
|
+
return l && a && v(t, p, a), a;
|
|
10
|
+
};
|
|
11
|
+
let r = class extends u {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.accept = "", this.hint = "", this.disabled = !1, this.error = !1, this.errorMessage = "", this.compact = !1, this._dragging = !1, this._fileName = "";
|
|
14
|
+
}
|
|
15
|
+
handleClick() {
|
|
16
|
+
this.disabled || this._input.click();
|
|
17
|
+
}
|
|
18
|
+
handleDragOver(e) {
|
|
19
|
+
e.preventDefault(), e.stopPropagation(), this.disabled || (this._dragging = !0);
|
|
20
|
+
}
|
|
21
|
+
handleDragLeave(e) {
|
|
22
|
+
e.preventDefault(), e.stopPropagation(), this._dragging = !1;
|
|
23
|
+
}
|
|
24
|
+
handleDrop(e) {
|
|
25
|
+
if (e.preventDefault(), e.stopPropagation(), this._dragging = !1, this.disabled) return;
|
|
26
|
+
const t = e.dataTransfer?.files[0];
|
|
27
|
+
t && (this._fileName = t.name, this.emit("reke-file-select", { file: t }));
|
|
28
|
+
}
|
|
29
|
+
handleInputChange() {
|
|
30
|
+
const e = this._input.files?.[0];
|
|
31
|
+
e && (this._fileName = e.name, this.emit("reke-file-select", { file: e }));
|
|
32
|
+
}
|
|
33
|
+
/** Clear the selected file programmatically. */
|
|
34
|
+
clear() {
|
|
35
|
+
this._fileName = "", this._input && (this._input.value = ""), this.emit("reke-file-clear");
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
const e = {
|
|
39
|
+
dropzone: !0,
|
|
40
|
+
"dropzone--dragging": this._dragging,
|
|
41
|
+
"dropzone--error": this.error,
|
|
42
|
+
"dropzone--compact": this.compact
|
|
43
|
+
};
|
|
44
|
+
return o`
|
|
45
|
+
<div
|
|
46
|
+
part="dropzone"
|
|
47
|
+
class=${m(e)}
|
|
48
|
+
@click=${this.handleClick}
|
|
49
|
+
@dragover=${this.handleDragOver}
|
|
50
|
+
@dragleave=${this.handleDragLeave}
|
|
51
|
+
@drop=${this.handleDrop}
|
|
52
|
+
role="button"
|
|
53
|
+
tabindex="0"
|
|
54
|
+
aria-label="Upload file"
|
|
55
|
+
@keydown=${(t) => {
|
|
56
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleClick());
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<div class="icon" aria-hidden="true">↑</div>
|
|
60
|
+
<div class="text">
|
|
61
|
+
${this._fileName ? o`<span class="text__file">${this._fileName}</span>` : o`<span class="text__primary">
|
|
62
|
+
${this._dragging ? "drop file here" : "drag or select file"}
|
|
63
|
+
</span>`}
|
|
64
|
+
${this.error && this.errorMessage ? o`<span class="text__error">${this.errorMessage}</span>` : this.hint ? o`<span class="text__secondary">${this.hint}</span>` : d}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<input
|
|
68
|
+
type="file"
|
|
69
|
+
accept=${this.accept || d}
|
|
70
|
+
@change=${this.handleInputChange}
|
|
71
|
+
/>
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
r.styles = _;
|
|
76
|
+
i([
|
|
77
|
+
s()
|
|
78
|
+
], r.prototype, "accept", 2);
|
|
79
|
+
i([
|
|
80
|
+
s()
|
|
81
|
+
], r.prototype, "hint", 2);
|
|
82
|
+
i([
|
|
83
|
+
s({ type: Boolean, reflect: !0 })
|
|
84
|
+
], r.prototype, "disabled", 2);
|
|
85
|
+
i([
|
|
86
|
+
s({ type: Boolean, reflect: !0 })
|
|
87
|
+
], r.prototype, "error", 2);
|
|
88
|
+
i([
|
|
89
|
+
s({ attribute: "error-message" })
|
|
90
|
+
], r.prototype, "errorMessage", 2);
|
|
91
|
+
i([
|
|
92
|
+
s({ type: Boolean, reflect: !0 })
|
|
93
|
+
], r.prototype, "compact", 2);
|
|
94
|
+
i([
|
|
95
|
+
c()
|
|
96
|
+
], r.prototype, "_dragging", 2);
|
|
97
|
+
i([
|
|
98
|
+
c()
|
|
99
|
+
], r.prototype, "_fileName", 2);
|
|
100
|
+
i([
|
|
101
|
+
f('input[type="file"]')
|
|
102
|
+
], r.prototype, "_input", 2);
|
|
103
|
+
r = i([
|
|
104
|
+
g("reke-file-upload")
|
|
105
|
+
], r);
|
|
106
|
+
export {
|
|
107
|
+
r as RekeFileUpload
|
|
108
|
+
};
|