@vialiq/web-components 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,637 @@
1
+ import { unsafeCSS, css, html } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { F as FocusableMixin } from '../focusable-mixin-CmxOyPX5.js';
4
+ import { V as ValidityMixin } from '../validity-mixin-BjmXwgWk.js';
5
+ import { V as ViElement } from '../vi-element-C6GfDPs3.js';
6
+ import { classMap } from 'lit/directives/class-map.js';
7
+
8
+ const checkboxStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.checkbox-wrapper{display:inline-flex;align-items:flex-start;gap:var(--vi-checkbox-label-gap, 8px);cursor:pointer;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-checkbox-label-font-size, var(--vi-font-size-base, 16px));line-height:var(--vi-line-height-normal, 1.5);color:var(--vi-checkbox-label-color, var(--vi-color-foreground, #111827));position:relative;-webkit-user-select:none;user-select:none;align-items:center}.checkbox-input{position:absolute!important;clip-path:inset(50%)!important;overflow:hidden!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;border:0!important;white-space:nowrap!important}.checkbox-box{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:var(--vi-checkbox-size, 18px);height:var(--vi-checkbox-size, 18px);border:var(--vi-border-width-base, 2px) solid var(--vi-checkbox-border-color, var(--vi-border-04, #bdbdbd));border-radius:var(--vi-checkbox-border-radius, 3px);background-color:var(--vi-checkbox-background-color, var(--vi-color-background, #ffffff));transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;flex-shrink:0}.checkbox-check{width:100%;height:100%;fill:none;stroke:var(--vi-checkbox-check-color, #ffffff);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.check-mark,.check-dash{opacity:0;transform:scale(0);transform-origin:center;transition:transform .15s cubic-bezier(.4,0,.2,1),opacity .15s ease}.checkbox-input:checked:not(:indeterminate)~.checkbox-box{border-color:var(--vi-checkbox-border-color-checked, var(--vi-color-primary, #3676d0));background-color:var(--vi-checkbox-background-checked, var(--vi-color-primary, #3676d0))}.checkbox-input:checked:not(:indeterminate)~.checkbox-box .check-mark{opacity:1;transform:scale(1)}.checkbox-input:indeterminate~.checkbox-box,.checkbox-input.checkbox-input--indeterminate~.checkbox-box{border-color:var(--vi-checkbox-border-color-checked, var(--vi-color-primary, #3676d0));background-color:var(--vi-checkbox-background-checked, var(--vi-color-primary, #3676d0))}.checkbox-input:indeterminate~.checkbox-box .check-dash,.checkbox-input.checkbox-input--indeterminate~.checkbox-box .check-dash{opacity:1;transform:scale(1)}.checkbox-input:focus-visible~.checkbox-box{outline:var(--vi-border-width-base, 2px) solid var(--vi-checkbox-focus-ring-color, var(--vi-color-primary, #3676d0));outline-offset:2px;box-shadow:0 0 0 3px var(--vi-checkbox-focus-ring-glow, var(--vi-color-blue-200, #cee6ff))}.checkbox-wrapper:hover:not(.checkbox-wrapper--disabled) .checkbox-box{border-color:var(--vi-checkbox-border-color-hover, var(--vi-border-inverse-03, #757575))}.checkbox-wrapper:hover:not(.checkbox-wrapper--disabled) .checkbox-input:checked:not(:indeterminate)~.checkbox-box{border-color:var(--vi-checkbox-border-color-checked-hover, var(--vi-color-primary, #3676d0))}.checkbox-wrapper:hover:not(.checkbox-wrapper--disabled) .checkbox-input:indeterminate~.checkbox-box,.checkbox-wrapper:hover:not(.checkbox-wrapper--disabled) .checkbox-input.checkbox-input--indeterminate~.checkbox-box{border-color:var(--vi-checkbox-border-color-checked-hover, var(--vi-color-primary, #3676d0))}.checkbox-wrapper--disabled{cursor:not-allowed;opacity:var(--vi-checkbox-disabled-opacity, .5)}.checkbox-wrapper--disabled .checkbox-box{background-color:var(--vi-layer-disabled, #f3f4f6);border-color:var(--vi-border-03, #e0e0e0)}.checkbox-wrapper--disabled .checkbox-check{stroke:var(--vi-text-inverse, #ffffff)}.checkbox-wrapper--disabled .checkbox-input:checked~.checkbox-box,.checkbox-wrapper--disabled .checkbox-input:indeterminate~.checkbox-box,.checkbox-wrapper--disabled .checkbox-input.checkbox-input--indeterminate~.checkbox-box{background-color:var(--vi-text-disabled, #9e9e9e);border-color:var(--vi-text-disabled, #9e9e9e)}@media(prefers-reduced-motion:reduce){.checkbox-box,.check-mark,.check-dash{transition:none}}}:host{display:inline-block;outline:none}:host([disabled]){cursor:not-allowed;pointer-events:none}::slotted(*){font-family:inherit;font-size:inherit;color:inherit}:host([status=invalid]){--vi-checkbox-border-color: var(--vi-color-error, #ef4444);--vi-checkbox-border-color-hover: var(--vi-color-error, #ef4444);--vi-checkbox-border-color-checked: var(--vi-color-error, #ef4444);--vi-checkbox-border-color-checked-hover: var(--vi-color-error, #ef4444);--vi-checkbox-background-checked: var(--vi-color-error, #ef4444);--vi-checkbox-focus-ring-color: var(--vi-color-error, #ef4444);--vi-checkbox-focus-ring-glow: var(--vi-color-red-100, #ffccce);--vi-checkbox-label-color: var(--vi-color-error, #ef4444)}:host([status=valid]){--vi-checkbox-border-color: var(--vi-color-success, #489167);--vi-checkbox-border-color-hover: var(--vi-color-success, #489167);--vi-checkbox-border-color-checked: var(--vi-color-success, #489167);--vi-checkbox-border-color-checked-hover: var(--vi-color-success, #489167);--vi-checkbox-background-checked: var(--vi-color-success, #489167);--vi-checkbox-focus-ring-color: var(--vi-color-success, #489167);--vi-checkbox-focus-ring-glow: var(--vi-color-green-100, #e6f0eb)}:host([size=xs]){--vi-checkbox-size: 12px;--vi-checkbox-border-radius: 2px;--vi-checkbox-label-gap: 4px;--vi-checkbox-label-font-size: var(--vi-font-size-xs, 12px)}:host([size=sm]){--vi-checkbox-size: 14px;--vi-checkbox-border-radius: 2px;--vi-checkbox-label-gap: 6px;--vi-checkbox-label-font-size: var(--vi-font-size-sm, 14px)}:host([size=lg]){--vi-checkbox-size: 22px;--vi-checkbox-border-radius: 4px;--vi-checkbox-label-gap: 10px;--vi-checkbox-label-font-size: var(--vi-font-size-lg, 18px)}";
9
+
10
+ function applyDecs2203RFactory() {
11
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
12
+ return function addInitializer(initializer) {
13
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
14
+ assertCallable(initializer, "An initializer");
15
+ initializers.push(initializer);
16
+ };
17
+ }
18
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
19
+ var kindStr;
20
+ switch(kind){
21
+ case 1:
22
+ kindStr = "accessor";
23
+ break;
24
+ case 2:
25
+ kindStr = "method";
26
+ break;
27
+ case 3:
28
+ kindStr = "getter";
29
+ break;
30
+ case 4:
31
+ kindStr = "setter";
32
+ break;
33
+ default:
34
+ kindStr = "field";
35
+ }
36
+ var ctx = {
37
+ kind: kindStr,
38
+ name: isPrivate ? "#" + name : name,
39
+ static: isStatic,
40
+ private: isPrivate,
41
+ metadata: metadata
42
+ };
43
+ var decoratorFinishedRef = {
44
+ v: false
45
+ };
46
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
47
+ var get, set;
48
+ if (kind === 0) {
49
+ if (isPrivate) {
50
+ get = desc.get;
51
+ set = desc.set;
52
+ } else {
53
+ get = function() {
54
+ return this[name];
55
+ };
56
+ set = function(v) {
57
+ this[name] = v;
58
+ };
59
+ }
60
+ } else if (kind === 2) {
61
+ get = function() {
62
+ return desc.value;
63
+ };
64
+ } else {
65
+ if (kind === 1 || kind === 3) {
66
+ get = function() {
67
+ return desc.get.call(this);
68
+ };
69
+ }
70
+ if (kind === 1 || kind === 4) {
71
+ set = function(v) {
72
+ desc.set.call(this, v);
73
+ };
74
+ }
75
+ }
76
+ ctx.access = get && set ? {
77
+ get: get,
78
+ set: set
79
+ } : get ? {
80
+ get: get
81
+ } : {
82
+ set: set
83
+ };
84
+ try {
85
+ return dec(value, ctx);
86
+ } finally{
87
+ decoratorFinishedRef.v = true;
88
+ }
89
+ }
90
+ function assertNotFinished(decoratorFinishedRef, fnName) {
91
+ if (decoratorFinishedRef.v) {
92
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
93
+ }
94
+ }
95
+ function assertCallable(fn, hint) {
96
+ if (typeof fn !== "function") {
97
+ throw new TypeError(hint + " must be a function");
98
+ }
99
+ }
100
+ function assertValidReturnValue(kind, value) {
101
+ var type = typeof value;
102
+ if (kind === 1) {
103
+ if (type !== "object" || value === null) {
104
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
105
+ }
106
+ if (value.get !== undefined) {
107
+ assertCallable(value.get, "accessor.get");
108
+ }
109
+ if (value.set !== undefined) {
110
+ assertCallable(value.set, "accessor.set");
111
+ }
112
+ if (value.init !== undefined) {
113
+ assertCallable(value.init, "accessor.init");
114
+ }
115
+ } else if (type !== "function") {
116
+ var hint;
117
+ if (kind === 0) {
118
+ hint = "field";
119
+ } else if (kind === 10) {
120
+ hint = "class";
121
+ } else {
122
+ hint = "method";
123
+ }
124
+ throw new TypeError(hint + " decorators must return a function or void 0");
125
+ }
126
+ }
127
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
128
+ var decs = decInfo[0];
129
+ var desc, init, value;
130
+ if (isPrivate) {
131
+ if (kind === 0 || kind === 1) {
132
+ desc = {
133
+ get: decInfo[3],
134
+ set: decInfo[4]
135
+ };
136
+ } else if (kind === 3) {
137
+ desc = {
138
+ get: decInfo[3]
139
+ };
140
+ } else if (kind === 4) {
141
+ desc = {
142
+ set: decInfo[3]
143
+ };
144
+ } else {
145
+ desc = {
146
+ value: decInfo[3]
147
+ };
148
+ }
149
+ } else if (kind !== 0) {
150
+ desc = Object.getOwnPropertyDescriptor(base, name);
151
+ }
152
+ if (kind === 1) {
153
+ value = {
154
+ get: desc.get,
155
+ set: desc.set
156
+ };
157
+ } else if (kind === 2) {
158
+ value = desc.value;
159
+ } else if (kind === 3) {
160
+ value = desc.get;
161
+ } else if (kind === 4) {
162
+ value = desc.set;
163
+ }
164
+ var newValue, get, set;
165
+ if (typeof decs === "function") {
166
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
167
+ if (newValue !== void 0) {
168
+ assertValidReturnValue(kind, newValue);
169
+ if (kind === 0) {
170
+ init = newValue;
171
+ } else if (kind === 1) {
172
+ init = newValue.init;
173
+ get = newValue.get || value.get;
174
+ set = newValue.set || value.set;
175
+ value = {
176
+ get: get,
177
+ set: set
178
+ };
179
+ } else {
180
+ value = newValue;
181
+ }
182
+ }
183
+ } else {
184
+ for(var i = decs.length - 1; i >= 0; i--){
185
+ var dec = decs[i];
186
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
187
+ if (newValue !== void 0) {
188
+ assertValidReturnValue(kind, newValue);
189
+ var newInit;
190
+ if (kind === 0) {
191
+ newInit = newValue;
192
+ } else if (kind === 1) {
193
+ newInit = newValue.init;
194
+ get = newValue.get || value.get;
195
+ set = newValue.set || value.set;
196
+ value = {
197
+ get: get,
198
+ set: set
199
+ };
200
+ } else {
201
+ value = newValue;
202
+ }
203
+ if (newInit !== void 0) {
204
+ if (init === void 0) {
205
+ init = newInit;
206
+ } else if (typeof init === "function") {
207
+ init = [
208
+ init,
209
+ newInit
210
+ ];
211
+ } else {
212
+ init.push(newInit);
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ if (kind === 0 || kind === 1) {
219
+ if (init === void 0) {
220
+ init = function(instance, init) {
221
+ return init;
222
+ };
223
+ } else if (typeof init !== "function") {
224
+ var ownInitializers = init;
225
+ init = function(instance, init) {
226
+ var value = init;
227
+ for(var i = 0; i < ownInitializers.length; i++){
228
+ value = ownInitializers[i].call(instance, value);
229
+ }
230
+ return value;
231
+ };
232
+ } else {
233
+ var originalInitializer = init;
234
+ init = function(instance, init) {
235
+ return originalInitializer.call(instance, init);
236
+ };
237
+ }
238
+ ret.push(init);
239
+ }
240
+ if (kind !== 0) {
241
+ if (kind === 1) {
242
+ desc.get = value.get;
243
+ desc.set = value.set;
244
+ } else if (kind === 2) {
245
+ desc.value = value;
246
+ } else if (kind === 3) {
247
+ desc.get = value;
248
+ } else if (kind === 4) {
249
+ desc.set = value;
250
+ }
251
+ if (isPrivate) {
252
+ if (kind === 1) {
253
+ ret.push(function(instance, args) {
254
+ return value.get.call(instance, args);
255
+ });
256
+ ret.push(function(instance, args) {
257
+ return value.set.call(instance, args);
258
+ });
259
+ } else if (kind === 2) {
260
+ ret.push(value);
261
+ } else {
262
+ ret.push(function(instance, args) {
263
+ return value.call(instance, args);
264
+ });
265
+ }
266
+ } else {
267
+ Object.defineProperty(base, name, desc);
268
+ }
269
+ }
270
+ }
271
+ function applyMemberDecs(Class, decInfos, metadata) {
272
+ var ret = [];
273
+ var protoInitializers;
274
+ var staticInitializers;
275
+ var existingProtoNonFields = new Map();
276
+ var existingStaticNonFields = new Map();
277
+ for(var i = 0; i < decInfos.length; i++){
278
+ var decInfo = decInfos[i];
279
+ if (!Array.isArray(decInfo)) continue;
280
+ var kind = decInfo[1];
281
+ var name = decInfo[2];
282
+ var isPrivate = decInfo.length > 3;
283
+ var isStatic = kind >= 5;
284
+ var base;
285
+ var initializers;
286
+ if (isStatic) {
287
+ base = Class;
288
+ kind = kind - 5;
289
+ staticInitializers = staticInitializers || [];
290
+ initializers = staticInitializers;
291
+ } else {
292
+ base = Class.prototype;
293
+ protoInitializers = protoInitializers || [];
294
+ initializers = protoInitializers;
295
+ }
296
+ if (kind !== 0 && !isPrivate) {
297
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
298
+ var existingKind = existingNonFields.get(name) || 0;
299
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
300
+ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
301
+ } else if (!existingKind && kind > 2) {
302
+ existingNonFields.set(name, kind);
303
+ } else {
304
+ existingNonFields.set(name, true);
305
+ }
306
+ }
307
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
308
+ }
309
+ pushInitializers(ret, protoInitializers);
310
+ pushInitializers(ret, staticInitializers);
311
+ return ret;
312
+ }
313
+ function pushInitializers(ret, initializers) {
314
+ if (initializers) {
315
+ ret.push(function(instance) {
316
+ for(var i = 0; i < initializers.length; i++){
317
+ initializers[i].call(instance);
318
+ }
319
+ return instance;
320
+ });
321
+ }
322
+ }
323
+ function applyClassDecs(targetClass, classDecs, metadata) {
324
+ if (classDecs.length > 0) {
325
+ var initializers = [];
326
+ var newClass = targetClass;
327
+ var name = targetClass.name;
328
+ for(var i = classDecs.length - 1; i >= 0; i--){
329
+ var decoratorFinishedRef = {
330
+ v: false
331
+ };
332
+ try {
333
+ var nextNewClass = classDecs[i](newClass, {
334
+ kind: "class",
335
+ name: name,
336
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
337
+ metadata
338
+ });
339
+ } finally{
340
+ decoratorFinishedRef.v = true;
341
+ }
342
+ if (nextNewClass !== undefined) {
343
+ assertValidReturnValue(10, nextNewClass);
344
+ newClass = nextNewClass;
345
+ }
346
+ }
347
+ return [
348
+ defineMetadata(newClass, metadata),
349
+ function() {
350
+ for(var i = 0; i < initializers.length; i++){
351
+ initializers[i].call(newClass);
352
+ }
353
+ }
354
+ ];
355
+ }
356
+ }
357
+ function defineMetadata(Class, metadata) {
358
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
359
+ configurable: true,
360
+ enumerable: true,
361
+ value: metadata
362
+ });
363
+ }
364
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
365
+ if (parentClass !== void 0) {
366
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
367
+ }
368
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
369
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
370
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
371
+ return {
372
+ e: e,
373
+ get c () {
374
+ return applyClassDecs(targetClass, classDecs, metadata);
375
+ }
376
+ };
377
+ };
378
+ }
379
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
380
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
381
+ }
382
+ function _identity(x) {
383
+ return x;
384
+ }
385
+ var _dec, _initClass, _ValidityMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, // ── ValidityMixin contract ───────────────────────────────────────────────
386
+ _init_status, _init_required, _init_validityMessage, // ── Public API ────────────────────────────────────────────────────────────
387
+ /** Checked state. */ _init_checked, /** Indeterminate (partial) state. */ _init_indeterminate, /** Size scale — controls size, padding, and font-size. */ _init_size, /** Form submission value when checked. */ _init_value, /** Form field name. */ _init_name, /** Disables the checkbox. */ _init_disabled, _initProto;
388
+ let _ViCheckbox;
389
+ _dec = customElement('vi-checkbox'), _dec1 = property({
390
+ reflect: true
391
+ }), _dec2 = property({
392
+ type: Boolean,
393
+ reflect: true
394
+ }), _dec3 = property(), _dec4 = property({
395
+ type: Boolean,
396
+ reflect: true
397
+ }), _dec5 = property({
398
+ type: Boolean,
399
+ reflect: true
400
+ }), _dec6 = property({
401
+ type: String,
402
+ reflect: true
403
+ }), _dec7 = property(), _dec8 = property(), _dec9 = property({
404
+ type: Boolean,
405
+ reflect: true
406
+ });
407
+ new class extends _identity {
408
+ constructor(){
409
+ super(_ViCheckbox), _initClass();
410
+ }
411
+ static{
412
+ class ViCheckbox extends (_ValidityMixin = ValidityMixin(FocusableMixin(ViElement))) {
413
+ static{
414
+ ({ e: [_init_status, _init_required, _init_validityMessage, _init_checked, _init_indeterminate, _init_size, _init_value, _init_name, _init_disabled, _initProto], c: [_ViCheckbox, _initClass] } = _apply_decs_2203_r(this, [
415
+ [
416
+ _dec1,
417
+ 1,
418
+ "status"
419
+ ],
420
+ [
421
+ _dec2,
422
+ 1,
423
+ "required"
424
+ ],
425
+ [
426
+ _dec3,
427
+ 1,
428
+ "validityMessage"
429
+ ],
430
+ [
431
+ _dec4,
432
+ 1,
433
+ "checked"
434
+ ],
435
+ [
436
+ _dec5,
437
+ 1,
438
+ "indeterminate"
439
+ ],
440
+ [
441
+ _dec6,
442
+ 1,
443
+ "size"
444
+ ],
445
+ [
446
+ _dec7,
447
+ 1,
448
+ "value"
449
+ ],
450
+ [
451
+ _dec8,
452
+ 1,
453
+ "name"
454
+ ],
455
+ [
456
+ _dec9,
457
+ 1,
458
+ "disabled"
459
+ ]
460
+ ], [
461
+ _dec
462
+ ], _ValidityMixin));
463
+ }
464
+ static formAssociated = true;
465
+ static styles = css`
466
+ ${unsafeCSS(checkboxStyles)}
467
+ `;
468
+ _internals = (_initProto(this), this.attachInternals());
469
+ _initialChecked = false;
470
+ get _focusableElement() {
471
+ return this.shadowRoot?.querySelector('input') ?? null;
472
+ }
473
+ #___private_status_1 = _init_status(this, 'default');
474
+ get status() {
475
+ return this.#___private_status_1;
476
+ }
477
+ set status(_v) {
478
+ this.#___private_status_1 = _v;
479
+ }
480
+ #___private_required_2 = _init_required(this, false);
481
+ get required() {
482
+ return this.#___private_required_2;
483
+ }
484
+ set required(_v) {
485
+ this.#___private_required_2 = _v;
486
+ }
487
+ #___private_validityMessage_3 = _init_validityMessage(this, '');
488
+ get validityMessage() {
489
+ return this.#___private_validityMessage_3;
490
+ }
491
+ set validityMessage(_v) {
492
+ this.#___private_validityMessage_3 = _v;
493
+ }
494
+ #___private_checked_4 = _init_checked(this, false);
495
+ get checked() {
496
+ return this.#___private_checked_4;
497
+ }
498
+ set checked(_v) {
499
+ this.#___private_checked_4 = _v;
500
+ }
501
+ #___private_indeterminate_5 = _init_indeterminate(this, false);
502
+ get indeterminate() {
503
+ return this.#___private_indeterminate_5;
504
+ }
505
+ set indeterminate(_v) {
506
+ this.#___private_indeterminate_5 = _v;
507
+ }
508
+ #___private_size_6 = _init_size(this, 'md');
509
+ get size() {
510
+ return this.#___private_size_6;
511
+ }
512
+ set size(_v) {
513
+ this.#___private_size_6 = _v;
514
+ }
515
+ #___private_value_7 = _init_value(this, 'on');
516
+ get value() {
517
+ return this.#___private_value_7;
518
+ }
519
+ set value(_v) {
520
+ this.#___private_value_7 = _v;
521
+ }
522
+ #___private_name_8 = _init_name(this, '');
523
+ get name() {
524
+ return this.#___private_name_8;
525
+ }
526
+ set name(_v) {
527
+ this.#___private_name_8 = _v;
528
+ }
529
+ #___private_disabled_9 = _init_disabled(this, false);
530
+ get disabled() {
531
+ return this.#___private_disabled_9;
532
+ }
533
+ set disabled(_v) {
534
+ this.#___private_disabled_9 = _v;
535
+ }
536
+ // ── ValidityMixin hook ───────────────────────────────────────────────────
537
+ _testValidity() {
538
+ if (this.required && !this.checked) {
539
+ this.validityMessage = 'Please check this box if you want to proceed.';
540
+ return {
541
+ valueMissing: true
542
+ };
543
+ }
544
+ return {};
545
+ }
546
+ // ── Lifecycle ──────────────────────────────────────────────────────────────
547
+ connectedCallback() {
548
+ super.connectedCallback();
549
+ this._initialChecked = this.hasAttribute('checked');
550
+ }
551
+ updated(changed) {
552
+ super.updated(changed);
553
+ // Sync form value for form submission participation
554
+ if (changed.has('checked') || changed.has('value')) {
555
+ this._internals.setFormValue(this.checked ? this.value : null);
556
+ }
557
+ // Centralize host focusability via FocusableMixin
558
+ if (changed.has('disabled')) {
559
+ this._setHostFocusable(!this.disabled);
560
+ }
561
+ // Sync inner input's tabindex with host's tabIndex (which is managed by FocusableMixin)
562
+ const input = this._focusableElement;
563
+ if (input && input.tabIndex !== this.tabIndex) {
564
+ input.tabIndex = this.tabIndex;
565
+ }
566
+ }
567
+ /** Resets value and validation state when the associated form resets. */ formResetCallback() {
568
+ this.checked = this._initialChecked;
569
+ this.indeterminate = false;
570
+ this.status = 'default';
571
+ this.validityMessage = '';
572
+ }
573
+ /** Keeps disabled in sync when a containing fieldset or form is disabled. */ formDisabledCallback(disabled) {
574
+ this.disabled = disabled;
575
+ }
576
+ // ── Event Handlers ─────────────────────────────────────────────────────────
577
+ _onChange(e) {
578
+ e.stopPropagation();
579
+ if (this.disabled) return;
580
+ const input = e.target;
581
+ this.checked = input.checked;
582
+ this.indeterminate = input.indeterminate;
583
+ this.dispatchEvent(new CustomEvent('vialiq-change', {
584
+ detail: {
585
+ checked: this.checked,
586
+ value: this.value
587
+ },
588
+ bubbles: true,
589
+ composed: true
590
+ }));
591
+ }
592
+ // ── Render ─────────────────────────────────────────────────────────────────
593
+ render() {
594
+ const isValDisabled = this.disabled;
595
+ const inputClasses = classMap({
596
+ 'checkbox-input': true,
597
+ 'sr-only': true,
598
+ 'checkbox-input--indeterminate': this.indeterminate
599
+ });
600
+ const wrapperClasses = classMap({
601
+ 'checkbox-wrapper': true,
602
+ 'checkbox-wrapper--disabled': isValDisabled
603
+ });
604
+ return html`
605
+ <label class=${wrapperClasses}>
606
+ <input
607
+ type="checkbox"
608
+ class=${inputClasses}
609
+ .name=${this.name}
610
+ .value=${this.value}
611
+ ?checked=${this.checked}
612
+ .indeterminate=${this.indeterminate}
613
+ ?disabled=${isValDisabled}
614
+ ?required=${this.required}
615
+ aria-required=${this.required ? 'true' : 'false'}
616
+ aria-checked=${this.indeterminate ? 'mixed' : this.checked ? 'true' : 'false'}
617
+ @change=${this._onChange}
618
+ />
619
+ <span part="box" class="checkbox-box" aria-hidden="true">
620
+ <svg part="check" class="checkbox-check" viewBox="0 0 12 12">
621
+ <!-- Checkmark path shown when checked -->
622
+ <polyline class="check-mark" points="2,6 5,9 10,3"/>
623
+ <!-- Dash shown when indeterminate -->
624
+ <line class="check-dash" x1="2" y1="6" x2="10" y2="6"/>
625
+ </svg>
626
+ </span>
627
+ <span part="label" class="checkbox-label">
628
+ <slot></slot>
629
+ </span>
630
+ </label>
631
+ `;
632
+ }
633
+ }
634
+ }
635
+ }();
636
+
637
+ export { _ViCheckbox as ViCheckbox };
package/index.d.ts CHANGED
@@ -4,11 +4,16 @@ export type { ControlStatus } from './base/validity-mixin.js';
4
4
  export { ViButton } from './button/vi-button.js';
5
5
  export type { ButtonVariant, ButtonSize, ButtonIconPlacement } from './button/vi-button.js';
6
6
  export { ViInput } from './input/vi-input.js';
7
- export type { InputType } from './input/vi-input.js';
7
+ export type { InputType, InputSize } from './input/vi-input.js';
8
8
  export { ViIcon } from './icons/vi-icon.js';
9
9
  export { registerIcons, getIcon } from './icons/registry.js';
10
10
  export type { SvgIconDef } from './icons/registry.js';
11
11
  export { ViRadio } from './radio/vi-radio.js';
12
+ export type { RadioSize } from './radio/vi-radio.js';
12
13
  export { ViRadioGroup } from './radio/vi-radio-group.js';
13
14
  export type { RadioGroupOrientation } from './radio/vi-radio-group.js';
15
+ export { ViCheckbox } from './checkbox/vi-checkbox.js';
16
+ export type { CheckboxSize } from './checkbox/vi-checkbox.js';
17
+ export { ViTooltip } from './tooltip/vi-tooltip.js';
18
+ export type { TooltipPlacement, TooltipTrigger } from './tooltip/vi-tooltip.js';
14
19
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -5,3 +5,5 @@ export { ViIcon } from './icons/vi-icon.js';
5
5
  export { getIcon, registerIcons } from './icons/registry.js';
6
6
  export { ViRadio } from './radio/vi-radio.js';
7
7
  export { ViRadioGroup } from './radio/vi-radio-group.js';
8
+ export { ViCheckbox } from './checkbox/vi-checkbox.js';
9
+ export { ViTooltip } from './tooltip/vi-tooltip.js';
package/input/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { ViInput } from './vi-input.js';
2
- export type { InputType } from './vi-input.js';
2
+ export type { InputType, InputSize } from './vi-input.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}