@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 @@
|
|
|
1
|
+
{"version":3,"file":"tt-input.d.ts","sourceRoot":"","sources":["../src/tt-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI1C,MAAM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AAY;IAYpB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAU5B,OAAO,CAAC,YAAY;IAOpB,MAAM,CAAC,MAAM,4BA0OV;IAEH,MAAM;CAqEP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
package/dist/tt-input.js
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
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 { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
+
import { property, customElement } from "lit/decorators.js";
|
|
10
|
+
import { srOnly } from "./sr-only.js";
|
|
11
|
+
let uid = 0;
|
|
12
|
+
let TTInput = class TTInput extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.internals = this.attachInternals();
|
|
16
|
+
this.label = "";
|
|
17
|
+
this.placeholder = "";
|
|
18
|
+
this.value = "";
|
|
19
|
+
// Field name under which the value is submitted with the form.
|
|
20
|
+
/*
|
|
21
|
+
Reflected, and it has to be.
|
|
22
|
+
|
|
23
|
+
A form-associated custom element is submitted under its name CONTENT
|
|
24
|
+
ATTRIBUTE, not its JS property. Without reflect, setting .name = "x"
|
|
25
|
+
from script leaves the attribute absent and the field vanishes from
|
|
26
|
+
FormData with no error anywhere. It only appeared to work because
|
|
27
|
+
every call site so far wrote name="x" in markup, which sets the
|
|
28
|
+
attribute directly.
|
|
29
|
+
*/
|
|
30
|
+
this.name = "";
|
|
31
|
+
this.type = "text";
|
|
32
|
+
this.size = "medium";
|
|
33
|
+
// Reflected, as on every other control, so tt-input[disabled] works as
|
|
34
|
+
// a selector. tt-modal's focus trap skips :not([disabled]) controls,
|
|
35
|
+
// and without the attribute it never could.
|
|
36
|
+
this.disabled = false;
|
|
37
|
+
this.required = false;
|
|
38
|
+
this.fullWidth = false;
|
|
39
|
+
this.error = "";
|
|
40
|
+
/*
|
|
41
|
+
Keeps the label for screen readers while taking it off screen. Same
|
|
42
|
+
contract as tt-checkbox: for a field whose purpose is obvious to the
|
|
43
|
+
eye (a search box with an icon, a chat composer) but would otherwise
|
|
44
|
+
have no name at all. A placeholder is not a name: it vanishes as soon
|
|
45
|
+
as anyone types.
|
|
46
|
+
*/
|
|
47
|
+
this.labelHidden = false;
|
|
48
|
+
this.inputId = `tt-input-${++uid}`;
|
|
49
|
+
}
|
|
50
|
+
// Participate in native <form> submission, validation and reset.
|
|
51
|
+
// Without this the shadow-DOM <input> is invisible to FormData.
|
|
52
|
+
static { this.formAssociated = true; }
|
|
53
|
+
get form() {
|
|
54
|
+
return this.internals.form;
|
|
55
|
+
}
|
|
56
|
+
get validity() {
|
|
57
|
+
return this.internals.validity;
|
|
58
|
+
}
|
|
59
|
+
// Exposed so tt-form (and any consumer) can validate without reaching
|
|
60
|
+
// into internals. Form-associated elements do not get these for free.
|
|
61
|
+
checkValidity() {
|
|
62
|
+
return this.internals.checkValidity();
|
|
63
|
+
}
|
|
64
|
+
reportValidity() {
|
|
65
|
+
return this.internals.reportValidity();
|
|
66
|
+
}
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
super.connectedCallback();
|
|
69
|
+
this.syncFormState();
|
|
70
|
+
}
|
|
71
|
+
updated(changed) {
|
|
72
|
+
if (changed.has("value") || changed.has("required")) {
|
|
73
|
+
this.syncFormState();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Reports both the value and whether it satisfies `required`. Without
|
|
77
|
+
// setValidity the field submits happily while empty, which is what this
|
|
78
|
+
// component did until tests caught it.
|
|
79
|
+
syncFormState() {
|
|
80
|
+
this.internals.setFormValue(this.value);
|
|
81
|
+
const missing = this.required && this.value.trim() === "";
|
|
82
|
+
if (missing) {
|
|
83
|
+
this.internals.setValidity({ valueMissing: true }, "Please fill in this field.", this.renderRoot?.querySelector("input") ?? undefined);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.internals.setValidity({});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Called by the browser when the containing form is reset.
|
|
90
|
+
formResetCallback() {
|
|
91
|
+
this.value = "";
|
|
92
|
+
}
|
|
93
|
+
// Called by the browser when the form state is restored (bfcache, autofill).
|
|
94
|
+
formStateRestoreCallback(state) {
|
|
95
|
+
this.value = state ?? "";
|
|
96
|
+
}
|
|
97
|
+
handleInput(event) {
|
|
98
|
+
const input = event.target;
|
|
99
|
+
this.value = input.value;
|
|
100
|
+
this.dispatchEvent(new CustomEvent("tt-input", {
|
|
101
|
+
detail: {
|
|
102
|
+
value: this.value,
|
|
103
|
+
},
|
|
104
|
+
bubbles: true,
|
|
105
|
+
composed: true,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
handleChange() {
|
|
109
|
+
this.dispatchEvent(new CustomEvent("tt-change", {
|
|
110
|
+
detail: {
|
|
111
|
+
value: this.value,
|
|
112
|
+
},
|
|
113
|
+
bubbles: true,
|
|
114
|
+
composed: true,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
focus(options) {
|
|
118
|
+
this.renderRoot?.querySelector("input")?.focus(options);
|
|
119
|
+
}
|
|
120
|
+
/*
|
|
121
|
+
A click on the box's padding, or on a decorative prefix icon, focuses
|
|
122
|
+
the input. The whole field used to sit inside the <label>, which did
|
|
123
|
+
this for free, and also swept everything else in the box into the
|
|
124
|
+
field's NAME. See render().
|
|
125
|
+
*/
|
|
126
|
+
focusFromBox(event) {
|
|
127
|
+
const target = event.target;
|
|
128
|
+
if (target === event.currentTarget || target.closest('[aria-hidden="true"]')) {
|
|
129
|
+
this.focus();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
static { this.styles = [srOnly, css `
|
|
133
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
134
|
+
hidden element would still show. Important, so it always wins. */
|
|
135
|
+
:host([hidden]) {
|
|
136
|
+
display: none !important;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host {
|
|
140
|
+
/*
|
|
141
|
+
A grid or flex item defaults to min-width: auto, which floors it at
|
|
142
|
+
its MIN-CONTENT width rather than letting it shrink.
|
|
143
|
+
|
|
144
|
+
For most fields that is harmless. For type="date" the min-content
|
|
145
|
+
width is the whole dd/mm/yyyy mask plus the picker icon, so in a
|
|
146
|
+
1fr 1fr row the date field pushed its own column past its share,
|
|
147
|
+
the field beside it shrank to compensate, and the pair stopped
|
|
148
|
+
lining up with the full-width fields above. The date looked like it
|
|
149
|
+
had wandered left, which it had.
|
|
150
|
+
|
|
151
|
+
Every field component carries this now, because any of them can end
|
|
152
|
+
up as a grid item and the failure is silent until a layout looks
|
|
153
|
+
subtly wrong.
|
|
154
|
+
*/
|
|
155
|
+
min-width: 0;
|
|
156
|
+
|
|
157
|
+
display: inline-block;
|
|
158
|
+
width: auto;
|
|
159
|
+
|
|
160
|
+
font-family: var(--tt-font-sans);
|
|
161
|
+
-webkit-font-smoothing: antialiased;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host([full-width]) {
|
|
165
|
+
display: block;
|
|
166
|
+
width: 100%;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.field {
|
|
170
|
+
display: flex;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
gap: var(--tt-space-2);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
label {
|
|
176
|
+
font-size: var(--tt-text-sm);
|
|
177
|
+
font-weight: var(--tt-weight-medium);
|
|
178
|
+
letter-spacing: -0.005em;
|
|
179
|
+
|
|
180
|
+
color: var(--tt-foreground);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.req {
|
|
184
|
+
margin-left: 2px;
|
|
185
|
+
color: var(--tt-destructive);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
The BORDER lives on this wrapper, not on the input, so slotted
|
|
190
|
+
content can sit inside the field rather than beside it. A search
|
|
191
|
+
icon or a currency symbol belongs within the box it labels; bolting
|
|
192
|
+
a separate control on next to it reads as two controls.
|
|
193
|
+
*/
|
|
194
|
+
.control {
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
gap: var(--tt-space-2);
|
|
198
|
+
|
|
199
|
+
width: 100%;
|
|
200
|
+
box-sizing: border-box;
|
|
201
|
+
|
|
202
|
+
border: 1px solid var(--tt-input);
|
|
203
|
+
/* tt-button-group flattens this per position, so controls that
|
|
204
|
+
sit together share one edge instead of stacking two. */
|
|
205
|
+
border-radius: var(--tt-group-radius, var(--tt-radius));
|
|
206
|
+
|
|
207
|
+
background: var(--tt-field);
|
|
208
|
+
color: var(--tt-foreground);
|
|
209
|
+
|
|
210
|
+
transition: border-color var(--tt-duration-normal) var(--tt-ease);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.control:hover:not(.disabled):not(.error) {
|
|
214
|
+
border-color: var(--tt-border-strong);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
focus-within, not focus. The input no longer carries the border, so
|
|
219
|
+
the ring has to come from the wrapper when anything inside it takes
|
|
220
|
+
focus, including a slotted clear button.
|
|
221
|
+
*/
|
|
222
|
+
.control:focus-within {
|
|
223
|
+
border-color: var(--tt-ring);
|
|
224
|
+
|
|
225
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
226
|
+
outline-offset: calc(var(--tt-ring-width) * -1);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.control.disabled {
|
|
230
|
+
background: var(--tt-muted);
|
|
231
|
+
color: var(--tt-muted-foreground);
|
|
232
|
+
cursor: not-allowed;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
Stripped bare. The wrapper owns the box now, so the input owning any
|
|
237
|
+
of it again would draw a second one inside the first.
|
|
238
|
+
*/
|
|
239
|
+
input {
|
|
240
|
+
flex: 1;
|
|
241
|
+
min-width: 0;
|
|
242
|
+
|
|
243
|
+
padding: 0;
|
|
244
|
+
border: none;
|
|
245
|
+
background: transparent;
|
|
246
|
+
color: inherit;
|
|
247
|
+
|
|
248
|
+
font-family: inherit;
|
|
249
|
+
font-size: inherit;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
input:focus {
|
|
253
|
+
outline: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
input::placeholder {
|
|
257
|
+
color: var(--tt-muted-foreground);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/*
|
|
261
|
+
Date and time fields.
|
|
262
|
+
|
|
263
|
+
The browser draws its own editor and picker button inside the input,
|
|
264
|
+
and neither of them respects the box this component set up. Chrome
|
|
265
|
+
pads ::-webkit-datetime-edit internally, which pushes the text off the
|
|
266
|
+
baseline every other field in the row sits on, and it gives the picker
|
|
267
|
+
button its own margin, so the icon lands short of the field's right
|
|
268
|
+
padding instead of flush with it. Next to a plain input or a number
|
|
269
|
+
field the whole row reads as misaligned.
|
|
270
|
+
|
|
271
|
+
Stripping both back to zero puts the text and the icon on exactly the
|
|
272
|
+
edges .control already defines. The picker icon itself needs no
|
|
273
|
+
recolouring: tokens.css sets color-scheme, so the browser draws it
|
|
274
|
+
light or dark to match on its own.
|
|
275
|
+
*/
|
|
276
|
+
input::-webkit-datetime-edit {
|
|
277
|
+
padding: 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
input::-webkit-datetime-edit-fields-wrapper {
|
|
281
|
+
padding: 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
input::-webkit-calendar-picker-indicator {
|
|
285
|
+
/* auto rather than a fixed value, so it sits at the right edge
|
|
286
|
+
whether or not the field also has a suffix slotted in. */
|
|
287
|
+
margin: 0;
|
|
288
|
+
margin-inline-start: auto;
|
|
289
|
+
padding: 0;
|
|
290
|
+
|
|
291
|
+
cursor: pointer;
|
|
292
|
+
|
|
293
|
+
/* Matches the weight of a tt-icon in the same row, which is drawn at
|
|
294
|
+
the muted foreground rather than at full contrast. */
|
|
295
|
+
opacity: 0.6;
|
|
296
|
+
|
|
297
|
+
transition: opacity var(--tt-duration-fast) var(--tt-ease);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
input::-webkit-calendar-picker-indicator:hover {
|
|
301
|
+
opacity: 1;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
input:disabled {
|
|
305
|
+
color: inherit;
|
|
306
|
+
cursor: not-allowed;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/* Slots are display:contents by default, so an empty one adds no box
|
|
310
|
+
and costs no gap. Nothing to hide when unused. */
|
|
311
|
+
::slotted(*) {
|
|
312
|
+
flex: 0 0 auto;
|
|
313
|
+
color: var(--tt-muted-foreground);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* min-height, not height: the field still grows for a slotted button
|
|
317
|
+
or a taller font, it simply never sits below the control size. */
|
|
318
|
+
.small {
|
|
319
|
+
min-height: var(--tt-control-sm);
|
|
320
|
+
padding: 0 11px;
|
|
321
|
+
font-size: var(--tt-text-sm);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.medium {
|
|
325
|
+
min-height: var(--tt-control-md);
|
|
326
|
+
padding: 0 13px;
|
|
327
|
+
font-size: var(--tt-text-sm);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.large {
|
|
331
|
+
min-height: var(--tt-control-lg);
|
|
332
|
+
padding: 0 16px;
|
|
333
|
+
font-size: var(--tt-text-md);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.error {
|
|
337
|
+
border-color: var(--tt-destructive);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.error:hover:not(.disabled),
|
|
341
|
+
.error:focus-within {
|
|
342
|
+
border-color: var(--tt-destructive);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* An invalid field still gets a ring, in the destructive colour, so
|
|
346
|
+
the ring carries the error instead of a second glow doing it. */
|
|
347
|
+
.error:focus-within {
|
|
348
|
+
outline-color: var(--tt-destructive);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.error-text {
|
|
352
|
+
color: var(--tt-destructive);
|
|
353
|
+
font-size: var(--tt-text-xs);
|
|
354
|
+
font-weight: var(--tt-weight-medium);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* iOS zooms the viewport when a focused field is under 16px. */
|
|
358
|
+
@media (max-width: 480px) {
|
|
359
|
+
.small,
|
|
360
|
+
.medium,
|
|
361
|
+
.large {
|
|
362
|
+
font-size: 16px;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
`]; }
|
|
367
|
+
render() {
|
|
368
|
+
const errorId = this.error ? `${this.inputId}-error` : undefined;
|
|
369
|
+
/*
|
|
370
|
+
The <label> holds the label TEXT and nothing else.
|
|
371
|
+
|
|
372
|
+
It used to wrap the whole field: the prefix and suffix slots and the
|
|
373
|
+
error message too. A <label>'s whole content becomes the input's
|
|
374
|
+
accessible name, so a slotted clear button made the field's name
|
|
375
|
+
"Email Clear search", and an error was read twice, once as the name
|
|
376
|
+
and once as the description. Worse, with no label set, tt-search's
|
|
377
|
+
field was named just "Clear search".
|
|
378
|
+
*/
|
|
379
|
+
return html `
|
|
380
|
+
<div class="field">
|
|
381
|
+
${this.label
|
|
382
|
+
? html `
|
|
383
|
+
<label
|
|
384
|
+
for=${this.inputId}
|
|
385
|
+
part="label"
|
|
386
|
+
class=${this.labelHidden ? "sr-only" : ""}
|
|
387
|
+
>
|
|
388
|
+
${this.label}
|
|
389
|
+
${this.required
|
|
390
|
+
? html `<span class="req" aria-hidden="true">*</span>`
|
|
391
|
+
: ""}
|
|
392
|
+
</label>
|
|
393
|
+
`
|
|
394
|
+
: ""}
|
|
395
|
+
|
|
396
|
+
<div
|
|
397
|
+
part="control"
|
|
398
|
+
class="control ${this.size} ${this.error ? "error" : ""} ${this
|
|
399
|
+
.disabled
|
|
400
|
+
? "disabled"
|
|
401
|
+
: ""}"
|
|
402
|
+
@click=${this.focusFromBox}
|
|
403
|
+
>
|
|
404
|
+
<slot name="prefix"></slot>
|
|
405
|
+
|
|
406
|
+
<input
|
|
407
|
+
part="input"
|
|
408
|
+
id=${this.inputId}
|
|
409
|
+
.value=${this.value}
|
|
410
|
+
name=${this.name}
|
|
411
|
+
placeholder=${this.placeholder}
|
|
412
|
+
type=${this.type}
|
|
413
|
+
autocomplete=${ifDefined(this.autocomplete)}
|
|
414
|
+
?disabled=${this.disabled}
|
|
415
|
+
?required=${this.required}
|
|
416
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
417
|
+
aria-describedby=${ifDefined(errorId)}
|
|
418
|
+
@input=${this.handleInput}
|
|
419
|
+
@change=${this.handleChange}
|
|
420
|
+
/>
|
|
421
|
+
|
|
422
|
+
<slot name="suffix"></slot>
|
|
423
|
+
</div>
|
|
424
|
+
|
|
425
|
+
${this.error
|
|
426
|
+
? html `
|
|
427
|
+
<span id=${ifDefined(errorId)} class="error-text" role="alert">
|
|
428
|
+
${this.error}
|
|
429
|
+
</span>
|
|
430
|
+
`
|
|
431
|
+
: null}
|
|
432
|
+
</div>
|
|
433
|
+
`;
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
__decorate([
|
|
437
|
+
property()
|
|
438
|
+
], TTInput.prototype, "label", void 0);
|
|
439
|
+
__decorate([
|
|
440
|
+
property()
|
|
441
|
+
], TTInput.prototype, "placeholder", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
property()
|
|
444
|
+
], TTInput.prototype, "value", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
property({ type: String, reflect: true })
|
|
447
|
+
], TTInput.prototype, "name", void 0);
|
|
448
|
+
__decorate([
|
|
449
|
+
property()
|
|
450
|
+
], TTInput.prototype, "type", void 0);
|
|
451
|
+
__decorate([
|
|
452
|
+
property()
|
|
453
|
+
], TTInput.prototype, "autocomplete", void 0);
|
|
454
|
+
__decorate([
|
|
455
|
+
property()
|
|
456
|
+
], TTInput.prototype, "size", void 0);
|
|
457
|
+
__decorate([
|
|
458
|
+
property({ type: Boolean, reflect: true })
|
|
459
|
+
], TTInput.prototype, "disabled", void 0);
|
|
460
|
+
__decorate([
|
|
461
|
+
property({ type: Boolean })
|
|
462
|
+
], TTInput.prototype, "required", void 0);
|
|
463
|
+
__decorate([
|
|
464
|
+
property({ type: Boolean, attribute: "full-width", reflect: true })
|
|
465
|
+
], TTInput.prototype, "fullWidth", void 0);
|
|
466
|
+
__decorate([
|
|
467
|
+
property()
|
|
468
|
+
], TTInput.prototype, "error", void 0);
|
|
469
|
+
__decorate([
|
|
470
|
+
property({ type: Boolean, attribute: "label-hidden", reflect: true })
|
|
471
|
+
], TTInput.prototype, "labelHidden", void 0);
|
|
472
|
+
TTInput = __decorate([
|
|
473
|
+
customElement("tt-input")
|
|
474
|
+
], TTInput);
|
|
475
|
+
export { TTInput };
|
|
476
|
+
//# sourceMappingURL=tt-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-input.js","sourceRoot":"","sources":["../src/tt-input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC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EAAE,IAAI,EAAE,CAAC;yCAC1B;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAClD;AAGlB;IADC,QAAQ,EAAE;sCACA;AAUX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAClD;AAzET,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAoenB"}
|
package/dist/tt-kbd.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type KbdSize = "small" | "medium";
|
|
3
|
+
/**
|
|
4
|
+
* A keyboard key, as printed in documentation and menus.
|
|
5
|
+
*
|
|
6
|
+
* Renders a real `<kbd>`, which is the element the HTML spec defines for
|
|
7
|
+
* "user input from a keyboard". A styled `<span>` looks identical and
|
|
8
|
+
* tells a screen reader nothing, so this is one of the rare cases where
|
|
9
|
+
* picking the right tag IS the accessibility work.
|
|
10
|
+
*
|
|
11
|
+
* Presentational only. It displays a key, it never listens for one.
|
|
12
|
+
*
|
|
13
|
+
* ---------------------------------------------------------------------
|
|
14
|
+
* ON `keys`.
|
|
15
|
+
*
|
|
16
|
+
* A combination is one idea, so it is one element:
|
|
17
|
+
*
|
|
18
|
+
* <tt-kbd keys="Ctrl+K"></tt-kbd>
|
|
19
|
+
*
|
|
20
|
+
* splits on "+" and renders a separator between the parts. Writing three
|
|
21
|
+
* elements and two literal plus signs in the markup instead would leave
|
|
22
|
+
* the separator's spacing to whoever typed it, and it would be different
|
|
23
|
+
* on every page by the end of the month.
|
|
24
|
+
*
|
|
25
|
+
* The default slot is the escape hatch for anything that is not a
|
|
26
|
+
* plus-separated combination, an arrow glyph say.
|
|
27
|
+
*/
|
|
28
|
+
export declare class TTKbd extends LitElement {
|
|
29
|
+
keys: string;
|
|
30
|
+
size: KbdSize;
|
|
31
|
+
static styles: import("lit").CSSResult;
|
|
32
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
"tt-kbd": TTKbd;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=tt-kbd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-kbd.d.ts","sourceRoot":"","sources":["../src/tt-kbd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,KAAM,SAAQ,UAAU;IACP,IAAI,SAAM;IAEK,IAAI,EAAE,OAAO,CAAY;IAEpE,MAAM,CAAC,MAAM,0BAsEX;IAEF,MAAM;CA2BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,QAAQ,EAAE,KAAK,CAAC;KACjB;CACF"}
|
package/dist/tt-kbd.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
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, customElement } from "lit/decorators.js";
|
|
9
|
+
/**
|
|
10
|
+
* A keyboard key, as printed in documentation and menus.
|
|
11
|
+
*
|
|
12
|
+
* Renders a real `<kbd>`, which is the element the HTML spec defines for
|
|
13
|
+
* "user input from a keyboard". A styled `<span>` looks identical and
|
|
14
|
+
* tells a screen reader nothing, so this is one of the rare cases where
|
|
15
|
+
* picking the right tag IS the accessibility work.
|
|
16
|
+
*
|
|
17
|
+
* Presentational only. It displays a key, it never listens for one.
|
|
18
|
+
*
|
|
19
|
+
* ---------------------------------------------------------------------
|
|
20
|
+
* ON `keys`.
|
|
21
|
+
*
|
|
22
|
+
* A combination is one idea, so it is one element:
|
|
23
|
+
*
|
|
24
|
+
* <tt-kbd keys="Ctrl+K"></tt-kbd>
|
|
25
|
+
*
|
|
26
|
+
* splits on "+" and renders a separator between the parts. Writing three
|
|
27
|
+
* elements and two literal plus signs in the markup instead would leave
|
|
28
|
+
* the separator's spacing to whoever typed it, and it would be different
|
|
29
|
+
* on every page by the end of the month.
|
|
30
|
+
*
|
|
31
|
+
* The default slot is the escape hatch for anything that is not a
|
|
32
|
+
* plus-separated combination, an arrow glyph say.
|
|
33
|
+
*/
|
|
34
|
+
let TTKbd = class TTKbd extends LitElement {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.keys = "";
|
|
38
|
+
this.size = "medium";
|
|
39
|
+
}
|
|
40
|
+
static { this.styles = css `
|
|
41
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
42
|
+
hidden element would still show. Important, so it always wins. */
|
|
43
|
+
:host([hidden]) {
|
|
44
|
+
display: none !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
vertical-align: middle;
|
|
50
|
+
max-width: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.kbd {
|
|
54
|
+
display: inline-flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: var(--tt-space-1);
|
|
57
|
+
|
|
58
|
+
font-family: var(--tt-font-sans);
|
|
59
|
+
max-width: 100%;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
kbd {
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
min-width: 1.5em;
|
|
70
|
+
padding: 0 var(--tt-space-2);
|
|
71
|
+
|
|
72
|
+
/* The height comes from a control token rather than from padding,
|
|
73
|
+
so a key beside an input lines up with it, and so the density
|
|
74
|
+
modes and the coarse-pointer block remap it for free. */
|
|
75
|
+
height: calc(var(--tt-control-sm) * 0.72);
|
|
76
|
+
|
|
77
|
+
font-family: var(--tt-font-mono);
|
|
78
|
+
font-size: var(--tt-text-xs);
|
|
79
|
+
font-weight: var(--tt-weight-medium);
|
|
80
|
+
|
|
81
|
+
/* A key is not a paragraph. An inherited body line-height adds
|
|
82
|
+
invisible space above and below the glyph and the key comes out
|
|
83
|
+
taller than it looks. Same trap as tt-badge. */
|
|
84
|
+
line-height: 1;
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
|
|
87
|
+
color: var(--tt-muted-foreground);
|
|
88
|
+
background: var(--tt-muted);
|
|
89
|
+
|
|
90
|
+
border: 1px solid var(--tt-border);
|
|
91
|
+
border-radius: var(--tt-radius-sm);
|
|
92
|
+
|
|
93
|
+
/* One hairline under the key. This is the whole illusion of a
|
|
94
|
+
physical key, and one pixel is enough: a real shadow here reads
|
|
95
|
+
as a floating card rather than as a keycap. */
|
|
96
|
+
box-shadow: 0 1px 0 var(--tt-border);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([size="small"]) kbd {
|
|
100
|
+
height: calc(var(--tt-control-sm) * 0.6);
|
|
101
|
+
padding: 0 var(--tt-space-1);
|
|
102
|
+
font-size: 0.6875rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.sep {
|
|
106
|
+
font-size: var(--tt-text-xs);
|
|
107
|
+
color: var(--tt-muted-foreground);
|
|
108
|
+
opacity: 0.6;
|
|
109
|
+
}
|
|
110
|
+
`; }
|
|
111
|
+
render() {
|
|
112
|
+
/*
|
|
113
|
+
Filter after splitting, so "Ctrl++" (the plus key) does not produce
|
|
114
|
+
an empty key between two separators.
|
|
115
|
+
*/
|
|
116
|
+
const parts = this.keys
|
|
117
|
+
.split("+")
|
|
118
|
+
.map((k) => k.trim())
|
|
119
|
+
.filter(Boolean);
|
|
120
|
+
if (parts.length === 0) {
|
|
121
|
+
return html `<span class="kbd"
|
|
122
|
+
><kbd part="key"><slot></slot></kbd
|
|
123
|
+
></span>`;
|
|
124
|
+
}
|
|
125
|
+
return html `
|
|
126
|
+
<span class="kbd">
|
|
127
|
+
${parts.map((key, i) => html `
|
|
128
|
+
${i > 0 ? html `<span class="sep" aria-hidden="true">+</span>` : ""}
|
|
129
|
+
<kbd part="key">${key}</kbd>
|
|
130
|
+
`)}
|
|
131
|
+
</span>
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
__decorate([
|
|
136
|
+
property({ type: String })
|
|
137
|
+
], TTKbd.prototype, "keys", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
property({ type: String, reflect: true })
|
|
140
|
+
], TTKbd.prototype, "size", void 0);
|
|
141
|
+
TTKbd = __decorate([
|
|
142
|
+
customElement("tt-kbd")
|
|
143
|
+
], TTKbd);
|
|
144
|
+
export { TTKbd };
|
|
145
|
+
//# sourceMappingURL=tt-kbd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-kbd.js","sourceRoot":"","sources":["../src/tt-kbd.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QA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