@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,556 @@
|
|
|
1
|
+
import { css as d, LitElement as m, nothing as u, html as p } from "lit";
|
|
2
|
+
import { property as i, query as h, customElement as v } from "lit/decorators.js";
|
|
3
|
+
import { classMap as c } from "lit/directives/class-map.js";
|
|
4
|
+
const f = d`
|
|
5
|
+
/* Base styles */
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.number-input {
|
|
11
|
+
font-family: var(--bp-font-family);
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--bp-spacing-xs);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.number-input__label {
|
|
18
|
+
font-size: var(--bp-font-size-sm);
|
|
19
|
+
font-weight: var(--bp-font-weight-medium);
|
|
20
|
+
color: var(--bp-color-text);
|
|
21
|
+
line-height: var(--bp-line-height-normal);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.number-input__required {
|
|
25
|
+
color: var(--bp-color-error);
|
|
26
|
+
margin-left: var(--bp-spacing-xs);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.number-input__container {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: stretch;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.number-input__input {
|
|
35
|
+
flex: 1;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
font-family: var(--bp-font-family);
|
|
38
|
+
font-size: var(--bp-font-size-base);
|
|
39
|
+
line-height: var(--bp-line-height-normal);
|
|
40
|
+
color: var(--bp-color-text);
|
|
41
|
+
background-color: var(--bp-color-background);
|
|
42
|
+
border: var(--bp-border-width) solid var(--bp-color-border);
|
|
43
|
+
padding: var(--bp-spacing-sm) var(--bp-spacing-md);
|
|
44
|
+
text-align: center;
|
|
45
|
+
font-variant-numeric: tabular-nums;
|
|
46
|
+
transition:
|
|
47
|
+
border-color var(--bp-transition-fast),
|
|
48
|
+
box-shadow var(--bp-transition-fast);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.number-input__input::placeholder {
|
|
52
|
+
color: var(--bp-color-text-muted);
|
|
53
|
+
opacity: var(--bp-opacity-subtle);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.number-input__input:hover:not(:disabled):not(:readonly) {
|
|
57
|
+
border-color: var(--bp-color-border-strong);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.number-input__input:focus {
|
|
61
|
+
outline: none;
|
|
62
|
+
border-color: var(--bp-color-focus);
|
|
63
|
+
box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-focus);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.number-input__input:focus-visible {
|
|
67
|
+
outline: none;
|
|
68
|
+
border-color: var(--bp-color-focus);
|
|
69
|
+
box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-focus);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Button styling */
|
|
73
|
+
.number-input__button {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
background-color: var(--bp-color-surface);
|
|
78
|
+
border: var(--bp-border-width) solid var(--bp-color-border);
|
|
79
|
+
color: var(--bp-color-text);
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
transition:
|
|
82
|
+
background-color var(--bp-transition-fast),
|
|
83
|
+
border-color var(--bp-transition-fast);
|
|
84
|
+
padding: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.number-input__button:hover:not(:disabled) {
|
|
88
|
+
background-color: var(--bp-color-surface-elevated);
|
|
89
|
+
border-color: var(--bp-color-border-strong);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.number-input__button:active:not(:disabled) {
|
|
93
|
+
background-color: var(--bp-color-surface-subdued);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.number-input__button:focus-visible {
|
|
97
|
+
outline: var(--bp-focus-width) var(--bp-focus-style) var(--bp-color-focus);
|
|
98
|
+
outline-offset: var(--bp-focus-offset);
|
|
99
|
+
z-index: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.number-input__button:disabled {
|
|
103
|
+
opacity: var(--bp-opacity-disabled);
|
|
104
|
+
background-color: var(--bp-color-surface-subdued);
|
|
105
|
+
cursor: not-allowed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.number-input__button--decrement {
|
|
109
|
+
border-right: none;
|
|
110
|
+
border-radius: var(--bp-border-radius-md) 0 0 var(--bp-border-radius-md);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.number-input__button--increment {
|
|
114
|
+
border-left: none;
|
|
115
|
+
border-radius: 0 var(--bp-border-radius-md) var(--bp-border-radius-md) 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.number-input__button-icon {
|
|
119
|
+
font-size: var(--bp-font-size-lg);
|
|
120
|
+
font-weight: var(--bp-font-weight-bold);
|
|
121
|
+
line-height: 1;
|
|
122
|
+
user-select: none;
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Input border radius adjustment when buttons visible */
|
|
129
|
+
.number-input:not(.number-input--hide-buttons) .number-input__input {
|
|
130
|
+
border-radius: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.number-input--hide-buttons .number-input__input {
|
|
134
|
+
border-radius: var(--bp-border-radius-md);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Size variants */
|
|
138
|
+
.number-input--sm .number-input__input {
|
|
139
|
+
font-size: var(--bp-font-size-sm);
|
|
140
|
+
padding: var(--bp-spacing-xs) var(--bp-spacing-sm);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.number-input--sm .number-input__button {
|
|
144
|
+
width: var(--bp-spacing-8);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.number-input--sm .number-input__button-icon {
|
|
148
|
+
font-size: var(--bp-font-size-base);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.number-input--md .number-input__input {
|
|
152
|
+
font-size: var(--bp-font-size-base);
|
|
153
|
+
padding: var(--bp-spacing-sm) var(--bp-spacing-md);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.number-input--md .number-input__button {
|
|
157
|
+
width: var(--bp-spacing-10);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.number-input--lg .number-input__input {
|
|
161
|
+
font-size: var(--bp-font-size-lg);
|
|
162
|
+
padding: var(--bp-spacing-md) var(--bp-spacing-lg);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.number-input--lg .number-input__button {
|
|
166
|
+
width: var(--bp-spacing-12);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.number-input--lg .number-input__button-icon {
|
|
170
|
+
font-size: var(--bp-font-size-xl);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Variant styles */
|
|
174
|
+
.number-input__input--default {
|
|
175
|
+
border-color: var(--bp-color-border);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.number-input__input--success {
|
|
179
|
+
border-color: var(--bp-color-success);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.number-input__input--success:focus,
|
|
183
|
+
.number-input__input--success:focus-visible {
|
|
184
|
+
border-color: var(--bp-color-success);
|
|
185
|
+
box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-success);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.number-input__input--error {
|
|
189
|
+
border-color: var(--bp-color-error);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.number-input__input--error:focus,
|
|
193
|
+
.number-input__input--error:focus-visible {
|
|
194
|
+
border-color: var(--bp-color-error);
|
|
195
|
+
box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-error);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.number-input__input--warning {
|
|
199
|
+
border-color: var(--bp-color-warning);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.number-input__input--warning:focus,
|
|
203
|
+
.number-input__input--warning:focus-visible {
|
|
204
|
+
border-color: var(--bp-color-warning);
|
|
205
|
+
box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-warning);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Match button border color to input variant */
|
|
209
|
+
.number-input--success .number-input__button {
|
|
210
|
+
border-color: var(--bp-color-success);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.number-input--error .number-input__button {
|
|
214
|
+
border-color: var(--bp-color-error);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.number-input--warning .number-input__button {
|
|
218
|
+
border-color: var(--bp-color-warning);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* States */
|
|
222
|
+
.number-input--disabled {
|
|
223
|
+
pointer-events: none;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.number-input--disabled .number-input__input {
|
|
227
|
+
opacity: var(--bp-opacity-disabled);
|
|
228
|
+
background-color: var(--bp-color-surface-subdued);
|
|
229
|
+
cursor: not-allowed;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.number-input--disabled .number-input__label {
|
|
233
|
+
opacity: var(--bp-opacity-disabled);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.number-input--readonly .number-input__input {
|
|
237
|
+
background-color: var(--bp-color-surface-subdued);
|
|
238
|
+
cursor: default;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.number-input--readonly .number-input__button {
|
|
242
|
+
background-color: var(--bp-color-surface-subdued);
|
|
243
|
+
pointer-events: none;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Message styles */
|
|
247
|
+
.number-input__message {
|
|
248
|
+
font-size: var(--bp-font-size-sm);
|
|
249
|
+
line-height: var(--bp-line-height-normal);
|
|
250
|
+
color: var(--bp-color-text-muted);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.number-input__message--error {
|
|
254
|
+
color: var(--bp-color-error);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.number-input__message--success {
|
|
258
|
+
color: var(--bp-color-success);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.number-input__message--warning {
|
|
262
|
+
color: var(--bp-color-warning);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* iOS zoom prevention: ensure 16px minimum on touch devices */
|
|
266
|
+
@media (max-width: 768px) {
|
|
267
|
+
.number-input--sm .number-input__input {
|
|
268
|
+
font-size: 16px;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
`;
|
|
272
|
+
var _ = Object.defineProperty, g = Object.getOwnPropertyDescriptor, n = (t, e, o, a) => {
|
|
273
|
+
for (var s = a > 1 ? void 0 : a ? g(e, o) : e, l = t.length - 1, b; l >= 0; l--)
|
|
274
|
+
(b = t[l]) && (s = (a ? b(e, o, s) : b(s)) || s);
|
|
275
|
+
return a && s && _(e, o, s), s;
|
|
276
|
+
};
|
|
277
|
+
let r = class extends m {
|
|
278
|
+
constructor() {
|
|
279
|
+
super(), this.value = null, this.min = void 0, this.max = void 0, this.step = 1, this.name = "", this.label = "", this.placeholder = "", this.disabled = !1, this.required = !1, this.readonly = !1, this.size = "md", this.variant = "default", this.message = "", this.precision = void 0, this.hideButtons = !1;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Check if decrement is allowed
|
|
283
|
+
*/
|
|
284
|
+
get canDecrement() {
|
|
285
|
+
return this.disabled || this.readonly ? !1 : this.value === null ? !0 : this.min !== void 0 ? this.value > this.min : !0;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Check if increment is allowed
|
|
289
|
+
*/
|
|
290
|
+
get canIncrement() {
|
|
291
|
+
return this.disabled || this.readonly ? !1 : this.value === null ? !0 : this.max !== void 0 ? this.value < this.max : !0;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Format value for display
|
|
295
|
+
*/
|
|
296
|
+
formatValue(t) {
|
|
297
|
+
return t === null ? "" : this.precision !== void 0 ? t.toFixed(this.precision) : String(t);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Clamp value to min/max range
|
|
301
|
+
*/
|
|
302
|
+
clampValue(t) {
|
|
303
|
+
let e = t;
|
|
304
|
+
return this.min !== void 0 && (e = Math.max(this.min, e)), this.max !== void 0 && (e = Math.min(this.max, e)), e;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Round value to step precision
|
|
308
|
+
*/
|
|
309
|
+
roundToStep(t) {
|
|
310
|
+
if (this.precision !== void 0) {
|
|
311
|
+
const a = Math.pow(10, this.precision);
|
|
312
|
+
return Math.round(t * a) / a;
|
|
313
|
+
}
|
|
314
|
+
const e = (String(this.step).split(".")[1] || "").length, o = Math.pow(10, e);
|
|
315
|
+
return Math.round(t * o) / o;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Update value and emit events
|
|
319
|
+
*/
|
|
320
|
+
updateValue(t, e = !0) {
|
|
321
|
+
const o = this.value;
|
|
322
|
+
t !== null && (t = this.clampValue(t), t = this.roundToStep(t)), t !== o && (this.value = t, this.dispatchEvent(
|
|
323
|
+
new CustomEvent("bp-input", {
|
|
324
|
+
detail: { value: this.value },
|
|
325
|
+
bubbles: !0,
|
|
326
|
+
composed: !0
|
|
327
|
+
})
|
|
328
|
+
), e && this.dispatchEvent(
|
|
329
|
+
new CustomEvent("bp-change", {
|
|
330
|
+
detail: { value: this.value },
|
|
331
|
+
bubbles: !0,
|
|
332
|
+
composed: !0
|
|
333
|
+
})
|
|
334
|
+
));
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Handle increment button click
|
|
338
|
+
*/
|
|
339
|
+
handleIncrement() {
|
|
340
|
+
if (!this.canIncrement) return;
|
|
341
|
+
const t = this.value ?? this.min ?? 0;
|
|
342
|
+
this.updateValue(t + this.step);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Handle decrement button click
|
|
346
|
+
*/
|
|
347
|
+
handleDecrement() {
|
|
348
|
+
if (!this.canDecrement) return;
|
|
349
|
+
const t = this.value ?? this.max ?? 0;
|
|
350
|
+
this.updateValue(t - this.step);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Handle direct input
|
|
354
|
+
*/
|
|
355
|
+
handleInput(t) {
|
|
356
|
+
const o = t.target.value.trim();
|
|
357
|
+
if (o === "") {
|
|
358
|
+
this.updateValue(null, !1);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const a = parseFloat(o);
|
|
362
|
+
isNaN(a) || (this.value = a, this.dispatchEvent(
|
|
363
|
+
new CustomEvent("bp-input", {
|
|
364
|
+
detail: { value: this.value },
|
|
365
|
+
bubbles: !0,
|
|
366
|
+
composed: !0
|
|
367
|
+
})
|
|
368
|
+
));
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Handle blur - validate and clamp
|
|
372
|
+
*/
|
|
373
|
+
handleBlur() {
|
|
374
|
+
if (this.value !== null) {
|
|
375
|
+
const t = this.clampValue(this.value), e = this.roundToStep(t);
|
|
376
|
+
e !== this.value && (this.value = e), this.inputElement && (this.inputElement.value = this.formatValue(this.value));
|
|
377
|
+
}
|
|
378
|
+
this.dispatchEvent(
|
|
379
|
+
new CustomEvent("bp-change", {
|
|
380
|
+
detail: { value: this.value },
|
|
381
|
+
bubbles: !0,
|
|
382
|
+
composed: !0
|
|
383
|
+
})
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Handle keyboard navigation
|
|
388
|
+
*/
|
|
389
|
+
handleKeyDown(t) {
|
|
390
|
+
if (!(this.disabled || this.readonly))
|
|
391
|
+
switch (t.key) {
|
|
392
|
+
case "ArrowUp":
|
|
393
|
+
t.preventDefault(), this.handleIncrement();
|
|
394
|
+
break;
|
|
395
|
+
case "ArrowDown":
|
|
396
|
+
t.preventDefault(), this.handleDecrement();
|
|
397
|
+
break;
|
|
398
|
+
case "PageUp":
|
|
399
|
+
if (t.preventDefault(), this.canIncrement) {
|
|
400
|
+
const e = this.value ?? this.min ?? 0;
|
|
401
|
+
this.updateValue(e + this.step * 10);
|
|
402
|
+
}
|
|
403
|
+
break;
|
|
404
|
+
case "PageDown":
|
|
405
|
+
if (t.preventDefault(), this.canDecrement) {
|
|
406
|
+
const e = this.value ?? this.max ?? 0;
|
|
407
|
+
this.updateValue(e - this.step * 10);
|
|
408
|
+
}
|
|
409
|
+
break;
|
|
410
|
+
case "Home":
|
|
411
|
+
t.preventDefault(), this.min !== void 0 && this.updateValue(this.min);
|
|
412
|
+
break;
|
|
413
|
+
case "End":
|
|
414
|
+
t.preventDefault(), this.max !== void 0 && this.updateValue(this.max);
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
render() {
|
|
419
|
+
const t = {
|
|
420
|
+
"number-input": !0,
|
|
421
|
+
[`number-input--${this.size}`]: !0,
|
|
422
|
+
[`number-input--${this.variant}`]: !0,
|
|
423
|
+
"number-input--disabled": this.disabled,
|
|
424
|
+
"number-input--readonly": this.readonly,
|
|
425
|
+
"number-input--hide-buttons": this.hideButtons
|
|
426
|
+
}, e = {
|
|
427
|
+
"number-input__input": !0,
|
|
428
|
+
[`number-input__input--${this.variant}`]: !0
|
|
429
|
+
};
|
|
430
|
+
return p`
|
|
431
|
+
<div class=${c(t)}>
|
|
432
|
+
${this.label ? p`
|
|
433
|
+
<label class="number-input__label" part="label">
|
|
434
|
+
${this.label}
|
|
435
|
+
${this.required ? p`<span class="number-input__required">*</span>` : u}
|
|
436
|
+
</label>
|
|
437
|
+
` : u}
|
|
438
|
+
|
|
439
|
+
<div class="number-input__container">
|
|
440
|
+
${this.hideButtons ? u : p`
|
|
441
|
+
<button
|
|
442
|
+
type="button"
|
|
443
|
+
class="number-input__button number-input__button--decrement"
|
|
444
|
+
part="decrement"
|
|
445
|
+
tabindex="-1"
|
|
446
|
+
?disabled=${!this.canDecrement}
|
|
447
|
+
aria-label="Decrease value"
|
|
448
|
+
@click=${this.handleDecrement}
|
|
449
|
+
>
|
|
450
|
+
<span class="number-input__button-icon">−</span>
|
|
451
|
+
</button>
|
|
452
|
+
`}
|
|
453
|
+
|
|
454
|
+
<input
|
|
455
|
+
type="text"
|
|
456
|
+
inputmode="decimal"
|
|
457
|
+
class=${c(e)}
|
|
458
|
+
part="input"
|
|
459
|
+
.value=${this.formatValue(this.value)}
|
|
460
|
+
name=${this.name || u}
|
|
461
|
+
placeholder=${this.placeholder || u}
|
|
462
|
+
?disabled=${this.disabled}
|
|
463
|
+
?readonly=${this.readonly}
|
|
464
|
+
?required=${this.required}
|
|
465
|
+
aria-valuemin=${this.min ?? u}
|
|
466
|
+
aria-valuemax=${this.max ?? u}
|
|
467
|
+
aria-valuenow=${this.value ?? u}
|
|
468
|
+
aria-invalid=${this.variant === "error" ? "true" : u}
|
|
469
|
+
@input=${this.handleInput}
|
|
470
|
+
@blur=${this.handleBlur}
|
|
471
|
+
@keydown=${this.handleKeyDown}
|
|
472
|
+
/>
|
|
473
|
+
|
|
474
|
+
${this.hideButtons ? u : p`
|
|
475
|
+
<button
|
|
476
|
+
type="button"
|
|
477
|
+
class="number-input__button number-input__button--increment"
|
|
478
|
+
part="increment"
|
|
479
|
+
tabindex="-1"
|
|
480
|
+
?disabled=${!this.canIncrement}
|
|
481
|
+
aria-label="Increase value"
|
|
482
|
+
@click=${this.handleIncrement}
|
|
483
|
+
>
|
|
484
|
+
<span class="number-input__button-icon">+</span>
|
|
485
|
+
</button>
|
|
486
|
+
`}
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
${this.message ? p`
|
|
490
|
+
<div
|
|
491
|
+
class="number-input__message number-input__message--${this.variant}"
|
|
492
|
+
part="message"
|
|
493
|
+
>
|
|
494
|
+
${this.message}
|
|
495
|
+
</div>
|
|
496
|
+
` : u}
|
|
497
|
+
</div>
|
|
498
|
+
`;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
r.styles = [f];
|
|
502
|
+
n([
|
|
503
|
+
i({ type: Number })
|
|
504
|
+
], r.prototype, "value", 2);
|
|
505
|
+
n([
|
|
506
|
+
i({ type: Number })
|
|
507
|
+
], r.prototype, "min", 2);
|
|
508
|
+
n([
|
|
509
|
+
i({ type: Number })
|
|
510
|
+
], r.prototype, "max", 2);
|
|
511
|
+
n([
|
|
512
|
+
i({ type: Number })
|
|
513
|
+
], r.prototype, "step", 2);
|
|
514
|
+
n([
|
|
515
|
+
i({ type: String })
|
|
516
|
+
], r.prototype, "name", 2);
|
|
517
|
+
n([
|
|
518
|
+
i({ type: String })
|
|
519
|
+
], r.prototype, "label", 2);
|
|
520
|
+
n([
|
|
521
|
+
i({ type: String })
|
|
522
|
+
], r.prototype, "placeholder", 2);
|
|
523
|
+
n([
|
|
524
|
+
i({ type: Boolean, reflect: !0 })
|
|
525
|
+
], r.prototype, "disabled", 2);
|
|
526
|
+
n([
|
|
527
|
+
i({ type: Boolean, reflect: !0 })
|
|
528
|
+
], r.prototype, "required", 2);
|
|
529
|
+
n([
|
|
530
|
+
i({ type: Boolean, reflect: !0 })
|
|
531
|
+
], r.prototype, "readonly", 2);
|
|
532
|
+
n([
|
|
533
|
+
i({ type: String })
|
|
534
|
+
], r.prototype, "size", 2);
|
|
535
|
+
n([
|
|
536
|
+
i({ type: String })
|
|
537
|
+
], r.prototype, "variant", 2);
|
|
538
|
+
n([
|
|
539
|
+
i({ type: String })
|
|
540
|
+
], r.prototype, "message", 2);
|
|
541
|
+
n([
|
|
542
|
+
i({ type: Number })
|
|
543
|
+
], r.prototype, "precision", 2);
|
|
544
|
+
n([
|
|
545
|
+
i({ type: Boolean, attribute: "hide-buttons" })
|
|
546
|
+
], r.prototype, "hideButtons", 2);
|
|
547
|
+
n([
|
|
548
|
+
h("input")
|
|
549
|
+
], r.prototype, "inputElement", 2);
|
|
550
|
+
r = n([
|
|
551
|
+
v("bp-number-input")
|
|
552
|
+
], r);
|
|
553
|
+
export {
|
|
554
|
+
r as BpNumberInput
|
|
555
|
+
};
|
|
556
|
+
//# sourceMappingURL=number-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-input.js","sources":["../../source/components/number-input/number-input.style.ts","../../source/components/number-input/number-input.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const numberInputStyles = css`\n /* Base styles */\n :host {\n display: block;\n }\n\n .number-input {\n font-family: var(--bp-font-family);\n display: flex;\n flex-direction: column;\n gap: var(--bp-spacing-xs);\n }\n\n .number-input__label {\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 .number-input__required {\n color: var(--bp-color-error);\n margin-left: var(--bp-spacing-xs);\n }\n\n .number-input__container {\n display: flex;\n align-items: stretch;\n }\n\n .number-input__input {\n flex: 1;\n min-width: 0;\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 padding: var(--bp-spacing-sm) var(--bp-spacing-md);\n text-align: center;\n font-variant-numeric: tabular-nums;\n transition:\n border-color var(--bp-transition-fast),\n box-shadow var(--bp-transition-fast);\n }\n\n .number-input__input::placeholder {\n color: var(--bp-color-text-muted);\n opacity: var(--bp-opacity-subtle);\n }\n\n .number-input__input:hover:not(:disabled):not(:readonly) {\n border-color: var(--bp-color-border-strong);\n }\n\n .number-input__input:focus {\n outline: none;\n border-color: var(--bp-color-focus);\n box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-focus);\n }\n\n .number-input__input:focus-visible {\n outline: none;\n border-color: var(--bp-color-focus);\n box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-focus);\n }\n\n /* Button styling */\n .number-input__button {\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--bp-color-surface);\n border: var(--bp-border-width) solid var(--bp-color-border);\n color: var(--bp-color-text);\n cursor: pointer;\n transition:\n background-color var(--bp-transition-fast),\n border-color var(--bp-transition-fast);\n padding: 0;\n }\n\n .number-input__button:hover:not(:disabled) {\n background-color: var(--bp-color-surface-elevated);\n border-color: var(--bp-color-border-strong);\n }\n\n .number-input__button:active:not(:disabled) {\n background-color: var(--bp-color-surface-subdued);\n }\n\n .number-input__button:focus-visible {\n outline: var(--bp-focus-width) var(--bp-focus-style) var(--bp-color-focus);\n outline-offset: var(--bp-focus-offset);\n z-index: 1;\n }\n\n .number-input__button:disabled {\n opacity: var(--bp-opacity-disabled);\n background-color: var(--bp-color-surface-subdued);\n cursor: not-allowed;\n }\n\n .number-input__button--decrement {\n border-right: none;\n border-radius: var(--bp-border-radius-md) 0 0 var(--bp-border-radius-md);\n }\n\n .number-input__button--increment {\n border-left: none;\n border-radius: 0 var(--bp-border-radius-md) var(--bp-border-radius-md) 0;\n }\n\n .number-input__button-icon {\n font-size: var(--bp-font-size-lg);\n font-weight: var(--bp-font-weight-bold);\n line-height: 1;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n /* Input border radius adjustment when buttons visible */\n .number-input:not(.number-input--hide-buttons) .number-input__input {\n border-radius: 0;\n }\n\n .number-input--hide-buttons .number-input__input {\n border-radius: var(--bp-border-radius-md);\n }\n\n /* Size variants */\n .number-input--sm .number-input__input {\n font-size: var(--bp-font-size-sm);\n padding: var(--bp-spacing-xs) var(--bp-spacing-sm);\n }\n\n .number-input--sm .number-input__button {\n width: var(--bp-spacing-8);\n }\n\n .number-input--sm .number-input__button-icon {\n font-size: var(--bp-font-size-base);\n }\n\n .number-input--md .number-input__input {\n font-size: var(--bp-font-size-base);\n padding: var(--bp-spacing-sm) var(--bp-spacing-md);\n }\n\n .number-input--md .number-input__button {\n width: var(--bp-spacing-10);\n }\n\n .number-input--lg .number-input__input {\n font-size: var(--bp-font-size-lg);\n padding: var(--bp-spacing-md) var(--bp-spacing-lg);\n }\n\n .number-input--lg .number-input__button {\n width: var(--bp-spacing-12);\n }\n\n .number-input--lg .number-input__button-icon {\n font-size: var(--bp-font-size-xl);\n }\n\n /* Variant styles */\n .number-input__input--default {\n border-color: var(--bp-color-border);\n }\n\n .number-input__input--success {\n border-color: var(--bp-color-success);\n }\n\n .number-input__input--success:focus,\n .number-input__input--success:focus-visible {\n border-color: var(--bp-color-success);\n box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-success);\n }\n\n .number-input__input--error {\n border-color: var(--bp-color-error);\n }\n\n .number-input__input--error:focus,\n .number-input__input--error:focus-visible {\n border-color: var(--bp-color-error);\n box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-error);\n }\n\n .number-input__input--warning {\n border-color: var(--bp-color-warning);\n }\n\n .number-input__input--warning:focus,\n .number-input__input--warning:focus-visible {\n border-color: var(--bp-color-warning);\n box-shadow: 0 0 0 var(--bp-focus-width) var(--bp-color-warning);\n }\n\n /* Match button border color to input variant */\n .number-input--success .number-input__button {\n border-color: var(--bp-color-success);\n }\n\n .number-input--error .number-input__button {\n border-color: var(--bp-color-error);\n }\n\n .number-input--warning .number-input__button {\n border-color: var(--bp-color-warning);\n }\n\n /* States */\n .number-input--disabled {\n pointer-events: none;\n }\n\n .number-input--disabled .number-input__input {\n opacity: var(--bp-opacity-disabled);\n background-color: var(--bp-color-surface-subdued);\n cursor: not-allowed;\n }\n\n .number-input--disabled .number-input__label {\n opacity: var(--bp-opacity-disabled);\n }\n\n .number-input--readonly .number-input__input {\n background-color: var(--bp-color-surface-subdued);\n cursor: default;\n }\n\n .number-input--readonly .number-input__button {\n background-color: var(--bp-color-surface-subdued);\n pointer-events: none;\n }\n\n /* Message styles */\n .number-input__message {\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 .number-input__message--error {\n color: var(--bp-color-error);\n }\n\n .number-input__message--success {\n color: var(--bp-color-success);\n }\n\n .number-input__message--warning {\n color: var(--bp-color-warning);\n }\n\n /* iOS zoom prevention: ensure 16px minimum on touch devices */\n @media (max-width: 768px) {\n .number-input--sm .number-input__input {\n font-size: 16px;\n }\n }\n`;\n","import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { numberInputStyles } from './number-input.style.js';\n\n/**\n * Size variants for the number input\n */\nexport type NumberInputSize = 'sm' | 'md' | 'lg';\n\n/**\n * Validation variant for the number input\n */\nexport type NumberInputVariant = 'default' | 'success' | 'error' | 'warning';\n\n/**\n * A number input component with increment/decrement buttons.\n *\n * @element bp-number-input\n *\n * @fires bp-input - Fired when the value changes during input\n * @fires bp-change - Fired when the value changes (on blur or button click)\n *\n * @csspart input - The native input element\n * @csspart decrement - The decrement button\n * @csspart increment - The increment button\n * @csspart label - The label element\n * @csspart message - The help/error message element\n */\n@customElement('bp-number-input')\nexport class BpNumberInput extends LitElement {\n /**\n * Current value of the input\n */\n @property({ type: Number }) declare value: number | null;\n\n /**\n * Minimum allowed value\n */\n @property({ type: Number }) declare min: number | undefined;\n\n /**\n * Maximum allowed value\n */\n @property({ type: Number }) declare max: number | undefined;\n\n /**\n * Step increment for buttons and arrow keys\n */\n @property({ type: Number }) declare step: number;\n\n /**\n * Name attribute for form association\n */\n @property({ type: String }) declare name: string;\n\n /**\n * Label text for the input\n */\n @property({ type: String }) declare label: string;\n\n /**\n * Placeholder text when empty\n */\n @property({ type: String }) declare placeholder: string;\n\n /**\n * Whether the input is disabled\n */\n @property({ type: Boolean, reflect: true }) declare disabled: boolean;\n\n /**\n * Whether the input is required\n */\n @property({ type: Boolean, reflect: true }) declare required: boolean;\n\n /**\n * Whether the input is readonly\n */\n @property({ type: Boolean, reflect: true }) declare readonly: boolean;\n\n /**\n * Size variant\n */\n @property({ type: String }) declare size: NumberInputSize;\n\n /**\n * Validation variant\n */\n @property({ type: String }) declare variant: NumberInputVariant;\n\n /**\n * Help or error message to display\n */\n @property({ type: String }) declare message: string;\n\n /**\n * Number of decimal places to display\n */\n @property({ type: Number }) declare precision: number | undefined;\n\n /**\n * Hide the increment/decrement buttons\n */\n @property({ type: Boolean, attribute: 'hide-buttons' })\n declare hideButtons: boolean;\n\n @query('input') private inputElement!: HTMLInputElement;\n\n static styles = [numberInputStyles];\n\n constructor() {\n super();\n this.value = null;\n this.min = undefined;\n this.max = undefined;\n this.step = 1;\n this.name = '';\n this.label = '';\n this.placeholder = '';\n this.disabled = false;\n this.required = false;\n this.readonly = false;\n this.size = 'md';\n this.variant = 'default';\n this.message = '';\n this.precision = undefined;\n this.hideButtons = false;\n }\n\n /**\n * Check if decrement is allowed\n */\n private get canDecrement(): boolean {\n if (this.disabled || this.readonly) return false;\n if (this.value === null) return true;\n if (this.min !== undefined) return this.value > this.min;\n return true;\n }\n\n /**\n * Check if increment is allowed\n */\n private get canIncrement(): boolean {\n if (this.disabled || this.readonly) return false;\n if (this.value === null) return true;\n if (this.max !== undefined) return this.value < this.max;\n return true;\n }\n\n /**\n * Format value for display\n */\n private formatValue(value: number | null): string {\n if (value === null) return '';\n if (this.precision !== undefined) {\n return value.toFixed(this.precision);\n }\n return String(value);\n }\n\n /**\n * Clamp value to min/max range\n */\n private clampValue(value: number): number {\n let result = value;\n if (this.min !== undefined) result = Math.max(this.min, result);\n if (this.max !== undefined) result = Math.min(this.max, result);\n return result;\n }\n\n /**\n * Round value to step precision\n */\n private roundToStep(value: number): number {\n if (this.precision !== undefined) {\n const factor = Math.pow(10, this.precision);\n return Math.round(value * factor) / factor;\n }\n // Handle floating point precision for step\n const stepDecimals = (String(this.step).split('.')[1] || '').length;\n const factor = Math.pow(10, stepDecimals);\n return Math.round(value * factor) / factor;\n }\n\n /**\n * Update value and emit events\n */\n private updateValue(\n newValue: number | null,\n emitChange: boolean = true\n ): void {\n const oldValue = this.value;\n\n if (newValue !== null) {\n newValue = this.clampValue(newValue);\n newValue = this.roundToStep(newValue);\n }\n\n if (newValue !== oldValue) {\n this.value = newValue;\n\n this.dispatchEvent(\n new CustomEvent('bp-input', {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n })\n );\n\n if (emitChange) {\n this.dispatchEvent(\n new CustomEvent('bp-change', {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n })\n );\n }\n }\n }\n\n /**\n * Handle increment button click\n */\n private handleIncrement(): void {\n if (!this.canIncrement) return;\n const currentValue = this.value ?? this.min ?? 0;\n this.updateValue(currentValue + this.step);\n }\n\n /**\n * Handle decrement button click\n */\n private handleDecrement(): void {\n if (!this.canDecrement) return;\n const currentValue = this.value ?? this.max ?? 0;\n this.updateValue(currentValue - this.step);\n }\n\n /**\n * Handle direct input\n */\n private handleInput(event: Event): void {\n const input = event.target as HTMLInputElement;\n const inputValue = input.value.trim();\n\n if (inputValue === '') {\n this.updateValue(null, false);\n return;\n }\n\n const numValue = parseFloat(inputValue);\n if (!isNaN(numValue)) {\n // Don't clamp during input, only on blur\n this.value = numValue;\n this.dispatchEvent(\n new CustomEvent('bp-input', {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n })\n );\n }\n }\n\n /**\n * Handle blur - validate and clamp\n */\n private handleBlur(): void {\n if (this.value !== null) {\n const clampedValue = this.clampValue(this.value);\n const roundedValue = this.roundToStep(clampedValue);\n\n if (roundedValue !== this.value) {\n this.value = roundedValue;\n }\n\n // Update input display\n if (this.inputElement) {\n this.inputElement.value = this.formatValue(this.value);\n }\n }\n\n this.dispatchEvent(\n new CustomEvent('bp-change', {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /**\n * Handle keyboard navigation\n */\n private handleKeyDown(event: globalThis.KeyboardEvent): void {\n if (this.disabled || this.readonly) return;\n\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault();\n this.handleIncrement();\n break;\n case 'ArrowDown':\n event.preventDefault();\n this.handleDecrement();\n break;\n case 'PageUp':\n event.preventDefault();\n if (this.canIncrement) {\n const currentValue = this.value ?? this.min ?? 0;\n this.updateValue(currentValue + this.step * 10);\n }\n break;\n case 'PageDown':\n event.preventDefault();\n if (this.canDecrement) {\n const currentValue = this.value ?? this.max ?? 0;\n this.updateValue(currentValue - this.step * 10);\n }\n break;\n case 'Home':\n event.preventDefault();\n if (this.min !== undefined) {\n this.updateValue(this.min);\n }\n break;\n case 'End':\n event.preventDefault();\n if (this.max !== undefined) {\n this.updateValue(this.max);\n }\n break;\n }\n }\n\n render() {\n const wrapperClasses = {\n 'number-input': true,\n [`number-input--${this.size}`]: true,\n [`number-input--${this.variant}`]: true,\n 'number-input--disabled': this.disabled,\n 'number-input--readonly': this.readonly,\n 'number-input--hide-buttons': this.hideButtons,\n };\n\n const inputClasses = {\n 'number-input__input': true,\n [`number-input__input--${this.variant}`]: true,\n };\n\n return html`\n <div class=${classMap(wrapperClasses)}>\n ${this.label\n ? html`\n <label class=\"number-input__label\" part=\"label\">\n ${this.label}\n ${this.required\n ? html`<span class=\"number-input__required\">*</span>`\n : nothing}\n </label>\n `\n : nothing}\n\n <div class=\"number-input__container\">\n ${!this.hideButtons\n ? html`\n <button\n type=\"button\"\n class=\"number-input__button number-input__button--decrement\"\n part=\"decrement\"\n tabindex=\"-1\"\n ?disabled=${!this.canDecrement}\n aria-label=\"Decrease value\"\n @click=${this.handleDecrement}\n >\n <span class=\"number-input__button-icon\">−</span>\n </button>\n `\n : nothing}\n\n <input\n type=\"text\"\n inputmode=\"decimal\"\n class=${classMap(inputClasses)}\n part=\"input\"\n .value=${this.formatValue(this.value)}\n name=${this.name || nothing}\n placeholder=${this.placeholder || nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-valuemin=${this.min ?? nothing}\n aria-valuemax=${this.max ?? nothing}\n aria-valuenow=${this.value ?? nothing}\n aria-invalid=${this.variant === 'error' ? 'true' : nothing}\n @input=${this.handleInput}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeyDown}\n />\n\n ${!this.hideButtons\n ? html`\n <button\n type=\"button\"\n class=\"number-input__button number-input__button--increment\"\n part=\"increment\"\n tabindex=\"-1\"\n ?disabled=${!this.canIncrement}\n aria-label=\"Increase value\"\n @click=${this.handleIncrement}\n >\n <span class=\"number-input__button-icon\">+</span>\n </button>\n `\n : nothing}\n </div>\n\n ${this.message\n ? html`\n <div\n class=\"number-input__message number-input__message--${this\n .variant}\"\n part=\"message\"\n >\n ${this.message}\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'bp-number-input': BpNumberInput;\n }\n}\n"],"names":["numberInputStyles","css","BpNumberInput","LitElement","value","result","factor","stepDecimals","newValue","emitChange","oldValue","currentValue","event","inputValue","numValue","clampedValue","roundedValue","wrapperClasses","inputClasses","html","classMap","nothing","__decorateClass","property","query","customElement"],"mappings":";;;AAEO,MAAMA,IAAoBC;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;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;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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