@vialiq/web-components 0.4.0 → 0.6.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,47 @@
1
+ import { type PropertyValues, type TemplateResult } from 'lit';
2
+ import { ViElement } from '../base/vi-element.js';
3
+ export type RadioSize = 'xs' | 'sm' | 'md' | 'lg';
4
+ declare const ViRadio_base: typeof ViElement & (new (...args: any[]) => import("../base/focusable-mixin.js").FocusableInterface);
5
+ /**
6
+ * vi-radio
7
+ * Individual radio option within a vi-radio-group.
8
+ *
9
+ * NOTE: For correct roving tabindex, form submission, and mutual exclusivity,
10
+ * vi-radio should be used inside a vi-radio-group. Standalone usage is supported (e.g. for
11
+ * custom layout structures), but keyboard navigation and form association must be handled manually.
12
+ *
13
+ * @element vi-radio
14
+ * @slot - Label text/content.
15
+ *
16
+ * @csspart circle - The visual outer circle wrapper.
17
+ * @csspart dot - The visual inner dot indicator.
18
+ * @csspart label - The label text span.
19
+ */
20
+ export declare class ViRadio extends ViRadio_base {
21
+ static styles: import("lit").CSSResult;
22
+ protected get _focusableElement(): HTMLInputElement | null;
23
+ /** The value this radio represents. */
24
+ accessor value: string;
25
+ /** Selected state (managed by vi-radio-group). */
26
+ accessor checked: boolean;
27
+ /** Disabled state. */
28
+ accessor disabled: boolean;
29
+ /** Shared name for the radio group (synced by parent). */
30
+ accessor name: string;
31
+ /** Size scale. */
32
+ accessor size: RadioSize;
33
+ private get _group();
34
+ /** Computes the effective disabled state based on local state and parent group state. */
35
+ private get _isEffectiveDisabled();
36
+ updated(changed: PropertyValues): void;
37
+ protected _setHostFocusable(enabled: boolean): void;
38
+ private _onChange;
39
+ render(): TemplateResult;
40
+ }
41
+ declare global {
42
+ interface HTMLElementTagNameMap {
43
+ 'vi-radio': ViRadio;
44
+ }
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=vi-radio.d.ts.map
@@ -0,0 +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;IAErE,sBAAsB;IACsB,QAAQ,CAAC,QAAQ,UAAS;IAEtE,0DAA0D;IAC9B,QAAQ,CAAC,IAAI,SAAM;IAE/C,kBAAkB;IACyB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAQ;IAE3E,OAAO,KAAK,MAAM,GAEjB;IAED,yFAAyF;IACzF,OAAO,KAAK,oBAAoB,GAE/B;IAEQ,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;cAe5B,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQ5D,OAAO,CAAC,SAAS;IAaR,MAAM,IAAI,cAAc;CAwBlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
@@ -0,0 +1,538 @@
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 ViElement } from '../vi-element-C6GfDPs3.js';
5
+
6
+ const radioStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.radio-group{border:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--vi-radio-group-spacing-field-gap, var(--vi-spacing-xs, 8px));width:100%}.radio-group-legend{font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-radio-group-label-font-size, var(--vi-font-size-base, 16px));font-weight:var(--vi-font-weight-semibold, 600);color:var(--vi-radio-group-label-color, var(--vi-color-foreground, #111827));padding:0;margin:0;margin-block-end:var(--vi-radio-group-legend-margin-bottom, var(--vi-spacing-xs, 8px))}.radio-group-items{display:flex;gap:var(--vi-radio-group-gap, 8px)}.radio-group-items[orientation=vertical]{flex-direction:column}.radio-group-items[orientation=horizontal]{flex-direction:row;flex-wrap:wrap;gap:var(--vi-radio-group-gap-horizontal, 24px)}.radio-group-helper{display:block;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-radio-group-helper-font-size, var(--vi-font-size-xs, 12px));color:var(--vi-radio-group-helper-color, var(--vi-text-helper, #9e9e9e))}.radio-group-validation{display:block;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-radio-group-validation-font-size, var(--vi-font-size-xs, 12px));color:var(--vi-radio-group-validation-color, var(--vi-text-helper, #9e9e9e));margin-block-start:var(--vi-radio-group-validation-margin-top, var(--vi-spacing-xs, 8px))}.radio-group-validation.radio-group-validation--invalid{color:var(--vi-radio-group-error-color, var(--vi-color-error, #ef4444))}.radio-group-validation.radio-group-validation--valid{color:var(--vi-radio-group-success-color, var(--vi-color-success, #489167))}.radio-wrapper{display:inline-flex;align-items:center;gap:var(--vi-radio-label-gap, 8px);cursor:pointer;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-radio-label-font-size, var(--vi-font-size-base, 16px));line-height:var(--vi-line-height-normal, 1.5);color:var(--vi-radio-label-color, var(--vi-color-foreground, #111827));position:relative;-webkit-user-select:none;user-select:none}.radio-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}.radio-circle{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:var(--vi-radio-size, 18px);height:var(--vi-radio-size, 18px);border:var(--vi-border-width-base, 2px) solid var(--vi-radio-border-color, var(--vi-border-04, #bdbdbd));border-radius:50%;background-color:var(--vi-radio-background-color, var(--vi-color-background, #ffffff));transition:border-color .15s ease,box-shadow .15s ease;flex-shrink:0}.radio-dot{box-sizing:border-box;width:var(--vi-radio-dot-size, 8px);height:var(--vi-radio-dot-size, 8px);border-radius:50%;background-color:var(--vi-radio-dot-color, var(--vi-color-primary, #3676d0));transform:scale(0);opacity:0;transition:transform .15s cubic-bezier(.4,0,.2,1),opacity .15s ease}.radio-input:checked+.radio-circle{border-color:var(--vi-radio-border-color-checked, var(--vi-color-primary, #3676d0))}.radio-input:checked+.radio-circle .radio-dot{transform:scale(1);opacity:1}.radio-input:focus-visible+.radio-circle{outline:var(--vi-border-width-base, 2px) solid var(--vi-radio-focus-ring-color, var(--vi-color-primary, #3676d0));outline-offset:2px;box-shadow:0 0 0 3px var(--vi-radio-focus-ring-glow, var(--vi-color-blue-200, #cee6ff))}.radio-wrapper:hover:not(.radio-wrapper--disabled) .radio-circle{border-color:var(--vi-radio-border-color-hover, var(--vi-border-inverse-03, #757575))}.radio-wrapper:hover:not(.radio-wrapper--disabled) .radio-input:checked+.radio-circle{border-color:var(--vi-radio-border-color-checked-hover, var(--vi-color-primary, #3676d0))}.radio-wrapper--disabled{cursor:not-allowed;opacity:var(--vi-radio-disabled-opacity, .5)}.radio-wrapper--disabled .radio-circle{background-color:var(--vi-layer-disabled, #f3f4f6);border-color:var(--vi-border-02, #eeeeee)}.radio-wrapper--disabled .radio-dot{background-color:var(--vi-text-disabled, #9e9e9e)}@media(prefers-reduced-motion:reduce){.radio-circle,.radio-dot{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=xs]){--vi-radio-size: 12px;--vi-radio-dot-size: 5px;--vi-radio-label-gap: 4px;--vi-radio-label-font-size: var(--vi-font-size-xs, 12px)}:host([size=sm]){--vi-radio-size: 14px;--vi-radio-dot-size: 6px;--vi-radio-label-gap: 6px;--vi-radio-label-font-size: var(--vi-font-size-sm, 14px)}:host([size=lg]){--vi-radio-size: 22px;--vi-radio-dot-size: 10px;--vi-radio-label-gap: 10px;--vi-radio-label-font-size: var(--vi-font-size-lg, 18px)}";
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, _FocusableMixin, _dec1, _dec2, _dec3, _dec4, _dec5, /** The value this radio represents. */ _init_value, /** Selected state (managed by vi-radio-group). */ _init_checked, /** Disabled state. */ _init_disabled, /** Shared name for the radio group (synced by parent). */ _init_name, /** Size scale. */ _init_size, _initProto;
384
+ let _ViRadio;
385
+ _dec = customElement('vi-radio'), _dec1 = property({
386
+ type: String
387
+ }), _dec2 = property({
388
+ type: Boolean,
389
+ reflect: true
390
+ }), _dec3 = property({
391
+ type: Boolean,
392
+ reflect: true
393
+ }), _dec4 = property({
394
+ type: String
395
+ }), _dec5 = property({
396
+ type: String,
397
+ reflect: true
398
+ });
399
+ new class extends _identity {
400
+ constructor(){
401
+ super(_ViRadio), _initClass();
402
+ }
403
+ static{
404
+ class ViRadio extends (_FocusableMixin = FocusableMixin(ViElement)) {
405
+ static{
406
+ ({ e: [_init_value, _init_checked, _init_disabled, _init_name, _init_size, _initProto], c: [_ViRadio, _initClass] } = _apply_decs_2203_r(this, [
407
+ [
408
+ _dec1,
409
+ 1,
410
+ "value"
411
+ ],
412
+ [
413
+ _dec2,
414
+ 1,
415
+ "checked"
416
+ ],
417
+ [
418
+ _dec3,
419
+ 1,
420
+ "disabled"
421
+ ],
422
+ [
423
+ _dec4,
424
+ 1,
425
+ "name"
426
+ ],
427
+ [
428
+ _dec5,
429
+ 1,
430
+ "size"
431
+ ]
432
+ ], [
433
+ _dec
434
+ ], _FocusableMixin));
435
+ }
436
+ static styles = css`
437
+ ${unsafeCSS(radioStyles)}
438
+ `;
439
+ get _focusableElement() {
440
+ return this.shadowRoot?.querySelector('input') ?? null;
441
+ }
442
+ #___private_value_1 = (_initProto(this), _init_value(this, ''));
443
+ get value() {
444
+ return this.#___private_value_1;
445
+ }
446
+ set value(_v) {
447
+ this.#___private_value_1 = _v;
448
+ }
449
+ #___private_checked_2 = _init_checked(this, false);
450
+ get checked() {
451
+ return this.#___private_checked_2;
452
+ }
453
+ set checked(_v) {
454
+ this.#___private_checked_2 = _v;
455
+ }
456
+ #___private_disabled_3 = _init_disabled(this, false);
457
+ get disabled() {
458
+ return this.#___private_disabled_3;
459
+ }
460
+ set disabled(_v) {
461
+ this.#___private_disabled_3 = _v;
462
+ }
463
+ #___private_name_4 = _init_name(this, '');
464
+ get name() {
465
+ return this.#___private_name_4;
466
+ }
467
+ set name(_v) {
468
+ this.#___private_name_4 = _v;
469
+ }
470
+ #___private_size_5 = _init_size(this, 'md');
471
+ get size() {
472
+ return this.#___private_size_5;
473
+ }
474
+ set size(_v) {
475
+ this.#___private_size_5 = _v;
476
+ }
477
+ get _group() {
478
+ return this.closest('vi-radio-group');
479
+ }
480
+ /** Computes the effective disabled state based on local state and parent group state. */ get _isEffectiveDisabled() {
481
+ return this.disabled || (this._group?.disabled ?? false);
482
+ }
483
+ updated(changed) {
484
+ super.updated(changed);
485
+ // If standalone, sync the host focusability with disabled state changes
486
+ if (!this._group && changed.has('disabled')) {
487
+ this._setHostFocusable(!this.disabled);
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
+ }
495
+ _setHostFocusable(enabled) {
496
+ if (this._group) {
497
+ // No-op: parent vi-radio-group manages host's tabIndex for roving tabindex compliance
498
+ return;
499
+ }
500
+ super._setHostFocusable(enabled);
501
+ }
502
+ _onChange(e) {
503
+ e.stopPropagation();
504
+ if (this._isEffectiveDisabled) return;
505
+ this.checked = true;
506
+ this.dispatchEvent(new CustomEvent('vi-radio-checked', {
507
+ bubbles: true,
508
+ composed: true
509
+ }));
510
+ }
511
+ render() {
512
+ const isValDisabled = this._isEffectiveDisabled;
513
+ return html`
514
+ <label class="radio-wrapper ${isValDisabled ? 'radio-wrapper--disabled' : ''}">
515
+ <input
516
+ type="radio"
517
+ class="radio-input"
518
+ tabindex="0"
519
+ .name=${this.name}
520
+ .value=${this.value}
521
+ .checked=${this.checked}
522
+ ?disabled=${isValDisabled}
523
+ @change=${this._onChange}
524
+ />
525
+ <span part="circle" class="radio-circle" aria-hidden="true">
526
+ <span part="dot" class="radio-dot"></span>
527
+ </span>
528
+ <span part="label" class="radio-label">
529
+ <slot></slot>
530
+ </span>
531
+ </label>
532
+ `;
533
+ }
534
+ }
535
+ }
536
+ }();
537
+
538
+ export { _ViRadio as ViRadio };
@@ -0,0 +1,3 @@
1
+ export { ViTooltip } from './vi-tooltip.js';
2
+ export type { TooltipPlacement, TooltipTrigger } from './vi-tooltip.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ export { ViTooltip } from './vi-tooltip.js';
@@ -0,0 +1,84 @@
1
+ import { type PropertyValues, type TemplateResult } from 'lit';
2
+ import { ViElement } from '../base/vi-element.js';
3
+ import { type ComputePositionConfig } from '@floating-ui/dom';
4
+ export type TooltipPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'right';
5
+ export type TooltipTrigger = 'hover focus' | 'hover' | 'focus' | 'click';
6
+ /**
7
+ * vi-tooltip
8
+ * A floating hint providing supplementary info on hover or focus using Floating UI.
9
+ *
10
+ * @element vi-tooltip
11
+ * @attr content - Plain text tooltip content
12
+ * @attr placement - Preferred position: top | top-start | top-end | bottom | bottom-start | bottom-end | left | right (default: top)
13
+ * @attr trigger - Events that trigger: hover focus | hover | focus | click (default: hover focus)
14
+ * @attr delay - Show delay in ms (default: 500)
15
+ * @attr hide-delay - Hide delay in ms (default: 100)
16
+ * @attr max-width - Max width of tooltip in px (default: 240)
17
+ * @attr disabled - Suppress display of tooltip
18
+ * @attr popper-options - Custom options passed directly to Floating UI's computePosition.
19
+ *
20
+ * @slot - Trigger element
21
+ * @slot content - Rich/interactive tooltip content
22
+ *
23
+ * @csspart tooltip - Floating tooltip panel
24
+ * @csspart content - Tooltip content container
25
+ * @csspart arrow - Arrow pointer
26
+ */
27
+ export declare class ViTooltip extends ViElement {
28
+ static styles: import("lit").CSSResult;
29
+ accessor content: string;
30
+ accessor placement: TooltipPlacement;
31
+ accessor trigger: TooltipTrigger;
32
+ accessor delay: number;
33
+ accessor hideDelay: number;
34
+ accessor maxWidth: number;
35
+ accessor disabled: boolean;
36
+ /**
37
+ * Custom options passed directly to Floating UI's computePosition.
38
+ * Note: the `popper-options` attribute only supports JSON-serializable values;
39
+ * middleware functions must be set via the `popperOptions` property.
40
+ */
41
+ accessor popperOptions: Partial<ComputePositionConfig>;
42
+ private accessor _open;
43
+ private accessor _isInteractive;
44
+ private accessor _tooltipPanel;
45
+ private accessor _defaultSlot;
46
+ private accessor _contentSlot;
47
+ private _showTimeout?;
48
+ private _hideTimeout?;
49
+ private _triggerElement;
50
+ private _cleanupAutoUpdate?;
51
+ private _panelId;
52
+ constructor();
53
+ connectedCallback(): void;
54
+ disconnectedCallback(): void;
55
+ protected firstUpdated(): void;
56
+ updated(changed: PropertyValues): void;
57
+ /** Force show the tooltip */
58
+ show(): void;
59
+ /** Force hide the tooltip */
60
+ hide(immediate?: boolean): void;
61
+ private _openTooltip;
62
+ private _closeTooltip;
63
+ private _clearTimeouts;
64
+ private _handleSlotChange;
65
+ private _updateTriggerElement;
66
+ private _hasInteractiveContent;
67
+ private _updateTriggerAria;
68
+ private _removeTriggerAria;
69
+ private _onPointerEnter;
70
+ private _onPointerLeave;
71
+ private _onFocusIn;
72
+ private _onFocusOut;
73
+ private _onClick;
74
+ private _onKeyDown;
75
+ private _handleDocumentClick;
76
+ private _positionTooltip;
77
+ render(): TemplateResult;
78
+ }
79
+ declare global {
80
+ interface HTMLElementTagNameMap {
81
+ 'vi-tooltip': ViTooltip;
82
+ }
83
+ }
84
+ //# sourceMappingURL=vi-tooltip.d.ts.map