@lmvz-ds/components 0.37.0 → 0.39.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 (182) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +12 -20
  3. package/cjs/{aria-validation-controller-Do0uEK4t.js → aria-validation-controller-DKNXjnQr.js} +1 -1
  4. package/cjs/checkmark-CuKDPAcx.js +5 -0
  5. package/cjs/{directional-focus-controller-8Xd_7MHT.js → directional-focus-controller-DDnhfX5w.js} +15 -5
  6. package/cjs/{index-BgvZ4y-3.js → index-DWy4nuyZ.js} +41 -0
  7. package/cjs/index.cjs.js +3 -195
  8. package/cjs/lmvz-action-list.cjs.entry.js +4 -4
  9. package/cjs/lmvz-action.cjs.entry.js +1 -1
  10. package/cjs/lmvz-button-group.cjs.entry.js +5 -1
  11. package/cjs/lmvz-button_2.cjs.entry.js +3 -3
  12. package/cjs/lmvz-card.cjs.entry.js +2 -2
  13. package/cjs/lmvz-checkbox.cjs.entry.js +4 -5
  14. package/cjs/lmvz-chip.cjs.entry.js +5 -5
  15. package/cjs/lmvz-components.cjs.js +2 -2
  16. package/cjs/lmvz-datepicker.cjs.entry.js +1 -1
  17. package/cjs/lmvz-header_2.cjs.entry.js +5 -5
  18. package/cjs/lmvz-input.cjs.entry.js +4 -7
  19. package/cjs/lmvz-link.cjs.entry.js +1 -1
  20. package/cjs/lmvz-menuitem.cjs.entry.js +2 -2
  21. package/cjs/lmvz-message.cjs.entry.js +4 -2
  22. package/cjs/lmvz-modal.cjs.entry.js +2 -2
  23. package/cjs/lmvz-popover.cjs.entry.js +5 -14
  24. package/cjs/lmvz-radio.cjs.entry.js +2 -2
  25. package/cjs/lmvz-select.cjs.entry.js +110 -16
  26. package/cjs/lmvz-snackbar.cjs.entry.js +1 -1
  27. package/cjs/lmvz-spinner.cjs.entry.js +1 -1
  28. package/cjs/lmvz-tab.cjs.entry.js +1 -1
  29. package/cjs/lmvz-tabs.cjs.entry.js +9 -3
  30. package/cjs/lmvz-toggle.cjs.entry.js +2 -2
  31. package/cjs/loader.cjs.js +2 -2
  32. package/cjs/public-DTgpEs1_.js +206 -0
  33. package/collection/components/lmvz-action-list/lmvz-action-list.css +119 -116
  34. package/collection/components/lmvz-button/lmvz-button.css +109 -106
  35. package/collection/components/lmvz-card/lmvz-card.css +106 -103
  36. package/collection/components/lmvz-chip/lmvz-chip.css +1 -1
  37. package/collection/components/lmvz-chip/lmvz-chip.js +2 -2
  38. package/collection/components/lmvz-header/lmvz-header.js +2 -2
  39. package/collection/components/lmvz-input/lmvz-input.js +2 -5
  40. package/collection/components/lmvz-message/lmvz-message.css +1 -1
  41. package/collection/components/lmvz-popover/lmvz-popover.css +1 -1
  42. package/collection/components/lmvz-popover/lmvz-popover.js +2 -11
  43. package/collection/components/lmvz-select/lmvz-select.css +102 -53
  44. package/collection/components/lmvz-select/lmvz-select.js +151 -41
  45. package/collection/components/lmvz-snackbar/public.js +3 -0
  46. package/collection/components/lmvz-tabs/lmvz-tabs.js +7 -1
  47. package/collection/utils/aria/directional-focus-controller.js +16 -7
  48. package/collection/utils/icons/public.js +3 -0
  49. package/components/index.js +1 -1
  50. package/components/lmvz-action-list.js +1 -1
  51. package/components/lmvz-action.js +1 -1
  52. package/components/lmvz-button-group.js +1 -1
  53. package/components/lmvz-button.js +1 -1
  54. package/components/lmvz-card.js +1 -1
  55. package/components/lmvz-checkbox.js +1 -1
  56. package/components/lmvz-chip.js +1 -1
  57. package/components/lmvz-datepicker.js +1 -1
  58. package/components/lmvz-header.js +1 -1
  59. package/components/lmvz-icon.js +1 -1
  60. package/components/lmvz-input.js +1 -1
  61. package/components/lmvz-link.js +1 -1
  62. package/components/lmvz-menuitem.js +1 -1
  63. package/components/lmvz-message.js +1 -1
  64. package/components/lmvz-modal.js +1 -1
  65. package/components/lmvz-popover.js +1 -1
  66. package/components/lmvz-radio.js +1 -1
  67. package/components/lmvz-select.js +1 -1
  68. package/components/lmvz-snackbar.js +1 -1
  69. package/components/lmvz-spinner.js +1 -1
  70. package/components/lmvz-tab.js +1 -1
  71. package/components/lmvz-tabs.js +1 -1
  72. package/components/lmvz-toggle.js +1 -1
  73. package/components/{p-BLMXiDE0.js → p--mU29mrX.js} +1 -1
  74. package/components/p-BPa0FHVO.js +1 -0
  75. package/components/p-Bc5MM0zh.js +1 -0
  76. package/components/p-CyDgnpOB.js +1 -0
  77. package/components/p-DAikapVO.js +1 -0
  78. package/components/{p-C-pRMuMh.js → p-DIyiticz.js} +1 -1
  79. package/components/{p-BhALzK62.js → p-DJLdOjL4.js} +1 -1
  80. package/components/p-DSDBThqb.js +1 -0
  81. package/components/{p-diOze8wI.js → p-DXFoXTse.js} +1 -1
  82. package/components/p-DXhP6UeF.js +1 -0
  83. package/components/p-D_mff3n7.js +1 -0
  84. package/components/p-DbBJxuBm.js +1 -0
  85. package/components/p-DsTgD0_a.js +1 -0
  86. package/components/p-DyQ1GbaN.js +1 -0
  87. package/components/p-niXjuPxe.js +1 -0
  88. package/components/{p-BAj4FkUt.js → p-sACbyedu.js} +1 -1
  89. package/esm/{aria-validation-controller-Cp6pofER.js → aria-validation-controller-Dwv7n0rk.js} +1 -1
  90. package/esm/checkmark-DAikapVO.js +3 -0
  91. package/esm/{directional-focus-controller-QukTTWBE.js → directional-focus-controller-CJ0yNC00.js} +15 -5
  92. package/esm/{index-BOXP1Vx0.js → index-DVab4vzV.js} +41 -1
  93. package/esm/index.js +1 -197
  94. package/esm/lmvz-action-list.entry.js +4 -4
  95. package/esm/lmvz-action.entry.js +1 -1
  96. package/esm/lmvz-button-group.entry.js +5 -1
  97. package/esm/lmvz-button_2.entry.js +3 -3
  98. package/esm/lmvz-card.entry.js +2 -2
  99. package/esm/lmvz-checkbox.entry.js +3 -4
  100. package/esm/lmvz-chip.entry.js +5 -5
  101. package/esm/lmvz-components.js +3 -3
  102. package/esm/lmvz-datepicker.entry.js +1 -1
  103. package/esm/lmvz-header_2.entry.js +5 -5
  104. package/esm/lmvz-input.entry.js +4 -7
  105. package/esm/lmvz-link.entry.js +1 -1
  106. package/esm/lmvz-menuitem.entry.js +2 -2
  107. package/esm/lmvz-message.entry.js +4 -2
  108. package/esm/lmvz-modal.entry.js +2 -2
  109. package/esm/lmvz-popover.entry.js +5 -14
  110. package/esm/lmvz-radio.entry.js +2 -2
  111. package/esm/lmvz-select.entry.js +110 -16
  112. package/esm/lmvz-snackbar.entry.js +1 -1
  113. package/esm/lmvz-spinner.entry.js +1 -1
  114. package/esm/lmvz-tab.entry.js +1 -1
  115. package/esm/lmvz-tabs.entry.js +9 -3
  116. package/esm/lmvz-toggle.entry.js +2 -2
  117. package/esm/loader.js +3 -3
  118. package/esm/public-m6pRVUeP.js +204 -0
  119. package/hydrate/index.js +394 -50
  120. package/hydrate/index.mjs +394 -50
  121. package/lmvz-components/index.esm.js +1 -1
  122. package/lmvz-components/lmvz-components.esm.js +1 -1
  123. package/lmvz-components/p-1ba1af8d.entry.js +1 -0
  124. package/lmvz-components/{p-0f65d001.entry.js → p-27e8b4fa.entry.js} +1 -1
  125. package/lmvz-components/p-304c7554.entry.js +1 -0
  126. package/lmvz-components/p-316dd61a.entry.js +1 -0
  127. package/lmvz-components/{p-3d5867df.entry.js → p-335b3867.entry.js} +1 -1
  128. package/lmvz-components/{p-7872a6b4.entry.js → p-3b7203a3.entry.js} +1 -1
  129. package/lmvz-components/p-41286514.entry.js +1 -0
  130. package/lmvz-components/p-6aae1df9.entry.js +1 -0
  131. package/lmvz-components/p-743616c0.entry.js +1 -0
  132. package/lmvz-components/{p-26dd9684.entry.js → p-773e9d95.entry.js} +1 -1
  133. package/lmvz-components/{p-a6fe9b61.entry.js → p-7cbfbc88.entry.js} +1 -1
  134. package/lmvz-components/p-87f21ac9.entry.js +1 -0
  135. package/lmvz-components/{p-a680a7b2.entry.js → p-8ba6ec19.entry.js} +1 -1
  136. package/lmvz-components/p-93b781ca.entry.js +1 -0
  137. package/lmvz-components/p-BPa0FHVO.js +1 -0
  138. package/lmvz-components/p-BlkpdeQI.js +1 -0
  139. package/lmvz-components/p-DAikapVO.js +1 -0
  140. package/lmvz-components/p-DVab4vzV.js +2 -0
  141. package/lmvz-components/{p-BeY96W7m.js → p-Wi9d2-w9.js} +1 -1
  142. package/lmvz-components/p-c884c76e.entry.js +1 -0
  143. package/lmvz-components/{p-eabbf901.entry.js → p-d73bb7fd.entry.js} +1 -1
  144. package/lmvz-components/{p-137b1fe1.entry.js → p-e35f49a1.entry.js} +1 -1
  145. package/lmvz-components/p-ebad823c.entry.js +1 -0
  146. package/lmvz-components/p-edec4d09.entry.js +1 -0
  147. package/lmvz-components/{p-88661c50.entry.js → p-efd9d50e.entry.js} +1 -1
  148. package/lmvz-components/p-f24f5207.entry.js +1 -0
  149. package/lmvz-components/p-f911691c.entry.js +1 -0
  150. package/manifest.json +72 -39
  151. package/package.json +2 -1
  152. package/types/components/lmvz-input/lmvz-input.d.ts +0 -2
  153. package/types/components/lmvz-popover/lmvz-popover.d.ts +0 -1
  154. package/types/components/lmvz-select/lmvz-select.d.ts +12 -3
  155. package/types/components/lmvz-snackbar/public.d.ts +6 -0
  156. package/types/components/lmvz-tabs/lmvz-tabs.d.ts +1 -0
  157. package/types/components.d.ts +39 -19
  158. package/types/index.d.ts +5 -0
  159. package/types/utils/aria/directional-focus-controller.d.ts +9 -7
  160. package/types/utils/icons/public.d.ts +6 -0
  161. package/components/p--FDdvoIg.js +0 -1
  162. package/components/p-BApwCp0R.js +0 -1
  163. package/components/p-BPYBmylI.js +0 -1
  164. package/components/p-C5gRiLRR.js +0 -1
  165. package/components/p-CrQCHVKL.js +0 -1
  166. package/components/p-DiRcp9V6.js +0 -1
  167. package/components/p-DqdrUt_G.js +0 -1
  168. package/lmvz-components/p-00489151.entry.js +0 -1
  169. package/lmvz-components/p-0af0211a.entry.js +0 -1
  170. package/lmvz-components/p-398b5cf4.entry.js +0 -1
  171. package/lmvz-components/p-40716828.entry.js +0 -1
  172. package/lmvz-components/p-492adf21.entry.js +0 -1
  173. package/lmvz-components/p-4deaa010.entry.js +0 -1
  174. package/lmvz-components/p-4fa6e72f.entry.js +0 -1
  175. package/lmvz-components/p-57a366e6.entry.js +0 -1
  176. package/lmvz-components/p-70f1e31a.entry.js +0 -1
  177. package/lmvz-components/p-91eb71bb.entry.js +0 -1
  178. package/lmvz-components/p-BOXP1Vx0.js +0 -2
  179. package/lmvz-components/p-CHxiS3ja.js +0 -1
  180. package/lmvz-components/p-e14058e1.entry.js +0 -1
  181. package/lmvz-components/p-f3f0ed49.entry.js +0 -1
  182. package/lmvz-components/p-f516a949.entry.js +0 -1
@@ -0,0 +1,204 @@
1
+ import { t as typedIconFromSet } from './icons-DQOFaux5.js';
2
+
3
+ const PRIORITY_MAP = {
4
+ low: 0,
5
+ normal: 1,
6
+ high: 2,
7
+ };
8
+ const STATUS_DURATION = {
9
+ success: 5000,
10
+ warning: 5000,
11
+ error: 8000,
12
+ };
13
+ let idCounter = 0;
14
+ function nextId() {
15
+ idCounter += 1;
16
+ return `snackbar-${idCounter}`;
17
+ }
18
+ function resolveHostElement() {
19
+ if (typeof document === 'undefined') {
20
+ return undefined;
21
+ }
22
+ const existing = document.querySelector('[data-snackbar-host]');
23
+ if (existing) {
24
+ return existing;
25
+ }
26
+ const el = document.createElement('lmvz-snackbar');
27
+ el.setAttribute('data-snackbar-host', '');
28
+ document.body.appendChild(el);
29
+ return el;
30
+ }
31
+ class SnackbarController {
32
+ hostEl = undefined;
33
+ active = undefined;
34
+ getHost() {
35
+ if (this.hostEl !== undefined && !this.hostEl.isConnected) {
36
+ this.hostEl = undefined;
37
+ }
38
+ if (this.hostEl === undefined) {
39
+ this.hostEl = resolveHostElement();
40
+ }
41
+ return this.hostEl;
42
+ }
43
+ clearTimer(entry) {
44
+ if (entry.timerId !== undefined) {
45
+ clearTimeout(entry.timerId);
46
+ entry.timerId = undefined;
47
+ }
48
+ }
49
+ scheduleTimer(entry, delayMs) {
50
+ if (delayMs <= 0) {
51
+ return;
52
+ }
53
+ entry.timerStartedAt = Date.now();
54
+ entry.timerId = setTimeout(() => {
55
+ if (this.active !== undefined && this.active.id === entry.id) {
56
+ this.dismissActive(entry, 'timeout');
57
+ }
58
+ }, delayMs);
59
+ }
60
+ dismissActive(entry, reason) {
61
+ this.clearTimer(entry);
62
+ const host = entry.hostEl;
63
+ host.removeEventListener('pointerenter', entry.onPointerEnter);
64
+ host.removeEventListener('pointerleave', entry.onPointerLeave);
65
+ host.removeEventListener('focusin', entry.onFocusIn);
66
+ host.removeEventListener('focusout', entry.onFocusOut);
67
+ if (entry.onActionListener) {
68
+ host.removeEventListener('lmvzAction', entry.onActionListener);
69
+ }
70
+ host.hide?.();
71
+ if (this.active?.id === entry.id) {
72
+ this.active = undefined;
73
+ }
74
+ if (reason !== 'action') {
75
+ host.dispatchEvent(new CustomEvent('lmvzClose', { detail: { reason }, bubbles: true, composed: true }));
76
+ }
77
+ entry.resolve({ reason });
78
+ }
79
+ pauseTimer(entry) {
80
+ entry.pauseCount += 1;
81
+ if (entry.pauseCount > 1 || entry.timerId === undefined) {
82
+ return;
83
+ }
84
+ const elapsed = entry.timerStartedAt !== undefined ? Date.now() - entry.timerStartedAt : 0;
85
+ entry.remaining = Math.max(0, entry.remaining - elapsed);
86
+ entry.timerStartedAt = undefined;
87
+ this.clearTimer(entry);
88
+ }
89
+ resumeTimer(entry) {
90
+ if (entry.pauseCount > 0) {
91
+ entry.pauseCount -= 1;
92
+ }
93
+ if (entry.pauseCount > 0) {
94
+ return;
95
+ }
96
+ if (entry.remaining > 0) {
97
+ this.scheduleTimer(entry, entry.remaining);
98
+ }
99
+ }
100
+ applyToHost(host, options) {
101
+ host.setAttribute('status', options.status ?? 'success');
102
+ if (options.actionLabel !== undefined) {
103
+ host.setAttribute('action-label', options.actionLabel);
104
+ }
105
+ else {
106
+ host.removeAttribute('action-label');
107
+ }
108
+ }
109
+ open(options) {
110
+ const incomingPriority = PRIORITY_MAP[options.priority ?? 'normal'];
111
+ if (this.active !== undefined && incomingPriority < this.active.priority) {
112
+ let swallowResolve;
113
+ const closed = new Promise((resolve) => {
114
+ swallowResolve = resolve;
115
+ });
116
+ swallowResolve({ reason: 'swallowed' });
117
+ const id = nextId();
118
+ return {
119
+ id,
120
+ closed,
121
+ dismiss() {
122
+ },
123
+ };
124
+ }
125
+ if (this.active !== undefined) {
126
+ this.dismissActive(this.active, 'overridden');
127
+ }
128
+ const host = this.getHost();
129
+ if (host === undefined) {
130
+ const id = nextId();
131
+ let ssrResolve;
132
+ const closed = new Promise((resolve) => {
133
+ ssrResolve = resolve;
134
+ });
135
+ ssrResolve({ reason: 'swallowed' });
136
+ return { id, closed, dismiss() { } };
137
+ }
138
+ const id = nextId();
139
+ const status = options.status ?? 'success';
140
+ const durationMs = options.duration === 0 ? 0 : (options.duration ?? STATUS_DURATION[status]);
141
+ let entryResolve;
142
+ const closed = new Promise((resolve) => {
143
+ entryResolve = resolve;
144
+ });
145
+ const entry = {
146
+ id,
147
+ priority: incomingPriority,
148
+ resolve: entryResolve,
149
+ timerId: undefined,
150
+ remaining: durationMs,
151
+ timerStartedAt: undefined,
152
+ pauseCount: 0,
153
+ hostEl: host,
154
+ onPointerEnter: () => this.pauseTimer(entry),
155
+ onPointerLeave: () => this.resumeTimer(entry),
156
+ onFocusIn: () => this.pauseTimer(entry),
157
+ onFocusOut: () => this.resumeTimer(entry),
158
+ };
159
+ this.active = entry;
160
+ host.addEventListener('pointerenter', entry.onPointerEnter);
161
+ host.addEventListener('pointerleave', entry.onPointerLeave);
162
+ host.addEventListener('focusin', entry.onFocusIn);
163
+ host.addEventListener('focusout', entry.onFocusOut);
164
+ this.applyToHost(host, options);
165
+ const onAction = () => {
166
+ if (this.active !== undefined && this.active.id === id) {
167
+ options.onAction?.();
168
+ this.dismissActive(entry, 'action');
169
+ }
170
+ };
171
+ entry.onActionListener = onAction;
172
+ host.addEventListener('lmvzAction', onAction, { once: true });
173
+ host.show?.();
174
+ queueMicrotask(() => host.setAttribute('message', options.message));
175
+ if (durationMs > 0) {
176
+ this.scheduleTimer(entry, durationMs);
177
+ }
178
+ return {
179
+ id,
180
+ closed,
181
+ dismiss: () => {
182
+ if (this.active?.id === id) {
183
+ this.dismissActive(entry, 'manual');
184
+ }
185
+ },
186
+ };
187
+ }
188
+ dismiss(id) {
189
+ if (!this.active) {
190
+ return;
191
+ }
192
+ if (!id || this.active.id === id) {
193
+ this.dismissActive(this.active, 'manual');
194
+ }
195
+ }
196
+ }
197
+
198
+ window.LmvzApi ??= {};
199
+ window.LmvzApi.SnackbarController = SnackbarController;
200
+
201
+ window.LmvzApi ??= {};
202
+ window.LmvzApi.typedIconFromSet = typedIconFromSet;
203
+
204
+ export { SnackbarController as S };