@melodicdev/components 3.1.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.
- package/assets/melodic-components.js +4269 -2377
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +5477 -3831
- package/lib/components/data-display/calendar-view/calendar-view-month.template.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view-month.template.js +17 -0
- package/lib/components/data-display/calendar-view/calendar-view.component.d.ts +23 -3
- package/lib/components/data-display/calendar-view/calendar-view.component.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.component.js +76 -21
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +9 -0
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.js +68 -19
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +24 -0
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +104 -31
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +3 -0
- package/lib/components/data-display/table/table.component.d.ts +7 -0
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +20 -5
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +3 -0
- package/lib/components/data-display/table-core/index.d.ts +1 -0
- package/lib/components/data-display/table-core/index.d.ts.map +1 -1
- package/lib/components/data-display/table-core/index.js +1 -0
- package/lib/components/data-display/table-core/memo.d.ts +10 -0
- package/lib/components/data-display/table-core/memo.d.ts.map +1 -0
- package/lib/components/data-display/table-core/memo.js +20 -0
- package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.styles.js +25 -0
- package/lib/components/feedback/progress/progress.styles.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.styles.js +8 -3
- package/lib/components/feedback/spinner/spinner.styles.d.ts.map +1 -1
- package/lib/components/feedback/spinner/spinner.styles.js +2 -11
- package/lib/components/feedback/toast/toast-container.template.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.template.js +4 -0
- package/lib/components/feedback/toast/toast.component.d.ts +3 -2
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +10 -0
- package/lib/components/feedback/toast/toast.service.d.ts +26 -6
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +53 -18
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +7 -0
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +39 -0
- package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.template.js +5 -1
- package/lib/components/forms/button-group/button-group.component.d.ts +3 -2
- package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.js +11 -1
- package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -0
- package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.component.js +5 -1
- package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.template.js +2 -0
- package/lib/components/forms/date-picker/calendar.component.d.ts +21 -0
- package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.component.js +69 -2
- package/lib/components/forms/date-picker/calendar.template.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.template.js +6 -3
- package/lib/components/forms/date-picker/date-picker.component.d.ts +6 -0
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +41 -12
- package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.component.js +15 -5
- package/lib/components/forms/form-field/form-field.component.d.ts +8 -0
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +41 -6
- package/lib/components/forms/form-field/form-field.template.js +1 -1
- package/lib/components/forms/input/input.component.d.ts +26 -3
- package/lib/components/forms/input/input.component.d.ts.map +1 -1
- package/lib/components/forms/input/input.component.js +46 -6
- package/lib/components/forms/input/input.template.d.ts.map +1 -1
- package/lib/components/forms/input/input.template.js +9 -0
- package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts +6 -0
- package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card-group.component.js +34 -0
- package/lib/components/forms/radio-card-group/radio-card.component.d.ts +6 -0
- package/lib/components/forms/radio-card-group/radio-card.component.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card.component.js +7 -1
- package/lib/components/forms/radio-card-group/radio-card.template.js +1 -1
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +13 -1
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +5 -1
- package/lib/components/forms/textarea/textarea.component.d.ts +10 -3
- package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.component.js +10 -5
- package/lib/components/forms/textarea/textarea.template.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.template.js +2 -0
- package/lib/components/forms/time-picker/time-picker.component.d.ts +16 -0
- package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.component.js +43 -3
- package/lib/components/foundation/container/container.component.js +5 -5
- package/lib/components/foundation/container/container.styles.d.ts.map +1 -1
- package/lib/components/foundation/container/container.styles.js +10 -0
- package/lib/components/foundation/stack/stack.component.d.ts +6 -0
- package/lib/components/foundation/stack/stack.component.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.component.js +11 -5
- package/lib/components/foundation/stack/stack.styles.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.styles.js +14 -0
- package/lib/components/general/icon/icon.template.d.ts.map +1 -1
- package/lib/components/general/icon/icon.template.js +7 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +2 -1
- package/lib/components/navigation/functions/match-by-route.function.d.ts +16 -0
- package/lib/components/navigation/functions/match-by-route.function.d.ts.map +1 -0
- package/lib/components/navigation/functions/match-by-route.function.js +34 -0
- package/lib/components/navigation/functions/route-link.function.d.ts +20 -0
- package/lib/components/navigation/functions/route-link.function.d.ts.map +1 -0
- package/lib/components/navigation/functions/route-link.function.js +34 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts +8 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.component.js +12 -2
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +10 -0
- package/lib/components/navigation/pagination/pagination.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar-item.template.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.template.js +5 -1
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +12 -6
- package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.component.js +20 -12
- package/lib/components/navigation/sidebar/sidebar.template.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.template.js +5 -1
- package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.component.js +19 -1
- package/lib/components/navigation/steps/step.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.template.js +6 -0
- package/lib/components/navigation/steps/steps.component.d.ts +10 -0
- package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.component.js +42 -9
- package/lib/components/navigation/steps/steps.template.js +9 -0
- package/lib/components/navigation/tabs/tab-panel.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.styles.js +7 -2
- package/lib/components/navigation/tabs/tabs.component.d.ts +10 -0
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +36 -7
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts +19 -9
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog-ref.class.js +37 -5
- package/lib/components/overlays/dropdown/dropdown.component.d.ts +7 -0
- package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.component.js +26 -11
- package/lib/components/overlays/popover/popover.component.d.ts +8 -0
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +17 -0
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +6 -5
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +14 -10
- package/lib/components/sections/app-shell/app-shell.component.d.ts +13 -0
- package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.component.js +45 -1
- package/lib/components/sections/app-shell/app-shell.styles.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.styles.js +15 -0
- package/lib/components/sections/app-shell/app-shell.template.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.template.js +5 -0
- package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.template.js +6 -1
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +39 -6
- package/lib/theme/functions/apply-theme.function.d.ts +4 -1
- package/lib/theme/functions/apply-theme.function.d.ts.map +1 -1
- package/lib/theme/functions/apply-theme.function.js +20 -4
- package/lib/theme/functions/create-theme.function.js +0 -1
- package/lib/utils/accessibility/cross-root-aria.d.ts +40 -0
- package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -0
- package/lib/utils/accessibility/cross-root-aria.js +97 -0
- package/lib/utils/accessibility/index.d.ts +1 -0
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -0
- package/lib/utils/directives/index.d.ts +1 -0
- package/lib/utils/directives/index.d.ts.map +1 -1
- package/lib/utils/directives/index.js +1 -0
- package/lib/utils/directives/watch-light-slots.d.ts +20 -0
- package/lib/utils/directives/watch-light-slots.d.ts.map +1 -0
- package/lib/utils/directives/watch-light-slots.js +36 -0
- package/package.json +2 -2
|
@@ -5,23 +5,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Injectable } from '@melodicdev/core';
|
|
8
|
-
/**
|
|
9
|
-
* ToastService - Injectable singleton for showing toast notifications from anywhere
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* @Service(ToastService)
|
|
14
|
-
* private readonly _toastService!: ToastService;
|
|
15
|
-
*
|
|
16
|
-
* this._toastService.success('Saved', 'Your changes have been saved.');
|
|
17
|
-
* this._toastService.error('Error', 'Something went wrong.');
|
|
18
|
-
* this._toastService.show({ variant: 'warning', title: 'Warning', message: '...' });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
8
|
let ToastService = class ToastService {
|
|
22
9
|
constructor() {
|
|
23
10
|
this._containerEl = null;
|
|
24
11
|
this._position = 'top-right';
|
|
12
|
+
/** Toasts currently on screen, oldest first. */
|
|
13
|
+
this._active = [];
|
|
14
|
+
this._maxVisible = 5;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Cap the number of toasts on screen at once (default 5, 0 = unlimited).
|
|
18
|
+
* Without a cap, a failing poll could stack hundreds of toasts over the
|
|
19
|
+
* whole viewport.
|
|
20
|
+
*/
|
|
21
|
+
setMaxVisible(max) {
|
|
22
|
+
this._maxVisible = Math.max(0, max);
|
|
23
|
+
this.enforceMaxVisible();
|
|
25
24
|
}
|
|
26
25
|
/** Set the default position for all toasts */
|
|
27
26
|
setPosition(position) {
|
|
@@ -30,7 +29,7 @@ let ToastService = class ToastService {
|
|
|
30
29
|
this._containerEl.setAttribute('position', position);
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
/** Show a toast with full configuration */
|
|
32
|
+
/** Show a toast with full configuration. Returns a handle for dismissing it. */
|
|
34
33
|
show(config) {
|
|
35
34
|
const container = this.ensureContainer();
|
|
36
35
|
const toast = document.createElement('ml-toast');
|
|
@@ -45,23 +44,59 @@ let ToastService = class ToastService {
|
|
|
45
44
|
toast.setAttribute('duration', String(config.duration));
|
|
46
45
|
if (config.dismissible === false)
|
|
47
46
|
toast.setAttribute('dismissible', 'false');
|
|
47
|
+
// An error toast is assertive; anything else is polite, so a success
|
|
48
|
+
// message does not interrupt what the user is reading. Every toast used
|
|
49
|
+
// to be role="alert", which interrupts.
|
|
50
|
+
toast.setAttribute('role', config.variant === 'error' ? 'alert' : 'status');
|
|
48
51
|
container.appendChild(toast);
|
|
52
|
+
this._active.push(toast);
|
|
53
|
+
toast.addEventListener('ml:dismiss', () => this.forget(toast), { once: true });
|
|
54
|
+
this.enforceMaxVisible();
|
|
55
|
+
return {
|
|
56
|
+
element: toast,
|
|
57
|
+
dismiss: () => {
|
|
58
|
+
this.forget(toast);
|
|
59
|
+
toast.remove();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
49
62
|
}
|
|
50
63
|
/** Show an info toast */
|
|
51
64
|
info(title, message) {
|
|
52
|
-
this.show({ variant: 'info', title, message });
|
|
65
|
+
return this.show({ variant: 'info', title, message });
|
|
53
66
|
}
|
|
54
67
|
/** Show a success toast */
|
|
55
68
|
success(title, message) {
|
|
56
|
-
this.show({ variant: 'success', title, message });
|
|
69
|
+
return this.show({ variant: 'success', title, message });
|
|
57
70
|
}
|
|
58
71
|
/** Show a warning toast */
|
|
59
72
|
warning(title, message) {
|
|
60
|
-
this.show({ variant: 'warning', title, message });
|
|
73
|
+
return this.show({ variant: 'warning', title, message });
|
|
61
74
|
}
|
|
62
75
|
/** Show an error toast */
|
|
63
76
|
error(title, message) {
|
|
64
|
-
this.show({ variant: 'error', title, message });
|
|
77
|
+
return this.show({ variant: 'error', title, message });
|
|
78
|
+
}
|
|
79
|
+
/** Remove every toast currently on screen. */
|
|
80
|
+
dismissAll() {
|
|
81
|
+
for (const toast of [...this._active]) {
|
|
82
|
+
toast.remove();
|
|
83
|
+
}
|
|
84
|
+
this._active.length = 0;
|
|
85
|
+
}
|
|
86
|
+
forget(toast) {
|
|
87
|
+
const index = this._active.indexOf(toast);
|
|
88
|
+
if (index !== -1) {
|
|
89
|
+
this._active.splice(index, 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
enforceMaxVisible() {
|
|
93
|
+
if (this._maxVisible === 0) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
while (this._active.length > this._maxVisible) {
|
|
97
|
+
const oldest = this._active.shift();
|
|
98
|
+
oldest?.remove();
|
|
99
|
+
}
|
|
65
100
|
}
|
|
66
101
|
ensureContainer() {
|
|
67
102
|
if (this._containerEl && document.body.contains(this._containerEl)) {
|
|
@@ -102,6 +102,13 @@ export declare class AutocompleteComponent implements IElementRef, OnCreate, OnD
|
|
|
102
102
|
get activeDescendant(): string | undefined;
|
|
103
103
|
/** Display text for the input in single mode */
|
|
104
104
|
get displayText(): string;
|
|
105
|
+
/**
|
|
106
|
+
* The platform can hide a popover without going through `close()` — a
|
|
107
|
+
* dialog closing above it, another popover taking the top layer, the
|
|
108
|
+
* element being removed. Without observing `toggle`, `isOpen` stayed true
|
|
109
|
+
* and the component refused to reopen.
|
|
110
|
+
*/
|
|
111
|
+
private readonly handlePopoverToggle;
|
|
105
112
|
/** Open the dropdown */
|
|
106
113
|
open: () => void;
|
|
107
114
|
/** Close the dropdown */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAqBxF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAMa,qBAAsB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACtE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAY;IAE9B,kCAAkC;IAC3B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,qBAAqB;IACd,IAAI,EAAE,IAAI,CAAQ;IAEzB,4BAA4B;IACrB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,+BAA+B;IACxB,QAAQ,UAAS;IAExB,6CAA6C;IACtC,KAAK,SAAM;IAElB,6CAA6C;IACtC,MAAM,EAAE,MAAM,EAAE,CAAM;IAE7B,0BAA0B;IACnB,OAAO,EAAE,kBAAkB,EAAE,CAAM;IAE1C,4BAA4B;IACrB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IAEpD,mCAAmC;IAC5B,QAAQ,SAAO;IAEtB,qDAAqD;IAC9C,QAAQ,SAAK;IAEpB,mDAAmD;IAC5C,WAAW,UAAQ;IAE1B,uBAAuB;IAChB,QAAQ,UAAQ;IAEvB,2BAA2B;IACpB,MAAM,SAAM;IAEnB,+BAA+B;IACxB,MAAM,UAAS;IAEtB,qCAAqC;IAC9B,YAAY,SAAM;IAEzB,qCAAqC;IAC9B,OAAO,UAAS;IAEvB,6BAA6B;IACtB,YAAY,EAAE,kBAAkB,EAAE,CAAM;IAE/C,4EAA4E;IACrE,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAQ;IAEvD,8EAA8E;IACvE,cAAc,EAAE,kBAAkB,EAAE,CAAM;IAEjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAmC;IACxE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAIxB;IACJ,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,cAAc,CAAS;IAExB,QAAQ,IAAI,IAAI;IAIhB,SAAS,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"autocomplete.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAqBxF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAMa,qBAAsB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACtE,UAAU,EAAG,WAAW,CAAC;IAEhC,iBAAiB;IACV,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAY;IAE9B,kCAAkC;IAC3B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,q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,CAAC,2BAA2B;IAInC,8EAA8E;IAC9E,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,SAAS;IAiEjB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,cAAc;CAOtB"}
|
|
@@ -115,6 +115,21 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
115
115
|
this.optionId = (index) => {
|
|
116
116
|
return `${this.listboxId}-option-${index}`;
|
|
117
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* The platform can hide a popover without going through `close()` — a
|
|
120
|
+
* dialog closing above it, another popover taking the top layer, the
|
|
121
|
+
* element being removed. Without observing `toggle`, `isOpen` stayed true
|
|
122
|
+
* and the component refused to reopen.
|
|
123
|
+
*/
|
|
124
|
+
this.handlePopoverToggle = (event) => {
|
|
125
|
+
const state = event.newState;
|
|
126
|
+
if (state === 'closed' && this.isOpen) {
|
|
127
|
+
this.isOpen = false;
|
|
128
|
+
this.focusedIndex = -1;
|
|
129
|
+
this.stopPositioning();
|
|
130
|
+
this.removeDocumentClickListener();
|
|
131
|
+
}
|
|
132
|
+
};
|
|
118
133
|
/** Open the dropdown */
|
|
119
134
|
this.open = () => {
|
|
120
135
|
if (this.disabled || this.isOpen)
|
|
@@ -124,6 +139,7 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
124
139
|
const dropdownEl = this.getDropdownEl();
|
|
125
140
|
if (!dropdownEl)
|
|
126
141
|
return;
|
|
142
|
+
dropdownEl.addEventListener('toggle', this.handlePopoverToggle);
|
|
127
143
|
dropdownEl.showPopover();
|
|
128
144
|
this.isOpen = true;
|
|
129
145
|
this.focusedIndex = this.findFirstEnabledIndex();
|
|
@@ -255,6 +271,7 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
255
271
|
}
|
|
256
272
|
onDestroy() {
|
|
257
273
|
this.elementRef.removeEventListener('keydown', this._handleKeyDown);
|
|
274
|
+
this.getDropdownEl()?.removeEventListener('toggle', this.handlePopoverToggle);
|
|
258
275
|
this.stopPositioning();
|
|
259
276
|
this.removeDocumentClickListener();
|
|
260
277
|
if (this._debounceTimer) {
|
|
@@ -398,6 +415,21 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
398
415
|
this.asyncOptions = results;
|
|
399
416
|
this.focusedIndex = this.findFirstEnabledIndex();
|
|
400
417
|
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
// A rejected searchFn used to become an unhandled rejection and
|
|
420
|
+
// leave the spinner running forever. Report it as an event the app
|
|
421
|
+
// can surface, show no results, and clear loading in `finally`.
|
|
422
|
+
if (generation === this._searchGeneration) {
|
|
423
|
+
this.asyncOptions = [];
|
|
424
|
+
this.focusedIndex = -1;
|
|
425
|
+
this.elementRef.dispatchEvent(new CustomEvent('ml:search-error', {
|
|
426
|
+
bubbles: true,
|
|
427
|
+
composed: true,
|
|
428
|
+
detail: { query, error }
|
|
429
|
+
}));
|
|
430
|
+
}
|
|
431
|
+
console.error(`[Melodic] ml-autocomplete search failed for '${query}':`, error);
|
|
432
|
+
}
|
|
401
433
|
finally {
|
|
402
434
|
if (generation === this._searchGeneration) {
|
|
403
435
|
this.loading = false;
|
|
@@ -445,6 +477,13 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
445
477
|
}
|
|
446
478
|
break;
|
|
447
479
|
case 'Escape':
|
|
480
|
+
// Only claim Escape while the listbox is actually open.
|
|
481
|
+
// preventDefault() on a closed control cancelled the platform's
|
|
482
|
+
// close-watcher, so an enclosing dialog or drawer could not be
|
|
483
|
+
// dismissed with Escape while focus sat on this field.
|
|
484
|
+
if (!this.isOpen) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
448
487
|
event.preventDefault();
|
|
449
488
|
this.close();
|
|
450
489
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGzE,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"autocomplete.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGzE,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,qBAAqB,6CAkE5D"}
|
|
@@ -34,7 +34,11 @@ export function autocompleteTemplate(c) {
|
|
|
34
34
|
popover="manual"
|
|
35
35
|
>
|
|
36
36
|
${c.filteredOptions.length
|
|
37
|
-
? repeat(c.filteredOptions,
|
|
37
|
+
? repeat(c.filteredOptions,
|
|
38
|
+
// Key by identity only. Embedding the selection state in the
|
|
39
|
+
// key made every toggle destroy and rebuild the option's
|
|
40
|
+
// DOM — losing hover, focus and any in-flight click.
|
|
41
|
+
(option) => option.value, (option, index) => renderOption(c, option, index))
|
|
38
42
|
: c.loading
|
|
39
43
|
? html `<div class="ml-autocomplete__loading">
|
|
40
44
|
<ml-spinner size="sm"></ml-spinner>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IElementRef, OnCreate, OnDestroy } from '@melodicdev/core';
|
|
1
|
+
import type { IElementRef, OnCreate, OnDestroy, OnRender } from '@melodicdev/core';
|
|
2
2
|
import type { ControlSize } from '../../../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* ml-button-group - A group of connected toggle buttons
|
|
@@ -22,7 +22,7 @@ import type { ControlSize } from '../../../types/index.js';
|
|
|
22
22
|
*
|
|
23
23
|
* @fires ml:change - Emitted when selection changes. Detail: { value: string } or { values: string[] }
|
|
24
24
|
*/
|
|
25
|
-
export declare class ButtonGroupComponent implements IElementRef, OnCreate, OnDestroy {
|
|
25
|
+
export declare class ButtonGroupComponent implements IElementRef, OnCreate, OnDestroy, OnRender {
|
|
26
26
|
elementRef: HTMLElement;
|
|
27
27
|
/** Currently selected value (single selection mode) */
|
|
28
28
|
value: string;
|
|
@@ -39,6 +39,7 @@ export declare class ButtonGroupComponent implements IElementRef, OnCreate, OnDe
|
|
|
39
39
|
/** Error message (shows error state when set; auto-populated by the forms system) */
|
|
40
40
|
error: string;
|
|
41
41
|
onCreate(): void;
|
|
42
|
+
onRender(): void;
|
|
42
43
|
onDestroy(): void;
|
|
43
44
|
/** Handle slot changes to sync initial state */
|
|
44
45
|
handleSlotChange: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/button-group/button-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"button-group.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/button-group/button-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAmB3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAMa,oBAAqB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAC/E,UAAU,EAAG,WAAW,CAAC;IAEhC,uDAAuD;IAChD,KAAK,SAAM;IAElB,sEAAsE;IAC/D,OAAO,EAAE,SAAS,GAAG,OAAO,CAAa;IAEhD,mBAAmB;IACZ,IAAI,EAAE,WAAW,CAAQ;IAEhC,+BAA+B;IACxB,QAAQ,UAAS;IAExB,gCAAgC;IACzB,QAAQ,UAAS;IAExB,sCAAsC;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAM;IAE7B,qFAAqF;IAC9E,KAAK,SAAM;IAEX,QAAQ,IAAI,IAAI;IAKhB,QAAQ,IAAI,IAAI;IAShB,SAAS,IAAI,IAAI;IAIxB,gDAAgD;IACzC,gBAAgB,QAAO,IAAI,CAEhC;IAEF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CA8B/B;IAEF,OAAO,CAAC,SAAS;CAcjB"}
|
|
@@ -99,13 +99,23 @@ let ButtonGroupComponent = class ButtonGroupComponent {
|
|
|
99
99
|
this.elementRef.addEventListener('ml:item-click', this._handleItemClick);
|
|
100
100
|
this.syncItems();
|
|
101
101
|
}
|
|
102
|
+
onRender() {
|
|
103
|
+
// Sync slotted items after every render, so a programmatic `value` /
|
|
104
|
+
// `values` / `disabled` write — including one from a :formControl
|
|
105
|
+
// binding, setValue or reset — reaches them. Running the sync only on
|
|
106
|
+
// create, slotchange and click meant the group ignored every
|
|
107
|
+
// programmatic change.
|
|
108
|
+
this.syncItems();
|
|
109
|
+
}
|
|
102
110
|
onDestroy() {
|
|
103
111
|
this.elementRef.removeEventListener('ml:item-click', this._handleItemClick);
|
|
104
112
|
}
|
|
105
113
|
syncItems() {
|
|
106
114
|
const items = this.elementRef.querySelectorAll('ml-button-group-item');
|
|
107
115
|
items.forEach((item) => {
|
|
108
|
-
|
|
116
|
+
// Read the PROPERTY first: `.value=${x}` never writes an attribute,
|
|
117
|
+
// so an attribute-only read saw nothing for property-bound items.
|
|
118
|
+
const itemValue = item.value ?? item.getAttribute('value') ?? '';
|
|
109
119
|
const isActive = this.multiple ? this.values.includes(itemValue) : itemValue === this.value;
|
|
110
120
|
item.toggleAttribute('active', isActive);
|
|
111
121
|
item.toggleAttribute('group-disabled', this.disabled);
|
|
@@ -24,6 +24,10 @@ export declare class CheckboxComponent implements IElementRef {
|
|
|
24
24
|
size: ControlSize;
|
|
25
25
|
/** Checked state */
|
|
26
26
|
checked: boolean;
|
|
27
|
+
/** Form field name, forwarded to the inner input. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Value submitted when checked (mirrors the native checkbox `value`). */
|
|
30
|
+
value: string;
|
|
27
31
|
/** Indeterminate state */
|
|
28
32
|
indeterminate: boolean;
|
|
29
33
|
/** Disabled state */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/checkbox/checkbox.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;GAWG;AACH,qBAMa,iBAAkB,YAAW,WAAW;IAC7C,UAAU,EAAG,WAAW,CAAC;IAEhC,qBAAqB;IACd,KAAK,SAAM;IAElB,mCAAmC;IAC5B,IAAI,SAAM;IAEjB,qFAAqF;IAC9E,KAAK,SAAM;IAElB,oBAAoB;IACb,IAAI,EAAE,WAAW,CAAQ;IAEhC,oBAAoB;IACb,OAAO,UAAS;IAEvB,0BAA0B;IACnB,aAAa,UAAS;IAE7B,qBAAqB;IACd,QAAQ,UAAS;IAEjB,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAiBxC;CACF"}
|
|
1
|
+
{"version":3,"file":"checkbox.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/checkbox/checkbox.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;GAWG;AACH,qBAMa,iBAAkB,YAAW,WAAW;IAC7C,UAAU,EAAG,WAAW,CAAC;IAEhC,qBAAqB;IACd,KAAK,SAAM;IAElB,mCAAmC;IAC5B,IAAI,SAAM;IAEjB,qFAAqF;IAC9E,KAAK,SAAM;IAElB,oBAAoB;IACb,IAAI,EAAE,WAAW,CAAQ;IAEhC,oBAAoB;IACb,OAAO,UAAS;IAEvB,qDAAqD;IAC9C,IAAI,SAAM;IAEjB,0EAA0E;IACnE,KAAK,SAAQ;IAEpB,0BAA0B;IACnB,aAAa,UAAS;IAE7B,qBAAqB;IACd,QAAQ,UAAS;IAEjB,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAiBxC;CACF"}
|
|
@@ -39,6 +39,10 @@ let CheckboxComponent = class CheckboxComponent {
|
|
|
39
39
|
this.size = 'md';
|
|
40
40
|
/** Checked state */
|
|
41
41
|
this.checked = false;
|
|
42
|
+
/** Form field name, forwarded to the inner input. */
|
|
43
|
+
this.name = '';
|
|
44
|
+
/** Value submitted when checked (mirrors the native checkbox `value`). */
|
|
45
|
+
this.value = 'on';
|
|
42
46
|
/** Indeterminate state */
|
|
43
47
|
this.indeterminate = false;
|
|
44
48
|
/** Disabled state */
|
|
@@ -64,7 +68,7 @@ CheckboxComponent = __decorate([
|
|
|
64
68
|
selector: 'ml-checkbox',
|
|
65
69
|
template: checkboxTemplate,
|
|
66
70
|
styles: checkboxStyles,
|
|
67
|
-
attributes: ['label', 'hint', 'error', 'size', 'checked', 'indeterminate', 'disabled']
|
|
71
|
+
attributes: ['label', 'hint', 'error', 'size', 'checked', 'indeterminate', 'disabled', 'name', 'value']
|
|
68
72
|
})
|
|
69
73
|
], CheckboxComponent);
|
|
70
74
|
export { CheckboxComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/checkbox/checkbox.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"checkbox.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/checkbox/checkbox.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CAiDpD"}
|
|
@@ -58,6 +58,13 @@ export declare class CalendarComponent implements IElementRef, OnInit, OnAttribu
|
|
|
58
58
|
yearPageStart: number;
|
|
59
59
|
onInit(): void;
|
|
60
60
|
onAttributeChange(name: string, _: unknown, newVal: unknown): void;
|
|
61
|
+
/**
|
|
62
|
+
* `.value=${iso}` never writes an attribute, so navigating to a
|
|
63
|
+
* programmatically set date only worked when the consumer happened to use
|
|
64
|
+
* `setAttribute`. The property hook covers both, since an observed
|
|
65
|
+
* attribute write also lands on the property.
|
|
66
|
+
*/
|
|
67
|
+
onPropertyChange(name: string, _: unknown, newValue: unknown): void;
|
|
61
68
|
private navigateToValue;
|
|
62
69
|
get monthLabel(): string;
|
|
63
70
|
get yearLabel(): string;
|
|
@@ -87,6 +94,20 @@ export declare class CalendarComponent implements IElementRef, OnInit, OnAttribu
|
|
|
87
94
|
selectViewYear: (year: CalendarYear) => void;
|
|
88
95
|
selectDay: (day: CalendarDay) => void;
|
|
89
96
|
goToToday: () => void;
|
|
97
|
+
/**
|
|
98
|
+
* Key of the single tabbable cell (roving tabindex).
|
|
99
|
+
*
|
|
100
|
+
* Every current-month day used to be `tabindex="0"`, so tabbing through a
|
|
101
|
+
* form meant ~30 stops inside one calendar. A grid is one tab stop; arrow
|
|
102
|
+
* keys move within it.
|
|
103
|
+
*/
|
|
104
|
+
rovingKey: string;
|
|
105
|
+
/** Day cell that carries the tab stop. */
|
|
106
|
+
get dayTabStop(): string;
|
|
107
|
+
/** Month cell that carries the tab stop. */
|
|
108
|
+
get monthTabStop(): number;
|
|
109
|
+
/** Year cell that carries the tab stop. */
|
|
110
|
+
get yearTabStop(): number;
|
|
90
111
|
handleGridKeyDown: (event: KeyboardEvent) => void;
|
|
91
112
|
private computeYearPageStart;
|
|
92
113
|
private selectedMonthForYear;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/calendar.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI/E,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AA8BpD;;;;;;;;;;;GAWG;AACH,qBAMa,iBAAkB,YAAW,WAAW,EAAE,MAAM,EAAE,iBAAiB;IACxE,UAAU,EAAG,WAAW,CAAC;IAEhC,+CAA+C;IACxC,KAAK,SAAM;IAElB,2CAA2C;IACpC,GAAG,SAAM;IAEhB,2CAA2C;IACpC,GAAG,SAAM;IAEhB,iFAAiF;IAC1E,OAAO,EAAE,MAAM,GAAG,MAAM,CAAM;IAErC,8EAA8E;IACvE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAM;IAErC,oCAAoC;IAC7B,SAAS,SAAyB;I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,IAAI,CAYzC;IAEK,SAAS,QAAO,IAAI,CAgBzB;
|
|
1
|
+
{"version":3,"file":"calendar.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/calendar.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI/E,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AA8BpD;;;;;;;;;;;GAWG;AACH,qBAMa,iBAAkB,YAAW,WAAW,EAAE,MAAM,EAAE,iBAAiB;IACxE,UAAU,EAAG,WAAW,CAAC;IAEhC,+CAA+C;IACxC,KAAK,SAAM;IAElB,2CAA2C;IACpC,GAAG,SAAM;IAEhB,2CAA2C;IACpC,GAAG,SAAM;IAEhB,iFAAiF;IAC1E,OAAO,EAAE,MAAM,GAAG,MAAM,CAAM;IAErC,8EAA8E;IACvE,OAAO,EAAE,MAAM,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,CAE7B;IAEK,YAAY,QAAO,IAAI,CAO5B;IAEK,eAAe,GAAI,OAAO,aAAa,KAAG,IAAI,CAInD;IAEK,cAAc,GAAI,MAAM,YAAY,KAAG,IAAI,CAIhD;IAIK,SAAS,GAAI,KAAK,WAAW,KAAG,IAAI,CAYzC;IAEK,SAAS,QAAO,IAAI,CAgBzB;IAIF;;;;;;OAMG;IACI,SAAS,SAAM;IAEtB,0CAA0C;IAC1C,IAAW,UAAU,IAAI,MAAM,CAW9B;IAED,4CAA4C;IAC5C,IAAW,YAAY,IAAI,MAAM,CAYhC;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAAI,MAAM,CAY/B;IAEM,iBAAiB,GAAI,OAAO,aAAa,KAAG,IAAI,CAmCrD;IAIF,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,UAAU;CAKlB"}
|
|
@@ -178,6 +178,14 @@ let CalendarComponent = class CalendarComponent {
|
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
// ── Keyboard navigation ─────────────────────────────────────────────────
|
|
181
|
+
/**
|
|
182
|
+
* Key of the single tabbable cell (roving tabindex).
|
|
183
|
+
*
|
|
184
|
+
* Every current-month day used to be `tabindex="0"`, so tabbing through a
|
|
185
|
+
* form meant ~30 stops inside one calendar. A grid is one tab stop; arrow
|
|
186
|
+
* keys move within it.
|
|
187
|
+
*/
|
|
188
|
+
this.rovingKey = '';
|
|
181
189
|
this.handleGridKeyDown = (event) => {
|
|
182
190
|
const key = event.key;
|
|
183
191
|
if (key !== 'ArrowLeft' && key !== 'ArrowRight' && key !== 'ArrowUp' && key !== 'ArrowDown' && key !== 'Home' && key !== 'End') {
|
|
@@ -189,7 +197,10 @@ let CalendarComponent = class CalendarComponent {
|
|
|
189
197
|
const grid = target.closest('.ml-calendar__grid, .ml-calendar__cell-grid');
|
|
190
198
|
if (!grid)
|
|
191
199
|
return;
|
|
192
|
-
|
|
200
|
+
// Every enabled cell participates in arrow navigation; only one of them
|
|
201
|
+
// is a tab stop, so filtering by tabIndex here would leave the arrows
|
|
202
|
+
// with a single cell to move between.
|
|
203
|
+
const cells = Array.from(grid.querySelectorAll('button:not([disabled])'));
|
|
193
204
|
if (cells.length === 0)
|
|
194
205
|
return;
|
|
195
206
|
const idx = cells.indexOf(target);
|
|
@@ -222,7 +233,9 @@ let CalendarComponent = class CalendarComponent {
|
|
|
222
233
|
return;
|
|
223
234
|
}
|
|
224
235
|
event.preventDefault();
|
|
225
|
-
cells[nextIdx]
|
|
236
|
+
const next = cells[nextIdx];
|
|
237
|
+
this.rovingKey = next.dataset.key ?? '';
|
|
238
|
+
next.focus();
|
|
226
239
|
};
|
|
227
240
|
}
|
|
228
241
|
onInit() {
|
|
@@ -235,6 +248,25 @@ let CalendarComponent = class CalendarComponent {
|
|
|
235
248
|
this.yearPageStart = this.computeYearPageStart(this.viewYear);
|
|
236
249
|
}
|
|
237
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* `.value=${iso}` never writes an attribute, so navigating to a
|
|
253
|
+
* programmatically set date only worked when the consumer happened to use
|
|
254
|
+
* `setAttribute`. The property hook covers both, since an observed
|
|
255
|
+
* attribute write also lands on the property.
|
|
256
|
+
*/
|
|
257
|
+
onPropertyChange(name, _, newValue) {
|
|
258
|
+
if (name !== 'value' || !newValue) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const parts = String(newValue).split('-');
|
|
262
|
+
if (parts.length !== 3) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
this.viewYear = Number.parseInt(parts[0], 10);
|
|
266
|
+
this.viewMonth = Number.parseInt(parts[1], 10) - 1;
|
|
267
|
+
this.yearPageStart = this.computeYearPageStart(this.viewYear);
|
|
268
|
+
this.rovingKey = String(newValue);
|
|
269
|
+
}
|
|
238
270
|
navigateToValue() {
|
|
239
271
|
if (!this.value)
|
|
240
272
|
return;
|
|
@@ -368,6 +400,41 @@ let CalendarComponent = class CalendarComponent {
|
|
|
368
400
|
get canPageYearsForward() {
|
|
369
401
|
return this.yearPageStart + YEARS_PER_PAGE - 1 < this.resolvedMaxYear;
|
|
370
402
|
}
|
|
403
|
+
/** Day cell that carries the tab stop. */
|
|
404
|
+
get dayTabStop() {
|
|
405
|
+
const candidates = this.days.filter((day) => day.isCurrentMonth && !day.isDisabled);
|
|
406
|
+
if (candidates.length === 0) {
|
|
407
|
+
return '';
|
|
408
|
+
}
|
|
409
|
+
if (this.rovingKey && candidates.some((day) => day.iso === this.rovingKey)) {
|
|
410
|
+
return this.rovingKey;
|
|
411
|
+
}
|
|
412
|
+
return (candidates.find((day) => day.isSelected) ?? candidates.find((day) => day.isToday) ?? candidates[0]).iso;
|
|
413
|
+
}
|
|
414
|
+
/** Month cell that carries the tab stop. */
|
|
415
|
+
get monthTabStop() {
|
|
416
|
+
const candidates = this.months.filter((month) => !month.isDisabled);
|
|
417
|
+
if (candidates.length === 0) {
|
|
418
|
+
return -1;
|
|
419
|
+
}
|
|
420
|
+
const roving = Number.parseInt(this.rovingKey, 10);
|
|
421
|
+
if (!Number.isNaN(roving) && candidates.some((month) => month.index === roving)) {
|
|
422
|
+
return roving;
|
|
423
|
+
}
|
|
424
|
+
return (candidates.find((month) => month.isSelected) ?? candidates.find((month) => month.isCurrent) ?? candidates[0]).index;
|
|
425
|
+
}
|
|
426
|
+
/** Year cell that carries the tab stop. */
|
|
427
|
+
get yearTabStop() {
|
|
428
|
+
const candidates = this.years.filter((year) => !year.isDisabled);
|
|
429
|
+
if (candidates.length === 0) {
|
|
430
|
+
return -1;
|
|
431
|
+
}
|
|
432
|
+
const roving = Number.parseInt(this.rovingKey, 10);
|
|
433
|
+
if (!Number.isNaN(roving) && candidates.some((year) => year.year === roving)) {
|
|
434
|
+
return roving;
|
|
435
|
+
}
|
|
436
|
+
return (candidates.find((year) => year.isSelected) ?? candidates.find((year) => year.isCurrent) ?? candidates[0]).year;
|
|
437
|
+
}
|
|
371
438
|
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
372
439
|
computeYearPageStart(year) {
|
|
373
440
|
const minY = this.resolvedMinYear;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/calendar.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA4C,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"calendar.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/calendar.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA4C,MAAM,yBAAyB,CAAC;AAwF3G,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CAsEpD"}
|
|
@@ -19,7 +19,8 @@ function dayGrid(c) {
|
|
|
19
19
|
'ml-calendar__day--disabled': day.isDisabled
|
|
20
20
|
})}
|
|
21
21
|
?disabled=${day.isDisabled || !day.isCurrentMonth}
|
|
22
|
-
|
|
22
|
+
data-key=${day.iso}
|
|
23
|
+
tabindex=${day.iso === c.dayTabStop ? '0' : '-1'}
|
|
23
24
|
aria-selected=${day.isSelected ? 'true' : 'false'}
|
|
24
25
|
aria-label=${day.iso}
|
|
25
26
|
@click=${() => c.selectDay(day)}
|
|
@@ -44,7 +45,8 @@ function monthGrid(c) {
|
|
|
44
45
|
'ml-calendar__cell--disabled': m.isDisabled
|
|
45
46
|
})}
|
|
46
47
|
?disabled=${m.isDisabled}
|
|
47
|
-
|
|
48
|
+
data-key=${String(m.index)}
|
|
49
|
+
tabindex=${m.index === c.monthTabStop ? '0' : '-1'}
|
|
48
50
|
aria-selected=${m.isSelected ? 'true' : 'false'}
|
|
49
51
|
aria-label=${m.label}
|
|
50
52
|
@click=${() => c.selectViewMonth(m)}
|
|
@@ -68,7 +70,8 @@ function yearGrid(c) {
|
|
|
68
70
|
'ml-calendar__cell--disabled': y.isDisabled
|
|
69
71
|
})}
|
|
70
72
|
?disabled=${y.isDisabled}
|
|
71
|
-
|
|
73
|
+
data-key=${String(y.year)}
|
|
74
|
+
tabindex=${y.year === c.yearTabStop ? '0' : '-1'}
|
|
72
75
|
aria-selected=${y.isSelected ? 'true' : 'false'}
|
|
73
76
|
aria-label=${String(y.year)}
|
|
74
77
|
@click=${() => c.selectViewYear(y)}
|
|
@@ -33,6 +33,12 @@ export declare class DatePickerComponent implements IElementRef, OnCreate, OnDes
|
|
|
33
33
|
disabled: boolean;
|
|
34
34
|
/** Required state */
|
|
35
35
|
required: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* BCP 47 locale for the displayed and accepted date format. Defaults to
|
|
38
|
+
* the document's `lang`, then the browser's — the format used to be
|
|
39
|
+
* hardcoded MM/DD/YYYY.
|
|
40
|
+
*/
|
|
41
|
+
locale: string;
|
|
36
42
|
/** Minimum selectable date (YYYY-MM-DD) */
|
|
37
43
|
min: string;
|
|
38
44
|
/** Maximum selectable date (YYYY-MM-DD) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/date-picker.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"date-picker.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/date-picker.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAmFzE;;;;;;;;;;;;;;;GAeG;AACH,qBAMa,mBAAoB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACpE,UAAU,EAAG,WAAW,CAAC;IAEhC,+CAA+C;IACxC,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAiB;IAEnC,kBAAkB;I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