@melodicdev/components 3.0.0 → 4.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.
Files changed (178) hide show
  1. package/assets/melodic-components.js +4371 -2363
  2. package/assets/melodic-components.js.map +1 -1
  3. package/assets/melodic-components.min.js +6220 -4461
  4. package/lib/components/data-display/calendar-view/calendar-view-month.template.d.ts.map +1 -1
  5. package/lib/components/data-display/calendar-view/calendar-view-month.template.js +17 -0
  6. package/lib/components/data-display/calendar-view/calendar-view.component.d.ts +23 -3
  7. package/lib/components/data-display/calendar-view/calendar-view.component.d.ts.map +1 -1
  8. package/lib/components/data-display/calendar-view/calendar-view.component.js +76 -21
  9. package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +9 -0
  10. package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
  11. package/lib/components/data-display/calendar-view/calendar-view.utils.js +68 -19
  12. package/lib/components/data-display/data-grid/data-grid.component.d.ts +24 -0
  13. package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
  14. package/lib/components/data-display/data-grid/data-grid.component.js +104 -31
  15. package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
  16. package/lib/components/data-display/data-grid/data-grid.template.js +3 -0
  17. package/lib/components/data-display/table/table.component.d.ts +7 -0
  18. package/lib/components/data-display/table/table.component.d.ts.map +1 -1
  19. package/lib/components/data-display/table/table.component.js +20 -5
  20. package/lib/components/data-display/table/table.template.d.ts.map +1 -1
  21. package/lib/components/data-display/table/table.template.js +3 -0
  22. package/lib/components/data-display/table-core/index.d.ts +1 -0
  23. package/lib/components/data-display/table-core/index.d.ts.map +1 -1
  24. package/lib/components/data-display/table-core/index.js +1 -0
  25. package/lib/components/data-display/table-core/memo.d.ts +10 -0
  26. package/lib/components/data-display/table-core/memo.d.ts.map +1 -0
  27. package/lib/components/data-display/table-core/memo.js +20 -0
  28. package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
  29. package/lib/components/feedback/alert/alert.styles.js +25 -0
  30. package/lib/components/feedback/progress/progress.styles.d.ts.map +1 -1
  31. package/lib/components/feedback/progress/progress.styles.js +8 -3
  32. package/lib/components/feedback/spinner/spinner.styles.d.ts.map +1 -1
  33. package/lib/components/feedback/spinner/spinner.styles.js +2 -11
  34. package/lib/components/feedback/toast/toast-container.template.d.ts.map +1 -1
  35. package/lib/components/feedback/toast/toast-container.template.js +4 -0
  36. package/lib/components/feedback/toast/toast.component.d.ts +3 -2
  37. package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
  38. package/lib/components/feedback/toast/toast.component.js +10 -0
  39. package/lib/components/feedback/toast/toast.service.d.ts +26 -6
  40. package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
  41. package/lib/components/feedback/toast/toast.service.js +53 -18
  42. package/lib/components/feedback/toast/toast.template.js +1 -1
  43. package/lib/components/forms/autocomplete/autocomplete.component.d.ts +7 -0
  44. package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
  45. package/lib/components/forms/autocomplete/autocomplete.component.js +39 -0
  46. package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
  47. package/lib/components/forms/autocomplete/autocomplete.template.js +5 -1
  48. package/lib/components/forms/button-group/button-group.component.d.ts +3 -2
  49. package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
  50. package/lib/components/forms/button-group/button-group.component.js +11 -1
  51. package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -0
  52. package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
  53. package/lib/components/forms/checkbox/checkbox.component.js +5 -1
  54. package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
  55. package/lib/components/forms/checkbox/checkbox.template.js +2 -0
  56. package/lib/components/forms/date-picker/calendar.component.d.ts +21 -0
  57. package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
  58. package/lib/components/forms/date-picker/calendar.component.js +69 -2
  59. package/lib/components/forms/date-picker/calendar.template.d.ts.map +1 -1
  60. package/lib/components/forms/date-picker/calendar.template.js +6 -3
  61. package/lib/components/forms/date-picker/date-picker.component.d.ts +6 -0
  62. package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
  63. package/lib/components/forms/date-picker/date-picker.component.js +41 -12
  64. package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
  65. package/lib/components/forms/file-upload/file-upload.component.js +15 -5
  66. package/lib/components/forms/form-field/form-field.component.d.ts +8 -0
  67. package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
  68. package/lib/components/forms/form-field/form-field.component.js +41 -6
  69. package/lib/components/forms/form-field/form-field.template.js +1 -1
  70. package/lib/components/forms/input/input.component.d.ts +26 -3
  71. package/lib/components/forms/input/input.component.d.ts.map +1 -1
  72. package/lib/components/forms/input/input.component.js +46 -6
  73. package/lib/components/forms/input/input.template.d.ts.map +1 -1
  74. package/lib/components/forms/input/input.template.js +9 -0
  75. package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts +6 -0
  76. package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts.map +1 -1
  77. package/lib/components/forms/radio-card-group/radio-card-group.component.js +34 -0
  78. package/lib/components/forms/radio-card-group/radio-card.component.d.ts +6 -0
  79. package/lib/components/forms/radio-card-group/radio-card.component.d.ts.map +1 -1
  80. package/lib/components/forms/radio-card-group/radio-card.component.js +7 -1
  81. package/lib/components/forms/radio-card-group/radio-card.template.js +1 -1
  82. package/lib/components/forms/select/select.component.d.ts +8 -0
  83. package/lib/components/forms/select/select.component.d.ts.map +1 -1
  84. package/lib/components/forms/select/select.component.js +75 -1
  85. package/lib/components/forms/select/select.template.d.ts.map +1 -1
  86. package/lib/components/forms/select/select.template.js +5 -1
  87. package/lib/components/forms/textarea/textarea.component.d.ts +10 -3
  88. package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
  89. package/lib/components/forms/textarea/textarea.component.js +10 -5
  90. package/lib/components/forms/textarea/textarea.template.d.ts.map +1 -1
  91. package/lib/components/forms/textarea/textarea.template.js +2 -0
  92. package/lib/components/forms/time-picker/time-picker.component.d.ts +16 -0
  93. package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
  94. package/lib/components/forms/time-picker/time-picker.component.js +43 -3
  95. package/lib/components/foundation/container/container.component.js +5 -5
  96. package/lib/components/foundation/container/container.styles.d.ts.map +1 -1
  97. package/lib/components/foundation/container/container.styles.js +10 -0
  98. package/lib/components/foundation/stack/stack.component.d.ts +6 -0
  99. package/lib/components/foundation/stack/stack.component.d.ts.map +1 -1
  100. package/lib/components/foundation/stack/stack.component.js +11 -5
  101. package/lib/components/foundation/stack/stack.styles.d.ts.map +1 -1
  102. package/lib/components/foundation/stack/stack.styles.js +14 -0
  103. package/lib/components/general/icon/icon.template.d.ts.map +1 -1
  104. package/lib/components/general/icon/icon.template.js +7 -1
  105. package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
  106. package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +2 -1
  107. package/lib/components/navigation/functions/match-by-route.function.d.ts +16 -0
  108. package/lib/components/navigation/functions/match-by-route.function.d.ts.map +1 -0
  109. package/lib/components/navigation/functions/match-by-route.function.js +34 -0
  110. package/lib/components/navigation/functions/route-link.function.d.ts +20 -0
  111. package/lib/components/navigation/functions/route-link.function.d.ts.map +1 -0
  112. package/lib/components/navigation/functions/route-link.function.js +34 -0
  113. package/lib/components/navigation/pagination/pagination.component.d.ts +8 -0
  114. package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
  115. package/lib/components/navigation/pagination/pagination.component.js +12 -2
  116. package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
  117. package/lib/components/navigation/pagination/pagination.styles.js +10 -0
  118. package/lib/components/navigation/pagination/pagination.template.js +2 -2
  119. package/lib/components/navigation/sidebar/sidebar-item.template.d.ts.map +1 -1
  120. package/lib/components/navigation/sidebar/sidebar-item.template.js +5 -1
  121. package/lib/components/navigation/sidebar/sidebar.component.d.ts +12 -6
  122. package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
  123. package/lib/components/navigation/sidebar/sidebar.component.js +20 -12
  124. package/lib/components/navigation/sidebar/sidebar.template.d.ts.map +1 -1
  125. package/lib/components/navigation/sidebar/sidebar.template.js +5 -1
  126. package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
  127. package/lib/components/navigation/steps/step.component.js +19 -1
  128. package/lib/components/navigation/steps/step.template.d.ts.map +1 -1
  129. package/lib/components/navigation/steps/step.template.js +6 -0
  130. package/lib/components/navigation/steps/steps.component.d.ts +10 -0
  131. package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
  132. package/lib/components/navigation/steps/steps.component.js +42 -9
  133. package/lib/components/navigation/steps/steps.template.js +9 -0
  134. package/lib/components/navigation/tabs/tab-panel.styles.d.ts.map +1 -1
  135. package/lib/components/navigation/tabs/tab-panel.styles.js +7 -2
  136. package/lib/components/navigation/tabs/tabs.component.d.ts +10 -0
  137. package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
  138. package/lib/components/navigation/tabs/tabs.component.js +36 -7
  139. package/lib/components/overlays/dialog/dialog-ref.class.d.ts +19 -9
  140. package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
  141. package/lib/components/overlays/dialog/dialog-ref.class.js +37 -5
  142. package/lib/components/overlays/dropdown/dropdown.component.d.ts +7 -0
  143. package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
  144. package/lib/components/overlays/dropdown/dropdown.component.js +26 -11
  145. package/lib/components/overlays/popover/popover.component.d.ts +8 -0
  146. package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
  147. package/lib/components/overlays/popover/popover.component.js +17 -0
  148. package/lib/components/overlays/tooltip/tooltip.component.d.ts +6 -5
  149. package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
  150. package/lib/components/overlays/tooltip/tooltip.component.js +14 -10
  151. package/lib/components/sections/app-shell/app-shell.component.d.ts +13 -0
  152. package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
  153. package/lib/components/sections/app-shell/app-shell.component.js +45 -1
  154. package/lib/components/sections/app-shell/app-shell.styles.d.ts.map +1 -1
  155. package/lib/components/sections/app-shell/app-shell.styles.js +15 -0
  156. package/lib/components/sections/app-shell/app-shell.template.d.ts.map +1 -1
  157. package/lib/components/sections/app-shell/app-shell.template.js +5 -0
  158. package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
  159. package/lib/components/sections/page-section/page-section.template.js +6 -1
  160. package/lib/directives/tooltip.directive.d.ts.map +1 -1
  161. package/lib/directives/tooltip.directive.js +39 -6
  162. package/lib/theme/functions/apply-theme.function.d.ts +4 -1
  163. package/lib/theme/functions/apply-theme.function.d.ts.map +1 -1
  164. package/lib/theme/functions/apply-theme.function.js +20 -4
  165. package/lib/theme/functions/create-theme.function.js +0 -1
  166. package/lib/utils/accessibility/cross-root-aria.d.ts +40 -0
  167. package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -0
  168. package/lib/utils/accessibility/cross-root-aria.js +97 -0
  169. package/lib/utils/accessibility/index.d.ts +1 -0
  170. package/lib/utils/accessibility/index.d.ts.map +1 -1
  171. package/lib/utils/accessibility/index.js +1 -0
  172. package/lib/utils/directives/index.d.ts +1 -0
  173. package/lib/utils/directives/index.d.ts.map +1 -1
  174. package/lib/utils/directives/index.js +1 -0
  175. package/lib/utils/directives/watch-light-slots.d.ts +20 -0
  176. package/lib/utils/directives/watch-light-slots.d.ts.map +1 -0
  177. package/lib/utils/directives/watch-light-slots.js +36 -0
  178. package/package.json +2 -2
@@ -26,6 +26,8 @@ registerAdapter((el) => el.tagName === 'ML-SELECT', {
26
26
  },
27
27
  setDisabled: (el, disabled) => { el.disabled = disabled; }
28
28
  });
29
+ /** Idle time after which the typeahead buffer resets (matches native select behavior) */
30
+ const TYPEAHEAD_RESET_MS = 700;
29
31
  /**
30
32
  * ml-select - Custom select/dropdown component
31
33
  *
@@ -99,6 +101,8 @@ let SelectComponent = class SelectComponent {
99
101
  }));
100
102
  this._lastCloseTime = 0;
101
103
  this._syncingValues = false;
104
+ this._typeaheadBuffer = '';
105
+ this._typeaheadLastTime = 0;
102
106
  /** Unique id for the option at the given display index */
103
107
  this.optionId = (index) => {
104
108
  return `${this.listboxId}-option-${index}`;
@@ -299,6 +303,7 @@ let SelectComponent = class SelectComponent {
299
303
  this.isOpen = false;
300
304
  this.focusedIndex = -1;
301
305
  this.search = '';
306
+ this._typeaheadBuffer = '';
302
307
  this._lastCloseTime = Date.now();
303
308
  this.stopPositioning();
304
309
  this.elementRef.dispatchEvent(new CustomEvent('ml:close', { bubbles: true, composed: true }));
@@ -327,8 +332,13 @@ let SelectComponent = class SelectComponent {
327
332
  switch (event.key) {
328
333
  case 'Enter':
329
334
  case ' ':
330
- if (isSearchInput)
335
+ // Space types a space in the search box, but Enter must commit
336
+ // the focused option from there too — in multiple mode the
337
+ // search input holds focus for the whole interaction, so Enter
338
+ // could not select anything at all.
339
+ if (isSearchInput && (event.key === ' ' || !this.isOpen || this.focusedIndex < 0)) {
331
340
  return;
341
+ }
332
342
  event.preventDefault();
333
343
  if (this.isOpen && this.focusedIndex >= 0) {
334
344
  const option = this.getActiveOptions()[this.focusedIndex];
@@ -341,6 +351,13 @@ let SelectComponent = class SelectComponent {
341
351
  }
342
352
  break;
343
353
  case 'Escape':
354
+ // Only claim Escape while the listbox is actually open.
355
+ // preventDefault() on a closed control cancelled the platform's
356
+ // close-watcher, so an enclosing dialog or drawer could not be
357
+ // dismissed with Escape while focus sat on this field.
358
+ if (!this.isOpen) {
359
+ return;
360
+ }
344
361
  event.preventDefault();
345
362
  this.close();
346
363
  break;
@@ -363,21 +380,76 @@ let SelectComponent = class SelectComponent {
363
380
  event.preventDefault();
364
381
  if (this.isOpen) {
365
382
  this.focusedIndex = this.findFirstEnabledIndex();
383
+ this.scrollFocusedOptionIntoView();
366
384
  }
367
385
  break;
368
386
  case 'End':
369
387
  event.preventDefault();
370
388
  if (this.isOpen) {
371
389
  this.focusedIndex = this.findLastEnabledIndex();
390
+ this.scrollFocusedOptionIntoView();
372
391
  }
373
392
  break;
374
393
  case 'Tab':
375
394
  this.close();
376
395
  break;
377
396
  default:
397
+ if (!isSearchInput) {
398
+ this.handleTypeahead(event);
399
+ }
378
400
  break;
379
401
  }
380
402
  }
403
+ /** Native-select-style type-to-jump: accumulate printable characters and jump to the matching option */
404
+ handleTypeahead(event) {
405
+ if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey)
406
+ return;
407
+ event.preventDefault();
408
+ const now = Date.now();
409
+ if (now - this._typeaheadLastTime > TYPEAHEAD_RESET_MS) {
410
+ this._typeaheadBuffer = '';
411
+ }
412
+ this._typeaheadLastTime = now;
413
+ this._typeaheadBuffer += event.key.toLowerCase();
414
+ // Repeated presses of the same letter cycle through its matches instead of matching "mm..."
415
+ const isRepeatedChar = this._typeaheadBuffer.length > 1 &&
416
+ this._typeaheadBuffer.split('').every((char) => char === this._typeaheadBuffer[0]);
417
+ const query = isRepeatedChar ? this._typeaheadBuffer[0] : this._typeaheadBuffer;
418
+ const options = this.getActiveOptions();
419
+ const startIndex = this.isOpen
420
+ ? this.focusedIndex
421
+ : options.findIndex((opt) => opt.value === this.value);
422
+ const matchIndex = this.findTypeaheadMatch(query, startIndex);
423
+ if (matchIndex < 0)
424
+ return;
425
+ if (this.isOpen) {
426
+ this.focusedIndex = matchIndex;
427
+ this.scrollFocusedOptionIntoView();
428
+ return;
429
+ }
430
+ if (this.multiple)
431
+ return;
432
+ this.selectOption(options[matchIndex]);
433
+ }
434
+ /** Find the first enabled option whose label starts with query, searching forward from startIndex + 1 and wrapping */
435
+ findTypeaheadMatch(query, startIndex) {
436
+ const options = this.getActiveOptions();
437
+ for (let offset = 1; offset <= options.length; offset++) {
438
+ const index = (startIndex + offset) % options.length;
439
+ const option = options[index];
440
+ if (!option.disabled && option.label.toLowerCase().startsWith(query)) {
441
+ return index;
442
+ }
443
+ }
444
+ return -1;
445
+ }
446
+ /** Keep the keyboard-focused option visible within the scrollable dropdown */
447
+ scrollFocusedOptionIntoView() {
448
+ if (this.focusedIndex < 0)
449
+ return;
450
+ const optionEl = this.elementRef.shadowRoot?.getElementById(this.optionId(this.focusedIndex));
451
+ optionEl?.scrollIntoView({ block: 'nearest' });
452
+ }
381
453
  /** Move focus to next enabled option */
382
454
  focusNextOption() {
383
455
  const startIndex = this.focusedIndex;
@@ -386,6 +458,7 @@ let SelectComponent = class SelectComponent {
386
458
  while (index < options.length) {
387
459
  if (!options[index].disabled) {
388
460
  this.focusedIndex = index;
461
+ this.scrollFocusedOptionIntoView();
389
462
  return;
390
463
  }
391
464
  index++;
@@ -399,6 +472,7 @@ let SelectComponent = class SelectComponent {
399
472
  while (index >= 0) {
400
473
  if (!options[index].disabled) {
401
474
  this.focusedIndex = index;
475
+ this.scrollFocusedOptionIntoView();
402
476
  return;
403
477
  }
404
478
  index--;
@@ -1 +1 @@
1
- {"version":3,"file":"select.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,6CAqEhD"}
1
+ {"version":3,"file":"select.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,6CAwEhD"}
@@ -45,7 +45,11 @@ export function selectTemplate(c) {
45
45
  aria-multiselectable=${c.multiple || false}
46
46
  >
47
47
  ${c.filteredOptions.length
48
- ? repeat(c.filteredOptions, (option) => `${option.value}-${c.multiple ? c.values.includes(option.value) : c.value === option.value}`, (option, index) => renderOption(c, option, index))
48
+ ? repeat(c.filteredOptions,
49
+ // Key by identity only. Embedding the selection state in the
50
+ // key made every toggle destroy and rebuild the option's
51
+ // DOM — losing hover, focus and any in-flight click.
52
+ (option) => option.value, (option, index) => renderOption(c, option, index))
49
53
  : html `<div class="ml-select__empty">No results found</div>`}
50
54
  </div>
51
55
  </div>
@@ -1,4 +1,4 @@
1
- import type { IElementRef, OnInit } from '@melodicdev/core';
1
+ import type { IElementRef } from '@melodicdev/core';
2
2
  import type { ControlSize } from '../../../types/index.js';
3
3
  /**
4
4
  * ml-textarea - Multi-line text input component
@@ -15,7 +15,7 @@ import type { ControlSize } from '../../../types/index.js';
15
15
  * @fires ml:focus - Emitted on focus
16
16
  * @fires ml:blur - Emitted on blur
17
17
  */
18
- export declare class TextareaComponent implements IElementRef, OnInit {
18
+ export declare class TextareaComponent implements IElementRef {
19
19
  elementRef: HTMLElement;
20
20
  /** Current value */
21
21
  value: string;
@@ -43,7 +43,14 @@ export declare class TextareaComponent implements IElementRef, OnInit {
43
43
  resize: boolean;
44
44
  /** Internal focus state */
45
45
  focused: boolean;
46
- onInit(): void;
46
+ /** Form field name, forwarded to the inner textarea. */
47
+ name: string;
48
+ /**
49
+ * Accessible name for the inner control when there is no visible label.
50
+ * An `aria-label` on the HOST names the custom element, not the
51
+ * `<textarea>` inside its shadow root.
52
+ */
53
+ get fieldLabel(): string;
47
54
  handleInput: (event: Event) => void;
48
55
  handleChange: (event: Event) => void;
49
56
  handleFocus: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;;;GAcG;AACH,qBAMa,iBAAkB,YAAW,WAAW,EAAE,MAAM;IACrD,UAAU,EAAG,WAAW,CAAC;IAEhC,oBAAoB;IACb,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAM;IAExB,iBAAiB;IACV,KAAK,SAAM;IAElB,qCAAqC;IAC9B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,mCAAmC;IAC5B,IAAI,SAAK;IAEhB,+BAA+B;IACxB,SAAS,SAAK;IAErB,2BAA2B;IACpB,QAAQ,UAAS;IAExB,6BAA6B;IACtB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,4BAA4B;IACrB,MAAM,UAAS;IAEtB,2BAA2B;IACpB,OAAO,UAAS;IAEhB,MAAM,IAAI,IAAI;IAMd,WAAW,GAAI,OAAO,KAAK,KAAG,IAAI,CAWvC;IAEK,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAWxC;IAEK,WAAW,QAAO,IAAI,CAQ3B;IAEK,UAAU,QAAO,IAAI,CAQ1B;CACF"}
1
+ {"version":3,"file":"textarea.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;;;GAcG;AACH,qBAMa,iBAAkB,YAAW,WAAW;IAC7C,UAAU,EAAG,WAAW,CAAC;IAEhC,oBAAoB;IACb,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAM;IAExB,iBAAiB;IACV,KAAK,SAAM;IAElB,qCAAqC;IAC9B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,mCAAmC;IAC5B,IAAI,SAAK;IAEhB,+BAA+B;IACxB,SAAS,SAAK;IAErB,2BAA2B;IACpB,QAAQ,UAAS;IAExB,6BAA6B;IACtB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,4BAA4B;IACrB,MAAM,UAAS;IAEtB,2BAA2B;IACpB,OAAO,UAAS;IAEvB,wDAAwD;IACjD,IAAI,SAAM;IAEjB;;;;OAIG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;IAEM,WAAW,GAAI,OAAO,KAAK,KAAG,IAAI,CAWvC;IAEK,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAWxC;IAEK,WAAW,QAAO,IAAI,CAQ3B;IAEK,UAAU,QAAO,IAAI,CAQ1B;CACF"}
@@ -58,6 +58,8 @@ let TextareaComponent = class TextareaComponent {
58
58
  this.resize = false;
59
59
  /** Internal focus state */
60
60
  this.focused = false;
61
+ /** Form field name, forwarded to the inner textarea. */
62
+ this.name = '';
61
63
  this.handleInput = (event) => {
62
64
  const target = event.target;
63
65
  this.value = target.value;
@@ -91,10 +93,13 @@ let TextareaComponent = class TextareaComponent {
91
93
  }));
92
94
  };
93
95
  }
94
- onInit() {
95
- if (!this.label && this.placeholder) {
96
- this.elementRef.setAttribute('aria-label', this.placeholder);
97
- }
96
+ /**
97
+ * Accessible name for the inner control when there is no visible label.
98
+ * An `aria-label` on the HOST names the custom element, not the
99
+ * `<textarea>` inside its shadow root.
100
+ */
101
+ get fieldLabel() {
102
+ return this.label || this.elementRef?.getAttribute('aria-label') || this.placeholder || '';
98
103
  }
99
104
  };
100
105
  TextareaComponent = __decorate([
@@ -102,7 +107,7 @@ TextareaComponent = __decorate([
102
107
  selector: 'ml-textarea',
103
108
  template: textareaTemplate,
104
109
  styles: textareaStyles,
105
- attributes: ['value', 'placeholder', 'label', 'hint', 'error', 'size', 'rows', 'max-length', 'disabled', 'readonly', 'required', 'resize']
110
+ attributes: ['value', 'placeholder', 'label', 'hint', 'error', 'size', 'rows', 'max-length', 'disabled', 'readonly', 'required', 'resize', 'name']
106
111
  })
107
112
  ], TextareaComponent);
108
113
  export { TextareaComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CAwDpD"}
1
+ {"version":3,"file":"textarea.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CA0DpD"}
@@ -29,6 +29,8 @@ export function textareaTemplate(c) {
29
29
  ?readonly=${c.readonly}
30
30
  ?required=${c.required}
31
31
  maxlength="${c.maxLength || ''}"
32
+ name="${c.name}"
33
+ aria-label=${c.label ? '' : c.fieldLabel}
32
34
  aria-invalid=${c.error ? 'true' : 'false'}
33
35
  aria-describedby=${c.error ? 'error' : c.hint ? 'hint' : ''}
34
36
  @input=${c.handleInput}
@@ -86,7 +86,23 @@ export declare class TimePickerComponent implements IElementRef, OnCreate, OnDes
86
86
  private closePopover;
87
87
  private startPositioning;
88
88
  private updatePosition;
89
+ /**
90
+ * Return focus to the input — but only when focus was still inside this
91
+ * component (Escape, a selection, a click on the trigger). Closing because
92
+ * the user clicked or tabbed somewhere else used to yank focus back here,
93
+ * which made the picker impossible to leave.
94
+ */
89
95
  private returnFocus;
96
+ /** Minutes since midnight for an `HH:mm[:ss]` string, or null. */
97
+ private toMinutes;
98
+ /**
99
+ * Clamp the edited time into the `min`/`max` window.
100
+ *
101
+ * The typed-input path validated against min/max; the popover's steppers
102
+ * and Now button did not, so the picker happily produced an out-of-range
103
+ * value the same component would reject when typed.
104
+ */
105
+ private clampEditToRange;
90
106
  private getInputEl;
91
107
  private getTriggerEl;
92
108
  private getPopoverEl;
@@ -1 +1 @@
1
- {"version":3,"file":"time-picker.component.d.ts","sourceR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K,eAAe,QAAO,IAAI,CAE/B;IAEK,eAAe,QAAO,IAAI,CAE/B;IAEK,eAAe,QAAO,IAAI,CAE/B;IAEK,YAAY,QAAO,IAAI,CAI5B;IAEK,gBAAgB,QAAO,IAAI,CAQhC;IAEK,cAAc,QAAO,IAAI,CAO9B;IAEF,uDAAuD;IAChD,eAAe,GAAI,OAAO,KAAK,KAAG,IAAI,CAG3C;IAEF,2CAA2C;IACpC,gBAAgB,QAAO,IAAI,CAIhC;IAEK,aAAa,GAAI,OAAO,aAAa,KAAG,IAAI,CAmBjD;IAEK,eAAe,GAAI,OAAO,KAAK,KAAG,IAAI,CAa3C;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAO7C;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAO7C;IAEK,cAAc,QAAO,IAAI,CAK9B;IAEK,gBAAgB,QAAO,IAAI,CAEhC;IAEK,gBAAgB,QAAO,IAAI,CAEhC;IAEK,gBAAgB,GAAI,OAAO,KAAK,KAAG,IAAI,CAE5C;IAEK,oBAAoB,GAAI,OAAO,aAAa,KAAG,IAAI,CAkBxD;IAEF,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAY5B;IAEF,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,cAAc;IAUtB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAWnB,kEAAkE;IAClE,OAAO,CAAC,SAAS;IAWjB;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAGpB"}
@@ -9,6 +9,7 @@ import { registerAdapter } from '@melodicdev/core/forms';
9
9
  import { computePosition, autoUpdate, offset, flip, shift } from '../../../utils/positioning/index.js';
10
10
  import { timePickerTemplate } from './time-picker.template.js';
11
11
  import { timePickerStyles } from './time-picker.styles.js';
12
+ import { getDeepActiveElement } from '../../../utils/accessibility/focus-trap.js';
12
13
  registerAdapter((el) => el.tagName === 'ML-TIME-PICKER', {
13
14
  inputEvent: 'ml:change',
14
15
  blurEvent: 'focusout',
@@ -141,6 +142,7 @@ let TimePickerComponent = class TimePickerComponent {
141
142
  this.editHour = this.to24Hour(h12, this.editPeriod);
142
143
  };
143
144
  this.confirmSelection = () => {
145
+ this.clampEditToRange();
144
146
  let timeStr = `${pad(this.editHour)}:${pad(this.editMinute)}`;
145
147
  if (this.showSeconds) {
146
148
  timeStr += `:${pad(this.editSecond)}`;
@@ -154,6 +156,7 @@ let TimePickerComponent = class TimePickerComponent {
154
156
  this.editMinute = now.getMinutes();
155
157
  this.editSecond = now.getSeconds();
156
158
  this.editPeriod = this.editHour >= 12 ? 'PM' : 'AM';
159
+ this.clampEditToRange();
157
160
  };
158
161
  /** Called when the user types a time into the input */
159
162
  this.handleTimeInput = (event) => {
@@ -374,11 +377,48 @@ let TimePickerComponent = class TimePickerComponent {
374
377
  popoverEl.style.left = `${x}px`;
375
378
  popoverEl.style.top = `${y}px`;
376
379
  }
380
+ /**
381
+ * Return focus to the input — but only when focus was still inside this
382
+ * component (Escape, a selection, a click on the trigger). Closing because
383
+ * the user clicked or tabbed somewhere else used to yank focus back here,
384
+ * which made the picker impossible to leave.
385
+ */
377
386
  returnFocus() {
378
- const inputEl = this.getInputEl();
379
- if (inputEl) {
380
- inputEl.focus();
387
+ const active = getDeepActiveElement();
388
+ const focusMovedAway = active !== null && active !== document.body && !this.elementRef.contains(active) && !this.elementRef.shadowRoot?.contains(active);
389
+ if (focusMovedAway) {
390
+ return;
391
+ }
392
+ this.getInputEl()?.focus();
393
+ }
394
+ /** Minutes since midnight for an `HH:mm[:ss]` string, or null. */
395
+ toMinutes(time) {
396
+ const parts = time.split(':');
397
+ if (parts.length < 2) {
398
+ return null;
381
399
  }
400
+ const hours = Number.parseInt(parts[0], 10);
401
+ const minutes = Number.parseInt(parts[1], 10);
402
+ return Number.isNaN(hours) || Number.isNaN(minutes) ? null : hours * 60 + minutes;
403
+ }
404
+ /**
405
+ * Clamp the edited time into the `min`/`max` window.
406
+ *
407
+ * The typed-input path validated against min/max; the popover's steppers
408
+ * and Now button did not, so the picker happily produced an out-of-range
409
+ * value the same component would reject when typed.
410
+ */
411
+ clampEditToRange() {
412
+ const current = this.editHour * 60 + this.editMinute;
413
+ const min = this.min ? this.toMinutes(this.min) : null;
414
+ const max = this.max ? this.toMinutes(this.max) : null;
415
+ const clamped = min !== null && current < min ? min : max !== null && current > max ? max : current;
416
+ if (clamped === current) {
417
+ return;
418
+ }
419
+ this.editHour = Math.floor(clamped / 60);
420
+ this.editMinute = clamped % 60;
421
+ this.editPeriod = this.editHour >= 12 ? 'PM' : 'AM';
382
422
  }
383
423
  getInputEl() {
384
424
  return this.elementRef.shadowRoot?.querySelector('.ml-time-picker__input');
@@ -40,12 +40,12 @@ let ContainerComponent = class ContainerComponent {
40
40
  xl: '1280px',
41
41
  full: '100%'
42
42
  };
43
+ // Component-scoped custom properties, not inline declarations — see the
44
+ // note on ml-stack.getStyles().
43
45
  return {
44
- 'max-width': maxWidthMap[this.size],
45
- 'padding-left': `var(--ml-space-${this.padding})`,
46
- 'padding-right': `var(--ml-space-${this.padding})`,
47
- 'margin-left': this.centered ? 'auto' : '0',
48
- 'margin-right': this.centered ? 'auto' : '0'
46
+ '--ml-container-max-width': maxWidthMap[this.size],
47
+ '--ml-container-padding-x': `var(--ml-space-${this.padding})`,
48
+ '--ml-container-margin-x': this.centered ? 'auto' : '0'
49
49
  };
50
50
  }
51
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"container.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/container/container.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,iDAS3B,CAAC"}
1
+ {"version":3,"file":"container.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/container/container.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,iDAmB3B,CAAC"}
@@ -1,11 +1,21 @@
1
1
  import { css } from '@melodicdev/core';
2
2
  export const containerStyles = () => css `
3
3
  :host {
4
+ /* ── Container: layout ── */
5
+ --ml-container-max-width: 1024px;
6
+ --ml-container-padding-x: var(--ml-space-4);
7
+ --ml-container-margin-x: auto;
8
+
4
9
  display: block;
5
10
  width: 100%;
6
11
  }
7
12
 
8
13
  .ml-container {
9
14
  width: 100%;
15
+ max-width: var(--ml-container-max-width);
16
+ padding-left: var(--ml-container-padding-x);
17
+ padding-right: var(--ml-container-padding-x);
18
+ margin-left: var(--ml-container-margin-x);
19
+ margin-right: var(--ml-container-margin-x);
10
20
  }
11
21
  `;
@@ -30,6 +30,12 @@ export declare class StackComponent implements IElementRef {
30
30
  justify: Justify;
31
31
  /** Allow items to wrap */
32
32
  wrap: boolean;
33
+ /**
34
+ * Layout values, exposed as component-scoped custom properties rather than
35
+ * inline declarations. An inline `style` beats every stylesheet rule, so
36
+ * inline layout could not be overridden — not by a token, not by a class,
37
+ * not by a media query.
38
+ */
33
39
  getStyles(): Record<string, string>;
34
40
  }
35
41
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"stack.component.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,KAAK,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,sBAAsB;IACf,SAAS,EAAE,WAAW,CAAc;IAE3C,mDAAmD;IAC5C,GAAG,EAAE,MAAM,CAAO;IAEzB,2BAA2B;IACpB,KAAK,EAAE,SAAS,CAAa;IAEpC,8BAA8B;IACvB,OAAO,EAAE,OAAO,CAAW;IAElC,0BAA0B;IACnB,IAAI,UAAS;IAEb,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CA0B1C"}
1
+ {"version":3,"file":"stack.component.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,KAAK,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,sBAAsB;IACf,SAAS,EAAE,WAAW,CAAc;IAE3C,mDAAmD;IAC5C,GAAG,EAAE,MAAM,CAAO;IAEzB,2BAA2B;IACpB,KAAK,EAAE,SAAS,CAAa;IAEpC,8BAA8B;IACvB,OAAO,EAAE,OAAO,CAAW;IAElC,0BAA0B;IACnB,IAAI,UAAS;IAEpB;;;;;OAKG;IACI,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CA0B1C"}
@@ -36,6 +36,12 @@ let StackComponent = class StackComponent {
36
36
  /** Allow items to wrap */
37
37
  this.wrap = false;
38
38
  }
39
+ /**
40
+ * Layout values, exposed as component-scoped custom properties rather than
41
+ * inline declarations. An inline `style` beats every stylesheet rule, so
42
+ * inline layout could not be overridden — not by a token, not by a class,
43
+ * not by a media query.
44
+ */
39
45
  getStyles() {
40
46
  const alignMap = {
41
47
  start: 'flex-start',
@@ -53,11 +59,11 @@ let StackComponent = class StackComponent {
53
59
  evenly: 'space-evenly'
54
60
  };
55
61
  return {
56
- 'flex-direction': this.direction === 'vertical' ? 'column' : 'row',
57
- gap: `var(--ml-space-${this.gap})`,
58
- 'align-items': alignMap[this.align],
59
- 'justify-content': justifyMap[this.justify],
60
- 'flex-wrap': this.wrap ? 'wrap' : 'nowrap'
62
+ '--ml-stack-direction': this.direction === 'vertical' ? 'column' : 'row',
63
+ '--ml-stack-gap': `var(--ml-space-${this.gap})`,
64
+ '--ml-stack-align': alignMap[this.align],
65
+ '--ml-stack-justify': justifyMap[this.justify],
66
+ '--ml-stack-wrap': this.wrap ? 'wrap' : 'nowrap'
61
67
  };
62
68
  }
63
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"stack.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDAQvB,CAAC"}
1
+ {"version":3,"file":"stack.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDAsBvB,CAAC"}
@@ -1,10 +1,24 @@
1
1
  import { css } from '@melodicdev/core';
2
2
  export const stackStyles = () => css `
3
3
  :host {
4
+ /* ── Stack: layout ──
5
+ Set from the component's properties; override any of them from a
6
+ parent rule to change the layout without touching the markup. */
7
+ --ml-stack-direction: row;
8
+ --ml-stack-gap: var(--ml-space-4);
9
+ --ml-stack-align: stretch;
10
+ --ml-stack-justify: flex-start;
11
+ --ml-stack-wrap: nowrap;
12
+
4
13
  display: block;
5
14
  }
6
15
 
7
16
  .ml-stack {
8
17
  display: flex;
18
+ flex-direction: var(--ml-stack-direction);
19
+ gap: var(--ml-stack-gap);
20
+ align-items: var(--ml-stack-align);
21
+ justify-content: var(--ml-stack-justify);
22
+ flex-wrap: var(--ml-stack-wrap);
9
23
  }
10
24
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"icon.template.d.ts","sourceRoot":"","sources":["../../../../src/components/general/icon/icon.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,YAAY,GAAI,GAAG,aAAa,8CAO5C,CAAC"}
1
+ {"version":3,"file":"icon.template.d.ts","sourceRoot":"","sources":["../../../../src/components/general/icon/icon.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,YAAY,GAAI,GAAG,aAAa,8CAiB5C,CAAC"}
@@ -1,8 +1,14 @@
1
- import { html } from '@melodicdev/core';
1
+ import { html, devWarn } from '@melodicdev/core';
2
2
  import { PHOSPHOR_ICON_MAP } from './icon.map.js';
3
3
  export const iconTemplate = (c) => {
4
4
  const className = c.format === 'regular' ? 'ph' : `ph-${c.format}`;
5
5
  const codepoint = PHOSPHOR_ICON_MAP[c.icon] ?? '';
6
+ // An unknown name rendered an empty <i> with no diagnostic, so a typo was
7
+ // invisible: the icon simply did not appear.
8
+ if (c.icon && !codepoint) {
9
+ devWarn(`unknown-icon:${c.icon}`, `<ml-icon icon="${c.icon}"> is not a known Phosphor icon name, so nothing is rendered. ` +
10
+ 'Check the name against https://phosphoricons.com (kebab-case, e.g. "caret-double-left").');
11
+ }
6
12
  // aria-hidden: the ligature codepoint is presentational; without it screen
7
13
  // readers announce the raw private-use character.
8
14
  return html `<i class="${className}" aria-hidden="true">${codepoint}</i>`;
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumb-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/breadcrumb/breadcrumb-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,uBAAuB,6CA8BhE"}
1
+ {"version":3,"file":"breadcrumb-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/breadcrumb/breadcrumb-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAG9E,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,uBAAuB,6CA8BhE"}
@@ -1,4 +1,5 @@
1
1
  import { html, classMap, when } from '@melodicdev/core';
2
+ import { routeAnchorClick } from '../functions/route-link.function.js';
2
3
  export function breadcrumbItemTemplate(c) {
3
4
  const separatorIcon = c.separator === 'slash' ? 'slash-forward' : 'caret-right';
4
5
  return html `
@@ -12,7 +13,7 @@ export function breadcrumbItemTemplate(c) {
12
13
  <ml-icon icon=${separatorIcon} size="sm"></ml-icon>
13
14
  </span>
14
15
  ${when(!!c.href && !c.current, () => html `
15
- <a class="ml-breadcrumb-item__link" href=${c.href}>
16
+ <a class="ml-breadcrumb-item__link" href=${c.href} @click=${(event) => routeAnchorClick(event, c.href)}>
16
17
  ${when(!!c.icon, () => html `<ml-icon icon=${c.icon} size="sm"></ml-icon>`)}
17
18
  <slot></slot>
18
19
  </a>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Pick the entry whose `href` best matches `path`.
3
+ *
4
+ * A plain `startsWith` + first match let a shorter href shadow a longer one:
5
+ * with `/admin` declared before `/admin/users`, every page under `/admin`
6
+ * highlighted the `/admin` tab. Matching is therefore:
7
+ *
8
+ * 1. an exact path match, else
9
+ * 2. the LONGEST href that is a path-segment prefix of `path` — `/admin` matches
10
+ * `/admin/users` but not `/administration`.
11
+ */
12
+ export declare function matchTabByRoute<T extends {
13
+ href?: string;
14
+ value: string;
15
+ }>(entries: T[], path: string): T | undefined;
16
+ //# sourceMappingURL=match-by-route.function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-by-route.function.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/functions/match-by-route.function.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAwBrH"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Pick the entry whose `href` best matches `path`.
3
+ *
4
+ * A plain `startsWith` + first match let a shorter href shadow a longer one:
5
+ * with `/admin` declared before `/admin/users`, every page under `/admin`
6
+ * highlighted the `/admin` tab. Matching is therefore:
7
+ *
8
+ * 1. an exact path match, else
9
+ * 2. the LONGEST href that is a path-segment prefix of `path` — `/admin` matches
10
+ * `/admin/users` but not `/administration`.
11
+ */
12
+ export function matchTabByRoute(entries, path) {
13
+ const normalized = normalize(path);
14
+ let best;
15
+ let bestLength = -1;
16
+ for (const entry of entries) {
17
+ if (!entry.href) {
18
+ continue;
19
+ }
20
+ const href = normalize(entry.href.split(/[?#]/)[0]);
21
+ if (href === normalized) {
22
+ return entry;
23
+ }
24
+ if (normalized.startsWith(`${href === '/' ? '' : href}/`) && href.length > bestLength) {
25
+ best = entry;
26
+ bestLength = href.length;
27
+ }
28
+ }
29
+ return best;
30
+ }
31
+ function normalize(path) {
32
+ const withSlash = path.startsWith('/') ? path : `/${path}`;
33
+ return withSlash.length > 1 ? withSlash.replace(/\/+$/, '') : withSlash;
34
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Intercept an anchor click and route it through the router when possible.
3
+ *
4
+ * Navigation components rendered raw `<a href>` elements with no
5
+ * `preventDefault`, so clicking one triggered a full page load — while tabs and
6
+ * steps in the same app navigated client-side. That inconsistency reloads the
7
+ * whole SPA (losing state) on what looks like ordinary in-app navigation.
8
+ *
9
+ * Native behaviour is preserved where it is the right thing:
10
+ * - modifier / non-primary clicks (new tab, new window, download)
11
+ * - external links, explicit `target`, and non-http(s) schemes
12
+ * - apps with no router registered
13
+ *
14
+ * Returns true when the router handled it.
15
+ */
16
+ export declare function routeAnchorClick(event: MouseEvent, href: string, options?: {
17
+ external?: boolean;
18
+ target?: string;
19
+ }): boolean;
20
+ //# sourceMappingURL=route-link.function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-link.function.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/functions/route-link.function.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAqBhI"}