@tartaguti/ui-components 0.0.0-stage → 0.1.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 +7 -0
- package/LICENSE +21 -0
- package/README.md +192 -2
- package/THIRD-PARTY-NOTICES.md +29 -0
- package/custom-elements.json +16731 -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 +69 -0
- package/dist/tt-data-table.d.ts.map +1 -0
- package/dist/tt-data-table.js +542 -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 +2907 -0
|
@@ -0,0 +1,169 @@
|
|
|
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, state } from "lit/decorators.js";
|
|
9
|
+
/**
|
|
10
|
+
* Image with an initials fallback. The fallback is the entire point:
|
|
11
|
+
* logos and profile photos fail to load constantly, and a broken image
|
|
12
|
+
* icon is the difference between a product that looks maintained and one
|
|
13
|
+
* that does not.
|
|
14
|
+
*/
|
|
15
|
+
let TTAvatar = class TTAvatar extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.src = "";
|
|
19
|
+
// Used for the initials and for the alt text.
|
|
20
|
+
this.name = "";
|
|
21
|
+
this.size = "medium";
|
|
22
|
+
this.square = false;
|
|
23
|
+
this.failed = false;
|
|
24
|
+
}
|
|
25
|
+
// Reset the failure flag when a new src arrives, or a broken image
|
|
26
|
+
// would poison every later one.
|
|
27
|
+
updated(changed) {
|
|
28
|
+
if (changed.has("src"))
|
|
29
|
+
this.failed = false;
|
|
30
|
+
}
|
|
31
|
+
/*
|
|
32
|
+
First letters of the first and last words: "Adriatik Logistics" -> AL,
|
|
33
|
+
"Ana" -> A. Two letters is the most that fits legibly at small sizes.
|
|
34
|
+
*/
|
|
35
|
+
get initials() {
|
|
36
|
+
const words = this.name.trim().split(/\s+/).filter(Boolean);
|
|
37
|
+
if (words.length === 0)
|
|
38
|
+
return "?";
|
|
39
|
+
const first = words[0][0];
|
|
40
|
+
const last = words.length > 1 ? words[words.length - 1][0] : "";
|
|
41
|
+
return (first + last).toUpperCase();
|
|
42
|
+
}
|
|
43
|
+
/*
|
|
44
|
+
A stable colour per name, so the same company is always the same
|
|
45
|
+
shade. Hashing the string means no state and no lookup table, and it
|
|
46
|
+
stays consistent across reloads and machines.
|
|
47
|
+
*/
|
|
48
|
+
get tone() {
|
|
49
|
+
let hash = 0;
|
|
50
|
+
for (const char of this.name) {
|
|
51
|
+
hash = (hash * 31 + char.charCodeAt(0)) % 360;
|
|
52
|
+
}
|
|
53
|
+
return hash;
|
|
54
|
+
}
|
|
55
|
+
static { this.styles = css `
|
|
56
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
57
|
+
hidden element would still show. Important, so it always wins. */
|
|
58
|
+
:host([hidden]) {
|
|
59
|
+
display: none !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host {
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
flex: 0 0 auto;
|
|
65
|
+
|
|
66
|
+
--_size: 40px;
|
|
67
|
+
--_text: var(--tt-text-sm);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([size="small"]) {
|
|
71
|
+
--_size: 28px;
|
|
72
|
+
--_text: var(--tt-text-xs);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([size="large"]) {
|
|
76
|
+
--_size: 64px;
|
|
77
|
+
--_text: var(--tt-text-lg);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.avatar {
|
|
81
|
+
position: relative;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
|
|
84
|
+
width: var(--_size);
|
|
85
|
+
height: var(--_size);
|
|
86
|
+
|
|
87
|
+
border-radius: var(--tt-radius-full);
|
|
88
|
+
background: var(--tt-muted);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host([square]) .avatar {
|
|
92
|
+
border-radius: var(--tt-radius);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
img {
|
|
96
|
+
display: block;
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
object-fit: cover;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.initials {
|
|
103
|
+
display: grid;
|
|
104
|
+
place-content: center;
|
|
105
|
+
|
|
106
|
+
width: 100%;
|
|
107
|
+
height: 100%;
|
|
108
|
+
|
|
109
|
+
/* oklch from a hashed hue: consistent lightness and chroma across
|
|
110
|
+
every name, so no avatar is unreadably dark or washed out. */
|
|
111
|
+
background: oklch(0.72 0.11 var(--_hue));
|
|
112
|
+
color: oklch(0.25 0.06 var(--_hue));
|
|
113
|
+
|
|
114
|
+
font-size: var(--_text);
|
|
115
|
+
font-weight: var(--tt-weight-semibold);
|
|
116
|
+
letter-spacing: 0.02em;
|
|
117
|
+
user-select: none;
|
|
118
|
+
}
|
|
119
|
+
`; }
|
|
120
|
+
render() {
|
|
121
|
+
const showImage = this.src && !this.failed;
|
|
122
|
+
return html `
|
|
123
|
+
<div class="avatar" part="avatar">
|
|
124
|
+
${showImage
|
|
125
|
+
? html `
|
|
126
|
+
<img
|
|
127
|
+
part="image"
|
|
128
|
+
src=${this.src}
|
|
129
|
+
alt=${this.name}
|
|
130
|
+
loading="lazy"
|
|
131
|
+
decoding="async"
|
|
132
|
+
@error=${() => (this.failed = true)}
|
|
133
|
+
/>
|
|
134
|
+
`
|
|
135
|
+
: html `
|
|
136
|
+
<div
|
|
137
|
+
class="initials"
|
|
138
|
+
part="initials"
|
|
139
|
+
style=${`--_hue:${this.tone}`}
|
|
140
|
+
role="img"
|
|
141
|
+
aria-label=${this.name || "Unknown"}
|
|
142
|
+
>
|
|
143
|
+
${this.initials}
|
|
144
|
+
</div>
|
|
145
|
+
`}
|
|
146
|
+
</div>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
__decorate([
|
|
151
|
+
property({ type: String })
|
|
152
|
+
], TTAvatar.prototype, "src", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
property({ type: String })
|
|
155
|
+
], TTAvatar.prototype, "name", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: String, reflect: true })
|
|
158
|
+
], TTAvatar.prototype, "size", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
property({ type: Boolean, reflect: true })
|
|
161
|
+
], TTAvatar.prototype, "square", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
state()
|
|
164
|
+
], TTAvatar.prototype, "failed", void 0);
|
|
165
|
+
TTAvatar = __decorate([
|
|
166
|
+
customElement("tt-avatar")
|
|
167
|
+
], TTAvatar);
|
|
168
|
+
export { TTAvatar };
|
|
169
|
+
//# sourceMappingURL=tt-avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-avatar.js","sourceRoot":"","sources":["../src/tt-avatar.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type BadgeVariant = "neutral" | "success" | "warning" | "danger";
|
|
3
|
+
export type BadgeSize = "small" | "medium";
|
|
4
|
+
/**
|
|
5
|
+
* A small status label. Presentational only: it displays state, it never
|
|
6
|
+
* owns it.
|
|
7
|
+
*
|
|
8
|
+
* THREE THINGS THAT WERE WRONG AND ARE WORTH KNOWING.
|
|
9
|
+
*
|
|
10
|
+
* line-height was 1.5. On a pill that is not a paragraph, an inherited
|
|
11
|
+
* body line-height adds invisible space above and below the text, so the
|
|
12
|
+
* badge came out taller than it looked and sat off-centre next to a name.
|
|
13
|
+
* A pill sets line-height: 1 and gets its height from padding, which is
|
|
14
|
+
* the only way the height is predictable.
|
|
15
|
+
*
|
|
16
|
+
* neutral was --tt-muted-foreground mixed 14% into transparent, which is
|
|
17
|
+
* a grey wash of a grey. Neutral is the most common variant and it looked
|
|
18
|
+
* like a rendering mistake. It now uses the real muted surface.
|
|
19
|
+
*
|
|
20
|
+
* white-space: nowrap with no escape meant a long label pushed its way
|
|
21
|
+
* out of whatever contained it. It still refuses to wrap, because a badge
|
|
22
|
+
* that wraps stops being a badge, but it now truncates instead of
|
|
23
|
+
* overflowing.
|
|
24
|
+
*/
|
|
25
|
+
export declare class TTBadge extends LitElement {
|
|
26
|
+
variant: BadgeVariant;
|
|
27
|
+
size: BadgeSize;
|
|
28
|
+
static styles: import("lit").CSSResult;
|
|
29
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
30
|
+
}
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
"tt-badge": TTBadge;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=tt-badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-badge.d.ts","sourceRoot":"","sources":["../src/tt-badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AACxE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,OAAQ,SAAQ,UAAU;IACM,OAAO,EAAE,YAAY,CAAa;IAElC,IAAI,EAAE,SAAS,CAAY;IAEtE,MAAM,CAAC,MAAM,0BAgFX;IAEF,MAAM;CAOP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
package/dist/tt-badge.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* A small status label. Presentational only: it displays state, it never
|
|
11
|
+
* owns it.
|
|
12
|
+
*
|
|
13
|
+
* THREE THINGS THAT WERE WRONG AND ARE WORTH KNOWING.
|
|
14
|
+
*
|
|
15
|
+
* line-height was 1.5. On a pill that is not a paragraph, an inherited
|
|
16
|
+
* body line-height adds invisible space above and below the text, so the
|
|
17
|
+
* badge came out taller than it looked and sat off-centre next to a name.
|
|
18
|
+
* A pill sets line-height: 1 and gets its height from padding, which is
|
|
19
|
+
* the only way the height is predictable.
|
|
20
|
+
*
|
|
21
|
+
* neutral was --tt-muted-foreground mixed 14% into transparent, which is
|
|
22
|
+
* a grey wash of a grey. Neutral is the most common variant and it looked
|
|
23
|
+
* like a rendering mistake. It now uses the real muted surface.
|
|
24
|
+
*
|
|
25
|
+
* white-space: nowrap with no escape meant a long label pushed its way
|
|
26
|
+
* out of whatever contained it. It still refuses to wrap, because a badge
|
|
27
|
+
* that wraps stops being a badge, but it now truncates instead of
|
|
28
|
+
* overflowing.
|
|
29
|
+
*/
|
|
30
|
+
let TTBadge = class TTBadge extends LitElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.variant = "neutral";
|
|
34
|
+
this.size = "medium";
|
|
35
|
+
}
|
|
36
|
+
static { this.styles = css `
|
|
37
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
38
|
+
hidden element would still show. Important, so it always wins. */
|
|
39
|
+
:host([hidden]) {
|
|
40
|
+
display: none !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
/* So a badge in a tight row shrinks and truncates rather than
|
|
46
|
+
forcing its container wider. */
|
|
47
|
+
min-width: 0;
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.badge {
|
|
52
|
+
--_color: var(--tt-muted-foreground);
|
|
53
|
+
--_surface: color-mix(in srgb, var(--_color) 13%, transparent);
|
|
54
|
+
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--tt-space-1);
|
|
58
|
+
|
|
59
|
+
min-width: 0;
|
|
60
|
+
max-width: 100%;
|
|
61
|
+
|
|
62
|
+
padding: 4px var(--tt-space-2);
|
|
63
|
+
border-radius: var(--tt-radius-full);
|
|
64
|
+
|
|
65
|
+
background: var(--_surface);
|
|
66
|
+
color: var(--_color);
|
|
67
|
+
|
|
68
|
+
font-family: var(--tt-font-sans);
|
|
69
|
+
font-size: var(--tt-text-xs);
|
|
70
|
+
font-weight: var(--tt-weight-semibold);
|
|
71
|
+
letter-spacing: 0.005em;
|
|
72
|
+
|
|
73
|
+
/* 1, not the body leading. See the note above: a pill gets its
|
|
74
|
+
height from padding, or the height is unpredictable. */
|
|
75
|
+
line-height: 1;
|
|
76
|
+
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([size="small"]) .badge {
|
|
83
|
+
padding: 3px 7px;
|
|
84
|
+
font-size: 0.6875rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
Neutral gets a real surface rather than a mix of grey into nothing.
|
|
89
|
+
It is the default and by far the most used, so it has to look
|
|
90
|
+
deliberate rather than washed out.
|
|
91
|
+
*/
|
|
92
|
+
.neutral {
|
|
93
|
+
--_surface: var(--tt-muted);
|
|
94
|
+
color: var(--tt-muted-foreground);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.success {
|
|
98
|
+
--_color: var(--tt-success);
|
|
99
|
+
}
|
|
100
|
+
.warning {
|
|
101
|
+
--_color: var(--tt-warning);
|
|
102
|
+
}
|
|
103
|
+
.danger {
|
|
104
|
+
--_color: var(--tt-destructive);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* An icon inside a badge sizes to the badge, not to the 16px default,
|
|
108
|
+
because --tt-icon-size inherits through the boundary. */
|
|
109
|
+
:host {
|
|
110
|
+
--tt-icon-size: 12px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
::slotted(tt-icon) {
|
|
114
|
+
flex: 0 0 auto;
|
|
115
|
+
}
|
|
116
|
+
`; }
|
|
117
|
+
render() {
|
|
118
|
+
return html `
|
|
119
|
+
<span class="badge ${this.variant}" part="badge">
|
|
120
|
+
<slot></slot>
|
|
121
|
+
</span>
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: String, reflect: true })
|
|
127
|
+
], TTBadge.prototype, "variant", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: String, reflect: true })
|
|
130
|
+
], TTBadge.prototype, "size", void 0);
|
|
131
|
+
TTBadge = __decorate([
|
|
132
|
+
customElement("tt-badge")
|
|
133
|
+
], TTBadge);
|
|
134
|
+
export { TTBadge };
|
|
135
|
+
//# sourceMappingURL=tt-badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-badge.js","sourceRoot":"","sources":["../src/tt-badge.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAK5D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QACsC,YAAO,GAAiB,SAAS,CAAC;QAElC,SAAI,GAAc,QAAQ,CAAC;IA2FxE,CAAC;aAzFQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFlB,AAhFY,CAgFX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;2BACY,IAAI,CAAC,OAAO;;;KAGlC,CAAC;IACJ,CAAC;;AA5F0C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAmC;AAElC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAA4B;AAH3D,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CA8FnB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export interface Crumb {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Trail showing where the current page sits. Emits a navigation event
|
|
8
|
+
* rather than following links itself, so it works with a client router,
|
|
9
|
+
* a server one, or neither.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TTBreadcrumbs extends LitElement {
|
|
12
|
+
items: Crumb[];
|
|
13
|
+
private navigate;
|
|
14
|
+
static styles: import("lit").CSSResult;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
"tt-breadcrumbs": TTBreadcrumbs;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=tt-breadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-breadcrumbs.d.ts","sourceRoot":"","sources":["../src/tt-breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAM5C,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,qBACa,aAAc,SAAQ,UAAU;IAChB,KAAK,EAAE,KAAK,EAAE,CAAM;IAE/C,OAAO,CAAC,QAAQ;IAkBhB,MAAM,CAAC,MAAM,0BA2DX;IAEF,MAAM;CA0CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
|
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
import { safeUrl } from "./safe-url.js";
|
|
11
|
+
/**
|
|
12
|
+
* Trail showing where the current page sits. Emits a navigation event
|
|
13
|
+
* rather than following links itself, so it works with a client router,
|
|
14
|
+
* a server one, or neither.
|
|
15
|
+
*/
|
|
16
|
+
let TTBreadcrumbs = class TTBreadcrumbs extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.items = [];
|
|
20
|
+
}
|
|
21
|
+
navigate(crumb, event) {
|
|
22
|
+
if (!crumb.href)
|
|
23
|
+
return;
|
|
24
|
+
// Let modified clicks through: ctrl, cmd and middle-click should open
|
|
25
|
+
// a new tab, which is what the browser already does with a real href.
|
|
26
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey)
|
|
27
|
+
return;
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
this.dispatchEvent(new CustomEvent("tt-navigate", {
|
|
30
|
+
detail: { href: crumb.href, label: crumb.label },
|
|
31
|
+
bubbles: true,
|
|
32
|
+
composed: true,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
static { this.styles = css `
|
|
36
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
37
|
+
hidden element would still show. Important, so it always wins. */
|
|
38
|
+
:host([hidden]) {
|
|
39
|
+
display: none !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host {
|
|
43
|
+
display: block;
|
|
44
|
+
font-family: var(--tt-font-sans);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ol {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
gap: var(--tt-space-2);
|
|
52
|
+
|
|
53
|
+
margin: 0;
|
|
54
|
+
padding: 0;
|
|
55
|
+
list-style: none;
|
|
56
|
+
|
|
57
|
+
font-size: var(--tt-text-xs);
|
|
58
|
+
color: var(--tt-muted-foreground);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
li {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: var(--tt-space-2);
|
|
65
|
+
min-width: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
a {
|
|
69
|
+
color: inherit;
|
|
70
|
+
text-decoration: none;
|
|
71
|
+
overflow-wrap: anywhere;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
a:hover {
|
|
75
|
+
color: var(--tt-foreground);
|
|
76
|
+
text-decoration: underline;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
a:focus-visible {
|
|
80
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
81
|
+
outline-offset: var(--tt-ring-offset);
|
|
82
|
+
border-radius: var(--tt-radius-sm);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.current {
|
|
86
|
+
color: var(--tt-foreground);
|
|
87
|
+
font-weight: var(--tt-weight-medium);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sep {
|
|
91
|
+
color: var(--tt-border);
|
|
92
|
+
user-select: none;
|
|
93
|
+
}
|
|
94
|
+
`; }
|
|
95
|
+
render() {
|
|
96
|
+
return html `
|
|
97
|
+
<nav aria-label="Breadcrumb" part="nav">
|
|
98
|
+
<ol part="list">
|
|
99
|
+
${this.items.map((crumb, index) => {
|
|
100
|
+
const isLast = index === this.items.length - 1;
|
|
101
|
+
const href = crumb.href ? safeUrl(crumb.href) : null;
|
|
102
|
+
return html `
|
|
103
|
+
<li>
|
|
104
|
+
${index > 0
|
|
105
|
+
? html `<span class="sep" aria-hidden="true">/</span>`
|
|
106
|
+
: ""}
|
|
107
|
+
|
|
108
|
+
${isLast || !href
|
|
109
|
+
? html `
|
|
110
|
+
<!-- aria-current tells a screen reader which one is
|
|
111
|
+
the page you are actually on. Only the LAST: a
|
|
112
|
+
middle crumb with no link is just a label, and
|
|
113
|
+
marking it too announced two current pages. -->
|
|
114
|
+
<span
|
|
115
|
+
class="current"
|
|
116
|
+
aria-current=${ifDefined(isLast ? "page" : undefined)}
|
|
117
|
+
>
|
|
118
|
+
${crumb.label}
|
|
119
|
+
</span>
|
|
120
|
+
`
|
|
121
|
+
: html `
|
|
122
|
+
<a
|
|
123
|
+
href=${href}
|
|
124
|
+
@click=${(e) => this.navigate(crumb, e)}
|
|
125
|
+
>
|
|
126
|
+
${crumb.label}
|
|
127
|
+
</a>
|
|
128
|
+
`}
|
|
129
|
+
</li>
|
|
130
|
+
`;
|
|
131
|
+
})}
|
|
132
|
+
</ol>
|
|
133
|
+
</nav>
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: Array })
|
|
139
|
+
], TTBreadcrumbs.prototype, "items", void 0);
|
|
140
|
+
TTBreadcrumbs = __decorate([
|
|
141
|
+
customElement("tt-breadcrumbs")
|
|
142
|
+
], TTBreadcrumbs);
|
|
143
|
+
export { TTBreadcrumbs };
|
|
144
|
+
//# sourceMappingURL=tt-breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-breadcrumbs.js","sourceRoot":"","sources":["../src/tt-breadcrumbs.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;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQxC;;;;GAIG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACsB,UAAK,GAAY,EAAE,CAAC;IA2HjD,CAAC;IAzHS,QAAQ,CAAC,KAAY,EAAE,KAAiB;QAC9C,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,OAAO;QAExB,sEAAsE;QACtE,sEAAsE;QACtE,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ;YAAE,OAAO;QAE7D,KAAK,CAAC,cAAc,EAAE,CAAC;QAEvB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,aAAa,EAAE;YAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;YAChD,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DlB,AA3DY,CA2DX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;;;YAGH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAChC,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAErD,OAAO,IAAI,CAAA;;kBAEL,KAAK,GAAG,CAAC;gBACT,CAAC,CAAC,IAAI,CAAA,+CAA+C;gBACrD,CAAC,CAAC,EAAE;;kBAEJ,MAAM,IAAI,CAAC,IAAI;gBACf,CAAC,CAAC,IAAI,CAAA;;;;;;;uCAOe,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;;0BAEnD,KAAK,CAAC,KAAK;;qBAEhB;gBACH,CAAC,CAAC,IAAI,CAAA;;+BAEO,IAAI;iCACF,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;;0BAEjD,KAAK,CAAC,KAAK;;qBAEhB;;aAER,CAAC;QACJ,CAAC,CAAC;;;KAGP,CAAC;IACJ,CAAC;;AA1H0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAqB;AADpC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA4HzB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Attaches controls into one unit: the corners where they meet flatten,
|
|
4
|
+
* and their borders collapse onto a single shared edge.
|
|
5
|
+
*
|
|
6
|
+
* Use it when the buttons are alternatives to each other, or steps in one
|
|
7
|
+
* decision. Do NOT use it as a way to save space between unrelated
|
|
8
|
+
* actions: joining "Reload" to "Checkout" tells the reader they belong
|
|
9
|
+
* together, and they do not. A plain flex row with a gap is right for
|
|
10
|
+
* those, which is what tt-toolbar already does.
|
|
11
|
+
*
|
|
12
|
+
* HOW IT REACHES INSIDE ITS CHILDREN. Each control's radius lives on an
|
|
13
|
+
* element in its own shadow root, and ::slotted() only ever matches the
|
|
14
|
+
* host, never anything within it. So a group cannot restyle a button's
|
|
15
|
+
* corners directly. What it can do is set a CUSTOM PROPERTY on the host,
|
|
16
|
+
* because custom properties inherit through the shadow boundary, and each
|
|
17
|
+
* groupable control reads `--tt-group-radius` for its own radius. The
|
|
18
|
+
* group sets that per position, and the child applies it.
|
|
19
|
+
*
|
|
20
|
+
* Works with tt-button, tt-dropdown-menu, tt-select and tt-input.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TTButtonGroup extends LitElement {
|
|
23
|
+
orientation: "horizontal" | "vertical";
|
|
24
|
+
static styles: import("lit").CSSResult;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
"tt-button-group": TTButtonGroup;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=tt-button-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-button-group.d.ts","sourceRoot":"","sources":["../src/tt-button-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,aAAc,SAAQ,UAAU;IAE3C,WAAW,EAAE,YAAY,GAAG,UAAU,CAAgB;IAEtD,MAAM,CAAC,MAAM,0BAkFX;IAEF,MAAM;CAOP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
|