@latty-ds/web 0.6.0 → 0.8.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.
Files changed (48) hide show
  1. package/custom-elements.json +1226 -995
  2. package/dist/components/accordion/index.js +4 -4
  3. package/dist/components/alert/index.js +39 -5
  4. package/dist/components/avatar/index.js +1 -1
  5. package/dist/components/badge/index.js +6 -2
  6. package/dist/components/breadcrumb/index.js +1 -1
  7. package/dist/components/button/button.d.ts +7 -2
  8. package/dist/components/button/button.types.d.ts +3 -2
  9. package/dist/components/button/index.js +83 -4
  10. package/dist/components/calendar/index.js +3 -3
  11. package/dist/components/checkbox/index.js +2 -1
  12. package/dist/components/chip/index.js +6 -2
  13. package/dist/components/color-input/index.js +6 -3
  14. package/dist/components/combobox/index.js +4 -4
  15. package/dist/components/date-input/index.js +6 -6
  16. package/dist/components/datepicker/index.js +3 -3
  17. package/dist/components/dialog/index.js +40 -6
  18. package/dist/components/divider/index.js +1 -1
  19. package/dist/components/dropdown/index.js +5 -5
  20. package/dist/components/icon-button/icon-button.d.ts +4 -0
  21. package/dist/components/icon-button/index.js +35 -1
  22. package/dist/components/image/image.d.ts +32 -1
  23. package/dist/components/image/image.types.d.ts +7 -0
  24. package/dist/components/image/index.js +41 -2
  25. package/dist/components/list/index.js +94 -7
  26. package/dist/components/list/list-item.d.ts +35 -0
  27. package/dist/components/nav/index.js +19 -5
  28. package/dist/components/nav/nav-item.d.ts +7 -1
  29. package/dist/components/pagination/index.js +1 -1
  30. package/dist/components/radio/index.js +2 -1
  31. package/dist/components/radio-group/index.js +2 -2
  32. package/dist/components/select/index.js +6 -6
  33. package/dist/components/shared/aria-forwarding.d.ts +43 -0
  34. package/dist/components/sidepanel/index.js +36 -2
  35. package/dist/components/slider/index.js +2 -2
  36. package/dist/components/snackbar/index.js +4 -4
  37. package/dist/components/surface/index.js +3 -3
  38. package/dist/components/switch/index.js +2 -1
  39. package/dist/components/tab/index.js +1 -1
  40. package/dist/components/tab-group/index.js +2 -2
  41. package/dist/components/table/index.js +3 -3
  42. package/dist/components/text/index.js +1 -1
  43. package/dist/components/textfield/index.js +7 -3
  44. package/dist/components/tooltip/index.js +1 -1
  45. package/dist/index.cjs +302 -67
  46. package/dist/index.js +344 -106
  47. package/dist/manifest.json +126 -84
  48. package/package.json +3 -3
@@ -1432,7 +1432,7 @@ var selectStyles = [
1432
1432
  css2`
1433
1433
  :host {
1434
1434
  display: inline-block;
1435
- font-family: 'Hanken Grotesk', sans-serif;
1435
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
1436
1436
  position: relative;
1437
1437
  width: 100%;
1438
1438
  }
@@ -1461,7 +1461,7 @@ var selectStyles = [
1461
1461
  align-items: center;
1462
1462
  background: var(--lt-bg-subtle);
1463
1463
  border-radius: var(--lt-border-radius);
1464
- border: 1px solid var(--lt-border-default);
1464
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
1465
1465
  box-sizing: border-box;
1466
1466
  cursor: pointer;
1467
1467
  display: flex;
@@ -1657,7 +1657,7 @@ import { css as css3 } from "lit";
1657
1657
  var surfaceStyles = css3`
1658
1658
  :host {
1659
1659
  display: block;
1660
- font-family: 'Hanken Grotesk', sans-serif;
1660
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
1661
1661
  }
1662
1662
 
1663
1663
  .surface {
@@ -1696,7 +1696,7 @@ var surfaceStyles = css3`
1696
1696
 
1697
1697
  :host([appearance='outlined']) .surface {
1698
1698
  background: var(--lt-surface-bg, transparent);
1699
- border: 1px solid var(--lt-border-default);
1699
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
1700
1700
  }
1701
1701
 
1702
1702
  :host([appearance='outlined']:hover) .surface {
@@ -1713,7 +1713,7 @@ var Surface = class extends ThemeableElement {
1713
1713
  this.background = "";
1714
1714
  }
1715
1715
  render() {
1716
- const style = this.background ? { "--_surface-bg": resolveColorValue(this.background) } : {};
1716
+ const style = this.background ? { "--lt-surface-bg": resolveColorValue(this.background) } : {};
1717
1717
  return html`
1718
1718
  <div class="surface" part="surface" style=${styleMap(style)}>
1719
1719
  <slot></slot>
@@ -1757,7 +1757,7 @@ var textStyles = css4`
1757
1757
  [part='base'] {
1758
1758
  margin: 0;
1759
1759
  color: inherit;
1760
- font-family: var(--lt-typography-fontfamily);
1760
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
1761
1761
  }
1762
1762
 
1763
1763
  /* ── Display ─────────────────────────────────────────────────────────── */
@@ -0,0 +1,43 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ /**
3
+ * Host `aria-*` attributes forwarded onto the internal native control.
4
+ *
5
+ * Interactive components render their semantics on a native element inside the
6
+ * shadow DOM, so ARIA attributes set on the host (`<lt-button aria-pressed="true">`)
7
+ * never reach the element screen readers actually interact with. Components that
8
+ * install an {@link AriaForwardingController} mirror this documented subset onto
9
+ * their internal control and keep it in sync as the host attributes change.
10
+ *
11
+ * Note: `aria-controls` contains an idref — it can only resolve when the referenced
12
+ * element lives in the same tree as the internal control, so cross-shadow references
13
+ * are forwarded but may be ignored by assistive technology.
14
+ */
15
+ export declare const FORWARDED_ARIA_ATTRIBUTES: readonly ["aria-pressed", "aria-expanded", "aria-haspopup", "aria-controls", "aria-current"];
16
+ type AriaForwardingHost = ReactiveControllerHost & Element;
17
+ /**
18
+ * Reactive controller that forwards {@link FORWARDED_ARIA_ATTRIBUTES} from the
19
+ * host element onto an internal target element (typically the native `<button>`
20
+ * or `<a>` rendered in the shadow DOM).
21
+ *
22
+ * A `MutationObserver` watches the host so dynamic changes (e.g. a framework
23
+ * toggling `aria-pressed`) are re-forwarded after every update. Attributes
24
+ * removed from the host are removed from the target — components should not
25
+ * render any of the forwarded attributes themselves.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * class Button extends LitElement {
30
+ * private _aria = new AriaForwardingController(this, () => this.shadowRoot?.querySelector('[part="base"]'));
31
+ * }
32
+ * ```
33
+ */
34
+ export declare class AriaForwardingController implements ReactiveController {
35
+ private _host;
36
+ private _getTarget;
37
+ private _observer;
38
+ constructor(host: AriaForwardingHost, getTarget: () => Element | null | undefined);
39
+ hostConnected(): void;
40
+ hostDisconnected(): void;
41
+ hostUpdated(): void;
42
+ }
43
+ export {};
@@ -186,7 +186,7 @@ var iconButtonStyles = css3`
186
186
  align-items: center;
187
187
  background: var(--lt-icon-button-bg, var(--_bg));
188
188
  border-radius: var(--lt-border-radius);
189
- border: 1px solid var(--lt-icon-button-border-color, var(--_border-color));
189
+ border: var(--lt-border-width, 1px) solid var(--lt-icon-button-border-color, var(--_border-color));
190
190
  box-sizing: border-box;
191
191
  color: var(--lt-icon-button-color, var(--_color));
192
192
  cursor: pointer;
@@ -392,11 +392,45 @@ var iconButtonStyles = css3`
392
392
  }
393
393
  `;
394
394
 
395
+ // src/components/shared/aria-forwarding.ts
396
+ var FORWARDED_ARIA_ATTRIBUTES = [
397
+ "aria-pressed",
398
+ "aria-expanded",
399
+ "aria-haspopup",
400
+ "aria-controls",
401
+ "aria-current"
402
+ ];
403
+ var AriaForwardingController = class {
404
+ constructor(host, getTarget) {
405
+ this._host = host;
406
+ this._getTarget = getTarget;
407
+ this._observer = new MutationObserver(() => this._host.requestUpdate());
408
+ host.addController(this);
409
+ }
410
+ hostConnected() {
411
+ this._observer.observe(this._host, { attributes: true, attributeFilter: [...FORWARDED_ARIA_ATTRIBUTES] });
412
+ this._host.requestUpdate();
413
+ }
414
+ hostDisconnected() {
415
+ this._observer.disconnect();
416
+ }
417
+ hostUpdated() {
418
+ const target = this._getTarget();
419
+ if (!target) return;
420
+ for (const attr of FORWARDED_ARIA_ATTRIBUTES) {
421
+ const value = this._host.getAttribute(attr);
422
+ if (value === null) target.removeAttribute(attr);
423
+ else if (target.getAttribute(attr) !== value) target.setAttribute(attr, value);
424
+ }
425
+ }
426
+ };
427
+
395
428
  // src/components/icon-button/icon-button.ts
396
429
  import "@latty-ds/icons";
397
430
  var IconButton = class extends ThemeableElement {
398
431
  constructor() {
399
432
  super(...arguments);
433
+ this._ariaForwarding = new AriaForwardingController(this, () => this.shadowRoot?.querySelector('[part="base"]'));
400
434
  this.icon = "";
401
435
  this.label = "";
402
436
  this.variant = "neutral";
@@ -491,7 +525,7 @@ var textStyles = css4`
491
525
  [part='base'] {
492
526
  margin: 0;
493
527
  color: inherit;
494
- font-family: var(--lt-typography-fontfamily);
528
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
495
529
  }
496
530
 
497
531
  /* ── Display ─────────────────────────────────────────────────────────── */
@@ -42,7 +42,7 @@ import { css } from "lit";
42
42
  var sliderStyles = css`
43
43
  :host {
44
44
  display: block;
45
- font-family: 'Hanken Grotesk', sans-serif;
45
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
46
46
  width: 100%;
47
47
  }
48
48
 
@@ -310,7 +310,7 @@ var textStyles = css3`
310
310
  [part='base'] {
311
311
  margin: 0;
312
312
  color: inherit;
313
- font-family: var(--lt-typography-fontfamily);
313
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
314
314
  }
315
315
 
316
316
  /* ── Display ─────────────────────────────────────────────────────────── */
@@ -69,7 +69,7 @@ var snackbarStyles = css`
69
69
  align-items: center;
70
70
  color: var(--lt-text-inverse);
71
71
  display: flex;
72
- font-family: 'Hanken Grotesk', sans-serif;
72
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
73
73
  font-size: 0.875rem;
74
74
  gap: var(--lt-spacing-2);
75
75
  line-height: 1.4;
@@ -163,7 +163,7 @@ import { css as css2 } from "lit";
163
163
  var surfaceStyles = css2`
164
164
  :host {
165
165
  display: block;
166
- font-family: 'Hanken Grotesk', sans-serif;
166
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
167
167
  }
168
168
 
169
169
  .surface {
@@ -202,7 +202,7 @@ var surfaceStyles = css2`
202
202
 
203
203
  :host([appearance='outlined']) .surface {
204
204
  background: var(--lt-surface-bg, transparent);
205
- border: 1px solid var(--lt-border-default);
205
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
206
206
  }
207
207
 
208
208
  :host([appearance='outlined']:hover) .surface {
@@ -219,7 +219,7 @@ var Surface = class extends ThemeableElement {
219
219
  this.background = "";
220
220
  }
221
221
  render() {
222
- const style = this.background ? { "--_surface-bg": resolveColorValue(this.background) } : {};
222
+ const style = this.background ? { "--lt-surface-bg": resolveColorValue(this.background) } : {};
223
223
  return html`
224
224
  <div class="surface" part="surface" style=${styleMap(style)}>
225
225
  <slot></slot>
@@ -43,7 +43,7 @@ import { css } from "lit";
43
43
  var surfaceStyles = css`
44
44
  :host {
45
45
  display: block;
46
- font-family: 'Hanken Grotesk', sans-serif;
46
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
47
47
  }
48
48
 
49
49
  .surface {
@@ -82,7 +82,7 @@ var surfaceStyles = css`
82
82
 
83
83
  :host([appearance='outlined']) .surface {
84
84
  background: var(--lt-surface-bg, transparent);
85
- border: 1px solid var(--lt-border-default);
85
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
86
86
  }
87
87
 
88
88
  :host([appearance='outlined']:hover) .surface {
@@ -102,7 +102,7 @@ var Surface = class extends ThemeableElement {
102
102
  this.background = "";
103
103
  }
104
104
  render() {
105
- const style = this.background ? { "--_surface-bg": resolveColorValue(this.background) } : {};
105
+ const style = this.background ? { "--lt-surface-bg": resolveColorValue(this.background) } : {};
106
106
  return html`
107
107
  <div class="surface" part="surface" style=${styleMap(style)}>
108
108
  <slot></slot>
@@ -42,7 +42,7 @@ import { css } from "lit";
42
42
  var switchStyles = css`
43
43
  :host {
44
44
  display: inline-block;
45
- font-family: 'Hanken Grotesk', sans-serif;
45
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
46
46
  }
47
47
 
48
48
  .switch-wrapper {
@@ -243,6 +243,7 @@ var Switch = class extends ThemeableElement {
243
243
  return this._internals.reportValidity();
244
244
  }
245
245
  handleChange(e) {
246
+ e.stopPropagation();
246
247
  const target = e.target;
247
248
  this.checked = target.checked;
248
249
  this.dispatchEvent(
@@ -42,7 +42,7 @@ import { css } from "lit";
42
42
  var tabStyles = css`
43
43
  :host {
44
44
  display: inline-block;
45
- font-family: 'Hanken Grotesk', sans-serif;
45
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
46
46
  }
47
47
 
48
48
  .tab {
@@ -42,7 +42,7 @@ import { css } from "lit";
42
42
  var tabGroupStyles = css`
43
43
  :host {
44
44
  display: block;
45
- font-family: 'Hanken Grotesk', sans-serif;
45
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
46
46
  }
47
47
 
48
48
  .tab-group {
@@ -102,7 +102,7 @@ import { css as css2 } from "lit";
102
102
  var tabStyles = css2`
103
103
  :host {
104
104
  display: inline-block;
105
- font-family: 'Hanken Grotesk', sans-serif;
105
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
106
106
  }
107
107
 
108
108
  .tab {
@@ -45,7 +45,7 @@ import { css } from "lit";
45
45
  var tableStyles = css`
46
46
  :host {
47
47
  display: block;
48
- font-family: 'Hanken Grotesk', sans-serif;
48
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
49
49
  overflow: hidden;
50
50
  width: 100%;
51
51
  }
@@ -206,7 +206,7 @@ var tableStyles = css`
206
206
 
207
207
  /* Border styling */
208
208
  :host([bordered]) table {
209
- border: 1px solid var(--lt-border-default);
209
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
210
210
  }
211
211
 
212
212
  :host([bordered]) th,
@@ -262,7 +262,7 @@ var tableStyles = css`
262
262
  :host([responsive-mode='stack']) tr {
263
263
  background: var(--lt-bg-subtle);
264
264
  border-radius: var(--lt-border-radius);
265
- border: 1px solid var(--lt-border-default);
265
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
266
266
  margin-bottom: var(--lt-spacing-3);
267
267
  padding: var(--lt-spacing-4);
268
268
  }
@@ -53,7 +53,7 @@ var textStyles = css`
53
53
  [part='base'] {
54
54
  margin: 0;
55
55
  color: inherit;
56
- font-family: var(--lt-typography-fontfamily);
56
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
57
57
  }
58
58
 
59
59
  /* ── Display ─────────────────────────────────────────────────────────── */
@@ -43,7 +43,7 @@ import { css } from "lit";
43
43
  var textfieldStyles = css`
44
44
  :host {
45
45
  display: inline-block;
46
- font-family: 'Hanken Grotesk', sans-serif;
46
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
47
47
  width: 100%;
48
48
  }
49
49
 
@@ -113,7 +113,7 @@ var textfieldStyles = css`
113
113
  textarea {
114
114
  background: var(--lt-bg-subtle);
115
115
  border-radius: var(--lt-border-radius);
116
- border: 1px solid var(--lt-border-default);
116
+ border: var(--lt-border-width, 1px) solid var(--lt-border-default);
117
117
  box-sizing: border-box;
118
118
  color: var(--lt-text-default);
119
119
  font-family: inherit;
@@ -307,7 +307,7 @@ var textStyles = css2`
307
307
  [part='base'] {
308
308
  margin: 0;
309
309
  color: inherit;
310
- font-family: var(--lt-typography-fontfamily);
310
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
311
311
  }
312
312
 
313
313
  /* ── Display ─────────────────────────────────────────────────────────── */
@@ -519,6 +519,7 @@ var Textfield = class extends ThemeableElement {
519
519
  return true;
520
520
  }
521
521
  handleInput(e) {
522
+ e.stopPropagation();
522
523
  const input = e.target;
523
524
  this.value = input.value;
524
525
  if (this._touched) this._autoError = !this._validate();
@@ -538,6 +539,7 @@ var Textfield = class extends ThemeableElement {
538
539
  * @private
539
540
  */
540
541
  handleChange(e) {
542
+ e.stopPropagation();
541
543
  const input = e.target;
542
544
  this.value = input.value;
543
545
  this.dispatchEvent(
@@ -624,6 +626,7 @@ var Textfield = class extends ThemeableElement {
624
626
  ${isMultiline ? html2`
625
627
  <textarea
626
628
  .value=${this.value}
629
+ name=${ifDefined(this.name || void 0)}
627
630
  placeholder=${this.placeholder}
628
631
  rows=${this.rows}
629
632
  minlength=${ifDefined(this.min !== null ? this.min : void 0)}
@@ -643,6 +646,7 @@ var Textfield = class extends ThemeableElement {
643
646
  <input
644
647
  type=${actualInputType}
645
648
  .value=${this.value}
649
+ name=${ifDefined(this.name || void 0)}
646
650
  placeholder=${this.placeholder}
647
651
  min=${ifDefined(isNumber && this.min !== null ? this.min : void 0)}
648
652
  max=${ifDefined(isNumber && this.max !== null ? this.max : void 0)}
@@ -170,7 +170,7 @@ var textStyles = css2`
170
170
  [part='base'] {
171
171
  margin: 0;
172
172
  color: inherit;
173
- font-family: var(--lt-typography-fontfamily);
173
+ font-family: var(--lt-typography-fontFamily, 'Hanken Grotesk', sans-serif);
174
174
  }
175
175
 
176
176
  /* ── Display ─────────────────────────────────────────────────────────── */