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