@vialiq/web-components 0.24.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,8 +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
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';
52
55
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -29,3 +29,5 @@ 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
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';
@@ -1 +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;CA8BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
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"}
package/link/vi-link.js CHANGED
@@ -581,6 +581,7 @@ new class extends _identity {
581
581
  <vi-icon name="external-link" size="14"></vi-icon>
582
582
  <span class="sr-only">(opens in new tab)</span>
583
583
  </span>` : nothing}
584
+ </a>
584
585
  `;
585
586
  }
586
587
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vialiq/web-components",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -127,12 +127,28 @@
127
127
  "./link/vi-link": {
128
128
  "types": "./link/vi-link.d.ts",
129
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"
130
146
  }
131
147
  },
132
148
  "peerDependencies": {
133
149
  "@floating-ui/dom": ">=1.0.0",
134
- "@vialiq/flux-ui": "^0.19.0",
135
- "@vialiq/icons": ">=0.0.3 <0.1.0",
150
+ "@vialiq/flux-ui": "^0.20.0",
151
+ "@vialiq/icons": "^0.5.0",
136
152
  "flatpickr": ">=4.6.0",
137
153
  "lit": "^3.0.0"
138
154
  },