@krollins/blueprint 0.1.11 → 0.1.13
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/dist/components/accordion.js +393 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert.js +213 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/avatar.js +237 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +144 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.js +481 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.js +192 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/card.js +223 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox.js +337 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/color-picker.js +1660 -0
- package/dist/components/color-picker.js.map +1 -0
- package/dist/components/combobox.js +595 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/date-picker.js +726 -0
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/divider.js +214 -0
- package/dist/components/divider.js.map +1 -0
- package/dist/components/drawer.js +568 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown.js +377 -0
- package/dist/components/dropdown.js.map +1 -0
- package/dist/components/file-upload.js +669 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/components/heading.js +161 -0
- package/dist/components/heading.js.map +1 -0
- package/dist/components/icon.js +599 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/input.js +363 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/link.js +178 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/menu.js +331 -0
- package/dist/components/menu.js.map +1 -0
- package/dist/components/modal.js +317 -0
- package/dist/components/modal.js.map +1 -0
- package/dist/components/multi-select.js +642 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/notification.js +429 -0
- package/dist/components/notification.js.map +1 -0
- package/dist/components/number-input.js +556 -0
- package/dist/components/number-input.js.map +1 -0
- package/dist/components/pagination.js +320 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.js +597 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.js +219 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio.js +321 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/select.js +498 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/skeleton.js +240 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.js +9 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/spinner.js +133 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stepper.js +812 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.js +380 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +642 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.js +547 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tag.js +291 -0
- package/dist/components/tag.js.map +1 -0
- package/dist/components/text.js +278 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/textarea.js +380 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/time-picker.js +457 -0
- package/dist/components/time-picker.js.map +1 -0
- package/dist/components/tooltip.js +239 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/tree.js +582 -0
- package/dist/components/tree.js.map +1 -0
- package/dist/index.js +93 -17799
- package/dist/index.js.map +1 -1
- package/dist/shared/boolean-converter-XDGfS9LC.js +12 -0
- package/dist/shared/boolean-converter-XDGfS9LC.js.map +1 -0
- package/dist/shared/debounce-BckY30Sf.js +23 -0
- package/dist/shared/debounce-BckY30Sf.js.map +1 -0
- package/dist/shared/memoize-DlOFy-92.js +16 -0
- package/dist/shared/memoize-DlOFy-92.js.map +1 -0
- package/dist/shared/slider-BNt5TITl.js +484 -0
- package/dist/shared/slider-BNt5TITl.js.map +1 -0
- package/package.json +49 -3
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { css as b, LitElement as d, nothing as h, html as a } from "lit";
|
|
2
|
+
import { property as o, query as f, customElement as v } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as s } from "lit/directives/if-defined.js";
|
|
4
|
+
import { live as m } from "lit/directives/live.js";
|
|
5
|
+
import { d as g } from "../shared/debounce-BckY30Sf.js";
|
|
6
|
+
const y = b`
|
|
7
|
+
/* Base styles */
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.input-wrapper {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: var(--bp-spacing-xs);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.input-label {
|
|
19
|
+
font-family: var(--bp-font-family);
|
|
20
|
+
font-size: var(--bp-font-size-sm);
|
|
21
|
+
font-weight: var(--bp-font-weight-medium);
|
|
22
|
+
color: var(--bp-color-text);
|
|
23
|
+
line-height: var(--bp-line-height-normal);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.input-required {
|
|
27
|
+
color: var(--bp-color-error);
|
|
28
|
+
margin-left: var(--bp-spacing-xs);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input {
|
|
32
|
+
font-family: var(--bp-font-family);
|
|
33
|
+
font-size: var(--bp-font-size-base);
|
|
34
|
+
line-height: var(--bp-line-height-normal);
|
|
35
|
+
color: var(--bp-color-text);
|
|
36
|
+
background-color: var(--bp-color-background);
|
|
37
|
+
border: var(--bp-border-width) solid var(--bp-color-border);
|
|
38
|
+
border-radius: var(--bp-border-radius-md);
|
|
39
|
+
padding: var(--bp-spacing-sm) var(--bp-spacing-md);
|
|
40
|
+
box-shadow: inset 0 1px 2px oklch(0 0 0 / 0.05);
|
|
41
|
+
transition:
|
|
42
|
+
border-color var(--bp-transition-fast),
|
|
43
|
+
box-shadow var(--bp-transition-fast);
|
|
44
|
+
width: 100%;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.input::placeholder {
|
|
49
|
+
color: var(--bp-color-text-muted);
|
|
50
|
+
opacity: var(--bp-opacity-subtle);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Variants */
|
|
54
|
+
.input--default {
|
|
55
|
+
border-color: var(--bp-color-border);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.input--success {
|
|
59
|
+
border-color: var(--bp-color-success);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.input--error {
|
|
63
|
+
border-color: var(--bp-color-error);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.input--warning {
|
|
67
|
+
border-color: var(--bp-color-warning);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.input--info {
|
|
71
|
+
border-color: var(--bp-color-info);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Sizes */
|
|
75
|
+
.input--sm {
|
|
76
|
+
font-size: var(--bp-font-size-sm);
|
|
77
|
+
padding: var(--bp-spacing-xs) var(--bp-spacing-sm);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.input--md {
|
|
81
|
+
font-size: var(--bp-font-size-base);
|
|
82
|
+
padding: var(--bp-spacing-sm) var(--bp-spacing-md);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.input--lg {
|
|
86
|
+
font-size: var(--bp-font-size-lg);
|
|
87
|
+
padding: var(--bp-spacing-md) var(--bp-spacing-lg);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* States */
|
|
91
|
+
.input:hover:not(:disabled):not(:focus) {
|
|
92
|
+
border-color: var(--bp-color-border-strong);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.input:focus {
|
|
96
|
+
outline: none;
|
|
97
|
+
border-color: var(--bp-color-focus);
|
|
98
|
+
box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-focus);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.input:focus-visible {
|
|
102
|
+
outline: none;
|
|
103
|
+
border-color: var(--bp-color-focus);
|
|
104
|
+
box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-focus);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.input:disabled {
|
|
108
|
+
opacity: var(--bp-opacity-disabled);
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
background-color: var(--bp-color-surface-subdued);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.input:read-only {
|
|
114
|
+
background-color: var(--bp-color-surface);
|
|
115
|
+
cursor: default;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Variant-specific focus states */
|
|
119
|
+
.input--success:focus,
|
|
120
|
+
.input--success:focus-visible {
|
|
121
|
+
border-color: var(--bp-color-success);
|
|
122
|
+
box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-success);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.input--error:focus,
|
|
126
|
+
.input--error:focus-visible {
|
|
127
|
+
border-color: var(--bp-color-error);
|
|
128
|
+
box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-error);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.input--warning:focus,
|
|
132
|
+
.input--warning:focus-visible {
|
|
133
|
+
border-color: var(--bp-color-warning);
|
|
134
|
+
box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-warning);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.input--info:focus,
|
|
138
|
+
.input--info:focus-visible {
|
|
139
|
+
border-color: var(--bp-color-info);
|
|
140
|
+
box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-info);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* Messages */
|
|
144
|
+
.input-message {
|
|
145
|
+
font-family: var(--bp-font-family);
|
|
146
|
+
font-size: var(--bp-font-size-sm);
|
|
147
|
+
line-height: var(--bp-line-height-normal);
|
|
148
|
+
color: var(--bp-color-text-muted);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.input-message--error {
|
|
152
|
+
color: var(--bp-color-error);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* iOS zoom prevention: ensure 16px minimum on touch devices */
|
|
156
|
+
@media (max-width: 768px) {
|
|
157
|
+
.input--sm {
|
|
158
|
+
font-size: 16px;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, t = (r, i, l, n) => {
|
|
163
|
+
for (var p = n > 1 ? void 0 : n ? w(i, l) : i, u = r.length - 1, c; u >= 0; u--)
|
|
164
|
+
(c = r[u]) && (p = (n ? c(i, l, p) : c(p)) || p);
|
|
165
|
+
return n && p && x(i, l, p), p;
|
|
166
|
+
};
|
|
167
|
+
let e = class extends d {
|
|
168
|
+
constructor() {
|
|
169
|
+
super(...arguments), this.variant = "default", this.size = "md", this.type = "text", this.value = "", this.disabled = !1, this.required = !1, this.readonly = !1, this.debouncedDispatchInput = g(
|
|
170
|
+
(r, i) => {
|
|
171
|
+
this.dispatchEvent(
|
|
172
|
+
new CustomEvent("bp-input", {
|
|
173
|
+
detail: { value: r, originalEvent: i },
|
|
174
|
+
bubbles: !0,
|
|
175
|
+
composed: !0
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
150
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
disconnectedCallback() {
|
|
183
|
+
super.disconnectedCallback(), this.debouncedDispatchInput.cancel();
|
|
184
|
+
}
|
|
185
|
+
handleInput(r) {
|
|
186
|
+
const i = r.target;
|
|
187
|
+
this.value = i.value, this.debouncedDispatchInput(this.value, r);
|
|
188
|
+
}
|
|
189
|
+
handleChange(r) {
|
|
190
|
+
const i = r.target;
|
|
191
|
+
this.value = i.value, this.dispatchEvent(
|
|
192
|
+
new CustomEvent("bp-change", {
|
|
193
|
+
detail: { value: this.value, originalEvent: r },
|
|
194
|
+
bubbles: !0,
|
|
195
|
+
composed: !0
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
handleFocus(r) {
|
|
200
|
+
this.dispatchEvent(
|
|
201
|
+
new CustomEvent("bp-focus", {
|
|
202
|
+
detail: { originalEvent: r },
|
|
203
|
+
bubbles: !0,
|
|
204
|
+
composed: !0
|
|
205
|
+
})
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
handleBlur(r) {
|
|
209
|
+
this.debouncedDispatchInput.flush(), this.dispatchEvent(
|
|
210
|
+
new CustomEvent("bp-blur", {
|
|
211
|
+
detail: { originalEvent: r },
|
|
212
|
+
bubbles: !0,
|
|
213
|
+
composed: !0
|
|
214
|
+
})
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Focuses the input element
|
|
219
|
+
*/
|
|
220
|
+
focus() {
|
|
221
|
+
this.inputElement?.focus();
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Blurs the input element
|
|
225
|
+
*/
|
|
226
|
+
blur() {
|
|
227
|
+
this.inputElement?.blur();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Selects the text in the input
|
|
231
|
+
*/
|
|
232
|
+
select() {
|
|
233
|
+
this.inputElement?.select();
|
|
234
|
+
}
|
|
235
|
+
get messageId() {
|
|
236
|
+
const r = this.variant === "error" && this.errorMessage, i = this.helperText && !r;
|
|
237
|
+
return r ? "error-message" : i ? "helper-text" : "";
|
|
238
|
+
}
|
|
239
|
+
render() {
|
|
240
|
+
const r = this.variant === "error" && this.errorMessage, i = this.helperText && !r;
|
|
241
|
+
return a`
|
|
242
|
+
<div class="input-wrapper">
|
|
243
|
+
${this.label ? a`
|
|
244
|
+
<label class="input-label" for="input">
|
|
245
|
+
${this.label}
|
|
246
|
+
${this.required ? a`<span class="input-required">*</span>` : ""}
|
|
247
|
+
</label>
|
|
248
|
+
` : ""}
|
|
249
|
+
|
|
250
|
+
<input
|
|
251
|
+
part="input"
|
|
252
|
+
id="input"
|
|
253
|
+
class="input input--${this.variant} input--${this.size}"
|
|
254
|
+
type=${this.type}
|
|
255
|
+
.value=${m(this.value)}
|
|
256
|
+
placeholder=${s(this.placeholder)}
|
|
257
|
+
?disabled=${this.disabled}
|
|
258
|
+
?required=${this.required}
|
|
259
|
+
?readonly=${this.readonly}
|
|
260
|
+
name=${s(this.name)}
|
|
261
|
+
autocomplete=${s(this.autocomplete)}
|
|
262
|
+
minlength=${s(this.minlength)}
|
|
263
|
+
maxlength=${s(this.maxlength)}
|
|
264
|
+
pattern=${s(this.pattern)}
|
|
265
|
+
step=${s(this.step)}
|
|
266
|
+
min=${s(this.min)}
|
|
267
|
+
max=${s(this.max)}
|
|
268
|
+
inputmode=${s(this.inputmode)}
|
|
269
|
+
aria-invalid=${this.variant === "error" ? "true" : "false"}
|
|
270
|
+
aria-describedby=${this.messageId || h}
|
|
271
|
+
@input=${this.handleInput}
|
|
272
|
+
@change=${this.handleChange}
|
|
273
|
+
@focus=${this.handleFocus}
|
|
274
|
+
@blur=${this.handleBlur}
|
|
275
|
+
/>
|
|
276
|
+
|
|
277
|
+
${r ? a`
|
|
278
|
+
<div
|
|
279
|
+
id="error-message"
|
|
280
|
+
class="input-message input-message--error"
|
|
281
|
+
role="alert"
|
|
282
|
+
>
|
|
283
|
+
${this.errorMessage}
|
|
284
|
+
</div>
|
|
285
|
+
` : ""}
|
|
286
|
+
${i ? a`<div id="helper-text" class="input-message">
|
|
287
|
+
${this.helperText}
|
|
288
|
+
</div>` : ""}
|
|
289
|
+
</div>
|
|
290
|
+
`;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
e.styles = [y];
|
|
294
|
+
t([
|
|
295
|
+
o({ type: String, reflect: !0 })
|
|
296
|
+
], e.prototype, "variant", 2);
|
|
297
|
+
t([
|
|
298
|
+
o({ type: String, reflect: !0 })
|
|
299
|
+
], e.prototype, "size", 2);
|
|
300
|
+
t([
|
|
301
|
+
o({ type: String, reflect: !0 })
|
|
302
|
+
], e.prototype, "type", 2);
|
|
303
|
+
t([
|
|
304
|
+
o({ type: String, reflect: !0 })
|
|
305
|
+
], e.prototype, "value", 2);
|
|
306
|
+
t([
|
|
307
|
+
o({ type: String, reflect: !0 })
|
|
308
|
+
], e.prototype, "placeholder", 2);
|
|
309
|
+
t([
|
|
310
|
+
o({ type: String, reflect: !0 })
|
|
311
|
+
], e.prototype, "label", 2);
|
|
312
|
+
t([
|
|
313
|
+
o({ type: String, reflect: !0 })
|
|
314
|
+
], e.prototype, "helperText", 2);
|
|
315
|
+
t([
|
|
316
|
+
o({ type: String, reflect: !0 })
|
|
317
|
+
], e.prototype, "errorMessage", 2);
|
|
318
|
+
t([
|
|
319
|
+
o({ type: Boolean, reflect: !0 })
|
|
320
|
+
], e.prototype, "disabled", 2);
|
|
321
|
+
t([
|
|
322
|
+
o({ type: Boolean, reflect: !0 })
|
|
323
|
+
], e.prototype, "required", 2);
|
|
324
|
+
t([
|
|
325
|
+
o({ type: Boolean, reflect: !0 })
|
|
326
|
+
], e.prototype, "readonly", 2);
|
|
327
|
+
t([
|
|
328
|
+
o({ type: String, reflect: !0 })
|
|
329
|
+
], e.prototype, "name", 2);
|
|
330
|
+
t([
|
|
331
|
+
o({ type: String, reflect: !0 })
|
|
332
|
+
], e.prototype, "autocomplete", 2);
|
|
333
|
+
t([
|
|
334
|
+
o({ type: Number, reflect: !0 })
|
|
335
|
+
], e.prototype, "minlength", 2);
|
|
336
|
+
t([
|
|
337
|
+
o({ type: Number, reflect: !0 })
|
|
338
|
+
], e.prototype, "maxlength", 2);
|
|
339
|
+
t([
|
|
340
|
+
o({ type: String, reflect: !0 })
|
|
341
|
+
], e.prototype, "pattern", 2);
|
|
342
|
+
t([
|
|
343
|
+
o({ type: Number, reflect: !0 })
|
|
344
|
+
], e.prototype, "step", 2);
|
|
345
|
+
t([
|
|
346
|
+
o({ type: Number, reflect: !0 })
|
|
347
|
+
], e.prototype, "min", 2);
|
|
348
|
+
t([
|
|
349
|
+
o({ type: Number, reflect: !0 })
|
|
350
|
+
], e.prototype, "max", 2);
|
|
351
|
+
t([
|
|
352
|
+
o({ type: String, reflect: !0 })
|
|
353
|
+
], e.prototype, "inputmode", 2);
|
|
354
|
+
t([
|
|
355
|
+
f("input")
|
|
356
|
+
], e.prototype, "inputElement", 2);
|
|
357
|
+
e = t([
|
|
358
|
+
v("bp-input")
|
|
359
|
+
], e);
|
|
360
|
+
export {
|
|
361
|
+
e as BpInput
|
|
362
|
+
};
|
|
363
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../source/components/input/input.style.ts","../../source/components/input/input.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const inputStyles = css`\n /* Base styles */\n :host {\n display: block;\n }\n\n .input-wrapper {\n display: flex;\n flex-direction: column;\n gap: var(--bp-spacing-xs);\n }\n\n .input-label {\n font-family: var(--bp-font-family);\n font-size: var(--bp-font-size-sm);\n font-weight: var(--bp-font-weight-medium);\n color: var(--bp-color-text);\n line-height: var(--bp-line-height-normal);\n }\n\n .input-required {\n color: var(--bp-color-error);\n margin-left: var(--bp-spacing-xs);\n }\n\n .input {\n font-family: var(--bp-font-family);\n font-size: var(--bp-font-size-base);\n line-height: var(--bp-line-height-normal);\n color: var(--bp-color-text);\n background-color: var(--bp-color-background);\n border: var(--bp-border-width) solid var(--bp-color-border);\n border-radius: var(--bp-border-radius-md);\n padding: var(--bp-spacing-sm) var(--bp-spacing-md);\n box-shadow: inset 0 1px 2px oklch(0 0 0 / 0.05);\n transition:\n border-color var(--bp-transition-fast),\n box-shadow var(--bp-transition-fast);\n width: 100%;\n box-sizing: border-box;\n }\n\n .input::placeholder {\n color: var(--bp-color-text-muted);\n opacity: var(--bp-opacity-subtle);\n }\n\n /* Variants */\n .input--default {\n border-color: var(--bp-color-border);\n }\n\n .input--success {\n border-color: var(--bp-color-success);\n }\n\n .input--error {\n border-color: var(--bp-color-error);\n }\n\n .input--warning {\n border-color: var(--bp-color-warning);\n }\n\n .input--info {\n border-color: var(--bp-color-info);\n }\n\n /* Sizes */\n .input--sm {\n font-size: var(--bp-font-size-sm);\n padding: var(--bp-spacing-xs) var(--bp-spacing-sm);\n }\n\n .input--md {\n font-size: var(--bp-font-size-base);\n padding: var(--bp-spacing-sm) var(--bp-spacing-md);\n }\n\n .input--lg {\n font-size: var(--bp-font-size-lg);\n padding: var(--bp-spacing-md) var(--bp-spacing-lg);\n }\n\n /* States */\n .input:hover:not(:disabled):not(:focus) {\n border-color: var(--bp-color-border-strong);\n }\n\n .input:focus {\n outline: none;\n border-color: var(--bp-color-focus);\n box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-focus);\n }\n\n .input:focus-visible {\n outline: none;\n border-color: var(--bp-color-focus);\n box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-focus);\n }\n\n .input:disabled {\n opacity: var(--bp-opacity-disabled);\n cursor: not-allowed;\n background-color: var(--bp-color-surface-subdued);\n }\n\n .input:read-only {\n background-color: var(--bp-color-surface);\n cursor: default;\n }\n\n /* Variant-specific focus states */\n .input--success:focus,\n .input--success:focus-visible {\n border-color: var(--bp-color-success);\n box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-success);\n }\n\n .input--error:focus,\n .input--error:focus-visible {\n border-color: var(--bp-color-error);\n box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-error);\n }\n\n .input--warning:focus,\n .input--warning:focus-visible {\n border-color: var(--bp-color-warning);\n box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-warning);\n }\n\n .input--info:focus,\n .input--info:focus-visible {\n border-color: var(--bp-color-info);\n box-shadow: 0 0 0 var(--bp-focus-offset) var(--bp-color-info);\n }\n\n /* Messages */\n .input-message {\n font-family: var(--bp-font-family);\n font-size: var(--bp-font-size-sm);\n line-height: var(--bp-line-height-normal);\n color: var(--bp-color-text-muted);\n }\n\n .input-message--error {\n color: var(--bp-color-error);\n }\n\n /* iOS zoom prevention: ensure 16px minimum on touch devices */\n @media (max-width: 768px) {\n .input--sm {\n font-size: 16px;\n }\n }\n`;\n","import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { inputStyles } from './input.style.js';\nimport { debounce } from '../../utilities/debounce.js';\n\nexport type InputVariant = 'default' | 'success' | 'error' | 'warning' | 'info';\nexport type InputSize = 'sm' | 'md' | 'lg';\nexport type InputType =\n | 'text'\n | 'email'\n | 'password'\n | 'number'\n | 'tel'\n | 'url'\n | 'search';\n\nexport type InputModeType =\n | 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal'\n | 'search';\n\nexport type AutocompleteType =\n | 'on'\n | 'off'\n | 'name'\n | 'email'\n | 'username'\n | 'new-password'\n | 'current-password'\n | 'tel'\n | 'url'\n | 'street-address'\n | 'address-line1'\n | 'address-line2'\n | 'address-line3'\n | 'address-level1'\n | 'address-level2'\n | 'address-level3'\n | 'address-level4'\n | 'country'\n | 'country-name'\n | 'postal-code'\n | 'cc-name'\n | 'cc-given-name'\n | 'cc-additional-name'\n | 'cc-family-name'\n | 'cc-number'\n | 'cc-exp'\n | 'cc-exp-month'\n | 'cc-exp-year'\n | 'cc-csc'\n | 'cc-type'\n | 'transaction-currency'\n | 'transaction-amount'\n | 'language'\n | 'bday'\n | 'bday-day'\n | 'bday-month'\n | 'bday-year'\n | 'sex'\n | 'tel-country-code'\n | 'tel-national'\n | 'tel-area-code'\n | 'tel-local'\n | 'tel-extension'\n | 'organization'\n | 'organization-title';\n\n@customElement('bp-input')\nexport class BpInput extends LitElement {\n @property({ type: String, reflect: true }) variant: InputVariant = 'default';\n @property({ type: String, reflect: true }) size: InputSize = 'md';\n @property({ type: String, reflect: true }) type: InputType = 'text';\n @property({ type: String, reflect: true }) value: string = '';\n @property({ type: String, reflect: true }) placeholder?: string;\n @property({ type: String, reflect: true }) label?: string;\n @property({ type: String, reflect: true }) helperText?: string;\n @property({ type: String, reflect: true }) errorMessage?: string;\n @property({ type: Boolean, reflect: true }) disabled: boolean = false;\n @property({ type: Boolean, reflect: true }) required: boolean = false;\n @property({ type: Boolean, reflect: true }) readonly: boolean = false;\n @property({ type: String, reflect: true }) name?: string;\n @property({ type: String, reflect: true }) autocomplete?: AutocompleteType;\n @property({ type: Number, reflect: true }) minlength?: number;\n @property({ type: Number, reflect: true }) maxlength?: number;\n @property({ type: String, reflect: true }) pattern?: string;\n @property({ type: Number, reflect: true }) step?: number;\n @property({ type: Number, reflect: true }) min?: number;\n @property({ type: Number, reflect: true }) max?: number;\n @property({ type: String, reflect: true }) inputmode?: InputModeType;\n\n @query('input') private inputElement?: HTMLInputElement;\n\n private debouncedDispatchInput = debounce(\n (value: string, originalEvent: InputEvent) => {\n this.dispatchEvent(\n new CustomEvent('bp-input', {\n detail: { value, originalEvent },\n bubbles: true,\n composed: true,\n })\n );\n },\n 150\n );\n\n static styles = [inputStyles];\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.debouncedDispatchInput.cancel();\n }\n\n private handleInput(e: InputEvent) {\n const target = e.target as HTMLInputElement;\n this.value = target.value;\n this.debouncedDispatchInput(this.value, e);\n }\n\n private handleChange(e: Event) {\n const target = e.target as HTMLInputElement;\n this.value = target.value;\n\n this.dispatchEvent(\n new CustomEvent('bp-change', {\n detail: { value: this.value, originalEvent: e },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleFocus(e: FocusEvent) {\n this.dispatchEvent(\n new CustomEvent('bp-focus', {\n detail: { originalEvent: e },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleBlur(e: FocusEvent) {\n this.debouncedDispatchInput.flush();\n this.dispatchEvent(\n new CustomEvent('bp-blur', {\n detail: { originalEvent: e },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /**\n * Focuses the input element\n */\n public focus() {\n this.inputElement?.focus();\n }\n\n /**\n * Blurs the input element\n */\n public blur() {\n this.inputElement?.blur();\n }\n\n /**\n * Selects the text in the input\n */\n public select() {\n this.inputElement?.select();\n }\n\n private get messageId(): string {\n const showError = this.variant === 'error' && this.errorMessage;\n const showHelper = this.helperText && !showError;\n if (showError) return 'error-message';\n if (showHelper) return 'helper-text';\n return '';\n }\n\n render() {\n const showError = this.variant === 'error' && this.errorMessage;\n const showHelper = this.helperText && !showError;\n\n return html`\n <div class=\"input-wrapper\">\n ${this.label\n ? html`\n <label class=\"input-label\" for=\"input\">\n ${this.label}\n ${this.required\n ? html`<span class=\"input-required\">*</span>`\n : ''}\n </label>\n `\n : ''}\n\n <input\n part=\"input\"\n id=\"input\"\n class=\"input input--${this.variant} input--${this.size}\"\n type=${this.type}\n .value=${live(this.value)}\n placeholder=${ifDefined(this.placeholder)}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?readonly=${this.readonly}\n name=${ifDefined(this.name)}\n autocomplete=${ifDefined(this.autocomplete)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n pattern=${ifDefined(this.pattern)}\n step=${ifDefined(this.step)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n inputmode=${ifDefined(this.inputmode)}\n aria-invalid=${this.variant === 'error' ? 'true' : 'false'}\n aria-describedby=${this.messageId || nothing}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n\n ${showError\n ? html`\n <div\n id=\"error-message\"\n class=\"input-message input-message--error\"\n role=\"alert\"\n >\n ${this.errorMessage}\n </div>\n `\n : ''}\n ${showHelper\n ? html`<div id=\"helper-text\" class=\"input-message\">\n ${this.helperText}\n </div>`\n : ''}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bp-input': BpInput;\n }\n}\n"],"names":["inputStyles","css","BpInput","LitElement","debounce","value","originalEvent","e","target","showError","showHelper","html","live","ifDefined","nothing","__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AAA,GACZhB,CAAA;"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { css as d, LitElement as v, html as f } from "lit";
|
|
2
|
+
import { property as i, customElement as u } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as c } from "lit/directives/if-defined.js";
|
|
4
|
+
const h = d`
|
|
5
|
+
/* Base styles */
|
|
6
|
+
:host {
|
|
7
|
+
display: inline;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.link {
|
|
11
|
+
display: inline;
|
|
12
|
+
font-family: var(--bp-font-family);
|
|
13
|
+
font-size: inherit;
|
|
14
|
+
font-weight: inherit;
|
|
15
|
+
color: var(--bp-color-primary);
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
transition: color var(--bp-transition-fast);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.link:hover {
|
|
22
|
+
color: var(--bp-color-primary-hover);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.link:active {
|
|
26
|
+
color: var(--bp-color-primary-active);
|
|
27
|
+
transform: translateY(var(--bp-spacing-0-5));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.link:visited {
|
|
31
|
+
color: var(--bp-color-primary);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.link:visited:hover {
|
|
35
|
+
color: var(--bp-color-primary-hover);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.link:focus-visible {
|
|
39
|
+
outline: var(--bp-focus-width) solid var(--bp-color-focus);
|
|
40
|
+
outline-offset: var(--bp-focus-offset);
|
|
41
|
+
border-radius: var(--bp-border-radius-sm);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.link[aria-disabled='true'] {
|
|
45
|
+
color: var(--bp-color-text-muted);
|
|
46
|
+
opacity: 0.5;
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Variants */
|
|
51
|
+
.link--primary {
|
|
52
|
+
font-weight: var(--bp-font-weight-semibold);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.link--muted {
|
|
56
|
+
color: var(--bp-color-text-muted);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.link--muted:hover {
|
|
60
|
+
color: var(--bp-color-text);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.link--muted:active {
|
|
64
|
+
color: var(--bp-color-text);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.link--muted:visited {
|
|
68
|
+
color: var(--bp-color-text-muted);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Underline variants */
|
|
72
|
+
.link--underline-always {
|
|
73
|
+
text-decoration: underline;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.link--underline-hover {
|
|
77
|
+
text-decoration: underline;
|
|
78
|
+
text-decoration-color: transparent;
|
|
79
|
+
transition: text-decoration-color var(--bp-transition-fast);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.link--underline-hover:hover {
|
|
83
|
+
text-decoration-color: currentColor;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.link--underline-none {
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.link--underline-none:hover {
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Size variants */
|
|
95
|
+
.link--size-sm {
|
|
96
|
+
font-size: var(--bp-font-size-sm);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.link--size-md {
|
|
100
|
+
font-size: inherit;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.link--size-lg {
|
|
104
|
+
font-size: var(--bp-font-size-lg);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* External link indicator */
|
|
108
|
+
.link[target='_blank']::after {
|
|
109
|
+
content: '↗';
|
|
110
|
+
margin-left: var(--bp-spacing-1);
|
|
111
|
+
vertical-align: super;
|
|
112
|
+
line-height: 0;
|
|
113
|
+
opacity: 0.75;
|
|
114
|
+
transition: opacity var(--bp-transition-fast);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.link[target='_blank']:hover::after {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
var b = Object.defineProperty, m = Object.getOwnPropertyDescriptor, t = (o, n, a, l) => {
|
|
122
|
+
for (var r = l > 1 ? void 0 : l ? m(n, a) : n, s = o.length - 1, p; s >= 0; s--)
|
|
123
|
+
(p = o[s]) && (r = (l ? p(n, a, r) : p(r)) || r);
|
|
124
|
+
return l && r && b(n, a, r), r;
|
|
125
|
+
};
|
|
126
|
+
let e = class extends v {
|
|
127
|
+
constructor() {
|
|
128
|
+
super(), this.href = "", this.target = "", this.rel = "", this.variant = "default", this.underline = "hover", this.size = "md", this.disabled = !1;
|
|
129
|
+
}
|
|
130
|
+
handleClick(o) {
|
|
131
|
+
this.disabled && o.preventDefault();
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
const o = this.target === "_blank", n = this.rel || (o ? "noopener noreferrer" : void 0);
|
|
135
|
+
return f`
|
|
136
|
+
<a
|
|
137
|
+
class="link link--${this.variant} link--underline-${this.underline} link--size-${this.size}"
|
|
138
|
+
href=${c(this.disabled ? void 0 : this.href || void 0)}
|
|
139
|
+
target=${c(this.target || void 0)}
|
|
140
|
+
rel=${c(n)}
|
|
141
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
142
|
+
@click=${this.handleClick}
|
|
143
|
+
part="link"
|
|
144
|
+
>
|
|
145
|
+
<slot></slot>
|
|
146
|
+
</a>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
e.styles = [h];
|
|
151
|
+
t([
|
|
152
|
+
i({ type: String, reflect: !0 })
|
|
153
|
+
], e.prototype, "href", 2);
|
|
154
|
+
t([
|
|
155
|
+
i({ type: String, reflect: !0 })
|
|
156
|
+
], e.prototype, "target", 2);
|
|
157
|
+
t([
|
|
158
|
+
i({ type: String, reflect: !0 })
|
|
159
|
+
], e.prototype, "rel", 2);
|
|
160
|
+
t([
|
|
161
|
+
i({ type: String, reflect: !0 })
|
|
162
|
+
], e.prototype, "variant", 2);
|
|
163
|
+
t([
|
|
164
|
+
i({ type: String, reflect: !0 })
|
|
165
|
+
], e.prototype, "underline", 2);
|
|
166
|
+
t([
|
|
167
|
+
i({ type: String, reflect: !0 })
|
|
168
|
+
], e.prototype, "size", 2);
|
|
169
|
+
t([
|
|
170
|
+
i({ type: Boolean, reflect: !0 })
|
|
171
|
+
], e.prototype, "disabled", 2);
|
|
172
|
+
e = t([
|
|
173
|
+
u("bp-link")
|
|
174
|
+
], e);
|
|
175
|
+
export {
|
|
176
|
+
e as BpLink
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../source/components/link/link.style.ts","../../source/components/link/link.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const linkStyles = css`\n /* Base styles */\n :host {\n display: inline;\n }\n\n .link {\n display: inline;\n font-family: var(--bp-font-family);\n font-size: inherit;\n font-weight: inherit;\n color: var(--bp-color-primary);\n text-decoration: none;\n cursor: pointer;\n transition: color var(--bp-transition-fast);\n }\n\n .link:hover {\n color: var(--bp-color-primary-hover);\n }\n\n .link:active {\n color: var(--bp-color-primary-active);\n transform: translateY(var(--bp-spacing-0-5));\n }\n\n .link:visited {\n color: var(--bp-color-primary);\n }\n\n .link:visited:hover {\n color: var(--bp-color-primary-hover);\n }\n\n .link:focus-visible {\n outline: var(--bp-focus-width) solid var(--bp-color-focus);\n outline-offset: var(--bp-focus-offset);\n border-radius: var(--bp-border-radius-sm);\n }\n\n .link[aria-disabled='true'] {\n color: var(--bp-color-text-muted);\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Variants */\n .link--primary {\n font-weight: var(--bp-font-weight-semibold);\n }\n\n .link--muted {\n color: var(--bp-color-text-muted);\n }\n\n .link--muted:hover {\n color: var(--bp-color-text);\n }\n\n .link--muted:active {\n color: var(--bp-color-text);\n }\n\n .link--muted:visited {\n color: var(--bp-color-text-muted);\n }\n\n /* Underline variants */\n .link--underline-always {\n text-decoration: underline;\n }\n\n .link--underline-hover {\n text-decoration: underline;\n text-decoration-color: transparent;\n transition: text-decoration-color var(--bp-transition-fast);\n }\n\n .link--underline-hover:hover {\n text-decoration-color: currentColor;\n }\n\n .link--underline-none {\n text-decoration: none;\n }\n\n .link--underline-none:hover {\n text-decoration: none;\n }\n\n /* Size variants */\n .link--size-sm {\n font-size: var(--bp-font-size-sm);\n }\n\n .link--size-md {\n font-size: inherit;\n }\n\n .link--size-lg {\n font-size: var(--bp-font-size-lg);\n }\n\n /* External link indicator */\n .link[target='_blank']::after {\n content: '↗';\n margin-left: var(--bp-spacing-1);\n vertical-align: super;\n line-height: 0;\n opacity: 0.75;\n transition: opacity var(--bp-transition-fast);\n }\n\n .link[target='_blank']:hover::after {\n opacity: 1;\n }\n`;\n","import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { linkStyles } from './link.style.js';\n\nexport type LinkVariant = 'default' | 'primary' | 'muted';\nexport type LinkUnderline = 'always' | 'hover' | 'none';\nexport type LinkSize = 'sm' | 'md' | 'lg';\n\n/**\n * A link component that provides styled anchor elements with variants.\n * Supports internal and external links with accessibility features.\n */\n@customElement('bp-link')\nexport class BpLink extends LitElement {\n /**\n * The URL the link points to.\n * @type {string}\n * @default ''\n */\n @property({ type: String, reflect: true }) declare href: string;\n\n /**\n * Where to display the linked URL (same semantics as anchor target).\n * @type {string}\n * @default ''\n */\n @property({ type: String, reflect: true }) declare target: string;\n\n /**\n * Relationship of the linked URL (same semantics as anchor rel).\n * @type {string}\n * @default ''\n */\n @property({ type: String, reflect: true }) declare rel: string;\n\n /**\n * Visual variant of the link.\n * @type {'default' | 'primary' | 'muted'}\n * @default 'default'\n */\n @property({ type: String, reflect: true }) declare variant: LinkVariant;\n\n /**\n * Underline style for the link.\n * @type {'always' | 'hover' | 'none'}\n * @default 'hover'\n */\n @property({ type: String, reflect: true }) declare underline: LinkUnderline;\n\n /**\n * Size of the link text.\n * @type {'sm' | 'md' | 'lg'}\n * @default 'md'\n */\n @property({ type: String, reflect: true }) declare size: LinkSize;\n\n /**\n * Whether the link is disabled.\n * @type {boolean}\n * @default false\n */\n @property({ type: Boolean, reflect: true }) declare disabled: boolean;\n\n static styles = [linkStyles];\n\n constructor() {\n super();\n this.href = '';\n this.target = '';\n this.rel = '';\n this.variant = 'default';\n this.underline = 'hover';\n this.size = 'md';\n this.disabled = false;\n }\n\n private handleClick(event: MouseEvent) {\n if (this.disabled) {\n event.preventDefault();\n }\n }\n\n render() {\n const isExternal = this.target === '_blank';\n const computedRel =\n this.rel || (isExternal ? 'noopener noreferrer' : undefined);\n\n return html`\n <a\n class=\"link link--${this.variant} link--underline-${this\n .underline} link--size-${this.size}\"\n href=${ifDefined(this.disabled ? undefined : this.href || undefined)}\n target=${ifDefined(this.target || undefined)}\n rel=${ifDefined(computedRel)}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n @click=${this.handleClick}\n part=\"link\"\n >\n <slot></slot>\n </a>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bp-link': BpLink;\n }\n}\n"],"names":["linkStyles","css","BpLink","LitElement","event","isExternal","computedRel","html","ifDefined","__decorateClass","property","customElement"],"mappings":";;;AAEO,MAAMA,IAAaC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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