@vialiq/web-components 0.20.0 → 0.22.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/README.md +126 -0
- package/base/controllers/floating-controller.d.ts +2 -2
- package/base/controllers/floating-controller.d.ts.map +1 -1
- package/base/flatpickr-mixin.d.ts +38 -0
- package/base/flatpickr-mixin.d.ts.map +1 -0
- package/base/validity-mixin.d.ts +2 -0
- package/base/validity-mixin.d.ts.map +1 -1
- package/date-picker/i18n.d.ts +19 -0
- package/date-picker/i18n.d.ts.map +1 -0
- package/date-picker/index.d.ts +4 -0
- package/date-picker/index.d.ts.map +1 -0
- package/date-picker/index.js +2 -0
- package/date-picker/iso-week.d.ts +18 -0
- package/date-picker/iso-week.d.ts.map +1 -0
- package/date-picker/locale-registry.d.ts +8 -0
- package/date-picker/locale-registry.d.ts.map +1 -0
- package/date-picker/plugin-registry.d.ts +7 -0
- package/date-picker/plugin-registry.d.ts.map +1 -0
- package/date-picker/plugin-utils.d.ts +10 -0
- package/date-picker/plugin-utils.d.ts.map +1 -0
- package/date-picker/plugins/vi-month-year-plugin.d.ts +17 -0
- package/date-picker/plugins/vi-month-year-plugin.d.ts.map +1 -0
- package/date-picker/plugins/vi-range-plugin.d.ts +12 -0
- package/date-picker/plugins/vi-range-plugin.d.ts.map +1 -0
- package/date-picker/plugins/vi-shadow-dom-plugin.d.ts +18 -0
- package/date-picker/plugins/vi-shadow-dom-plugin.d.ts.map +1 -0
- package/date-picker/types.d.ts +34 -0
- package/date-picker/types.d.ts.map +1 -0
- package/date-picker/vi-date-picker-input.d.ts +34 -0
- package/date-picker/vi-date-picker-input.d.ts.map +1 -0
- package/date-picker/vi-date-picker-input.js +599 -0
- package/date-picker/vi-date-picker.d.ts +95 -0
- package/date-picker/vi-date-picker.d.ts.map +1 -0
- package/date-picker/vi-date-picker.js +2273 -0
- package/index.d.ts +7 -0
- package/index.js +5 -0
- package/input/vi-input.js +1 -1
- package/{keyboard-controller-DqpJtUuK.js → keyboard-controller-D3htDhGR.js} +25 -23
- package/label/index.d.ts +2 -0
- package/label/index.d.ts.map +1 -0
- package/label/index.js +1 -0
- package/label/vi-label.d.ts +53 -0
- package/label/vi-label.d.ts.map +1 -0
- package/label/vi-label.js +552 -0
- package/package.json +32 -4
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { unsafeCSS, css, nothing, html } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { V as ViElement } from '../vi-element-C6GfDPs3.js';
|
|
5
|
+
|
|
6
|
+
const labelStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.vi-label{--vi-label-font-size: var(--vi-font-size-sm, var(--vi-font-size-sm, 14px));--vi-label-font-weight: var(--vi-font-weight-medium, var(--vi-font-weight-medium, 500));--vi-label-color: var(--vi-text-primary, var(--vi-text-primary, #111827));--vi-label-color-disabled: var(--vi-text-disabled, var(--vi-text-disabled, #9e9e9e));--vi-label-required-color: var(--vi-color-error, var(--vi-color-error, #ef4444));--vi-label-optional-color: var(--vi-text-helper, var(--vi-text-helper, #9e9e9e));--vi-label-gap: 4px}.vi-label{display:inline-flex;align-items:center;gap:var(--vi-label-gap);font-size:var(--vi-label-font-size);font-weight:var(--vi-label-font-weight);color:var(--vi-label-color);line-height:1.5;margin:0}.vi-label.size-sm{--vi-label-font-size: var(--vi-font-size-xs, var(--vi-font-size-xs, 12px))}.vi-label.size-lg{--vi-label-font-size: var(--vi-font-size-base, var(--vi-font-size-base, 16px))}.vi-label.is-disabled{color:var(--vi-label-color-disabled);cursor:default}.vi-label-required{color:var(--vi-label-required-color)}.vi-label-optional{color:var(--vi-label-optional-color);font-weight:400}}:host{vertical-align:middle}:host([layout=stacked]){display:block;margin-bottom:var(--vi-label-margin-bottom, 8px)}:host([layout=inline]){display:inline-flex;align-items:center;margin-right:var(--vi-label-margin-inline, 12px);margin-bottom:0}:host([type=primary]) .vi-label{--vi-label-color: var(--vi-color-text-primary, var(--vi-text-primary, #111827))}:host([type=secondary]) .vi-label{--vi-label-color: var(--vi-color-text-secondary, var(--vi-text-secondary, #4b5563))}";
|
|
7
|
+
|
|
8
|
+
function applyDecs2203RFactory() {
|
|
9
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
10
|
+
return function addInitializer(initializer) {
|
|
11
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
12
|
+
assertCallable(initializer, "An initializer");
|
|
13
|
+
initializers.push(initializer);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
17
|
+
var kindStr;
|
|
18
|
+
switch(kind){
|
|
19
|
+
case 1:
|
|
20
|
+
kindStr = "accessor";
|
|
21
|
+
break;
|
|
22
|
+
case 2:
|
|
23
|
+
kindStr = "method";
|
|
24
|
+
break;
|
|
25
|
+
case 3:
|
|
26
|
+
kindStr = "getter";
|
|
27
|
+
break;
|
|
28
|
+
case 4:
|
|
29
|
+
kindStr = "setter";
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
kindStr = "field";
|
|
33
|
+
}
|
|
34
|
+
var ctx = {
|
|
35
|
+
kind: kindStr,
|
|
36
|
+
name: isPrivate ? "#" + name : name,
|
|
37
|
+
static: isStatic,
|
|
38
|
+
private: isPrivate,
|
|
39
|
+
metadata: metadata
|
|
40
|
+
};
|
|
41
|
+
var decoratorFinishedRef = {
|
|
42
|
+
v: false
|
|
43
|
+
};
|
|
44
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
45
|
+
var get, set;
|
|
46
|
+
if (kind === 0) {
|
|
47
|
+
if (isPrivate) {
|
|
48
|
+
get = desc.get;
|
|
49
|
+
set = desc.set;
|
|
50
|
+
} else {
|
|
51
|
+
get = function() {
|
|
52
|
+
return this[name];
|
|
53
|
+
};
|
|
54
|
+
set = function(v) {
|
|
55
|
+
this[name] = v;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
} else if (kind === 2) {
|
|
59
|
+
get = function() {
|
|
60
|
+
return desc.value;
|
|
61
|
+
};
|
|
62
|
+
} else {
|
|
63
|
+
if (kind === 1 || kind === 3) {
|
|
64
|
+
get = function() {
|
|
65
|
+
return desc.get.call(this);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (kind === 1 || kind === 4) {
|
|
69
|
+
set = function(v) {
|
|
70
|
+
desc.set.call(this, v);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
ctx.access = get && set ? {
|
|
75
|
+
get: get,
|
|
76
|
+
set: set
|
|
77
|
+
} : get ? {
|
|
78
|
+
get: get
|
|
79
|
+
} : {
|
|
80
|
+
set: set
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
return dec(value, ctx);
|
|
84
|
+
} finally{
|
|
85
|
+
decoratorFinishedRef.v = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
89
|
+
if (decoratorFinishedRef.v) {
|
|
90
|
+
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function assertCallable(fn, hint) {
|
|
94
|
+
if (typeof fn !== "function") {
|
|
95
|
+
throw new TypeError(hint + " must be a function");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function assertValidReturnValue(kind, value) {
|
|
99
|
+
var type = typeof value;
|
|
100
|
+
if (kind === 1) {
|
|
101
|
+
if (type !== "object" || value === null) {
|
|
102
|
+
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
103
|
+
}
|
|
104
|
+
if (value.get !== undefined) {
|
|
105
|
+
assertCallable(value.get, "accessor.get");
|
|
106
|
+
}
|
|
107
|
+
if (value.set !== undefined) {
|
|
108
|
+
assertCallable(value.set, "accessor.set");
|
|
109
|
+
}
|
|
110
|
+
if (value.init !== undefined) {
|
|
111
|
+
assertCallable(value.init, "accessor.init");
|
|
112
|
+
}
|
|
113
|
+
} else if (type !== "function") {
|
|
114
|
+
var hint;
|
|
115
|
+
if (kind === 0) {
|
|
116
|
+
hint = "field";
|
|
117
|
+
} else if (kind === 10) {
|
|
118
|
+
hint = "class";
|
|
119
|
+
} else {
|
|
120
|
+
hint = "method";
|
|
121
|
+
}
|
|
122
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
126
|
+
var decs = decInfo[0];
|
|
127
|
+
var desc, init, value;
|
|
128
|
+
if (isPrivate) {
|
|
129
|
+
if (kind === 0 || kind === 1) {
|
|
130
|
+
desc = {
|
|
131
|
+
get: decInfo[3],
|
|
132
|
+
set: decInfo[4]
|
|
133
|
+
};
|
|
134
|
+
} else if (kind === 3) {
|
|
135
|
+
desc = {
|
|
136
|
+
get: decInfo[3]
|
|
137
|
+
};
|
|
138
|
+
} else if (kind === 4) {
|
|
139
|
+
desc = {
|
|
140
|
+
set: decInfo[3]
|
|
141
|
+
};
|
|
142
|
+
} else {
|
|
143
|
+
desc = {
|
|
144
|
+
value: decInfo[3]
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
} else if (kind !== 0) {
|
|
148
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
149
|
+
}
|
|
150
|
+
if (kind === 1) {
|
|
151
|
+
value = {
|
|
152
|
+
get: desc.get,
|
|
153
|
+
set: desc.set
|
|
154
|
+
};
|
|
155
|
+
} else if (kind === 2) {
|
|
156
|
+
value = desc.value;
|
|
157
|
+
} else if (kind === 3) {
|
|
158
|
+
value = desc.get;
|
|
159
|
+
} else if (kind === 4) {
|
|
160
|
+
value = desc.set;
|
|
161
|
+
}
|
|
162
|
+
var newValue, get, set;
|
|
163
|
+
if (typeof decs === "function") {
|
|
164
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
165
|
+
if (newValue !== void 0) {
|
|
166
|
+
assertValidReturnValue(kind, newValue);
|
|
167
|
+
if (kind === 0) {
|
|
168
|
+
init = newValue;
|
|
169
|
+
} else if (kind === 1) {
|
|
170
|
+
init = newValue.init;
|
|
171
|
+
get = newValue.get || value.get;
|
|
172
|
+
set = newValue.set || value.set;
|
|
173
|
+
value = {
|
|
174
|
+
get: get,
|
|
175
|
+
set: set
|
|
176
|
+
};
|
|
177
|
+
} else {
|
|
178
|
+
value = newValue;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
for(var i = decs.length - 1; i >= 0; i--){
|
|
183
|
+
var dec = decs[i];
|
|
184
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
185
|
+
if (newValue !== void 0) {
|
|
186
|
+
assertValidReturnValue(kind, newValue);
|
|
187
|
+
var newInit;
|
|
188
|
+
if (kind === 0) {
|
|
189
|
+
newInit = newValue;
|
|
190
|
+
} else if (kind === 1) {
|
|
191
|
+
newInit = newValue.init;
|
|
192
|
+
get = newValue.get || value.get;
|
|
193
|
+
set = newValue.set || value.set;
|
|
194
|
+
value = {
|
|
195
|
+
get: get,
|
|
196
|
+
set: set
|
|
197
|
+
};
|
|
198
|
+
} else {
|
|
199
|
+
value = newValue;
|
|
200
|
+
}
|
|
201
|
+
if (newInit !== void 0) {
|
|
202
|
+
if (init === void 0) {
|
|
203
|
+
init = newInit;
|
|
204
|
+
} else if (typeof init === "function") {
|
|
205
|
+
init = [
|
|
206
|
+
init,
|
|
207
|
+
newInit
|
|
208
|
+
];
|
|
209
|
+
} else {
|
|
210
|
+
init.push(newInit);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (kind === 0 || kind === 1) {
|
|
217
|
+
if (init === void 0) {
|
|
218
|
+
init = function(instance, init) {
|
|
219
|
+
return init;
|
|
220
|
+
};
|
|
221
|
+
} else if (typeof init !== "function") {
|
|
222
|
+
var ownInitializers = init;
|
|
223
|
+
init = function(instance, init) {
|
|
224
|
+
var value = init;
|
|
225
|
+
for(var i = 0; i < ownInitializers.length; i++){
|
|
226
|
+
value = ownInitializers[i].call(instance, value);
|
|
227
|
+
}
|
|
228
|
+
return value;
|
|
229
|
+
};
|
|
230
|
+
} else {
|
|
231
|
+
var originalInitializer = init;
|
|
232
|
+
init = function(instance, init) {
|
|
233
|
+
return originalInitializer.call(instance, init);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
ret.push(init);
|
|
237
|
+
}
|
|
238
|
+
if (kind !== 0) {
|
|
239
|
+
if (kind === 1) {
|
|
240
|
+
desc.get = value.get;
|
|
241
|
+
desc.set = value.set;
|
|
242
|
+
} else if (kind === 2) {
|
|
243
|
+
desc.value = value;
|
|
244
|
+
} else if (kind === 3) {
|
|
245
|
+
desc.get = value;
|
|
246
|
+
} else if (kind === 4) {
|
|
247
|
+
desc.set = value;
|
|
248
|
+
}
|
|
249
|
+
if (isPrivate) {
|
|
250
|
+
if (kind === 1) {
|
|
251
|
+
ret.push(function(instance, args) {
|
|
252
|
+
return value.get.call(instance, args);
|
|
253
|
+
});
|
|
254
|
+
ret.push(function(instance, args) {
|
|
255
|
+
return value.set.call(instance, args);
|
|
256
|
+
});
|
|
257
|
+
} else if (kind === 2) {
|
|
258
|
+
ret.push(value);
|
|
259
|
+
} else {
|
|
260
|
+
ret.push(function(instance, args) {
|
|
261
|
+
return value.call(instance, args);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
Object.defineProperty(base, name, desc);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
270
|
+
var ret = [];
|
|
271
|
+
var protoInitializers;
|
|
272
|
+
var staticInitializers;
|
|
273
|
+
var existingProtoNonFields = new Map();
|
|
274
|
+
var existingStaticNonFields = new Map();
|
|
275
|
+
for(var i = 0; i < decInfos.length; i++){
|
|
276
|
+
var decInfo = decInfos[i];
|
|
277
|
+
if (!Array.isArray(decInfo)) continue;
|
|
278
|
+
var kind = decInfo[1];
|
|
279
|
+
var name = decInfo[2];
|
|
280
|
+
var isPrivate = decInfo.length > 3;
|
|
281
|
+
var isStatic = kind >= 5;
|
|
282
|
+
var base;
|
|
283
|
+
var initializers;
|
|
284
|
+
if (isStatic) {
|
|
285
|
+
base = Class;
|
|
286
|
+
kind = kind - 5;
|
|
287
|
+
staticInitializers = staticInitializers || [];
|
|
288
|
+
initializers = staticInitializers;
|
|
289
|
+
} else {
|
|
290
|
+
base = Class.prototype;
|
|
291
|
+
protoInitializers = protoInitializers || [];
|
|
292
|
+
initializers = protoInitializers;
|
|
293
|
+
}
|
|
294
|
+
if (kind !== 0 && !isPrivate) {
|
|
295
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
296
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
297
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
298
|
+
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);
|
|
299
|
+
} else if (!existingKind && kind > 2) {
|
|
300
|
+
existingNonFields.set(name, kind);
|
|
301
|
+
} else {
|
|
302
|
+
existingNonFields.set(name, true);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
306
|
+
}
|
|
307
|
+
pushInitializers(ret, protoInitializers);
|
|
308
|
+
pushInitializers(ret, staticInitializers);
|
|
309
|
+
return ret;
|
|
310
|
+
}
|
|
311
|
+
function pushInitializers(ret, initializers) {
|
|
312
|
+
if (initializers) {
|
|
313
|
+
ret.push(function(instance) {
|
|
314
|
+
for(var i = 0; i < initializers.length; i++){
|
|
315
|
+
initializers[i].call(instance);
|
|
316
|
+
}
|
|
317
|
+
return instance;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
322
|
+
if (classDecs.length > 0) {
|
|
323
|
+
var initializers = [];
|
|
324
|
+
var newClass = targetClass;
|
|
325
|
+
var name = targetClass.name;
|
|
326
|
+
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
327
|
+
var decoratorFinishedRef = {
|
|
328
|
+
v: false
|
|
329
|
+
};
|
|
330
|
+
try {
|
|
331
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
332
|
+
kind: "class",
|
|
333
|
+
name: name,
|
|
334
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
335
|
+
metadata
|
|
336
|
+
});
|
|
337
|
+
} finally{
|
|
338
|
+
decoratorFinishedRef.v = true;
|
|
339
|
+
}
|
|
340
|
+
if (nextNewClass !== undefined) {
|
|
341
|
+
assertValidReturnValue(10, nextNewClass);
|
|
342
|
+
newClass = nextNewClass;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return [
|
|
346
|
+
defineMetadata(newClass, metadata),
|
|
347
|
+
function() {
|
|
348
|
+
for(var i = 0; i < initializers.length; i++){
|
|
349
|
+
initializers[i].call(newClass);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
];
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function defineMetadata(Class, metadata) {
|
|
356
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
357
|
+
configurable: true,
|
|
358
|
+
enumerable: true,
|
|
359
|
+
value: metadata
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
363
|
+
if (parentClass !== void 0) {
|
|
364
|
+
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
365
|
+
}
|
|
366
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
367
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
368
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
369
|
+
return {
|
|
370
|
+
e: e,
|
|
371
|
+
get c () {
|
|
372
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
378
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
379
|
+
}
|
|
380
|
+
function _identity(x) {
|
|
381
|
+
return x;
|
|
382
|
+
}
|
|
383
|
+
var _dec, _initClass, _ViElement, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, /** ID of the associated control */ _init_for, /** Show required `*` indicator */ _init_required, /** Show "(optional)" text */ _init_optional, /** Muted disabled styling */ _init_disabled, /** Font size variant */ _init_size, /** Layout spacing behavior */ _init_layout, /** Semantic text color */ _init_type, _initProto;
|
|
384
|
+
let _ViLabel;
|
|
385
|
+
_dec = customElement('vi-label'), _dec1 = property({
|
|
386
|
+
type: String
|
|
387
|
+
}), _dec2 = property({
|
|
388
|
+
type: Boolean
|
|
389
|
+
}), _dec3 = property({
|
|
390
|
+
type: Boolean
|
|
391
|
+
}), _dec4 = property({
|
|
392
|
+
type: Boolean,
|
|
393
|
+
reflect: true
|
|
394
|
+
}), _dec5 = property({
|
|
395
|
+
type: String
|
|
396
|
+
}), _dec6 = property({
|
|
397
|
+
type: String,
|
|
398
|
+
reflect: true
|
|
399
|
+
}), _dec7 = property({
|
|
400
|
+
type: String,
|
|
401
|
+
reflect: true
|
|
402
|
+
});
|
|
403
|
+
new class extends _identity {
|
|
404
|
+
constructor(){
|
|
405
|
+
super(_ViLabel), _initClass();
|
|
406
|
+
}
|
|
407
|
+
static{
|
|
408
|
+
class ViLabel extends (_ViElement = ViElement) {
|
|
409
|
+
static{
|
|
410
|
+
({ e: [_init_for, _init_required, _init_optional, _init_disabled, _init_size, _init_layout, _init_type, _initProto], c: [_ViLabel, _initClass] } = _apply_decs_2203_r(this, [
|
|
411
|
+
[
|
|
412
|
+
_dec1,
|
|
413
|
+
1,
|
|
414
|
+
"for"
|
|
415
|
+
],
|
|
416
|
+
[
|
|
417
|
+
_dec2,
|
|
418
|
+
1,
|
|
419
|
+
"required"
|
|
420
|
+
],
|
|
421
|
+
[
|
|
422
|
+
_dec3,
|
|
423
|
+
1,
|
|
424
|
+
"optional"
|
|
425
|
+
],
|
|
426
|
+
[
|
|
427
|
+
_dec4,
|
|
428
|
+
1,
|
|
429
|
+
"disabled"
|
|
430
|
+
],
|
|
431
|
+
[
|
|
432
|
+
_dec5,
|
|
433
|
+
1,
|
|
434
|
+
"size"
|
|
435
|
+
],
|
|
436
|
+
[
|
|
437
|
+
_dec6,
|
|
438
|
+
1,
|
|
439
|
+
"layout"
|
|
440
|
+
],
|
|
441
|
+
[
|
|
442
|
+
_dec7,
|
|
443
|
+
1,
|
|
444
|
+
"type"
|
|
445
|
+
]
|
|
446
|
+
], [
|
|
447
|
+
_dec
|
|
448
|
+
], _ViElement));
|
|
449
|
+
}
|
|
450
|
+
static styles = css`
|
|
451
|
+
${unsafeCSS(labelStyles)}
|
|
452
|
+
`;
|
|
453
|
+
#___private_for_1 = (_initProto(this), _init_for(this, ''));
|
|
454
|
+
get for() {
|
|
455
|
+
return this.#___private_for_1;
|
|
456
|
+
}
|
|
457
|
+
set for(_v) {
|
|
458
|
+
this.#___private_for_1 = _v;
|
|
459
|
+
}
|
|
460
|
+
#___private_required_2 = _init_required(this, false);
|
|
461
|
+
get required() {
|
|
462
|
+
return this.#___private_required_2;
|
|
463
|
+
}
|
|
464
|
+
set required(_v) {
|
|
465
|
+
this.#___private_required_2 = _v;
|
|
466
|
+
}
|
|
467
|
+
#___private_optional_3 = _init_optional(this, false);
|
|
468
|
+
get optional() {
|
|
469
|
+
return this.#___private_optional_3;
|
|
470
|
+
}
|
|
471
|
+
set optional(_v) {
|
|
472
|
+
this.#___private_optional_3 = _v;
|
|
473
|
+
}
|
|
474
|
+
#___private_disabled_4 = _init_disabled(this, false);
|
|
475
|
+
get disabled() {
|
|
476
|
+
return this.#___private_disabled_4;
|
|
477
|
+
}
|
|
478
|
+
set disabled(_v) {
|
|
479
|
+
this.#___private_disabled_4 = _v;
|
|
480
|
+
}
|
|
481
|
+
#___private_size_5 = _init_size(this, 'md');
|
|
482
|
+
get size() {
|
|
483
|
+
return this.#___private_size_5;
|
|
484
|
+
}
|
|
485
|
+
set size(_v) {
|
|
486
|
+
this.#___private_size_5 = _v;
|
|
487
|
+
}
|
|
488
|
+
#___private_layout_6 = _init_layout(this, 'stacked');
|
|
489
|
+
get layout() {
|
|
490
|
+
return this.#___private_layout_6;
|
|
491
|
+
}
|
|
492
|
+
set layout(_v) {
|
|
493
|
+
this.#___private_layout_6 = _v;
|
|
494
|
+
}
|
|
495
|
+
#___private_type_7 = _init_type(this, 'default');
|
|
496
|
+
get type() {
|
|
497
|
+
return this.#___private_type_7;
|
|
498
|
+
}
|
|
499
|
+
set type(_v) {
|
|
500
|
+
this.#___private_type_7 = _v;
|
|
501
|
+
}
|
|
502
|
+
_hasTooltip = false;
|
|
503
|
+
_handleSlotChange(e) {
|
|
504
|
+
const slot = e.target;
|
|
505
|
+
const nodes = slot.assignedNodes({
|
|
506
|
+
flatten: true
|
|
507
|
+
});
|
|
508
|
+
this._hasTooltip = nodes.some((node)=>node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && Boolean(node.textContent?.trim()));
|
|
509
|
+
this.requestUpdate();
|
|
510
|
+
}
|
|
511
|
+
_handleClick(e) {
|
|
512
|
+
if (this.disabled || !this.for) return;
|
|
513
|
+
e.preventDefault();
|
|
514
|
+
// Cross shadow boundary workaround
|
|
515
|
+
const rootNode = this.getRootNode();
|
|
516
|
+
const target = rootNode.getElementById(this.for);
|
|
517
|
+
if (target) {
|
|
518
|
+
target.focus();
|
|
519
|
+
if ('click' in target && typeof target.click === 'function') {
|
|
520
|
+
target.click();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
render() {
|
|
525
|
+
const classes = {
|
|
526
|
+
'vi-label': true,
|
|
527
|
+
[`size-${this.size}`]: true,
|
|
528
|
+
'is-disabled': this.disabled
|
|
529
|
+
};
|
|
530
|
+
return html`
|
|
531
|
+
<label part="label" class=${classMap(classes)} for=${this.for || nothing} @click=${this._handleClick}>
|
|
532
|
+
<slot></slot>
|
|
533
|
+
|
|
534
|
+
${this.required ? html`
|
|
535
|
+
<span part="required-indicator" class="vi-label-required" aria-hidden="true">*</span>
|
|
536
|
+
` : nothing}
|
|
537
|
+
|
|
538
|
+
${this.optional && !this.required ? html`
|
|
539
|
+
<span part="optional-indicator" class="vi-label-optional">(optional)</span>
|
|
540
|
+
` : nothing}
|
|
541
|
+
|
|
542
|
+
<span part="tooltip-trigger" style=${!this._hasTooltip ? 'display: none;' : nothing}>
|
|
543
|
+
<slot name="tooltip" @slotchange=${this._handleSlotChange}></slot>
|
|
544
|
+
</span>
|
|
545
|
+
</label>
|
|
546
|
+
`;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}();
|
|
551
|
+
|
|
552
|
+
export { _ViLabel as ViLabel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vialiq/web-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -99,12 +99,33 @@
|
|
|
99
99
|
"./accordion/vi-accordion-item": {
|
|
100
100
|
"types": "./accordion/vi-accordion-item.d.ts",
|
|
101
101
|
"default": "./accordion/vi-accordion-item.js"
|
|
102
|
+
},
|
|
103
|
+
"./date-picker": {
|
|
104
|
+
"types": "./date-picker/index.d.ts",
|
|
105
|
+
"default": "./date-picker/index.js"
|
|
106
|
+
},
|
|
107
|
+
"./date-picker/vi-date-picker": {
|
|
108
|
+
"types": "./date-picker/vi-date-picker.d.ts",
|
|
109
|
+
"default": "./date-picker/vi-date-picker.js"
|
|
110
|
+
},
|
|
111
|
+
"./date-picker/vi-date-picker-input": {
|
|
112
|
+
"types": "./date-picker/vi-date-picker-input.d.ts",
|
|
113
|
+
"default": "./date-picker/vi-date-picker-input.js"
|
|
114
|
+
},
|
|
115
|
+
"./label": {
|
|
116
|
+
"types": "./label/index.d.ts",
|
|
117
|
+
"default": "./label/index.js"
|
|
118
|
+
},
|
|
119
|
+
"./label/vi-label": {
|
|
120
|
+
"types": "./label/vi-label.d.ts",
|
|
121
|
+
"default": "./label/vi-label.js"
|
|
102
122
|
}
|
|
103
123
|
},
|
|
104
124
|
"peerDependencies": {
|
|
105
125
|
"@floating-ui/dom": ">=1.0.0",
|
|
106
|
-
"@vialiq/flux-ui": "^0.
|
|
107
|
-
"@vialiq/icons": "
|
|
126
|
+
"@vialiq/flux-ui": "^0.18.0",
|
|
127
|
+
"@vialiq/icons": "^0.4.1",
|
|
128
|
+
"flatpickr": ">=4.6.0",
|
|
108
129
|
"lit": "^3.0.0"
|
|
109
130
|
},
|
|
110
131
|
"keywords": [
|
|
@@ -126,6 +147,13 @@
|
|
|
126
147
|
"checkbox/",
|
|
127
148
|
"tooltip/",
|
|
128
149
|
"badge/",
|
|
150
|
+
"date-picker/",
|
|
151
|
+
"label/",
|
|
129
152
|
"README.md"
|
|
130
|
-
]
|
|
153
|
+
],
|
|
154
|
+
"peerDependenciesMeta": {
|
|
155
|
+
"flatpickr": {
|
|
156
|
+
"optional": false
|
|
157
|
+
}
|
|
158
|
+
}
|
|
131
159
|
}
|