@vialiq/web-components 0.23.0 → 0.25.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 CHANGED
@@ -298,6 +298,79 @@ vi-input {
298
298
 
299
299
  ---
300
300
 
301
+ ### Label ([vi-label](./src/label/vi-label.ts))
302
+
303
+ The [ViLabel](./src/label/vi-label.ts) is a styled `<label>` component for associating visible text with form controls. It supports required/optional indicators and inline help tooltips. Because it uses Shadow DOM, it automatically maps click and focus events to target controls and manages `aria-labelledby` across the Shadow boundary for accessibility.
304
+
305
+ #### Properties & Attributes
306
+
307
+ | Attribute | Property | Type | Default | Description |
308
+ | :--------- | :--------- | :--------------------------------- | :---------- | :----------------------------------------- |
309
+ | `for` | `for` | `string` | `''` | ID of the target control to focus/click. |
310
+ | `required` | `required` | `boolean` | `false` | Shows a `*` indicator. |
311
+ | `optional` | `optional` | `boolean` | `false` | Shows "(optional)" text. |
312
+ | `disabled` | `disabled` | `boolean` | `false` | Muted disabled styling. |
313
+ | `size` | `size` | `'sm'\|'md'\|'lg'` | `'md'` | Font size variant. |
314
+ | `layout` | `layout` | `'stacked'\|'inline'` | `'stacked'` | Controls margin and inline-flex spacing. |
315
+ | `type` | `type` | `'default'\|'primary'\|'secondary'`| `'default'` | Semantic text color for emphasis. |
316
+
317
+ #### Slots
318
+
319
+ - **Default Slot**: Label text content.
320
+ - **`tooltip` Slot**: Optional icon/element that triggers an inline tooltip (renders to the right of the label text).
321
+
322
+ #### CSS Shadow Parts
323
+
324
+ Since `vi-label` uses Shadow DOM, you can override its internal styles using CSS shadow parts (`::part`):
325
+
326
+ ```css
327
+ vi-label::part(label) {
328
+ --vi-label-font-size: var(--vi-font-size-sm);
329
+ --vi-label-font-weight: var(--vi-font-weight-medium);
330
+ --vi-label-color: var(--vi-text-primary);
331
+ /* Other styles... */
332
+ }
333
+
334
+ vi-label::part(required-indicator) {
335
+ color: red;
336
+ }
337
+ ```
338
+
339
+ The available parts are:
340
+ - `label`: The internal `<label>` container.
341
+ - `required-indicator`: The `*` span.
342
+ - `optional-indicator`: The `(optional)` span.
343
+ - `tooltip-trigger`: The wrapper around the tooltip slot.
344
+
345
+ #### Snippets
346
+
347
+ **Basic Standard Usage:**
348
+ ```html
349
+ <vi-label for="first-name" required>First Name</vi-label>
350
+ <vi-input id="first-name" name="firstName"></vi-input>
351
+ ```
352
+
353
+ **Optional & Inline:**
354
+ ```html
355
+ <div style="display: flex; align-items: center;">
356
+ <vi-label for="promo-code" layout="inline" optional>Promo Code</vi-label>
357
+ <vi-input id="promo-code" name="promoCode"></vi-input>
358
+ </div>
359
+ ```
360
+
361
+ **With Semantic Type and Tooltip:**
362
+ ```html
363
+ <vi-label for="cvv-input" type="primary">
364
+ Card Security Code
365
+ <vi-tooltip slot="tooltip" content="3 digits on back of card">
366
+ <vi-icon name="info-circle"></vi-icon>
367
+ </vi-tooltip>
368
+ </vi-label>
369
+ <vi-input id="cvv-input" type="password"></vi-input>
370
+ ```
371
+
372
+ ---
373
+
301
374
  ### Select ([vi-select](./src/select/vi-select.ts))
302
375
 
303
376
  > [!NOTE]
@@ -1141,6 +1214,66 @@ The `<vi-switch>` component is a form-associated toggle switch used for boolean
1141
1214
 
1142
1215
  ---
1143
1216
 
1217
+ ### Tabs ([vi-tabs](./src/tabs/vi-tabs.ts))
1218
+
1219
+ The Tabs component is a composite of `<vi-tabs>`, `<vi-tab>`, and `<vi-tab-panel>` used to organize content into separate views where only one view is visible at a time. It follows the WAI-ARIA tabs pattern and includes robust support for responsive overflow, dynamic closable tabs, and advanced layout variants.
1220
+
1221
+ #### Properties & Attributes
1222
+
1223
+ | Attribute | Property | Type | Default | Description |
1224
+ | :----------- | :--------- | :----------------------------------- | :------------- | :----------------------------------------------------- |
1225
+ | `active` | `active` | `string` | `''` | The `tab-id` of the currently active tab. |
1226
+ | `orientation`| `orientation` | `'horizontal'\|'vertical'` | `'horizontal'` | The layout direction of the tablist. |
1227
+ | `variant` | `variant` | `'line'\|'pill'\|'card'\|'enclosed'` | `'line'` | Visual design variant of the tabs. |
1228
+ | `overflow` | `overflow` | `'scroll'\|'menu'\|'wrap'` | `'scroll'` | Defines behavior when tabs exceed container width. |
1229
+
1230
+ #### Events & Architecture Note
1231
+
1232
+ Tabs use a mutually exclusive state (only one can be active at a time). Because of this, tabs are **"activated"** rather than "opened". There is no `vi-tab-before-open` event; instead, you intercept the activation of a tab at the container level using `vi-tabs-before-change`.
1233
+
1234
+ If you need to prevent a user from switching to a specific tab (e.g., due to unsaved changes or missing permissions), simply call `e.preventDefault()` on the `vi-tabs-before-change` event:
1235
+
1236
+ ```javascript
1237
+ tabs.addEventListener('vi-tabs-before-change', (e) => {
1238
+ if (e.detail.toTabId === 'restricted-tab' && !userHasAccess) {
1239
+ e.preventDefault(); // Stops the tab from "opening"
1240
+ alert('You do not have access to this tab!');
1241
+ }
1242
+ });
1243
+ ```
1244
+
1245
+ For more detailed documentation, including slots, CSS parts, and custom properties, see the [Full Tabs Documentation](./docs/components/vi-tabs.md).
1246
+
1247
+ #### Snippets
1248
+
1249
+ **Standard Line Tabs:**
1250
+
1251
+ ```html
1252
+ <vi-tabs active="tab-1">
1253
+ <vi-tab tab-id="tab-1">Account</vi-tab>
1254
+ <vi-tab tab-id="tab-2">Security</vi-tab>
1255
+
1256
+ <vi-tab-panel for="tab-1">Account settings content...</vi-tab-panel>
1257
+ <vi-tab-panel for="tab-2">Security settings content...</vi-tab-panel>
1258
+ </vi-tabs>
1259
+ ```
1260
+
1261
+ **Variants & Overflow:**
1262
+
1263
+ ```html
1264
+ <vi-tabs variant="pill" overflow="menu" active="t1">
1265
+ <vi-tab tab-id="t1">Overview</vi-tab>
1266
+ <vi-tab tab-id="t2">Analytics</vi-tab>
1267
+ <vi-tab tab-id="t3" closable>Reports</vi-tab>
1268
+
1269
+ <vi-tab-panel for="t1">...</vi-tab-panel>
1270
+ <vi-tab-panel for="t2">...</vi-tab-panel>
1271
+ <vi-tab-panel for="t3">...</vi-tab-panel>
1272
+ </vi-tabs>
1273
+ ```
1274
+
1275
+ ---
1276
+
1144
1277
  ## Storybook
1145
1278
 
1146
1279
  The project uses **Storybook 10** with the `@storybook/web-components-vite` framework.
@@ -1 +1 @@
1
- {"version":3,"file":"vi-month-year-plugin.d.ts","sourceRoot":"","sources":["../../../../../libs/web-components/src/date-picker/plugins/vi-month-year-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,2BAA2B,CAAC;AAEnC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,uBAA4B,IACnD,IAAI,QAAQ;;;;;EA6M9B"}
1
+ {"version":3,"file":"vi-month-year-plugin.d.ts","sourceRoot":"","sources":["../../../../../libs/web-components/src/date-picker/plugins/vi-month-year-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,2BAA2B,CAAC;AAEnC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,uBAA4B,IACnD,IAAI,QAAQ;;;;;EAgN9B"}
@@ -798,7 +798,9 @@ function ViMonthYearPlugin(config = {}) {
798
798
  if (config.ariaLabels?.prevMonth) {
799
799
  prevBtn.setAttribute('aria-label', config.ariaLabels.prevMonth);
800
800
  }
801
- prevBtn.innerHTML = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6"/></svg>`;
801
+ const parser = new DOMParser();
802
+ const prevDoc = parser.parseFromString(`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6"/></svg>`, 'image/svg+xml');
803
+ prevBtn.appendChild(prevDoc.documentElement);
802
804
  prevBtn.addEventListener('click', (e)=>{
803
805
  e.preventDefault();
804
806
  fp.changeMonth(-1);
@@ -809,7 +811,8 @@ function ViMonthYearPlugin(config = {}) {
809
811
  if (config.ariaLabels?.nextMonth) {
810
812
  nextBtn.setAttribute('aria-label', config.ariaLabels.nextMonth);
811
813
  }
812
- nextBtn.innerHTML = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>`;
814
+ const nextDoc = parser.parseFromString(`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>`, 'image/svg+xml');
815
+ nextBtn.appendChild(nextDoc.documentElement);
813
816
  nextBtn.addEventListener('click', (e)=>{
814
817
  e.preventDefault();
815
818
  fp.changeMonth(1);
package/index.d.ts CHANGED
@@ -19,14 +19,14 @@ export type { TooltipPlacement, TooltipTrigger } from './tooltip/vi-tooltip.js';
19
19
  export { ViTextarea } from './textarea/vi-textarea.js';
20
20
  export type { TextareaResize } from './textarea/vi-textarea.js';
21
21
  export { ViAccordion } from './accordion/vi-accordion.js';
22
- export type { AccordionVariant, AccordionSize } from './accordion/vi-accordion.js';
22
+ export type { AccordionVariant, AccordionSize, } from './accordion/vi-accordion.js';
23
23
  export { ViAccordionItem } from './accordion/vi-accordion-item.js';
24
24
  export { ViBadge } from './badge/vi-badge.js';
25
25
  export type { BadgeVariant, BadgeSize } from './badge/vi-badge.js';
26
26
  export { ViAlert } from './alert/vi-alert.js';
27
27
  export type { AlertVariant } from './alert/vi-alert.js';
28
28
  export { ViModal } from './modal/vi-modal.js';
29
- export type { ModalVariant, DrawerPlacement, ModalSize } from './modal/vi-modal.js';
29
+ export type { ModalVariant, DrawerPlacement, ModalSize, } from './modal/vi-modal.js';
30
30
  export { ViModalHeader } from './modal/vi-modal-header.js';
31
31
  export { ViModalFooter } from './modal/vi-modal-footer.js';
32
32
  export { ViChip } from './chip/vi-chip.js';
@@ -45,7 +45,11 @@ export { ViCombobox } from './combobox/vi-combobox.js';
45
45
  export { ViComboboxItem } from './combobox/vi-combobox-item.js';
46
46
  export { ViDatePicker, VIALIQ_CHANGE } from './date-picker/vi-date-picker.js';
47
47
  export { ViDatePickerInput } from './date-picker/vi-date-picker-input.js';
48
- export type { DatePickerMode, DatePickerChangeDetail } from './date-picker/types.js';
48
+ export type { DatePickerMode, DatePickerChangeDetail, } from './date-picker/types.js';
49
49
  export { ViLabel } from './label/vi-label.js';
50
50
  export type { LabelSize } from './label/vi-label.js';
51
+ export { ViLink } from './link/index.js';
52
+ export type { TabsOrientation, TabsVariant, TabsActivation, TabsOverflow, } from './tabs/vi-tabs.js';
53
+ export { ViTab } from './tabs/vi-tab.js';
54
+ export { ViTabPanel } from './tabs/vi-tab-panel.js';
51
55
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -28,3 +28,6 @@ export { ViComboboxItem } from './combobox/vi-combobox-item.js';
28
28
  export { VIALIQ_CHANGE, ViDatePicker } from './date-picker/vi-date-picker.js';
29
29
  export { ViDatePickerInput } from './date-picker/vi-date-picker-input.js';
30
30
  export { ViLabel } from './label/vi-label.js';
31
+ export { ViLink } from './link/vi-link.js';
32
+ export { ViTab } from './tabs/vi-tab.js';
33
+ export { ViTabPanel } from './tabs/vi-tab-panel.js';
@@ -0,0 +1,2 @@
1
+ export { ViLink } from './vi-link.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
package/link/index.js ADDED
@@ -0,0 +1 @@
1
+ export { ViLink } from './vi-link.js';
@@ -0,0 +1,30 @@
1
+ import { nothing } from 'lit';
2
+ import { ViElement } from '../base/vi-element.js';
3
+ type LinkVariant = 'primary' | 'secondary' | 'muted';
4
+ type LinkSize = 'inherit' | 'sm' | 'md' | 'lg';
5
+ type LinkUnderline = 'always' | 'hover' | 'none';
6
+ declare const ViLink_base: typeof ViElement & (new (...args: any[]) => import('../base/focusable-mixin.js').FocusableInterface);
7
+ export declare class ViLink extends ViLink_base {
8
+ static styles: import('lit').CSSResult;
9
+ accessor href: string;
10
+ accessor target: string;
11
+ accessor rel: string;
12
+ accessor download: string;
13
+ accessor variant: LinkVariant;
14
+ accessor size: LinkSize;
15
+ accessor underline: LinkUnderline;
16
+ accessor disabled: boolean;
17
+ accessor external: boolean;
18
+ protected get _focusableElement(): HTMLElement;
19
+ protected get _effectiveTarget(): string;
20
+ protected get _effectiveRel(): string | typeof nothing;
21
+ accessor ariaLabel: string | null;
22
+ render(): import('lit-html').TemplateResult<1>;
23
+ }
24
+ declare global {
25
+ interface HTMLElementTagNameMap {
26
+ 'vi-link': ViLink;
27
+ }
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=vi-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vi-link.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/link/vi-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAa,MAAM,KAAK,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,qBAAqB,CAAC;AAG7B,KAAK,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AACrD,KAAK,QAAQ,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/C,KAAK,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;;AAEjD,qBACa,MAAO,SAAQ,WAAyB;IACnD,OAAgB,MAAM,0BAEpB;IAE0B,QAAQ,CAAC,IAAI,SAAM;IACnB,QAAQ,CAAC,MAAM,SAAW;IAC1B,QAAQ,CAAC,GAAG,SAAM;IAClB,QAAQ,CAAC,QAAQ,SAAM;IACR,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC5D;IACgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAa;IACpC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAW;IAC5B,QAAQ,CAAC,QAAQ,UAAS;IACzC,QAAQ,CAAC,QAAQ,UAAS;IAEvD,cAAuB,iBAAiB,IACQ,WAAW,CAC1D;IAED,SAAS,KAAK,gBAAgB,WAE7B;IAED,SAAS,KAAK,aAAa,4BAS1B;IAEsC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEvE,MAAM;CA+BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
@@ -0,0 +1,591 @@
1
+ import { unsafeCSS, css, nothing, html } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { V as ViElement } from '../vi-element-C6GfDPs3.js';
4
+ import { F as FocusableMixin } from '../focusable-mixin-CmxOyPX5.js';
5
+ import '../icons/vi-icon.js';
6
+
7
+ const linkStyles = "@charset \"UTF-8\";@layer reset,components,utilities;:host{display:inline-block}.link{color:var(--vi-link-color, var(--vi-link-color, var(--vi-color-primary, #3676d0)));text-decoration-thickness:1px;text-underline-offset:var(--vi-link-underline-offset, 2px);cursor:pointer;transition:color .2s ease,text-decoration-color .2s ease;outline:none;text-decoration:underline}.link.underline-none,.link.underline-hover{text-decoration:none}.link.underline-hover:hover{text-decoration:underline}.link.size-inherit{font-size:inherit}.link.size-sm{font-size:var(--vi-font-size-sm, var(--vi-font-size-sm, 14px))}.link.size-md{font-size:var(--vi-font-size-base, var(--vi-font-size-base, 16px))}.link.size-lg{font-size:var(--vi-font-size-lg, var(--vi-font-size-lg, 18px))}.link.variant-secondary{--vi-link-color: var(--vi-link-color-secondary, var(--vi-link-color-secondary, var(--vi-color-grey-700, #616161)));--vi-link-color-hover: var(--vi-link-color-secondary-hover, var(--vi-color-grey-800, #424242));--vi-link-color-active: var(--vi-link-color-secondary-active, var(--vi-color-grey-900, #212121));--vi-link-color-visited: var(--vi-link-color-secondary-visited, var(--vi-color-grey-700, #616161))}.link.variant-muted{--vi-link-color: var(--vi-link-color-muted, var(--vi-link-color-muted, var(--vi-color-grey-500, #9e9e9e)));--vi-link-color-hover: var(--vi-link-color-muted-hover, var(--vi-color-grey-600, #757575));--vi-link-color-active: var(--vi-link-color-muted-active, var(--vi-color-grey-700, #616161));--vi-link-color-visited: var(--vi-link-color-muted-visited, var(--vi-color-grey-500, #9e9e9e))}.link:visited{color:var(--vi-link-color-visited, var(--vi-link-color-visited, var(--vi-color-purple-600, #6507c9)))}.link:hover{color:var(--vi-link-color-hover, var(--vi-link-color-hover, var(--vi-color-blue-800, #2d5fa8)))}.link:active{color:var(--vi-link-color-active, var(--vi-link-color-active, var(--vi-color-blue-900, #254882)))}.link:focus-visible{outline:var(--vi-border-width-base, 2px) solid var(--vi-focus-ring-color, var(--vi-link-color, var(--vi-color-primary, #3676d0)));outline-offset:0;box-shadow:0 0 0 3px var(--vi-focus-ring-glow, transparent)}.link[aria-disabled=true],.link.disabled{color:var(--vi-link-color-disabled, var(--vi-link-color-disabled, var(--vi-color-grey-400, #bdbdbd)));pointer-events:none;cursor:not-allowed;text-decoration:none}.link{display:inline-flex;align-items:center}::slotted([slot=icon]){display:inline-flex;margin-inline-end:.25rem}[part=external-icon]{display:inline-flex;align-items:center;margin-inline-start:.25rem}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}";
8
+
9
+ function applyDecs2203RFactory() {
10
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
11
+ return function addInitializer(initializer) {
12
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
13
+ assertCallable(initializer, "An initializer");
14
+ initializers.push(initializer);
15
+ };
16
+ }
17
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
18
+ var kindStr;
19
+ switch(kind){
20
+ case 1:
21
+ kindStr = "accessor";
22
+ break;
23
+ case 2:
24
+ kindStr = "method";
25
+ break;
26
+ case 3:
27
+ kindStr = "getter";
28
+ break;
29
+ case 4:
30
+ kindStr = "setter";
31
+ break;
32
+ default:
33
+ kindStr = "field";
34
+ }
35
+ var ctx = {
36
+ kind: kindStr,
37
+ name: isPrivate ? "#" + name : name,
38
+ static: isStatic,
39
+ private: isPrivate,
40
+ metadata: metadata
41
+ };
42
+ var decoratorFinishedRef = {
43
+ v: false
44
+ };
45
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
46
+ var get, set;
47
+ if (kind === 0) {
48
+ if (isPrivate) {
49
+ get = desc.get;
50
+ set = desc.set;
51
+ } else {
52
+ get = function() {
53
+ return this[name];
54
+ };
55
+ set = function(v) {
56
+ this[name] = v;
57
+ };
58
+ }
59
+ } else if (kind === 2) {
60
+ get = function() {
61
+ return desc.value;
62
+ };
63
+ } else {
64
+ if (kind === 1 || kind === 3) {
65
+ get = function() {
66
+ return desc.get.call(this);
67
+ };
68
+ }
69
+ if (kind === 1 || kind === 4) {
70
+ set = function(v) {
71
+ desc.set.call(this, v);
72
+ };
73
+ }
74
+ }
75
+ ctx.access = get && set ? {
76
+ get: get,
77
+ set: set
78
+ } : get ? {
79
+ get: get
80
+ } : {
81
+ set: set
82
+ };
83
+ try {
84
+ return dec(value, ctx);
85
+ } finally{
86
+ decoratorFinishedRef.v = true;
87
+ }
88
+ }
89
+ function assertNotFinished(decoratorFinishedRef, fnName) {
90
+ if (decoratorFinishedRef.v) {
91
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
92
+ }
93
+ }
94
+ function assertCallable(fn, hint) {
95
+ if (typeof fn !== "function") {
96
+ throw new TypeError(hint + " must be a function");
97
+ }
98
+ }
99
+ function assertValidReturnValue(kind, value) {
100
+ var type = typeof value;
101
+ if (kind === 1) {
102
+ if (type !== "object" || value === null) {
103
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
104
+ }
105
+ if (value.get !== undefined) {
106
+ assertCallable(value.get, "accessor.get");
107
+ }
108
+ if (value.set !== undefined) {
109
+ assertCallable(value.set, "accessor.set");
110
+ }
111
+ if (value.init !== undefined) {
112
+ assertCallable(value.init, "accessor.init");
113
+ }
114
+ } else if (type !== "function") {
115
+ var hint;
116
+ if (kind === 0) {
117
+ hint = "field";
118
+ } else if (kind === 10) {
119
+ hint = "class";
120
+ } else {
121
+ hint = "method";
122
+ }
123
+ throw new TypeError(hint + " decorators must return a function or void 0");
124
+ }
125
+ }
126
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
127
+ var decs = decInfo[0];
128
+ var desc, init, value;
129
+ if (isPrivate) {
130
+ if (kind === 0 || kind === 1) {
131
+ desc = {
132
+ get: decInfo[3],
133
+ set: decInfo[4]
134
+ };
135
+ } else if (kind === 3) {
136
+ desc = {
137
+ get: decInfo[3]
138
+ };
139
+ } else if (kind === 4) {
140
+ desc = {
141
+ set: decInfo[3]
142
+ };
143
+ } else {
144
+ desc = {
145
+ value: decInfo[3]
146
+ };
147
+ }
148
+ } else if (kind !== 0) {
149
+ desc = Object.getOwnPropertyDescriptor(base, name);
150
+ }
151
+ if (kind === 1) {
152
+ value = {
153
+ get: desc.get,
154
+ set: desc.set
155
+ };
156
+ } else if (kind === 2) {
157
+ value = desc.value;
158
+ } else if (kind === 3) {
159
+ value = desc.get;
160
+ } else if (kind === 4) {
161
+ value = desc.set;
162
+ }
163
+ var newValue, get, set;
164
+ if (typeof decs === "function") {
165
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
166
+ if (newValue !== void 0) {
167
+ assertValidReturnValue(kind, newValue);
168
+ if (kind === 0) {
169
+ init = newValue;
170
+ } else if (kind === 1) {
171
+ init = newValue.init;
172
+ get = newValue.get || value.get;
173
+ set = newValue.set || value.set;
174
+ value = {
175
+ get: get,
176
+ set: set
177
+ };
178
+ } else {
179
+ value = newValue;
180
+ }
181
+ }
182
+ } else {
183
+ for(var i = decs.length - 1; i >= 0; i--){
184
+ var dec = decs[i];
185
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
186
+ if (newValue !== void 0) {
187
+ assertValidReturnValue(kind, newValue);
188
+ var newInit;
189
+ if (kind === 0) {
190
+ newInit = newValue;
191
+ } else if (kind === 1) {
192
+ newInit = newValue.init;
193
+ get = newValue.get || value.get;
194
+ set = newValue.set || value.set;
195
+ value = {
196
+ get: get,
197
+ set: set
198
+ };
199
+ } else {
200
+ value = newValue;
201
+ }
202
+ if (newInit !== void 0) {
203
+ if (init === void 0) {
204
+ init = newInit;
205
+ } else if (typeof init === "function") {
206
+ init = [
207
+ init,
208
+ newInit
209
+ ];
210
+ } else {
211
+ init.push(newInit);
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }
217
+ if (kind === 0 || kind === 1) {
218
+ if (init === void 0) {
219
+ init = function(instance, init) {
220
+ return init;
221
+ };
222
+ } else if (typeof init !== "function") {
223
+ var ownInitializers = init;
224
+ init = function(instance, init) {
225
+ var value = init;
226
+ for(var i = 0; i < ownInitializers.length; i++){
227
+ value = ownInitializers[i].call(instance, value);
228
+ }
229
+ return value;
230
+ };
231
+ } else {
232
+ var originalInitializer = init;
233
+ init = function(instance, init) {
234
+ return originalInitializer.call(instance, init);
235
+ };
236
+ }
237
+ ret.push(init);
238
+ }
239
+ if (kind !== 0) {
240
+ if (kind === 1) {
241
+ desc.get = value.get;
242
+ desc.set = value.set;
243
+ } else if (kind === 2) {
244
+ desc.value = value;
245
+ } else if (kind === 3) {
246
+ desc.get = value;
247
+ } else if (kind === 4) {
248
+ desc.set = value;
249
+ }
250
+ if (isPrivate) {
251
+ if (kind === 1) {
252
+ ret.push(function(instance, args) {
253
+ return value.get.call(instance, args);
254
+ });
255
+ ret.push(function(instance, args) {
256
+ return value.set.call(instance, args);
257
+ });
258
+ } else if (kind === 2) {
259
+ ret.push(value);
260
+ } else {
261
+ ret.push(function(instance, args) {
262
+ return value.call(instance, args);
263
+ });
264
+ }
265
+ } else {
266
+ Object.defineProperty(base, name, desc);
267
+ }
268
+ }
269
+ }
270
+ function applyMemberDecs(Class, decInfos, metadata) {
271
+ var ret = [];
272
+ var protoInitializers;
273
+ var staticInitializers;
274
+ var existingProtoNonFields = new Map();
275
+ var existingStaticNonFields = new Map();
276
+ for(var i = 0; i < decInfos.length; i++){
277
+ var decInfo = decInfos[i];
278
+ if (!Array.isArray(decInfo)) continue;
279
+ var kind = decInfo[1];
280
+ var name = decInfo[2];
281
+ var isPrivate = decInfo.length > 3;
282
+ var isStatic = kind >= 5;
283
+ var base;
284
+ var initializers;
285
+ if (isStatic) {
286
+ base = Class;
287
+ kind = kind - 5;
288
+ staticInitializers = staticInitializers || [];
289
+ initializers = staticInitializers;
290
+ } else {
291
+ base = Class.prototype;
292
+ protoInitializers = protoInitializers || [];
293
+ initializers = protoInitializers;
294
+ }
295
+ if (kind !== 0 && !isPrivate) {
296
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
297
+ var existingKind = existingNonFields.get(name) || 0;
298
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
299
+ 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);
300
+ } else if (!existingKind && kind > 2) {
301
+ existingNonFields.set(name, kind);
302
+ } else {
303
+ existingNonFields.set(name, true);
304
+ }
305
+ }
306
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
307
+ }
308
+ pushInitializers(ret, protoInitializers);
309
+ pushInitializers(ret, staticInitializers);
310
+ return ret;
311
+ }
312
+ function pushInitializers(ret, initializers) {
313
+ if (initializers) {
314
+ ret.push(function(instance) {
315
+ for(var i = 0; i < initializers.length; i++){
316
+ initializers[i].call(instance);
317
+ }
318
+ return instance;
319
+ });
320
+ }
321
+ }
322
+ function applyClassDecs(targetClass, classDecs, metadata) {
323
+ if (classDecs.length > 0) {
324
+ var initializers = [];
325
+ var newClass = targetClass;
326
+ var name = targetClass.name;
327
+ for(var i = classDecs.length - 1; i >= 0; i--){
328
+ var decoratorFinishedRef = {
329
+ v: false
330
+ };
331
+ try {
332
+ var nextNewClass = classDecs[i](newClass, {
333
+ kind: "class",
334
+ name: name,
335
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
336
+ metadata
337
+ });
338
+ } finally{
339
+ decoratorFinishedRef.v = true;
340
+ }
341
+ if (nextNewClass !== undefined) {
342
+ assertValidReturnValue(10, nextNewClass);
343
+ newClass = nextNewClass;
344
+ }
345
+ }
346
+ return [
347
+ defineMetadata(newClass, metadata),
348
+ function() {
349
+ for(var i = 0; i < initializers.length; i++){
350
+ initializers[i].call(newClass);
351
+ }
352
+ }
353
+ ];
354
+ }
355
+ }
356
+ function defineMetadata(Class, metadata) {
357
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
358
+ configurable: true,
359
+ enumerable: true,
360
+ value: metadata
361
+ });
362
+ }
363
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
364
+ if (parentClass !== void 0) {
365
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
366
+ }
367
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
368
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
369
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
370
+ return {
371
+ e: e,
372
+ get c () {
373
+ return applyClassDecs(targetClass, classDecs, metadata);
374
+ }
375
+ };
376
+ };
377
+ }
378
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
379
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
380
+ }
381
+ function _identity(x) {
382
+ return x;
383
+ }
384
+ var _dec, _initClass, _FocusableMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _init_href, _init_target, _init_rel, _init_download, _init_variant, _init_size, _init_underline, _init_disabled, _init_external, _init_ariaLabel, _initProto;
385
+ let _ViLink;
386
+ _dec = customElement('vi-link'), _dec1 = property({
387
+ type: String
388
+ }), _dec2 = property({
389
+ type: String
390
+ }), _dec3 = property({
391
+ type: String
392
+ }), _dec4 = property({
393
+ type: String
394
+ }), _dec5 = property({
395
+ type: String,
396
+ reflect: true
397
+ }), _dec6 = property({
398
+ type: String
399
+ }), _dec7 = property({
400
+ type: String
401
+ }), _dec8 = property({
402
+ type: Boolean,
403
+ reflect: true
404
+ }), _dec9 = property({
405
+ type: Boolean
406
+ }), _dec10 = property({
407
+ attribute: 'aria-label'
408
+ });
409
+ new class extends _identity {
410
+ constructor(){
411
+ super(_ViLink), _initClass();
412
+ }
413
+ static{
414
+ class ViLink extends (_FocusableMixin = FocusableMixin(ViElement)) {
415
+ static{
416
+ ({ e: [_init_href, _init_target, _init_rel, _init_download, _init_variant, _init_size, _init_underline, _init_disabled, _init_external, _init_ariaLabel, _initProto], c: [_ViLink, _initClass] } = _apply_decs_2203_r(this, [
417
+ [
418
+ _dec1,
419
+ 1,
420
+ "href"
421
+ ],
422
+ [
423
+ _dec2,
424
+ 1,
425
+ "target"
426
+ ],
427
+ [
428
+ _dec3,
429
+ 1,
430
+ "rel"
431
+ ],
432
+ [
433
+ _dec4,
434
+ 1,
435
+ "download"
436
+ ],
437
+ [
438
+ _dec5,
439
+ 1,
440
+ "variant"
441
+ ],
442
+ [
443
+ _dec6,
444
+ 1,
445
+ "size"
446
+ ],
447
+ [
448
+ _dec7,
449
+ 1,
450
+ "underline"
451
+ ],
452
+ [
453
+ _dec8,
454
+ 1,
455
+ "disabled"
456
+ ],
457
+ [
458
+ _dec9,
459
+ 1,
460
+ "external"
461
+ ],
462
+ [
463
+ _dec10,
464
+ 1,
465
+ "ariaLabel"
466
+ ]
467
+ ], [
468
+ _dec
469
+ ], _FocusableMixin));
470
+ }
471
+ static styles = css`
472
+ ${unsafeCSS(linkStyles)}
473
+ `;
474
+ #___private_href_1 = (_initProto(this), _init_href(this, ''));
475
+ get href() {
476
+ return this.#___private_href_1;
477
+ }
478
+ set href(_v) {
479
+ this.#___private_href_1 = _v;
480
+ }
481
+ #___private_target_2 = _init_target(this, '_self');
482
+ get target() {
483
+ return this.#___private_target_2;
484
+ }
485
+ set target(_v) {
486
+ this.#___private_target_2 = _v;
487
+ }
488
+ #___private_rel_3 = _init_rel(this, '');
489
+ get rel() {
490
+ return this.#___private_rel_3;
491
+ }
492
+ set rel(_v) {
493
+ this.#___private_rel_3 = _v;
494
+ }
495
+ #___private_download_4 = _init_download(this, '');
496
+ get download() {
497
+ return this.#___private_download_4;
498
+ }
499
+ set download(_v) {
500
+ this.#___private_download_4 = _v;
501
+ }
502
+ #___private_variant_5 = _init_variant(this, 'primary');
503
+ get variant() {
504
+ return this.#___private_variant_5;
505
+ }
506
+ set variant(_v) {
507
+ this.#___private_variant_5 = _v;
508
+ }
509
+ #___private_size_6 = _init_size(this, 'inherit');
510
+ get size() {
511
+ return this.#___private_size_6;
512
+ }
513
+ set size(_v) {
514
+ this.#___private_size_6 = _v;
515
+ }
516
+ #___private_underline_7 = _init_underline(this, 'hover');
517
+ get underline() {
518
+ return this.#___private_underline_7;
519
+ }
520
+ set underline(_v) {
521
+ this.#___private_underline_7 = _v;
522
+ }
523
+ #___private_disabled_8 = _init_disabled(this, false);
524
+ get disabled() {
525
+ return this.#___private_disabled_8;
526
+ }
527
+ set disabled(_v) {
528
+ this.#___private_disabled_8 = _v;
529
+ }
530
+ #___private_external_9 = _init_external(this, false);
531
+ get external() {
532
+ return this.#___private_external_9;
533
+ }
534
+ set external(_v) {
535
+ this.#___private_external_9 = _v;
536
+ }
537
+ get _focusableElement() {
538
+ return this.shadowRoot?.querySelector('a');
539
+ }
540
+ get _effectiveTarget() {
541
+ return this.external ? '_blank' : this.target;
542
+ }
543
+ get _effectiveRel() {
544
+ const isExternal = this.external || this.target === '_blank';
545
+ if (!isExternal) {
546
+ return this.rel || nothing;
547
+ }
548
+ const rels = new Set((this.rel || '').split(' ').filter(Boolean));
549
+ rels.add('noopener');
550
+ rels.add('noreferrer');
551
+ return Array.from(rels).join(' ');
552
+ }
553
+ #___private_ariaLabel_10 = _init_ariaLabel(this, null);
554
+ get ariaLabel() {
555
+ return this.#___private_ariaLabel_10;
556
+ }
557
+ set ariaLabel(_v) {
558
+ this.#___private_ariaLabel_10 = _v;
559
+ }
560
+ render() {
561
+ const effectiveTarget = this._effectiveTarget;
562
+ const effectiveRel = this._effectiveRel;
563
+ const ariaDisabled = this.disabled ? 'true' : null;
564
+ const href = this.disabled || !this.href ? nothing : this.href;
565
+ const ariaLabel = this.ariaLabel ?? nothing;
566
+ return html`
567
+ <a
568
+ part="link"
569
+ class="link ${this.disabled ? 'disabled' : ''} variant-${this.variant} size-${this.size} underline-${this.underline}"
570
+ href=${href}
571
+ target=${effectiveTarget}
572
+ rel=${effectiveRel}
573
+ download=${this.download || nothing}
574
+ aria-disabled=${ariaDisabled}
575
+ aria-label=${ariaLabel}
576
+ tabindex=${this.disabled ? '-1' : '0'}
577
+ >
578
+ <slot name="icon" part="icon"></slot>
579
+ <slot></slot>
580
+ ${this.external ? html`<span part="external-icon">
581
+ <vi-icon name="external-link" size="14"></vi-icon>
582
+ <span class="sr-only">(opens in new tab)</span>
583
+ </span>` : nothing}
584
+ </a>
585
+ `;
586
+ }
587
+ }
588
+ }
589
+ }();
590
+
591
+ export { _ViLink as ViLink };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vialiq/web-components",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -119,12 +119,36 @@
119
119
  "./label/vi-label": {
120
120
  "types": "./label/vi-label.d.ts",
121
121
  "default": "./label/vi-label.js"
122
+ },
123
+ "./link": {
124
+ "types": "./link/index.d.ts",
125
+ "default": "./link/index.js"
126
+ },
127
+ "./link/vi-link": {
128
+ "types": "./link/vi-link.d.ts",
129
+ "default": "./link/vi-link.js"
130
+ },
131
+ "./tabs": {
132
+ "types": "./tabs/index.d.ts",
133
+ "default": "./tabs/index.js"
134
+ },
135
+ "./tabs/vi-tabs": {
136
+ "types": "./tabs/vi-tabs.d.ts",
137
+ "default": "./tabs/vi-tabs.js"
138
+ },
139
+ "./tabs/vi-tab": {
140
+ "types": "./tabs/vi-tab.d.ts",
141
+ "default": "./tabs/vi-tab.js"
142
+ },
143
+ "./tabs/vi-tab-panel": {
144
+ "types": "./tabs/vi-tab-panel.d.ts",
145
+ "default": "./tabs/vi-tab-panel.js"
122
146
  }
123
147
  },
124
148
  "peerDependencies": {
125
149
  "@floating-ui/dom": ">=1.0.0",
126
- "@vialiq/flux-ui": ">=0.0.4 <0.1.0",
127
- "@vialiq/icons": ">=0.0.3 <0.1.0",
150
+ "@vialiq/flux-ui": "^0.20.0",
151
+ "@vialiq/icons": "^0.5.0",
128
152
  "flatpickr": ">=4.6.0",
129
153
  "lit": "^3.0.0"
130
154
  },
@@ -149,6 +173,7 @@
149
173
  "badge/",
150
174
  "date-picker/",
151
175
  "label/",
176
+ "link/",
152
177
  "README.md"
153
178
  ],
154
179
  "peerDependenciesMeta": {