@tartaguti/ui-components 0.0.0-stage → 0.2.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +192 -2
- package/THIRD-PARTY-NOTICES.md +29 -0
- package/custom-elements.json +16899 -0
- package/dist/accordion/tt-accordion-item.d.ts +32 -0
- package/dist/accordion/tt-accordion-item.d.ts.map +1 -0
- package/dist/accordion/tt-accordion-item.js +247 -0
- package/dist/accordion/tt-accordion-item.js.map +1 -0
- package/dist/accordion/tt-accordion.d.ts +28 -0
- package/dist/accordion/tt-accordion.d.ts.map +1 -0
- package/dist/accordion/tt-accordion.js +148 -0
- package/dist/accordion/tt-accordion.js.map +1 -0
- package/dist/bento/tt-bento-item.d.ts +35 -0
- package/dist/bento/tt-bento-item.d.ts.map +1 -0
- package/dist/bento/tt-bento-item.js +201 -0
- package/dist/bento/tt-bento-item.js.map +1 -0
- package/dist/bento/tt-bento.d.ts +25 -0
- package/dist/bento/tt-bento.d.ts.map +1 -0
- package/dist/bento/tt-bento.js +314 -0
- package/dist/bento/tt-bento.js.map +1 -0
- package/dist/floating.d.ts +61 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +120 -0
- package/dist/floating.js.map +1 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/tt-draggable.d.ts +29 -0
- package/dist/interaction/tt-draggable.d.ts.map +1 -0
- package/dist/interaction/tt-draggable.js +66 -0
- package/dist/interaction/tt-draggable.js.map +1 -0
- package/dist/interaction/tt-droppable.d.ts +37 -0
- package/dist/interaction/tt-droppable.d.ts.map +1 -0
- package/dist/interaction/tt-droppable.js +108 -0
- package/dist/interaction/tt-droppable.js.map +1 -0
- package/dist/interaction/tt-resizable.d.ts +45 -0
- package/dist/interaction/tt-resizable.d.ts.map +1 -0
- package/dist/interaction/tt-resizable.js +210 -0
- package/dist/interaction/tt-resizable.js.map +1 -0
- package/dist/interaction/tt-reveal.d.ts +54 -0
- package/dist/interaction/tt-reveal.d.ts.map +1 -0
- package/dist/interaction/tt-reveal.js +302 -0
- package/dist/interaction/tt-reveal.js.map +1 -0
- package/dist/motion.d.ts +8 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +49 -0
- package/dist/motion.js.map +1 -0
- package/dist/overlay.d.ts +7 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +121 -0
- package/dist/overlay.js.map +1 -0
- package/dist/safe-url.d.ts +14 -0
- package/dist/safe-url.d.ts.map +1 -0
- package/dist/safe-url.js +46 -0
- package/dist/safe-url.js.map +1 -0
- package/dist/scroll-lock.d.ts +22 -0
- package/dist/scroll-lock.d.ts.map +1 -0
- package/dist/scroll-lock.js +56 -0
- package/dist/scroll-lock.js.map +1 -0
- package/dist/sidebar/tt-menu-group.d.ts +69 -0
- package/dist/sidebar/tt-menu-group.d.ts.map +1 -0
- package/dist/sidebar/tt-menu-group.js +358 -0
- package/dist/sidebar/tt-menu-group.js.map +1 -0
- package/dist/sidebar/tt-menu-item.d.ts +70 -0
- package/dist/sidebar/tt-menu-item.d.ts.map +1 -0
- package/dist/sidebar/tt-menu-item.js +502 -0
- package/dist/sidebar/tt-menu-item.js.map +1 -0
- package/dist/sidebar/tt-sidebar-footer.d.ts +39 -0
- package/dist/sidebar/tt-sidebar-footer.d.ts.map +1 -0
- package/dist/sidebar/tt-sidebar-footer.js +205 -0
- package/dist/sidebar/tt-sidebar-footer.js.map +1 -0
- package/dist/sidebar/tt-sidebar-header.d.ts +31 -0
- package/dist/sidebar/tt-sidebar-header.d.ts.map +1 -0
- package/dist/sidebar/tt-sidebar-header.js +150 -0
- package/dist/sidebar/tt-sidebar-header.js.map +1 -0
- package/dist/sidebar/tt-sidebar.d.ts +72 -0
- package/dist/sidebar/tt-sidebar.d.ts.map +1 -0
- package/dist/sidebar/tt-sidebar.js +539 -0
- package/dist/sidebar/tt-sidebar.js.map +1 -0
- package/dist/sr-only.d.ts +15 -0
- package/dist/sr-only.d.ts.map +1 -0
- package/dist/sr-only.js +27 -0
- package/dist/sr-only.js.map +1 -0
- package/dist/tokens.css +1124 -0
- package/dist/tt-alert.d.ts +26 -0
- package/dist/tt-alert.d.ts.map +1 -0
- package/dist/tt-alert.js +165 -0
- package/dist/tt-alert.js.map +1 -0
- package/dist/tt-aspect-ratio.d.ts +40 -0
- package/dist/tt-aspect-ratio.d.ts.map +1 -0
- package/dist/tt-aspect-ratio.js +98 -0
- package/dist/tt-aspect-ratio.js.map +1 -0
- package/dist/tt-auth.d.ts +75 -0
- package/dist/tt-auth.d.ts.map +1 -0
- package/dist/tt-auth.js +520 -0
- package/dist/tt-auth.js.map +1 -0
- package/dist/tt-avatar.d.ts +26 -0
- package/dist/tt-avatar.d.ts.map +1 -0
- package/dist/tt-avatar.js +169 -0
- package/dist/tt-avatar.js.map +1 -0
- package/dist/tt-badge.d.ts +36 -0
- package/dist/tt-badge.d.ts.map +1 -0
- package/dist/tt-badge.js +135 -0
- package/dist/tt-badge.js.map +1 -0
- package/dist/tt-breadcrumbs.d.ts +22 -0
- package/dist/tt-breadcrumbs.d.ts.map +1 -0
- package/dist/tt-breadcrumbs.js +144 -0
- package/dist/tt-breadcrumbs.js.map +1 -0
- package/dist/tt-button-group.d.ts +32 -0
- package/dist/tt-button-group.d.ts.map +1 -0
- package/dist/tt-button-group.js +132 -0
- package/dist/tt-button-group.js.map +1 -0
- package/dist/tt-button.d.ts +31 -0
- package/dist/tt-button.d.ts.map +1 -0
- package/dist/tt-button.js +483 -0
- package/dist/tt-button.js.map +1 -0
- package/dist/tt-card.d.ts +26 -0
- package/dist/tt-card.d.ts.map +1 -0
- package/dist/tt-card.js +429 -0
- package/dist/tt-card.js.map +1 -0
- package/dist/tt-chart.d.ts +36 -0
- package/dist/tt-chart.d.ts.map +1 -0
- package/dist/tt-chart.js +332 -0
- package/dist/tt-chart.js.map +1 -0
- package/dist/tt-checkbox-group.d.ts +38 -0
- package/dist/tt-checkbox-group.d.ts.map +1 -0
- package/dist/tt-checkbox-group.js +243 -0
- package/dist/tt-checkbox-group.js.map +1 -0
- package/dist/tt-checkbox.d.ts +35 -0
- package/dist/tt-checkbox.d.ts.map +1 -0
- package/dist/tt-checkbox.js +354 -0
- package/dist/tt-checkbox.js.map +1 -0
- package/dist/tt-code-block.d.ts +37 -0
- package/dist/tt-code-block.d.ts.map +1 -0
- package/dist/tt-code-block.js +409 -0
- package/dist/tt-code-block.js.map +1 -0
- package/dist/tt-collapsible.d.ts +71 -0
- package/dist/tt-collapsible.d.ts.map +1 -0
- package/dist/tt-collapsible.js +206 -0
- package/dist/tt-collapsible.js.map +1 -0
- package/dist/tt-combobox.d.ts +107 -0
- package/dist/tt-combobox.d.ts.map +1 -0
- package/dist/tt-combobox.js +816 -0
- package/dist/tt-combobox.js.map +1 -0
- package/dist/tt-company-card.d.ts +30 -0
- package/dist/tt-company-card.d.ts.map +1 -0
- package/dist/tt-company-card.js +382 -0
- package/dist/tt-company-card.js.map +1 -0
- package/dist/tt-comparison-table.d.ts +59 -0
- package/dist/tt-comparison-table.d.ts.map +1 -0
- package/dist/tt-comparison-table.js +441 -0
- package/dist/tt-comparison-table.js.map +1 -0
- package/dist/tt-component-doc.d.ts +63 -0
- package/dist/tt-component-doc.d.ts.map +1 -0
- package/dist/tt-component-doc.js +585 -0
- package/dist/tt-component-doc.js.map +1 -0
- package/dist/tt-confirm.d.ts +45 -0
- package/dist/tt-confirm.d.ts.map +1 -0
- package/dist/tt-confirm.js +151 -0
- package/dist/tt-confirm.js.map +1 -0
- package/dist/tt-contact-list.d.ts +18 -0
- package/dist/tt-contact-list.d.ts.map +1 -0
- package/dist/tt-contact-list.js +101 -0
- package/dist/tt-contact-list.js.map +1 -0
- package/dist/tt-copy-button.d.ts +25 -0
- package/dist/tt-copy-button.d.ts.map +1 -0
- package/dist/tt-copy-button.js +194 -0
- package/dist/tt-copy-button.js.map +1 -0
- package/dist/tt-data-table.d.ts +96 -0
- package/dist/tt-data-table.d.ts.map +1 -0
- package/dist/tt-data-table.js +812 -0
- package/dist/tt-data-table.js.map +1 -0
- package/dist/tt-divider.d.ts +19 -0
- package/dist/tt-divider.d.ts.map +1 -0
- package/dist/tt-divider.js +104 -0
- package/dist/tt-divider.js.map +1 -0
- package/dist/tt-drawer.d.ts +38 -0
- package/dist/tt-drawer.d.ts.map +1 -0
- package/dist/tt-drawer.js +433 -0
- package/dist/tt-drawer.js.map +1 -0
- package/dist/tt-dropdown-menu.d.ts +57 -0
- package/dist/tt-dropdown-menu.d.ts.map +1 -0
- package/dist/tt-dropdown-menu.js +631 -0
- package/dist/tt-dropdown-menu.js.map +1 -0
- package/dist/tt-empty-state.d.ts +13 -0
- package/dist/tt-empty-state.d.ts.map +1 -0
- package/dist/tt-empty-state.js +94 -0
- package/dist/tt-empty-state.js.map +1 -0
- package/dist/tt-example.d.ts +33 -0
- package/dist/tt-example.d.ts.map +1 -0
- package/dist/tt-example.js +250 -0
- package/dist/tt-example.js.map +1 -0
- package/dist/tt-file-upload.d.ts +85 -0
- package/dist/tt-file-upload.d.ts.map +1 -0
- package/dist/tt-file-upload.js +662 -0
- package/dist/tt-file-upload.js.map +1 -0
- package/dist/tt-filter.d.ts +62 -0
- package/dist/tt-filter.d.ts.map +1 -0
- package/dist/tt-filter.js +393 -0
- package/dist/tt-filter.js.map +1 -0
- package/dist/tt-form.d.ts +33 -0
- package/dist/tt-form.d.ts.map +1 -0
- package/dist/tt-form.js +202 -0
- package/dist/tt-form.js.map +1 -0
- package/dist/tt-grid.d.ts +22 -0
- package/dist/tt-grid.d.ts.map +1 -0
- package/dist/tt-grid.js +106 -0
- package/dist/tt-grid.js.map +1 -0
- package/dist/tt-icon.d.ts +20 -0
- package/dist/tt-icon.d.ts.map +1 -0
- package/dist/tt-icon.js +510 -0
- package/dist/tt-icon.js.map +1 -0
- package/dist/tt-image.d.ts +59 -0
- package/dist/tt-image.d.ts.map +1 -0
- package/dist/tt-image.js +314 -0
- package/dist/tt-image.js.map +1 -0
- package/dist/tt-inbox.d.ts +45 -0
- package/dist/tt-inbox.d.ts.map +1 -0
- package/dist/tt-inbox.js +275 -0
- package/dist/tt-inbox.js.map +1 -0
- package/dist/tt-input.d.ts +43 -0
- package/dist/tt-input.d.ts.map +1 -0
- package/dist/tt-input.js +476 -0
- package/dist/tt-input.js.map +1 -0
- package/dist/tt-kbd.d.ts +39 -0
- package/dist/tt-kbd.d.ts.map +1 -0
- package/dist/tt-kbd.js +145 -0
- package/dist/tt-kbd.js.map +1 -0
- package/dist/tt-key-values.d.ts +17 -0
- package/dist/tt-key-values.d.ts.map +1 -0
- package/dist/tt-key-values.js +126 -0
- package/dist/tt-key-values.js.map +1 -0
- package/dist/tt-knowledge-doc.d.ts +24 -0
- package/dist/tt-knowledge-doc.d.ts.map +1 -0
- package/dist/tt-knowledge-doc.js +120 -0
- package/dist/tt-knowledge-doc.js.map +1 -0
- package/dist/tt-layout.d.ts +36 -0
- package/dist/tt-layout.d.ts.map +1 -0
- package/dist/tt-layout.js +318 -0
- package/dist/tt-layout.js.map +1 -0
- package/dist/tt-modal.d.ts +32 -0
- package/dist/tt-modal.d.ts.map +1 -0
- package/dist/tt-modal.js +553 -0
- package/dist/tt-modal.js.map +1 -0
- package/dist/tt-navbar.d.ts +33 -0
- package/dist/tt-navbar.d.ts.map +1 -0
- package/dist/tt-navbar.js +390 -0
- package/dist/tt-navbar.js.map +1 -0
- package/dist/tt-page-header.d.ts +28 -0
- package/dist/tt-page-header.d.ts.map +1 -0
- package/dist/tt-page-header.js +166 -0
- package/dist/tt-page-header.js.map +1 -0
- package/dist/tt-page.d.ts +14 -0
- package/dist/tt-page.d.ts.map +1 -0
- package/dist/tt-page.js +163 -0
- package/dist/tt-page.js.map +1 -0
- package/dist/tt-pagination.d.ts +27 -0
- package/dist/tt-pagination.d.ts.map +1 -0
- package/dist/tt-pagination.js +194 -0
- package/dist/tt-pagination.js.map +1 -0
- package/dist/tt-preview.d.ts +11 -0
- package/dist/tt-preview.d.ts.map +1 -0
- package/dist/tt-preview.js +68 -0
- package/dist/tt-preview.js.map +1 -0
- package/dist/tt-product.d.ts +40 -0
- package/dist/tt-product.d.ts.map +1 -0
- package/dist/tt-product.js +590 -0
- package/dist/tt-product.js.map +1 -0
- package/dist/tt-profile-card.d.ts +23 -0
- package/dist/tt-profile-card.d.ts.map +1 -0
- package/dist/tt-profile-card.js +199 -0
- package/dist/tt-profile-card.js.map +1 -0
- package/dist/tt-progress.d.ts +26 -0
- package/dist/tt-progress.d.ts.map +1 -0
- package/dist/tt-progress.js +156 -0
- package/dist/tt-progress.js.map +1 -0
- package/dist/tt-quantity.d.ts +36 -0
- package/dist/tt-quantity.d.ts.map +1 -0
- package/dist/tt-quantity.js +396 -0
- package/dist/tt-quantity.js.map +1 -0
- package/dist/tt-radio-group.d.ts +50 -0
- package/dist/tt-radio-group.d.ts.map +1 -0
- package/dist/tt-radio-group.js +372 -0
- package/dist/tt-radio-group.js.map +1 -0
- package/dist/tt-rating.d.ts +54 -0
- package/dist/tt-rating.d.ts.map +1 -0
- package/dist/tt-rating.js +312 -0
- package/dist/tt-rating.js.map +1 -0
- package/dist/tt-search.d.ts +47 -0
- package/dist/tt-search.d.ts.map +1 -0
- package/dist/tt-search.js +360 -0
- package/dist/tt-search.js.map +1 -0
- package/dist/tt-section.d.ts +13 -0
- package/dist/tt-section.d.ts.map +1 -0
- package/dist/tt-section.js +98 -0
- package/dist/tt-section.js.map +1 -0
- package/dist/tt-select.d.ts +62 -0
- package/dist/tt-select.d.ts.map +1 -0
- package/dist/tt-select.js +662 -0
- package/dist/tt-select.js.map +1 -0
- package/dist/tt-skeleton.d.ts +20 -0
- package/dist/tt-skeleton.d.ts.map +1 -0
- package/dist/tt-skeleton.js +143 -0
- package/dist/tt-skeleton.js.map +1 -0
- package/dist/tt-slider.d.ts +74 -0
- package/dist/tt-slider.d.ts.map +1 -0
- package/dist/tt-slider.js +426 -0
- package/dist/tt-slider.js.map +1 -0
- package/dist/tt-social-links.d.ts +34 -0
- package/dist/tt-social-links.d.ts.map +1 -0
- package/dist/tt-social-links.js +242 -0
- package/dist/tt-social-links.js.map +1 -0
- package/dist/tt-sparkline.d.ts +19 -0
- package/dist/tt-sparkline.d.ts.map +1 -0
- package/dist/tt-sparkline.js +191 -0
- package/dist/tt-sparkline.js.map +1 -0
- package/dist/tt-spinner.d.ts +19 -0
- package/dist/tt-spinner.d.ts.map +1 -0
- package/dist/tt-spinner.js +93 -0
- package/dist/tt-spinner.js.map +1 -0
- package/dist/tt-stack.d.ts +42 -0
- package/dist/tt-stack.d.ts.map +1 -0
- package/dist/tt-stack.js +158 -0
- package/dist/tt-stack.js.map +1 -0
- package/dist/tt-stat.d.ts +17 -0
- package/dist/tt-stat.d.ts.map +1 -0
- package/dist/tt-stat.js +134 -0
- package/dist/tt-stat.js.map +1 -0
- package/dist/tt-switch.d.ts +39 -0
- package/dist/tt-switch.d.ts.map +1 -0
- package/dist/tt-switch.js +254 -0
- package/dist/tt-switch.js.map +1 -0
- package/dist/tt-switcher.d.ts +23 -0
- package/dist/tt-switcher.d.ts.map +1 -0
- package/dist/tt-switcher.js +203 -0
- package/dist/tt-switcher.js.map +1 -0
- package/dist/tt-table-cell.d.ts +26 -0
- package/dist/tt-table-cell.d.ts.map +1 -0
- package/dist/tt-table-cell.js +121 -0
- package/dist/tt-table-cell.js.map +1 -0
- package/dist/tt-table-row.d.ts +31 -0
- package/dist/tt-table-row.d.ts.map +1 -0
- package/dist/tt-table-row.js +72 -0
- package/dist/tt-table-row.js.map +1 -0
- package/dist/tt-table.d.ts +44 -0
- package/dist/tt-table.d.ts.map +1 -0
- package/dist/tt-table.js +270 -0
- package/dist/tt-table.js.map +1 -0
- package/dist/tt-tabs.d.ts +31 -0
- package/dist/tt-tabs.d.ts.map +1 -0
- package/dist/tt-tabs.js +223 -0
- package/dist/tt-tabs.js.map +1 -0
- package/dist/tt-tag-list.d.ts +19 -0
- package/dist/tt-tag-list.d.ts.map +1 -0
- package/dist/tt-tag-list.js +136 -0
- package/dist/tt-tag-list.js.map +1 -0
- package/dist/tt-text.d.ts +52 -0
- package/dist/tt-text.d.ts.map +1 -0
- package/dist/tt-text.js +337 -0
- package/dist/tt-text.js.map +1 -0
- package/dist/tt-textarea.d.ts +43 -0
- package/dist/tt-textarea.d.ts.map +1 -0
- package/dist/tt-textarea.js +356 -0
- package/dist/tt-textarea.js.map +1 -0
- package/dist/tt-thread.d.ts +62 -0
- package/dist/tt-thread.d.ts.map +1 -0
- package/dist/tt-thread.js +374 -0
- package/dist/tt-thread.js.map +1 -0
- package/dist/tt-toast.d.ts +49 -0
- package/dist/tt-toast.d.ts.map +1 -0
- package/dist/tt-toast.js +440 -0
- package/dist/tt-toast.js.map +1 -0
- package/dist/tt-toggle-group.d.ts +73 -0
- package/dist/tt-toggle-group.d.ts.map +1 -0
- package/dist/tt-toggle-group.js +273 -0
- package/dist/tt-toggle-group.js.map +1 -0
- package/dist/tt-toggle.d.ts +54 -0
- package/dist/tt-toggle.d.ts.map +1 -0
- package/dist/tt-toggle.js +232 -0
- package/dist/tt-toggle.js.map +1 -0
- package/dist/tt-toolbar.d.ts +26 -0
- package/dist/tt-toolbar.d.ts.map +1 -0
- package/dist/tt-toolbar.js +164 -0
- package/dist/tt-toolbar.js.map +1 -0
- package/dist/tt-tooltip.d.ts +42 -0
- package/dist/tt-tooltip.d.ts.map +1 -0
- package/dist/tt-tooltip.js +299 -0
- package/dist/tt-tooltip.js.map +1 -0
- package/package.json +84 -4
- package/vscode.html-custom-data.json +2911 -0
package/dist/tt-table.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
10
|
+
import "./tt-table-row.js";
|
|
11
|
+
import "./tt-table-cell.js";
|
|
12
|
+
/**
|
|
13
|
+
* A read-only table, written one of two ways.
|
|
14
|
+
*
|
|
15
|
+
* DATA: pass `columns` and `rows` and it draws a real table element.
|
|
16
|
+
* Fastest for text, and what every reference table in the docs uses.
|
|
17
|
+
*
|
|
18
|
+
* COMPOSED: leave `columns` empty and put `tt-table-row` elements inside,
|
|
19
|
+
* each holding `tt-table-cell` elements. A cell takes any component, so
|
|
20
|
+
* a checkbox, a badge or a button goes exactly where it is wanted.
|
|
21
|
+
*
|
|
22
|
+
* Both look the same. Columns win when both are given.
|
|
23
|
+
*/
|
|
24
|
+
let TTTable = class TTTable extends LitElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
// Generic so the same table renders properties, events and slots.
|
|
28
|
+
// Empty by default: a table guessing at columns is a docs table
|
|
29
|
+
// pretending to be a generic one.
|
|
30
|
+
this.columns = [];
|
|
31
|
+
this.rows = [];
|
|
32
|
+
/*
|
|
33
|
+
The table's name for screen readers, which announce it on entering
|
|
34
|
+
("Team members, table, 4 rows"). Optional: a heading right above the
|
|
35
|
+
table does the same job for sighted readers only.
|
|
36
|
+
*/
|
|
37
|
+
this.label = "";
|
|
38
|
+
/*
|
|
39
|
+
How many columns the composed grid has: the most cells in any row.
|
|
40
|
+
CSS cannot count, and a subgrid row can only span tracks its table
|
|
41
|
+
has declared, so the number has to be written into the template.
|
|
42
|
+
*/
|
|
43
|
+
this.columnCount = 1;
|
|
44
|
+
/*
|
|
45
|
+
Rows and cells come and go in the light DOM, two levels down. A
|
|
46
|
+
slotchange only reports the first level (rows), so a cell added to
|
|
47
|
+
a row would go unnoticed; a subtree observer sees both.
|
|
48
|
+
*/
|
|
49
|
+
this.observer = new MutationObserver(() => this.countColumns());
|
|
50
|
+
}
|
|
51
|
+
connectedCallback() {
|
|
52
|
+
super.connectedCallback();
|
|
53
|
+
this.countColumns();
|
|
54
|
+
this.observer.observe(this, { childList: true, subtree: true });
|
|
55
|
+
}
|
|
56
|
+
disconnectedCallback() {
|
|
57
|
+
super.disconnectedCallback();
|
|
58
|
+
this.observer.disconnect();
|
|
59
|
+
}
|
|
60
|
+
countColumns() {
|
|
61
|
+
let most = 1;
|
|
62
|
+
for (const row of this.children) {
|
|
63
|
+
if (row.localName === "tt-table-row")
|
|
64
|
+
most = Math.max(most, row.children.length);
|
|
65
|
+
}
|
|
66
|
+
this.columnCount = most;
|
|
67
|
+
}
|
|
68
|
+
static { this.styles = css `
|
|
69
|
+
:host {
|
|
70
|
+
display: block;
|
|
71
|
+
|
|
72
|
+
font-family: var(--tt-font-sans);
|
|
73
|
+
-webkit-font-smoothing: antialiased;
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
Not inherited, in effect. Set on this table it sizes this table's
|
|
77
|
+
columns; a table nested inside a cell would otherwise take its
|
|
78
|
+
parent's track list too. A value set on the element from outside
|
|
79
|
+
still wins, because outside rules beat :host.
|
|
80
|
+
*/
|
|
81
|
+
--tt-table-columns: initial;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([hidden]) {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.wrap {
|
|
89
|
+
width: 100%;
|
|
90
|
+
overflow-x: auto;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
|
|
93
|
+
border: 1px solid var(--tt-border);
|
|
94
|
+
border-radius: var(--tt-radius-lg);
|
|
95
|
+
|
|
96
|
+
-webkit-overflow-scrolling: touch;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
table {
|
|
100
|
+
width: 100%;
|
|
101
|
+
border-collapse: collapse;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
table,
|
|
105
|
+
.grid {
|
|
106
|
+
background: var(--tt-card);
|
|
107
|
+
color: var(--tt-muted-foreground);
|
|
108
|
+
|
|
109
|
+
font-size: var(--tt-text-sm);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
The composed table. Every row spans all the tracks and lays its
|
|
114
|
+
cells on them with subgrid, so a column is as wide as its widest
|
|
115
|
+
cell in any row. auto tracks share the spare width, and never
|
|
116
|
+
shrink below their content: past that, .wrap scrolls sideways.
|
|
117
|
+
*/
|
|
118
|
+
.grid {
|
|
119
|
+
display: grid;
|
|
120
|
+
grid-template-columns: var(--tt-table-columns, repeat(var(--_columns), auto));
|
|
121
|
+
|
|
122
|
+
/* Grows with columns that cannot shrink, so the surface and the
|
|
123
|
+
row borders reach the last column while scrolling. */
|
|
124
|
+
min-width: min-content;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Rows, and anything else put in, run the full width. */
|
|
128
|
+
::slotted(*) {
|
|
129
|
+
grid-column: 1 / -1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
th {
|
|
133
|
+
text-align: left;
|
|
134
|
+
|
|
135
|
+
/* Its own pair of tokens (tokens.css), so a colour theme can tint
|
|
136
|
+
the header without tinting every muted surface on the page. */
|
|
137
|
+
background: var(--tt-table-header);
|
|
138
|
+
color: var(--tt-table-header-foreground);
|
|
139
|
+
|
|
140
|
+
padding: var(--tt-space-3) var(--tt-space-4);
|
|
141
|
+
|
|
142
|
+
font-size: var(--tt-text-xs);
|
|
143
|
+
font-weight: var(--tt-weight-semibold);
|
|
144
|
+
|
|
145
|
+
text-transform: uppercase;
|
|
146
|
+
letter-spacing: 0.05em;
|
|
147
|
+
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
td {
|
|
152
|
+
padding: var(--tt-space-3) var(--tt-space-4);
|
|
153
|
+
|
|
154
|
+
border-top: 1px solid var(--tt-border);
|
|
155
|
+
|
|
156
|
+
color: var(--tt-muted-foreground);
|
|
157
|
+
|
|
158
|
+
vertical-align: top;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
tbody tr:hover {
|
|
162
|
+
background: var(--tt-accent);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* First column identifies the row. */
|
|
166
|
+
td:first-child {
|
|
167
|
+
color: var(--tt-foreground);
|
|
168
|
+
font-weight: var(--tt-weight-semibold);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
code {
|
|
172
|
+
font-family: var(--tt-font-mono);
|
|
173
|
+
font-size: var(--tt-text-xs);
|
|
174
|
+
|
|
175
|
+
background: var(--tt-muted);
|
|
176
|
+
color: var(--tt-foreground);
|
|
177
|
+
|
|
178
|
+
/* A chip: half a step tall, a full step wide, FIXED sm corners. */
|
|
179
|
+
padding: calc(var(--tt-space-1) / 2) var(--tt-space-2);
|
|
180
|
+
border-radius: var(--tt-radius-sm);
|
|
181
|
+
|
|
182
|
+
white-space: nowrap;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.muted {
|
|
186
|
+
opacity: 0.6;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@media (max-width: 480px) {
|
|
190
|
+
th,
|
|
191
|
+
td {
|
|
192
|
+
padding: var(--tt-space-2) var(--tt-space-3);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
table,
|
|
196
|
+
.grid {
|
|
197
|
+
font-size: var(--tt-text-xs);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
`; }
|
|
201
|
+
renderCell(column, row) {
|
|
202
|
+
const value = row[column.key];
|
|
203
|
+
if (value === undefined || value === "") {
|
|
204
|
+
return html `<span class="muted">-</span>`;
|
|
205
|
+
}
|
|
206
|
+
return column.code ? html `<code>${value}</code>` : value;
|
|
207
|
+
}
|
|
208
|
+
renderData() {
|
|
209
|
+
return html `
|
|
210
|
+
<table part="table" aria-label=${this.label || nothing}>
|
|
211
|
+
<thead>
|
|
212
|
+
<tr>
|
|
213
|
+
${this.columns.map((column) => html `<th>${column.label}</th>`)}
|
|
214
|
+
</tr>
|
|
215
|
+
</thead>
|
|
216
|
+
|
|
217
|
+
<tbody>
|
|
218
|
+
${this.rows.map((row) => html `
|
|
219
|
+
<tr>
|
|
220
|
+
${this.columns.map((column) => html `<td>${this.renderCell(column, row)}</td>`)}
|
|
221
|
+
</tr>
|
|
222
|
+
`)}
|
|
223
|
+
</tbody>
|
|
224
|
+
</table>
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
/*
|
|
228
|
+
A div with table roles rather than a table element. The HTML parser
|
|
229
|
+
moves a slot out of a table element, and a table's rows must be tr
|
|
230
|
+
elements anyway, so the rows and cells carry their roles on their
|
|
231
|
+
own hosts and this supplies the one that holds them.
|
|
232
|
+
*/
|
|
233
|
+
renderComposed() {
|
|
234
|
+
return html `
|
|
235
|
+
<div
|
|
236
|
+
class="grid"
|
|
237
|
+
part="table"
|
|
238
|
+
role="table"
|
|
239
|
+
aria-label=${this.label || nothing}
|
|
240
|
+
style=${styleMap({ "--_columns": String(this.columnCount) })}
|
|
241
|
+
>
|
|
242
|
+
<slot></slot>
|
|
243
|
+
</div>
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
render() {
|
|
247
|
+
return html `
|
|
248
|
+
<div class="wrap" part="wrap">
|
|
249
|
+
${this.columns.length > 0 ? this.renderData() : this.renderComposed()}
|
|
250
|
+
</div>
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
__decorate([
|
|
255
|
+
property({ type: Array })
|
|
256
|
+
], TTTable.prototype, "columns", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ type: Array })
|
|
259
|
+
], TTTable.prototype, "rows", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
property({ type: String })
|
|
262
|
+
], TTTable.prototype, "label", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
state()
|
|
265
|
+
], TTTable.prototype, "columnCount", void 0);
|
|
266
|
+
TTTable = __decorate([
|
|
267
|
+
customElement("tt-table")
|
|
268
|
+
], TTTable);
|
|
269
|
+
export { TTTable };
|
|
270
|
+
//# sourceMappingURL=tt-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-table.js","sourceRoot":"","sources":["../src/tt-table.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,oBAAoB,CAAC;AAY5B;;;;;;;;;;;GAWG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QACL,kEAAkE;QAClE,gEAAgE;QAChE,kCAAkC;QAElC,YAAO,GAAkB,EAAE,CAAC;QAG5B,SAAI,GAAe,EAAE,CAAC;QAEtB;;;;UAIE;QAEF,UAAK,GAAG,EAAE,CAAC;QAEX;;;;UAIE;QAEM,gBAAW,GAAG,CAAC,CAAC;QAExB;;;;UAIE;QACM,aAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAwNrE,CAAC;IAtNC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,E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,MAAM,CAAC,KAAK,OAAO,CAAC;;;;;YAK9D,IAAI,CAAC,IAAI,CAAC,GAAG,CACb,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;;kBAEP,IAAI,CAAC,OAAO,CAAC,GAAG,CAChB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAA,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAC3D;;aAEJ,CACF;;;KAGN,CAAC;IACJ,CAAC;IAED;;;;;MAKE;IACM,cAAc;QACpB,OAAO,IAAI,CAAA;;;;;qBAKM,IAAI,CAAC,KAAK,IAAI,OAAO;gBAC1B,QAAQ,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;;;;KAI/D,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;;KAExE,CAAC;IACJ,CAAC;;AAjPD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wCACE;AAG5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qCACJ;AAQtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAChB;AAQH;IADP,KAAK,EAAE;4CACgB;AAxBb,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAuPnB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export interface TabItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Tabbed sections. Panels are slotted by id, so the content lives with
|
|
9
|
+
* whoever is using the tabs rather than being passed in as data:
|
|
10
|
+
*
|
|
11
|
+
* <tt-tabs .tabs=${[{ id: "about", label: "About" }]} active="about">
|
|
12
|
+
* <div slot="about">...</div>
|
|
13
|
+
* </tt-tabs>
|
|
14
|
+
*
|
|
15
|
+
* Owns nothing. `active` comes in, a click emits the id you asked for.
|
|
16
|
+
*/
|
|
17
|
+
export declare class TTTabs extends LitElement {
|
|
18
|
+
tabs: TabItem[];
|
|
19
|
+
active: string;
|
|
20
|
+
private get current();
|
|
21
|
+
private select;
|
|
22
|
+
private handleKeydown;
|
|
23
|
+
static styles: import("lit").CSSResult;
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
"tt-tabs": TTTabs;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=tt-tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-tabs.d.ts","sourceRoot":"","sources":["../src/tt-tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,qBACa,MAAO,SAAQ,UAAU;IACT,IAAI,EAAE,OAAO,EAAE,CAAM;IAEpB,MAAM,SAAM;IAExC,OAAO,KAAK,OAAO,GAKlB;IAED,OAAO,CAAC,MAAM;IAiBd,OAAO,CAAC,aAAa;IA0CrB,MAAM,CAAC,MAAM,0BAoFX;IAEF,MAAM;CAgDP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
package/dist/tt-tabs.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
/**
|
|
11
|
+
* Tabbed sections. Panels are slotted by id, so the content lives with
|
|
12
|
+
* whoever is using the tabs rather than being passed in as data:
|
|
13
|
+
*
|
|
14
|
+
* <tt-tabs .tabs=${[{ id: "about", label: "About" }]} active="about">
|
|
15
|
+
* <div slot="about">...</div>
|
|
16
|
+
* </tt-tabs>
|
|
17
|
+
*
|
|
18
|
+
* Owns nothing. `active` comes in, a click emits the id you asked for.
|
|
19
|
+
*/
|
|
20
|
+
let TTTabs = class TTTabs extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.tabs = [];
|
|
24
|
+
this.active = "";
|
|
25
|
+
}
|
|
26
|
+
get current() {
|
|
27
|
+
// Fall back to the first tab, so an unset or stale id still renders
|
|
28
|
+
// something rather than an empty panel.
|
|
29
|
+
if (this.tabs.some((t) => t.id === this.active))
|
|
30
|
+
return this.active;
|
|
31
|
+
return this.tabs[0]?.id ?? "";
|
|
32
|
+
}
|
|
33
|
+
select(tab) {
|
|
34
|
+
if (tab.disabled || tab.id === this.current)
|
|
35
|
+
return;
|
|
36
|
+
this.dispatchEvent(new CustomEvent("tt-tab-change", {
|
|
37
|
+
detail: { id: tab.id },
|
|
38
|
+
bubbles: true,
|
|
39
|
+
composed: true,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
Arrow keys move between tabs, Home and End jump to the ends. This is
|
|
44
|
+
the expected behaviour for a tablist and it is what makes the
|
|
45
|
+
component usable without a mouse.
|
|
46
|
+
*/
|
|
47
|
+
handleKeydown(event) {
|
|
48
|
+
const keys = ["ArrowRight", "ArrowLeft", "Home", "End"];
|
|
49
|
+
if (!keys.includes(event.key))
|
|
50
|
+
return;
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
const index = this.tabs.findIndex((t) => t.id === this.current);
|
|
53
|
+
if (index === -1)
|
|
54
|
+
return;
|
|
55
|
+
let next = index;
|
|
56
|
+
if (event.key === "Home")
|
|
57
|
+
next = -1;
|
|
58
|
+
if (event.key === "End")
|
|
59
|
+
next = this.tabs.length;
|
|
60
|
+
const step = event.key === "ArrowLeft" ? -1 : event.key === "ArrowRight" ? 1 : 0;
|
|
61
|
+
if (step !== 0) {
|
|
62
|
+
for (let i = 0; i < this.tabs.length; i++) {
|
|
63
|
+
next = (next + step + this.tabs.length) % this.tabs.length;
|
|
64
|
+
if (!this.tabs[next].disabled)
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Home and End walk inward until they find an enabled tab.
|
|
70
|
+
const dir = event.key === "Home" ? 1 : -1;
|
|
71
|
+
do {
|
|
72
|
+
next += dir;
|
|
73
|
+
} while (this.tabs[next]?.disabled);
|
|
74
|
+
}
|
|
75
|
+
const tab = this.tabs[next];
|
|
76
|
+
if (!tab)
|
|
77
|
+
return;
|
|
78
|
+
this.select(tab);
|
|
79
|
+
this.updateComplete.then(() => {
|
|
80
|
+
const tabs = this.renderRoot?.querySelectorAll('[role="tab"]');
|
|
81
|
+
tabs?.[next]?.focus();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static { this.styles = css `
|
|
85
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
86
|
+
hidden element would still show. Important, so it always wins. */
|
|
87
|
+
:host([hidden]) {
|
|
88
|
+
display: none !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host {
|
|
92
|
+
display: block;
|
|
93
|
+
font-family: var(--tt-font-sans);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.list {
|
|
97
|
+
display: flex;
|
|
98
|
+
gap: var(--tt-space-1);
|
|
99
|
+
|
|
100
|
+
/* The line runs the full width behind the tabs, so the active tab
|
|
101
|
+
reads as sitting on top of it rather than floating. */
|
|
102
|
+
border-bottom: 1px solid var(--tt-border);
|
|
103
|
+
|
|
104
|
+
overflow-x: auto;
|
|
105
|
+
|
|
106
|
+
/* Setting overflow on one axis makes the other compute to auto, so
|
|
107
|
+
the tabs' -1px bottom margin was enough to raise a vertical
|
|
108
|
+
scrollbar. Pin it shut. */
|
|
109
|
+
overflow-y: hidden;
|
|
110
|
+
|
|
111
|
+
scrollbar-width: thin;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tab {
|
|
115
|
+
position: relative;
|
|
116
|
+
flex: 0 0 auto;
|
|
117
|
+
|
|
118
|
+
padding: var(--tt-space-3) var(--tt-space-4);
|
|
119
|
+
margin-bottom: -1px;
|
|
120
|
+
|
|
121
|
+
border: none;
|
|
122
|
+
border-bottom: 2px solid transparent;
|
|
123
|
+
background: transparent;
|
|
124
|
+
color: var(--tt-muted-foreground);
|
|
125
|
+
|
|
126
|
+
font: inherit;
|
|
127
|
+
font-size: var(--tt-text-sm);
|
|
128
|
+
font-weight: var(--tt-weight-medium);
|
|
129
|
+
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
|
|
133
|
+
transition:
|
|
134
|
+
color var(--tt-duration-normal) var(--tt-ease),
|
|
135
|
+
border-color var(--tt-duration-normal) var(--tt-ease);
|
|
136
|
+
/* Long-press should activate the control, not start selecting
|
|
137
|
+
its label. The other half of the mobile blue flash: the tap
|
|
138
|
+
highlight is the flash, this is the drag-select. */
|
|
139
|
+
-webkit-user-select: none;
|
|
140
|
+
user-select: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tab:hover:not(:disabled) {
|
|
144
|
+
color: var(--tt-foreground);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.tab[aria-selected="true"] {
|
|
148
|
+
color: var(--tt-foreground);
|
|
149
|
+
border-bottom-color: var(--tt-primary);
|
|
150
|
+
font-weight: var(--tt-weight-semibold);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.tab:disabled {
|
|
154
|
+
opacity: var(--tt-opacity-disabled);
|
|
155
|
+
cursor: not-allowed;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.tab:focus-visible {
|
|
159
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
160
|
+
outline-offset: var(--tt-ring-offset);
|
|
161
|
+
border-radius: var(--tt-radius-sm) var(--tt-radius-sm) 0 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.panel {
|
|
165
|
+
padding-top: var(--tt-space-5);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
`; }
|
|
169
|
+
render() {
|
|
170
|
+
const current = this.current;
|
|
171
|
+
return html `
|
|
172
|
+
<div
|
|
173
|
+
class="list"
|
|
174
|
+
part="list"
|
|
175
|
+
role="tablist"
|
|
176
|
+
@keydown=${this.handleKeydown}
|
|
177
|
+
>
|
|
178
|
+
${this.tabs.map((tab) => html `
|
|
179
|
+
<button
|
|
180
|
+
class="tab"
|
|
181
|
+
part="tab"
|
|
182
|
+
role="tab"
|
|
183
|
+
id=${`tab-${tab.id}`}
|
|
184
|
+
aria-selected=${tab.id === current ? "true" : "false"}
|
|
185
|
+
aria-controls=${ifDefined(tab.id === current ? `panel-${tab.id}` : undefined)}
|
|
186
|
+
tabindex=${tab.id === current ? 0 : -1}
|
|
187
|
+
?disabled=${tab.disabled}
|
|
188
|
+
@click=${() => this.select(tab)}
|
|
189
|
+
>
|
|
190
|
+
${tab.label}
|
|
191
|
+
</button>
|
|
192
|
+
`)}
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<!--
|
|
196
|
+
Only the active panel is rendered. Rendering all of them and
|
|
197
|
+
hiding the rest would mean hidden form fields still submitting,
|
|
198
|
+
and hidden charts still measuring themselves at zero width.
|
|
199
|
+
-->
|
|
200
|
+
<div
|
|
201
|
+
class="panel"
|
|
202
|
+
part="panel"
|
|
203
|
+
role="tabpanel"
|
|
204
|
+
id=${`panel-${current}`}
|
|
205
|
+
aria-labelledby=${`tab-${current}`}
|
|
206
|
+
tabindex="0"
|
|
207
|
+
>
|
|
208
|
+
<slot name=${current}></slot>
|
|
209
|
+
</div>
|
|
210
|
+
`;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: Array })
|
|
215
|
+
], TTTabs.prototype, "tabs", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ type: String })
|
|
218
|
+
], TTTabs.prototype, "active", void 0);
|
|
219
|
+
TTTabs = __decorate([
|
|
220
|
+
customElement("tt-tabs")
|
|
221
|
+
], TTTabs);
|
|
222
|
+
export { TTTabs };
|
|
223
|
+
//# sourceMappingURL=tt-tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-tabs.js","sourceRoot":"","sources":["../src/tt-tabs.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAQzD;;;;;;;;;GASG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAA/B;;QACsB,S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,MAAM,CA6MlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "./tt-badge.js";
|
|
3
|
+
export declare class TTTagList extends LitElement {
|
|
4
|
+
tags: string[];
|
|
5
|
+
max: number;
|
|
6
|
+
expandable: boolean;
|
|
7
|
+
private expanded;
|
|
8
|
+
private get visibleTags();
|
|
9
|
+
private get hiddenCount();
|
|
10
|
+
private expand;
|
|
11
|
+
static styles: import("lit").CSSResult;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
}
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
"tt-tag-list": TTTagList;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tt-tag-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-tag-list.d.ts","sourceRoot":"","sources":["../src/tt-tag-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,eAAe,CAAC;AAEvB,qBACa,SAAU,SAAQ,UAAU;IACZ,IAAI,EAAE,MAAM,EAAE,CAAM;IAKnB,GAAG,SAAK;IAGP,UAAU,UAAS;IAGvC,OAAO,CAAC,QAAQ,CAAS;IAElC,OAAO,KAAK,WAAW,GAOtB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,CAAC,MAAM;IAId,MAAM,CAAC,MAAM,0BA2DX;IAEF,MAAM;CAwBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,SAAS,CAAC;KAC1B;CACF"}
|