@stachelock/ui 0.6.15 → 0.6.17

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 (56) hide show
  1. package/dist/NavigationItem.vue_vue_type_script_setup_true_lang-a6F3LQ_P.js +56 -0
  2. package/dist/ScreenSizeSelector.vue_vue_type_script_setup_true_lang-FINxrVod.js +183 -0
  3. package/dist/UiMapAll.vue_vue_type_script_setup_true_lang-DKcK0HmT.js +501 -0
  4. package/dist/charts/BaseChart.js +76 -56
  5. package/dist/charts/chartTheme.js +199 -60
  6. package/dist/charts/index.js +30 -27
  7. package/dist/components/Button.js +109 -89
  8. package/dist/composables/index.js +41 -32
  9. package/dist/composables/useMap.js +1 -1
  10. package/dist/index.js +2612 -1757
  11. package/dist/layouts/DashboardLayout.js +218 -2
  12. package/dist/layouts/NavigationItem.js +1 -1
  13. package/dist/maps/UiMap.js +167 -150
  14. package/dist/maps/UiMapAll.js +1 -1
  15. package/dist/maps/UiMapMarker.js +227 -118
  16. package/dist/maps/index.js +1 -1
  17. package/dist/src/components/SecureHandoffCard.d.ts +88 -0
  18. package/dist/src/components/UiProgressBar.d.ts +1 -1
  19. package/dist/src/components/UiRadialProgressBar.d.ts +1 -1
  20. package/dist/src/components/charts/chartTheme.d.ts +53 -0
  21. package/dist/src/components/formatters/DateFormatter.d.ts +1 -1
  22. package/dist/src/components/index.d.ts +2 -0
  23. package/dist/src/components/inputs/DatepickerInput.d.ts +3 -3
  24. package/dist/src/components/layouts/DashboardLayout.d.ts +80 -18
  25. package/dist/src/components/layouts/ShowcaseCard.d.ts +1 -0
  26. package/dist/src/components/layouts/UiDetailPanel.d.ts +65 -0
  27. package/dist/src/components/layouts/UiSplitPanelLayout.d.ts +96 -0
  28. package/dist/src/components/layouts/index.d.ts +2 -0
  29. package/dist/src/components/maps/UiMap.d.ts +13 -2
  30. package/dist/src/components/maps/UiMapAll.d.ts +13 -0
  31. package/dist/src/components/maps/UiMapMarker.d.ts +47 -10
  32. package/dist/src/components/modals/UiSlideOver.d.ts +104 -0
  33. package/dist/src/components/modals/index.d.ts +1 -0
  34. package/dist/src/components/palettes/UiCommandPalette.d.ts +166 -0
  35. package/dist/src/components/palettes/index.d.ts +1 -0
  36. package/dist/src/components/wrappers/BreakpointWrapper.d.ts +36 -0
  37. package/dist/src/components/wrappers/ResponsivePreviewWrapper.d.ts +85 -0
  38. package/dist/src/components/wrappers/ScreenSizeSelector.d.ts +74 -0
  39. package/dist/src/components/wrappers/index.d.ts +3 -0
  40. package/dist/src/composables/index.d.ts +1 -0
  41. package/dist/src/composables/useScreenSize.d.ts +131 -0
  42. package/dist/src/types/index.d.ts +1 -0
  43. package/dist/src/types/layouts.d.ts +42 -0
  44. package/dist/src/types/palettes.d.ts +134 -0
  45. package/dist/src/views/components/index.d.ts +2 -0
  46. package/dist/src/views/index.d.ts +5 -1
  47. package/dist/src/views/layouts/index.d.ts +3 -1
  48. package/dist/style.css +1 -1
  49. package/dist/useMap-CM59TKX6.js +318 -0
  50. package/dist/useScreenSize-Kr6cn5Zr.js +104 -0
  51. package/dist/wrappers/index.js +10 -6
  52. package/package.json +1 -1
  53. package/dist/DashboardLayout.vue_vue_type_script_setup_true_lang-BAx4gKqh.js +0 -239
  54. package/dist/NavigationItem.vue_vue_type_script_setup_true_lang-C8aX-84Q.js +0 -56
  55. package/dist/UiMapAll.vue_vue_type_script_setup_true_lang-11yT7mTH.js +0 -471
  56. package/dist/useMap-BGg0H582.js +0 -297
@@ -0,0 +1,501 @@
1
+ import { defineComponent as de, ref as m, computed as B, watch as E, onMounted as ce, createElementBlock as g, openBlock as f, Fragment as S, createVNode as C, mergeProps as fe, withCtx as M, createElementVNode as x, createCommentVNode as y, renderSlot as Z, normalizeClass as d, unref as b, toDisplayString as U, renderList as K, createBlock as q, nextTick as me } from "vue";
2
+ import { PlusIcon as ge, MinusIcon as ve, ArrowsPointingOutIcon as he } from "@heroicons/vue/24/outline";
3
+ import pe from "./maps/UiMap.js";
4
+ import G from "./maps/UiMapMarker.js";
5
+ import ye from "./maps/UiInfoWindow.js";
6
+ import { u as be } from "./useMap-CM59TKX6.js";
7
+ import { g as H } from "./mapThemes-DFE9fZm3.js";
8
+ const ke = { class: "sl-flex sl-flex-col sl-gap-2" }, Se = /* @__PURE__ */ de({
9
+ __name: "UiMapAll",
10
+ props: {
11
+ /** Google Maps API key */
12
+ apiKey: {
13
+ type: String,
14
+ default: ""
15
+ },
16
+ /** Google Cloud Map ID (required for Advanced Markers) */
17
+ googleMapId: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ /** Array of markers or data objects */
22
+ items: {
23
+ type: Array,
24
+ default: () => []
25
+ },
26
+ /** Custom coordinate extractor for data objects */
27
+ coordinateExtractor: {
28
+ type: Function,
29
+ default: void 0
30
+ },
31
+ /** ID field for data objects */
32
+ idField: {
33
+ type: String,
34
+ default: "id"
35
+ },
36
+ /** Title field for data objects */
37
+ titleField: {
38
+ type: String,
39
+ default: "name"
40
+ },
41
+ /** Initial map center */
42
+ center: {
43
+ type: Object,
44
+ default: () => ({ lat: 39.8283, lng: -98.5795 })
45
+ // US center
46
+ },
47
+ /** Initial zoom level */
48
+ zoom: {
49
+ type: Number,
50
+ default: 4
51
+ },
52
+ /** Map width */
53
+ width: {
54
+ type: String,
55
+ default: "100%"
56
+ },
57
+ /** Map height */
58
+ height: {
59
+ type: String,
60
+ default: "400px"
61
+ },
62
+ /** Map theme */
63
+ theme: {
64
+ type: String,
65
+ default: "ultraLight"
66
+ },
67
+ /** Auto-switch theme based on dark mode */
68
+ autoTheme: {
69
+ type: Boolean,
70
+ default: !0
71
+ },
72
+ /** Enable clustering */
73
+ enableClustering: {
74
+ type: Boolean,
75
+ default: !0
76
+ },
77
+ /** Clustering options */
78
+ clusteringOptions: {
79
+ type: Object,
80
+ default: () => ({
81
+ minimumClusterSize: 2,
82
+ maxZoom: 15,
83
+ gridSize: 60,
84
+ maxMarkersWithoutClustering: 50
85
+ // Lower threshold for better performance
86
+ })
87
+ },
88
+ /** Maximum markers to render */
89
+ maxMarkers: {
90
+ type: Number,
91
+ default: 500
92
+ },
93
+ /** Marker color */
94
+ markerColor: {
95
+ type: String,
96
+ default: "primary"
97
+ },
98
+ /** Marker size */
99
+ markerSize: {
100
+ type: String,
101
+ default: "md"
102
+ },
103
+ /** Use pin-style markers */
104
+ pinMarkers: {
105
+ type: Boolean,
106
+ default: !1
107
+ },
108
+ /** Custom marker icon */
109
+ markerIcon: {
110
+ type: Object,
111
+ default: void 0
112
+ },
113
+ /** Show info window on marker click */
114
+ showInfoWindow: {
115
+ type: Boolean,
116
+ default: !0
117
+ },
118
+ /** Show avatar in info window */
119
+ showInfoAvatar: {
120
+ type: Boolean,
121
+ default: !0
122
+ },
123
+ /** Info window actions */
124
+ infoActions: {
125
+ type: Array,
126
+ default: () => []
127
+ },
128
+ /** Info window field mapping */
129
+ infoFields: {
130
+ type: Array,
131
+ default: () => []
132
+ },
133
+ /** Data loading state */
134
+ isDataLoading: {
135
+ type: Boolean,
136
+ default: !1
137
+ },
138
+ /** Data loading text */
139
+ dataLoadingText: {
140
+ type: String,
141
+ default: "Loading data..."
142
+ },
143
+ /** Show marker count badge */
144
+ showMarkerCount: {
145
+ type: Boolean,
146
+ default: !1
147
+ },
148
+ /** Show controls */
149
+ showControls: {
150
+ type: Boolean,
151
+ default: !0
152
+ },
153
+ /** Show default zoom controls */
154
+ showDefaultZoomControls: {
155
+ type: Boolean,
156
+ default: !0
157
+ },
158
+ /** Show fit to markers button */
159
+ showFitButton: {
160
+ type: Boolean,
161
+ default: !0
162
+ },
163
+ /** Controls position */
164
+ controlsPosition: {
165
+ type: String,
166
+ default: "bottom-left"
167
+ },
168
+ /** Auto fit to markers on load */
169
+ autoFit: {
170
+ type: Boolean,
171
+ default: !1
172
+ },
173
+ /** Fit padding */
174
+ fitPadding: {
175
+ type: Number,
176
+ default: 50
177
+ }
178
+ },
179
+ emits: ["marker-click", "cluster-click", "info-action", "ready", "error", "update:visible-markers", "update:center", "update:zoom"],
180
+ setup(n, { expose: J, emit: Q }) {
181
+ function X(e, o) {
182
+ let t = null;
183
+ return (...c) => {
184
+ t && clearTimeout(t), t = setTimeout(() => e(...c), o);
185
+ };
186
+ }
187
+ const l = n, h = Q, {
188
+ markers: z,
189
+ clusters: k,
190
+ processMarkers: F,
191
+ markersFromData: Y
192
+ } = be({
193
+ clustering: l.enableClustering ? {
194
+ enabled: !0,
195
+ ...l.clusteringOptions
196
+ } : { enabled: !1 }
197
+ }), T = m(!1), w = m(null), A = m(l.center), i = m(l.zoom), u = m(null), v = m(null), p = m(null), O = m(!1), r = m({
198
+ visible: !1,
199
+ loading: !1,
200
+ error: null,
201
+ title: "",
202
+ subtitle: "",
203
+ imageUrl: "",
204
+ details: [],
205
+ actions: [],
206
+ data: void 0
207
+ }), D = B(() => ({
208
+ apiKey: l.apiKey,
209
+ googleMapId: l.googleMapId,
210
+ width: l.width,
211
+ height: l.height,
212
+ theme: l.theme,
213
+ autoTheme: l.autoTheme
214
+ })), a = B(() => {
215
+ if (!l.items.length) return [];
216
+ const e = l.items[0];
217
+ return "position" in e && "id" in e ? l.items : Y(
218
+ l.items,
219
+ l.coordinateExtractor,
220
+ l.idField
221
+ ).slice(0, l.maxMarkers);
222
+ }), W = B(() => {
223
+ if (!l.enableClustering) return !1;
224
+ const e = l.clusteringOptions?.maxZoom ?? 15;
225
+ return i.value < e && k.value.length > 0;
226
+ }), N = X((e, o) => {
227
+ T.value || (T.value = !0, me(() => {
228
+ z.value = a.value, F(e, o), T.value = !1;
229
+ }));
230
+ }, 150), j = B(() => {
231
+ if (W.value && l.enableClustering) {
232
+ const e = /* @__PURE__ */ new Set();
233
+ return k.value.forEach((o) => {
234
+ o.markers.forEach((t) => e.add(t.id));
235
+ }), a.value.filter((o) => !e.has(o.id)).slice(0, l.maxMarkers);
236
+ }
237
+ return a.value.slice(0, l.maxMarkers);
238
+ });
239
+ function _(e) {
240
+ if (p.value = e.map, O.value = !0, h("ready", e), l.enableClustering && a.value.length > 0) {
241
+ z.value = a.value;
242
+ const o = e.map.getBounds();
243
+ if (o) {
244
+ const t = o.getNorthEast(), c = o.getSouthWest(), s = {
245
+ north: t.lat(),
246
+ south: c.lat(),
247
+ east: t.lng(),
248
+ west: c.lng()
249
+ };
250
+ u.value = s;
251
+ const P = e.map.getZoom() || i.value;
252
+ i.value = P, F(P, void 0);
253
+ }
254
+ }
255
+ l.autoFit && a.value.length > 0 && setTimeout(() => I(), 100);
256
+ }
257
+ function ee() {
258
+ L();
259
+ }
260
+ function te(e) {
261
+ const o = e.bounds;
262
+ u.value && !(Math.abs(u.value.north - o.north) > 1e-3 || Math.abs(u.value.south - o.south) > 1e-3 || Math.abs(u.value.east - o.east) > 1e-3 || Math.abs(u.value.west - o.west) > 1e-3) || (u.value = o, l.enableClustering && a.value.length > 0 && N(i.value, o));
263
+ }
264
+ function le(e) {
265
+ i.value !== e.zoom && (i.value = e.zoom, h("update:zoom", e.zoom), l.enableClustering && u.value && a.value.length > 0 && N(e.zoom, u.value));
266
+ }
267
+ function oe() {
268
+ }
269
+ function ae(e) {
270
+ h("error", e);
271
+ }
272
+ function se(e) {
273
+ h("marker-click", e), l.showInfoWindow && (v.value = e.marker, R(e.marker));
274
+ }
275
+ function ne(e, o) {
276
+ h("cluster-click", { cluster: e, markers: e.markers });
277
+ const t = new google.maps.LatLngBounds();
278
+ e.markers.forEach((c) => t.extend(c.position)), o.fitBounds(t, l.fitPadding);
279
+ }
280
+ function R(e) {
281
+ const o = e.data;
282
+ r.value = {
283
+ visible: !0,
284
+ loading: !1,
285
+ error: null,
286
+ title: e.title || o?.[l.titleField] || "Details",
287
+ subtitle: o?.subtitle || "",
288
+ imageUrl: o?.imageUrl || o?.profile_image || o?.image || "",
289
+ details: l.infoFields.length > 0 ? l.infoFields.map((t) => ({
290
+ label: t.label,
291
+ value: o?.[t.field] || "",
292
+ type: t.type
293
+ })) : [],
294
+ actions: l.infoActions,
295
+ data: e.data
296
+ };
297
+ }
298
+ function L() {
299
+ r.value.visible = !1, v.value = null;
300
+ }
301
+ function re() {
302
+ v.value && R(v.value);
303
+ }
304
+ function ie(e) {
305
+ h("info-action", { ...e, marker: v.value || void 0 });
306
+ }
307
+ function ue(e) {
308
+ return {
309
+ path: 0,
310
+ // google.maps.SymbolPath.CIRCLE
311
+ scale: Math.min(20 + Math.log(e.size) * 5, 40),
312
+ fillColor: H(e.size),
313
+ fillOpacity: 0.8,
314
+ strokeColor: "#ffffff",
315
+ strokeWeight: 2
316
+ };
317
+ }
318
+ function $() {
319
+ if (w.value) {
320
+ const e = i.value;
321
+ w.value.setZoom?.(Math.min(e + 1, 21));
322
+ }
323
+ }
324
+ function V() {
325
+ if (w.value) {
326
+ const e = i.value;
327
+ w.value.setZoom?.(Math.max(e - 1, 1));
328
+ }
329
+ }
330
+ function I() {
331
+ if (!p.value || a.value.length === 0) return;
332
+ const e = new google.maps.LatLngBounds();
333
+ a.value.forEach((o) => e.extend(o.position)), p.value.fitBounds(e, l.fitPadding);
334
+ }
335
+ return E(() => l.items, () => {
336
+ z.value = a.value, l.enableClustering && u.value && a.value.length > 0 && F(i.value, u.value), l.autoFit && O.value && a.value.length > 0 && I();
337
+ }, { deep: !0 }), E(() => l.center, (e) => {
338
+ A.value = e;
339
+ }), E(() => l.zoom, (e) => {
340
+ i.value = e;
341
+ }), ce(() => {
342
+ z.value = a.value;
343
+ }), J({
344
+ getMap: () => p.value,
345
+ fitToMarkers: I,
346
+ zoomIn: $,
347
+ zoomOut: V,
348
+ panTo: (e) => p.value?.panTo(e),
349
+ setZoom: (e) => p.value?.setZoom(e),
350
+ closeInfoWindow: L,
351
+ getMarkers: () => a.value,
352
+ getVisibleMarkers: () => j.value,
353
+ getClusters: () => k.value,
354
+ getClusterIcon: ue
355
+ }), (e, o) => (f(), g(S, null, [
356
+ C(pe, fe({
357
+ ref_key: "mapRef",
358
+ ref: w
359
+ }, D.value, {
360
+ "show-custom-controls": n.showControls,
361
+ "show-default-zoom-controls": n.showDefaultZoomControls,
362
+ "controls-position": n.controlsPosition,
363
+ onReady: _,
364
+ onClick: ee,
365
+ onBoundsChanged: te,
366
+ onZoomChanged: le,
367
+ onIdle: oe,
368
+ onError: ae,
369
+ center: A.value,
370
+ "onUpdate:center": o[0] || (o[0] = (t) => A.value = t),
371
+ zoom: i.value,
372
+ "onUpdate:zoom": o[1] || (o[1] = (t) => i.value = t)
373
+ }), {
374
+ default: M(({ ready: t, map: c }) => [
375
+ t && c ? (f(), g(S, { key: 0 }, [
376
+ W.value ? (f(!0), g(S, { key: 0 }, K(b(k), (s) => (f(), q(G, {
377
+ key: s.id,
378
+ position: s.position,
379
+ id: s.id,
380
+ title: `${s.size} items in this area`,
381
+ ready: t,
382
+ cluster: !0,
383
+ "cluster-size": s.size,
384
+ "cluster-color": b(H)(s.size),
385
+ "z-index": 1e3,
386
+ onClick: (P) => ne(s, c)
387
+ }, null, 8, ["position", "id", "title", "ready", "cluster-size", "cluster-color", "onClick"]))), 128)) : y("", !0),
388
+ (f(!0), g(S, null, K(j.value, (s) => (f(), q(G, {
389
+ key: s.id,
390
+ position: s.position,
391
+ id: s.id,
392
+ title: s.title,
393
+ data: s.data,
394
+ ready: t,
395
+ color: n.markerColor,
396
+ size: n.markerSize,
397
+ pin: n.pinMarkers,
398
+ icon: n.markerIcon,
399
+ "z-index": 100,
400
+ onClick: se
401
+ }, null, 8, ["position", "id", "title", "data", "ready", "color", "size", "pin", "icon"]))), 128))
402
+ ], 64)) : y("", !0)
403
+ ]),
404
+ overlay: M(({ isDark: t }) => [
405
+ n.isDataLoading ? (f(), g("div", {
406
+ key: 0,
407
+ class: d(["sl-absolute sl-top-4 sl-left-4 sl-z-10 sl-flex sl-items-center sl-gap-2 sl-px-3 sl-py-2 sl-rounded-lg sl-shadow-md", t ? "sl-bg-gray-800" : "sl-bg-white"])
408
+ }, [
409
+ x("div", {
410
+ class: d(["sl-animate-spin sl-h-4 sl-w-4 sl-border-2 sl-border-t-transparent sl-rounded-full", t ? "sl-border-primary-400" : "sl-border-primary-600"])
411
+ }, null, 2),
412
+ x("span", {
413
+ class: d(["sl-text-sm", t ? "sl-text-gray-300" : "sl-text-gray-600"])
414
+ }, U(n.dataLoadingText), 3)
415
+ ], 2)) : y("", !0),
416
+ n.showMarkerCount && a.value.length > 0 ? (f(), g("div", {
417
+ key: 1,
418
+ class: d(["sl-absolute sl-top-4 sl-right-4 sl-z-10 sl-px-2 sl-py-1 sl-rounded-md sl-text-xs sl-font-medium", t ? "sl-bg-gray-800/90 sl-text-gray-300" : "sl-bg-white/90 sl-text-gray-700"])
419
+ }, U(a.value.length) + " " + U(a.value.length === 1 ? "marker" : "markers"), 3)) : y("", !0),
420
+ Z(e.$slots, "overlay", {
421
+ isDark: t,
422
+ markers: a.value,
423
+ clusters: b(k)
424
+ })
425
+ ]),
426
+ controls: M(({ isDark: t }) => [
427
+ x("div", ke, [
428
+ n.showDefaultZoomControls ? (f(), g("div", {
429
+ key: 0,
430
+ class: d(["sl-flex sl-flex-col sl-rounded-lg sl-shadow-md sl-overflow-hidden", t ? "sl-bg-gray-800" : "sl-bg-white"])
431
+ }, [
432
+ x("button", {
433
+ onClick: $,
434
+ class: d(["sl-w-8 sl-h-8 sl-flex sl-items-center sl-justify-center sl-border-b sl-transition-colors", t ? "sl-border-gray-700 hover:sl-bg-gray-700" : "sl-border-gray-200 hover:sl-bg-gray-50"]),
435
+ title: "Zoom in"
436
+ }, [
437
+ C(b(ge), {
438
+ class: d(["sl-w-4 sl-h-4", t ? "sl-text-gray-300" : "sl-text-gray-600"])
439
+ }, null, 8, ["class"])
440
+ ], 2),
441
+ x("button", {
442
+ onClick: V,
443
+ class: d(["sl-w-8 sl-h-8 sl-flex sl-items-center sl-justify-center sl-transition-colors", t ? "hover:sl-bg-gray-700" : "hover:sl-bg-gray-50"]),
444
+ title: "Zoom out"
445
+ }, [
446
+ C(b(ve), {
447
+ class: d(["sl-w-4 sl-h-4", t ? "sl-text-gray-300" : "sl-text-gray-600"])
448
+ }, null, 8, ["class"])
449
+ ], 2)
450
+ ], 2)) : y("", !0),
451
+ n.showFitButton && a.value.length > 0 ? (f(), g("button", {
452
+ key: 1,
453
+ onClick: I,
454
+ class: d(["sl-w-8 sl-h-8 sl-flex sl-items-center sl-justify-center sl-rounded-lg sl-shadow-md sl-transition-colors", t ? "sl-bg-gray-800 hover:sl-bg-gray-700" : "sl-bg-white hover:sl-bg-gray-50"]),
455
+ title: "Fit to all markers"
456
+ }, [
457
+ C(b(he), {
458
+ class: d(["sl-w-4 sl-h-4", t ? "sl-text-gray-300" : "sl-text-gray-600"])
459
+ }, null, 8, ["class"])
460
+ ], 2)) : y("", !0),
461
+ Z(e.$slots, "controls", { isDark: t })
462
+ ])
463
+ ]),
464
+ _: 3
465
+ }, 16, ["show-custom-controls", "show-default-zoom-controls", "controls-position", "center", "zoom"]),
466
+ C(ye, {
467
+ visible: r.value.visible,
468
+ "onUpdate:visible": o[2] || (o[2] = (t) => r.value.visible = t),
469
+ loading: r.value.loading,
470
+ error: r.value.error,
471
+ title: r.value.title,
472
+ subtitle: r.value.subtitle,
473
+ "image-url": r.value.imageUrl,
474
+ details: r.value.details,
475
+ actions: r.value.actions,
476
+ data: r.value.data,
477
+ "show-avatar": n.showInfoAvatar,
478
+ onClose: L,
479
+ onRetry: re,
480
+ onAction: ie
481
+ }, {
482
+ footer: M(() => [
483
+ Z(e.$slots, "info-footer", {
484
+ data: r.value.data,
485
+ marker: v.value
486
+ })
487
+ ]),
488
+ default: M(() => [
489
+ Z(e.$slots, "info-content", {
490
+ data: r.value.data,
491
+ marker: v.value
492
+ })
493
+ ]),
494
+ _: 3
495
+ }, 8, ["visible", "loading", "error", "title", "subtitle", "image-url", "details", "actions", "data", "show-avatar"])
496
+ ], 64));
497
+ }
498
+ });
499
+ export {
500
+ Se as _
501
+ };
@@ -1,16 +1,17 @@
1
- import { defineComponent as b, ref as h, computed as r, onMounted as D, provide as S, createElementBlock as p, openBlock as l, normalizeStyle as A, normalizeClass as L, createBlock as u, unref as O, createElementVNode as c, resolveDynamicComponent as T, toDisplayString as f } from "vue";
1
+ import { defineComponent as w, ref as p, computed as i, onMounted as z, provide as D, createElementBlock as h, openBlock as l, normalizeStyle as T, normalizeClass as S, createBlock as u, unref as L, createElementVNode as c, resolveDynamicComponent as O, toDisplayString as f } from "vue";
2
2
  import I from "vue-echarts";
3
3
  import { use as R } from "echarts/core";
4
4
  import { CanvasRenderer as E } from "echarts/renderers";
5
5
  import { LineChart as N, BarChart as V, PieChart as $, FunnelChart as j, ScatterChart as F } from "echarts/charts";
6
6
  import { TitleComponent as G, TooltipComponent as M, LegendComponent as P, GridComponent as Z, DataZoomComponent as q } from "echarts/components";
7
- import { chartColors as H, baseTheme as i } from "./chartTheme.js";
8
- import { ChartBarIcon as J } from "@heroicons/vue/24/outline";
9
- import { _ as K } from "../_plugin-vue_export-helper-CHgC5LLL.js";
10
- const Q = {
7
+ import { chartColors as H, getTheme as J } from "./chartTheme.js";
8
+ import { ChartBarIcon as K } from "@heroicons/vue/24/outline";
9
+ import { useTheme as Q } from "../composables/useTheme.js";
10
+ import { _ as U } from "../_plugin-vue_export-helper-CHgC5LLL.js";
11
+ const W = {
11
12
  key: 1,
12
13
  class: "sl-flex sl-items-center sl-justify-center sl-h-full"
13
- }, U = { class: "sl-text-center" }, W = { class: "sl-mt-2 sl-text-sm sl-font-medium sl-text-gray-900 dark:sl-text-white" }, X = { class: "sl-mt-1 sl-text-sm sl-text-gray-500 dark:sl-text-slate-400" }, Y = /* @__PURE__ */ b({
14
+ }, X = { class: "sl-text-center" }, Y = { class: "sl-mt-2 sl-text-sm sl-font-medium sl-text-gray-900 dark:sl-text-white" }, ee = { class: "sl-mt-1 sl-text-sm sl-text-gray-500 dark:sl-text-slate-400" }, te = /* @__PURE__ */ w({
14
15
  __name: "BaseChart",
15
16
  props: {
16
17
  option: {},
@@ -23,7 +24,7 @@ const Q = {
23
24
  theme: { default: "light" },
24
25
  emptyTitle: { default: "No data available" },
25
26
  emptyDescription: { default: "Data will appear here once available." },
26
- emptyIcon: { default: () => J }
27
+ emptyIcon: { default: () => K }
27
28
  },
28
29
  emits: ["click", "legendselectchanged", "ready"],
29
30
  setup(o, { expose: g, emit: y }) {
@@ -40,79 +41,98 @@ const Q = {
40
41
  Z,
41
42
  q
42
43
  ]);
43
- const e = o, s = y, C = h(null), a = h(null), x = r(() => ({
44
- height: typeof e.height == "number" ? `${e.height}px` : e.height,
45
- width: typeof e.width == "number" ? `${e.width}px` : e.width
46
- })), v = r(() => ({
44
+ const t = o, s = y, x = p(null), a = p(null), { isDark: r } = Q(), C = i(() => ({
45
+ height: typeof t.height == "number" ? `${t.height}px` : t.height,
46
+ width: typeof t.width == "number" ? `${t.width}px` : t.width
47
+ })), v = i(() => ({
47
48
  text: "Loading...",
48
49
  color: H.primary[0],
49
- textColor: "#6b7280",
50
- maskColor: "rgba(255, 255, 255, 0.8)",
51
- ...e.loadingOptions
52
- })), k = r(() => {
53
- const t = e.option;
54
- if (!t) return !1;
55
- const n = t.series;
50
+ textColor: r.value ? "#94a3b8" : "#6b7280",
51
+ maskColor: r.value ? "rgba(15, 23, 42, 0.8)" : "rgba(255, 255, 255, 0.8)",
52
+ ...t.loadingOptions
53
+ })), k = i(() => {
54
+ const e = t.option;
55
+ if (!e) return !1;
56
+ const n = e.series;
56
57
  if (!n) return !1;
57
58
  if (Array.isArray(n))
58
- return n.some((z) => {
59
- const m = z.data;
59
+ return n.some((_) => {
60
+ const m = _.data;
60
61
  return Array.isArray(m) && m.length > 0;
61
62
  });
62
63
  const d = n.data;
63
64
  return Array.isArray(d) && d.length > 0;
64
- }), B = r(() => ({
65
- ...i,
66
- ...e.option,
67
- textStyle: {
68
- ...i.textStyle || {},
69
- ...e.option?.textStyle || {}
70
- },
71
- tooltip: {
72
- ...i.tooltip || {},
73
- ...e.option?.tooltip || {}
74
- },
75
- grid: {
76
- ...i.grid || {},
77
- ...e.option?.grid || {}
78
- }
79
- })), _ = (t) => {
80
- s("click", t);
81
- }, w = (t) => {
82
- s("legendselectchanged", t);
65
+ }), A = i(() => {
66
+ const e = J(r.value);
67
+ return {
68
+ ...e,
69
+ ...t.option,
70
+ textStyle: {
71
+ ...e.textStyle || {},
72
+ ...t.option?.textStyle || {}
73
+ },
74
+ tooltip: {
75
+ ...e.tooltip || {},
76
+ ...t.option?.tooltip || {}
77
+ },
78
+ grid: {
79
+ ...e.grid || {},
80
+ ...t.option?.grid || {}
81
+ },
82
+ title: {
83
+ ...e.title || {},
84
+ ...t.option?.title || {}
85
+ },
86
+ xAxis: {
87
+ ...e.xAxis || {},
88
+ ...t.option?.xAxis || {}
89
+ },
90
+ yAxis: {
91
+ ...e.yAxis || {},
92
+ ...t.option?.yAxis || {}
93
+ },
94
+ legend: {
95
+ ...e.legend || {},
96
+ ...t.option?.legend || {}
97
+ }
98
+ };
99
+ }), b = (e) => {
100
+ s("click", e);
101
+ }, B = (e) => {
102
+ s("legendselectchanged", e);
83
103
  };
84
104
  return g({
85
105
  getChart: () => a.value?.chart,
86
106
  resize: () => a.value?.resize(),
87
- setOption: (t) => a.value?.setOption(t)
88
- }), D(() => {
107
+ setOption: (e) => a.value?.setOption(e)
108
+ }), z(() => {
89
109
  a.value?.chart && s("ready", a.value.chart);
90
- }), S("chartTheme", e.theme), (t, n) => (l(), p("div", {
110
+ }), D("chartTheme", r.value ? "dark" : "light"), (e, n) => (l(), h("div", {
91
111
  ref_key: "chartContainer",
92
- ref: C,
93
- class: L(o.containerClass),
94
- style: A(x.value)
112
+ ref: x,
113
+ class: S(o.containerClass),
114
+ style: T(C.value)
95
115
  }, [
96
- k.value ? (l(), u(O(I), {
116
+ k.value ? (l(), u(L(I), {
97
117
  key: 0,
98
118
  ref_key: "chartRef",
99
119
  ref: a,
100
- option: B.value,
120
+ option: A.value,
101
121
  autoresize: o.autoresize,
102
122
  loading: o.loading,
103
123
  "loading-options": v.value,
104
- onClick: _,
105
- onLegendselectchanged: w
106
- }, null, 8, ["option", "autoresize", "loading", "loading-options"])) : (l(), p("div", Q, [
107
- c("div", U, [
108
- (l(), u(T(o.emptyIcon), { class: "sl-mx-auto sl-h-12 sl-w-12 sl-text-gray-300 dark:sl-text-slate-600" })),
109
- c("h3", W, f(o.emptyTitle), 1),
110
- c("p", X, f(o.emptyDescription), 1)
124
+ onClick: b,
125
+ onLegendselectchanged: B
126
+ }, null, 8, ["option", "autoresize", "loading", "loading-options"])) : (l(), h("div", W, [
127
+ c("div", X, [
128
+ (l(), u(O(o.emptyIcon), { class: "sl-mx-auto sl-h-12 sl-w-12 sl-text-gray-300 dark:sl-text-slate-600" })),
129
+ c("h3", Y, f(o.emptyTitle), 1),
130
+ c("p", ee, f(o.emptyDescription), 1)
111
131
  ])
112
132
  ]))
113
133
  ], 6));
114
134
  }
115
- }), ce = /* @__PURE__ */ K(Y, [["__scopeId", "data-v-7a9624c5"]]);
135
+ }), pe = /* @__PURE__ */ U(te, [["__scopeId", "data-v-ca77ba23"]]);
116
136
  export {
117
- ce as default
137
+ pe as default
118
138
  };