@gspa/ui 0.1.1 → 0.1.4

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 (205) hide show
  1. package/README.md +18 -0
  2. package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  3. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  4. package/dist/components/Accordion.cjs +1 -0
  5. package/dist/components/Accordion.js +192 -0
  6. package/dist/components/AccordionItem.cjs +1 -0
  7. package/dist/components/AccordionItem.js +109 -0
  8. package/dist/components/AddReminderModal.cjs +1 -0
  9. package/dist/components/AddReminderModal.js +107 -0
  10. package/dist/components/Alert.cjs +1 -0
  11. package/dist/components/Alert.js +222 -0
  12. package/dist/components/Avatar.cjs +1 -0
  13. package/dist/components/Avatar.js +86 -0
  14. package/dist/components/Badge.cjs +1 -0
  15. package/dist/components/Badge.js +109 -0
  16. package/dist/components/Breadcrumb.cjs +1 -0
  17. package/dist/components/Breadcrumb.js +72 -0
  18. package/dist/components/Button.cjs +1 -0
  19. package/dist/components/Button.js +190 -0
  20. package/dist/components/ButtonGroup.cjs +1 -0
  21. package/dist/components/ButtonGroup.js +46 -0
  22. package/dist/components/Calendar.cjs +1 -0
  23. package/dist/components/Calendar.js +341 -0
  24. package/dist/components/Card.cjs +1 -0
  25. package/dist/components/Card.js +316 -0
  26. package/dist/components/CardBody.cjs +1 -0
  27. package/dist/components/CardBody.js +34 -0
  28. package/dist/components/CardContent.cjs +1 -0
  29. package/dist/components/CardContent.js +17 -0
  30. package/dist/components/CardFooter.cjs +1 -0
  31. package/dist/components/CardFooter.js +34 -0
  32. package/dist/components/CardHeader.cjs +1 -0
  33. package/dist/components/CardHeader.js +91 -0
  34. package/dist/components/CardTitle.cjs +1 -0
  35. package/dist/components/CardTitle.js +17 -0
  36. package/dist/components/Checkbox.cjs +1 -0
  37. package/dist/components/Checkbox.js +185 -0
  38. package/dist/components/CircularProgress.cjs +1 -0
  39. package/dist/components/CircularProgress.js +141 -0
  40. package/dist/components/DataTable.cjs +1 -0
  41. package/dist/components/DataTable.js +863 -0
  42. package/dist/components/DataTableCell.cjs +1 -0
  43. package/dist/components/DataTableCell.js +95 -0
  44. package/dist/components/DataTableFilters.cjs +1 -0
  45. package/dist/components/DataTableFilters.js +519 -0
  46. package/dist/components/DataTableHeader.cjs +1 -0
  47. package/dist/components/DataTableHeader.js +116 -0
  48. package/dist/components/DataTablePagination.cjs +1 -0
  49. package/dist/components/DataTablePagination.js +290 -0
  50. package/dist/components/DataTableRow.cjs +1 -0
  51. package/dist/components/DataTableRow.js +199 -0
  52. package/dist/components/DataTableToolBar.cjs +1 -0
  53. package/dist/components/DataTableToolBar.js +477 -0
  54. package/dist/components/DatePicker.cjs +1 -0
  55. package/dist/components/DatePicker.js +401 -0
  56. package/dist/components/Divider.cjs +1 -0
  57. package/dist/components/Divider.js +103 -0
  58. package/dist/components/Dropdown.cjs +1 -0
  59. package/dist/components/Dropdown.js +104 -0
  60. package/dist/components/DropdownItem.cjs +1 -0
  61. package/dist/components/DropdownItem.js +60 -0
  62. package/dist/components/EventsCalendar.cjs +1 -0
  63. package/dist/components/EventsCalendar.js +863 -0
  64. package/dist/components/FileUpload.cjs +1 -0
  65. package/dist/components/FileUpload.js +195 -0
  66. package/dist/components/FilterDrawer.cjs +1 -0
  67. package/dist/components/FilterDrawer.js +412 -0
  68. package/dist/components/Footer.cjs +1 -0
  69. package/dist/components/Footer.js +157 -0
  70. package/dist/components/FormField.cjs +1 -0
  71. package/dist/components/FormField.js +190 -0
  72. package/dist/components/Graph.cjs +1 -0
  73. package/dist/components/Graph.js +164 -0
  74. package/dist/components/GraphFilters.cjs +1 -0
  75. package/dist/components/GraphFilters.js +305 -0
  76. package/dist/components/Header.cjs +1 -0
  77. package/dist/components/Header.js +674 -0
  78. package/dist/components/Icon.cjs +1 -0
  79. package/dist/components/Icon.js +51 -0
  80. package/dist/components/Image.cjs +1 -0
  81. package/dist/components/Image.js +112 -0
  82. package/dist/components/Input.cjs +1 -0
  83. package/dist/components/Input.js +166 -0
  84. package/dist/components/InputGroup.cjs +1 -0
  85. package/dist/components/InputGroup.js +45 -0
  86. package/dist/components/Label.cjs +1 -0
  87. package/dist/components/Label.js +46 -0
  88. package/dist/components/Link.cjs +1 -0
  89. package/dist/components/Link.js +119 -0
  90. package/dist/components/ListItem.cjs +1 -0
  91. package/dist/components/ListItem.js +89 -0
  92. package/dist/components/Loader.cjs +1 -0
  93. package/dist/components/Loader.js +154 -0
  94. package/dist/components/Logo.cjs +1 -0
  95. package/dist/components/Logo.js +67 -0
  96. package/dist/components/MenuItem.cjs +1 -0
  97. package/dist/components/MenuItem.js +66 -0
  98. package/dist/components/Modal.cjs +1 -0
  99. package/dist/components/Modal.js +110 -0
  100. package/dist/components/ModalBody.cjs +1 -0
  101. package/dist/components/ModalBody.js +33 -0
  102. package/dist/components/ModalFooter.cjs +1 -0
  103. package/dist/components/ModalFooter.js +33 -0
  104. package/dist/components/ModalHeader.cjs +1 -0
  105. package/dist/components/ModalHeader.js +24 -0
  106. package/dist/components/MultiSelect.cjs +1 -0
  107. package/dist/components/MultiSelect.js +211 -0
  108. package/dist/components/Notification.cjs +1 -0
  109. package/dist/components/Notification.js +121 -0
  110. package/dist/components/Option.cjs +1 -0
  111. package/dist/components/Option.js +44 -0
  112. package/dist/components/Progress.cjs +1 -0
  113. package/dist/components/Progress.js +77 -0
  114. package/dist/components/ProgressBar.cjs +1 -0
  115. package/dist/components/ProgressBar.js +101 -0
  116. package/dist/components/Radio.cjs +1 -0
  117. package/dist/components/Radio.js +81 -0
  118. package/dist/components/RailNav.cjs +1 -0
  119. package/dist/components/RailNav.js +124 -0
  120. package/dist/components/ReminderConfig.cjs +1 -0
  121. package/dist/components/ReminderConfig.js +375 -0
  122. package/dist/components/ReusableForm.cjs +1 -0
  123. package/dist/components/ReusableForm.js +657 -0
  124. package/dist/components/ReusableFormModal.cjs +1 -0
  125. package/dist/components/ReusableFormModal.js +112 -0
  126. package/dist/components/RightDrawer.cjs +1 -0
  127. package/dist/components/RightDrawer.js +143 -0
  128. package/dist/components/Search.cjs +1 -0
  129. package/dist/components/Search.js +252 -0
  130. package/dist/components/Select.cjs +1 -0
  131. package/dist/components/Select.js +243 -0
  132. package/dist/components/Sidebar.cjs +1 -0
  133. package/dist/components/Sidebar.js +372 -0
  134. package/dist/components/Slider.cjs +1 -0
  135. package/dist/components/Slider.js +42 -0
  136. package/dist/components/Spinner.cjs +1 -0
  137. package/dist/components/Spinner.js +87 -0
  138. package/dist/components/Stepper.cjs +1 -0
  139. package/dist/components/Stepper.js +12 -0
  140. package/dist/components/StepperItem.cjs +1 -0
  141. package/dist/components/StepperItem.js +33 -0
  142. package/dist/components/Switch.cjs +1 -0
  143. package/dist/components/Switch.js +112 -0
  144. package/dist/components/Tab.cjs +1 -0
  145. package/dist/components/Tab.js +134 -0
  146. package/dist/components/TabPanel.cjs +1 -0
  147. package/dist/components/TabPanel.js +49 -0
  148. package/dist/components/Text.cjs +1 -0
  149. package/dist/components/Text.js +84 -0
  150. package/dist/components/Textarea.cjs +1 -0
  151. package/dist/components/Textarea.js +102 -0
  152. package/dist/components/ThemeConfigurator.cjs +1 -0
  153. package/dist/components/ThemeConfigurator.js +50 -0
  154. package/dist/components/Timeline.cjs +1 -0
  155. package/dist/components/Timeline.js +24 -0
  156. package/dist/components/TimelineItem.cjs +1 -0
  157. package/dist/components/TimelineItem.js +63 -0
  158. package/dist/components/Toast.cjs +1 -0
  159. package/dist/components/Toast.js +231 -0
  160. package/dist/components/Tooltip.cjs +1 -0
  161. package/dist/components/Tooltip.js +124 -0
  162. package/dist/components/Typography.cjs +1 -0
  163. package/dist/components/Typography.js +267 -0
  164. package/dist/components/charts/BarChart.cjs +1 -0
  165. package/dist/components/charts/BarChart.js +323 -0
  166. package/dist/components/charts/LineChart.cjs +1 -0
  167. package/dist/components/charts/LineChart.js +322 -0
  168. package/dist/components/charts/PieChart.cjs +1 -0
  169. package/dist/components/charts/PieChart.js +311 -0
  170. package/dist/components/charts/StackedBarChart.cjs +1 -0
  171. package/dist/components/charts/StackedBarChart.js +348 -0
  172. package/dist/components/widgets/DashboardWidget.cjs +1 -0
  173. package/dist/components/widgets/DashboardWidget.js +309 -0
  174. package/dist/directives/tooltip.cjs +47 -0
  175. package/dist/directives/tooltip.js +115 -0
  176. package/dist/index.cjs +1 -0
  177. package/dist/index.esm.js +310 -19533
  178. package/dist/layouts/AuthLayout.cjs +1 -0
  179. package/dist/layouts/AuthLayout.js +190 -0
  180. package/dist/layouts/DashboardLayout.cjs +1 -0
  181. package/dist/layouts/DashboardLayout.js +244 -0
  182. package/dist/layouts/DefaultLayout.cjs +1 -0
  183. package/dist/layouts/DefaultLayout.js +94 -0
  184. package/dist/layouts/ErrorLayout.cjs +1 -0
  185. package/dist/layouts/ErrorLayout.js +452 -0
  186. package/dist/lib/auth.cjs +1 -0
  187. package/dist/lib/auth.js +4 -0
  188. package/dist/lib/theme.cjs +1 -0
  189. package/dist/lib/theme.js +135 -0
  190. package/dist/lib/toast.cjs +1 -0
  191. package/dist/lib/toast.js +81 -0
  192. package/dist/src/__tests__/AuthLayout.spec.d.ts +2 -0
  193. package/dist/src/__tests__/AuthLayout.spec.d.ts.map +1 -0
  194. package/dist/src/layouts/AuthLayout.vue.d.ts +10 -6
  195. package/dist/src/layouts/AuthLayout.vue.d.ts.map +1 -1
  196. package/dist/tsconfig.tsbuildinfo +1 -1
  197. package/dist/utils/cn.cjs +1 -0
  198. package/dist/utils/cn.js +7 -0
  199. package/package.json +43 -11
  200. package/dist/applogo.png +0 -0
  201. package/dist/favicon.ico +0 -0
  202. package/dist/index.js +0 -605
  203. package/dist/logo.png +0 -0
  204. package/dist/stlbacklogo.jpeg +0 -0
  205. package/dist/stlbacklogo.png +0 -0
@@ -0,0 +1,348 @@
1
+ import { ref as M, computed as c, onMounted as Z, onBeforeUnmount as _, createElementBlock as a, openBlock as s, createCommentVNode as v, createElementVNode as i, Fragment as b, renderList as x, normalizeStyle as z, toDisplayString as f, normalizeClass as $ } from "vue";
2
+ const I = {
3
+ key: 0,
4
+ class: "absolute top-3 left-3 z-10 ui-surface border ui-border-strong rounded-md px-2.5 py-2"
5
+ }, ee = { class: "flex items-center gap-3 flex-wrap" }, te = { class: "text-xs font-semibold ui-text" }, le = ["width", "height", "viewBox"], oe = { key: 0 }, ae = ["x1", "y1", "x2", "y2", "stroke"], se = ["id"], ne = ["stop-color"], re = ["stop-color"], ie = ["x", "y", "width", "height", "fill", "onMouseenter", "onClick"], ue = ["to", "begin"], de = ["from", "to", "begin"], ce = { key: 0 }, he = ["x", "y"], ge = { key: 1 }, fe = ["x", "y"], ye = { key: 2 }, ve = ["x", "y"], be = { key: 3 }, xe = ["x", "y"], me = { key: 4 }, pe = ["x", "y"], we = ["x1", "y1", "x2", "y2"], ke = ["x1", "y1", "x2", "y2"], Le = { class: "ui-surface ui-text px-4 py-3 rounded-lg shadow-2xl border ui-border-strong min-w-[180px]" }, $e = { class: "flex items-center gap-2 mb-2" }, Be = { class: "font-semibold text-sm" }, Se = { class: "ml-5" }, Ae = { class: "text-xs ui-text mb-1" }, Ce = { class: "text-2xl font-bold" }, Ve = {
6
+ __name: "StackedBarChart",
7
+ props: {
8
+ data: {
9
+ type: Array,
10
+ required: !0
11
+ // Expected format: [{ complied: 60, uncomplied: 40 }, ...]
12
+ },
13
+ labels: {
14
+ type: Array,
15
+ default: () => []
16
+ },
17
+ colors: {
18
+ type: Array,
19
+ default: () => ["#f97316", "#10b981"]
20
+ // [complied color, uncomplied color]
21
+ },
22
+ groupKeys: {
23
+ type: Array,
24
+ default: () => ["complied", "uncomplied"]
25
+ // Left to right order
26
+ },
27
+ width: {
28
+ type: [Number, String],
29
+ default: "auto"
30
+ },
31
+ height: {
32
+ type: [Number, String],
33
+ default: "auto"
34
+ },
35
+ padding: {
36
+ type: Object,
37
+ default: () => ({ top: 20, right: 20, bottom: 60, left: 60 })
38
+ },
39
+ showGrid: {
40
+ type: Boolean,
41
+ default: !0
42
+ },
43
+ showXAxis: {
44
+ type: Boolean,
45
+ default: !0
46
+ },
47
+ showYAxis: {
48
+ type: Boolean,
49
+ default: !0
50
+ },
51
+ gridColor: {
52
+ type: String,
53
+ default: "#e5e7eb"
54
+ },
55
+ barClasses: {
56
+ type: String,
57
+ default: "transition-all duration-200 hover:opacity-90 cursor-pointer"
58
+ },
59
+ axisLabelClasses: {
60
+ type: String,
61
+ default: "fill-(--ui-text) text-xs font-medium"
62
+ },
63
+ maxValue: {
64
+ type: Number,
65
+ default: 100
66
+ // Default for percentages
67
+ },
68
+ xAxisLabel: {
69
+ type: String,
70
+ default: ""
71
+ },
72
+ yAxisLabel: {
73
+ type: String,
74
+ default: ""
75
+ },
76
+ showValues: {
77
+ type: Boolean,
78
+ default: !0
79
+ },
80
+ valueSuffix: {
81
+ type: String,
82
+ default: ""
83
+ },
84
+ showLegend: {
85
+ type: Boolean,
86
+ default: !0
87
+ },
88
+ legendLabels: {
89
+ type: Array,
90
+ default: () => []
91
+ }
92
+ },
93
+ emits: ["bar-click", "bar-hover"],
94
+ setup(t, { emit: W }) {
95
+ const o = t, K = W, B = M(null), m = M({ width: 0, height: 0 });
96
+ let k = null;
97
+ const p = c(() => {
98
+ const e = Number(o.width);
99
+ return Number.isFinite(e) && e > 0 ? e : m.value.width > 0 ? m.value.width : 400;
100
+ }), h = c(() => {
101
+ const e = Number(o.height);
102
+ return Number.isFinite(e) && e > 0 ? e : m.value.height > 0 ? m.value.height : 300;
103
+ }), g = M({
104
+ visible: !1,
105
+ x: 0,
106
+ y: 0,
107
+ label: "",
108
+ barLabel: "",
109
+ value: 0,
110
+ color: ""
111
+ }), y = c(() => h.value - o.padding.top - o.padding.bottom), S = c(() => p.value - o.padding.left - o.padding.right), A = c(() => S.value / o.data.length * 0.8), X = c(() => S.value / o.data.length * 0.2), C = c(() => A.value / o.groupKeys.length), F = c(() => 0), G = c(() => {
112
+ const e = [];
113
+ for (let l = 0; l <= 5; l++) {
114
+ const r = o.padding.top + y.value / 5 * l;
115
+ e.push(r);
116
+ }
117
+ return e;
118
+ }), Y = (e) => o.padding.left + e * (A.value + X.value) + X.value / 2, E = (e, n) => Y(e) + n * (C.value + F.value), N = (e) => {
119
+ const n = y.value / o.maxValue;
120
+ return o.padding.top + y.value - e * n;
121
+ }, R = (e) => {
122
+ const n = y.value / o.maxValue;
123
+ return e * n;
124
+ }, L = (e) => o.colors[e % o.colors.length], H = (e) => (Number(e) || 0) <= 0 ? o.padding.top + y.value - 6 : Math.max(N(e) + 18, o.padding.top + 16), O = (e) => (Number(e) || 0) <= 0 ? "fill-(--ui-text) text-[10px] font-semibold" : "fill-white text-[10px] font-semibold", U = (e) => {
125
+ const n = (h.value - o.padding.bottom - e) / y.value * o.maxValue;
126
+ return V(Math.round(n));
127
+ }, T = (e) => e.charAt(0).toUpperCase() + e.slice(1), j = c(() => o.valueSuffix ? o.valueSuffix : String(o.yAxisLabel || "").includes("%") || o.maxValue === 100 ? "%" : ""), V = (e) => `${e}${j.value}`, q = c(() => o.groupKeys.map((e, n) => ({
128
+ key: e,
129
+ color: L(n),
130
+ label: o.legendLabels[n] || T(e)
131
+ }))), D = (e, n, l) => {
132
+ const r = o.data[n], d = o.groupKeys[l], u = r[d] || 0, w = o.labels[n] || `Item ${n + 1}`, Q = T(d);
133
+ g.value = {
134
+ visible: !0,
135
+ x: e.clientX,
136
+ y: e.clientY,
137
+ label: w,
138
+ barLabel: Q,
139
+ value: u,
140
+ color: L(l)
141
+ }, K("bar-hover", { dataIndex: n, barIndex: l, key: d, value: u, label: w });
142
+ }, J = () => {
143
+ g.value.visible = !1;
144
+ }, P = (e, n) => {
145
+ const l = o.data[e], r = o.groupKeys[n], d = l[r] || 0, u = o.labels[e] || `Item ${e + 1}`;
146
+ K("bar-click", { dataIndex: e, barIndex: n, key: r, value: d, label: u });
147
+ };
148
+ return Z(() => {
149
+ k = new ResizeObserver((e) => {
150
+ const n = e[0];
151
+ if (!n) return;
152
+ const { width: l, height: r } = n.contentRect;
153
+ m.value = {
154
+ width: Math.round(l),
155
+ height: Math.round(r)
156
+ };
157
+ }), B.value && k.observe(B.value);
158
+ }), _(() => {
159
+ k && k.disconnect();
160
+ }), (e, n) => (s(), a("div", {
161
+ ref_key: "containerRef",
162
+ ref: B,
163
+ class: "w-full h-full relative"
164
+ }, [
165
+ t.showLegend ? (s(), a("div", I, [
166
+ i("div", ee, [
167
+ (s(!0), a(b, null, x(q.value, (l) => (s(), a("div", {
168
+ key: `legend-${l.key}`,
169
+ class: "flex items-center gap-1.5"
170
+ }, [
171
+ i("span", {
172
+ class: "w-2.5 h-2.5 rounded-sm",
173
+ style: z({ backgroundColor: l.color })
174
+ }, null, 4),
175
+ i("span", te, f(l.label), 1)
176
+ ]))), 128))
177
+ ])
178
+ ])) : v("", !0),
179
+ (s(), a("svg", {
180
+ width: p.value,
181
+ height: h.value,
182
+ viewBox: `0 0 ${p.value} ${h.value}`,
183
+ class: "overflow-visible"
184
+ }, [
185
+ t.showGrid ? (s(), a("g", oe, [
186
+ (s(!0), a(b, null, x(G.value, (l) => (s(), a("line", {
187
+ key: `grid-${l}`,
188
+ x1: t.padding.left,
189
+ y1: l,
190
+ x2: p.value - t.padding.right,
191
+ y2: l,
192
+ stroke: t.gridColor,
193
+ "stroke-width": "1",
194
+ "stroke-dasharray": "4,4",
195
+ opacity: "0.3"
196
+ }, null, 8, ae))), 128))
197
+ ])) : v("", !0),
198
+ i("defs", null, [
199
+ (s(!0), a(b, null, x(t.groupKeys, (l, r) => (s(), a("linearGradient", {
200
+ id: `barGradient-${r}`,
201
+ key: `gradient-${r}`,
202
+ x1: "0%",
203
+ y1: "0%",
204
+ x2: "0%",
205
+ y2: "100%"
206
+ }, [
207
+ i("stop", {
208
+ offset: "0%",
209
+ "stop-color": L(r),
210
+ "stop-opacity": "0.95"
211
+ }, null, 8, ne),
212
+ i("stop", {
213
+ offset: "100%",
214
+ "stop-color": L(r),
215
+ "stop-opacity": "0.85"
216
+ }, null, 8, re)
217
+ ], 8, se))), 128))
218
+ ]),
219
+ i("g", null, [
220
+ (s(!0), a(b, null, x(t.data, (l, r) => (s(), a("g", {
221
+ key: `bar-group-${r}`
222
+ }, [
223
+ (s(!0), a(b, null, x(t.groupKeys, (d, u) => (s(), a("rect", {
224
+ key: `bar-${r}-${u}`,
225
+ x: E(r, u),
226
+ y: N(l[d] || 0),
227
+ width: C.value,
228
+ height: R(l[d] || 0),
229
+ fill: `url(#barGradient-${u})`,
230
+ class: $(t.barClasses),
231
+ rx: "4",
232
+ onMouseenter: (w) => D(w, r, u),
233
+ onMouseleave: J,
234
+ onClick: (w) => P(r, u)
235
+ }, [
236
+ i("animate", {
237
+ attributeName: "height",
238
+ from: 0,
239
+ to: R(l[d] || 0),
240
+ dur: "0.6s",
241
+ begin: `${u * 0.1}s`,
242
+ fill: "freeze"
243
+ }, null, 8, ue),
244
+ i("animate", {
245
+ attributeName: "y",
246
+ from: t.padding.top + y.value,
247
+ to: N(l[d] || 0),
248
+ dur: "0.6s",
249
+ begin: `${u * 0.1}s`,
250
+ fill: "freeze"
251
+ }, null, 8, de)
252
+ ], 42, ie))), 128)),
253
+ t.showValues ? (s(), a("g", ce, [
254
+ (s(!0), a(b, null, x(t.groupKeys, (d, u) => (s(), a("text", {
255
+ key: `bar-value-${r}-${u}`,
256
+ x: E(r, u) + C.value / 2,
257
+ y: H(l[d] || 0),
258
+ class: $(O(l[d] || 0)),
259
+ "text-anchor": "middle"
260
+ }, f(V(l[d] || 0)), 11, he))), 128))
261
+ ])) : v("", !0)
262
+ ]))), 128))
263
+ ]),
264
+ t.showXAxis ? (s(), a("g", ge, [
265
+ (s(!0), a(b, null, x(t.labels, (l, r) => (s(), a("text", {
266
+ key: `xlabel-${r}`,
267
+ x: Y(r) + A.value / 2,
268
+ y: h.value - t.padding.bottom + 20,
269
+ class: $(t.axisLabelClasses),
270
+ "text-anchor": "middle"
271
+ }, f(l), 11, fe))), 128))
272
+ ])) : v("", !0),
273
+ t.xAxisLabel ? (s(), a("g", ye, [
274
+ i("text", {
275
+ x: t.padding.left + S.value / 2,
276
+ y: h.value - 10,
277
+ class: "fill-(--ui-text) text-sm font-semibold",
278
+ "text-anchor": "middle"
279
+ }, f(t.xAxisLabel), 9, ve)
280
+ ])) : v("", !0),
281
+ t.showYAxis ? (s(), a("g", be, [
282
+ (s(!0), a(b, null, x(G.value, (l) => (s(), a("text", {
283
+ key: `ylabel-${l}`,
284
+ x: t.padding.left - 10,
285
+ y: l + 4,
286
+ class: $(t.axisLabelClasses),
287
+ "text-anchor": "end"
288
+ }, f(U(l)), 11, xe))), 128))
289
+ ])) : v("", !0),
290
+ t.yAxisLabel ? (s(), a("g", me, [
291
+ i("text", {
292
+ x: -(t.padding.top + y.value / 2),
293
+ y: t.padding.left - 40,
294
+ class: "fill-(--ui-text) text-sm font-semibold",
295
+ "text-anchor": "middle",
296
+ transform: "rotate(-90)"
297
+ }, f(t.yAxisLabel), 9, pe)
298
+ ])) : v("", !0),
299
+ i("line", {
300
+ x1: t.padding.left,
301
+ y1: t.padding.top,
302
+ x2: t.padding.left,
303
+ y2: h.value - t.padding.bottom,
304
+ stroke: "#cbd5e1",
305
+ "stroke-width": "2"
306
+ }, null, 8, we),
307
+ i("line", {
308
+ x1: t.padding.left,
309
+ y1: h.value - t.padding.bottom,
310
+ x2: p.value - t.padding.right,
311
+ y2: h.value - t.padding.bottom,
312
+ stroke: "#cbd5e1",
313
+ "stroke-width": "2"
314
+ }, null, 8, ke)
315
+ ], 8, le)),
316
+ g.value.visible ? (s(), a("div", {
317
+ key: 1,
318
+ style: z({
319
+ position: "fixed",
320
+ left: `${g.value.x}px`,
321
+ top: `${g.value.y}px`,
322
+ transform: "translate(-50%, -120%)",
323
+ pointerEvents: "none",
324
+ zIndex: 9999
325
+ }),
326
+ class: "animate-in fade-in duration-200"
327
+ }, [
328
+ i("div", Le, [
329
+ i("div", $e, [
330
+ i("div", {
331
+ style: z({ backgroundColor: g.value.color }),
332
+ class: "w-3 h-3 rounded shadow-sm"
333
+ }, null, 4),
334
+ i("p", Be, f(g.value.label), 1)
335
+ ]),
336
+ i("div", Se, [
337
+ i("p", Ae, f(g.value.barLabel), 1),
338
+ i("span", Ce, f(V(g.value.value)), 1)
339
+ ]),
340
+ n[0] || (n[0] = i("div", { class: "absolute bottom-0 left-1/2 transform -translate-x-1/2 translate-y-1/2 rotate-45 w-2 h-2 ui-surface border-r border-b ui-border-strong" }, null, -1))
341
+ ])
342
+ ], 4)) : v("", !0)
343
+ ], 512));
344
+ }
345
+ };
346
+ export {
347
+ Ve as default
348
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("../Icon.cjs"),O=require("../Loader.cjs"),L=require("../charts/BarChart.cjs"),_=require("../charts/LineChart.cjs"),C=require("../charts/PieChart.cjs"),P=require("../../utils/cn.cjs"),A={key:0,class:"flex bg-(--ui-surface) items-center justify-between px-6 py-4 border-b ui-border-strong shrink-0"},F={class:"flex items-center gap-3"},K={class:"font-semibold text-lg ui-text"},M={class:"flex items-center gap-2"},W=["disabled"],I={key:1,class:"absolute top-16 right-4 z-20 ui-surface rounded-lg shadow-xl border ui-border-strong p-4 min-w-[250px]"},X={class:"flex items-center justify-between mb-3"},Y={class:"space-y-3"},G=["for"],U=["id","onClick"],J={key:2,class:"absolute top-16 right-4 z-20 ui-surface rounded-lg shadow-xl border ui-border-strong p-4 min-w-[280px]"},Q={class:"flex items-center justify-between mb-3"},Z={class:"space-y-2"},ee={class:"ui-text"},te={class:"px-2 py-1 ui-surface-muted border ui-border-strong rounded text-xs font-mono"},ae={class:"relative flex-1 overflow-hidden"},oe={key:0,class:"absolute inset-0 bg-[color:color-mix(in oklab, var(--ui-surface), transparent 10%)] backdrop-blur-sm z-10 flex items-center justify-center"},ne={class:"w-full h-full flex items-center justify-center"},re={key:3,class:"border-t ui-border-strong px-6 py-3 ui-surface-muted shrink-0"},le={__name:"DashboardWidget",props:{id:{type:String,required:!0},title:{type:String,required:!0},icon:{type:String,default:null},requiredRoles:{type:Function,default:null},loading:{type:Boolean,default:!1},height:{type:String,default:"auto"},maxHeight:{type:String,default:"none"},minHeight:{type:String,default:"200px"},width:{type:String,default:"100%"},showRefresh:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},padding:{type:String,default:"normal"},hasRole:{type:Function,default:()=>()=>!1},chartType:{type:String,default:null},chartData:{type:Object,default:null},chartOptions:{type:Object,default:()=>({})},customizationOptions:{type:Array,default:()=>[]}},emits:["refresh","dragstart","dragend","customize","keypress"],setup(l,{emit:E}){const a=l,c=E,N=e.computed(()=>a.requiredRoles?a.requiredRoles(a.hasRole):!0),B=e.computed(()=>({width:a.width,height:a.height!=="auto"?a.height:void 0,maxHeight:a.maxHeight!=="none"?a.maxHeight:void 0,minHeight:a.minHeight})),y={none:"",small:"p-3",normal:"p-4",large:"p-6"},u=e.ref(!1),r=e.ref({});e.onMounted(()=>{a.customizationOptions.forEach(t=>{r.value[t.id]=t.default??!0})});const g=()=>{u.value=!u.value},V=(t,o)=>{r.value[t]=o,c("customize",{...r.value})},D=e.ref(null),m=e.ref(!1),b=t=>{if(!m.value)return;const o={r:()=>c("refresh"),R:()=>c("refresh"),c:()=>g(),C:()=>g(),Escape:()=>u.value=!1,h:()=>i.value=!i.value,H:()=>i.value=!i.value,"?":()=>i.value=!i.value};o[t.key]&&(t.preventDefault(),o[t.key](),c("keypress",t.key))},S=()=>{m.value=!0},z=()=>{m.value=!1},i=e.ref(!1),$=[{key:"R",description:"Refresh widget"},{key:"C",description:"Open customization"},{key:"Esc",description:"Close panels"},{key:"?",description:"Toggle help"}],p=e.ref(!1);let s=null;const R=t=>{if(!t.dataTransfer)return;p.value=!0,c("dragstart",a.id);const o=t.target.getBoundingClientRect();s=t.target.cloneNode(!0),Object.assign(s.style,{position:"fixed",width:`${o.width}px`,height:`${o.height}px`,pointerEvents:"none",opacity:"0.8",zIndex:"1000",left:`${t.clientX-o.width/2}px`,top:`${t.clientY-o.height/2}px`}),document.body.appendChild(s),t.dataTransfer.setDragImage(s,o.width/2,o.height/2),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",a.id)},k=t=>{s&&t.clientX&&t.clientY&&(s.style.left=`${t.clientX-s.offsetWidth/2}px`,s.style.top=`${t.clientY-s.offsetHeight/2}px`)},H=()=>{p.value=!1,c("dragend",a.id),s&&(document.body.removeChild(s),s=null)},w=e.computed(()=>{if(!a.chartType||!a.chartData)return null;const t=a.chartData.datasets?.[0]?.data||a.chartData.data||[],o=a.chartData.labels||[],n=t.filter(f=>f!=null&&!isNaN(f));if(n.length===0)return null;const v=a.chartType==="pie"||a.chartType==="doughnut",j=v?450:400,q=v?450:400,d={data:n,labels:o.slice(0,n.length),width:j,height:q,seriesLabel:a.chartData.datasets?.[0]?.label||a.title,...a.chartOptions};if(r.value.legend!==void 0&&(d.showLegend=r.value.legend),r.value.grid!==void 0&&(d.showGrid=r.value.grid),r.value.values!==void 0&&(d.showValues=r.value.values),r.value.percentages!==void 0&&(d.showPercentages=r.value.percentages),r.value.points!==void 0&&(d.showPoints=r.value.points),r.value.fillArea!==void 0&&(d.fillArea=r.value.fillArea),a.chartData.datasets?.[0]?.backgroundColor){const f=a.chartData.datasets[0].backgroundColor;d.colors=Array.isArray(f)?f:[f]}return a.chartData.datasets?.[0]?.borderColor&&(d.lineColor=a.chartData.datasets[0].borderColor),d}),x=e.computed(()=>{switch(a.chartType){case"bar":return L.default;case"line":return _.default;case"pie":return C.default;case"doughnut":return C.default;default:return null}}),T=e.computed(()=>a.chartType==="doughnut");return e.onMounted(()=>{window.addEventListener("dragover",k),window.addEventListener("keydown",b)}),e.onUnmounted(()=>{window.removeEventListener("dragover",k),window.removeEventListener("keydown",b),s&&document.body.removeChild(s)}),(t,o)=>N.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"widgetRef",ref:D,draggable:"true",tabindex:"0",style:e.normalizeStyle(B.value),class:e.normalizeClass(e.unref(P.cn)(" rounded-xl border ui-border-strong overflow-hidden transition-all select-none flex flex-col relative","shadow-sm",p.value?"opacity-50 scale-95":"hover:shadow-lg cursor-move",m.value?"ring-2 ring-(--ui-primary) ring-offset-2":"")),onDragstart:R,onDragend:H,onFocus:S,onBlur:z},[l.showHeader?(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",F,[l.icon?(e.openBlock(),e.createBlock(h.default,{key:0,icon:l.icon,class:"w-5 h-5 ui-text"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("h3",K,e.toDisplayString(l.title),1)]),e.createElementVNode("div",M,[e.renderSlot(t.$slots,"header-actions"),e.createElementVNode("button",{class:"p-2 rounded-lg hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 20%)] transition-all duration-200 hover:scale-105 active:scale-95",title:"Keyboard shortcuts (?)",onClick:o[0]||(o[0]=n=>i.value=!i.value)},[e.createVNode(h.default,{icon:"circle-info",class:"w-4 h-4 ui-text"})]),l.customizationOptions.length>0?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["p-2 rounded-lg hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 20%)] transition-all duration-200 hover:scale-105 active:scale-95",{"ui-primary-soft":u.value}]),title:"Customize (C)",onClick:g},[e.createVNode(h.default,{icon:"gear",class:"w-4 h-4 ui-text"})],2)):e.createCommentVNode("",!0),l.showRefresh?(e.openBlock(),e.createElementBlock("button",{key:1,class:"p-2 rounded-lg hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 20%)] transition-all duration-200 hover:scale-105 active:scale-95",disabled:l.loading,title:"Refresh (R)",onClick:o[1]||(o[1]=n=>t.$emit("refresh"))},[e.createVNode(h.default,{icon:"refresh",class:e.normalizeClass(["w-4 h-4 ui-text transition-transform duration-500",{"animate-spin":l.loading}])},null,8,["class"])],8,W)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("div",X,[o[4]||(o[4]=e.createElementVNode("h4",{class:"font-semibold text-sm ui-text"}," Customize Widget ",-1)),e.createElementVNode("button",{class:"p-1 rounded hover:bg-(--ui-surface)",onClick:o[2]||(o[2]=n=>u.value=!1)},[e.createVNode(h.default,{icon:"x",class:"w-4 h-4 ui-text"})])]),e.createElementVNode("div",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.customizationOptions,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"flex items-center justify-between"},[e.createElementVNode("label",{for:`setting-${n.id}`,class:"text-sm ui-text cursor-pointer"},e.toDisplayString(n.label),9,G),e.createElementVNode("button",{id:`setting-${n.id}`,class:e.normalizeClass(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors",r.value[n.id]?"ui-primary":"ui-surface"]),onClick:v=>V(n.id,!r.value[n.id])},[e.createElementVNode("span",{class:e.normalizeClass(["inline-block h-4 w-4 transform rounded-full ui-surface transition-transform",r.value[n.id]?"translate-x-6":"translate-x-1"])},null,2)],10,U)]))),128))])])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("div",Q,[o[5]||(o[5]=e.createElementVNode("h4",{class:"font-semibold text-sm ui-text"}," Keyboard Shortcuts ",-1)),e.createElementVNode("button",{class:"p-1 rounded hover:bg-(--ui-surface)",onClick:o[3]||(o[3]=n=>i.value=!1)},[e.createVNode(h.default,{icon:"x",class:"w-4 h-4 ui-text"})])]),e.createElementVNode("div",Z,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList($,n=>e.createElementVNode("div",{key:n.key,class:"flex items-center justify-between text-sm"},[e.createElementVNode("span",ee,e.toDisplayString(n.description),1),e.createElementVNode("kbd",te,e.toDisplayString(n.key),1)])),64))])])):e.createCommentVNode("",!0),e.createElementVNode("div",ae,[l.loading?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(O.default,{type:"spin",size:"medium",color:"#3b82f6"})])):e.createCommentVNode("",!0),l.chartType&&l.chartData&&x.value&&w.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["w-full h-full flex items-center justify-center p-4",y[l.padding]])},[e.createElementVNode("div",ne,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.value),e.mergeProps(w.value,{doughnut:T.value}),null,16,["doughnut"]))])],2)):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["overflow-auto h-full",y[l.padding]])},[e.renderSlot(t.$slots,"default")],2))]),t.$slots.footer?(e.openBlock(),e.createElementBlock("div",re,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)}};exports.default=le;
@@ -0,0 +1,309 @@
1
+ import { computed as w, ref as p, onMounted as E, onUnmounted as U, createElementBlock as u, createCommentVNode as f, openBlock as o, normalizeClass as h, normalizeStyle as J, unref as Q, createElementVNode as n, createBlock as O, toDisplayString as k, renderSlot as z, createVNode as y, Fragment as B, renderList as L, resolveDynamicComponent as Z, mergeProps as ee } from "vue";
2
+ import b from "../Icon.js";
3
+ import te from "../Loader.js";
4
+ import ae from "../charts/BarChart.js";
5
+ import se from "../charts/LineChart.js";
6
+ import _ from "../charts/PieChart.js";
7
+ import { cn as ne } from "../../utils/cn.js";
8
+ const re = {
9
+ key: 0,
10
+ class: "flex bg-(--ui-surface) items-center justify-between px-6 py-4 border-b ui-border-strong shrink-0"
11
+ }, ie = { class: "flex items-center gap-3" }, oe = { class: "font-semibold text-lg ui-text" }, le = { class: "flex items-center gap-2" }, ue = ["disabled"], de = {
12
+ key: 1,
13
+ class: "absolute top-16 right-4 z-20 ui-surface rounded-lg shadow-xl border ui-border-strong p-4 min-w-[250px]"
14
+ }, ce = { class: "flex items-center justify-between mb-3" }, fe = { class: "space-y-3" }, he = ["for"], ge = ["id", "onClick"], me = {
15
+ key: 2,
16
+ class: "absolute top-16 right-4 z-20 ui-surface rounded-lg shadow-xl border ui-border-strong p-4 min-w-[280px]"
17
+ }, ve = { class: "flex items-center justify-between mb-3" }, pe = { class: "space-y-2" }, ye = { class: "ui-text" }, be = { class: "px-2 py-1 ui-surface-muted border ui-border-strong rounded text-xs font-mono" }, we = { class: "relative flex-1 overflow-hidden" }, xe = {
18
+ key: 0,
19
+ class: "absolute inset-0 bg-[color:color-mix(in oklab, var(--ui-surface), transparent 10%)] backdrop-blur-sm z-10 flex items-center justify-center"
20
+ }, ke = { class: "w-full h-full flex items-center justify-center" }, Ce = {
21
+ key: 3,
22
+ class: "border-t ui-border-strong px-6 py-3 ui-surface-muted shrink-0"
23
+ }, je = {
24
+ __name: "DashboardWidget",
25
+ props: {
26
+ id: { type: String, required: !0 },
27
+ title: { type: String, required: !0 },
28
+ icon: { type: String, default: null },
29
+ requiredRoles: { type: Function, default: null },
30
+ loading: { type: Boolean, default: !1 },
31
+ height: { type: String, default: "auto" },
32
+ maxHeight: { type: String, default: "none" },
33
+ minHeight: { type: String, default: "200px" },
34
+ width: { type: String, default: "100%" },
35
+ showRefresh: { type: Boolean, default: !0 },
36
+ showHeader: { type: Boolean, default: !0 },
37
+ padding: { type: String, default: "normal" },
38
+ hasRole: {
39
+ type: Function,
40
+ default: () => () => !1
41
+ },
42
+ chartType: { type: String, default: null },
43
+ chartData: { type: Object, default: null },
44
+ chartOptions: { type: Object, default: () => ({}) },
45
+ customizationOptions: {
46
+ type: Array,
47
+ default: () => []
48
+ }
49
+ },
50
+ emits: ["refresh", "dragstart", "dragend", "customize", "keypress"],
51
+ setup(i, { emit: A }) {
52
+ const t = i, g = A, F = w(() => t.requiredRoles ? t.requiredRoles(t.hasRole) : !0), N = w(() => ({
53
+ width: t.width,
54
+ height: t.height !== "auto" ? t.height : void 0,
55
+ maxHeight: t.maxHeight !== "none" ? t.maxHeight : void 0,
56
+ minHeight: t.minHeight
57
+ })), S = {
58
+ none: "",
59
+ small: "p-3",
60
+ normal: "p-4",
61
+ large: "p-6"
62
+ }, m = p(!1), r = p({});
63
+ E(() => {
64
+ t.customizationOptions.forEach((e) => {
65
+ r.value[e.id] = e.default ?? !0;
66
+ });
67
+ });
68
+ const C = () => {
69
+ m.value = !m.value;
70
+ }, P = (e, a) => {
71
+ r.value[e] = a, g("customize", { ...r.value });
72
+ }, q = p(null), x = p(!1), R = (e) => {
73
+ if (!x.value) return;
74
+ const a = {
75
+ r: () => g("refresh"),
76
+ R: () => g("refresh"),
77
+ c: () => C(),
78
+ C: () => C(),
79
+ Escape: () => m.value = !1,
80
+ h: () => d.value = !d.value,
81
+ H: () => d.value = !d.value,
82
+ "?": () => d.value = !d.value
83
+ };
84
+ a[e.key] && (e.preventDefault(), a[e.key](), g("keypress", e.key));
85
+ }, V = () => {
86
+ x.value = !0;
87
+ }, K = () => {
88
+ x.value = !1;
89
+ }, d = p(!1), W = [
90
+ { key: "R", description: "Refresh widget" },
91
+ { key: "C", description: "Open customization" },
92
+ { key: "Esc", description: "Close panels" },
93
+ { key: "?", description: "Toggle help" }
94
+ ], D = p(!1);
95
+ let l = null;
96
+ const X = (e) => {
97
+ if (!e.dataTransfer) return;
98
+ D.value = !0, g("dragstart", t.id);
99
+ const a = e.target.getBoundingClientRect();
100
+ l = e.target.cloneNode(!0), Object.assign(l.style, {
101
+ position: "fixed",
102
+ width: `${a.width}px`,
103
+ height: `${a.height}px`,
104
+ pointerEvents: "none",
105
+ opacity: "0.8",
106
+ zIndex: "1000",
107
+ left: `${e.clientX - a.width / 2}px`,
108
+ top: `${e.clientY - a.height / 2}px`
109
+ }), document.body.appendChild(l), e.dataTransfer.setDragImage(l, a.width / 2, a.height / 2), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t.id);
110
+ }, H = (e) => {
111
+ l && e.clientX && e.clientY && (l.style.left = `${e.clientX - l.offsetWidth / 2}px`, l.style.top = `${e.clientY - l.offsetHeight / 2}px`);
112
+ }, Y = () => {
113
+ D.value = !1, g("dragend", t.id), l && (document.body.removeChild(l), l = null);
114
+ }, T = w(() => {
115
+ if (!t.chartType || !t.chartData) return null;
116
+ const e = t.chartData.datasets?.[0]?.data || t.chartData.data || [], a = t.chartData.labels || [], s = e.filter((v) => v != null && !isNaN(v));
117
+ if (s.length === 0) return null;
118
+ const $ = t.chartType === "pie" || t.chartType === "doughnut", G = $ ? 450 : 400, M = $ ? 450 : 400, c = {
119
+ data: s,
120
+ labels: a.slice(0, s.length),
121
+ width: G,
122
+ height: M,
123
+ seriesLabel: t.chartData.datasets?.[0]?.label || t.title,
124
+ ...t.chartOptions
125
+ };
126
+ if (r.value.legend !== void 0 && (c.showLegend = r.value.legend), r.value.grid !== void 0 && (c.showGrid = r.value.grid), r.value.values !== void 0 && (c.showValues = r.value.values), r.value.percentages !== void 0 && (c.showPercentages = r.value.percentages), r.value.points !== void 0 && (c.showPoints = r.value.points), r.value.fillArea !== void 0 && (c.fillArea = r.value.fillArea), t.chartData.datasets?.[0]?.backgroundColor) {
127
+ const v = t.chartData.datasets[0].backgroundColor;
128
+ c.colors = Array.isArray(v) ? v : [v];
129
+ }
130
+ return t.chartData.datasets?.[0]?.borderColor && (c.lineColor = t.chartData.datasets[0].borderColor), c;
131
+ }), j = w(() => {
132
+ switch (t.chartType) {
133
+ case "bar":
134
+ return ae;
135
+ case "line":
136
+ return se;
137
+ case "pie":
138
+ return _;
139
+ case "doughnut":
140
+ return _;
141
+ default:
142
+ return null;
143
+ }
144
+ }), I = w(() => t.chartType === "doughnut");
145
+ return E(() => {
146
+ window.addEventListener("dragover", H), window.addEventListener("keydown", R);
147
+ }), U(() => {
148
+ window.removeEventListener("dragover", H), window.removeEventListener("keydown", R), l && document.body.removeChild(l);
149
+ }), (e, a) => F.value ? (o(), u("div", {
150
+ key: 0,
151
+ ref_key: "widgetRef",
152
+ ref: q,
153
+ draggable: "true",
154
+ tabindex: "0",
155
+ style: J(N.value),
156
+ class: h(Q(ne)(
157
+ " rounded-xl border ui-border-strong overflow-hidden transition-all select-none flex flex-col relative",
158
+ "shadow-sm",
159
+ D.value ? "opacity-50 scale-95" : "hover:shadow-lg cursor-move",
160
+ x.value ? "ring-2 ring-(--ui-primary) ring-offset-2" : ""
161
+ )),
162
+ onDragstart: X,
163
+ onDragend: Y,
164
+ onFocus: V,
165
+ onBlur: K
166
+ }, [
167
+ i.showHeader ? (o(), u("div", re, [
168
+ n("div", ie, [
169
+ i.icon ? (o(), O(b, {
170
+ key: 0,
171
+ icon: i.icon,
172
+ class: "w-5 h-5 ui-text"
173
+ }, null, 8, ["icon"])) : f("", !0),
174
+ n("h3", oe, k(i.title), 1)
175
+ ]),
176
+ n("div", le, [
177
+ z(e.$slots, "header-actions"),
178
+ n("button", {
179
+ class: "p-2 rounded-lg hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 20%)] transition-all duration-200 hover:scale-105 active:scale-95",
180
+ title: "Keyboard shortcuts (?)",
181
+ onClick: a[0] || (a[0] = (s) => d.value = !d.value)
182
+ }, [
183
+ y(b, {
184
+ icon: "circle-info",
185
+ class: "w-4 h-4 ui-text"
186
+ })
187
+ ]),
188
+ i.customizationOptions.length > 0 ? (o(), u("button", {
189
+ key: 0,
190
+ class: h(["p-2 rounded-lg hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 20%)] transition-all duration-200 hover:scale-105 active:scale-95", { "ui-primary-soft": m.value }]),
191
+ title: "Customize (C)",
192
+ onClick: C
193
+ }, [
194
+ y(b, {
195
+ icon: "gear",
196
+ class: "w-4 h-4 ui-text"
197
+ })
198
+ ], 2)) : f("", !0),
199
+ i.showRefresh ? (o(), u("button", {
200
+ key: 1,
201
+ class: "p-2 rounded-lg hover:bg-[color:color-mix(in oklab, var(--ui-surface), transparent 20%)] transition-all duration-200 hover:scale-105 active:scale-95",
202
+ disabled: i.loading,
203
+ title: "Refresh (R)",
204
+ onClick: a[1] || (a[1] = (s) => e.$emit("refresh"))
205
+ }, [
206
+ y(b, {
207
+ icon: "refresh",
208
+ class: h([
209
+ "w-4 h-4 ui-text transition-transform duration-500",
210
+ { "animate-spin": i.loading }
211
+ ])
212
+ }, null, 8, ["class"])
213
+ ], 8, ue)) : f("", !0)
214
+ ])
215
+ ])) : f("", !0),
216
+ m.value ? (o(), u("div", de, [
217
+ n("div", ce, [
218
+ a[4] || (a[4] = n("h4", { class: "font-semibold text-sm ui-text" }, " Customize Widget ", -1)),
219
+ n("button", {
220
+ class: "p-1 rounded hover:bg-(--ui-surface)",
221
+ onClick: a[2] || (a[2] = (s) => m.value = !1)
222
+ }, [
223
+ y(b, {
224
+ icon: "x",
225
+ class: "w-4 h-4 ui-text"
226
+ })
227
+ ])
228
+ ]),
229
+ n("div", fe, [
230
+ (o(!0), u(B, null, L(i.customizationOptions, (s) => (o(), u("div", {
231
+ key: s.id,
232
+ class: "flex items-center justify-between"
233
+ }, [
234
+ n("label", {
235
+ for: `setting-${s.id}`,
236
+ class: "text-sm ui-text cursor-pointer"
237
+ }, k(s.label), 9, he),
238
+ n("button", {
239
+ id: `setting-${s.id}`,
240
+ class: h([
241
+ "relative inline-flex h-6 w-11 items-center rounded-full transition-colors",
242
+ r.value[s.id] ? "ui-primary" : "ui-surface"
243
+ ]),
244
+ onClick: ($) => P(s.id, !r.value[s.id])
245
+ }, [
246
+ n("span", {
247
+ class: h([
248
+ "inline-block h-4 w-4 transform rounded-full ui-surface transition-transform",
249
+ r.value[s.id] ? "translate-x-6" : "translate-x-1"
250
+ ])
251
+ }, null, 2)
252
+ ], 10, ge)
253
+ ]))), 128))
254
+ ])
255
+ ])) : f("", !0),
256
+ d.value ? (o(), u("div", me, [
257
+ n("div", ve, [
258
+ a[5] || (a[5] = n("h4", { class: "font-semibold text-sm ui-text" }, " Keyboard Shortcuts ", -1)),
259
+ n("button", {
260
+ class: "p-1 rounded hover:bg-(--ui-surface)",
261
+ onClick: a[3] || (a[3] = (s) => d.value = !1)
262
+ }, [
263
+ y(b, {
264
+ icon: "x",
265
+ class: "w-4 h-4 ui-text"
266
+ })
267
+ ])
268
+ ]),
269
+ n("div", pe, [
270
+ (o(), u(B, null, L(W, (s) => n("div", {
271
+ key: s.key,
272
+ class: "flex items-center justify-between text-sm"
273
+ }, [
274
+ n("span", ye, k(s.description), 1),
275
+ n("kbd", be, k(s.key), 1)
276
+ ])), 64))
277
+ ])
278
+ ])) : f("", !0),
279
+ n("div", we, [
280
+ i.loading ? (o(), u("div", xe, [
281
+ y(te, {
282
+ type: "spin",
283
+ size: "medium",
284
+ color: "#3b82f6"
285
+ })
286
+ ])) : f("", !0),
287
+ i.chartType && i.chartData && j.value && T.value ? (o(), u("div", {
288
+ key: 1,
289
+ class: h(["w-full h-full flex items-center justify-center p-4", S[i.padding]])
290
+ }, [
291
+ n("div", ke, [
292
+ (o(), O(Z(j.value), ee(T.value, { doughnut: I.value }), null, 16, ["doughnut"]))
293
+ ])
294
+ ], 2)) : (o(), u("div", {
295
+ key: 2,
296
+ class: h(["overflow-auto h-full", S[i.padding]])
297
+ }, [
298
+ z(e.$slots, "default")
299
+ ], 2))
300
+ ]),
301
+ e.$slots.footer ? (o(), u("div", Ce, [
302
+ z(e.$slots, "footer")
303
+ ])) : f("", !0)
304
+ ], 38)) : f("", !0);
305
+ }
306
+ };
307
+ export {
308
+ je as default
309
+ };