@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,390 @@
|
|
|
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, customElement } from "lit/decorators.js";
|
|
9
|
+
import "./tt-button.js";
|
|
10
|
+
import "./tt-icon.js";
|
|
11
|
+
let TTNavbar = class TTNavbar extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
// Reflected so :host([sticky]) can match. The stickiness has to live on
|
|
15
|
+
// the HOST: position:sticky is constrained to its containing block, and
|
|
16
|
+
// for the inner <header> that block is this element, all 60px of it, so
|
|
17
|
+
// sticking it there does nothing at all once the page scrolls.
|
|
18
|
+
//
|
|
19
|
+
// Opt-in, like every boolean in the library: a boolean attribute can
|
|
20
|
+
// only switch something ON, so one that defaulted to true could never
|
|
21
|
+
// be turned off from HTML.
|
|
22
|
+
this.sticky = false;
|
|
23
|
+
// A rule along the bottom edge. Opt-in, matching tt-toolbar and
|
|
24
|
+
// tt-page-header.
|
|
25
|
+
this.bordered = false;
|
|
26
|
+
// 48, 60 or 72px. `size` with the library's usual words; it was
|
|
27
|
+
// `height: thin | default | thick`, a vocabulary used nowhere else.
|
|
28
|
+
this.size = "medium";
|
|
29
|
+
this.mobileMenuOpen = false;
|
|
30
|
+
/**
|
|
31
|
+
* A soft blurred boundary below the bar instead of a hard rule, for
|
|
32
|
+
* where content actually scrolls UNDERNEATH it: a landing page, or any
|
|
33
|
+
* layout where the bar floats over the scroller rather than sitting in
|
|
34
|
+
* a column above it.
|
|
35
|
+
*
|
|
36
|
+
* Not decoration, and not a nicer border. It marks where UI meets
|
|
37
|
+
* content, so it is wrong on a bar with nothing passing under it, and
|
|
38
|
+
* it does nothing unless `sticky` is set. Use one per scrolling view.
|
|
39
|
+
*
|
|
40
|
+
* Attribute is `scroll-edge`, kebab-case like every multi-word
|
|
41
|
+
* attribute in the library.
|
|
42
|
+
*/
|
|
43
|
+
this.scrollEdge = false;
|
|
44
|
+
}
|
|
45
|
+
handleMenuToggle() {
|
|
46
|
+
this.mobileMenuOpen = !this.mobileMenuOpen;
|
|
47
|
+
this.dispatchEvent(new CustomEvent("tt-menu-toggle", {
|
|
48
|
+
detail: {
|
|
49
|
+
open: this.mobileMenuOpen,
|
|
50
|
+
},
|
|
51
|
+
bubbles: true,
|
|
52
|
+
composed: true,
|
|
53
|
+
}));
|
|
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: block;
|
|
64
|
+
|
|
65
|
+
/* Private aliases. Underscore-prefixed so they can never collide
|
|
66
|
+
with a global --tt-* token a consumer might set. */
|
|
67
|
+
--_bg: color-mix(in srgb, var(--tt-background) 92%, transparent);
|
|
68
|
+
--_link: var(--tt-muted-foreground);
|
|
69
|
+
--_link-hover: var(--tt-foreground);
|
|
70
|
+
|
|
71
|
+
font-family: var(--tt-font-sans);
|
|
72
|
+
-webkit-font-smoothing: antialiased;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
header {
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
|
|
78
|
+
/* Anchors the scroll edge below the bar. */
|
|
79
|
+
position: relative;
|
|
80
|
+
|
|
81
|
+
width: 100%;
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
GRID, NOT FLEX, and this is the whole reason the centre zone is
|
|
85
|
+
worth having.
|
|
86
|
+
|
|
87
|
+
As a flex row the middle zone only got the space the two sides
|
|
88
|
+
left over, so it was centred in that leftover rather than in the
|
|
89
|
+
bar. Its offset was exactly (start - end) / 2: with a 419px start
|
|
90
|
+
and a 76px end the search sat 171px right of centre at every
|
|
91
|
+
window width, which is what it looked like.
|
|
92
|
+
|
|
93
|
+
Three columns with equal side tracks makes the middle column the
|
|
94
|
+
real middle whatever the sides contain. minmax(0, 1fr) rather
|
|
95
|
+
than 1fr so a wide side shrinks its own content instead of
|
|
96
|
+
overflowing into the middle.
|
|
97
|
+
*/
|
|
98
|
+
display: grid;
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
The middle track is auto and the sides are equal fr.
|
|
102
|
+
|
|
103
|
+
auto gives the middle its content width and lets it fall back to
|
|
104
|
+
min-content when the bar runs out of room, which is the right
|
|
105
|
+
order of sacrifice. It must NOT be minmax(0, auto): an fr track
|
|
106
|
+
absorbs all the free space before an auto one is grown, so a
|
|
107
|
+
floored auto track never gets more than its minimum and the
|
|
108
|
+
search sat at 207px no matter how wide the window was.
|
|
109
|
+
*/
|
|
110
|
+
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
|
111
|
+
align-items: center;
|
|
112
|
+
|
|
113
|
+
gap: var(--tt-space-4);
|
|
114
|
+
|
|
115
|
+
padding: 0 var(--tt-space-5);
|
|
116
|
+
|
|
117
|
+
background: var(--_bg);
|
|
118
|
+
color: var(--tt-foreground);
|
|
119
|
+
|
|
120
|
+
-webkit-backdrop-filter: saturate(180%) blur(12px);
|
|
121
|
+
backdrop-filter: saturate(180%) blur(12px);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.small {
|
|
125
|
+
height: 48px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.medium {
|
|
129
|
+
height: 60px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.large {
|
|
133
|
+
height: 72px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.bordered {
|
|
137
|
+
border-bottom: 1px solid var(--tt-border);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/*
|
|
141
|
+
On the host, not on the header inside it.
|
|
142
|
+
|
|
143
|
+
It was on the header, and inside tt-layout that looked fine only
|
|
144
|
+
because tt-layout wraps the slot in its OWN sticky div. Standalone -
|
|
145
|
+
the landing page - nothing was sticky and the bar simply scrolled
|
|
146
|
+
away, because a sticky element cannot travel outside its containing
|
|
147
|
+
block and the header s block is this 60px host.
|
|
148
|
+
*/
|
|
149
|
+
:host([sticky]) {
|
|
150
|
+
position: sticky;
|
|
151
|
+
top: 0;
|
|
152
|
+
z-index: var(--tt-z-sticky);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ---- scroll edge ---- */
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
A hard rule says "two boxes". A soft edge says "the content
|
|
159
|
+
continues underneath", which is the truth when the bar floats over
|
|
160
|
+
a scroller. So the border goes when the edge is on: stacking both
|
|
161
|
+
draws the line the effect exists to remove.
|
|
162
|
+
*/
|
|
163
|
+
:host([scroll-edge]) .bordered {
|
|
164
|
+
border-bottom-color: transparent;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
Sits just below the bar and travels with it, because it is a child
|
|
169
|
+
of the sticky element. The mask fades the blur out over its own
|
|
170
|
+
height, so text dissolves as it passes under rather than sliding
|
|
171
|
+
beneath a line. pointer-events:none, or it would swallow clicks on
|
|
172
|
+
the first row of content.
|
|
173
|
+
*/
|
|
174
|
+
.edge {
|
|
175
|
+
position: absolute;
|
|
176
|
+
top: 100%;
|
|
177
|
+
left: 0;
|
|
178
|
+
right: 0;
|
|
179
|
+
|
|
180
|
+
height: var(--tt-space-6);
|
|
181
|
+
|
|
182
|
+
pointer-events: none;
|
|
183
|
+
|
|
184
|
+
-webkit-backdrop-filter: blur(6px);
|
|
185
|
+
backdrop-filter: blur(6px);
|
|
186
|
+
|
|
187
|
+
-webkit-mask-image: linear-gradient(to bottom, #000, transparent);
|
|
188
|
+
mask-image: linear-gradient(to bottom, #000, transparent);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Mobile menu button */
|
|
192
|
+
|
|
193
|
+
.mobile-menu {
|
|
194
|
+
display: none;
|
|
195
|
+
flex-shrink: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Navbar zones */
|
|
199
|
+
|
|
200
|
+
.start,
|
|
201
|
+
.end {
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
|
|
205
|
+
gap: var(--tt-space-2);
|
|
206
|
+
|
|
207
|
+
min-width: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.center {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
|
|
215
|
+
gap: var(--tt-space-1);
|
|
216
|
+
|
|
217
|
+
min-width: 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/*
|
|
221
|
+
The zones STRETCH to their tracks and align their content inside,
|
|
222
|
+
rather than being shrink-wrapped with justify-self.
|
|
223
|
+
|
|
224
|
+
justify-self: start sizes a grid item to its content and lets it
|
|
225
|
+
overflow the track, so min-width: 0 never bites and a wide start
|
|
226
|
+
zone simply sat on top of the middle one. Stretched, the box is
|
|
227
|
+
exactly its track and the flex row inside does the aligning.
|
|
228
|
+
|
|
229
|
+
A bar is one line and clips: it never wraps, and content that does
|
|
230
|
+
not fit is the consumer's cue to put less in it.
|
|
231
|
+
*/
|
|
232
|
+
.start {
|
|
233
|
+
justify-content: flex-start;
|
|
234
|
+
overflow: hidden;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.end {
|
|
238
|
+
justify-content: flex-end;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Slotted components */
|
|
243
|
+
|
|
244
|
+
.start ::slotted(tt-icon),
|
|
245
|
+
.center ::slotted(tt-icon),
|
|
246
|
+
.end ::slotted(tt-icon) {
|
|
247
|
+
width: 16px;
|
|
248
|
+
height: 16px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* The control token rather than 36px. A fixed height on the host
|
|
252
|
+
fought the control inside it, which grows to a touch target under
|
|
253
|
+
pointer: coarse, and overflowed the box this set. */
|
|
254
|
+
.start ::slotted(tt-button),
|
|
255
|
+
.center ::slotted(tt-button),
|
|
256
|
+
.end ::slotted(tt-button) {
|
|
257
|
+
height: var(--tt-control-md);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.start ::slotted(tt-input),
|
|
261
|
+
.center ::slotted(tt-input),
|
|
262
|
+
.end ::slotted(tt-input) {
|
|
263
|
+
height: var(--tt-control-md);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/* Links */
|
|
267
|
+
|
|
268
|
+
::slotted(a) {
|
|
269
|
+
color: var(--_link);
|
|
270
|
+
|
|
271
|
+
text-decoration: none;
|
|
272
|
+
|
|
273
|
+
font-size: var(--tt-text-sm);
|
|
274
|
+
font-weight: var(--tt-weight-medium);
|
|
275
|
+
|
|
276
|
+
padding: 6px 10px;
|
|
277
|
+
|
|
278
|
+
/* A link is a control: md, like tt-menu-item's rows and every
|
|
279
|
+
button. lg is the card radius. */
|
|
280
|
+
border-radius: var(--tt-radius);
|
|
281
|
+
|
|
282
|
+
transition:
|
|
283
|
+
color var(--tt-duration-normal) var(--tt-ease),
|
|
284
|
+
background var(--tt-duration-normal) var(--tt-ease);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
::slotted(a:hover) {
|
|
288
|
+
color: var(--_link-hover);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Mobile */
|
|
292
|
+
|
|
293
|
+
@media (max-width: 768px) {
|
|
294
|
+
/*
|
|
295
|
+
A different set of three. The centre goes away and the menu button
|
|
296
|
+
appears, so the columns become: button, brand, actions. The brand
|
|
297
|
+
takes the slack rather than the sides, because there is nothing
|
|
298
|
+
left to centre and a phone wants the name hard against the button.
|
|
299
|
+
*/
|
|
300
|
+
header {
|
|
301
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
302
|
+
|
|
303
|
+
gap: var(--tt-space-2);
|
|
304
|
+
padding: 0 var(--tt-space-3);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.mobile-menu {
|
|
308
|
+
display: inline-flex;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/* display:none removes it from the grid entirely, so it takes no
|
|
312
|
+
track and the three above line up with what is left. */
|
|
313
|
+
.center {
|
|
314
|
+
display: none;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
`; }
|
|
319
|
+
render() {
|
|
320
|
+
return html `
|
|
321
|
+
<header
|
|
322
|
+
part="header"
|
|
323
|
+
class="
|
|
324
|
+
${this.size}
|
|
325
|
+
${this.bordered ? "bordered" : ""}
|
|
326
|
+
"
|
|
327
|
+
>
|
|
328
|
+
<!-- Nothing scrolls under a bar that is not sticky, so there is
|
|
329
|
+
nothing for an edge to mark. -->
|
|
330
|
+
${this.scrollEdge && this.sticky
|
|
331
|
+
? html `<div class="edge" part="edge" aria-hidden="true"></div>`
|
|
332
|
+
: nothing}
|
|
333
|
+
|
|
334
|
+
<!-- Mobile menu -->
|
|
335
|
+
|
|
336
|
+
<tt-button
|
|
337
|
+
class="mobile-menu"
|
|
338
|
+
variant="secondary"
|
|
339
|
+
size="small"
|
|
340
|
+
label=${this.mobileMenuOpen ? "Close menu" : "Open menu"}
|
|
341
|
+
expanded=${this.mobileMenuOpen ? "true" : "false"}
|
|
342
|
+
@tt-button-click=${this.handleMenuToggle}
|
|
343
|
+
>
|
|
344
|
+
<tt-icon
|
|
345
|
+
name=${this.mobileMenuOpen ? "x" : "menu"}
|
|
346
|
+
size="20px"
|
|
347
|
+
></tt-icon>
|
|
348
|
+
</tt-button>
|
|
349
|
+
|
|
350
|
+
<!-- Left -->
|
|
351
|
+
|
|
352
|
+
<div class="start" part="start">
|
|
353
|
+
<slot name="start"></slot>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
<!-- Center -->
|
|
357
|
+
|
|
358
|
+
<div class="center" part="center">
|
|
359
|
+
<slot></slot>
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
<!-- Right -->
|
|
363
|
+
|
|
364
|
+
<div class="end" part="end">
|
|
365
|
+
<slot name="end"></slot>
|
|
366
|
+
</div>
|
|
367
|
+
</header>
|
|
368
|
+
`;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
__decorate([
|
|
372
|
+
property({ type: Boolean, reflect: true })
|
|
373
|
+
], TTNavbar.prototype, "sticky", void 0);
|
|
374
|
+
__decorate([
|
|
375
|
+
property({ type: Boolean })
|
|
376
|
+
], TTNavbar.prototype, "bordered", void 0);
|
|
377
|
+
__decorate([
|
|
378
|
+
property({ type: String })
|
|
379
|
+
], TTNavbar.prototype, "size", void 0);
|
|
380
|
+
__decorate([
|
|
381
|
+
property({ type: Boolean, attribute: "mobile-menu-open" })
|
|
382
|
+
], TTNavbar.prototype, "mobileMenuOpen", void 0);
|
|
383
|
+
__decorate([
|
|
384
|
+
property({ type: Boolean, attribute: "scroll-edge", reflect: true })
|
|
385
|
+
], TTNavbar.prototype, "scrollEdge", void 0);
|
|
386
|
+
TTNavbar = __decorate([
|
|
387
|
+
customElement("tt-navbar")
|
|
388
|
+
], TTNavbar);
|
|
389
|
+
export { TTNavbar };
|
|
390
|
+
//# sourceMappingURL=tt-navbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-navbar.js","sourceRoot":"","sources":["../src/tt-navbar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AAKf,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,wEAAwE;QACxE,wEAAwE;QACxE,wEAAwE;QACxE,+DAA+D;QAC/D,EAAE;QACF,qEAAqE;QACrE,sEAAsE;QACtE,2BAA2B;QAE3B,WAAM,GAAG,KAAK,CAAC;QAEf,gEAAgE;QAChE,kBAAkB;QAElB,aAAQ,GAAG,KAAK,CAAC;QAEjB,gEAAgE;QAChE,oEAAoE;QAEpE,SAAI,GAAe,QAAQ,CAAC;QAG5B,mBAAc,GAAG,KAAK,CAAC;QAEvB;;;;;;;;;;;;WAYG;QAEH,eAAU,GAAG,KAAK,CAAC;IA4UrB,CAAC;IA1US,gBAAgB;QACtB,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC;QAE3C,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,gBAAgB,EAAE;YAChC,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,cAAc;aAC1B;YACD,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuQlB,AAvQY,CAuQX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;;;;YAIH,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;;;;;UAKjC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM;YAC9B,CAAC,CAAC,IAAI,CAAA,yDAAyD;YAC/D,CAAC,CAAC,OAAO;;;;;;;;kBAQD,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW;qBAC7C,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;6BAC9B,IAAI,CAAC,gBAAgB;;;mBAG/B,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;KAuBhD,CAAC;IACJ,CAAC;;AAxWD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAC5B;AAKf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACX;AAKjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCACC;AAG5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;gDACpC;AAgBvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAClD;AAvCR,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAmXpB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Title, optional description, optional breadcrumb, and a row of actions
|
|
4
|
+
* pinned to the right.
|
|
5
|
+
*
|
|
6
|
+
* This is the most repeated block in any application: every list, detail
|
|
7
|
+
* and settings screen opens with it. Without a component, each page
|
|
8
|
+
* invents slightly different spacing and the product stops feeling like
|
|
9
|
+
* one thing.
|
|
10
|
+
*
|
|
11
|
+
* tt-page owns the page frame and its width. This owns the top of the
|
|
12
|
+
* content.
|
|
13
|
+
*/
|
|
14
|
+
export declare class TTPageHeader extends LitElement {
|
|
15
|
+
heading: string;
|
|
16
|
+
description: string;
|
|
17
|
+
bordered: boolean;
|
|
18
|
+
private hasBreadcrumb;
|
|
19
|
+
static styles: import("lit").CSSResult;
|
|
20
|
+
private onBreadcrumbChange;
|
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
"tt-page-header": TTPageHeader;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=tt-page-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-page-header.d.ts","sourceRoot":"","sources":["../src/tt-page-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;;;;;GAWG;AACH,qBACa,YAAa,SAAQ,UAAU;IACd,OAAO,SAAM;IAEb,WAAW,SAAM;IAIhB,QAAQ,UAAS;IAKrC,OAAO,CAAC,aAAa,CAAS;IAEvC,MAAM,CAAC,MAAM,0BA8EX;IAEF,OAAO,CAAC,kBAAkB;IAa1B,MAAM;CA4BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
* Title, optional description, optional breadcrumb, and a row of actions
|
|
11
|
+
* pinned to the right.
|
|
12
|
+
*
|
|
13
|
+
* This is the most repeated block in any application: every list, detail
|
|
14
|
+
* and settings screen opens with it. Without a component, each page
|
|
15
|
+
* invents slightly different spacing and the product stops feeling like
|
|
16
|
+
* one thing.
|
|
17
|
+
*
|
|
18
|
+
* tt-page owns the page frame and its width. This owns the top of the
|
|
19
|
+
* content.
|
|
20
|
+
*/
|
|
21
|
+
let TTPageHeader = class TTPageHeader extends LitElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.heading = "";
|
|
25
|
+
this.description = "";
|
|
26
|
+
// Divider underneath. Useful on list screens, usually wrong on a
|
|
27
|
+
// detail screen where a card follows immediately.
|
|
28
|
+
this.bordered = false;
|
|
29
|
+
// Whether anything is in the breadcrumb slot. Its row carries the space
|
|
30
|
+
// under it, and no CSS selector can see slotted content, so an empty
|
|
31
|
+
// row pushed the title 8px below the actions it shares a line with.
|
|
32
|
+
this.hasBreadcrumb = false;
|
|
33
|
+
}
|
|
34
|
+
static { this.styles = css `
|
|
35
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
36
|
+
hidden element would still show. Important, so it always wins. */
|
|
37
|
+
:host([hidden]) {
|
|
38
|
+
display: none !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host {
|
|
42
|
+
display: block;
|
|
43
|
+
font-family: var(--tt-font-sans);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.header {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: flex-start;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
gap: var(--tt-space-5);
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.bordered {
|
|
55
|
+
padding-bottom: var(--tt-space-5);
|
|
56
|
+
border-bottom: 1px solid var(--tt-border);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.text {
|
|
60
|
+
flex: 1;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.breadcrumb {
|
|
65
|
+
margin-bottom: var(--tt-space-2);
|
|
66
|
+
font-size: var(--tt-text-xs);
|
|
67
|
+
color: var(--tt-muted-foreground);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
h1 {
|
|
71
|
+
margin: 0;
|
|
72
|
+
|
|
73
|
+
font-family: var(--tt-font-display);
|
|
74
|
+
font-size: var(--tt-text-2xl);
|
|
75
|
+
font-weight: var(--tt-weight-bold);
|
|
76
|
+
line-height: var(--tt-leading-tight);
|
|
77
|
+
letter-spacing: -0.02em;
|
|
78
|
+
|
|
79
|
+
color: var(--tt-foreground);
|
|
80
|
+
overflow-wrap: anywhere;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
p {
|
|
84
|
+
margin: var(--tt-space-2) 0 0;
|
|
85
|
+
max-width: 62ch;
|
|
86
|
+
|
|
87
|
+
font-size: var(--tt-text-sm);
|
|
88
|
+
line-height: var(--tt-leading-relaxed);
|
|
89
|
+
color: var(--tt-muted-foreground);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Actions keep their size and sit at the right. flex-wrap on the
|
|
93
|
+
parent drops them onto their own line when space runs out, rather
|
|
94
|
+
than squashing the title. */
|
|
95
|
+
.actions {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: var(--tt-space-2);
|
|
99
|
+
flex-shrink: 0;
|
|
100
|
+
flex-wrap: wrap;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
::slotted([slot="breadcrumb"]) {
|
|
104
|
+
margin: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (max-width: 480px) {
|
|
108
|
+
.actions {
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`; }
|
|
113
|
+
onBreadcrumbChange(event) {
|
|
114
|
+
const slot = event.target;
|
|
115
|
+
// Whitespace between tags is not content.
|
|
116
|
+
this.hasBreadcrumb = slot
|
|
117
|
+
.assignedNodes({ flatten: true })
|
|
118
|
+
.some((node) => node.nodeType === Node.ELEMENT_NODE ||
|
|
119
|
+
(node.textContent ?? "").trim() !== "");
|
|
120
|
+
}
|
|
121
|
+
render() {
|
|
122
|
+
return html `
|
|
123
|
+
<div class="header ${this.bordered ? "bordered" : ""}" part="header">
|
|
124
|
+
<div class="text">
|
|
125
|
+
<!-- Always rendered, so the slot exists and reports
|
|
126
|
+
slotchange; hidden while it is empty. -->
|
|
127
|
+
<div class="breadcrumb" ?hidden=${!this.hasBreadcrumb}>
|
|
128
|
+
<slot
|
|
129
|
+
name="breadcrumb"
|
|
130
|
+
@slotchange=${this.onBreadcrumbChange}
|
|
131
|
+
></slot>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<h1 part="heading">${this.heading}</h1>
|
|
135
|
+
|
|
136
|
+
${this.description
|
|
137
|
+
? html `<p part="description">${this.description}</p>`
|
|
138
|
+
: ""}
|
|
139
|
+
|
|
140
|
+
<slot></slot>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<div class="actions" part="actions">
|
|
144
|
+
<slot name="actions"></slot>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
__decorate([
|
|
151
|
+
property({ type: String })
|
|
152
|
+
], TTPageHeader.prototype, "heading", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
property({ type: String })
|
|
155
|
+
], TTPageHeader.prototype, "description", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: Boolean })
|
|
158
|
+
], TTPageHeader.prototype, "bordered", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
state()
|
|
161
|
+
], TTPageHeader.prototype, "hasBreadcrumb", void 0);
|
|
162
|
+
TTPageHeader = __decorate([
|
|
163
|
+
customElement("tt-page-header")
|
|
164
|
+
], TTPageHeader);
|
|
165
|
+
export { TTPageHeader };
|
|
166
|
+
//# sourceMappingURL=tt-page-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-page-header.js","sourceRoot":"","sources":["../src/tt-page-header.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;GAWG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACuB,YAAO,GAAG,EAAE,CAAC;QAEb,gBAAW,GAAG,EAAE,CAAC;QAE7C,iEAAiE;QACjE,kDAAkD;QACrB,aAAQ,GAAG,KAAK,CAAC;QAE9C,wEAAwE;QACxE,qEAAqE;QACrE,oEAAoE;QACnD,kBAAa,GAAG,KAAK,CAAC;IA2HzC,CAAC;aAzHQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8ElB,AA9EY,CA8EX;IAEM,kBAAkB,CAAC,KAAY;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;QAE7C,0CAA0C;QAC1C,IAAI,CAAC,aAAa,GAAG,IAAI;aACtB,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;aAChC,IAAI,CACH,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACnC,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CACzC,CAAC;IACN,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;2BACY,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;;;;4CAId,CAAC,IAAI,CAAC,aAAa;;;4BAGnC,IAAI,CAAC,kBAAkB;;;;+BAIpB,IAAI,CAAC,OAAO;;YAE/B,IAAI,CAAC,WAAW;YAChB,CAAC,CAAC,IAAI,CAAA,yBAAyB,IAAI,CAAC,WAAW,MAAM;YACrD,CAAC,CAAC,EAAE;;;;;;;;;KASX,CAAC;IACJ,CAAC;;AArI2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AAEb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAkB;AAIhB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAkB;AAK7B;IAAhB,KAAK,EAAE;mDAA+B;AAZ5B,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAuIxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class TTPage extends LitElement {
|
|
3
|
+
heading: string;
|
|
4
|
+
description: string;
|
|
5
|
+
width: "narrow" | "default" | "wide" | "full";
|
|
6
|
+
static styles: import("lit").CSSResult;
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
"tt-page": TTPage;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=tt-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-page.d.ts","sourceRoot":"","sources":["../src/tt-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBACa,MAAO,SAAQ,UAAU;IAIpC,OAAO,SAAM;IAGb,WAAW,SAAM;IAMjB,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAa;IAE1D,MAAM,CAAC,MAAM,0BAgHX;IAEF,MAAM;CAeP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|