@tartaguti/ui-components 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +192 -2
- package/THIRD-PARTY-NOTICES.md +29 -0
- package/custom-elements.json +16899 -0
- package/dist/accordion/tt-accordion-item.d.ts +32 -0
- package/dist/accordion/tt-accordion-item.d.ts.map +1 -0
- package/dist/accordion/tt-accordion-item.js +247 -0
- package/dist/accordion/tt-accordion-item.js.map +1 -0
- package/dist/accordion/tt-accordion.d.ts +28 -0
- package/dist/accordion/tt-accordion.d.ts.map +1 -0
- package/dist/accordion/tt-accordion.js +148 -0
- package/dist/accordion/tt-accordion.js.map +1 -0
- package/dist/bento/tt-bento-item.d.ts +35 -0
- package/dist/bento/tt-bento-item.d.ts.map +1 -0
- package/dist/bento/tt-bento-item.js +201 -0
- package/dist/bento/tt-bento-item.js.map +1 -0
- package/dist/bento/tt-bento.d.ts +25 -0
- package/dist/bento/tt-bento.d.ts.map +1 -0
- package/dist/bento/tt-bento.js +314 -0
- package/dist/bento/tt-bento.js.map +1 -0
- package/dist/floating.d.ts +61 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +120 -0
- package/dist/floating.js.map +1 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/tt-draggable.d.ts +29 -0
- package/dist/interaction/tt-draggable.d.ts.map +1 -0
- package/dist/interaction/tt-draggable.js +66 -0
- package/dist/interaction/tt-draggable.js.map +1 -0
- package/dist/interaction/tt-droppable.d.ts +37 -0
- package/dist/interaction/tt-droppable.d.ts.map +1 -0
- package/dist/interaction/tt-droppable.js +108 -0
- package/dist/interaction/tt-droppable.js.map +1 -0
- package/dist/interaction/tt-resizable.d.ts +45 -0
- package/dist/interaction/tt-resizable.d.ts.map +1 -0
- package/dist/interaction/tt-resizable.js +210 -0
- package/dist/interaction/tt-resizable.js.map +1 -0
- package/dist/interaction/tt-reveal.d.ts +54 -0
- package/dist/interaction/tt-reveal.d.ts.map +1 -0
- package/dist/interaction/tt-reveal.js +302 -0
- package/dist/interaction/tt-reveal.js.map +1 -0
- package/dist/motion.d.ts +8 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +49 -0
- package/dist/motion.js.map +1 -0
- package/dist/overlay.d.ts +7 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +121 -0
- package/dist/overlay.js.map +1 -0
- package/dist/safe-url.d.ts +14 -0
- package/dist/safe-url.d.ts.map +1 -0
- package/dist/safe-url.js +46 -0
- package/dist/safe-url.js.map +1 -0
- package/dist/scroll-lock.d.ts +22 -0
- package/dist/scroll-lock.d.ts.map +1 -0
- package/dist/scroll-lock.js +56 -0
- package/dist/scroll-lock.js.map +1 -0
- package/dist/sidebar/tt-menu-group.d.ts +69 -0
- package/dist/sidebar/tt-menu-group.d.ts.map +1 -0
- package/dist/sidebar/tt-menu-group.js +358 -0
- package/dist/sidebar/tt-menu-group.js.map +1 -0
- package/dist/sidebar/tt-menu-item.d.ts +70 -0
- package/dist/sidebar/tt-menu-item.d.ts.map +1 -0
- package/dist/sidebar/tt-menu-item.js +502 -0
- package/dist/sidebar/tt-menu-item.js.map +1 -0
- package/dist/sidebar/tt-sidebar-footer.d.ts +39 -0
- package/dist/sidebar/tt-sidebar-footer.d.ts.map +1 -0
- package/dist/sidebar/tt-sidebar-footer.js +205 -0
- package/dist/sidebar/tt-sidebar-footer.js.map +1 -0
- package/dist/sidebar/tt-sidebar-header.d.ts +31 -0
- package/dist/sidebar/tt-sidebar-header.d.ts.map +1 -0
- package/dist/sidebar/tt-sidebar-header.js +150 -0
- package/dist/sidebar/tt-sidebar-header.js.map +1 -0
- package/dist/sidebar/tt-sidebar.d.ts +72 -0
- package/dist/sidebar/tt-sidebar.d.ts.map +1 -0
- package/dist/sidebar/tt-sidebar.js +539 -0
- package/dist/sidebar/tt-sidebar.js.map +1 -0
- package/dist/sr-only.d.ts +15 -0
- package/dist/sr-only.d.ts.map +1 -0
- package/dist/sr-only.js +27 -0
- package/dist/sr-only.js.map +1 -0
- package/dist/tokens.css +1124 -0
- package/dist/tt-alert.d.ts +26 -0
- package/dist/tt-alert.d.ts.map +1 -0
- package/dist/tt-alert.js +165 -0
- package/dist/tt-alert.js.map +1 -0
- package/dist/tt-aspect-ratio.d.ts +40 -0
- package/dist/tt-aspect-ratio.d.ts.map +1 -0
- package/dist/tt-aspect-ratio.js +98 -0
- package/dist/tt-aspect-ratio.js.map +1 -0
- package/dist/tt-auth.d.ts +75 -0
- package/dist/tt-auth.d.ts.map +1 -0
- package/dist/tt-auth.js +520 -0
- package/dist/tt-auth.js.map +1 -0
- package/dist/tt-avatar.d.ts +26 -0
- package/dist/tt-avatar.d.ts.map +1 -0
- package/dist/tt-avatar.js +169 -0
- package/dist/tt-avatar.js.map +1 -0
- package/dist/tt-badge.d.ts +36 -0
- package/dist/tt-badge.d.ts.map +1 -0
- package/dist/tt-badge.js +135 -0
- package/dist/tt-badge.js.map +1 -0
- package/dist/tt-breadcrumbs.d.ts +22 -0
- package/dist/tt-breadcrumbs.d.ts.map +1 -0
- package/dist/tt-breadcrumbs.js +144 -0
- package/dist/tt-breadcrumbs.js.map +1 -0
- package/dist/tt-button-group.d.ts +32 -0
- package/dist/tt-button-group.d.ts.map +1 -0
- package/dist/tt-button-group.js +132 -0
- package/dist/tt-button-group.js.map +1 -0
- package/dist/tt-button.d.ts +31 -0
- package/dist/tt-button.d.ts.map +1 -0
- package/dist/tt-button.js +483 -0
- package/dist/tt-button.js.map +1 -0
- package/dist/tt-card.d.ts +26 -0
- package/dist/tt-card.d.ts.map +1 -0
- package/dist/tt-card.js +429 -0
- package/dist/tt-card.js.map +1 -0
- package/dist/tt-chart.d.ts +36 -0
- package/dist/tt-chart.d.ts.map +1 -0
- package/dist/tt-chart.js +332 -0
- package/dist/tt-chart.js.map +1 -0
- package/dist/tt-checkbox-group.d.ts +38 -0
- package/dist/tt-checkbox-group.d.ts.map +1 -0
- package/dist/tt-checkbox-group.js +243 -0
- package/dist/tt-checkbox-group.js.map +1 -0
- package/dist/tt-checkbox.d.ts +35 -0
- package/dist/tt-checkbox.d.ts.map +1 -0
- package/dist/tt-checkbox.js +354 -0
- package/dist/tt-checkbox.js.map +1 -0
- package/dist/tt-code-block.d.ts +37 -0
- package/dist/tt-code-block.d.ts.map +1 -0
- package/dist/tt-code-block.js +409 -0
- package/dist/tt-code-block.js.map +1 -0
- package/dist/tt-collapsible.d.ts +71 -0
- package/dist/tt-collapsible.d.ts.map +1 -0
- package/dist/tt-collapsible.js +206 -0
- package/dist/tt-collapsible.js.map +1 -0
- package/dist/tt-combobox.d.ts +107 -0
- package/dist/tt-combobox.d.ts.map +1 -0
- package/dist/tt-combobox.js +816 -0
- package/dist/tt-combobox.js.map +1 -0
- package/dist/tt-company-card.d.ts +30 -0
- package/dist/tt-company-card.d.ts.map +1 -0
- package/dist/tt-company-card.js +382 -0
- package/dist/tt-company-card.js.map +1 -0
- package/dist/tt-comparison-table.d.ts +59 -0
- package/dist/tt-comparison-table.d.ts.map +1 -0
- package/dist/tt-comparison-table.js +441 -0
- package/dist/tt-comparison-table.js.map +1 -0
- package/dist/tt-component-doc.d.ts +63 -0
- package/dist/tt-component-doc.d.ts.map +1 -0
- package/dist/tt-component-doc.js +585 -0
- package/dist/tt-component-doc.js.map +1 -0
- package/dist/tt-confirm.d.ts +45 -0
- package/dist/tt-confirm.d.ts.map +1 -0
- package/dist/tt-confirm.js +151 -0
- package/dist/tt-confirm.js.map +1 -0
- package/dist/tt-contact-list.d.ts +18 -0
- package/dist/tt-contact-list.d.ts.map +1 -0
- package/dist/tt-contact-list.js +101 -0
- package/dist/tt-contact-list.js.map +1 -0
- package/dist/tt-copy-button.d.ts +25 -0
- package/dist/tt-copy-button.d.ts.map +1 -0
- package/dist/tt-copy-button.js +194 -0
- package/dist/tt-copy-button.js.map +1 -0
- package/dist/tt-data-table.d.ts +96 -0
- package/dist/tt-data-table.d.ts.map +1 -0
- package/dist/tt-data-table.js +812 -0
- package/dist/tt-data-table.js.map +1 -0
- package/dist/tt-divider.d.ts +19 -0
- package/dist/tt-divider.d.ts.map +1 -0
- package/dist/tt-divider.js +104 -0
- package/dist/tt-divider.js.map +1 -0
- package/dist/tt-drawer.d.ts +38 -0
- package/dist/tt-drawer.d.ts.map +1 -0
- package/dist/tt-drawer.js +433 -0
- package/dist/tt-drawer.js.map +1 -0
- package/dist/tt-dropdown-menu.d.ts +57 -0
- package/dist/tt-dropdown-menu.d.ts.map +1 -0
- package/dist/tt-dropdown-menu.js +631 -0
- package/dist/tt-dropdown-menu.js.map +1 -0
- package/dist/tt-empty-state.d.ts +13 -0
- package/dist/tt-empty-state.d.ts.map +1 -0
- package/dist/tt-empty-state.js +94 -0
- package/dist/tt-empty-state.js.map +1 -0
- package/dist/tt-example.d.ts +33 -0
- package/dist/tt-example.d.ts.map +1 -0
- package/dist/tt-example.js +250 -0
- package/dist/tt-example.js.map +1 -0
- package/dist/tt-file-upload.d.ts +85 -0
- package/dist/tt-file-upload.d.ts.map +1 -0
- package/dist/tt-file-upload.js +662 -0
- package/dist/tt-file-upload.js.map +1 -0
- package/dist/tt-filter.d.ts +62 -0
- package/dist/tt-filter.d.ts.map +1 -0
- package/dist/tt-filter.js +393 -0
- package/dist/tt-filter.js.map +1 -0
- package/dist/tt-form.d.ts +33 -0
- package/dist/tt-form.d.ts.map +1 -0
- package/dist/tt-form.js +202 -0
- package/dist/tt-form.js.map +1 -0
- package/dist/tt-grid.d.ts +22 -0
- package/dist/tt-grid.d.ts.map +1 -0
- package/dist/tt-grid.js +106 -0
- package/dist/tt-grid.js.map +1 -0
- package/dist/tt-icon.d.ts +20 -0
- package/dist/tt-icon.d.ts.map +1 -0
- package/dist/tt-icon.js +510 -0
- package/dist/tt-icon.js.map +1 -0
- package/dist/tt-image.d.ts +59 -0
- package/dist/tt-image.d.ts.map +1 -0
- package/dist/tt-image.js +314 -0
- package/dist/tt-image.js.map +1 -0
- package/dist/tt-inbox.d.ts +45 -0
- package/dist/tt-inbox.d.ts.map +1 -0
- package/dist/tt-inbox.js +275 -0
- package/dist/tt-inbox.js.map +1 -0
- package/dist/tt-input.d.ts +43 -0
- package/dist/tt-input.d.ts.map +1 -0
- package/dist/tt-input.js +476 -0
- package/dist/tt-input.js.map +1 -0
- package/dist/tt-kbd.d.ts +39 -0
- package/dist/tt-kbd.d.ts.map +1 -0
- package/dist/tt-kbd.js +145 -0
- package/dist/tt-kbd.js.map +1 -0
- package/dist/tt-key-values.d.ts +17 -0
- package/dist/tt-key-values.d.ts.map +1 -0
- package/dist/tt-key-values.js +126 -0
- package/dist/tt-key-values.js.map +1 -0
- package/dist/tt-knowledge-doc.d.ts +24 -0
- package/dist/tt-knowledge-doc.d.ts.map +1 -0
- package/dist/tt-knowledge-doc.js +120 -0
- package/dist/tt-knowledge-doc.js.map +1 -0
- package/dist/tt-layout.d.ts +36 -0
- package/dist/tt-layout.d.ts.map +1 -0
- package/dist/tt-layout.js +318 -0
- package/dist/tt-layout.js.map +1 -0
- package/dist/tt-modal.d.ts +32 -0
- package/dist/tt-modal.d.ts.map +1 -0
- package/dist/tt-modal.js +553 -0
- package/dist/tt-modal.js.map +1 -0
- package/dist/tt-navbar.d.ts +33 -0
- package/dist/tt-navbar.d.ts.map +1 -0
- package/dist/tt-navbar.js +390 -0
- package/dist/tt-navbar.js.map +1 -0
- package/dist/tt-page-header.d.ts +28 -0
- package/dist/tt-page-header.d.ts.map +1 -0
- package/dist/tt-page-header.js +166 -0
- package/dist/tt-page-header.js.map +1 -0
- package/dist/tt-page.d.ts +14 -0
- package/dist/tt-page.d.ts.map +1 -0
- package/dist/tt-page.js +163 -0
- package/dist/tt-page.js.map +1 -0
- package/dist/tt-pagination.d.ts +27 -0
- package/dist/tt-pagination.d.ts.map +1 -0
- package/dist/tt-pagination.js +194 -0
- package/dist/tt-pagination.js.map +1 -0
- package/dist/tt-preview.d.ts +11 -0
- package/dist/tt-preview.d.ts.map +1 -0
- package/dist/tt-preview.js +68 -0
- package/dist/tt-preview.js.map +1 -0
- package/dist/tt-product.d.ts +40 -0
- package/dist/tt-product.d.ts.map +1 -0
- package/dist/tt-product.js +590 -0
- package/dist/tt-product.js.map +1 -0
- package/dist/tt-profile-card.d.ts +23 -0
- package/dist/tt-profile-card.d.ts.map +1 -0
- package/dist/tt-profile-card.js +199 -0
- package/dist/tt-profile-card.js.map +1 -0
- package/dist/tt-progress.d.ts +26 -0
- package/dist/tt-progress.d.ts.map +1 -0
- package/dist/tt-progress.js +156 -0
- package/dist/tt-progress.js.map +1 -0
- package/dist/tt-quantity.d.ts +36 -0
- package/dist/tt-quantity.d.ts.map +1 -0
- package/dist/tt-quantity.js +396 -0
- package/dist/tt-quantity.js.map +1 -0
- package/dist/tt-radio-group.d.ts +50 -0
- package/dist/tt-radio-group.d.ts.map +1 -0
- package/dist/tt-radio-group.js +372 -0
- package/dist/tt-radio-group.js.map +1 -0
- package/dist/tt-rating.d.ts +54 -0
- package/dist/tt-rating.d.ts.map +1 -0
- package/dist/tt-rating.js +312 -0
- package/dist/tt-rating.js.map +1 -0
- package/dist/tt-search.d.ts +47 -0
- package/dist/tt-search.d.ts.map +1 -0
- package/dist/tt-search.js +360 -0
- package/dist/tt-search.js.map +1 -0
- package/dist/tt-section.d.ts +13 -0
- package/dist/tt-section.d.ts.map +1 -0
- package/dist/tt-section.js +98 -0
- package/dist/tt-section.js.map +1 -0
- package/dist/tt-select.d.ts +62 -0
- package/dist/tt-select.d.ts.map +1 -0
- package/dist/tt-select.js +662 -0
- package/dist/tt-select.js.map +1 -0
- package/dist/tt-skeleton.d.ts +20 -0
- package/dist/tt-skeleton.d.ts.map +1 -0
- package/dist/tt-skeleton.js +143 -0
- package/dist/tt-skeleton.js.map +1 -0
- package/dist/tt-slider.d.ts +74 -0
- package/dist/tt-slider.d.ts.map +1 -0
- package/dist/tt-slider.js +426 -0
- package/dist/tt-slider.js.map +1 -0
- package/dist/tt-social-links.d.ts +34 -0
- package/dist/tt-social-links.d.ts.map +1 -0
- package/dist/tt-social-links.js +242 -0
- package/dist/tt-social-links.js.map +1 -0
- package/dist/tt-sparkline.d.ts +19 -0
- package/dist/tt-sparkline.d.ts.map +1 -0
- package/dist/tt-sparkline.js +191 -0
- package/dist/tt-sparkline.js.map +1 -0
- package/dist/tt-spinner.d.ts +19 -0
- package/dist/tt-spinner.d.ts.map +1 -0
- package/dist/tt-spinner.js +93 -0
- package/dist/tt-spinner.js.map +1 -0
- package/dist/tt-stack.d.ts +42 -0
- package/dist/tt-stack.d.ts.map +1 -0
- package/dist/tt-stack.js +158 -0
- package/dist/tt-stack.js.map +1 -0
- package/dist/tt-stat.d.ts +17 -0
- package/dist/tt-stat.d.ts.map +1 -0
- package/dist/tt-stat.js +134 -0
- package/dist/tt-stat.js.map +1 -0
- package/dist/tt-switch.d.ts +39 -0
- package/dist/tt-switch.d.ts.map +1 -0
- package/dist/tt-switch.js +254 -0
- package/dist/tt-switch.js.map +1 -0
- package/dist/tt-switcher.d.ts +23 -0
- package/dist/tt-switcher.d.ts.map +1 -0
- package/dist/tt-switcher.js +203 -0
- package/dist/tt-switcher.js.map +1 -0
- package/dist/tt-table-cell.d.ts +26 -0
- package/dist/tt-table-cell.d.ts.map +1 -0
- package/dist/tt-table-cell.js +121 -0
- package/dist/tt-table-cell.js.map +1 -0
- package/dist/tt-table-row.d.ts +31 -0
- package/dist/tt-table-row.d.ts.map +1 -0
- package/dist/tt-table-row.js +72 -0
- package/dist/tt-table-row.js.map +1 -0
- package/dist/tt-table.d.ts +44 -0
- package/dist/tt-table.d.ts.map +1 -0
- package/dist/tt-table.js +270 -0
- package/dist/tt-table.js.map +1 -0
- package/dist/tt-tabs.d.ts +31 -0
- package/dist/tt-tabs.d.ts.map +1 -0
- package/dist/tt-tabs.js +223 -0
- package/dist/tt-tabs.js.map +1 -0
- package/dist/tt-tag-list.d.ts +19 -0
- package/dist/tt-tag-list.d.ts.map +1 -0
- package/dist/tt-tag-list.js +136 -0
- package/dist/tt-tag-list.js.map +1 -0
- package/dist/tt-text.d.ts +52 -0
- package/dist/tt-text.d.ts.map +1 -0
- package/dist/tt-text.js +337 -0
- package/dist/tt-text.js.map +1 -0
- package/dist/tt-textarea.d.ts +43 -0
- package/dist/tt-textarea.d.ts.map +1 -0
- package/dist/tt-textarea.js +356 -0
- package/dist/tt-textarea.js.map +1 -0
- package/dist/tt-thread.d.ts +62 -0
- package/dist/tt-thread.d.ts.map +1 -0
- package/dist/tt-thread.js +374 -0
- package/dist/tt-thread.js.map +1 -0
- package/dist/tt-toast.d.ts +49 -0
- package/dist/tt-toast.d.ts.map +1 -0
- package/dist/tt-toast.js +440 -0
- package/dist/tt-toast.js.map +1 -0
- package/dist/tt-toggle-group.d.ts +73 -0
- package/dist/tt-toggle-group.d.ts.map +1 -0
- package/dist/tt-toggle-group.js +273 -0
- package/dist/tt-toggle-group.js.map +1 -0
- package/dist/tt-toggle.d.ts +54 -0
- package/dist/tt-toggle.d.ts.map +1 -0
- package/dist/tt-toggle.js +232 -0
- package/dist/tt-toggle.js.map +1 -0
- package/dist/tt-toolbar.d.ts +26 -0
- package/dist/tt-toolbar.d.ts.map +1 -0
- package/dist/tt-toolbar.js +164 -0
- package/dist/tt-toolbar.js.map +1 -0
- package/dist/tt-tooltip.d.ts +42 -0
- package/dist/tt-tooltip.d.ts.map +1 -0
- package/dist/tt-tooltip.js +299 -0
- package/dist/tt-tooltip.js.map +1 -0
- package/package.json +84 -4
- package/vscode.html-custom-data.json +2911 -0
|
@@ -0,0 +1,136 @@
|
|
|
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, state, customElement } from "lit/decorators.js";
|
|
9
|
+
import "./tt-badge.js";
|
|
10
|
+
let TTTagList = class TTTagList extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.tags = [];
|
|
14
|
+
// How many to show before collapsing the rest. 0 means show all.
|
|
15
|
+
// A fixed count rather than measuring the container: predictable, and
|
|
16
|
+
// it cannot flicker or give a different answer on every resize.
|
|
17
|
+
this.max = 0;
|
|
18
|
+
// Whether the overflow indicator can be clicked to reveal the rest.
|
|
19
|
+
this.expandable = false;
|
|
20
|
+
// Purely visual, nobody outside needs it, so @state not @property.
|
|
21
|
+
this.expanded = false;
|
|
22
|
+
}
|
|
23
|
+
get visibleTags() {
|
|
24
|
+
if (this.max === 0 || this.expanded) {
|
|
25
|
+
return this.tags;
|
|
26
|
+
}
|
|
27
|
+
// slice returns a new array; it does not modify the original.
|
|
28
|
+
return this.tags.slice(0, this.max);
|
|
29
|
+
}
|
|
30
|
+
get hiddenCount() {
|
|
31
|
+
return this.tags.length - this.visibleTags.length;
|
|
32
|
+
}
|
|
33
|
+
expand() {
|
|
34
|
+
this.expanded = true;
|
|
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: block;
|
|
45
|
+
font-family: var(--tt-font-sans);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.list {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--tt-space-1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
A button, not a badge, because it is interactive: it has to be
|
|
57
|
+
focusable and reachable by keyboard. Styled to match a badge so it
|
|
58
|
+
does not look foreign next to them.
|
|
59
|
+
*/
|
|
60
|
+
.more {
|
|
61
|
+
border: none;
|
|
62
|
+
background: transparent;
|
|
63
|
+
|
|
64
|
+
padding: 2px var(--tt-space-2);
|
|
65
|
+
border-radius: var(--tt-radius-full);
|
|
66
|
+
|
|
67
|
+
color: var(--tt-muted-foreground);
|
|
68
|
+
|
|
69
|
+
font: inherit;
|
|
70
|
+
font-size: var(--tt-text-xs);
|
|
71
|
+
font-weight: var(--tt-weight-semibold);
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.more:hover {
|
|
78
|
+
color: var(--tt-foreground);
|
|
79
|
+
background: var(--tt-accent);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.more:focus-visible {
|
|
83
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
84
|
+
outline-offset: var(--tt-ring-offset);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Not interactive, so it renders as plain text rather than a button. */
|
|
88
|
+
.more-static {
|
|
89
|
+
padding: 2px var(--tt-space-2);
|
|
90
|
+
color: var(--tt-muted-foreground);
|
|
91
|
+
font-size: var(--tt-text-xs);
|
|
92
|
+
font-weight: var(--tt-weight-semibold);
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
}
|
|
95
|
+
`; }
|
|
96
|
+
render() {
|
|
97
|
+
const hidden = this.hiddenCount;
|
|
98
|
+
return html `
|
|
99
|
+
<div class="list" part="list">
|
|
100
|
+
${this.visibleTags.map((tag) => html `<tt-badge>${tag}</tt-badge>`)}
|
|
101
|
+
|
|
102
|
+
${hidden > 0
|
|
103
|
+
? this.expandable
|
|
104
|
+
? html `
|
|
105
|
+
<button
|
|
106
|
+
class="more"
|
|
107
|
+
part="more"
|
|
108
|
+
@click=${this.expand}
|
|
109
|
+
aria-label=${`Show ${hidden} more`}
|
|
110
|
+
>
|
|
111
|
+
+${hidden} more
|
|
112
|
+
</button>
|
|
113
|
+
`
|
|
114
|
+
: html `<span class="more-static" part="more">+${hidden}</span>`
|
|
115
|
+
: ""}
|
|
116
|
+
</div>
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
__decorate([
|
|
121
|
+
property({ type: Array })
|
|
122
|
+
], TTTagList.prototype, "tags", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
property({ type: Number })
|
|
125
|
+
], TTTagList.prototype, "max", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
property({ type: Boolean })
|
|
128
|
+
], TTTagList.prototype, "expandable", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
state()
|
|
131
|
+
], TTTagList.prototype, "expanded", void 0);
|
|
132
|
+
TTTagList = __decorate([
|
|
133
|
+
customElement("tt-tag-list")
|
|
134
|
+
], TTTagList);
|
|
135
|
+
export { TTTagList };
|
|
136
|
+
//# sourceMappingURL=tt-tag-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-tag-list.js","sourceRoot":"","sources":["../src/tt-tag-list.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,eAAe,CAAC;AAGhB,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACsB,SAAI,GAAa,EAAE,CAAC;QAE/C,iEAAiE;QACjE,sEAAsE;QACtE,gEAAgE;QACpC,QAAG,GAAG,CAAC,CAAC;QAEpC,oEAAoE;QACvC,eAAU,GAAG,KAAK,CAAC;QAEhD,mEAAmE;QAClD,aAAQ,GAAG,KAAK,CAAC;IAwGpC,CAAC;IAtGC,IAAY,WAAW;QACrB,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QAED,8DAA8D;QAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;IACpD,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DlB,AA3DY,CA2DX;IAEF,MAAM;QACJ,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;QAEhC,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA,aAAa,GAAG,aAAa,CAAC;;UAEhE,MAAM,GAAG,CAAC;YACV,CAAC,CAAC,IAAI,CAAC,UAAU;gBACf,CAAC,CAAC,IAAI,CAAA;;;;2BAIS,IAAI,CAAC,MAAM;+BACP,QAAQ,MAAM,OAAO;;qBAE/B,MAAM;;eAEZ;gBACH,CAAC,CAAC,IAAI,CAAA,0CAA0C,MAAM,SAAS;YACjE,CAAC,CAAC,EAAE;;KAET,CAAC;IACJ,CAAC;;AAlH0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCAAqB;AAKnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAS;AAGP;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAoB;AAG/B;IAAhB,KAAK,EAAE;2CAA0B;AAZvB,SAAS;IADrB,aAAa,CAAC,aAAa,CAAC;GAChB,SAAS,CAoHrB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type TextAs = "p" | "span" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
3
|
+
export type TextSize = "auto" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
4
|
+
export type TextWeight = "auto" | "regular" | "medium" | "semibold" | "bold";
|
|
5
|
+
export type TextTone = "default" | "muted" | "brand" | "success" | "warning" | "danger";
|
|
6
|
+
export type TextAlign = "start" | "center" | "end" | "justify";
|
|
7
|
+
/**
|
|
8
|
+
* A heading, a paragraph or a run of text, on the type scale.
|
|
9
|
+
*
|
|
10
|
+
* Every component styles its own text, so the library had no general
|
|
11
|
+
* one, and the apps wrote `<h2 style="font-size: ...">` by hand with a
|
|
12
|
+
* size that matched no token. This one can only take a step of the
|
|
13
|
+
* scale, a weight token and a colour token, so it follows the theme,
|
|
14
|
+
* dark mode included, and never drifts.
|
|
15
|
+
*
|
|
16
|
+
* ---------------------------------------------------------------------
|
|
17
|
+
* TWO SEPARATE QUESTIONS: WHAT IT IS, AND HOW IT LOOKS.
|
|
18
|
+
*
|
|
19
|
+
* `as` is meaning. It picks the real element in the shadow root, so an
|
|
20
|
+
* h2 is an h2 to a screen reader and in the page outline. `size` and
|
|
21
|
+
* `weight` are looks. They stay separate because the two disagree all
|
|
22
|
+
* the time: the heading of a small card is an h3 for the outline but
|
|
23
|
+
* should not be drawn at h3 size.
|
|
24
|
+
*
|
|
25
|
+
* Left on "auto", size and weight follow the tag: h1 is 3xl bold down
|
|
26
|
+
* to h6 at sm semibold, a paragraph is md regular. Setting either one
|
|
27
|
+
* overrides only that one.
|
|
28
|
+
*
|
|
29
|
+
* ---------------------------------------------------------------------
|
|
30
|
+
* THE TYPE IS SET ON THE HOST.
|
|
31
|
+
*
|
|
32
|
+
* Every rule below is a :host rule, and the element inside only
|
|
33
|
+
* inherits. So a consumer's own `font-size` or `color` on the element
|
|
34
|
+
* simply wins, because a rule from outside beats :host, the same reason
|
|
35
|
+
* tt-stack keeps its layout on the host.
|
|
36
|
+
*/
|
|
37
|
+
export declare class TTText extends LitElement {
|
|
38
|
+
as: TextAs;
|
|
39
|
+
size: TextSize;
|
|
40
|
+
weight: TextWeight;
|
|
41
|
+
tone: TextTone;
|
|
42
|
+
align: TextAlign;
|
|
43
|
+
maxLines: number;
|
|
44
|
+
static styles: import("lit").CSSResult;
|
|
45
|
+
render(): import("lit-html").TemplateResult;
|
|
46
|
+
}
|
|
47
|
+
declare global {
|
|
48
|
+
interface HTMLElementTagNameMap {
|
|
49
|
+
"tt-text": TTText;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=tt-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-text.d.ts","sourceRoot":"","sources":["../src/tt-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,KAAK,CAAC;AAK/C,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAC7E,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AACxF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAmB/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBACa,MAAO,SAAQ,UAAU;IAKO,EAAE,EAAE,MAAM,CAAO;IAGjB,IAAI,EAAE,QAAQ,CAAU;IAExB,MAAM,EAAE,UAAU,CAAU;IAI5B,IAAI,EAAE,QAAQ,CAAa;IAE3B,KAAK,EAAE,SAAS,CAAW;IAKlB,QAAQ,SAAK;IAEjE,MAAM,CAAC,MAAM,0BA8NX;IAEF,MAAM;CAgBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
package/dist/tt-text.js
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
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, css, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { html as staticHtml, literal } from "lit/static-html.js";
|
|
10
|
+
/*
|
|
11
|
+
The tags `as` may render. `literal` makes each one a constant written
|
|
12
|
+
in this file, which is what lets the tag be dynamic without
|
|
13
|
+
unsafeStatic: nothing a consumer passes ever becomes markup. A value
|
|
14
|
+
not in the list falls back to a paragraph.
|
|
15
|
+
*/
|
|
16
|
+
const TAGS = {
|
|
17
|
+
p: literal `p`,
|
|
18
|
+
span: literal `span`,
|
|
19
|
+
h1: literal `h1`,
|
|
20
|
+
h2: literal `h2`,
|
|
21
|
+
h3: literal `h3`,
|
|
22
|
+
h4: literal `h4`,
|
|
23
|
+
h5: literal `h5`,
|
|
24
|
+
h6: literal `h6`,
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A heading, a paragraph or a run of text, on the type scale.
|
|
28
|
+
*
|
|
29
|
+
* Every component styles its own text, so the library had no general
|
|
30
|
+
* one, and the apps wrote `<h2 style="font-size: ...">` by hand with a
|
|
31
|
+
* size that matched no token. This one can only take a step of the
|
|
32
|
+
* scale, a weight token and a colour token, so it follows the theme,
|
|
33
|
+
* dark mode included, and never drifts.
|
|
34
|
+
*
|
|
35
|
+
* ---------------------------------------------------------------------
|
|
36
|
+
* TWO SEPARATE QUESTIONS: WHAT IT IS, AND HOW IT LOOKS.
|
|
37
|
+
*
|
|
38
|
+
* `as` is meaning. It picks the real element in the shadow root, so an
|
|
39
|
+
* h2 is an h2 to a screen reader and in the page outline. `size` and
|
|
40
|
+
* `weight` are looks. They stay separate because the two disagree all
|
|
41
|
+
* the time: the heading of a small card is an h3 for the outline but
|
|
42
|
+
* should not be drawn at h3 size.
|
|
43
|
+
*
|
|
44
|
+
* Left on "auto", size and weight follow the tag: h1 is 3xl bold down
|
|
45
|
+
* to h6 at sm semibold, a paragraph is md regular. Setting either one
|
|
46
|
+
* overrides only that one.
|
|
47
|
+
*
|
|
48
|
+
* ---------------------------------------------------------------------
|
|
49
|
+
* THE TYPE IS SET ON THE HOST.
|
|
50
|
+
*
|
|
51
|
+
* Every rule below is a :host rule, and the element inside only
|
|
52
|
+
* inherits. So a consumer's own `font-size` or `color` on the element
|
|
53
|
+
* simply wins, because a rule from outside beats :host, the same reason
|
|
54
|
+
* tt-stack keeps its layout on the host.
|
|
55
|
+
*/
|
|
56
|
+
let TTText = class TTText extends LitElement {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(...arguments);
|
|
59
|
+
/*
|
|
60
|
+
Reflected, all of them. Each style is a :host([attr]) rule, and a
|
|
61
|
+
selector matches an attribute, never a property.
|
|
62
|
+
*/
|
|
63
|
+
this.as = "p";
|
|
64
|
+
// A step of the type scale, named like its token: "2xl" is --tt-text-2xl.
|
|
65
|
+
this.size = "auto";
|
|
66
|
+
this.weight = "auto";
|
|
67
|
+
// Colour from the theme only. "default" is the foreground, or for a
|
|
68
|
+
// span, the colour of the text around it.
|
|
69
|
+
this.tone = "default";
|
|
70
|
+
this.align = "start";
|
|
71
|
+
// Cuts the text off after this many lines, with an ellipsis. 0 shows
|
|
72
|
+
// it all. Not reflected: the number reaches the CSS as a custom
|
|
73
|
+
// property, so no attribute rule needs to see it.
|
|
74
|
+
this.maxLines = 0;
|
|
75
|
+
}
|
|
76
|
+
static { this.styles = css `
|
|
77
|
+
/*
|
|
78
|
+
The paragraph, which is also the fallback for a value it does not
|
|
79
|
+
know.
|
|
80
|
+
*/
|
|
81
|
+
:host {
|
|
82
|
+
display: block;
|
|
83
|
+
|
|
84
|
+
font-family: var(--tt-font-sans);
|
|
85
|
+
font-size: var(--tt-text-md);
|
|
86
|
+
font-weight: var(--tt-weight-regular);
|
|
87
|
+
line-height: var(--tt-leading-normal);
|
|
88
|
+
letter-spacing: normal;
|
|
89
|
+
color: var(--tt-foreground);
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
align is also an old HTML attribute, and Chrome turns it into a
|
|
93
|
+
text-align of its own on any element. Setting it here, from the
|
|
94
|
+
start value up, keeps that leftover rule out.
|
|
95
|
+
*/
|
|
96
|
+
text-align: start;
|
|
97
|
+
|
|
98
|
+
-webkit-font-smoothing: antialiased;
|
|
99
|
+
|
|
100
|
+
/* Avoids a single word left alone on the last line. */
|
|
101
|
+
text-wrap: pretty;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* ---- The tag's own look, used while size and weight are "auto" ----
|
|
105
|
+
|
|
106
|
+
These come BEFORE the size and weight rules on purpose. Both sets
|
|
107
|
+
have the same specificity, so source order decides, and an
|
|
108
|
+
explicit size has to beat the tag's. */
|
|
109
|
+
|
|
110
|
+
:host([as^="h"]) {
|
|
111
|
+
font-weight: var(--tt-weight-semibold);
|
|
112
|
+
line-height: var(--tt-leading-snug);
|
|
113
|
+
|
|
114
|
+
/* Balanced lines: a two-line heading splits near the middle
|
|
115
|
+
instead of leaving one word on the second line. */
|
|
116
|
+
text-wrap: balance;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Page-level headings take the display face, which a theme can
|
|
120
|
+
change; h4 and below are component-level and stay in the sans. */
|
|
121
|
+
:host([as="h1"]),
|
|
122
|
+
:host([as="h2"]),
|
|
123
|
+
:host([as="h3"]) {
|
|
124
|
+
font-family: var(--tt-font-display);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([as="h1"]) {
|
|
128
|
+
font-size: var(--tt-text-3xl);
|
|
129
|
+
font-weight: var(--tt-weight-bold);
|
|
130
|
+
line-height: var(--tt-leading-tight);
|
|
131
|
+
letter-spacing: -0.02em;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([as="h2"]) {
|
|
135
|
+
font-size: var(--tt-text-2xl);
|
|
136
|
+
font-weight: var(--tt-weight-bold);
|
|
137
|
+
line-height: var(--tt-leading-tight);
|
|
138
|
+
letter-spacing: -0.02em;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:host([as="h3"]) {
|
|
142
|
+
font-size: var(--tt-text-xl);
|
|
143
|
+
letter-spacing: -0.01em;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host([as="h4"]) {
|
|
147
|
+
font-size: var(--tt-text-lg);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:host([as="h5"]) {
|
|
151
|
+
font-size: var(--tt-text-md);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([as="h6"]) {
|
|
155
|
+
font-size: var(--tt-text-sm);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/*
|
|
159
|
+
A span is a run inside other text, so it takes everything from the
|
|
160
|
+
text around it: "Total <tt-text as="span" weight="bold">" changes
|
|
161
|
+
the weight and nothing else.
|
|
162
|
+
*/
|
|
163
|
+
:host([as="span"]) {
|
|
164
|
+
display: inline;
|
|
165
|
+
|
|
166
|
+
font: inherit;
|
|
167
|
+
letter-spacing: inherit;
|
|
168
|
+
color: inherit;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* ---- Explicit size ----
|
|
172
|
+
|
|
173
|
+
Each step brings its own line height and tracking, because large
|
|
174
|
+
text needs less of both. Every rule sets all three, so a step
|
|
175
|
+
chosen on a heading also undoes the tag's values. */
|
|
176
|
+
|
|
177
|
+
:host([size="xs"]) {
|
|
178
|
+
font-size: var(--tt-text-xs);
|
|
179
|
+
line-height: var(--tt-leading-normal);
|
|
180
|
+
letter-spacing: normal;
|
|
181
|
+
}
|
|
182
|
+
:host([size="sm"]) {
|
|
183
|
+
font-size: var(--tt-text-sm);
|
|
184
|
+
line-height: var(--tt-leading-normal);
|
|
185
|
+
letter-spacing: normal;
|
|
186
|
+
}
|
|
187
|
+
:host([size="md"]) {
|
|
188
|
+
font-size: var(--tt-text-md);
|
|
189
|
+
line-height: var(--tt-leading-normal);
|
|
190
|
+
letter-spacing: normal;
|
|
191
|
+
}
|
|
192
|
+
:host([size="lg"]) {
|
|
193
|
+
font-size: var(--tt-text-lg);
|
|
194
|
+
line-height: var(--tt-leading-snug);
|
|
195
|
+
letter-spacing: normal;
|
|
196
|
+
}
|
|
197
|
+
:host([size="xl"]) {
|
|
198
|
+
font-size: var(--tt-text-xl);
|
|
199
|
+
line-height: var(--tt-leading-snug);
|
|
200
|
+
letter-spacing: -0.01em;
|
|
201
|
+
}
|
|
202
|
+
:host([size="2xl"]) {
|
|
203
|
+
font-size: var(--tt-text-2xl);
|
|
204
|
+
line-height: var(--tt-leading-tight);
|
|
205
|
+
letter-spacing: -0.02em;
|
|
206
|
+
}
|
|
207
|
+
:host([size="3xl"]) {
|
|
208
|
+
font-size: var(--tt-text-3xl);
|
|
209
|
+
line-height: var(--tt-leading-tight);
|
|
210
|
+
letter-spacing: -0.02em;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* ---- Explicit weight ---- */
|
|
214
|
+
|
|
215
|
+
:host([weight="regular"]) {
|
|
216
|
+
font-weight: var(--tt-weight-regular);
|
|
217
|
+
}
|
|
218
|
+
:host([weight="medium"]) {
|
|
219
|
+
font-weight: var(--tt-weight-medium);
|
|
220
|
+
}
|
|
221
|
+
:host([weight="semibold"]) {
|
|
222
|
+
font-weight: var(--tt-weight-semibold);
|
|
223
|
+
}
|
|
224
|
+
:host([weight="bold"]) {
|
|
225
|
+
font-weight: var(--tt-weight-bold);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* ---- Tone ----
|
|
229
|
+
|
|
230
|
+
Tokens only. Each one is checked by the theme to read at 4.5:1 on
|
|
231
|
+
the page and on a card, in both themes, so no tone here can fail
|
|
232
|
+
contrast however it is combined. */
|
|
233
|
+
|
|
234
|
+
:host([tone="muted"]) {
|
|
235
|
+
color: var(--tt-muted-foreground);
|
|
236
|
+
}
|
|
237
|
+
:host([tone="brand"]) {
|
|
238
|
+
color: var(--tt-brand);
|
|
239
|
+
}
|
|
240
|
+
:host([tone="success"]) {
|
|
241
|
+
color: var(--tt-success);
|
|
242
|
+
}
|
|
243
|
+
:host([tone="warning"]) {
|
|
244
|
+
color: var(--tt-warning);
|
|
245
|
+
}
|
|
246
|
+
:host([tone="danger"]) {
|
|
247
|
+
color: var(--tt-destructive);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* ---- Alignment ---- */
|
|
251
|
+
|
|
252
|
+
:host([align="center"]) {
|
|
253
|
+
text-align: center;
|
|
254
|
+
}
|
|
255
|
+
:host([align="end"]) {
|
|
256
|
+
text-align: end;
|
|
257
|
+
}
|
|
258
|
+
:host([align="justify"]) {
|
|
259
|
+
text-align: justify;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/*
|
|
263
|
+
Last, so it beats the display: inline of a span as well. The
|
|
264
|
+
browser's own [hidden] rule is weaker than any author style.
|
|
265
|
+
*/
|
|
266
|
+
:host([hidden]) {
|
|
267
|
+
display: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/*
|
|
271
|
+
The real element only inherits: margin 0 and font: inherit undo the
|
|
272
|
+
browser's own heading and paragraph styles, so the host's rules are
|
|
273
|
+
the only ones that count. Colour, tracking and alignment inherit
|
|
274
|
+
on their own.
|
|
275
|
+
|
|
276
|
+
break-word, not anywhere: it still breaks a long URL, but leaves
|
|
277
|
+
the text's minimum width at its longest word, so a flex row cannot
|
|
278
|
+
squeeze it into a column of single letters.
|
|
279
|
+
*/
|
|
280
|
+
.text {
|
|
281
|
+
margin: 0;
|
|
282
|
+
font: inherit;
|
|
283
|
+
|
|
284
|
+
overflow-wrap: break-word;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/*
|
|
288
|
+
The clamp. line-clamp needs the -webkit-box display, which also
|
|
289
|
+
makes a clamped span behave as a block.
|
|
290
|
+
*/
|
|
291
|
+
.clamped {
|
|
292
|
+
display: -webkit-box;
|
|
293
|
+
-webkit-box-orient: vertical;
|
|
294
|
+
-webkit-line-clamp: var(--_lines);
|
|
295
|
+
line-clamp: var(--_lines);
|
|
296
|
+
overflow: hidden;
|
|
297
|
+
}
|
|
298
|
+
`; }
|
|
299
|
+
render() {
|
|
300
|
+
const tag = TAGS[this.as] ?? TAGS.p;
|
|
301
|
+
const lines = Math.max(0, Math.floor(this.maxLines || 0));
|
|
302
|
+
/*
|
|
303
|
+
The line count goes on the inner element's own style rather than
|
|
304
|
+
into the stylesheet, which is shared by every instance: two texts
|
|
305
|
+
with different counts would otherwise share whichever rendered
|
|
306
|
+
last.
|
|
307
|
+
*/
|
|
308
|
+
return staticHtml `<${tag}
|
|
309
|
+
class=${lines > 0 ? "text clamped" : "text"}
|
|
310
|
+
part="text"
|
|
311
|
+
style=${lines > 0 ? `--_lines: ${lines}` : nothing}
|
|
312
|
+
><slot></slot></${tag}>`;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ type: String, reflect: true })
|
|
317
|
+
], TTText.prototype, "as", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: String, reflect: true })
|
|
320
|
+
], TTText.prototype, "size", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: String, reflect: true })
|
|
323
|
+
], TTText.prototype, "weight", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: String, reflect: true })
|
|
326
|
+
], TTText.prototype, "tone", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: String, reflect: true })
|
|
329
|
+
], TTText.prototype, "align", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
property({ type: Number, attribute: "max-lines" })
|
|
332
|
+
], TTText.prototype, "maxLines", void 0);
|
|
333
|
+
TTText = __decorate([
|
|
334
|
+
customElement("tt-text")
|
|
335
|
+
], TTText);
|
|
336
|
+
export { TTText };
|
|
337
|
+
//# sourceMappingURL=tt-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-text.js","sourceRoot":"","sources":["../src/tt-text.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { PropertyValues } from "lit";
|
|
3
|
+
import type { AutoCompleteToken } from "./tt-input.js";
|
|
4
|
+
export declare class TTTextarea extends LitElement {
|
|
5
|
+
static formAssociated: boolean;
|
|
6
|
+
private internals;
|
|
7
|
+
label: string;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
value: string;
|
|
10
|
+
name: string;
|
|
11
|
+
autocomplete?: AutoCompleteToken;
|
|
12
|
+
error: string;
|
|
13
|
+
labelHidden: boolean;
|
|
14
|
+
rows: number;
|
|
15
|
+
maxlength: number;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
required: boolean;
|
|
18
|
+
fullWidth: boolean;
|
|
19
|
+
autoGrow: boolean;
|
|
20
|
+
private field;
|
|
21
|
+
private fieldId;
|
|
22
|
+
get form(): HTMLFormElement | null;
|
|
23
|
+
get validity(): ValidityState;
|
|
24
|
+
checkValidity(): boolean;
|
|
25
|
+
reportValidity(): boolean;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
formResetCallback(): void;
|
|
28
|
+
formStateRestoreCallback(state: string): void;
|
|
29
|
+
updated(changed: PropertyValues): void;
|
|
30
|
+
private syncFormState;
|
|
31
|
+
private resize;
|
|
32
|
+
private handleInput;
|
|
33
|
+
private handleChange;
|
|
34
|
+
focus(options?: FocusOptions): void;
|
|
35
|
+
static styles: import("lit").CSSResult[];
|
|
36
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
"tt-textarea": TTTextarea;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=tt-textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-textarea.d.ts","sourceRoot":"","sources":["../src/tt-textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,qBACa,UAAW,SAAQ,UAAU;IACxC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,SAAS,CAA0B;IAE/B,KAAK,SAAM;IACX,WAAW,SAAM;IACjB,KAAK,SAAM;IAWoB,IAAI,SAAM;IAOzC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,KAAK,SAAM;IAKvB,WAAW,UAAS;IAEQ,IAAI,SAAK;IAGT,SAAS,SAAK;IAGE,QAAQ,UAAS;IAChC,QAAQ,UAAS;IACuB,SAAS,UAAS;IAIlC,QAAQ,UAAS;IAEnD,OAAO,CAAC,KAAK,CAAuB;IAEvD,OAAO,CAAC,OAAO,CAA0B;IAEzC,IAAI,IAAI,2BAEP;IAED,IAAI,QAAQ,kBAEX;IACD,aAAa;IAIb,cAAc;IAId,iBAAiB;IAKjB,iBAAiB;IAIjB,wBAAwB,CAAC,KAAK,EAAE,MAAM;IAItC,OAAO,CAAC,OAAO,EAAE,cAAc;IAU/B,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,YAAY;IAUpB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,MAAM,CAAC,MAAM,4BA2HV;IAEH,MAAM;CA0EP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|