@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,132 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Attaches controls into one unit: the corners where they meet flatten,
|
|
11
|
+
* and their borders collapse onto a single shared edge.
|
|
12
|
+
*
|
|
13
|
+
* Use it when the buttons are alternatives to each other, or steps in one
|
|
14
|
+
* decision. Do NOT use it as a way to save space between unrelated
|
|
15
|
+
* actions: joining "Reload" to "Checkout" tells the reader they belong
|
|
16
|
+
* together, and they do not. A plain flex row with a gap is right for
|
|
17
|
+
* those, which is what tt-toolbar already does.
|
|
18
|
+
*
|
|
19
|
+
* HOW IT REACHES INSIDE ITS CHILDREN. Each control's radius lives on an
|
|
20
|
+
* element in its own shadow root, and ::slotted() only ever matches the
|
|
21
|
+
* host, never anything within it. So a group cannot restyle a button's
|
|
22
|
+
* corners directly. What it can do is set a CUSTOM PROPERTY on the host,
|
|
23
|
+
* because custom properties inherit through the shadow boundary, and each
|
|
24
|
+
* groupable control reads `--tt-group-radius` for its own radius. The
|
|
25
|
+
* group sets that per position, and the child applies it.
|
|
26
|
+
*
|
|
27
|
+
* Works with tt-button, tt-dropdown-menu, tt-select and tt-input.
|
|
28
|
+
*/
|
|
29
|
+
let TTButtonGroup = class TTButtonGroup extends LitElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.orientation = "horizontal";
|
|
33
|
+
}
|
|
34
|
+
static { this.styles = css `
|
|
35
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
36
|
+
hidden element would still show. Important, so it always wins. */
|
|
37
|
+
:host([hidden]) {
|
|
38
|
+
display: none !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
font-family: var(--tt-font-sans);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.group {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
/* stretch, so a shorter control still meets its neighbour's edges
|
|
49
|
+
rather than floating in the middle of the row. */
|
|
50
|
+
align-items: stretch;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([orientation="vertical"]) .group {
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: stretch;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
Everything in the middle loses every corner; the two ends keep only
|
|
60
|
+
their outer ones.
|
|
61
|
+
|
|
62
|
+
:not(:only-child) on the end rules is load-bearing. A lone child is
|
|
63
|
+
first AND last, and the end rules carry a :host([...]) prefix that
|
|
64
|
+
outranks a bare ::slotted(:only-child), so a group of one came out
|
|
65
|
+
with the last-child radius: square on the left, round on the right.
|
|
66
|
+
Excluding it explicitly beats relying on source order against a more
|
|
67
|
+
specific selector.
|
|
68
|
+
*/
|
|
69
|
+
::slotted(*) {
|
|
70
|
+
--tt-group-radius: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
::slotted(:only-child) {
|
|
74
|
+
--tt-group-radius: var(--tt-radius);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([orientation="horizontal"]) ::slotted(:first-child:not(:only-child)) {
|
|
78
|
+
--tt-group-radius: var(--tt-radius) 0 0 var(--tt-radius);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([orientation="horizontal"]) ::slotted(:last-child:not(:only-child)) {
|
|
82
|
+
--tt-group-radius: 0 var(--tt-radius) var(--tt-radius) 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host([orientation="vertical"]) ::slotted(:first-child:not(:only-child)) {
|
|
86
|
+
--tt-group-radius: var(--tt-radius) var(--tt-radius) 0 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:host([orientation="vertical"]) ::slotted(:last-child:not(:only-child)) {
|
|
90
|
+
--tt-group-radius: 0 0 var(--tt-radius) var(--tt-radius);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
Pull each neighbour back over the previous one's border. Two adjacent
|
|
95
|
+
1px borders otherwise stack into a 2px seam that reads as a gap
|
|
96
|
+
rather than a join.
|
|
97
|
+
*/
|
|
98
|
+
:host([orientation="horizontal"]) ::slotted(:not(:first-child)) {
|
|
99
|
+
margin-left: -1px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host([orientation="vertical"]) ::slotted(:not(:first-child)) {
|
|
103
|
+
margin-top: -1px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/*
|
|
107
|
+
Whatever is hovered or focused draws its border and its focus ring
|
|
108
|
+
on top of its neighbours. Without this the overlap above means the
|
|
109
|
+
NEXT control's border covers the active one's, and the ring gets
|
|
110
|
+
clipped along the edge where they meet.
|
|
111
|
+
*/
|
|
112
|
+
::slotted(:hover),
|
|
113
|
+
::slotted(:focus-within) {
|
|
114
|
+
z-index: 1;
|
|
115
|
+
}
|
|
116
|
+
`; }
|
|
117
|
+
render() {
|
|
118
|
+
return html `
|
|
119
|
+
<div class="group" part="group" role="group">
|
|
120
|
+
<slot></slot>
|
|
121
|
+
</div>
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: String, reflect: true })
|
|
127
|
+
], TTButtonGroup.prototype, "orientation", void 0);
|
|
128
|
+
TTButtonGroup = __decorate([
|
|
129
|
+
customElement("tt-button-group")
|
|
130
|
+
], TTButtonGroup);
|
|
131
|
+
export { TTButtonGroup };
|
|
132
|
+
//# sourceMappingURL=tt-button-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-button-group.js","sourceRoot":"","sources":["../src/tt-button-group.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;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAEL,gBAAW,GAA8B,YAAY,CAAC;IA6FxD,CAAC;aA3FQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFlB,AAlFY,CAkFX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;;AA5FD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACY;AAF3C,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA+FzB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type ButtonVariant = "primary" | "secondary" | "danger" | "ghost";
|
|
3
|
+
export type ButtonSize = "small" | "medium" | "large";
|
|
4
|
+
export type ButtonType = "button" | "submit" | "reset";
|
|
5
|
+
export type ButtonCurrent = "page" | "step" | "location" | "date" | "time" | "true";
|
|
6
|
+
export declare class TTButton extends LitElement {
|
|
7
|
+
variant: ButtonVariant;
|
|
8
|
+
size: ButtonSize;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
fullWidth: boolean;
|
|
12
|
+
pill: boolean;
|
|
13
|
+
type: ButtonType;
|
|
14
|
+
label: string;
|
|
15
|
+
current: ButtonCurrent | "";
|
|
16
|
+
expanded: "true" | "false" | "";
|
|
17
|
+
private iconOnly;
|
|
18
|
+
protected firstUpdated(): void;
|
|
19
|
+
private handleSlotChange;
|
|
20
|
+
private detectIconOnly;
|
|
21
|
+
private handleClick;
|
|
22
|
+
static styles: import("lit").CSSResult;
|
|
23
|
+
focus(options?: FocusOptions): void;
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
"tt-button": TTButton;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=tt-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-button.d.ts","sourceRoot":"","sources":["../src/tt-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAWtD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAIvD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpF,qBACa,QAAS,SAAQ,UAAU;IAEtC,OAAO,EAAE,aAAa,CAAa;IAGnC,IAAI,EAAE,UAAU,CAAY;IAG5B,QAAQ,UAAS;IAGjB,OAAO,UAAS;IAMhB,SAAS,UAAS;IAYlB,IAAI,UAAS;IAGb,IAAI,EAAE,UAAU,CAAY;IAW5B,KAAK,SAAM;IAYX,OAAO,EAAE,aAAa,GAAG,EAAE,CAAM;IAcjC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,EAAE,CAAM;IAMrC,OAAO,CAAC,QAAQ,CAAS;IAQzB,SAAS,CAAC,YAAY;IAKtB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,WAAW;IAWnB,MAAM,CAAC,MAAM,0BA4SX;IAIF,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAc5B,MAAM;CA8BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css, nothing } from "lit";
|
|
8
|
+
import { property, customElement, state } from "lit/decorators.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
let TTButton = class TTButton extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.variant = "primary";
|
|
14
|
+
this.size = "medium";
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.loading = false;
|
|
17
|
+
// Reflected so the :host([full-width]) rule can match. Every multi-word
|
|
18
|
+
// property names its attribute in kebab-case explicitly; Lit's default
|
|
19
|
+
// would be the lowercased `fullwidth`.
|
|
20
|
+
this.fullWidth = false;
|
|
21
|
+
/*
|
|
22
|
+
Fully round ends. Reflected so the :host([pill]) rule can match.
|
|
23
|
+
|
|
24
|
+
A boolean rather than a shape="pill" scale, because there are only two
|
|
25
|
+
answers and the second one has no name worth arguing about. It sets
|
|
26
|
+
--_radius, the same variable the size classes set, so it stays behind
|
|
27
|
+
--tt-group-radius: a pill inside a tt-button-group still flattens its
|
|
28
|
+
inner corners, which is what keeps the group looking like one control.
|
|
29
|
+
*/
|
|
30
|
+
this.pill = false;
|
|
31
|
+
this.type = "button";
|
|
32
|
+
/*
|
|
33
|
+
The accessible name, for a button whose whole content is an icon.
|
|
34
|
+
|
|
35
|
+
It has to live here rather than as aria-label on the host, because the
|
|
36
|
+
host is a plain custom element with no role: assistive tech reads the
|
|
37
|
+
inner <button>, and an aria-label on the outside never reaches it. An
|
|
38
|
+
icon-only button without this is announced as just "button".
|
|
39
|
+
*/
|
|
40
|
+
this.label = "";
|
|
41
|
+
/*
|
|
42
|
+
Marks this button as the current one in a set: the page you are on in
|
|
43
|
+
tt-pagination, the step you are at in a wizard. Forwarded to the inner
|
|
44
|
+
<button> for the same reason as label: an aria-current on the host
|
|
45
|
+
never reaches what assistive tech reads.
|
|
46
|
+
|
|
47
|
+
Not named ariaCurrent, which every Element already has; shadowing a
|
|
48
|
+
built-in DOM member breaks the element type.
|
|
49
|
+
*/
|
|
50
|
+
this.current = "";
|
|
51
|
+
/*
|
|
52
|
+
Whether the thing this button opens is open: a menu, a drawer, a
|
|
53
|
+
collapsible panel. Forwarded to the inner <button> as aria-expanded,
|
|
54
|
+
for the same reason as label and current: on the host it reaches
|
|
55
|
+
nothing. tt-navbar's menu button set aria-expanded on the host and a
|
|
56
|
+
screen reader never heard whether the menu was open.
|
|
57
|
+
|
|
58
|
+
A string, not a boolean, because there are THREE states: "true",
|
|
59
|
+
"false", and "" for a button that opens nothing, which must carry no
|
|
60
|
+
aria-expanded at all. A boolean cannot say the third.
|
|
61
|
+
*/
|
|
62
|
+
this.expanded = "";
|
|
63
|
+
// Set from slotchange, not asked for as a prop. There is no CSS
|
|
64
|
+
// selector for "this slot has assigned nodes", and a caller who has to
|
|
65
|
+
// remember a flag will forget it.
|
|
66
|
+
this.iconOnly = false;
|
|
67
|
+
}
|
|
68
|
+
/*
|
|
69
|
+
Also checked on first render. slotchange fires only when something is
|
|
70
|
+
assigned, so a button whose default slot is EMPTY from the start
|
|
71
|
+
(one-line markup, or a design loaded with only an icon) never heard
|
|
72
|
+
one and stayed the wide, padded shape of a text button.
|
|
73
|
+
*/
|
|
74
|
+
firstUpdated() {
|
|
75
|
+
const slot = this.renderRoot.querySelector("slot:not([name])");
|
|
76
|
+
if (slot)
|
|
77
|
+
this.detectIconOnly(slot);
|
|
78
|
+
}
|
|
79
|
+
handleSlotChange(event) {
|
|
80
|
+
this.detectIconOnly(event.target);
|
|
81
|
+
}
|
|
82
|
+
detectIconOnly(slot) {
|
|
83
|
+
// Whitespace-only text nodes are not content. Without the trim, the
|
|
84
|
+
// newline between the tags counts as a label and nothing is ever
|
|
85
|
+
// detected as icon-only.
|
|
86
|
+
const hasText = slot
|
|
87
|
+
.assignedNodes({ flatten: true })
|
|
88
|
+
.some((node) => (node.textContent ?? "").trim().length > 0);
|
|
89
|
+
this.iconOnly = !hasText;
|
|
90
|
+
}
|
|
91
|
+
handleClick() {
|
|
92
|
+
if (this.disabled || this.loading)
|
|
93
|
+
return;
|
|
94
|
+
this.dispatchEvent(new CustomEvent("tt-button-click", {
|
|
95
|
+
bubbles: true,
|
|
96
|
+
composed: true,
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
static { this.styles = css `
|
|
100
|
+
/* The browser's own [hidden] rule loses to any :host display, so a
|
|
101
|
+
hidden element would still show. Important, so it always wins. */
|
|
102
|
+
:host([hidden]) {
|
|
103
|
+
display: none !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host {
|
|
107
|
+
display: inline-block;
|
|
108
|
+
font-family: var(--tt-font-sans);
|
|
109
|
+
-webkit-font-smoothing: antialiased;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([full-width]) {
|
|
113
|
+
display: block;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
button {
|
|
117
|
+
position: relative;
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
flex, not inline-flex. The host is already the inline box; an
|
|
121
|
+
inline-flex button inside it sat on a LINE inside the host, and a
|
|
122
|
+
line is at least as tall as the inherited line-height. In a
|
|
123
|
+
paragraph with line-height 2 the host grew to 36px around a 32px
|
|
124
|
+
button, so it no longer lined up with a tt-input beside it. A
|
|
125
|
+
block-level button makes no line, so the host is exactly the
|
|
126
|
+
button's height wherever it sits.
|
|
127
|
+
*/
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
|
|
132
|
+
/* Part of the size ramp, not a constant. A large button used to
|
|
133
|
+
carry the same 8px icon gap as a small one, so scaling the button
|
|
134
|
+
did not scale the space inside it and the proportions drifted. */
|
|
135
|
+
gap: var(--_gap);
|
|
136
|
+
|
|
137
|
+
width: 100%;
|
|
138
|
+
box-sizing: border-box;
|
|
139
|
+
|
|
140
|
+
border: 1px solid transparent;
|
|
141
|
+
/* tt-button-group flattens this per position, so controls that
|
|
142
|
+
sit together share one edge instead of stacking two. */
|
|
143
|
+
border-radius: var(--tt-group-radius, var(--_radius));
|
|
144
|
+
|
|
145
|
+
/*
|
|
146
|
+
NO vertical padding. The size classes set min-height from
|
|
147
|
+
--tt-control-*, and vertical padding fights it: 14px text plus
|
|
148
|
+
10px top and bottom is ~37px, which already exceeds the 36px
|
|
149
|
+
control height, so min-height never applied and neither the
|
|
150
|
+
density modes nor the pointer:coarse touch block did anything to
|
|
151
|
+
buttons. Pad horizontally, let min-height do the vertical.
|
|
152
|
+
*/
|
|
153
|
+
padding: 0 var(--tt-space-4);
|
|
154
|
+
|
|
155
|
+
font-family: inherit;
|
|
156
|
+
font-size: var(--tt-text-sm);
|
|
157
|
+
line-height: 1;
|
|
158
|
+
font-weight: 550;
|
|
159
|
+
letter-spacing: -0.01em;
|
|
160
|
+
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
user-select: none;
|
|
163
|
+
|
|
164
|
+
transition:
|
|
165
|
+
background var(--tt-duration-normal) var(--tt-ease),
|
|
166
|
+
border-color var(--tt-duration-normal) var(--tt-ease),
|
|
167
|
+
box-shadow var(--tt-duration-normal) var(--tt-ease),
|
|
168
|
+
transform var(--tt-duration-fast) var(--tt-ease);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
button:active:not(:disabled):not(.is-loading) {
|
|
172
|
+
transform: scale(0.97);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
button:focus-visible {
|
|
176
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
177
|
+
outline-offset: var(--tt-ring-offset);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* Variants */
|
|
181
|
+
|
|
182
|
+
.primary {
|
|
183
|
+
background: var(--tt-primary);
|
|
184
|
+
color: var(--tt-primary-foreground);
|
|
185
|
+
border-color: var(--tt-primary);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.primary:hover:not(:disabled):not(.is-loading) {
|
|
189
|
+
background: color-mix(
|
|
190
|
+
in srgb,
|
|
191
|
+
var(--tt-primary) 88%,
|
|
192
|
+
var(--tt-foreground)
|
|
193
|
+
);
|
|
194
|
+
border-color: color-mix(
|
|
195
|
+
in srgb,
|
|
196
|
+
var(--tt-primary) 88%,
|
|
197
|
+
var(--tt-foreground)
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.secondary {
|
|
202
|
+
background: var(--tt-secondary);
|
|
203
|
+
color: var(--tt-secondary-foreground);
|
|
204
|
+
border-color: var(--tt-border);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.secondary:hover:not(:disabled):not(.is-loading) {
|
|
208
|
+
background: var(--tt-accent);
|
|
209
|
+
border-color: var(--tt-border);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
Ghost: no surface of its own until you touch it.
|
|
214
|
+
|
|
215
|
+
The gap this fills is every button that sits ON something rather
|
|
216
|
+
than in a form - a card's corner actions, a toolbar, an icon button
|
|
217
|
+
in a header. secondary has a border and a fill, so three of them in
|
|
218
|
+
a card corner read as three boxes competing with the content they
|
|
219
|
+
are attached to. This one is invisible at rest and only appears
|
|
220
|
+
under the pointer.
|
|
221
|
+
|
|
222
|
+
Muted at rest so it stays subordinate, full foreground on hover so
|
|
223
|
+
it does not look disabled once you are on it.
|
|
224
|
+
*/
|
|
225
|
+
.ghost {
|
|
226
|
+
background: transparent;
|
|
227
|
+
color: var(--tt-muted-foreground);
|
|
228
|
+
border-color: transparent;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.ghost:hover:not(:disabled):not(.is-loading) {
|
|
232
|
+
background: var(--tt-accent);
|
|
233
|
+
color: var(--tt-foreground);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.danger {
|
|
237
|
+
background: var(--tt-destructive);
|
|
238
|
+
color: var(--tt-destructive-foreground);
|
|
239
|
+
border-color: var(--tt-destructive);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.danger:hover:not(:disabled):not(.is-loading) {
|
|
243
|
+
background: color-mix(
|
|
244
|
+
in srgb,
|
|
245
|
+
var(--tt-destructive) 88%,
|
|
246
|
+
var(--tt-foreground)
|
|
247
|
+
);
|
|
248
|
+
border-color: color-mix(
|
|
249
|
+
in srgb,
|
|
250
|
+
var(--tt-destructive) 88%,
|
|
251
|
+
var(--tt-foreground)
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Sizes */
|
|
256
|
+
|
|
257
|
+
/*
|
|
258
|
+
--tt-icon-size is set here rather than on ::slotted(tt-icon), because
|
|
259
|
+
custom properties inherit THROUGH the shadow boundary and a selector
|
|
260
|
+
cannot. tt-icon reads it, so a small button gets small icons with no
|
|
261
|
+
coordination at the call site.
|
|
262
|
+
*/
|
|
263
|
+
/*
|
|
264
|
+
One size sets one bundle: height, padding, gap, icon size, radius and
|
|
265
|
+
type. Picking any of those independently is how a design system drifts,
|
|
266
|
+
because the ratios between them are the thing that has to hold.
|
|
267
|
+
|
|
268
|
+
Icon sizes are the same 14 / 16 / 18 as before, now expressed in units
|
|
269
|
+
so they move with --tt-unit rather than staying frozen in px while
|
|
270
|
+
everything around them scales.
|
|
271
|
+
|
|
272
|
+
Radius grows with the box: a 40px-tall button with a 32px button's
|
|
273
|
+
corner reads as tight. Both are floored well below the height, so
|
|
274
|
+
neither ever becomes a pill by accident.
|
|
275
|
+
*/
|
|
276
|
+
.small {
|
|
277
|
+
min-height: var(--tt-control-sm);
|
|
278
|
+
padding: 0 var(--tt-space-3);
|
|
279
|
+
/* text-sm, not text-xs. A small button used to be 12px while a
|
|
280
|
+
small tt-input beside it was 14px, and the pair read as two
|
|
281
|
+
different sizes rather than one row. */
|
|
282
|
+
font-size: var(--tt-text-sm);
|
|
283
|
+
--_gap: calc(var(--tt-unit) * 1.5); /* 6px */
|
|
284
|
+
--_radius: var(--tt-radius-md);
|
|
285
|
+
--tt-icon-size: calc(var(--tt-unit) * 3.5); /* 14px */
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* 16px sides, was 20. At 20 a 36px button was wider than it was
|
|
289
|
+
tall by more than its label needed, and an icon plus a word read
|
|
290
|
+
as a loose row rather than one control. */
|
|
291
|
+
.medium {
|
|
292
|
+
min-height: var(--tt-control-md);
|
|
293
|
+
padding: 0 var(--tt-space-4);
|
|
294
|
+
--_gap: calc(var(--tt-unit) * 2); /* 8px */
|
|
295
|
+
--_radius: var(--tt-radius-md);
|
|
296
|
+
--tt-icon-size: calc(var(--tt-unit) * 4); /* 16px */
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.large {
|
|
300
|
+
min-height: var(--tt-control-lg);
|
|
301
|
+
padding: 0 var(--tt-space-6);
|
|
302
|
+
font-size: var(--tt-text-md);
|
|
303
|
+
--_gap: calc(var(--tt-unit) * 2.5); /* 10px */
|
|
304
|
+
--_radius: var(--tt-radius-lg);
|
|
305
|
+
--tt-icon-size: calc(var(--tt-unit) * 4.5); /* 18px */
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/*
|
|
309
|
+
After the size classes on purpose. Each of those sets --_radius, so
|
|
310
|
+
this has to come later to win, and it overrides only the radius: a
|
|
311
|
+
pill keeps its size's height, padding and icon scale.
|
|
312
|
+
|
|
313
|
+
An icon-only pill lands on a circle, which is the right answer and
|
|
314
|
+
needs no separate rule.
|
|
315
|
+
*/
|
|
316
|
+
:host([pill]) button {
|
|
317
|
+
--_radius: var(--tt-radius-full);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/*
|
|
321
|
+
Icon-only: square, not a wide pill.
|
|
322
|
+
|
|
323
|
+
Horizontal padding sized for a word leaves a lone icon floating in
|
|
324
|
+
the middle of a 56px box. Detected from the slot rather than asked
|
|
325
|
+
for as a prop, so a caller cannot forget to set it.
|
|
326
|
+
*/
|
|
327
|
+
.icon-only {
|
|
328
|
+
padding: 0;
|
|
329
|
+
width: var(--tt-control-md);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.icon-only.small {
|
|
333
|
+
width: var(--tt-control-sm);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.icon-only.large {
|
|
337
|
+
width: var(--tt-control-lg);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* States */
|
|
341
|
+
|
|
342
|
+
button:disabled {
|
|
343
|
+
opacity: var(--tt-opacity-disabled);
|
|
344
|
+
cursor: not-allowed;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Looks disabled, but is not: see the comment in render(). */
|
|
348
|
+
button.is-loading {
|
|
349
|
+
opacity: var(--tt-opacity-disabled);
|
|
350
|
+
cursor: progress;
|
|
351
|
+
color: transparent;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* Spinner */
|
|
355
|
+
|
|
356
|
+
.spinner {
|
|
357
|
+
position: absolute;
|
|
358
|
+
|
|
359
|
+
width: 16px;
|
|
360
|
+
height: 16px;
|
|
361
|
+
|
|
362
|
+
border: 2px solid currentColor;
|
|
363
|
+
border-top-color: transparent;
|
|
364
|
+
border-radius: var(--tt-radius-full);
|
|
365
|
+
|
|
366
|
+
color: inherit;
|
|
367
|
+
|
|
368
|
+
animation: spin var(--tt-duration-spin) linear infinite;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.primary .spinner,
|
|
372
|
+
.danger .spinner {
|
|
373
|
+
color: var(--tt-primary-foreground);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.secondary .spinner {
|
|
377
|
+
color: var(--tt-secondary-foreground);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
::slotted(tt-icon) {
|
|
381
|
+
flex: 0 0 auto;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
@keyframes spin {
|
|
385
|
+
to {
|
|
386
|
+
transform: rotate(360deg);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/* Durations are handled centrally in tokens.css, including slowing the
|
|
391
|
+
spinner. This is only here for the press transform, which is a state
|
|
392
|
+
rather than a transition and so survives a zeroed duration: without
|
|
393
|
+
this the button would still jump on every click. */
|
|
394
|
+
@media (prefers-reduced-motion: reduce) {
|
|
395
|
+
button:active:not(:disabled):not(.is-loading) {
|
|
396
|
+
transform: none;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
`; }
|
|
400
|
+
// Focus has to be forwarded: focusing the host focuses nothing, since the
|
|
401
|
+
// control lives in the shadow root. Same as tt-slider and tt-input.
|
|
402
|
+
focus(options) {
|
|
403
|
+
this.renderRoot?.querySelector("button")?.focus(options);
|
|
404
|
+
}
|
|
405
|
+
/*
|
|
406
|
+
LOADING IS NOT DISABLED.
|
|
407
|
+
|
|
408
|
+
It used to be: loading set the native `disabled` too. A disabled button
|
|
409
|
+
cannot hold focus, so pressing Save on the keyboard moved focus to
|
|
410
|
+
<body> the instant the request started, and a keyboard user had to
|
|
411
|
+
find their way back from the top of the page. aria-disabled says "not
|
|
412
|
+
available" to a screen reader while focus stays put, and handleClick
|
|
413
|
+
already ignores clicks while loading.
|
|
414
|
+
*/
|
|
415
|
+
render() {
|
|
416
|
+
return html `
|
|
417
|
+
<button
|
|
418
|
+
part="button"
|
|
419
|
+
@click=${this.handleClick}
|
|
420
|
+
type=${this.type}
|
|
421
|
+
?disabled=${this.disabled}
|
|
422
|
+
aria-disabled=${ifDefined(this.loading ? "true" : undefined)}
|
|
423
|
+
aria-busy=${this.loading ? "true" : "false"}
|
|
424
|
+
aria-expanded=${ifDefined(this.expanded || undefined)}
|
|
425
|
+
aria-label=${this.label || nothing}
|
|
426
|
+
aria-current=${ifDefined(this.current || undefined)}
|
|
427
|
+
class="${this.variant} ${this.size} ${this.loading
|
|
428
|
+
? "is-loading"
|
|
429
|
+
: ""} ${this.iconOnly ? "icon-only" : ""}"
|
|
430
|
+
>
|
|
431
|
+
${this.loading
|
|
432
|
+
? html `<span class="spinner" aria-hidden="true"></span>`
|
|
433
|
+
: ""}
|
|
434
|
+
|
|
435
|
+
<slot name="icon"></slot>
|
|
436
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
437
|
+
|
|
438
|
+
<!-- A trailing icon gets its own slot rather than being ordered by
|
|
439
|
+
hand, because a chevron or an external-link mark belongs after
|
|
440
|
+
the label and slot order is fixed. -->
|
|
441
|
+
<slot name="icon-end"></slot>
|
|
442
|
+
</button>
|
|
443
|
+
`;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
__decorate([
|
|
447
|
+
property({ type: String })
|
|
448
|
+
], TTButton.prototype, "variant", void 0);
|
|
449
|
+
__decorate([
|
|
450
|
+
property({ type: String })
|
|
451
|
+
], TTButton.prototype, "size", void 0);
|
|
452
|
+
__decorate([
|
|
453
|
+
property({ type: Boolean, reflect: true })
|
|
454
|
+
], TTButton.prototype, "disabled", void 0);
|
|
455
|
+
__decorate([
|
|
456
|
+
property({ type: Boolean, reflect: true })
|
|
457
|
+
], TTButton.prototype, "loading", void 0);
|
|
458
|
+
__decorate([
|
|
459
|
+
property({ type: Boolean, attribute: "full-width", reflect: true })
|
|
460
|
+
], TTButton.prototype, "fullWidth", void 0);
|
|
461
|
+
__decorate([
|
|
462
|
+
property({ type: Boolean, reflect: true })
|
|
463
|
+
], TTButton.prototype, "pill", void 0);
|
|
464
|
+
__decorate([
|
|
465
|
+
property({ type: String })
|
|
466
|
+
], TTButton.prototype, "type", void 0);
|
|
467
|
+
__decorate([
|
|
468
|
+
property({ type: String })
|
|
469
|
+
], TTButton.prototype, "label", void 0);
|
|
470
|
+
__decorate([
|
|
471
|
+
property({ type: String })
|
|
472
|
+
], TTButton.prototype, "current", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
property({ type: String })
|
|
475
|
+
], TTButton.prototype, "expanded", void 0);
|
|
476
|
+
__decorate([
|
|
477
|
+
state()
|
|
478
|
+
], TTButton.prototype, "iconOnly", void 0);
|
|
479
|
+
TTButton = __decorate([
|
|
480
|
+
customElement("tt-button")
|
|
481
|
+
], TTButton);
|
|
482
|
+
export { TTButton };
|
|
483
|
+
//# sourceMappingURL=tt-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-button.js","sourceRoot":"","sources":["../src/tt-button.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type CardVariant = "default" | "outlined" | "elevated";
|
|
3
|
+
export type CardPadding = "none" | "small" | "medium" | "large";
|
|
4
|
+
export type CardRadius = "none" | "small" | "medium" | "large" | "xlarge";
|
|
5
|
+
export declare class TTCard extends LitElement {
|
|
6
|
+
variant: CardVariant;
|
|
7
|
+
padding: CardPadding;
|
|
8
|
+
radius: CardRadius;
|
|
9
|
+
clickable: boolean;
|
|
10
|
+
inline: boolean;
|
|
11
|
+
heading: string;
|
|
12
|
+
description: string;
|
|
13
|
+
headingLevel: number;
|
|
14
|
+
private hasHeaderSlot;
|
|
15
|
+
private hasActions;
|
|
16
|
+
static styles: import("lit").CSSResult;
|
|
17
|
+
private onKeydown;
|
|
18
|
+
private onSlotChange;
|
|
19
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
"tt-card": TTCard;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=tt-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-card.d.ts","sourceRoot":"","sources":["../src/tt-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1E,qBACa,MAAO,SAAQ,UAAU;IAEpC,OAAO,EAAE,WAAW,CAAa;IAMjC,OAAO,EAAE,WAAW,CAAY;IAGhC,MAAM,EAAE,UAAU,CAAY;IAG9B,SAAS,UAAS;IAKlB,MAAM,UAAS;IAUf,OAAO,SAAM;IAGb,WAAW,SAAM;IAKjB,YAAY,SAAK;IAKR,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAS;IAEpC,MAAM,CAAC,MAAM,0BA4RX;IAEF,OAAO,CAAC,SAAS,CAYf;IAEF,OAAO,CAAC,YAAY;IAgBpB,MAAM;CA+CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|