@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,62 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { PropertyValues } from "lit";
|
|
3
|
+
import "./tt-checkbox-group.js";
|
|
4
|
+
import type { CheckboxGroupOption } from "./tt-checkbox-group.js";
|
|
5
|
+
import "./tt-icon.js";
|
|
6
|
+
/**
|
|
7
|
+
* One facet of a filter set: a pill that says what it filters, how many
|
|
8
|
+
* are picked, and opens a list of checkboxes.
|
|
9
|
+
*
|
|
10
|
+
* WHY THIS IS NOT A VARIANT OF SOMETHING ELSE. The library already has
|
|
11
|
+
* two things that open a list, and this is neither of them:
|
|
12
|
+
*
|
|
13
|
+
* tt-dropdown-menu performs an action and REMEMBERS NOTHING. It closes
|
|
14
|
+
* on choose because the choice is the whole event.
|
|
15
|
+
* tt-select edits ONE value and displays the chosen one.
|
|
16
|
+
* tt-filter holds a SET, stays open while you build it, and
|
|
17
|
+
* reports the whole set.
|
|
18
|
+
*
|
|
19
|
+
* Bending either of the first two into this would have cost them the
|
|
20
|
+
* property that makes them easy to reason about.
|
|
21
|
+
*
|
|
22
|
+
* It composes tt-checkbox-group rather than reimplementing checkboxes, and
|
|
23
|
+
* keeps that component's contract: values come in, tt-change goes out
|
|
24
|
+
* carrying the COMPLETE new array, and this component owns nothing.
|
|
25
|
+
*
|
|
26
|
+
* Laid out as a pill with a count because a filter has to be readable when
|
|
27
|
+
* it is closed. A row of loose checkboxes says what the options are; a
|
|
28
|
+
* pill says what is actually filtering, which is the thing you need to
|
|
29
|
+
* know when you are looking at a result set and wondering why.
|
|
30
|
+
*/
|
|
31
|
+
export declare class TTFilter extends LitElement {
|
|
32
|
+
label: string;
|
|
33
|
+
options: CheckboxGroupOption[];
|
|
34
|
+
values: string[];
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
align: "start" | "end";
|
|
37
|
+
private open;
|
|
38
|
+
private pill;
|
|
39
|
+
private panel;
|
|
40
|
+
private panelId;
|
|
41
|
+
private untrack?;
|
|
42
|
+
private get count();
|
|
43
|
+
disconnectedCallback(): void;
|
|
44
|
+
private openPanel;
|
|
45
|
+
private close;
|
|
46
|
+
private handleDocumentClick;
|
|
47
|
+
private reposition;
|
|
48
|
+
private position;
|
|
49
|
+
updated(changed: PropertyValues): void;
|
|
50
|
+
private emit;
|
|
51
|
+
private handleGroupChange;
|
|
52
|
+
private clear;
|
|
53
|
+
private handleKeydown;
|
|
54
|
+
static styles: import("lit").CSSResult[];
|
|
55
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
56
|
+
}
|
|
57
|
+
declare global {
|
|
58
|
+
interface HTMLElementTagNameMap {
|
|
59
|
+
"tt-filter": TTFilter;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=tt-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-filter.d.ts","sourceRoot":"","sources":["../src/tt-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK1C,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,cAAc,CAAC;AAKtB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,QAAS,SAAQ,UAAU;IACV,KAAK,SAAM;IAIZ,OAAO,EAAE,mBAAmB,EAAE,CAAM;IAEpC,MAAM,EAAE,MAAM,EAAE,CAAM;IAEL,QAAQ,UAAS;IAGjC,KAAK,EAAE,OAAO,GAAG,KAAK,CAAW;IAEpD,OAAO,CAAC,IAAI,CAAS;IAEd,OAAO,CAAC,IAAI,CAAqB;IAChC,OAAO,CAAC,KAAK,CAAe;IAE7C,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,OAAO,KAAK,KAAK,GAEhB;IAED,oBAAoB;IAKpB,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,KAAK;IAcb,OAAO,CAAC,mBAAmB,CAEzB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,OAAO,EAAE,cAAc;IAgB/B,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,aAAa;IAYrB,MAAM,CAAC,MAAM,4BA6JX;IAEF,MAAM;CA4DP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,393 @@
|
|
|
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, query } from "lit/decorators.js";
|
|
9
|
+
import { trackAnchor, placeBelow } from "./floating.js";
|
|
10
|
+
import "./tt-checkbox-group.js";
|
|
11
|
+
import "./tt-icon.js";
|
|
12
|
+
import { srOnly } from "./sr-only.js";
|
|
13
|
+
let uid = 0;
|
|
14
|
+
/**
|
|
15
|
+
* One facet of a filter set: a pill that says what it filters, how many
|
|
16
|
+
* are picked, and opens a list of checkboxes.
|
|
17
|
+
*
|
|
18
|
+
* WHY THIS IS NOT A VARIANT OF SOMETHING ELSE. The library already has
|
|
19
|
+
* two things that open a list, and this is neither of them:
|
|
20
|
+
*
|
|
21
|
+
* tt-dropdown-menu performs an action and REMEMBERS NOTHING. It closes
|
|
22
|
+
* on choose because the choice is the whole event.
|
|
23
|
+
* tt-select edits ONE value and displays the chosen one.
|
|
24
|
+
* tt-filter holds a SET, stays open while you build it, and
|
|
25
|
+
* reports the whole set.
|
|
26
|
+
*
|
|
27
|
+
* Bending either of the first two into this would have cost them the
|
|
28
|
+
* property that makes them easy to reason about.
|
|
29
|
+
*
|
|
30
|
+
* It composes tt-checkbox-group rather than reimplementing checkboxes, and
|
|
31
|
+
* keeps that component's contract: values come in, tt-change goes out
|
|
32
|
+
* carrying the COMPLETE new array, and this component owns nothing.
|
|
33
|
+
*
|
|
34
|
+
* Laid out as a pill with a count because a filter has to be readable when
|
|
35
|
+
* it is closed. A row of loose checkboxes says what the options are; a
|
|
36
|
+
* pill says what is actually filtering, which is the thing you need to
|
|
37
|
+
* know when you are looking at a result set and wondering why.
|
|
38
|
+
*/
|
|
39
|
+
let TTFilter = class TTFilter extends LitElement {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this.label = "";
|
|
43
|
+
// Passed straight to tt-checkbox-group, so the same two shapes work:
|
|
44
|
+
// strings, or { value, label, disabled }.
|
|
45
|
+
this.options = [];
|
|
46
|
+
this.values = [];
|
|
47
|
+
this.disabled = false;
|
|
48
|
+
// Which edge of the pill the panel lines up with.
|
|
49
|
+
this.align = "start";
|
|
50
|
+
this.open = false;
|
|
51
|
+
this.panelId = `tt-filter-${++uid}`;
|
|
52
|
+
// composedPath sees through shadow boundaries; event.target is
|
|
53
|
+
// retargeted to the host and would report our own clicks as outside.
|
|
54
|
+
this.handleDocumentClick = (event) => {
|
|
55
|
+
if (!event.composedPath().includes(this))
|
|
56
|
+
this.close(false);
|
|
57
|
+
};
|
|
58
|
+
this.reposition = () => {
|
|
59
|
+
if (this.open)
|
|
60
|
+
this.position();
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
get count() {
|
|
64
|
+
return this.values.length;
|
|
65
|
+
}
|
|
66
|
+
disconnectedCallback() {
|
|
67
|
+
this.close(false);
|
|
68
|
+
super.disconnectedCallback();
|
|
69
|
+
}
|
|
70
|
+
openPanel() {
|
|
71
|
+
if (this.disabled || this.open)
|
|
72
|
+
return;
|
|
73
|
+
this.open = true;
|
|
74
|
+
document.addEventListener("click", this.handleDocumentClick);
|
|
75
|
+
// See floating.ts: scroll events are not composed, so a window
|
|
76
|
+
// listener misses the container that actually scrolls.
|
|
77
|
+
this.untrack = trackAnchor(this, this.reposition);
|
|
78
|
+
}
|
|
79
|
+
close(refocus = true) {
|
|
80
|
+
if (!this.open)
|
|
81
|
+
return;
|
|
82
|
+
this.open = false;
|
|
83
|
+
document.removeEventListener("click", this.handleDocumentClick);
|
|
84
|
+
this.untrack?.();
|
|
85
|
+
this.untrack = undefined;
|
|
86
|
+
if (refocus)
|
|
87
|
+
this.pill?.focus();
|
|
88
|
+
}
|
|
89
|
+
position() {
|
|
90
|
+
if (!this.pill || !this.panel)
|
|
91
|
+
return;
|
|
92
|
+
placeBelow(this.pill, this.panel, { align: this.align });
|
|
93
|
+
}
|
|
94
|
+
updated(changed) {
|
|
95
|
+
if (!changed.has("open"))
|
|
96
|
+
return;
|
|
97
|
+
const panel = this.panel;
|
|
98
|
+
if (!panel)
|
|
99
|
+
return;
|
|
100
|
+
if (this.open) {
|
|
101
|
+
// Show first, then measure. A closed popover is display:none and
|
|
102
|
+
// measures 0x0, which makes the clamp meaningless.
|
|
103
|
+
if (!panel.matches(":popover-open"))
|
|
104
|
+
panel.showPopover();
|
|
105
|
+
this.position();
|
|
106
|
+
}
|
|
107
|
+
else if (panel.matches(":popover-open")) {
|
|
108
|
+
panel.hidePopover();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
emit(values) {
|
|
112
|
+
this.dispatchEvent(new CustomEvent("tt-change", {
|
|
113
|
+
detail: { values },
|
|
114
|
+
bubbles: true,
|
|
115
|
+
composed: true,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
handleGroupChange(event) {
|
|
119
|
+
/*
|
|
120
|
+
The inner group emits its own composed tt-change. Left alone it
|
|
121
|
+
would reach the page as a second, indistinguishable event from a
|
|
122
|
+
different target. Stop it and re-emit from here, so the page has one
|
|
123
|
+
event and one sender.
|
|
124
|
+
*/
|
|
125
|
+
event.stopPropagation();
|
|
126
|
+
const { values } = event.detail;
|
|
127
|
+
this.emit(values);
|
|
128
|
+
}
|
|
129
|
+
clear(event) {
|
|
130
|
+
event.stopPropagation();
|
|
131
|
+
this.emit([]);
|
|
132
|
+
// Clear only exists while something is selected, so the button that
|
|
133
|
+
// has focus is about to disappear, and focus would fall to <body>.
|
|
134
|
+
// Hand it to the pill: it names this filter and the panel stays open.
|
|
135
|
+
this.pill?.focus();
|
|
136
|
+
}
|
|
137
|
+
handleKeydown(event) {
|
|
138
|
+
if (event.key === "Escape" && this.open) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
this.close();
|
|
141
|
+
}
|
|
142
|
+
if ((event.key === "ArrowDown" || event.key === "Enter") && !this.open) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
this.openPanel();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
static { this.styles = [
|
|
148
|
+
srOnly,
|
|
149
|
+
css `
|
|
150
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
151
|
+
hidden element would still show. Important, so it always wins. */
|
|
152
|
+
:host([hidden]) {
|
|
153
|
+
display: none !important;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:host {
|
|
157
|
+
display: inline-block;
|
|
158
|
+
font-family: var(--tt-font-sans);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([disabled]) {
|
|
162
|
+
opacity: var(--tt-opacity-disabled);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.pill {
|
|
166
|
+
display: inline-flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
gap: var(--tt-space-2);
|
|
169
|
+
|
|
170
|
+
min-height: var(--tt-control-sm);
|
|
171
|
+
padding: 0 var(--tt-space-3);
|
|
172
|
+
|
|
173
|
+
border: 1px solid var(--tt-input);
|
|
174
|
+
border-radius: var(--tt-radius-full);
|
|
175
|
+
|
|
176
|
+
background: var(--tt-field);
|
|
177
|
+
color: var(--tt-foreground);
|
|
178
|
+
|
|
179
|
+
font: inherit;
|
|
180
|
+
font-size: var(--tt-text-sm);
|
|
181
|
+
font-weight: var(--tt-weight-medium);
|
|
182
|
+
white-space: nowrap;
|
|
183
|
+
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
|
|
186
|
+
-webkit-user-select: none;
|
|
187
|
+
user-select: none;
|
|
188
|
+
|
|
189
|
+
transition:
|
|
190
|
+
background var(--tt-duration-fast) var(--tt-ease),
|
|
191
|
+
border-color var(--tt-duration-fast) var(--tt-ease);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.pill:hover:not(:disabled) {
|
|
195
|
+
border-color: var(--tt-border-strong);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.pill:focus-visible {
|
|
199
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
200
|
+
outline-offset: var(--tt-ring-offset);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.pill:disabled {
|
|
204
|
+
cursor: not-allowed;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* An active filter is the most important thing in the row: it is the
|
|
208
|
+
reason the results look the way they do. */
|
|
209
|
+
.pill.active {
|
|
210
|
+
border-color: var(--tt-primary);
|
|
211
|
+
background: color-mix(in srgb, var(--tt-primary) 8%, var(--tt-field));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.count {
|
|
215
|
+
display: inline-flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
|
|
219
|
+
min-width: 18px;
|
|
220
|
+
height: 18px;
|
|
221
|
+
padding: 0 5px;
|
|
222
|
+
box-sizing: border-box;
|
|
223
|
+
|
|
224
|
+
border-radius: var(--tt-radius-full);
|
|
225
|
+
|
|
226
|
+
background: var(--tt-primary);
|
|
227
|
+
color: var(--tt-primary-foreground);
|
|
228
|
+
|
|
229
|
+
font-size: var(--tt-text-xs);
|
|
230
|
+
font-weight: var(--tt-weight-semibold);
|
|
231
|
+
font-variant-numeric: tabular-nums;
|
|
232
|
+
line-height: 1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.chevron {
|
|
236
|
+
color: var(--tt-muted-foreground);
|
|
237
|
+
transition: transform var(--tt-duration-fast) var(--tt-ease);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.pill[aria-expanded="true"] .chevron {
|
|
241
|
+
transform: rotate(180deg);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* Top layer, so a filter row inside a card with overflow cannot clip
|
|
245
|
+
the panel. Position comes from script. */
|
|
246
|
+
.panel {
|
|
247
|
+
position: fixed;
|
|
248
|
+
margin: 0;
|
|
249
|
+
padding: var(--tt-space-3);
|
|
250
|
+
|
|
251
|
+
min-width: 200px;
|
|
252
|
+
max-width: calc(100vw - 16px);
|
|
253
|
+
max-height: 60vh;
|
|
254
|
+
overflow-y: auto;
|
|
255
|
+
box-sizing: border-box;
|
|
256
|
+
|
|
257
|
+
background: var(--tt-popover);
|
|
258
|
+
color: var(--tt-popover-foreground);
|
|
259
|
+
|
|
260
|
+
border: 1px solid var(--tt-border);
|
|
261
|
+
border-radius: var(--tt-radius);
|
|
262
|
+
box-shadow: var(--tt-elevation-2);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.panel:not(:popover-open) {
|
|
266
|
+
display: none;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.foot {
|
|
270
|
+
display: flex;
|
|
271
|
+
justify-content: flex-end;
|
|
272
|
+
|
|
273
|
+
margin-top: var(--tt-space-3);
|
|
274
|
+
padding-top: var(--tt-space-2);
|
|
275
|
+
border-top: 1px solid var(--tt-border);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.clear {
|
|
279
|
+
padding: var(--tt-space-1) var(--tt-space-2);
|
|
280
|
+
|
|
281
|
+
border: none;
|
|
282
|
+
border-radius: var(--tt-radius-sm);
|
|
283
|
+
background: transparent;
|
|
284
|
+
color: var(--tt-muted-foreground);
|
|
285
|
+
|
|
286
|
+
font: inherit;
|
|
287
|
+
font-size: var(--tt-text-xs);
|
|
288
|
+
font-weight: var(--tt-weight-medium);
|
|
289
|
+
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.clear:hover {
|
|
294
|
+
background: var(--tt-accent);
|
|
295
|
+
color: var(--tt-foreground);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.clear:focus-visible {
|
|
299
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
300
|
+
outline-offset: var(--tt-ring-offset);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
`,
|
|
304
|
+
]; }
|
|
305
|
+
render() {
|
|
306
|
+
const active = this.count > 0;
|
|
307
|
+
return html `
|
|
308
|
+
<!--
|
|
309
|
+
A disclosure: aria-expanded plus aria-controls, nothing more. Not
|
|
310
|
+
aria-haspopup, which tells a screen reader a MENU is coming, and
|
|
311
|
+
this panel is a list of checkboxes.
|
|
312
|
+
-->
|
|
313
|
+
<button
|
|
314
|
+
class="pill ${active ? "active" : ""}"
|
|
315
|
+
part="pill"
|
|
316
|
+
type="button"
|
|
317
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
318
|
+
aria-controls=${this.panelId}
|
|
319
|
+
?disabled=${this.disabled}
|
|
320
|
+
@click=${() => (this.open ? this.close() : this.openPanel())}
|
|
321
|
+
@keydown=${this.handleKeydown}
|
|
322
|
+
>
|
|
323
|
+
<span>${this.label}</span>
|
|
324
|
+
|
|
325
|
+
<!--
|
|
326
|
+
The badge is for the eye, the sentence for the ear. aria-label on
|
|
327
|
+
a plain <span> is ignored: it has no role, so it cannot carry a
|
|
328
|
+
name, and a screen reader read the bare number.
|
|
329
|
+
-->
|
|
330
|
+
${active
|
|
331
|
+
? html `<span class="count" aria-hidden="true">${this.count}</span
|
|
332
|
+
><span class="sr-only">${this.count} selected</span>`
|
|
333
|
+
: ""}
|
|
334
|
+
|
|
335
|
+
<tt-icon class="chevron" name="chevron-down" size="14px"></tt-icon>
|
|
336
|
+
</button>
|
|
337
|
+
|
|
338
|
+
<div
|
|
339
|
+
class="panel"
|
|
340
|
+
part="panel"
|
|
341
|
+
id=${this.panelId}
|
|
342
|
+
popover="manual"
|
|
343
|
+
@keydown=${this.handleKeydown}
|
|
344
|
+
>
|
|
345
|
+
<tt-checkbox-group
|
|
346
|
+
orientation="vertical"
|
|
347
|
+
.options=${this.options}
|
|
348
|
+
.values=${this.values}
|
|
349
|
+
@tt-change=${this.handleGroupChange}
|
|
350
|
+
></tt-checkbox-group>
|
|
351
|
+
|
|
352
|
+
${active
|
|
353
|
+
? html `
|
|
354
|
+
<div class="foot">
|
|
355
|
+
<button class="clear" type="button" @click=${this.clear}>
|
|
356
|
+
Clear
|
|
357
|
+
</button>
|
|
358
|
+
</div>
|
|
359
|
+
`
|
|
360
|
+
: ""}
|
|
361
|
+
</div>
|
|
362
|
+
`;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
__decorate([
|
|
366
|
+
property({ type: String })
|
|
367
|
+
], TTFilter.prototype, "label", void 0);
|
|
368
|
+
__decorate([
|
|
369
|
+
property({ type: Array })
|
|
370
|
+
], TTFilter.prototype, "options", void 0);
|
|
371
|
+
__decorate([
|
|
372
|
+
property({ type: Array })
|
|
373
|
+
], TTFilter.prototype, "values", void 0);
|
|
374
|
+
__decorate([
|
|
375
|
+
property({ type: Boolean, reflect: true })
|
|
376
|
+
], TTFilter.prototype, "disabled", void 0);
|
|
377
|
+
__decorate([
|
|
378
|
+
property({ type: String })
|
|
379
|
+
], TTFilter.prototype, "align", void 0);
|
|
380
|
+
__decorate([
|
|
381
|
+
state()
|
|
382
|
+
], TTFilter.prototype, "open", void 0);
|
|
383
|
+
__decorate([
|
|
384
|
+
query(".pill")
|
|
385
|
+
], TTFilter.prototype, "pill", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
query(".panel")
|
|
388
|
+
], TTFilter.prototype, "panel", void 0);
|
|
389
|
+
TTFilter = __decorate([
|
|
390
|
+
customElement("tt-filter")
|
|
391
|
+
], TTFilter);
|
|
392
|
+
export { TTFilter };
|
|
393
|
+
//# sourceMappingURL=tt-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-filter.js","sourceRoot":"","sources":["../src/tt-filter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,wBAAwB,CAAC;AAEhC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,IAAI,GAAG,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACuB,UAAK,GAAG,EAAE,CAAC;QAEvC,qEAAqE;QACrE,0CAA0C;QACf,YAAO,GAA0B,EAAE,CAAC;QAEpC,WAAM,GAAa,EAAE,CAAC;QAEL,aAAQ,GAAG,KAAK,CAAC;QAE7D,kDAAkD;QACtB,UAAK,GAAoB,OAAO,CAAC;QAE5C,SAAI,GAAG,KAAK,CAAC;QAKtB,YAAO,GAAG,aAAa,EAAE,GAAG,EAAE,CAAC;QAoCvC,+DAA+D;QAC/D,qEAAqE;QAC7D,wBAAmB,GAAG,CAAC,KAAiB,EAAE,EAAE;YAClD,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9D,CAAC,CAAC;QAEM,eAAU,GAAG,GAAG,EAAE;YACx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;;qBAIhB,IAAI,CAAC,OAAO;oBACb,IAAI,CAAC,MAAM;uBACR,IAAI,CAAC,iBAAiB;;;UAGnC,MAAM;YACN,CAAC,CAAC,IAAI,CAAA;;6DAE6C,IAAI,CAAC,KAAK;;;;aAI1D;YACH,CAAC,CAAC,EAAE;;KAET,CAAC;IACJ,CAAC;;AA9V2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAY;AAIZ;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yCAAqC;AAEpC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wCAAuB;AAEL;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAGjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAkC;AAE5C;IAAhB,KAAK,EAAE;sCAAsB;AAEN;IAAvB,KAAK,CAAC,OAAO,CAAC;sCAAkC;AACxB;IAAxB,KAAK,CAAC,QAAQ,CAAC;uCAA6B;AAjBlC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAgWpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type FormLayout = "vertical" | "horizontal";
|
|
3
|
+
export declare class TTForm extends LitElement {
|
|
4
|
+
name: string;
|
|
5
|
+
layout: FormLayout;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
novalidate: boolean;
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
/** Every named control inside the form, in document order. */
|
|
12
|
+
private get controls();
|
|
13
|
+
private handleButtonClick;
|
|
14
|
+
private handleClick;
|
|
15
|
+
private handleKeydown;
|
|
16
|
+
/**
|
|
17
|
+
* Validates, then emits tt-form-submit with the collected values.
|
|
18
|
+
* Returns false if validation stopped it.
|
|
19
|
+
*/
|
|
20
|
+
submit(): boolean;
|
|
21
|
+
/** Builds FormData from the named controls. */
|
|
22
|
+
collect(): FormData;
|
|
23
|
+
/** Clears every control by calling its form reset callback. */
|
|
24
|
+
reset(): void;
|
|
25
|
+
static styles: import("lit").CSSResult;
|
|
26
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
"tt-form": TTForm;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tt-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-form.d.ts","sourceRoot":"","sources":["../src/tt-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AA8CnD,qBACa,MAAO,SAAQ,UAAU;IACR,IAAI,SAAM;IAItC,MAAM,EAAE,UAAU,CAAc;IAEY,QAAQ,UAAS;IAEjB,OAAO,UAAS;IAG/B,UAAU,UAAS;IAEhD,iBAAiB;IAQjB,oBAAoB;IAQpB,8DAA8D;IAC9D,OAAO,KAAK,QAAQ,GAEnB;IAED,OAAO,CAAC,iBAAiB,CAGvB;IAGF,OAAO,CAAC,WAAW,CAMjB;IAcF,OAAO,CAAC,aAAa,CAMnB;IAEF;;;OAGG;IACH,MAAM,IAAI,OAAO;IAwBjB,+CAA+C;IAC/C,OAAO,IAAI,QAAQ;IAiBnB,+DAA+D;IAC/D,KAAK;IAUL,MAAM,CAAC,MAAM,0BAgCX;IAEF,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|