@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
|
@@ -0,0 +1,203 @@
|
|
|
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 { property, customElement } from "lit/decorators.js";
|
|
9
|
+
import "./tt-button.js";
|
|
10
|
+
import "./tt-code-block.js";
|
|
11
|
+
let TTSwitcher = class TTSwitcher extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.items = [];
|
|
15
|
+
this.activeIndex = 0;
|
|
16
|
+
}
|
|
17
|
+
// When the row is scrolled, the selected tab can sit off-screen after a
|
|
18
|
+
// change made in code rather than by a click. Bring it back into view.
|
|
19
|
+
updated(changed) {
|
|
20
|
+
if (!changed.has("activeIndex"))
|
|
21
|
+
return;
|
|
22
|
+
const tab = this.renderRoot.querySelectorAll("tt-button")[this.activeIndex];
|
|
23
|
+
tab?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
24
|
+
}
|
|
25
|
+
static { this.styles = css `
|
|
26
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
27
|
+
hidden element would still show. Important, so it always wins. */
|
|
28
|
+
:host([hidden]) {
|
|
29
|
+
display: none !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host {
|
|
33
|
+
display: block;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.container {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: var(--tt-space-4);
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
The tab row turns into a horizontal slider on its own once the tabs
|
|
46
|
+
no longer fit. overflow-x does the scrolling, but it only kicks in
|
|
47
|
+
because the tabs refuse to shrink (see .tabs > tt-button below) -
|
|
48
|
+
flex items shrink by default, so without that they would squash to
|
|
49
|
+
fit and nothing would ever overflow.
|
|
50
|
+
*/
|
|
51
|
+
.tabs {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: 6px;
|
|
55
|
+
|
|
56
|
+
width: 100%;
|
|
57
|
+
|
|
58
|
+
overflow-x: auto;
|
|
59
|
+
overflow-y: hidden;
|
|
60
|
+
|
|
61
|
+
/* Room for the scrollbar so it never overlaps the tabs. */
|
|
62
|
+
padding-bottom: var(--tt-space-2);
|
|
63
|
+
|
|
64
|
+
/* Slider feel: snap to whole tabs, animate programmatic scrolls,
|
|
65
|
+
and keep a horizontal swipe from triggering browser back. */
|
|
66
|
+
scroll-snap-type: x proximity;
|
|
67
|
+
scroll-behavior: smooth;
|
|
68
|
+
scroll-padding-inline: var(--tt-space-1);
|
|
69
|
+
overscroll-behavior-x: contain;
|
|
70
|
+
-webkit-overflow-scrolling: touch;
|
|
71
|
+
|
|
72
|
+
/* A visible bar, so the row is obviously draggable with a mouse.
|
|
73
|
+
It only appears when the tabs actually overflow. Firefox. */
|
|
74
|
+
scrollbar-width: thin;
|
|
75
|
+
scrollbar-color: var(--tt-border) transparent;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Chromium and Safari */
|
|
79
|
+
.tabs::-webkit-scrollbar {
|
|
80
|
+
height: 8px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.tabs::-webkit-scrollbar-track {
|
|
84
|
+
background: var(--tt-muted);
|
|
85
|
+
border-radius: var(--tt-radius-full);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.tabs::-webkit-scrollbar-thumb {
|
|
89
|
+
background: color-mix(
|
|
90
|
+
in srgb,
|
|
91
|
+
var(--tt-muted-foreground) 45%,
|
|
92
|
+
transparent
|
|
93
|
+
);
|
|
94
|
+
border-radius: var(--tt-radius-full);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.tabs::-webkit-scrollbar-thumb:hover {
|
|
98
|
+
background: var(--tt-muted-foreground);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Keep each tab at its natural width so the row can overflow. */
|
|
102
|
+
.tabs > tt-button {
|
|
103
|
+
flex: 0 0 auto;
|
|
104
|
+
scroll-snap-align: start;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Not a duration, so tokens cannot reach it: smooth scrolling is its own
|
|
108
|
+
property. Everything else is handled centrally in tokens.css. */
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
.tabs {
|
|
111
|
+
scroll-behavior: auto;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.content {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: var(--tt-space-3);
|
|
119
|
+
width: 100%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.description {
|
|
123
|
+
margin: 0;
|
|
124
|
+
color: var(--tt-muted-foreground);
|
|
125
|
+
font-size: var(--tt-text-sm);
|
|
126
|
+
line-height: var(--tt-leading-relaxed);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
tt-code-block {
|
|
130
|
+
display: block;
|
|
131
|
+
width: 100%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@media (max-width: 480px) {
|
|
135
|
+
.container {
|
|
136
|
+
gap: var(--tt-space-3);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.tabs {
|
|
140
|
+
gap: 4px;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`; }
|
|
144
|
+
render() {
|
|
145
|
+
const activeItem = this.items[this.activeIndex];
|
|
146
|
+
return html `
|
|
147
|
+
<div class="container">
|
|
148
|
+
|
|
149
|
+
<!--
|
|
150
|
+
Not a tablist: role="tab" was set on the tt-button HOST, which
|
|
151
|
+
wraps a real <button>, so a screen reader met a "tab" with a
|
|
152
|
+
button inside it and none of the tab keyboard behaviour. The
|
|
153
|
+
chosen one is marked current on the inner button instead.
|
|
154
|
+
-->
|
|
155
|
+
<div class="tabs" part="tabs" role="group" aria-label="Examples">
|
|
156
|
+
${this.items.map((item, index) => html `
|
|
157
|
+
<tt-button
|
|
158
|
+
variant=${index === this.activeIndex ? "primary" : "secondary"}
|
|
159
|
+
size="small"
|
|
160
|
+
current=${index === this.activeIndex ? "true" : ""}
|
|
161
|
+
@tt-button-click=${() => (this.activeIndex = index)}
|
|
162
|
+
>
|
|
163
|
+
${item.title}
|
|
164
|
+
</tt-button>
|
|
165
|
+
`)}
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
${activeItem
|
|
169
|
+
? html `
|
|
170
|
+
<div class="content" part="content">
|
|
171
|
+
${activeItem.description
|
|
172
|
+
? html `
|
|
173
|
+
<p class="description">${activeItem.description}</p>
|
|
174
|
+
`
|
|
175
|
+
: ""}
|
|
176
|
+
|
|
177
|
+
${activeItem.code
|
|
178
|
+
? html `
|
|
179
|
+
<tt-code-block show-line-numbers
|
|
180
|
+
.code=${activeItem.code}
|
|
181
|
+
language=${activeItem.language ?? ""}
|
|
182
|
+
></tt-code-block>
|
|
183
|
+
`
|
|
184
|
+
: ""}
|
|
185
|
+
</div>
|
|
186
|
+
`
|
|
187
|
+
: ""}
|
|
188
|
+
|
|
189
|
+
</div>
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
__decorate([
|
|
194
|
+
property({ type: Array })
|
|
195
|
+
], TTSwitcher.prototype, "items", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: Number, attribute: "active-index" })
|
|
198
|
+
], TTSwitcher.prototype, "activeIndex", void 0);
|
|
199
|
+
TTSwitcher = __decorate([
|
|
200
|
+
customElement("tt-switcher")
|
|
201
|
+
], TTSwitcher);
|
|
202
|
+
export { TTSwitcher };
|
|
203
|
+
//# sourceMappingURL=tt-switcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-switcher.js","sourceRoot":"","sources":["../src/tt-switcher.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAUrB,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAEL,UAAK,GAAmB,EAAE,CAAC;QAG3B,gBAAW,GAAG,CAAC,CAAC;IAyLlB,CAAC;IAvLC,wEAAwE;IACxE,uEAAuE;IACvE,OAAO,CAAC,OAAuB;QAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;YAAE,OAAO;QAExC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC,CACvD,IAAI,CAAC,WAAW,CACjB,CAAC;QAEF,GAAG,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/D,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsHlB,AAtHY,CAsHX;IAEF,MAAM;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhD,OAAO,IAAI,CAAA;;;;;;;;;;YAUH,IAAI,CAAC,KAAK,CAAC,GAAG,CACd,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;0BAEP,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;;0BAEpD,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;mCAC/B,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;;kBAEjD,IAAI,CAAC,KAAK;;aAEf,CACF;;;UAGD,UAAU;YACV,CAAC,CAAC,IAAI,CAAA;;kBAEE,UAAU,CAAC,WAAW;gBACtB,CAAC,CAAC,IAAI,CAAA;+CACuB,UAAU,CAAC,WAAW;qBAChD;gBACH,CAAC,CAAC,EAAE;;kBAEJ,UAAU,CAAC,IAAI;gBACf,CAAC,CAAC,IAAI,CAAA;;gCAEQ,UAAU,CAAC,IAAI;mCACZ,UAAU,CAAC,QAAQ,IAAI,EAAE;;qBAEvC;gBACH,CAAC,CAAC,EAAE;;aAET;YACH,CAAC,CAAC,EAAE;;;KAGT,CAAC;IACJ,CAAC;;AA3LD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yCACC;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;+CACtC;AALL,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8LtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type TableCellAlign = "start" | "center" | "end";
|
|
3
|
+
/**
|
|
4
|
+
* One cell of a composed `tt-table`, inside a `tt-table-row`.
|
|
5
|
+
*
|
|
6
|
+
* It takes anything: text, a badge, a checkbox, a button, another
|
|
7
|
+
* component. The cell only supplies what every cell needs, the padding,
|
|
8
|
+
* the vertical centring and the alignment, so the content never has to
|
|
9
|
+
* know it is in a table.
|
|
10
|
+
*
|
|
11
|
+
* `header` makes it a column heading, for screen readers as well as on
|
|
12
|
+
* screen, the same as a th in a plain table.
|
|
13
|
+
*/
|
|
14
|
+
export declare class TTTableCell extends LitElement {
|
|
15
|
+
header: boolean;
|
|
16
|
+
align: TableCellAlign;
|
|
17
|
+
protected willUpdate(): void;
|
|
18
|
+
static styles: import("lit").CSSResult;
|
|
19
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
"tt-table-cell": TTTableCell;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=tt-table-cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-table-cell.d.ts","sourceRoot":"","sources":["../src/tt-table-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExD;;;;;;;;;;GAUG;AACH,qBACa,WAAY,SAAQ,UAAU;IAMzC,MAAM,UAAS;IAOf,KAAK,EAAE,cAAc,CAAW;IAEhC,SAAS,CAAC,UAAU;IAYpB,MAAM,CAAC,MAAM,0BA6DX;IAEF,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,WAAW,CAAC;KAC9B;CACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* One cell of a composed `tt-table`, inside a `tt-table-row`.
|
|
11
|
+
*
|
|
12
|
+
* It takes anything: text, a badge, a checkbox, a button, another
|
|
13
|
+
* component. The cell only supplies what every cell needs, the padding,
|
|
14
|
+
* the vertical centring and the alignment, so the content never has to
|
|
15
|
+
* know it is in a table.
|
|
16
|
+
*
|
|
17
|
+
* `header` makes it a column heading, for screen readers as well as on
|
|
18
|
+
* screen, the same as a th in a plain table.
|
|
19
|
+
*/
|
|
20
|
+
let TTTableCell = class TTTableCell extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
/*
|
|
24
|
+
A column heading. Reflected, because the heading look is a
|
|
25
|
+
:host([header]) rule and a selector only sees attributes.
|
|
26
|
+
*/
|
|
27
|
+
this.header = false;
|
|
28
|
+
/*
|
|
29
|
+
Where the content sits across the cell. End for numbers, so the
|
|
30
|
+
digits of a column of amounts line up.
|
|
31
|
+
*/
|
|
32
|
+
this.align = "start";
|
|
33
|
+
}
|
|
34
|
+
willUpdate() {
|
|
35
|
+
/*
|
|
36
|
+
The role follows header, so it is set on every update rather than
|
|
37
|
+
once. Only a role this cell set itself is replaced: an author who
|
|
38
|
+
wrote role="rowheader" keeps it.
|
|
39
|
+
*/
|
|
40
|
+
const role = this.getAttribute("role");
|
|
41
|
+
if (role === null || role === "cell" || role === "columnheader") {
|
|
42
|
+
this.setAttribute("role", this.header ? "columnheader" : "cell");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static { this.styles = css `
|
|
46
|
+
:host {
|
|
47
|
+
/*
|
|
48
|
+
Flex only to centre the content vertically. The content itself
|
|
49
|
+
sits in one wrapper below, so text and inline components keep
|
|
50
|
+
flowing as one line instead of each becoming a flex item.
|
|
51
|
+
*/
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
|
|
55
|
+
padding: var(--tt-space-3) var(--tt-space-4);
|
|
56
|
+
|
|
57
|
+
text-align: start;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([hidden]) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([align="center"]) {
|
|
65
|
+
text-align: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([align="end"]) {
|
|
69
|
+
text-align: end;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* The first column identifies the row, as in the data table. */
|
|
73
|
+
:host(:first-child:not([header])) {
|
|
74
|
+
color: var(--tt-foreground);
|
|
75
|
+
font-weight: var(--tt-weight-semibold);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([header]) {
|
|
79
|
+
/* The same pair as tt-table's data-mode header. */
|
|
80
|
+
background: var(--tt-table-header);
|
|
81
|
+
color: var(--tt-table-header-foreground);
|
|
82
|
+
|
|
83
|
+
font-size: var(--tt-text-xs);
|
|
84
|
+
font-weight: var(--tt-weight-semibold);
|
|
85
|
+
|
|
86
|
+
text-transform: uppercase;
|
|
87
|
+
letter-spacing: 0.05em;
|
|
88
|
+
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
Fills the cell, so a block component (a progress bar, a field)
|
|
94
|
+
takes the column's width and inline ones (a badge, a checkbox)
|
|
95
|
+
follow text-align.
|
|
96
|
+
*/
|
|
97
|
+
.content {
|
|
98
|
+
flex: 1 1 auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (max-width: 480px) {
|
|
102
|
+
:host {
|
|
103
|
+
padding: var(--tt-space-2) var(--tt-space-3);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`; }
|
|
107
|
+
render() {
|
|
108
|
+
return html `<div class="content" part="content"><slot></slot></div>`;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: Boolean, reflect: true })
|
|
113
|
+
], TTTableCell.prototype, "header", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
property({ type: String, reflect: true })
|
|
116
|
+
], TTTableCell.prototype, "align", void 0);
|
|
117
|
+
TTTableCell = __decorate([
|
|
118
|
+
customElement("tt-table-cell")
|
|
119
|
+
], TTTableCell);
|
|
120
|
+
export { TTTableCell };
|
|
121
|
+
//# sourceMappingURL=tt-table-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-table-cell.js","sourceRoot":"","sources":["../src/tt-table-cell.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;AAI5D;;;;;;;;;;GAUG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QACL;;;UAGE;QAEF,WAAM,GAAG,KAAK,CAAC;QAEf;;;UAGE;QAEF,UAAK,GAAmB,OAAO,CAAC;IAgFlC,CAAC;IA9EW,UAAU;QAClB;;;;UAIE;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;YAChE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DlB,AA7DY,CA6DX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA,yDAAyD,CAAC;IACvE,CAAC;;AAtFD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAC5B;AAOf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACV;AAbrB,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA6FvB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* One row of a composed `tt-table`. Holds `tt-table-cell` elements.
|
|
4
|
+
*
|
|
5
|
+
* It has no settings. Its whole job is to be a row twice over: a row to
|
|
6
|
+
* a screen reader (role="row") and a row of the table's grid, through
|
|
7
|
+
* `grid-template-columns: subgrid`. Subgrid is what makes the columns
|
|
8
|
+
* line up. Each row lays its cells on the TABLE's column tracks rather
|
|
9
|
+
* than its own, so a wide cell in one row widens that column in every
|
|
10
|
+
* row, the way a real table does.
|
|
11
|
+
*
|
|
12
|
+
* <tt-table>
|
|
13
|
+
* <tt-table-row>
|
|
14
|
+
* <tt-table-cell header>Name</tt-table-cell>
|
|
15
|
+
* </tt-table-row>
|
|
16
|
+
* <tt-table-row>
|
|
17
|
+
* <tt-table-cell>Ada Lovelace</tt-table-cell>
|
|
18
|
+
* </tt-table-row>
|
|
19
|
+
* </tt-table>
|
|
20
|
+
*/
|
|
21
|
+
export declare class TTTableRow extends LitElement {
|
|
22
|
+
connectedCallback(): void;
|
|
23
|
+
static styles: import("lit").CSSResult;
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
"tt-table-row": TTTableRow;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=tt-table-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-table-row.d.ts","sourceRoot":"","sources":["../src/tt-table-row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,iBAAiB;IAUjB,MAAM,CAAC,MAAM,0BAwBX;IAEF,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,UAAU,CAAC;KAC5B;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 } from "lit/decorators.js";
|
|
9
|
+
/**
|
|
10
|
+
* One row of a composed `tt-table`. Holds `tt-table-cell` elements.
|
|
11
|
+
*
|
|
12
|
+
* It has no settings. Its whole job is to be a row twice over: a row to
|
|
13
|
+
* a screen reader (role="row") and a row of the table's grid, through
|
|
14
|
+
* `grid-template-columns: subgrid`. Subgrid is what makes the columns
|
|
15
|
+
* line up. Each row lays its cells on the TABLE's column tracks rather
|
|
16
|
+
* than its own, so a wide cell in one row widens that column in every
|
|
17
|
+
* row, the way a real table does.
|
|
18
|
+
*
|
|
19
|
+
* <tt-table>
|
|
20
|
+
* <tt-table-row>
|
|
21
|
+
* <tt-table-cell header>Name</tt-table-cell>
|
|
22
|
+
* </tt-table-row>
|
|
23
|
+
* <tt-table-row>
|
|
24
|
+
* <tt-table-cell>Ada Lovelace</tt-table-cell>
|
|
25
|
+
* </tt-table-row>
|
|
26
|
+
* </tt-table>
|
|
27
|
+
*/
|
|
28
|
+
let TTTableRow = class TTTableRow extends LitElement {
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
super.connectedCallback();
|
|
31
|
+
/*
|
|
32
|
+
The role goes on the host itself, because the host is what sits
|
|
33
|
+
between the table and its cells in the accessibility tree. An
|
|
34
|
+
author's own role is left alone.
|
|
35
|
+
*/
|
|
36
|
+
if (!this.hasAttribute("role"))
|
|
37
|
+
this.setAttribute("role", "row");
|
|
38
|
+
}
|
|
39
|
+
static { this.styles = css `
|
|
40
|
+
:host {
|
|
41
|
+
/*
|
|
42
|
+
No grid-column here: tt-table places every child it holds, so
|
|
43
|
+
placement is decided once by the thing that owns the grid.
|
|
44
|
+
*/
|
|
45
|
+
display: grid;
|
|
46
|
+
grid-template-columns: subgrid;
|
|
47
|
+
|
|
48
|
+
border-top: 1px solid var(--tt-border);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* The table's own border already closes the top edge. */
|
|
52
|
+
:host(:first-child) {
|
|
53
|
+
border-top: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host(:hover) {
|
|
57
|
+
background: var(--tt-accent);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([hidden]) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
`; }
|
|
64
|
+
render() {
|
|
65
|
+
return html `<slot></slot>`;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
TTTableRow = __decorate([
|
|
69
|
+
customElement("tt-table-row")
|
|
70
|
+
], TTTableRow);
|
|
71
|
+
export { TTTableRow };
|
|
72
|
+
//# sourceMappingURL=tt-table-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-table-row.js","sourceRoot":"","sources":["../src/tt-table-row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IACxC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B;;;;UAIE;QACF,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBlB,AAxBY,CAwBX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAvCU,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAwCtB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { TemplateResult } from "lit";
|
|
3
|
+
import "./tt-table-row.js";
|
|
4
|
+
import "./tt-table-cell.js";
|
|
5
|
+
export interface TableColumn {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
code?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type TableCell = string | number | TemplateResult;
|
|
11
|
+
export type TableRow = Record<string, TableCell>;
|
|
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
|
+
export declare class TTTable extends LitElement {
|
|
25
|
+
columns: TableColumn[];
|
|
26
|
+
rows: TableRow[];
|
|
27
|
+
label: string;
|
|
28
|
+
private columnCount;
|
|
29
|
+
private observer;
|
|
30
|
+
connectedCallback(): void;
|
|
31
|
+
disconnectedCallback(): void;
|
|
32
|
+
private countColumns;
|
|
33
|
+
static styles: import("lit").CSSResult;
|
|
34
|
+
private renderCell;
|
|
35
|
+
private renderData;
|
|
36
|
+
private renderComposed;
|
|
37
|
+
render(): TemplateResult<1>;
|
|
38
|
+
}
|
|
39
|
+
declare global {
|
|
40
|
+
interface HTMLElementTagNameMap {
|
|
41
|
+
"tt-table": TTTable;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=tt-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-table.d.ts","sourceRoot":"","sources":["../src/tt-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI1C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,oBAAoB,CAAC;AAE5B,MAAM,WAAW,WAAW;IAE1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AACD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,qBACa,OAAQ,SAAQ,UAAU;IAKrC,OAAO,EAAE,WAAW,EAAE,CAAM;IAG5B,IAAI,EAAE,QAAQ,EAAE,CAAM;IAQtB,KAAK,SAAM;IAQX,OAAO,CAAC,WAAW,CAAK;IAOxB,OAAO,CAAC,QAAQ,CAAmD;IAEnE,iBAAiB;IAMjB,oBAAoB;IAKpB,OAAO,CAAC,YAAY;IAQpB,MAAM,CAAC,MAAM,0BAoIX;IAEF,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,UAAU;IA8BlB,OAAO,CAAC,cAAc;IActB,MAAM;CAOP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|