@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-auth.js
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
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 { property, state, customElement } from "lit/decorators.js";
|
|
9
|
+
import "./tt-card.js";
|
|
10
|
+
import "./tt-form.js";
|
|
11
|
+
import "./tt-input.js";
|
|
12
|
+
import "./tt-checkbox.js";
|
|
13
|
+
import "./tt-button.js";
|
|
14
|
+
import "./tt-alert.js";
|
|
15
|
+
import "./tt-divider.js";
|
|
16
|
+
import "./tt-icon.js";
|
|
17
|
+
/*
|
|
18
|
+
What each mode calls itself, in one table rather than spread across four
|
|
19
|
+
render methods. A consumer can still override any of it with the
|
|
20
|
+
heading and submitLabel properties; these are only the defaults, and a
|
|
21
|
+
default that has to be right in four places is a default that will
|
|
22
|
+
eventually disagree with itself in one of them.
|
|
23
|
+
*/
|
|
24
|
+
const COPY = {
|
|
25
|
+
signIn: {
|
|
26
|
+
heading: "Sign in",
|
|
27
|
+
submit: "Sign in",
|
|
28
|
+
description: "",
|
|
29
|
+
},
|
|
30
|
+
signUp: {
|
|
31
|
+
heading: "Create an account",
|
|
32
|
+
submit: "Create account",
|
|
33
|
+
description: "",
|
|
34
|
+
},
|
|
35
|
+
forgotPsw: {
|
|
36
|
+
heading: "Reset your password",
|
|
37
|
+
submit: "Send reset link",
|
|
38
|
+
description: "We will email you a link to choose a new password.",
|
|
39
|
+
},
|
|
40
|
+
resetPsw: {
|
|
41
|
+
heading: "Choose a new password",
|
|
42
|
+
submit: "Save password",
|
|
43
|
+
description: "",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The four screens every application needs, as one component.
|
|
48
|
+
*
|
|
49
|
+
* One element with a `mode` rather than four elements, the same choice
|
|
50
|
+
* tt-product and tt-profile-card make with `orientation`. All four share
|
|
51
|
+
* a card, a heading, an error region and a footer; only the fields and
|
|
52
|
+
* the event differ. Four components would repeat that shell four times
|
|
53
|
+
* and let it drift.
|
|
54
|
+
*
|
|
55
|
+
* IT NEVER TALKS TO A SERVER AND NEVER DECIDES ANYTHING. It reports what
|
|
56
|
+
* was typed and what was asked for. Whether the credentials are valid,
|
|
57
|
+
* whether the account exists, and what happens next all belong to
|
|
58
|
+
* whoever is using it. That is what keeps it usable against any backend.
|
|
59
|
+
*
|
|
60
|
+
* The events, for the custom-elements manifest. Its analyzer reads event
|
|
61
|
+
* names from string literals at the dispatch site, and these are chosen at
|
|
62
|
+
* run time, so without the tags the manifest listed a bogus event instead.
|
|
63
|
+
* @fires tt-sign-in - { email, password, remember } from the sign-in form.
|
|
64
|
+
* @fires tt-sign-up - { name, email, password, accepted } from the sign-up form.
|
|
65
|
+
* @fires tt-forgot - { email } from the forgot-password form.
|
|
66
|
+
* @fires tt-reset - { password } from the reset form.
|
|
67
|
+
* @fires tt-mode - { mode }, when a footer link asks for another screen.
|
|
68
|
+
*/
|
|
69
|
+
let TTAuth = class TTAuth extends LitElement {
|
|
70
|
+
constructor() {
|
|
71
|
+
super(...arguments);
|
|
72
|
+
this.mode = "signIn";
|
|
73
|
+
// Left empty to take the per-mode default from COPY above.
|
|
74
|
+
this.heading = "";
|
|
75
|
+
this.description = "";
|
|
76
|
+
this.submitLabel = "";
|
|
77
|
+
this.emailLabel = "Email";
|
|
78
|
+
this.passwordLabel = "Password";
|
|
79
|
+
this.nameLabel = "Full name";
|
|
80
|
+
// Prefilled after a failed attempt, so nothing has to be retyped.
|
|
81
|
+
this.email = "";
|
|
82
|
+
this.name = "";
|
|
83
|
+
this.rememberMe = false;
|
|
84
|
+
this.loading = false;
|
|
85
|
+
/*
|
|
86
|
+
forgotPsw only: swap the form for a confirmation.
|
|
87
|
+
|
|
88
|
+
Deliberately a boolean and not an outcome. The message must be the
|
|
89
|
+
same whether or not the address is registered, or anyone can use this
|
|
90
|
+
form to discover which emails have accounts. See renderSent.
|
|
91
|
+
*/
|
|
92
|
+
this.sent = false;
|
|
93
|
+
// A failure from the server, above the form. Field problems go on the
|
|
94
|
+
// field, which is where the person is looking.
|
|
95
|
+
this.error = "";
|
|
96
|
+
/*
|
|
97
|
+
The mismatch message, held here rather than passed in.
|
|
98
|
+
|
|
99
|
+
It is the one error this component is allowed to decide, because it is
|
|
100
|
+
the one that needs no server: the two boxes either match or they do
|
|
101
|
+
not. Everything else arrives through `error`.
|
|
102
|
+
*/
|
|
103
|
+
this.confirmError = "";
|
|
104
|
+
}
|
|
105
|
+
get copy() {
|
|
106
|
+
return COPY[this.mode];
|
|
107
|
+
}
|
|
108
|
+
get resolvedHeading() {
|
|
109
|
+
return this.heading || this.copy.heading;
|
|
110
|
+
}
|
|
111
|
+
get resolvedSubmit() {
|
|
112
|
+
return this.submitLabel || this.copy.submit;
|
|
113
|
+
}
|
|
114
|
+
get resolvedDescription() {
|
|
115
|
+
return this.description || this.copy.description;
|
|
116
|
+
}
|
|
117
|
+
/*
|
|
118
|
+
One submit handler, branching on mode.
|
|
119
|
+
|
|
120
|
+
The event NAME and its payload both follow the mode. A single event
|
|
121
|
+
carrying { email, password, remember } would be wrong for three of
|
|
122
|
+
the four screens: sign-up drops the name and the terms box, and
|
|
123
|
+
forgot-password reports a password field that does not exist.
|
|
124
|
+
*/
|
|
125
|
+
handleSubmit(event) {
|
|
126
|
+
const data = event.detail.formData;
|
|
127
|
+
const read = (key) => String(data.get(key) ?? "");
|
|
128
|
+
this.confirmError = "";
|
|
129
|
+
if (this.mode === "signIn") {
|
|
130
|
+
this.emit("tt-sign-in", {
|
|
131
|
+
email: read("email"),
|
|
132
|
+
password: read("password"),
|
|
133
|
+
remember: data.get("remember") !== null,
|
|
134
|
+
});
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (this.mode === "forgotPsw") {
|
|
138
|
+
this.emit("tt-forgot", { email: read("email") });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
/*
|
|
142
|
+
The two modes that set a password both confirm it.
|
|
143
|
+
|
|
144
|
+
Checked on SUBMIT, never on input: comparing as someone types tells
|
|
145
|
+
them they are wrong before they have finished being right, and the
|
|
146
|
+
message flickers on every keystroke.
|
|
147
|
+
*/
|
|
148
|
+
const password = read("password");
|
|
149
|
+
if (password !== read("confirm")) {
|
|
150
|
+
this.confirmError = "The two passwords do not match.";
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (this.mode === "signUp") {
|
|
154
|
+
this.emit("tt-sign-up", {
|
|
155
|
+
name: read("name"),
|
|
156
|
+
email: read("email"),
|
|
157
|
+
password,
|
|
158
|
+
accepted: data.get("accepted") !== null,
|
|
159
|
+
});
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.emit("tt-reset", { password });
|
|
163
|
+
}
|
|
164
|
+
emit(type, detail) {
|
|
165
|
+
this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }));
|
|
166
|
+
}
|
|
167
|
+
/*
|
|
168
|
+
The footer links announce rather than navigate.
|
|
169
|
+
|
|
170
|
+
This component has no idea whether the app routes with a hash, real
|
|
171
|
+
paths, or by swapping a property. Same rule as every other composite
|
|
172
|
+
here: report the intent, let the owner act on it.
|
|
173
|
+
*/
|
|
174
|
+
goTo(mode) {
|
|
175
|
+
this.emit("tt-mode", { mode });
|
|
176
|
+
}
|
|
177
|
+
// ---- pieces shared by every mode ----
|
|
178
|
+
renderEmail(autocomplete) {
|
|
179
|
+
return html `
|
|
180
|
+
<tt-input
|
|
181
|
+
name="email"
|
|
182
|
+
type="email"
|
|
183
|
+
full-width
|
|
184
|
+
required
|
|
185
|
+
autocomplete=${autocomplete}
|
|
186
|
+
label=${this.emailLabel}
|
|
187
|
+
placeholder="you@company.com"
|
|
188
|
+
.value=${this.email}
|
|
189
|
+
?disabled=${this.loading}
|
|
190
|
+
></tt-input>
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
renderPassword(label, isNew) {
|
|
194
|
+
return html `
|
|
195
|
+
<tt-input
|
|
196
|
+
name="password"
|
|
197
|
+
type="password"
|
|
198
|
+
full-width
|
|
199
|
+
required
|
|
200
|
+
autocomplete=${isNew ? "new-password" : "current-password"}
|
|
201
|
+
label=${label}
|
|
202
|
+
?disabled=${this.loading}
|
|
203
|
+
></tt-input>
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
/* The mismatch lands on this field, not above the form, because this is
|
|
207
|
+
the field that has to change. */
|
|
208
|
+
renderConfirm() {
|
|
209
|
+
return html `
|
|
210
|
+
<tt-input
|
|
211
|
+
name="confirm"
|
|
212
|
+
type="password"
|
|
213
|
+
full-width
|
|
214
|
+
required
|
|
215
|
+
autocomplete="new-password"
|
|
216
|
+
label="Confirm password"
|
|
217
|
+
error=${this.confirmError}
|
|
218
|
+
?disabled=${this.loading}
|
|
219
|
+
></tt-input>
|
|
220
|
+
`;
|
|
221
|
+
}
|
|
222
|
+
renderSubmit() {
|
|
223
|
+
return html `
|
|
224
|
+
<tt-button
|
|
225
|
+
type="submit"
|
|
226
|
+
full-width
|
|
227
|
+
?loading=${this.loading}
|
|
228
|
+
>
|
|
229
|
+
${this.resolvedSubmit}
|
|
230
|
+
</tt-button>
|
|
231
|
+
`;
|
|
232
|
+
}
|
|
233
|
+
link(label, mode) {
|
|
234
|
+
return html `
|
|
235
|
+
<button type="button" class="link" @click=${() => this.goTo(mode)}>
|
|
236
|
+
${label}
|
|
237
|
+
</button>
|
|
238
|
+
`;
|
|
239
|
+
}
|
|
240
|
+
/*
|
|
241
|
+
The card, written once.
|
|
242
|
+
|
|
243
|
+
Every mode used to carry its own copy of this, which is the
|
|
244
|
+
duplication a `mode` property exists to remove: four shells drift, and
|
|
245
|
+
a fix to the error region has to be made four times.
|
|
246
|
+
*/
|
|
247
|
+
renderShell(body, footer) {
|
|
248
|
+
return html `
|
|
249
|
+
<tt-card part="card" variant="elevated">
|
|
250
|
+
<div class="head">
|
|
251
|
+
<h1 part="heading">${this.resolvedHeading}</h1>
|
|
252
|
+
|
|
253
|
+
${this.resolvedDescription
|
|
254
|
+
? html `<p class="description">${this.resolvedDescription}</p>`
|
|
255
|
+
: nothing}
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
${this.error
|
|
259
|
+
? html `<tt-alert class="error" variant="danger">${this.error}</tt-alert>`
|
|
260
|
+
: nothing}
|
|
261
|
+
${body}
|
|
262
|
+
|
|
263
|
+
<div class="footer" part="footer">
|
|
264
|
+
<slot name="footer">${footer}</slot>
|
|
265
|
+
</div>
|
|
266
|
+
</tt-card>
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
// ---- the four screens ----
|
|
270
|
+
renderSignIn() {
|
|
271
|
+
return this.renderShell(html `
|
|
272
|
+
<tt-form @tt-form-submit=${this.handleSubmit}>
|
|
273
|
+
${this.renderEmail("username")}
|
|
274
|
+
${this.renderPassword(this.passwordLabel, false)}
|
|
275
|
+
|
|
276
|
+
<div class="row">
|
|
277
|
+
<tt-checkbox
|
|
278
|
+
name="remember"
|
|
279
|
+
label="Remember me"
|
|
280
|
+
?checked=${this.rememberMe}
|
|
281
|
+
?disabled=${this.loading}
|
|
282
|
+
></tt-checkbox>
|
|
283
|
+
|
|
284
|
+
<slot name="secondary">
|
|
285
|
+
${this.link("Forgot password?", "forgotPsw")}
|
|
286
|
+
</slot>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
${this.renderSubmit()}
|
|
290
|
+
</tt-form>
|
|
291
|
+
`, html `No account? ${this.link("Create one", "signUp")}`);
|
|
292
|
+
}
|
|
293
|
+
renderSignUp() {
|
|
294
|
+
return this.renderShell(html `
|
|
295
|
+
<tt-form @tt-form-submit=${this.handleSubmit}>
|
|
296
|
+
<tt-input
|
|
297
|
+
name="name"
|
|
298
|
+
full-width
|
|
299
|
+
required
|
|
300
|
+
autocomplete="name"
|
|
301
|
+
label=${this.nameLabel}
|
|
302
|
+
placeholder="Ana Marku"
|
|
303
|
+
.value=${this.name}
|
|
304
|
+
?disabled=${this.loading}
|
|
305
|
+
></tt-input>
|
|
306
|
+
|
|
307
|
+
${this.renderEmail("email")}
|
|
308
|
+
${this.renderPassword("Password", true)} ${this.renderConfirm()}
|
|
309
|
+
|
|
310
|
+
<tt-checkbox
|
|
311
|
+
name="accepted"
|
|
312
|
+
required
|
|
313
|
+
label="I accept the terms and the privacy policy"
|
|
314
|
+
?disabled=${this.loading}
|
|
315
|
+
></tt-checkbox>
|
|
316
|
+
|
|
317
|
+
${this.renderSubmit()}
|
|
318
|
+
</tt-form>
|
|
319
|
+
`, html `Already have an account? ${this.link("Sign in", "signIn")}`);
|
|
320
|
+
}
|
|
321
|
+
/*
|
|
322
|
+
The same message whether or not the address is registered.
|
|
323
|
+
|
|
324
|
+
Telling someone "no account with that email" turns this form into a
|
|
325
|
+
way of testing which addresses have accounts, one request at a time.
|
|
326
|
+
The wording is deliberately conditional.
|
|
327
|
+
*/
|
|
328
|
+
renderSent() {
|
|
329
|
+
return html `
|
|
330
|
+
<tt-alert variant="success" heading="Check your email">
|
|
331
|
+
If an account exists for that address, a reset link is on its way.
|
|
332
|
+
</tt-alert>
|
|
333
|
+
`;
|
|
334
|
+
}
|
|
335
|
+
renderForgot() {
|
|
336
|
+
return this.renderShell(this.sent
|
|
337
|
+
? this.renderSent()
|
|
338
|
+
: html `
|
|
339
|
+
<tt-form @tt-form-submit=${this.handleSubmit}>
|
|
340
|
+
${this.renderEmail("username")} ${this.renderSubmit()}
|
|
341
|
+
</tt-form>
|
|
342
|
+
`, html `Remembered it? ${this.link("Sign in", "signIn")}`);
|
|
343
|
+
}
|
|
344
|
+
renderReset() {
|
|
345
|
+
return this.renderShell(html `
|
|
346
|
+
<tt-form @tt-form-submit=${this.handleSubmit}>
|
|
347
|
+
${this.renderPassword("New password", true)} ${this.renderConfirm()}
|
|
348
|
+
${this.renderSubmit()}
|
|
349
|
+
</tt-form>
|
|
350
|
+
`, html `${this.link("Back to sign in", "signIn")}`);
|
|
351
|
+
}
|
|
352
|
+
static { this.styles = css `
|
|
353
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
354
|
+
hidden element would still show. Important, so it always wins. */
|
|
355
|
+
:host([hidden]) {
|
|
356
|
+
display: none !important;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
:host {
|
|
360
|
+
display: block;
|
|
361
|
+
width: 100%;
|
|
362
|
+
max-width: 380px;
|
|
363
|
+
|
|
364
|
+
font-family: var(--tt-font-sans);
|
|
365
|
+
-webkit-font-smoothing: antialiased;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.head {
|
|
369
|
+
display: flex;
|
|
370
|
+
flex-direction: column;
|
|
371
|
+
gap: var(--tt-space-1);
|
|
372
|
+
margin-bottom: var(--tt-space-5);
|
|
373
|
+
text-align: center;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
h1 {
|
|
377
|
+
margin: 0;
|
|
378
|
+
font-size: var(--tt-text-xl);
|
|
379
|
+
font-weight: var(--tt-weight-bold);
|
|
380
|
+
letter-spacing: -0.01em;
|
|
381
|
+
color: var(--tt-foreground);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.description {
|
|
385
|
+
margin: 0;
|
|
386
|
+
font-size: var(--tt-text-sm);
|
|
387
|
+
line-height: var(--tt-leading-normal);
|
|
388
|
+
color: var(--tt-muted-foreground);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/* role="alert" makes a screen reader announce this the moment it
|
|
392
|
+
appears, which is the whole point of a failed sign-in message. */
|
|
393
|
+
/* A tt-alert, not a box of its own. This was a second, hand-drawn
|
|
394
|
+
danger banner (different tint, no accent edge) beside the one the
|
|
395
|
+
library already has; tt-alert danger is also role="alert". */
|
|
396
|
+
.error {
|
|
397
|
+
display: block;
|
|
398
|
+
margin-bottom: var(--tt-space-4);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.row {
|
|
402
|
+
display: flex;
|
|
403
|
+
align-items: center;
|
|
404
|
+
justify-content: space-between;
|
|
405
|
+
gap: var(--tt-space-3);
|
|
406
|
+
flex-wrap: wrap;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* Pushed to the bottom of the card, separated from the fields. */
|
|
410
|
+
.footer {
|
|
411
|
+
margin-top: var(--tt-space-5);
|
|
412
|
+
padding-top: var(--tt-space-4);
|
|
413
|
+
border-top: 1px solid var(--tt-border);
|
|
414
|
+
|
|
415
|
+
font-size: var(--tt-text-sm);
|
|
416
|
+
color: var(--tt-muted-foreground);
|
|
417
|
+
text-align: center;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/*
|
|
421
|
+
A button, not an anchor, and that is deliberate.
|
|
422
|
+
|
|
423
|
+
These switch a screen inside this component; they do not go to a
|
|
424
|
+
URL, and this component does not know whether the app even has one
|
|
425
|
+
for them. An <a> with no href is not focusable and is announced as
|
|
426
|
+
nothing, so a real button carries the interaction and CSS makes it
|
|
427
|
+
read as a link.
|
|
428
|
+
*/
|
|
429
|
+
.link {
|
|
430
|
+
padding: 0;
|
|
431
|
+
border: none;
|
|
432
|
+
background: none;
|
|
433
|
+
|
|
434
|
+
font: inherit;
|
|
435
|
+
color: var(--tt-foreground);
|
|
436
|
+
font-weight: var(--tt-weight-medium);
|
|
437
|
+
|
|
438
|
+
cursor: pointer;
|
|
439
|
+
text-decoration: none;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.link:hover {
|
|
443
|
+
text-decoration: underline;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.link:focus-visible {
|
|
447
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
448
|
+
outline-offset: var(--tt-ring-offset);
|
|
449
|
+
border-radius: var(--tt-radius-sm);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
::slotted(a) {
|
|
453
|
+
color: var(--tt-foreground);
|
|
454
|
+
text-decoration: none;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
::slotted(a:hover) {
|
|
458
|
+
text-decoration: underline;
|
|
459
|
+
}
|
|
460
|
+
`; }
|
|
461
|
+
render() {
|
|
462
|
+
switch (this.mode) {
|
|
463
|
+
case "signUp":
|
|
464
|
+
return this.renderSignUp();
|
|
465
|
+
case "forgotPsw":
|
|
466
|
+
return this.renderForgot();
|
|
467
|
+
case "resetPsw":
|
|
468
|
+
return this.renderReset();
|
|
469
|
+
default:
|
|
470
|
+
return this.renderSignIn();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
__decorate([
|
|
475
|
+
property({ type: String })
|
|
476
|
+
], TTAuth.prototype, "mode", void 0);
|
|
477
|
+
__decorate([
|
|
478
|
+
property({ type: String })
|
|
479
|
+
], TTAuth.prototype, "heading", void 0);
|
|
480
|
+
__decorate([
|
|
481
|
+
property({ type: String })
|
|
482
|
+
], TTAuth.prototype, "description", void 0);
|
|
483
|
+
__decorate([
|
|
484
|
+
property({ type: String, attribute: "submit-label" })
|
|
485
|
+
], TTAuth.prototype, "submitLabel", void 0);
|
|
486
|
+
__decorate([
|
|
487
|
+
property({ type: String, attribute: "email-label" })
|
|
488
|
+
], TTAuth.prototype, "emailLabel", void 0);
|
|
489
|
+
__decorate([
|
|
490
|
+
property({ type: String, attribute: "password-label" })
|
|
491
|
+
], TTAuth.prototype, "passwordLabel", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
property({ type: String, attribute: "name-label" })
|
|
494
|
+
], TTAuth.prototype, "nameLabel", void 0);
|
|
495
|
+
__decorate([
|
|
496
|
+
property({ type: String })
|
|
497
|
+
], TTAuth.prototype, "email", void 0);
|
|
498
|
+
__decorate([
|
|
499
|
+
property({ type: String })
|
|
500
|
+
], TTAuth.prototype, "name", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ type: Boolean, attribute: "remember-me" })
|
|
503
|
+
], TTAuth.prototype, "rememberMe", void 0);
|
|
504
|
+
__decorate([
|
|
505
|
+
property({ type: Boolean })
|
|
506
|
+
], TTAuth.prototype, "loading", void 0);
|
|
507
|
+
__decorate([
|
|
508
|
+
property({ type: Boolean })
|
|
509
|
+
], TTAuth.prototype, "sent", void 0);
|
|
510
|
+
__decorate([
|
|
511
|
+
property({ type: String })
|
|
512
|
+
], TTAuth.prototype, "error", void 0);
|
|
513
|
+
__decorate([
|
|
514
|
+
state()
|
|
515
|
+
], TTAuth.prototype, "confirmError", void 0);
|
|
516
|
+
TTAuth = __decorate([
|
|
517
|
+
customElement("tt-auth")
|
|
518
|
+
], TTAuth);
|
|
519
|
+
export { TTAuth };
|
|
520
|
+
//# sourceMappingURL=tt-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-auth.js","sourceRoot":"","sources":["../src/tt-auth.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AAItB;;;;;;EAME;AACF,MAAM,IAAI,GAGN;IACF,MAAM,EAAE;QACN,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;QACjB,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,OAAO,EAAE,mBAAmB;QAC5B,MAAM,EAAE,gBAAgB;QACxB,WAAW,EAAE,EAAE;KAChB;IACD,SAAS,EAAE;QACT,OAAO,EAAE,qBAAqB;QAC9B,MAAM,EAAE,iBAAiB;QACzB,WAAW,EAAE,oDAAoD;KACl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|
|
3
|
+
/**
|
|
4
|
+
* Image with an initials fallback. The fallback is the entire point:
|
|
5
|
+
* logos and profile photos fail to load constantly, and a broken image
|
|
6
|
+
* icon is the difference between a product that looks maintained and one
|
|
7
|
+
* that does not.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TTAvatar extends LitElement {
|
|
10
|
+
src: string;
|
|
11
|
+
name: string;
|
|
12
|
+
size: AvatarSize;
|
|
13
|
+
square: boolean;
|
|
14
|
+
private failed;
|
|
15
|
+
updated(changed: Map<string, unknown>): void;
|
|
16
|
+
private get initials();
|
|
17
|
+
private get tone();
|
|
18
|
+
static styles: import("lit").CSSResult;
|
|
19
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
"tt-avatar": TTAvatar;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=tt-avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-avatar.d.ts","sourceRoot":"","sources":["../src/tt-avatar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD;;;;;GAKG;AACH,qBACa,QAAS,SAAQ,UAAU;IACV,GAAG,SAAM;IAGT,IAAI,SAAM;IAEK,IAAI,EAAE,UAAU,CAAY;IAE3B,MAAM,UAAS;IAElD,OAAO,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrC,OAAO,KAAK,QAAQ,GAQnB;IAOD,OAAO,KAAK,IAAI,GAMf;IAED,MAAM,CAAC,MAAM,0BAgEX;IAEF,MAAM;CA8BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|