@tartaguti/ui-components 0.1.0 → 0.3.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 +43 -0
- package/README.md +12 -0
- package/custom-elements.json +2887 -823
- package/dist/accordion/tt-accordion-item.d.ts.map +1 -1
- package/dist/accordion/tt-accordion-item.js +5 -2
- package/dist/accordion/tt-accordion-item.js.map +1 -1
- package/dist/bento/tt-bento-item.d.ts.map +1 -1
- package/dist/bento/tt-bento-item.js +7 -13
- package/dist/bento/tt-bento-item.js.map +1 -1
- package/dist/docs.d.ts +7 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/docs.js +15 -0
- package/dist/docs.js.map +1 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/sidebar/tt-menu-group.d.ts.map +1 -1
- package/dist/sidebar/tt-menu-group.js +16 -5
- package/dist/sidebar/tt-menu-group.js.map +1 -1
- package/dist/sidebar/tt-menu-item.d.ts.map +1 -1
- package/dist/sidebar/tt-menu-item.js +24 -11
- package/dist/sidebar/tt-menu-item.js.map +1 -1
- package/dist/sidebar/tt-sidebar-footer.d.ts.map +1 -1
- package/dist/sidebar/tt-sidebar-footer.js +7 -3
- package/dist/sidebar/tt-sidebar-footer.js.map +1 -1
- package/dist/sidebar/tt-sidebar.d.ts +8 -3
- package/dist/sidebar/tt-sidebar.d.ts.map +1 -1
- package/dist/sidebar/tt-sidebar.js +196 -44
- package/dist/sidebar/tt-sidebar.js.map +1 -1
- package/dist/strings.d.ts +64 -0
- package/dist/strings.d.ts.map +1 -0
- package/dist/strings.js +68 -0
- package/dist/strings.js.map +1 -0
- package/dist/tokens.css +30 -6
- package/dist/tt-alert.d.ts.map +1 -1
- package/dist/tt-alert.js +5 -2
- package/dist/tt-alert.js.map +1 -1
- package/dist/tt-auth.d.ts +5 -1
- package/dist/tt-auth.d.ts.map +1 -1
- package/dist/tt-auth.js +72 -10
- package/dist/tt-auth.js.map +1 -1
- package/dist/tt-breadcrumbs.d.ts.map +1 -1
- package/dist/tt-breadcrumbs.js +6 -3
- package/dist/tt-breadcrumbs.js.map +1 -1
- package/dist/tt-button-group.d.ts.map +1 -1
- package/dist/tt-button-group.js +7 -1
- package/dist/tt-button-group.js.map +1 -1
- package/dist/tt-button.d.ts.map +1 -1
- package/dist/tt-button.js +37 -28
- package/dist/tt-button.js.map +1 -1
- package/dist/tt-card.d.ts.map +1 -1
- package/dist/tt-card.js +9 -6
- package/dist/tt-card.js.map +1 -1
- package/dist/tt-chart.d.ts +10 -2
- package/dist/tt-chart.d.ts.map +1 -1
- package/dist/tt-chart.js +167 -29
- package/dist/tt-chart.js.map +1 -1
- package/dist/tt-checkbox.d.ts.map +1 -1
- package/dist/tt-checkbox.js +5 -2
- package/dist/tt-checkbox.js.map +1 -1
- package/dist/tt-code-block.d.ts +4 -5
- package/dist/tt-code-block.d.ts.map +1 -1
- package/dist/tt-code-block.js +53 -17
- package/dist/tt-code-block.js.map +1 -1
- package/dist/tt-combobox.d.ts +14 -0
- package/dist/tt-combobox.d.ts.map +1 -1
- package/dist/tt-combobox.js +234 -31
- package/dist/tt-combobox.js.map +1 -1
- package/dist/tt-company-card.d.ts +18 -0
- package/dist/tt-company-card.d.ts.map +1 -1
- package/dist/tt-company-card.js +73 -4
- package/dist/tt-company-card.js.map +1 -1
- package/dist/tt-comparison-table.d.ts.map +1 -1
- package/dist/tt-comparison-table.js +6 -3
- package/dist/tt-comparison-table.js.map +1 -1
- package/dist/tt-component-doc.d.ts.map +1 -1
- package/dist/tt-component-doc.js +6 -3
- package/dist/tt-component-doc.js.map +1 -1
- package/dist/tt-contact-list.d.ts +17 -2
- package/dist/tt-contact-list.d.ts.map +1 -1
- package/dist/tt-contact-list.js +68 -10
- package/dist/tt-contact-list.js.map +1 -1
- package/dist/tt-copy-button.d.ts.map +1 -1
- package/dist/tt-copy-button.js +6 -3
- package/dist/tt-copy-button.js.map +1 -1
- package/dist/tt-data-table.d.ts +32 -1
- package/dist/tt-data-table.d.ts.map +1 -1
- package/dist/tt-data-table.js +302 -16
- package/dist/tt-data-table.js.map +1 -1
- package/dist/tt-dock-item.d.ts +53 -0
- package/dist/tt-dock-item.d.ts.map +1 -0
- package/dist/tt-dock-item.js +270 -0
- package/dist/tt-dock-item.js.map +1 -0
- package/dist/tt-dock.d.ts +59 -0
- package/dist/tt-dock.d.ts.map +1 -0
- package/dist/tt-dock.js +337 -0
- package/dist/tt-dock.js.map +1 -0
- package/dist/tt-drawer.d.ts +4 -0
- package/dist/tt-drawer.d.ts.map +1 -1
- package/dist/tt-drawer.js +14 -4
- package/dist/tt-drawer.js.map +1 -1
- package/dist/tt-dropdown-menu.d.ts +5 -0
- package/dist/tt-dropdown-menu.d.ts.map +1 -1
- package/dist/tt-dropdown-menu.js +34 -8
- package/dist/tt-dropdown-menu.js.map +1 -1
- package/dist/tt-file-upload.d.ts +35 -0
- package/dist/tt-file-upload.d.ts.map +1 -1
- package/dist/tt-file-upload.js +210 -21
- package/dist/tt-file-upload.js.map +1 -1
- package/dist/tt-filter.d.ts.map +1 -1
- package/dist/tt-filter.js +10 -5
- package/dist/tt-filter.js.map +1 -1
- package/dist/tt-form.d.ts +25 -1
- package/dist/tt-form.d.ts.map +1 -1
- package/dist/tt-form.js +151 -12
- package/dist/tt-form.js.map +1 -1
- package/dist/tt-grid.d.ts +10 -1
- package/dist/tt-grid.d.ts.map +1 -1
- package/dist/tt-grid.js +38 -9
- package/dist/tt-grid.js.map +1 -1
- package/dist/tt-icon.d.ts.map +1 -1
- package/dist/tt-icon.js +5 -0
- package/dist/tt-icon.js.map +1 -1
- package/dist/tt-inbox.d.ts +4 -0
- package/dist/tt-inbox.d.ts.map +1 -1
- package/dist/tt-inbox.js +13 -3
- package/dist/tt-inbox.js.map +1 -1
- package/dist/tt-input.d.ts.map +1 -1
- package/dist/tt-input.js +15 -5
- package/dist/tt-input.js.map +1 -1
- package/dist/tt-key-values.d.ts +2 -0
- package/dist/tt-key-values.d.ts.map +1 -1
- package/dist/tt-key-values.js +45 -2
- package/dist/tt-key-values.js.map +1 -1
- package/dist/tt-layout.d.ts +53 -2
- package/dist/tt-layout.d.ts.map +1 -1
- package/dist/tt-layout.js +233 -27
- package/dist/tt-layout.js.map +1 -1
- package/dist/tt-modal.d.ts +4 -0
- package/dist/tt-modal.d.ts.map +1 -1
- package/dist/tt-modal.js +14 -4
- package/dist/tt-modal.js.map +1 -1
- package/dist/tt-navbar.d.ts +4 -0
- package/dist/tt-navbar.d.ts.map +1 -1
- package/dist/tt-navbar.js +42 -7
- package/dist/tt-navbar.js.map +1 -1
- package/dist/tt-pagination.d.ts +4 -0
- package/dist/tt-pagination.d.ts.map +1 -1
- package/dist/tt-pagination.js +8 -1
- package/dist/tt-pagination.js.map +1 -1
- package/dist/tt-product.d.ts +67 -15
- package/dist/tt-product.d.ts.map +1 -1
- package/dist/tt-product.js +447 -366
- package/dist/tt-product.js.map +1 -1
- package/dist/tt-progress.d.ts +1 -0
- package/dist/tt-progress.d.ts.map +1 -1
- package/dist/tt-progress.js +26 -7
- package/dist/tt-progress.js.map +1 -1
- package/dist/tt-quantity.d.ts.map +1 -1
- package/dist/tt-quantity.js +5 -2
- package/dist/tt-quantity.js.map +1 -1
- package/dist/tt-radio-group.d.ts.map +1 -1
- package/dist/tt-radio-group.js +5 -2
- package/dist/tt-radio-group.js.map +1 -1
- package/dist/tt-scroller.d.ts +76 -0
- package/dist/tt-scroller.d.ts.map +1 -0
- package/dist/tt-scroller.js +525 -0
- package/dist/tt-scroller.js.map +1 -0
- package/dist/tt-search.d.ts.map +1 -1
- package/dist/tt-search.js +10 -5
- package/dist/tt-search.js.map +1 -1
- package/dist/tt-select.d.ts +9 -0
- package/dist/tt-select.d.ts.map +1 -1
- package/dist/tt-select.js +99 -14
- package/dist/tt-select.js.map +1 -1
- package/dist/tt-slider.d.ts.map +1 -1
- package/dist/tt-slider.js +13 -2
- package/dist/tt-slider.js.map +1 -1
- package/dist/tt-social-links.d.ts.map +1 -1
- package/dist/tt-social-links.js +7 -4
- package/dist/tt-social-links.js.map +1 -1
- package/dist/tt-switcher.d.ts +2 -0
- package/dist/tt-switcher.d.ts.map +1 -1
- package/dist/tt-switcher.js +24 -76
- package/dist/tt-switcher.js.map +1 -1
- package/dist/tt-table-row.d.ts.map +1 -1
- package/dist/tt-table-row.js +5 -2
- package/dist/tt-table-row.js.map +1 -1
- package/dist/tt-table.d.ts.map +1 -1
- package/dist/tt-table.js +5 -2
- package/dist/tt-table.js.map +1 -1
- package/dist/tt-tabs.d.ts.map +1 -1
- package/dist/tt-tabs.js +5 -2
- package/dist/tt-tabs.js.map +1 -1
- package/dist/tt-tag-list.d.ts.map +1 -1
- package/dist/tt-tag-list.js +6 -3
- package/dist/tt-tag-list.js.map +1 -1
- package/dist/tt-textarea.d.ts.map +1 -1
- package/dist/tt-textarea.js +5 -2
- package/dist/tt-textarea.js.map +1 -1
- package/dist/tt-toast.d.ts +4 -1
- package/dist/tt-toast.d.ts.map +1 -1
- package/dist/tt-toast.js +40 -6
- package/dist/tt-toast.js.map +1 -1
- package/dist/tt-toggle-group.d.ts.map +1 -1
- package/dist/tt-toggle-group.js +7 -1
- package/dist/tt-toggle-group.js.map +1 -1
- package/dist/tt-toggle.d.ts.map +1 -1
- package/dist/tt-toggle.js +14 -9
- package/dist/tt-toggle.js.map +1 -1
- package/package.json +1 -1
- package/vscode.html-custom-data.json +241 -66
|
@@ -0,0 +1,525 @@
|
|
|
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 { customElement, property, query, state } from "lit/decorators.js";
|
|
9
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
10
|
+
import "./tt-icon.js";
|
|
11
|
+
/*
|
|
12
|
+
What the browser can focus by itself, for "does the row hold anything
|
|
13
|
+
that Tab reaches?" (holdsFocusable, below).
|
|
14
|
+
*/
|
|
15
|
+
const FOCUSABLE = [
|
|
16
|
+
"a[href]",
|
|
17
|
+
"area[href]",
|
|
18
|
+
"button:not([disabled])",
|
|
19
|
+
"input:not([disabled]):not([type='hidden'])",
|
|
20
|
+
"select:not([disabled])",
|
|
21
|
+
"textarea:not([disabled])",
|
|
22
|
+
"summary",
|
|
23
|
+
"iframe",
|
|
24
|
+
"[contenteditable]:not([contenteditable='false'])",
|
|
25
|
+
"[tabindex]:not([tabindex='-1'])",
|
|
26
|
+
].join(", ");
|
|
27
|
+
/**
|
|
28
|
+
* Whether an element, or anything inside it, takes focus with Tab. Walks
|
|
29
|
+
* into open shadow roots too, because a tt-button's real <button> is in
|
|
30
|
+
* its shadow root, not among its children.
|
|
31
|
+
*/
|
|
32
|
+
function holdsFocusable(element) {
|
|
33
|
+
if (element.matches(FOCUSABLE))
|
|
34
|
+
return true;
|
|
35
|
+
const inside = element.shadowRoot ? [...element.shadowRoot.children] : [];
|
|
36
|
+
return [...inside, ...element.children].some(holdsFocusable);
|
|
37
|
+
}
|
|
38
|
+
/** A mouse press on an arrow does not move focus away from where it is. */
|
|
39
|
+
const keepFocus = (event) => event.preventDefault();
|
|
40
|
+
/**
|
|
41
|
+
* A row of children side by side that scrolls sideways when they do not
|
|
42
|
+
* fit, with no scrollbar.
|
|
43
|
+
*
|
|
44
|
+
* With the bar gone, two things say there is more: the edge that has
|
|
45
|
+
* more to scroll fades out, by as much as is hidden there up to the fade
|
|
46
|
+
* width, so the fade grows in as you scroll rather than snapping on; and,
|
|
47
|
+
* with `controls`, an arrow button on each side that has more.
|
|
48
|
+
*
|
|
49
|
+
* The arrows only appear where a pointer can hover. A finger swipes the
|
|
50
|
+
* row natively, which is what people do on a phone, and two 44px circles
|
|
51
|
+
* would cover a third of a phone's row. A mouse with a plain wheel has no
|
|
52
|
+
* sideways scroll at all, which is who the arrows are for.
|
|
53
|
+
*
|
|
54
|
+
* LEFT AND RIGHT ARE PHYSICAL ON PURPOSE. Everything about the layout
|
|
55
|
+
* follows the writing direction (the row starts on the right in a
|
|
56
|
+
* right-to-left page), but an arrow points at a side of the screen, and
|
|
57
|
+
* "Scroll left" names that side, so the fades and arrows are measured
|
|
58
|
+
* physically and stay right in both directions.
|
|
59
|
+
*/
|
|
60
|
+
let TTScroller = class TTScroller extends LitElement {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
/** Names the row for a screen reader. Given a label, the row is a named group. */
|
|
64
|
+
this.label = "";
|
|
65
|
+
/*
|
|
66
|
+
Reflected, like tt-stack's: these are :host([attr]) rules, and a
|
|
67
|
+
selector matches an attribute, never a property.
|
|
68
|
+
*/
|
|
69
|
+
this.gap = "medium";
|
|
70
|
+
/** Lands on a whole child after a swipe or an arrow: its start or its centre. */
|
|
71
|
+
this.snap = "none";
|
|
72
|
+
/** Arrow buttons on the sides that have more, for a mouse. */
|
|
73
|
+
this.controls = false;
|
|
74
|
+
/**
|
|
75
|
+
* Every child's width, as a CSS length ("240px", "80%"). Empty: each
|
|
76
|
+
* child keeps its own width, which is right for chips but makes a card
|
|
77
|
+
* as wide as its longest line.
|
|
78
|
+
*/
|
|
79
|
+
this.itemWidth = "";
|
|
80
|
+
/** How much of the row is out of sight past each physical edge, in pixels. */
|
|
81
|
+
this.hiddenLeft = 0;
|
|
82
|
+
this.hiddenRight = 0;
|
|
83
|
+
/** Whether anything inside takes focus with Tab (a button, a link). */
|
|
84
|
+
this.holdsFocus = false;
|
|
85
|
+
// A child that changes size (a font loading, its text edited) can make
|
|
86
|
+
// the row start or stop overflowing without the row itself resizing,
|
|
87
|
+
// so the children are observed as well as the row.
|
|
88
|
+
this.resize = new ResizeObserver(() => this.measure(true));
|
|
89
|
+
this.focusTimer = 0;
|
|
90
|
+
// Scroll events already come at most once a frame.
|
|
91
|
+
this.onScroll = () => this.measure();
|
|
92
|
+
this.onSlotChange = () => {
|
|
93
|
+
this.observe();
|
|
94
|
+
};
|
|
95
|
+
/*
|
|
96
|
+
Tab onto a child near an edge: the browser scrolls it into view, but
|
|
97
|
+
only just, or not at all, so it can land under a fade or an arrow.
|
|
98
|
+
The browser scrolls after the focus events, so this runs a task
|
|
99
|
+
later and has the last word: the child moves fully clear.
|
|
100
|
+
*/
|
|
101
|
+
this.onFocusIn = (event) => {
|
|
102
|
+
const items = this.items();
|
|
103
|
+
const item = event
|
|
104
|
+
.composedPath()
|
|
105
|
+
.find((node) => node instanceof Element && items.includes(node));
|
|
106
|
+
if (!item)
|
|
107
|
+
return;
|
|
108
|
+
clearTimeout(this.focusTimer);
|
|
109
|
+
this.focusTimer = window.setTimeout(() => this.bringIntoView(item));
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
connectedCallback() {
|
|
113
|
+
super.connectedCallback();
|
|
114
|
+
// Moved in the page: observing stopped when it was taken out.
|
|
115
|
+
if (this.hasUpdated)
|
|
116
|
+
this.observe();
|
|
117
|
+
}
|
|
118
|
+
disconnectedCallback() {
|
|
119
|
+
super.disconnectedCallback();
|
|
120
|
+
this.resize.disconnect();
|
|
121
|
+
clearTimeout(this.focusTimer);
|
|
122
|
+
}
|
|
123
|
+
firstUpdated() {
|
|
124
|
+
this.observe();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Scrolls the row, and only the row, until `item` is fully in sight,
|
|
128
|
+
* clear of the fades and arrows. An item wider than the row shows its
|
|
129
|
+
* start. Unlike `scrollIntoView()`, the page itself never moves.
|
|
130
|
+
*/
|
|
131
|
+
async scrollToItem(item, behavior = "auto") {
|
|
132
|
+
await this.updateComplete;
|
|
133
|
+
await this.childrenRendered();
|
|
134
|
+
this.bringIntoView(item, behavior);
|
|
135
|
+
}
|
|
136
|
+
/*
|
|
137
|
+
The row's items: its children, or, when another component puts its
|
|
138
|
+
own <slot> in here (tt-dock does), what that slot passes on. Read
|
|
139
|
+
flattened, because a slot element is display: contents and has no
|
|
140
|
+
box to measure or scroll to.
|
|
141
|
+
*/
|
|
142
|
+
items() {
|
|
143
|
+
return this.slotEl?.assignedElements({ flatten: true }) ?? [...this.children];
|
|
144
|
+
}
|
|
145
|
+
/*
|
|
146
|
+
A tt-* child has no size until its own first render, which comes
|
|
147
|
+
after the row's, so the first measure is taken again once they have
|
|
148
|
+
rendered. Awaited rather than left to the ResizeObserver: a page in a
|
|
149
|
+
background tab gets no observer callbacks and no animation frames,
|
|
150
|
+
and the row would show no arrows until it was visible.
|
|
151
|
+
*/
|
|
152
|
+
async childrenRendered() {
|
|
153
|
+
await Promise.all(this.items().map((child) => child.updateComplete));
|
|
154
|
+
}
|
|
155
|
+
async observe() {
|
|
156
|
+
const viewport = this.viewport;
|
|
157
|
+
if (!viewport)
|
|
158
|
+
return;
|
|
159
|
+
this.resize.disconnect();
|
|
160
|
+
this.resize.observe(viewport);
|
|
161
|
+
for (const child of this.items())
|
|
162
|
+
this.resize.observe(child);
|
|
163
|
+
// After the update that called this, so the measure starts a new one.
|
|
164
|
+
await this.updateComplete;
|
|
165
|
+
this.measure(true);
|
|
166
|
+
await this.childrenRendered();
|
|
167
|
+
this.measure(true);
|
|
168
|
+
}
|
|
169
|
+
/** What is hidden past each edge, and, when `children` changed, what inside takes focus. */
|
|
170
|
+
measure(children = false) {
|
|
171
|
+
const viewport = this.viewport;
|
|
172
|
+
if (!viewport)
|
|
173
|
+
return;
|
|
174
|
+
const max = viewport.scrollWidth - viewport.clientWidth;
|
|
175
|
+
// Right to left, scrollLeft is 0 at the start and goes negative.
|
|
176
|
+
const rtl = getComputedStyle(viewport).direction === "rtl";
|
|
177
|
+
const fromLeft = rtl ? viewport.scrollLeft + max : viewport.scrollLeft;
|
|
178
|
+
// A pixel of slack: zoom and fractional layout leave sub-pixel scroll.
|
|
179
|
+
const left = max > 1 && fromLeft > 1 ? Math.round(fromLeft) : 0;
|
|
180
|
+
const right = max > 1 && max - fromLeft > 1 ? Math.round(max - fromLeft) : 0;
|
|
181
|
+
if (left !== this.hiddenLeft)
|
|
182
|
+
this.hiddenLeft = left;
|
|
183
|
+
if (right !== this.hiddenRight)
|
|
184
|
+
this.hiddenRight = right;
|
|
185
|
+
if (children) {
|
|
186
|
+
const holds = this.items().some(holdsFocusable);
|
|
187
|
+
if (holds !== this.holdsFocus)
|
|
188
|
+
this.holdsFocus = holds;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
bringIntoView(target, behavior = "auto") {
|
|
192
|
+
const viewport = this.viewport;
|
|
193
|
+
// The child of the row that holds it: the whole card, not its button.
|
|
194
|
+
const items = this.items();
|
|
195
|
+
let item = target;
|
|
196
|
+
while (item && !items.includes(item))
|
|
197
|
+
item = item.parentElement;
|
|
198
|
+
if (!viewport || !item)
|
|
199
|
+
return;
|
|
200
|
+
const view = viewport.getBoundingClientRect();
|
|
201
|
+
const box = item.getBoundingClientRect();
|
|
202
|
+
const style = getComputedStyle(viewport);
|
|
203
|
+
// The fade, or the arrow when there is one: the scroll padding.
|
|
204
|
+
const inset = parseFloat(style.scrollPaddingLeft) || 0;
|
|
205
|
+
const start = view.left + inset;
|
|
206
|
+
const end = view.right - inset;
|
|
207
|
+
const rtl = style.direction === "rtl";
|
|
208
|
+
// Where it begins: its right edge in a right-to-left row.
|
|
209
|
+
const toStart = rtl ? box.right - end : box.left - start;
|
|
210
|
+
let delta = 0;
|
|
211
|
+
if (box.width > end - start) {
|
|
212
|
+
// Too wide to fit: show where it begins.
|
|
213
|
+
delta = toStart;
|
|
214
|
+
}
|
|
215
|
+
else if (box.left < start || box.right > end) {
|
|
216
|
+
/*
|
|
217
|
+
With snapping on, the row has to come to rest on a snap position,
|
|
218
|
+
and one that cuts this child off would undo the scroll. So it goes
|
|
219
|
+
to its OWN snap position, which always shows it whole. Without
|
|
220
|
+
snapping, it moves only as far as it must.
|
|
221
|
+
*/
|
|
222
|
+
if (this.snap === "start")
|
|
223
|
+
delta = toStart;
|
|
224
|
+
else if (this.snap === "center")
|
|
225
|
+
delta = box.left + box.width / 2 - (view.left + view.width / 2);
|
|
226
|
+
else
|
|
227
|
+
delta = box.left < start ? box.left - start : box.right - end;
|
|
228
|
+
}
|
|
229
|
+
// scrollBy clamps at both ends, so the first item still sits flush.
|
|
230
|
+
if (Math.abs(delta) >= 1)
|
|
231
|
+
viewport.scrollBy({ left: delta, behavior });
|
|
232
|
+
}
|
|
233
|
+
/** About one row's width, less the edges, so the cut-off child comes fully into sight. */
|
|
234
|
+
page(direction) {
|
|
235
|
+
const viewport = this.viewport;
|
|
236
|
+
if (!viewport)
|
|
237
|
+
return;
|
|
238
|
+
const inset = parseFloat(getComputedStyle(viewport).scrollPaddingLeft) || 0;
|
|
239
|
+
const step = Math.max(viewport.clientWidth - 2 * inset, viewport.clientWidth / 2);
|
|
240
|
+
viewport.scrollBy({ left: direction * step });
|
|
241
|
+
}
|
|
242
|
+
static { this.styles = css `
|
|
243
|
+
:host {
|
|
244
|
+
display: block;
|
|
245
|
+
/* Usually a flex or grid item, which refuses to shrink below its
|
|
246
|
+
content without this, and then nothing would ever overflow. */
|
|
247
|
+
min-width: 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* The browser's own [hidden] rule loses to any :host display. */
|
|
251
|
+
:host([hidden]) {
|
|
252
|
+
display: none !important;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.frame {
|
|
256
|
+
/* The arrows' size. The fade reads it too, so it lives on both
|
|
257
|
+
their parent. */
|
|
258
|
+
--_control: var(--tt-control-sm);
|
|
259
|
+
|
|
260
|
+
/* Its own formatting context, so the row's negative margins stay
|
|
261
|
+
inside it instead of collapsing out through the host. */
|
|
262
|
+
display: flow-root;
|
|
263
|
+
position: relative;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.viewport {
|
|
267
|
+
/* How far a fade reaches, and how far a child is kept from an edge. */
|
|
268
|
+
--_fade: var(--tt-space-8);
|
|
269
|
+
/* Room for a child's focus ring above and below. */
|
|
270
|
+
--_ring: calc(var(--tt-ring-width) + var(--tt-ring-offset));
|
|
271
|
+
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: stretch;
|
|
274
|
+
gap: var(--tt-space-4);
|
|
275
|
+
|
|
276
|
+
overflow-x: auto;
|
|
277
|
+
overflow-y: hidden;
|
|
278
|
+
|
|
279
|
+
/* overflow clips everything outside the box, focus rings included,
|
|
280
|
+
so the box is a ring taller on each side, and the negative margin
|
|
281
|
+
gives the room back: the row is exactly as tall as its children. */
|
|
282
|
+
padding-block: var(--_ring);
|
|
283
|
+
margin-block: calc(var(--_ring) * -1);
|
|
284
|
+
|
|
285
|
+
/* No bar, in every engine. Firefox and current Chromium read the
|
|
286
|
+
property; Safari still needs the pseudo-element below. */
|
|
287
|
+
scrollbar-width: none;
|
|
288
|
+
|
|
289
|
+
scroll-behavior: smooth;
|
|
290
|
+
scroll-padding-inline: var(--_fade);
|
|
291
|
+
/* A sideways swipe at the end stays in the row, instead of going
|
|
292
|
+
back a page in the browser's history. */
|
|
293
|
+
overscroll-behavior-x: contain;
|
|
294
|
+
outline: none;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.viewport::-webkit-scrollbar {
|
|
298
|
+
display: none;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* The mask would cut the ring off the row itself, so the frame,
|
|
302
|
+
which is not masked, draws it. */
|
|
303
|
+
.frame:has(> .viewport:focus-visible) {
|
|
304
|
+
border-radius: var(--tt-radius-md);
|
|
305
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
306
|
+
outline-offset: var(--tt-ring-offset);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
:host([gap="none"]) .viewport {
|
|
310
|
+
gap: 0;
|
|
311
|
+
}
|
|
312
|
+
:host([gap="small"]) .viewport {
|
|
313
|
+
gap: var(--tt-space-2);
|
|
314
|
+
}
|
|
315
|
+
:host([gap="large"]) .viewport {
|
|
316
|
+
gap: var(--tt-space-6);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/*
|
|
320
|
+
Children keep their own width, or the item width, and never shrink:
|
|
321
|
+
a flex item shrinks by default, and a row that squashes to fit never
|
|
322
|
+
overflows. Three longhands rather than flex, so an item width that
|
|
323
|
+
is not a length falls back to auto and the row still scrolls.
|
|
324
|
+
*/
|
|
325
|
+
::slotted(*) {
|
|
326
|
+
flex-grow: 0;
|
|
327
|
+
flex-shrink: 0;
|
|
328
|
+
flex-basis: var(--_item-width, auto);
|
|
329
|
+
min-width: 0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
:host([snap="start"]) .viewport,
|
|
333
|
+
:host([snap="center"]) .viewport {
|
|
334
|
+
scroll-snap-type: x mandatory;
|
|
335
|
+
}
|
|
336
|
+
:host([snap="start"]) ::slotted(*) {
|
|
337
|
+
scroll-snap-align: start;
|
|
338
|
+
}
|
|
339
|
+
:host([snap="center"]) ::slotted(*) {
|
|
340
|
+
scroll-snap-align: center;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Smooth scrolling is its own property, which the duration tokens in
|
|
344
|
+
tokens.css cannot reach. */
|
|
345
|
+
@media (prefers-reduced-motion: reduce) {
|
|
346
|
+
.viewport {
|
|
347
|
+
scroll-behavior: auto;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.control {
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: 50%;
|
|
354
|
+
transform: translateY(-50%);
|
|
355
|
+
|
|
356
|
+
display: none;
|
|
357
|
+
place-items: center;
|
|
358
|
+
width: var(--_control);
|
|
359
|
+
height: var(--_control);
|
|
360
|
+
padding: 0;
|
|
361
|
+
|
|
362
|
+
border: 1px solid var(--tt-border);
|
|
363
|
+
border-radius: var(--tt-radius-full);
|
|
364
|
+
background: var(--tt-card);
|
|
365
|
+
color: var(--tt-foreground);
|
|
366
|
+
box-shadow: var(--tt-elevation-1);
|
|
367
|
+
cursor: pointer;
|
|
368
|
+
|
|
369
|
+
--tt-icon-size: 16px;
|
|
370
|
+
|
|
371
|
+
transition:
|
|
372
|
+
background var(--tt-duration-fast) var(--tt-ease-out),
|
|
373
|
+
color var(--tt-duration-fast) var(--tt-ease-out);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.control.left {
|
|
377
|
+
left: 0;
|
|
378
|
+
}
|
|
379
|
+
.control.right {
|
|
380
|
+
right: 0;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.control:focus-visible {
|
|
384
|
+
outline: var(--tt-ring-width) solid var(--tt-ring);
|
|
385
|
+
outline-offset: var(--tt-ring-offset);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* Only with a pointer that hovers: see the class comment. */
|
|
389
|
+
@media (hover: hover) {
|
|
390
|
+
.control:not([hidden]) {
|
|
391
|
+
display: grid;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* With arrows, the fade reaches past them, and a child is kept
|
|
395
|
+
clear of them, not only of the fade. */
|
|
396
|
+
:host([controls]) .viewport {
|
|
397
|
+
--_fade: calc(var(--_control) + var(--tt-space-2));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.control:hover {
|
|
401
|
+
background: var(--tt-accent);
|
|
402
|
+
color: var(--tt-accent-foreground);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* A touchscreen laptop: the pointer hovers, but a finger may press. */
|
|
407
|
+
@media (any-pointer: coarse) {
|
|
408
|
+
.frame {
|
|
409
|
+
--_control: max(var(--tt-control-md), 2.75rem);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
`; }
|
|
413
|
+
render() {
|
|
414
|
+
const overflows = this.hiddenLeft > 0 || this.hiddenRight > 0;
|
|
415
|
+
/*
|
|
416
|
+
Each side fades by as much as is hidden past it, up to --_fade, so a
|
|
417
|
+
row at rest has no fade at its start and the fade grows in as it
|
|
418
|
+
scrolls. A mask reads only the alpha of its colour, so the black is
|
|
419
|
+
never seen: transparent lets the surface behind show through, on
|
|
420
|
+
any surface and in either theme. Written here rather than as custom
|
|
421
|
+
properties in the styles: those inherit, so every child would
|
|
422
|
+
restyle on every frame of a scroll, and mask-image does not.
|
|
423
|
+
*/
|
|
424
|
+
const fade = (hidden) => `min(var(--_fade), ${hidden}px)`;
|
|
425
|
+
const mask = overflows
|
|
426
|
+
? `linear-gradient(to right, transparent, #000 ${fade(this.hiddenLeft)}, #000 calc(100% - ${fade(this.hiddenRight)}), transparent)`
|
|
427
|
+
: undefined;
|
|
428
|
+
return html `
|
|
429
|
+
<div class="frame">
|
|
430
|
+
<div
|
|
431
|
+
class="viewport"
|
|
432
|
+
part="viewport"
|
|
433
|
+
role=${this.label ? "group" : nothing}
|
|
434
|
+
aria-label=${this.label || nothing}
|
|
435
|
+
tabindex=${
|
|
436
|
+
/*
|
|
437
|
+
A row that scrolls must be reachable by keyboard. When
|
|
438
|
+
something inside takes focus, Tab already reaches it all
|
|
439
|
+
(each focused child is scrolled into view), so the row stays
|
|
440
|
+
out of the Tab order, as Chrome decides for any scroller;
|
|
441
|
+
-1 also stops Firefox adding a stop of its own. With nothing
|
|
442
|
+
focusable inside, the row is the stop, and the arrow keys
|
|
443
|
+
scroll it.
|
|
444
|
+
*/
|
|
445
|
+
overflows ? (this.holdsFocus ? "-1" : "0") : nothing}
|
|
446
|
+
style=${styleMap({
|
|
447
|
+
"mask-image": mask,
|
|
448
|
+
"--_item-width": this.itemWidth || undefined,
|
|
449
|
+
})}
|
|
450
|
+
@scroll=${this.onScroll}
|
|
451
|
+
@focusin=${this.onFocusIn}
|
|
452
|
+
>
|
|
453
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
454
|
+
</div>
|
|
455
|
+
|
|
456
|
+
${this.controls
|
|
457
|
+
? html `
|
|
458
|
+
<!-- Out of the Tab order: Tab and the arrow keys already
|
|
459
|
+
scroll the row, so these are for a mouse. A screen
|
|
460
|
+
reader still finds them by name. -->
|
|
461
|
+
<button
|
|
462
|
+
type="button"
|
|
463
|
+
class="control left"
|
|
464
|
+
part="control control-left"
|
|
465
|
+
tabindex="-1"
|
|
466
|
+
aria-label="Scroll left"
|
|
467
|
+
?hidden=${this.hiddenLeft === 0}
|
|
468
|
+
@mousedown=${keepFocus}
|
|
469
|
+
@click=${() => this.page(-1)}
|
|
470
|
+
>
|
|
471
|
+
<tt-icon name="chevron-left"></tt-icon>
|
|
472
|
+
</button>
|
|
473
|
+
<button
|
|
474
|
+
type="button"
|
|
475
|
+
class="control right"
|
|
476
|
+
part="control control-right"
|
|
477
|
+
tabindex="-1"
|
|
478
|
+
aria-label="Scroll right"
|
|
479
|
+
?hidden=${this.hiddenRight === 0}
|
|
480
|
+
@mousedown=${keepFocus}
|
|
481
|
+
@click=${() => this.page(1)}
|
|
482
|
+
>
|
|
483
|
+
<tt-icon name="chevron-right"></tt-icon>
|
|
484
|
+
</button>
|
|
485
|
+
`
|
|
486
|
+
: nothing}
|
|
487
|
+
</div>
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
__decorate([
|
|
492
|
+
property({ type: String })
|
|
493
|
+
], TTScroller.prototype, "label", void 0);
|
|
494
|
+
__decorate([
|
|
495
|
+
property({ type: String, reflect: true })
|
|
496
|
+
], TTScroller.prototype, "gap", void 0);
|
|
497
|
+
__decorate([
|
|
498
|
+
property({ type: String, reflect: true })
|
|
499
|
+
], TTScroller.prototype, "snap", void 0);
|
|
500
|
+
__decorate([
|
|
501
|
+
property({ type: Boolean, reflect: true })
|
|
502
|
+
], TTScroller.prototype, "controls", void 0);
|
|
503
|
+
__decorate([
|
|
504
|
+
property({ type: String, attribute: "item-width" })
|
|
505
|
+
], TTScroller.prototype, "itemWidth", void 0);
|
|
506
|
+
__decorate([
|
|
507
|
+
state()
|
|
508
|
+
], TTScroller.prototype, "hiddenLeft", void 0);
|
|
509
|
+
__decorate([
|
|
510
|
+
state()
|
|
511
|
+
], TTScroller.prototype, "hiddenRight", void 0);
|
|
512
|
+
__decorate([
|
|
513
|
+
state()
|
|
514
|
+
], TTScroller.prototype, "holdsFocus", void 0);
|
|
515
|
+
__decorate([
|
|
516
|
+
query(".viewport")
|
|
517
|
+
], TTScroller.prototype, "viewport", void 0);
|
|
518
|
+
__decorate([
|
|
519
|
+
query("slot")
|
|
520
|
+
], TTScroller.prototype, "slotEl", void 0);
|
|
521
|
+
TTScroller = __decorate([
|
|
522
|
+
customElement("tt-scroller")
|
|
523
|
+
], TTScroller);
|
|
524
|
+
export { TTScroller };
|
|
525
|
+
//# sourceMappingURL=tt-scroller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tt-scroller.js","sourceRoot":"","sources":["../src/tt-scroller.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,cAAc,CAAC;AAKtB;;;EAGE;AACF,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,YAAY;IACZ,wBAAwB;IACxB,4CAA4C;IAC5C,wBAAwB;IACxB,0BAA0B;IAC1B,SAAS;IACT,QAAQ;IACR,kDAAkD;IAClD,iCAAiC;CAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAgB;IACtC,IAAI,OAAO,CAA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EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CAAgB;AAGnD;IAAhB,KAAK,EAAE;8CAAwB;AACf;IAAhB,KAAK,EAAE;+CAAyB;AAGhB;IAAhB,KAAK,EAAE;8CAA4B;AAER;IAA3B,KAAK,CAAC,WAAW,CAAC;4CAAgC;AAC5B;IAAtB,KAAK,CAAC,MAAM,CAAC;0CAAkC;AA/BrC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA+btB"}
|
package/dist/tt-search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tt-search.d.ts","sourceRoot":"","sources":["../src/tt-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AACH,qBACa,QAAS,SAAQ,UAAU;IACV,WAAW,SAAY;IAEvB,KAAK,SAAM;IAEK,QAAQ,UAAS;IAKlB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CACnE;IAIkC,WAAW,UAAS;IAEpC,QAAQ,SAAO;IAEU,SAAS,SAAK;IAE1D,OAAO,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,aAAa,CAAC,CAAgC;IAEtD,oBAAoB;IAKpB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,UAAU;IAMlB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"tt-search.d.ts","sourceRoot":"","sources":["../src/tt-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AACH,qBACa,QAAS,SAAQ,UAAU;IACV,WAAW,SAAY;IAEvB,KAAK,SAAM;IAEK,QAAQ,UAAS;IAKlB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CACnE;IAIkC,WAAW,UAAS;IAEpC,QAAQ,SAAO;IAEU,SAAS,SAAK;IAE1D,OAAO,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,aAAa,CAAC,CAAgC;IAEtD,oBAAoB;IAKpB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,UAAU;IAMlB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,MAAM,CAAC,MAAM,0BA+JX;IAEF,OAAO,CAAC,WAAW;IAqCnB,MAAM;CA0BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
package/dist/tt-search.js
CHANGED
|
@@ -174,9 +174,12 @@ let TTSearch = class TTSearch extends LitElement {
|
|
|
174
174
|
user-select: none;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
/* Only where a pointer can hover: a tap would leave this on. */
|
|
178
|
+
@media (hover: hover) {
|
|
179
|
+
.clear:hover {
|
|
180
|
+
background: var(--tt-accent);
|
|
181
|
+
color: var(--tt-foreground);
|
|
182
|
+
}
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
.clear:focus-visible {
|
|
@@ -212,8 +215,10 @@ let TTSearch = class TTSearch extends LitElement {
|
|
|
212
215
|
user-select: none;
|
|
213
216
|
}
|
|
214
217
|
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
@media (hover: hover) {
|
|
219
|
+
.toggle:hover {
|
|
220
|
+
background: var(--tt-accent);
|
|
221
|
+
}
|
|
217
222
|
}
|
|
218
223
|
|
|
219
224
|
.toggle:focus-visible {
|
package/dist/tt-search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tt-search.js","sourceRoot":"","sources":["../src/tt-search.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACuB,gBAAW,GAAG,QAAQ,CAAC;QAEvB,UAAK,GAAG,EAAE,CAAC;QAEK,aAAQ,GAAG,KAAK,CAAC;QAE7D,iEAAiE;QACjE,wEAAwE;QACxE,mEAAmE;QACxB,SAAI,GAC7C,OAAO,CAAC;QAEV,sEAAsE;QACtE,sBAAsB;QACsB,gBAAW,GAAG,KAAK,CAAC;QAEpC,aAAQ,GAAG,GAAG,CAAC;QAEU,cAAS,GAAG,CAAC,CAAC;QAElD,aAAQ,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"tt-search.js","sourceRoot":"","sources":["../src/tt-search.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;GAcG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAA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ACJ,CAAC;;AAhV2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAY;AAEK;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAKlB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAChC;AAIkC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAqB;AAEpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAgB;AAEU;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;2CAAe;AAElD;IAAhB,KAAK,EAAE;0CAA0B;AArBvB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkVpB"}
|
package/dist/tt-select.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { PropertyValues } from "lit";
|
|
3
3
|
import "./tt-icon.js";
|
|
4
|
+
import type { TTStrings } from "./strings.js";
|
|
4
5
|
export type SelectSize = "small" | "medium" | "large";
|
|
5
6
|
export interface SelectOption {
|
|
6
7
|
value: string;
|
|
@@ -12,6 +13,12 @@ export declare class TTSelect extends LitElement {
|
|
|
12
13
|
private internals;
|
|
13
14
|
name: string;
|
|
14
15
|
value: string;
|
|
16
|
+
multiple: boolean;
|
|
17
|
+
/** The chosen values while `multiple` is on, in the options' order. */
|
|
18
|
+
values: string[];
|
|
19
|
+
/** This component's own text, over setStrings() (see strings.ts). */
|
|
20
|
+
strings: Partial<TTStrings>;
|
|
21
|
+
private text;
|
|
15
22
|
placeholder: string;
|
|
16
23
|
options: SelectOption[];
|
|
17
24
|
label: string;
|
|
@@ -38,6 +45,8 @@ export declare class TTSelect extends LitElement {
|
|
|
38
45
|
updated(changed: PropertyValues): void;
|
|
39
46
|
private syncFormState;
|
|
40
47
|
private get selectedOption();
|
|
48
|
+
private isChosen;
|
|
49
|
+
private get triggerText();
|
|
41
50
|
private openList;
|
|
42
51
|
private closeList;
|
|
43
52
|
private removeGlobalListeners;
|
package/dist/tt-select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tt-select.d.ts","sourceRoot":"","sources":["../src/tt-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1C,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tt-select.d.ts","sourceRoot":"","sources":["../src/tt-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1C,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBACa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,SAAS,CAA0B;IAYA,IAAI,SAAM;IACzB,KAAK,SAAM;IAOK,QAAQ,UAAS;IAE7D,uEAAuE;IAC5C,MAAM,EAAE,MAAM,EAAE,CAAM;IAEjD,qEAAqE;IACrC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