@latty-ds/web 0.10.4 → 1.0.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/custom-elements.json +1969 -228
- package/dist/components/accordion/index.js +36 -2
- package/dist/components/alert/alert.d.ts +29 -6
- package/dist/components/alert/alert.types.d.ts +5 -0
- package/dist/components/alert/index.js +124 -17
- package/dist/components/avatar/avatar.d.ts +2 -0
- package/dist/components/avatar/index.js +10 -3
- package/dist/components/breadcrumb/breadcrumb.d.ts +4 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +5 -0
- package/dist/components/breadcrumb/index.js +20 -3
- package/dist/components/button/button.d.ts +33 -0
- package/dist/components/button/index.js +135 -12
- package/dist/components/calendar/calendar.d.ts +15 -7
- package/dist/components/calendar/calendar.types.d.ts +17 -1
- package/dist/components/calendar/index.js +78 -25
- package/dist/components/checkbox/checkbox.d.ts +14 -2
- package/dist/components/checkbox/checkbox.types.d.ts +5 -0
- package/dist/components/checkbox/index.js +82 -5
- package/dist/components/chip/chip.d.ts +4 -1
- package/dist/components/chip/chip.types.d.ts +5 -0
- package/dist/components/chip/index.js +29 -1
- package/dist/components/color-input/color-input.d.ts +11 -2
- package/dist/components/color-input/color-input.types.d.ts +5 -0
- package/dist/components/color-input/index.js +92 -8
- package/dist/components/combobox/combobox.d.ts +18 -2
- package/dist/components/combobox/combobox.types.d.ts +7 -0
- package/dist/components/combobox/index.js +164 -23
- package/dist/components/date-input/date-input.d.ts +22 -7
- package/dist/components/date-input/date-input.types.d.ts +7 -0
- package/dist/components/date-input/index.js +216 -53
- package/dist/components/datepicker/datepicker.d.ts +9 -1
- package/dist/components/datepicker/index.js +108 -15
- package/dist/components/dialog/dialog.d.ts +39 -19
- package/dist/components/dialog/dialog.types.d.ts +5 -0
- package/dist/components/dialog/index.js +237 -90
- package/dist/components/divider/index.js +2 -2
- package/dist/components/dropdown/dropdown.d.ts +4 -0
- package/dist/components/dropdown/index.js +43 -3
- package/dist/components/icon-button/icon-button.d.ts +4 -0
- package/dist/components/icon-button/index.js +36 -1
- package/dist/components/image/image.d.ts +7 -7
- package/dist/components/image/index.js +6 -11
- package/dist/components/list/index.js +14 -4
- package/dist/components/nav/index.js +37 -17
- package/dist/components/nav/nav-item.d.ts +8 -8
- package/dist/components/pagination/index.js +57 -16
- package/dist/components/pagination/pagination.d.ts +8 -1
- package/dist/components/pagination/pagination.types.d.ts +15 -0
- package/dist/components/progress/index.js +44 -6
- package/dist/components/progress/progress.d.ts +12 -0
- package/dist/components/radio/index.js +148 -9
- package/dist/components/radio/radio.d.ts +34 -2
- package/dist/components/radio/radio.types.d.ts +5 -0
- package/dist/components/radio-group/index.js +120 -29
- package/dist/components/radio-group/radio-group.d.ts +27 -2
- package/dist/components/select/index.js +197 -44
- package/dist/components/select/select.d.ts +38 -4
- package/dist/components/select/select.types.d.ts +5 -0
- package/dist/components/shared/aria-forwarding.d.ts +1 -1
- package/dist/components/shared/form-default.d.ts +30 -0
- package/dist/components/shared/form-disabled.d.ts +40 -0
- package/dist/components/shared/form-field.d.ts +7 -0
- package/dist/components/shared/form-validity.d.ts +17 -0
- package/dist/components/shared/roving.d.ts +11 -0
- package/dist/components/shared/scroll-lock.d.ts +2 -0
- package/dist/components/sidepanel/index.js +275 -72
- package/dist/components/sidepanel/sidepanel.d.ts +32 -10
- package/dist/components/sidepanel/sidepanel.types.d.ts +10 -1
- package/dist/components/skeleton/index.js +3 -8
- package/dist/components/slider/index.js +307 -75
- package/dist/components/slider/slider.d.ts +16 -3
- package/dist/components/snackbar/index.js +82 -9
- package/dist/components/snackbar/snackbar.d.ts +17 -1
- package/dist/components/snackbar/snackbar.types.d.ts +5 -0
- package/dist/components/surface/index.js +8 -0
- package/dist/components/switch/index.js +101 -5
- package/dist/components/switch/switch.d.ts +13 -2
- package/dist/components/switch/switch.types.d.ts +5 -0
- package/dist/components/tab/index.js +15 -14
- package/dist/components/tab/tab.d.ts +0 -1
- package/dist/components/tab-group/index.js +102 -30
- package/dist/components/tab-group/tab-group.d.ts +17 -2
- package/dist/components/table/index.js +105 -61
- package/dist/components/table/table.d.ts +8 -2
- package/dist/components/table/table.types.d.ts +4 -3
- package/dist/components/text/index.js +16 -1
- package/dist/components/text/text.d.ts +1 -1
- package/dist/components/textfield/index.js +243 -35
- package/dist/components/textfield/textfield.d.ts +24 -2
- package/dist/components/textfield/textfield.types.d.ts +11 -0
- package/dist/components/tooltip/index.js +176 -49
- package/dist/components/tooltip/tooltip.d.ts +17 -0
- package/dist/components/tooltip/tooltip.types.d.ts +5 -1
- package/dist/index.cjs +2458 -683
- package/dist/index.js +2469 -690
- package/dist/manifest.json +202 -32
- package/dist/utils/dev-warn.d.ts +5 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +3 -7
|
@@ -9,6 +9,10 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
9
9
|
return result;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/components/shared/form-field.ts
|
|
13
|
+
var fieldCount = 0;
|
|
14
|
+
var createFieldIds = () => ({ helper: `lt-field-${fieldCount++}-helper` });
|
|
15
|
+
|
|
12
16
|
// src/components/combobox/combobox.ts
|
|
13
17
|
import { html as html2, nothing } from "lit";
|
|
14
18
|
|
|
@@ -1447,8 +1451,8 @@ var comboboxStyles = [
|
|
|
1447
1451
|
}
|
|
1448
1452
|
|
|
1449
1453
|
.required-indicator {
|
|
1450
|
-
color: var(--lt-
|
|
1451
|
-
margin-
|
|
1454
|
+
color: var(--lt-text-error);
|
|
1455
|
+
margin-inline-start: 2px;
|
|
1452
1456
|
}
|
|
1453
1457
|
|
|
1454
1458
|
.input-wrap {
|
|
@@ -1473,7 +1477,7 @@ var comboboxStyles = [
|
|
|
1473
1477
|
}
|
|
1474
1478
|
|
|
1475
1479
|
:host([variant='error']) .input-wrap {
|
|
1476
|
-
border-color: var(--lt-
|
|
1480
|
+
border-color: var(--lt-text-error);
|
|
1477
1481
|
}
|
|
1478
1482
|
:host([variant='error'][open]) .input-wrap,
|
|
1479
1483
|
:host([variant='error']) .input-wrap:focus-within {
|
|
@@ -1486,7 +1490,10 @@ var comboboxStyles = [
|
|
|
1486
1490
|
border-color: var(--lt-color-warning-500);
|
|
1487
1491
|
}
|
|
1488
1492
|
|
|
1489
|
-
:host(
|
|
1493
|
+
/* :host(:disabled) — the browser matches this automatically for a form-associated element inside a
|
|
1494
|
+
disabled <fieldset>, no JS required; :host([disabled]) covers the component's own explicit attribute. */
|
|
1495
|
+
:host([disabled]) .input-wrap,
|
|
1496
|
+
:host(:disabled) .input-wrap {
|
|
1490
1497
|
background: var(--lt-bg-neutral-subtle);
|
|
1491
1498
|
cursor: not-allowed;
|
|
1492
1499
|
pointer-events: none;
|
|
@@ -1506,7 +1513,8 @@ var comboboxStyles = [
|
|
|
1506
1513
|
color: var(--lt-text-placeholder, var(--lt-color-neutral-400));
|
|
1507
1514
|
}
|
|
1508
1515
|
|
|
1509
|
-
:host([disabled]) input
|
|
1516
|
+
:host([disabled]) input,
|
|
1517
|
+
:host(:disabled) input {
|
|
1510
1518
|
color: var(--lt-text-subtle);
|
|
1511
1519
|
cursor: not-allowed;
|
|
1512
1520
|
}
|
|
@@ -1567,16 +1575,21 @@ var comboboxStyles = [
|
|
|
1567
1575
|
font-family: inherit;
|
|
1568
1576
|
font-size: 0.9375rem;
|
|
1569
1577
|
padding: var(--lt-spacing-2) var(--lt-spacing-3);
|
|
1570
|
-
text-align:
|
|
1578
|
+
text-align: start;
|
|
1571
1579
|
width: 100%;
|
|
1572
1580
|
}
|
|
1573
1581
|
|
|
1574
1582
|
.option:hover {
|
|
1575
1583
|
background: var(--lt-bg-neutral-subtle);
|
|
1576
1584
|
}
|
|
1585
|
+
.option[data-active='true'] {
|
|
1586
|
+
background: var(--lt-bg-neutral-subtle);
|
|
1587
|
+
outline: 2px solid var(--lt-interactive-primary-bg);
|
|
1588
|
+
outline-offset: -2px;
|
|
1589
|
+
}
|
|
1577
1590
|
.option[aria-selected='true'] {
|
|
1578
1591
|
background: var(--lt-bg-primary-subtle);
|
|
1579
|
-
color: var(--lt-
|
|
1592
|
+
color: var(--lt-text-primary);
|
|
1580
1593
|
font-weight: 500;
|
|
1581
1594
|
}
|
|
1582
1595
|
.option[disabled] {
|
|
@@ -1598,13 +1611,22 @@ var comboboxStyles = [
|
|
|
1598
1611
|
}
|
|
1599
1612
|
|
|
1600
1613
|
:host([variant='error']) .helper-text {
|
|
1601
|
-
color: var(--lt-
|
|
1614
|
+
color: var(--lt-text-error);
|
|
1602
1615
|
}
|
|
1603
1616
|
:host([variant='success']) .helper-text {
|
|
1604
|
-
color: var(--lt-
|
|
1617
|
+
color: var(--lt-text-success);
|
|
1605
1618
|
}
|
|
1606
1619
|
:host([variant='warning']) .helper-text {
|
|
1607
|
-
color: var(--lt-
|
|
1620
|
+
color: var(--lt-text-warning);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
/* ── Reduced motion ───────────────────────────────────────────────────── */
|
|
1624
|
+
|
|
1625
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1626
|
+
.input-wrap,
|
|
1627
|
+
.chevron {
|
|
1628
|
+
transition: none;
|
|
1629
|
+
}
|
|
1608
1630
|
}
|
|
1609
1631
|
`
|
|
1610
1632
|
];
|
|
@@ -1795,6 +1817,20 @@ var textStyles = css3`
|
|
|
1795
1817
|
`;
|
|
1796
1818
|
|
|
1797
1819
|
// src/components/text/text.ts
|
|
1820
|
+
var ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
1821
|
+
"h1",
|
|
1822
|
+
"h2",
|
|
1823
|
+
"h3",
|
|
1824
|
+
"h4",
|
|
1825
|
+
"h5",
|
|
1826
|
+
"h6",
|
|
1827
|
+
"p",
|
|
1828
|
+
"span",
|
|
1829
|
+
"div",
|
|
1830
|
+
"label",
|
|
1831
|
+
"strong",
|
|
1832
|
+
"em"
|
|
1833
|
+
]);
|
|
1798
1834
|
var VARIANT_TAG = {
|
|
1799
1835
|
"display-2xl": "p",
|
|
1800
1836
|
"display-xl": "p",
|
|
@@ -1819,7 +1855,8 @@ var Text = class extends ThemeableElement {
|
|
|
1819
1855
|
this.as = "";
|
|
1820
1856
|
}
|
|
1821
1857
|
render() {
|
|
1822
|
-
const
|
|
1858
|
+
const requested = this.as && ALLOWED_TAGS.has(this.as) ? this.as : "";
|
|
1859
|
+
const tag = unsafeStatic(requested || VARIANT_TAG[this.variant] || "p");
|
|
1823
1860
|
return html`<${tag} part="base"><slot></slot></${tag}>`;
|
|
1824
1861
|
}
|
|
1825
1862
|
};
|
|
@@ -1834,10 +1871,56 @@ Text = __decorateClass([
|
|
|
1834
1871
|
customElement("lt-text")
|
|
1835
1872
|
], Text);
|
|
1836
1873
|
|
|
1874
|
+
// src/components/shared/form-default.ts
|
|
1875
|
+
var FormDefaultController = class {
|
|
1876
|
+
constructor(host, get) {
|
|
1877
|
+
this._captured = false;
|
|
1878
|
+
this._get = get;
|
|
1879
|
+
host.addController(this);
|
|
1880
|
+
}
|
|
1881
|
+
hostConnected() {
|
|
1882
|
+
if (this._captured) return;
|
|
1883
|
+
this._captured = true;
|
|
1884
|
+
this.value = this._get();
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
// src/components/shared/form-disabled.ts
|
|
1889
|
+
var FormDisabledController = class {
|
|
1890
|
+
constructor(host) {
|
|
1891
|
+
this._fieldsetDisabled = false;
|
|
1892
|
+
this._host = host;
|
|
1893
|
+
host.addController(this);
|
|
1894
|
+
}
|
|
1895
|
+
// No-op — this controller has no connect-time work of its own (formDisabledCallback drives it instead), but
|
|
1896
|
+
// ReactiveController's members are all optional, and a class satisfying an all-optional interface with no
|
|
1897
|
+
// members in common is a TS error (TS2559); this gives it one.
|
|
1898
|
+
hostConnected() {
|
|
1899
|
+
}
|
|
1900
|
+
/** Whether an ancestor `<fieldset>` is currently disabled. */
|
|
1901
|
+
get fieldsetDisabled() {
|
|
1902
|
+
return this._fieldsetDisabled;
|
|
1903
|
+
}
|
|
1904
|
+
setFieldsetDisabled(disabled) {
|
|
1905
|
+
if (this._fieldsetDisabled === disabled) return;
|
|
1906
|
+
this._fieldsetDisabled = disabled;
|
|
1907
|
+
this._host.requestUpdate();
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1837
1911
|
// src/components/combobox/combobox.ts
|
|
1912
|
+
var comboboxCount = 0;
|
|
1913
|
+
var DEFAULT_LABELS = {
|
|
1914
|
+
validationMessage: "Please select an option",
|
|
1915
|
+
noResults: "No results"
|
|
1916
|
+
};
|
|
1838
1917
|
var Combobox = class extends ThemeableElement {
|
|
1839
1918
|
constructor() {
|
|
1840
1919
|
super();
|
|
1920
|
+
this._default = new FormDefaultController(this, () => this.value);
|
|
1921
|
+
this._fieldsetDisabled = new FormDisabledController(this);
|
|
1922
|
+
// Scopes generated option/listbox ids to this instance, so two comboboxes on the same page don't collide.
|
|
1923
|
+
this._uid = `lt-combobox-${comboboxCount++}`;
|
|
1841
1924
|
this.options = [];
|
|
1842
1925
|
this.value = "";
|
|
1843
1926
|
this.label = "";
|
|
@@ -1848,13 +1931,24 @@ var Combobox = class extends ThemeableElement {
|
|
|
1848
1931
|
this.disabled = false;
|
|
1849
1932
|
this.required = false;
|
|
1850
1933
|
this.name = "";
|
|
1934
|
+
this.labels = {};
|
|
1851
1935
|
this.query = "";
|
|
1852
1936
|
this.open = false;
|
|
1853
1937
|
this.activeIndex = -1;
|
|
1854
1938
|
this._cleanupClickOutside = null;
|
|
1855
1939
|
this._floatingCleanup = null;
|
|
1940
|
+
this._fieldIds = createFieldIds();
|
|
1941
|
+
// Now that options are tabindex="-1" (see SEL-3/CMB-1), the input is the only focusable thing in this
|
|
1942
|
+
// component's shadow root — so any focusout while open means focus is leaving the combobox entirely, unlike
|
|
1943
|
+
// lt-dropdown, which has to check where focus actually went.
|
|
1944
|
+
this._onFocusOut = () => {
|
|
1945
|
+
if (this.open) this.closeDropdown();
|
|
1946
|
+
};
|
|
1856
1947
|
this._internals = this.attachInternals();
|
|
1857
1948
|
}
|
|
1949
|
+
get _labels() {
|
|
1950
|
+
return { ...DEFAULT_LABELS, ...this.labels };
|
|
1951
|
+
}
|
|
1858
1952
|
get selectedLabel() {
|
|
1859
1953
|
return this.options.find((o) => o.value === this.value)?.label ?? "";
|
|
1860
1954
|
}
|
|
@@ -1862,8 +1956,26 @@ var Combobox = class extends ThemeableElement {
|
|
|
1862
1956
|
const q = this.query.toLowerCase();
|
|
1863
1957
|
return this.options.filter((o) => o.label.toLowerCase().includes(q));
|
|
1864
1958
|
}
|
|
1959
|
+
// `activeIndex` counts positions in this list (enabled options only) — using the same list here and in
|
|
1960
|
+
// handleKeydown for both is what keeps the highlighted option and the one Enter selects in agreement (they
|
|
1961
|
+
// used to disagree once any option was disabled: the index came from this list, but the id/highlight below
|
|
1962
|
+
// used to come from the unfiltered one).
|
|
1963
|
+
get enabledOpts() {
|
|
1964
|
+
return this.filtered.filter((o) => !o.disabled);
|
|
1965
|
+
}
|
|
1966
|
+
// Ids are derived from position in the unfiltered (but query-filtered) list, since that's what's actually
|
|
1967
|
+
// rendered — every option, enabled or not, gets one.
|
|
1968
|
+
_idFor(opt) {
|
|
1969
|
+
return `${this._uid}-option-${this.filtered.indexOf(opt)}`;
|
|
1970
|
+
}
|
|
1971
|
+
// Clicking an option button would otherwise focus it first (the default mousedown action) — a button that
|
|
1972
|
+
// momentarily takes focus, then vanishes as the dropdown closes, drops focus off the input. Suppressing just
|
|
1973
|
+
// that default action leaves the click itself (and selectOption) untouched, and the input stays focused.
|
|
1974
|
+
_preventFocusSteal(e) {
|
|
1975
|
+
e.preventDefault();
|
|
1976
|
+
}
|
|
1865
1977
|
async openDropdown() {
|
|
1866
|
-
if (this.
|
|
1978
|
+
if (this._isDisabled || this.open) return;
|
|
1867
1979
|
this.open = true;
|
|
1868
1980
|
this.setAttribute("open", "");
|
|
1869
1981
|
this.query = "";
|
|
@@ -1899,11 +2011,21 @@ var Combobox = class extends ThemeableElement {
|
|
|
1899
2011
|
this.openDropdown();
|
|
1900
2012
|
}
|
|
1901
2013
|
handleKeydown(e) {
|
|
1902
|
-
const opts = this.filtered.filter((o) => !o.disabled);
|
|
1903
2014
|
if (e.key === "Escape") {
|
|
1904
|
-
this.
|
|
2015
|
+
if (this.open) {
|
|
2016
|
+
e.preventDefault();
|
|
2017
|
+
this.closeDropdown();
|
|
2018
|
+
}
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
if (!this.open) {
|
|
2022
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
2023
|
+
e.preventDefault();
|
|
2024
|
+
this.openDropdown();
|
|
2025
|
+
}
|
|
1905
2026
|
return;
|
|
1906
2027
|
}
|
|
2028
|
+
const opts = this.enabledOpts;
|
|
1907
2029
|
if (e.key === "ArrowDown") {
|
|
1908
2030
|
e.preventDefault();
|
|
1909
2031
|
this.activeIndex = Math.min(this.activeIndex + 1, opts.length - 1);
|
|
@@ -1918,9 +2040,11 @@ var Combobox = class extends ThemeableElement {
|
|
|
1918
2040
|
connectedCallback() {
|
|
1919
2041
|
super.connectedCallback();
|
|
1920
2042
|
this._cleanupClickOutside = createClickOutsideHandler(this, () => this.closeDropdown(), { event: "click" });
|
|
2043
|
+
this.addEventListener("focusout", this._onFocusOut);
|
|
1921
2044
|
}
|
|
1922
2045
|
disconnectedCallback() {
|
|
1923
2046
|
super.disconnectedCallback();
|
|
2047
|
+
this.removeEventListener("focusout", this._onFocusOut);
|
|
1924
2048
|
this._cleanupClickOutside?.();
|
|
1925
2049
|
this._cleanupClickOutside = null;
|
|
1926
2050
|
this._floatingCleanup?.();
|
|
@@ -1930,13 +2054,20 @@ var Combobox = class extends ThemeableElement {
|
|
|
1930
2054
|
this._internals.setFormValue(this.value || null);
|
|
1931
2055
|
const input = this.shadowRoot?.querySelector("input");
|
|
1932
2056
|
if (this.required && !this.value && input) {
|
|
1933
|
-
this._internals.setValidity({ valueMissing: true },
|
|
2057
|
+
this._internals.setValidity({ valueMissing: true }, this._labels.validationMessage, input);
|
|
1934
2058
|
} else {
|
|
1935
2059
|
this._internals.setValidity({});
|
|
1936
2060
|
}
|
|
1937
2061
|
}
|
|
1938
2062
|
formResetCallback() {
|
|
1939
|
-
this.value =
|
|
2063
|
+
this.value = this._default.value;
|
|
2064
|
+
}
|
|
2065
|
+
formDisabledCallback(disabled) {
|
|
2066
|
+
this._fieldsetDisabled.setFieldsetDisabled(disabled);
|
|
2067
|
+
}
|
|
2068
|
+
/** `this.disabled` combined with an ancestor `<fieldset>`'s own disabled state (see `FormDisabledController`). */
|
|
2069
|
+
get _isDisabled() {
|
|
2070
|
+
return this.disabled || this._fieldsetDisabled.fieldsetDisabled;
|
|
1940
2071
|
}
|
|
1941
2072
|
checkValidity() {
|
|
1942
2073
|
return this._internals.checkValidity();
|
|
@@ -1946,6 +2077,7 @@ var Combobox = class extends ThemeableElement {
|
|
|
1946
2077
|
}
|
|
1947
2078
|
render() {
|
|
1948
2079
|
const opts = this.filtered;
|
|
2080
|
+
const activeOption = this.enabledOpts[this.activeIndex];
|
|
1949
2081
|
const displayValue = this.open ? this.query : this.selectedLabel;
|
|
1950
2082
|
const inputRow = html2`
|
|
1951
2083
|
<div class="input-wrap" @click=${this.openDropdown}>
|
|
@@ -1954,11 +2086,14 @@ var Combobox = class extends ThemeableElement {
|
|
|
1954
2086
|
role="combobox"
|
|
1955
2087
|
aria-expanded=${this.open}
|
|
1956
2088
|
aria-autocomplete="list"
|
|
2089
|
+
aria-describedby=${this.helperText ? this._fieldIds.helper : nothing}
|
|
1957
2090
|
aria-required=${this.required}
|
|
2091
|
+
aria-controls=${this.open ? `${this._uid}-listbox` : nothing}
|
|
2092
|
+
aria-activedescendant=${this.open && activeOption ? this._idFor(activeOption) : nothing}
|
|
1958
2093
|
autocomplete="off"
|
|
1959
2094
|
placeholder=${this.open ? this.placeholder : this.selectedLabel || this.placeholder}
|
|
1960
2095
|
.value=${displayValue}
|
|
1961
|
-
?disabled=${this.
|
|
2096
|
+
?disabled=${this._isDisabled}
|
|
1962
2097
|
@focus=${this.handleFocus}
|
|
1963
2098
|
@input=${this.handleInput}
|
|
1964
2099
|
@keydown=${this.handleKeydown}
|
|
@@ -1974,24 +2109,27 @@ var Combobox = class extends ThemeableElement {
|
|
|
1974
2109
|
</label>` : nothing}
|
|
1975
2110
|
${inputRow}
|
|
1976
2111
|
${this.open ? html2`
|
|
1977
|
-
<div class="dropdown" popover="manual" role="listbox">
|
|
2112
|
+
<div class="dropdown" id=${`${this._uid}-listbox`} popover="manual" role="listbox">
|
|
1978
2113
|
${opts.length > 0 ? opts.map(
|
|
1979
|
-
(opt
|
|
2114
|
+
(opt) => html2`
|
|
1980
2115
|
<button
|
|
2116
|
+
id=${this._idFor(opt)}
|
|
1981
2117
|
class="option"
|
|
1982
2118
|
role="option"
|
|
2119
|
+
tabindex="-1"
|
|
1983
2120
|
aria-selected=${opt.value === this.value}
|
|
1984
2121
|
?disabled=${opt.disabled}
|
|
1985
|
-
data-active=${
|
|
2122
|
+
data-active=${opt === activeOption}
|
|
2123
|
+
@mousedown=${this._preventFocusSteal}
|
|
1986
2124
|
@click=${() => this.selectOption(opt)}
|
|
1987
2125
|
>
|
|
1988
2126
|
${opt.label}
|
|
1989
2127
|
</button>
|
|
1990
2128
|
`
|
|
1991
|
-
) : html2`<p class="no-results"
|
|
2129
|
+
) : html2`<p class="no-results">${this._labels.noResults}</p>`}
|
|
1992
2130
|
</div>
|
|
1993
2131
|
` : nothing}
|
|
1994
|
-
${this.helperText ? html2`<span class="helper-text">${this.helperText}</span>` : nothing}
|
|
2132
|
+
${this.helperText ? html2`<span id=${this._fieldIds.helper} class="helper-text">${this.helperText}</span>` : nothing}
|
|
1995
2133
|
</div>
|
|
1996
2134
|
`;
|
|
1997
2135
|
}
|
|
@@ -2002,7 +2140,7 @@ __decorateClass([
|
|
|
2002
2140
|
property3({ type: Array })
|
|
2003
2141
|
], Combobox.prototype, "options", 2);
|
|
2004
2142
|
__decorateClass([
|
|
2005
|
-
property3(
|
|
2143
|
+
property3()
|
|
2006
2144
|
], Combobox.prototype, "value", 2);
|
|
2007
2145
|
__decorateClass([
|
|
2008
2146
|
property3({ reflect: true })
|
|
@@ -2028,6 +2166,9 @@ __decorateClass([
|
|
|
2028
2166
|
__decorateClass([
|
|
2029
2167
|
property3({ reflect: true })
|
|
2030
2168
|
], Combobox.prototype, "name", 2);
|
|
2169
|
+
__decorateClass([
|
|
2170
|
+
property3({ type: Object })
|
|
2171
|
+
], Combobox.prototype, "labels", 2);
|
|
2031
2172
|
__decorateClass([
|
|
2032
2173
|
state()
|
|
2033
2174
|
], Combobox.prototype, "query", 2);
|
|
@@ -2,8 +2,9 @@ import { ThemeableElement } from '../../base';
|
|
|
2
2
|
import '@latty-ds/icons';
|
|
3
3
|
import '../calendar/calendar';
|
|
4
4
|
import '../text/text';
|
|
5
|
-
import type { DateInputSize, DateInputVariant, DateInputFormat } from './date-input.types';
|
|
5
|
+
import type { DateInputSize, DateInputVariant, DateInputFormat, DateInputLabels } from './date-input.types';
|
|
6
6
|
import type { Calendar } from '../calendar/calendar';
|
|
7
|
+
import type { CalendarWeekStart } from '../calendar/calendar.types';
|
|
7
8
|
/**
|
|
8
9
|
* A text field that opens an `lt-calendar` popover for visual date selection.
|
|
9
10
|
*
|
|
@@ -25,8 +26,11 @@ export declare class DateInput extends ThemeableElement {
|
|
|
25
26
|
static styles: import("lit").CSSResult[];
|
|
26
27
|
static formAssociated: boolean;
|
|
27
28
|
private _internals;
|
|
29
|
+
private _default;
|
|
30
|
+
private _fieldsetDisabled;
|
|
28
31
|
constructor();
|
|
29
|
-
/** Selected date in ISO format (YYYY-MM-DD).
|
|
32
|
+
/** Selected date in ISO format (YYYY-MM-DD). Not reflected as an attribute — read the property, or the
|
|
33
|
+
* `change` event's `detail.value`, instead of `getAttribute('value')`/`[value]`. */
|
|
30
34
|
value: string;
|
|
31
35
|
/** Minimum selectable date (ISO format). Dates before this are disabled. */
|
|
32
36
|
min: string;
|
|
@@ -36,8 +40,12 @@ export declare class DateInput extends ThemeableElement {
|
|
|
36
40
|
locale: string;
|
|
37
41
|
/** How to format the selected date in the trigger field. Maps to `Intl.DateTimeFormat` `dateStyle`. */
|
|
38
42
|
format: DateInputFormat;
|
|
39
|
-
/**
|
|
40
|
-
|
|
43
|
+
/**
|
|
44
|
+
* First day of the week in the calendar (0 = Sunday … 6 = Saturday). Defaults to whatever `locale` implies —
|
|
45
|
+
* set this explicitly only to override that. Forwarded as-is to the internal `lt-calendar`, which does the
|
|
46
|
+
* actual derivation when this is left unset.
|
|
47
|
+
*/
|
|
48
|
+
weekStart?: CalendarWeekStart;
|
|
41
49
|
/** Field label displayed above the trigger. */
|
|
42
50
|
label: string;
|
|
43
51
|
/** Placeholder text shown when no date is selected. */
|
|
@@ -52,21 +60,28 @@ export declare class DateInput extends ThemeableElement {
|
|
|
52
60
|
disabled: boolean;
|
|
53
61
|
/** Whether the field is required. */
|
|
54
62
|
required: boolean;
|
|
55
|
-
/** Name used in form submission
|
|
63
|
+
/** Name used in form submission (through `ElementInternals`, so no hidden input is rendered). */
|
|
56
64
|
name: string;
|
|
57
|
-
/** Individual dates to disable in the calendar, as Date objects. */
|
|
65
|
+
/** Individual dates to disable in the calendar, as Date objects. Set as a JS property (`.disabledDates`). */
|
|
58
66
|
disabledDates: Calendar['disabledDates'];
|
|
67
|
+
/** Overridable UI text (validation message, calendar popover's accessible label), for i18n. English defaults — override only the keys you need. */
|
|
68
|
+
labels: Partial<DateInputLabels>;
|
|
69
|
+
private get _labels();
|
|
59
70
|
private _open;
|
|
60
71
|
private _cleanupClickOutside;
|
|
61
72
|
private _floatingCleanup;
|
|
73
|
+
private readonly _fieldIds;
|
|
62
74
|
private get _displayValue();
|
|
63
75
|
private _openDropdown;
|
|
64
76
|
private _closeDropdown;
|
|
65
77
|
disconnectedCallback(): void;
|
|
66
78
|
private _handleCalendarChange;
|
|
67
79
|
private _handleDropdownKeyDown;
|
|
68
|
-
updated(): void;
|
|
80
|
+
updated(changed: Map<string, unknown>): void;
|
|
69
81
|
formResetCallback(): void;
|
|
82
|
+
formDisabledCallback(disabled: boolean): void;
|
|
83
|
+
/** `this.disabled` combined with an ancestor `<fieldset>`'s own disabled state (see `FormDisabledController`). */
|
|
84
|
+
private get _isDisabled();
|
|
70
85
|
checkValidity(): boolean;
|
|
71
86
|
reportValidity(): boolean;
|
|
72
87
|
render(): import("lit").TemplateResult<1>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export type DateInputSize = 'sm' | 'md' | 'lg';
|
|
2
2
|
export type DateInputVariant = 'default' | 'success' | 'warning' | 'error';
|
|
3
3
|
export type DateInputFormat = 'short' | 'medium' | 'long' | 'full';
|
|
4
|
+
/** Overridable UI text for `lt-date-input`, for i18n. */
|
|
5
|
+
export interface DateInputLabels {
|
|
6
|
+
/** Validation message shown when a required field has no date selected. */
|
|
7
|
+
validationMessage: string;
|
|
8
|
+
/** Accessible label for the calendar popover dialog. */
|
|
9
|
+
datePicker: string;
|
|
10
|
+
}
|