@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,360 @@
|
|
|
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
|
+
import "./tt-input.js";
|
|
10
|
+
import "./tt-icon.js";
|
|
11
|
+
/**
|
|
12
|
+
* A search field.
|
|
13
|
+
*
|
|
14
|
+
* One field, with the magnifier INSIDE it and a clear button that appears
|
|
15
|
+
* only when there is something to clear. There is no separate submit
|
|
16
|
+
* button, because search is not a form you submit: results follow typing.
|
|
17
|
+
* The old layout put a filled button beside the input, which read as two
|
|
18
|
+
* controls and made the field look like it needed permission to run.
|
|
19
|
+
* Enter still fires tt-search for anyone who expects it to.
|
|
20
|
+
*
|
|
21
|
+
* `collapsible` is opt-in, and off by default. Collapsing to an icon on a
|
|
22
|
+
* phone is right in a navbar, where the row is fighting for space, and
|
|
23
|
+
* wrong in a page toolbar, where the field is the main control on screen.
|
|
24
|
+
* Only the host knows which it is, so the host decides.
|
|
25
|
+
*/
|
|
26
|
+
let TTSearch = class TTSearch extends LitElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.placeholder = "Search";
|
|
30
|
+
this.value = "";
|
|
31
|
+
this.disabled = false;
|
|
32
|
+
// Handed to the field inside. Small by default, unlike tt-input,
|
|
33
|
+
// because a search lives in toolbars and navbars beside small controls;
|
|
34
|
+
// every use in this repo is small. Set medium to match a form row.
|
|
35
|
+
this.size = "small";
|
|
36
|
+
// On narrow screens, shrink to an icon that expands into a full-width
|
|
37
|
+
// field. For navbars.
|
|
38
|
+
this.collapsible = false;
|
|
39
|
+
this.debounce = 250;
|
|
40
|
+
this.minLength = 0;
|
|
41
|
+
this.expanded = false;
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
clearTimeout(this.debounceTimer);
|
|
45
|
+
super.disconnectedCallback();
|
|
46
|
+
}
|
|
47
|
+
emitInput() {
|
|
48
|
+
this.dispatchEvent(new CustomEvent("tt-search-input", {
|
|
49
|
+
detail: { value: this.value },
|
|
50
|
+
bubbles: true,
|
|
51
|
+
composed: true,
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
handleInput(event) {
|
|
55
|
+
// The inner tt-input's own event, stopped here like tt-filter stops
|
|
56
|
+
// its group's: tt-search speaks through tt-search-input, and a page
|
|
57
|
+
// listening for tt-input on a container would otherwise hear a stray
|
|
58
|
+
// one from inside the search box on every keystroke.
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
this.value = event.detail?.value ?? "";
|
|
61
|
+
clearTimeout(this.debounceTimer);
|
|
62
|
+
this.debounceTimer = setTimeout(() => {
|
|
63
|
+
// A partial query below minLength is not worth a round trip. Zero
|
|
64
|
+
// length is exempt: clearing the box has to reach the consumer, or
|
|
65
|
+
// the results stay filtered by a query that is no longer there.
|
|
66
|
+
if (this.value.length > 0 && this.value.length < this.minLength)
|
|
67
|
+
return;
|
|
68
|
+
this.emitInput();
|
|
69
|
+
}, this.debounce);
|
|
70
|
+
}
|
|
71
|
+
handleKeydown(event) {
|
|
72
|
+
if (event.key === "Enter") {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
this.emitSearch();
|
|
75
|
+
}
|
|
76
|
+
if (event.key === "Escape" && this.value !== "") {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
this.clear();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
emitSearch() {
|
|
82
|
+
if (this.disabled)
|
|
83
|
+
return;
|
|
84
|
+
this.dispatchEvent(new CustomEvent("tt-search", {
|
|
85
|
+
detail: { value: this.value },
|
|
86
|
+
bubbles: true,
|
|
87
|
+
composed: true,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
clear() {
|
|
91
|
+
this.value = "";
|
|
92
|
+
// Immediate, not debounced. Clearing is a deliberate act and waiting
|
|
93
|
+
// 250ms to see the full list back feels broken.
|
|
94
|
+
clearTimeout(this.debounceTimer);
|
|
95
|
+
this.emitInput();
|
|
96
|
+
this.focus();
|
|
97
|
+
}
|
|
98
|
+
expand() {
|
|
99
|
+
if (this.disabled)
|
|
100
|
+
return;
|
|
101
|
+
this.expanded = true;
|
|
102
|
+
// After the field exists in the DOM, not before.
|
|
103
|
+
this.updateComplete.then(() => this.focus());
|
|
104
|
+
}
|
|
105
|
+
handleBlur() {
|
|
106
|
+
// Collapse again only if nothing was typed, so a query is never lost
|
|
107
|
+
// to a stray tap outside.
|
|
108
|
+
if (this.collapsible && this.value === "")
|
|
109
|
+
this.expanded = false;
|
|
110
|
+
}
|
|
111
|
+
focus(options) {
|
|
112
|
+
this.renderRoot?.querySelector("tt-input")?.focus(options);
|
|
113
|
+
}
|
|
114
|
+
static { this.styles = css `
|
|
115
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
116
|
+
hidden element would still show. Important, so it always wins. */
|
|
117
|
+
:host([hidden]) {
|
|
118
|
+
display: none !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host {
|
|
122
|
+
display: block;
|
|
123
|
+
width: 100%;
|
|
124
|
+
font-family: var(--tt-font-sans);
|
|
125
|
+
|
|
126
|
+
--_h: var(--tt-control-md);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([size="small"]) {
|
|
130
|
+
--_h: var(--tt-control-sm);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host([size="large"]) {
|
|
134
|
+
--_h: var(--tt-control-lg);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:host([collapsible]) {
|
|
138
|
+
width: auto;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.icon {
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
color: var(--tt-muted-foreground);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
Sized off the control height so it stays a square target, and given
|
|
148
|
+
no border of its own: it lives inside the field's border already.
|
|
149
|
+
*/
|
|
150
|
+
.clear {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
|
|
155
|
+
width: calc(var(--tt-control-sm) - 8px);
|
|
156
|
+
height: calc(var(--tt-control-sm) - 8px);
|
|
157
|
+
|
|
158
|
+
padding: 0;
|
|
159
|
+
border: none;
|
|
160
|
+
border-radius: var(--tt-radius-full);
|
|
161
|
+
|
|
162
|
+
background: transparent;
|
|
163
|
+
color: var(--tt-muted-foreground);
|
|
164
|
+
|
|
165
|
+
font: inherit;
|
|
166
|
+
font-size: var(--tt-text-md);
|
|
167
|
+
line-height: 1;
|
|
168
|
+
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
/* Long-press should activate the control, not start selecting
|
|
171
|
+
its label. The other half of the mobile blue flash: the tap
|
|
172
|
+
highlight is the flash, this is the drag-select. */
|
|
173
|
+
-webkit-user-select: none;
|
|
174
|
+
user-select: none;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.clear:hover {
|
|
178
|
+
background: var(--tt-accent);
|
|
179
|
+
color: var(--tt-foreground);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.clear:focus-visible {
|
|
183
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
184
|
+
outline-offset: var(--tt-ring-offset);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* The collapsed trigger. Only ever rendered when collapsible. */
|
|
188
|
+
.toggle {
|
|
189
|
+
display: inline-flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
|
|
193
|
+
/* The same height as the field it opens, per size. It was always
|
|
194
|
+
the medium height, so a small or large search changed height
|
|
195
|
+
the moment it expanded. */
|
|
196
|
+
box-sizing: border-box;
|
|
197
|
+
width: var(--_h);
|
|
198
|
+
height: var(--_h);
|
|
199
|
+
|
|
200
|
+
padding: 0;
|
|
201
|
+
border: 1px solid transparent;
|
|
202
|
+
border-radius: var(--tt-radius);
|
|
203
|
+
|
|
204
|
+
background: transparent;
|
|
205
|
+
color: var(--tt-foreground);
|
|
206
|
+
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
/* Long-press should activate the control, not start selecting
|
|
209
|
+
its label. The other half of the mobile blue flash: the tap
|
|
210
|
+
highlight is the flash, this is the drag-select. */
|
|
211
|
+
-webkit-user-select: none;
|
|
212
|
+
user-select: none;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.toggle:hover {
|
|
216
|
+
background: var(--tt-accent);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.toggle:focus-visible {
|
|
220
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
221
|
+
outline-offset: var(--tt-ring-offset);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.field {
|
|
225
|
+
display: block;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/*
|
|
229
|
+
The field is ALWAYS rendered, and CSS decides whether it shows. The
|
|
230
|
+
first version only rendered it once expanded, which meant that on a
|
|
231
|
+
desktop, where the toggle is hidden, there was nothing left to see.
|
|
232
|
+
Rendering is not the place to make a responsive decision: a media
|
|
233
|
+
query knows the viewport, a template does not.
|
|
234
|
+
*/
|
|
235
|
+
@media (max-width: 768px) {
|
|
236
|
+
:host([collapsible]) .field {
|
|
237
|
+
display: none;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/*
|
|
241
|
+
Expanded, the field spans the row. Absolute against the host would
|
|
242
|
+
only cover the host's own width, which collapsed is one icon, so
|
|
243
|
+
it stretches across the nearest positioned ancestor instead.
|
|
244
|
+
*/
|
|
245
|
+
:host([collapsible]) .field.expanded {
|
|
246
|
+
display: block;
|
|
247
|
+
|
|
248
|
+
position: absolute;
|
|
249
|
+
left: var(--tt-space-3);
|
|
250
|
+
right: var(--tt-space-3);
|
|
251
|
+
|
|
252
|
+
z-index: var(--tt-z-dropdown);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* Above the breakpoint collapsible is ignored: there is room for the
|
|
257
|
+
field, so hiding it behind a tap helps nobody. */
|
|
258
|
+
@media (min-width: 769px) {
|
|
259
|
+
:host([collapsible]) {
|
|
260
|
+
width: 100%;
|
|
261
|
+
max-width: 320px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
:host([collapsible]) .toggle {
|
|
265
|
+
display: none;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
`; }
|
|
269
|
+
renderField() {
|
|
270
|
+
return html `
|
|
271
|
+
<tt-input
|
|
272
|
+
full-width
|
|
273
|
+
size=${this.size}
|
|
274
|
+
part="input"
|
|
275
|
+
placeholder=${this.placeholder}
|
|
276
|
+
label=${this.placeholder || "Search"}
|
|
277
|
+
label-hidden
|
|
278
|
+
.value=${this.value}
|
|
279
|
+
?disabled=${this.disabled}
|
|
280
|
+
@tt-input=${this.handleInput}
|
|
281
|
+
@tt-change=${(event) => event.stopPropagation()}
|
|
282
|
+
@keydown=${this.handleKeydown}
|
|
283
|
+
@focusout=${this.handleBlur}
|
|
284
|
+
>
|
|
285
|
+
<span class="icon" slot="prefix" aria-hidden="true">
|
|
286
|
+
<tt-icon name="search" size="16px"></tt-icon>
|
|
287
|
+
</span>
|
|
288
|
+
|
|
289
|
+
${this.value
|
|
290
|
+
? html `
|
|
291
|
+
<button
|
|
292
|
+
class="clear"
|
|
293
|
+
slot="suffix"
|
|
294
|
+
type="button"
|
|
295
|
+
aria-label="Clear search"
|
|
296
|
+
@click=${this.clear}
|
|
297
|
+
>
|
|
298
|
+
<tt-icon name="x" size="14px"></tt-icon>
|
|
299
|
+
</button>
|
|
300
|
+
`
|
|
301
|
+
: ""}
|
|
302
|
+
</tt-input>
|
|
303
|
+
`;
|
|
304
|
+
}
|
|
305
|
+
render() {
|
|
306
|
+
return html `
|
|
307
|
+
${this.collapsible
|
|
308
|
+
? html `
|
|
309
|
+
<button
|
|
310
|
+
class="toggle"
|
|
311
|
+
part="toggle"
|
|
312
|
+
type="button"
|
|
313
|
+
aria-label="Search"
|
|
314
|
+
aria-expanded=${this.expanded ? "true" : "false"}
|
|
315
|
+
?disabled=${this.disabled}
|
|
316
|
+
@click=${this.expand}
|
|
317
|
+
>
|
|
318
|
+
<tt-icon name="search" size="20px"></tt-icon>
|
|
319
|
+
</button>
|
|
320
|
+
`
|
|
321
|
+
: ""}
|
|
322
|
+
|
|
323
|
+
<div
|
|
324
|
+
class="field ${this.expanded ? "expanded" : ""}"
|
|
325
|
+
part="search"
|
|
326
|
+
>
|
|
327
|
+
${this.renderField()}
|
|
328
|
+
</div>
|
|
329
|
+
`;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
__decorate([
|
|
333
|
+
property({ type: String })
|
|
334
|
+
], TTSearch.prototype, "placeholder", void 0);
|
|
335
|
+
__decorate([
|
|
336
|
+
property({ type: String })
|
|
337
|
+
], TTSearch.prototype, "value", void 0);
|
|
338
|
+
__decorate([
|
|
339
|
+
property({ type: Boolean, reflect: true })
|
|
340
|
+
], TTSearch.prototype, "disabled", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
property({ type: String, reflect: true })
|
|
343
|
+
], TTSearch.prototype, "size", void 0);
|
|
344
|
+
__decorate([
|
|
345
|
+
property({ type: Boolean, reflect: true })
|
|
346
|
+
], TTSearch.prototype, "collapsible", void 0);
|
|
347
|
+
__decorate([
|
|
348
|
+
property({ type: Number })
|
|
349
|
+
], TTSearch.prototype, "debounce", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
property({ type: Number, attribute: "min-length" })
|
|
352
|
+
], TTSearch.prototype, "minLength", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
state()
|
|
355
|
+
], TTSearch.prototype, "expanded", void 0);
|
|
356
|
+
TTSearch = __decorate([
|
|
357
|
+
customElement("tt-search")
|
|
358
|
+
], TTSearch);
|
|
359
|
+
export { TTSearch };
|
|
360
|
+
//# sourceMappingURL=tt-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-search.js","sourceRoot":"","sources":["../src/tt-search.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,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACuB,gBAAW,GAAG,QAAQ,CAAC;QAEvB,UAAK,GAAG,EAAE,CAAC;QAEK,aAAQ,GAAG,KAAK,CAAC;QAE7D,iEAAiE;QACjE,wEAAwE;QACxE,mEAAmE;QACxB,SAAI,GAC7C,OAAO,CAAC;QAEV,sEAAsE;QACtE,sBAAsB;QACsB,gBAAW,GAAG,KAAK,CAAC;QAEpC,aAAQ,GAAG,GAAG,CAAC;QAEU,cAAS,GAAG,CAAC,CAAC;QAElD,aAAQ,GAAG,KAAK,CAAC;IAwTpC,CAAC;IApTC,oBAAoB;QAClB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,KAAK,CAAC,oBAAoB,EAAE,CAAC;IAC/B,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YAC7B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,WAAW,CAAC,KAAkB;QACpC,oEAAoE;QACpE,oEAAoE;QACpE,qEAAqE;QACrE,qDAAqD;QACrD,KAAK,CAAC,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
+
heading: string;
|
|
4
|
+
description: string;
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
"tt-section": TTSection;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=tt-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-section.d.ts","sourceRoot":"","sources":["../src/tt-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBACa,SAAU,SAAQ,UAAU;IAIvC,OAAO,SAAM;IAGb,WAAW,SAAM;IAEjB,MAAM,CAAC,MAAM,0BAgDX;IAEF,MAAM;CAqBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
let TTSection = class TTSection extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
// Named `heading` rather than `title` so it cannot collide with the
|
|
13
|
+
// global HTML title attribute (which renders a native tooltip).
|
|
14
|
+
this.heading = "";
|
|
15
|
+
this.description = "";
|
|
16
|
+
}
|
|
17
|
+
static { this.styles = css `
|
|
18
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
19
|
+
hidden element would still show. Important, so it always wins. */
|
|
20
|
+
:host([hidden]) {
|
|
21
|
+
display: none !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* No outer margin - the parent owns spacing between siblings. */
|
|
25
|
+
:host {
|
|
26
|
+
display: block;
|
|
27
|
+
|
|
28
|
+
font-family: var(--tt-font-sans);
|
|
29
|
+
|
|
30
|
+
-webkit-font-smoothing: antialiased;
|
|
31
|
+
text-rendering: optimizeLegibility;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.title {
|
|
35
|
+
margin-bottom: var(--tt-space-1);
|
|
36
|
+
|
|
37
|
+
color: var(--tt-foreground);
|
|
38
|
+
|
|
39
|
+
font-size: var(--tt-text-lg);
|
|
40
|
+
font-weight: var(--tt-weight-semibold);
|
|
41
|
+
line-height: var(--tt-leading-tight);
|
|
42
|
+
letter-spacing: -0.01em;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.description {
|
|
46
|
+
max-width: 62ch;
|
|
47
|
+
|
|
48
|
+
margin-bottom: var(--tt-space-4);
|
|
49
|
+
|
|
50
|
+
color: var(--tt-muted-foreground);
|
|
51
|
+
|
|
52
|
+
font-size: var(--tt-text-sm);
|
|
53
|
+
line-height: var(--tt-leading-relaxed);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.content {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (max-width: 480px) {
|
|
61
|
+
.title {
|
|
62
|
+
font-size: var(--tt-text-md);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`; }
|
|
66
|
+
render() {
|
|
67
|
+
return html `
|
|
68
|
+
<section part="section">
|
|
69
|
+
${this.heading
|
|
70
|
+
? html `<div class="title" part="heading">${this.heading}</div>`
|
|
71
|
+
: ""}
|
|
72
|
+
|
|
73
|
+
${this.description
|
|
74
|
+
? html `
|
|
75
|
+
<div class="description" part="description">
|
|
76
|
+
${this.description}
|
|
77
|
+
</div>
|
|
78
|
+
`
|
|
79
|
+
: ""}
|
|
80
|
+
|
|
81
|
+
<div class="content" part="content">
|
|
82
|
+
<slot></slot>
|
|
83
|
+
</div>
|
|
84
|
+
</section>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ type: String })
|
|
90
|
+
], TTSection.prototype, "heading", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
property({ type: String })
|
|
93
|
+
], TTSection.prototype, "description", void 0);
|
|
94
|
+
TTSection = __decorate([
|
|
95
|
+
customElement("tt-section")
|
|
96
|
+
], TTSection);
|
|
97
|
+
export { TTSection };
|
|
98
|
+
//# sourceMappingURL=tt-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-section.js","sourceRoot":"","sources":["../src/tt-section.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACL,oEAAoE;QACpE,gEAAgE;QAEhE,YAAO,GAAG,EAAE,CAAC;QAGb,gBAAW,GAAG,EAAE,CAAC;IAyEnB,CAAC;aAvEQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDlB,AAhDY,CAgDX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,OAAO;YACZ,CAAC,CAAC,IAAI,CAAA,qCAAqC,IAAI,CAAC,OAAO,QAAQ;YAC/D,CAAC,CAAC,EAAE;;UAEJ,IAAI,CAAC,WAAW;YAChB,CAAC,CAAC,IAAI,CAAA;;kBAEE,IAAI,CAAC,WAAW;;aAErB;YACH,CAAC,CAAC,EAAE;;;;;;KAMT,CAAC;IACJ,CAAC;;AA3ED;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACd;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACV;AAPN,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAgFrB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { PropertyValues } from "lit";
|
|
3
|
+
import "./tt-icon.js";
|
|
4
|
+
export type SelectSize = "small" | "medium" | "large";
|
|
5
|
+
export interface SelectOption {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class TTSelect extends LitElement {
|
|
11
|
+
static formAssociated: boolean;
|
|
12
|
+
private internals;
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
options: SelectOption[];
|
|
17
|
+
label: string;
|
|
18
|
+
error: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
required: boolean;
|
|
21
|
+
size: SelectSize;
|
|
22
|
+
labelHidden: boolean;
|
|
23
|
+
private open;
|
|
24
|
+
private activeIndex;
|
|
25
|
+
private trigger;
|
|
26
|
+
private list;
|
|
27
|
+
private untrack?;
|
|
28
|
+
private instanceId;
|
|
29
|
+
private listId;
|
|
30
|
+
get form(): HTMLFormElement | null;
|
|
31
|
+
get validity(): ValidityState;
|
|
32
|
+
checkValidity(): boolean;
|
|
33
|
+
reportValidity(): boolean;
|
|
34
|
+
connectedCallback(): void;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
formResetCallback(): void;
|
|
37
|
+
formStateRestoreCallback(state: string): void;
|
|
38
|
+
updated(changed: PropertyValues): void;
|
|
39
|
+
private syncFormState;
|
|
40
|
+
private get selectedOption();
|
|
41
|
+
private openList;
|
|
42
|
+
private closeList;
|
|
43
|
+
private removeGlobalListeners;
|
|
44
|
+
private toggleOpen;
|
|
45
|
+
private handleDocumentClick;
|
|
46
|
+
private handleReposition;
|
|
47
|
+
private selectOption;
|
|
48
|
+
private moveActive;
|
|
49
|
+
private scrollActiveIntoView;
|
|
50
|
+
private handleKeydown;
|
|
51
|
+
private syncPopover;
|
|
52
|
+
private positionList;
|
|
53
|
+
static styles: import("lit").CSSResult[];
|
|
54
|
+
focus(options?: FocusOptions): void;
|
|
55
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
56
|
+
}
|
|
57
|
+
declare global {
|
|
58
|
+
interface HTMLElementTagNameMap {
|
|
59
|
+
"tt-select": TTSelect;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=tt-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-select.d.ts","sourceRoot":"","sources":["../src/tt-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1C,OAAO,cAAc,CAAC;AAItB,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBACa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,SAAS,CAA0B;IAYA,IAAI,SAAM;IACzB,KAAK,SAAM;IACX,WAAW,SAAsB;IAClC,OAAO,EAAE,YAAY,EAAE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