golden-logic-ui 1.3.6 → 1.3.8

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.
@@ -1,4 +1,4 @@
1
- import { ref as c, shallowRef as Y, onMounted as ve, onBeforeUnmount as me, watch as M, createElementBlock as f, openBlock as v, Fragment as Z, createCommentVNode as p, normalizeClass as B, createElementVNode as s, toDisplayString as w, withDirectives as R, withModifiers as ee, vShow as te, vModelText as ge, renderList as he, nextTick as pe } from "vue";
1
+ import { ref as c, shallowRef as Y, onMounted as ve, onBeforeUnmount as me, watch as M, createElementBlock as f, openBlock as v, Fragment as Z, createCommentVNode as h, normalizeClass as B, createElementVNode as s, toDisplayString as b, withDirectives as F, withModifiers as ee, vShow as te, vModelText as ge, renderList as pe, nextTick as he } from "vue";
2
2
  const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3 mb-4" }, we = {
3
3
  key: 0,
4
4
  class: "bg-blue-100 text-blue-800 text-sm font-medium mb-2 mt-2 me-2 px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300"
@@ -8,20 +8,20 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
8
8
  }, Se = { class: "relative focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:focus:ring-blue-500 dark:focus:border-blue-500" }, _e = { class: "relative showOptions" }, Ce = ["value", "placeholder"], De = { class: "text-gray-700 bg-white border dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 absolute w-full z-999999999 rounded-md mt-1 pt-1" }, Oe = {
9
9
  key: 0,
10
10
  class: "border-b border-gray-200 dark:border-gray-700"
11
- }, Ee = { class: "relative" }, Be = ["id", "placeholder"], $e = { class: "flex items-center py-2 pr-4" }, Le = ["onClick", "onMousedown", "id"], Me = { class: "flex justify-between items-center py-2" }, Ie = ["innerHTML"], Te = {
11
+ }, Ee = { class: "relative" }, Be = ["id", "placeholder"], $e = { class: "flex items-center py-2 pr-4" }, Le = ["onClick", "onMousedown", "id"], Me = { class: "flex justify-between items-center py-2" }, Ie = ["innerHTML"], je = {
12
12
  key: 0,
13
13
  class: "flex items-center shrink-0 w-4 h-4 text-green-500 ltr:right-2 rtl:left-2 dark:text-green-400",
14
14
  "aria-hidden": "true",
15
15
  xmlns: "http://www.w3.org/2000/svg",
16
16
  fill: "none",
17
17
  viewBox: "0 0 16 12"
18
- }, Ue = {
18
+ }, Te = {
19
19
  key: 2,
20
20
  class: "p-2 text-center text-gray-500"
21
- }, Ve = {
21
+ }, Ue = {
22
22
  key: 3,
23
23
  class: "p-2 text-gray-500"
24
- }, je = { class: "block mt-1 text-sm font-normal leading-5 text-red-500" }, Ae = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, Ne = {
24
+ }, Ae = { class: "block mt-1 text-sm font-normal leading-5 text-red-500" }, qe = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, Ne = {
25
25
  __name: "GlDropdown",
26
26
  props: {
27
27
  modelValue: {
@@ -110,19 +110,19 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
110
110
  },
111
111
  emits: ["update:modelValue", "selected", "selectionChanged"],
112
112
  setup(r, { emit: le }) {
113
- const o = r, b = le, a = c({}), F = c(!1), y = c(0), x = c(!1), m = c(""), g = c(""), $ = c(!1), k = c(1), S = c(null), L = c(1), i = Y([]), O = c(!1), I = Y([]), U = c([]), ne = c(null), H = c(null);
114
- let E = !1, h = null, V = 0, _ = null;
115
- const z = (e) => e?.name === "CanceledError" || e?.name === "AbortError" || typeof axios < "u" && axios.isCancel?.(e), j = async (e = "down") => {
113
+ const o = r, k = le, a = c({}), T = c(!1), y = c(0), x = c(!1), m = c(""), g = c(""), $ = c(!1), S = c(1), _ = c(null), L = c(1), i = Y([]), O = c(!1), I = Y([]), U = c([]), ne = c(null), H = c(null);
114
+ let E = !1, p = null, A = 0, C = null;
115
+ const z = (e) => e?.name === "CanceledError" || e?.name === "AbortError" || typeof axios < "u" && axios.isCancel?.(e), q = async (e = "down") => {
116
116
  if ($.value || !o.api_url) return;
117
- h && h.abort(), h = new AbortController();
118
- const t = ++V;
117
+ p && p.abort(), p = new AbortController();
118
+ const t = ++A;
119
119
  $.value = !0;
120
120
  try {
121
- const l = e === "up" ? Math.max(k.value - 1, L.value) : k.value, { data: n } = await axios.get(o.api_url, {
121
+ const l = e === "up" ? Math.max(S.value - 1, L.value) : S.value, { data: n } = await axios.get(o.api_url, {
122
122
  params: { search: m.value, page: l, per_page: 20 },
123
- signal: h.signal
123
+ signal: p.signal
124
124
  });
125
- if (E || t !== V) return;
125
+ if (E || t !== A) return;
126
126
  if (!n || !n.data) {
127
127
  i.value = [], O.value = !1;
128
128
  return;
@@ -130,14 +130,14 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
130
130
  const u = W(n.data);
131
131
  if (e === "down") {
132
132
  const d = i.value.length ? i.value.concat(u) : u, D = a.value;
133
- C(D) && D.id !== void 0 && D.name && !d.some((T) => String(T.id) === String(D.id)) && d.unshift(D), i.value = d, k.value++, S.value = n.last_page, O.value = !0;
133
+ w(D) && D.id !== void 0 && D.name && !d.some((j) => String(j.id) === String(D.id)) && d.unshift(D), i.value = d, S.value++, _.value = n.last_page, O.value = !0;
134
134
  }
135
- S.value || (S.value = n.last_page), L.value || (L.value = 1);
135
+ _.value || (_.value = n.last_page), L.value || (L.value = 1);
136
136
  } catch (l) {
137
137
  if (z(l)) return;
138
138
  console.error("Error fetching data:", l);
139
139
  } finally {
140
- !E && t === V && ($.value = !1, h = null);
140
+ !E && t === A && ($.value = !1, p = null);
141
141
  }
142
142
  }, ae = async (e) => {
143
143
  if (!o.api_url || e === null || e === void 0 || e === "") return null;
@@ -170,23 +170,23 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
170
170
  E || (u ? (a.value = u, i.value.some((d) => String(d.id) === String(u.id)) || (i.value = [u, ...i.value])) : o.allow_custom ? a.value = { id: t, name: t } : a.value = { id: t, name: "" });
171
171
  }, re = (e) => {
172
172
  const t = e.target;
173
- t && t.scrollHeight - t.clientHeight <= t.scrollTop + 10 && k.value <= S.value && j("down");
173
+ t && t.scrollHeight - t.clientHeight <= t.scrollTop + 10 && S.value <= _.value && q("down");
174
174
  }, K = (e) => {
175
- e.target && (document.activeElement.classList.contains("showOptions" + g.value) ? x.value || A() : e.target.id != o.field_name + "search" + g.value && e.target.id != o.field_name && !e.target.classList.contains("showOptions" + g.value) && (P(), y.value = 0, x.value = !1));
176
- }, A = () => {
175
+ e.target && (document.activeElement.classList.contains("showOptions" + g.value) ? x.value || V() : e.target.id != o.field_name + "search" + g.value && e.target.id != o.field_name && !e.target.classList.contains("showOptions" + g.value) && (R(), y.value = 0, x.value = !1));
176
+ }, V = () => {
177
177
  if (!o.show) {
178
178
  if (x.value) {
179
179
  x.value = !1;
180
180
  return;
181
181
  }
182
- m.value = "", x.value = !0, o.api_url && (!O.value || i.value.length === 0) && (k.value = 1, S.value = null, i.value = [], O.value = !1, j("down")), pe(() => {
182
+ m.value = "", x.value = !0, o.api_url && (!O.value || i.value.length === 0) && (S.value = 1, _.value = null, i.value = [], O.value = !1, q("down")), he(() => {
183
183
  const e = document.getElementById(
184
184
  `${o.field_name}search${g.value}`
185
185
  );
186
186
  e && e.focus();
187
187
  });
188
188
  }
189
- }, q = () => {
189
+ }, N = () => {
190
190
  const e = (t) => {
191
191
  if (o.allow_custom && t) {
192
192
  const l = typeof t == "object" ? t.id : t;
@@ -194,7 +194,7 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
194
194
  }
195
195
  return {};
196
196
  };
197
- return C(a.value) ? typeof a.value == "object" ? i.value.find(
197
+ return w(a.value) ? typeof a.value == "object" ? i.value.find(
198
198
  (t) => String(t.id) === String(a.value.id)
199
199
  ) || e(a.value) : i.value.find(
200
200
  (t) => String(t.id) === String(a.value)
@@ -207,7 +207,7 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
207
207
  ve(() => {
208
208
  g.value = ue(), o.show || (document.body.addEventListener("click", G), document.addEventListener("focusin", K));
209
209
  }), me(() => {
210
- E = !0, h && (h.abort(), h = null), _ && (clearTimeout(_), _ = null), document.body.removeEventListener("click", G), document.removeEventListener("focusin", K);
210
+ E = !0, p && (p.abort(), p = null), C && (clearTimeout(C), C = null), document.body.removeEventListener("click", G), document.removeEventListener("focusin", K);
211
211
  });
212
212
  function ie() {
213
213
  const e = I.value, t = o.maxItem, l = m.value;
@@ -215,8 +215,8 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
215
215
  return e.length > t ? e.slice(0, t) : e;
216
216
  const n = l.toLowerCase(), u = [];
217
217
  for (let d = 0, D = e.length; d < D && u.length < t; d++) {
218
- const T = e[d];
219
- String(T.name).toLowerCase().includes(n) && u.push(T);
218
+ const j = e[d];
219
+ String(j.name).toLowerCase().includes(n) && u.push(j);
220
220
  }
221
221
  return u;
222
222
  }
@@ -240,11 +240,11 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
240
240
  return e = Math.floor(e / 16), (t === "x" ? l : l & 3 | 8).toString(16);
241
241
  });
242
242
  }
243
- function C(e) {
243
+ function w(e) {
244
244
  return e && typeof e == "object" && Object.keys(e).length > 0;
245
245
  }
246
246
  function G(e) {
247
- e.target.id != o.field_name + "search" + g.value && e.target.id != o.field_name && !e.target.classList.contains("showOptions" + g.value) && (P(), y.value = 0, x.value = !1);
247
+ e.target.id != o.field_name + "search" + g.value && e.target.id != o.field_name && !e.target.classList.contains("showOptions" + g.value) && (R(), y.value = 0, x.value = !1);
248
248
  }
249
249
  function J(e) {
250
250
  const t = `${e}${g.value}`, l = document.getElementById(t), n = H.value;
@@ -278,15 +278,15 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
278
278
  }
279
279
  function X() {
280
280
  const e = m.value, t = { id: e, name: e }, l = String(e);
281
- U.value.some((n) => String(n.id) === l) || U.value.push(t), i.value.some((n) => String(n.id) === l) || (i.value = [...i.value, t], I.value = [...I.value, t]), N(t);
281
+ U.value.some((n) => String(n.id) === l) || U.value.push(t), i.value.some((n) => String(n.id) === l) || (i.value = [...i.value, t], I.value = [...I.value, t]), P(t);
282
282
  }
283
- function N(e) {
284
- F.value = !0, a.value = e, x.value = !1, b("update:modelValue", a.value.id), b("selected", a.value), b("selectionChanged", a.value);
283
+ function P(e) {
284
+ T.value = !0, a.value = e, x.value = !1, k("update:modelValue", a.value.id), k("selected", a.value), k("selectionChanged", a.value);
285
285
  }
286
286
  function fe() {
287
- o.show || (a.value = {}, m.value = "", b("update:modelValue", ""), b("selected", a.value), b("selectionChanged", a.value), A());
287
+ o.show || (a.value = {}, m.value = "", k("update:modelValue", ""), k("selected", a.value), k("selectionChanged", a.value), V());
288
288
  }
289
- function P() {
289
+ function R() {
290
290
  (!a.value || !a.value.id) && (a.value = {}, m.value = "");
291
291
  }
292
292
  return M(m, () => {
@@ -294,15 +294,15 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
294
294
  i.value = ie(), i.value.length === 0 && (a.value = {});
295
295
  return;
296
296
  }
297
- _ && clearTimeout(_), _ = setTimeout(() => {
298
- _ = null, !E && (k.value = 1, S.value = null, L.value = 1, i.value = [], O.value = !1, j("down"));
297
+ C && clearTimeout(C), C = setTimeout(() => {
298
+ C = null, !E && (S.value = 1, _.value = null, L.value = 1, i.value = [], O.value = !1, q("down"));
299
299
  }, 250);
300
300
  }), M(a, (e) => {
301
- C(e) && e.id !== o.modelValue && b("update:modelValue", e.id);
301
+ w(e) && e.id !== o.modelValue && k("update:modelValue", e.id);
302
302
  }), M(
303
303
  () => o.api_url,
304
304
  () => {
305
- h && (h.abort(), h = null), k.value = 1, S.value = null, L.value = 1, i.value = [], O.value = !1;
305
+ p && (p.abort(), p = null), S.value = 1, _.value = null, L.value = 1, i.value = [], O.value = !1;
306
306
  },
307
307
  { immediate: !0 }
308
308
  ), M(
@@ -312,7 +312,8 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
312
312
  a.value = {};
313
313
  return;
314
314
  }
315
- o.api_url ? F.value ? a.value = q() : await oe(e) : a.value = q();
315
+ const t = typeof e == "object" ? e.id : e;
316
+ w(a.value) && String(a.value.id) !== String(t) && (a.value = {}, T.value = !1), o.api_url ? T.value ? a.value = N() : await oe(e) : a.value = N();
316
317
  },
317
318
  { immediate: !0 }
318
319
  ), M(
@@ -324,7 +325,7 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
324
325
  const u = String(n.id);
325
326
  t.has(u) || (l.push(n), t.add(u));
326
327
  }
327
- I.value = l, i.value = l, a.value = q();
328
+ I.value = l, i.value = l, a.value = N();
328
329
  }
329
330
  },
330
331
  // deep so the list still updates when options load late by mutating the SAME
@@ -336,13 +337,13 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
336
337
  key: 0,
337
338
  class: B(r.field_name)
338
339
  }, [
339
- s("h3", ye, w(r.label_name), 1),
340
+ s("h3", ye, b(r.label_name), 1),
340
341
  s("p", xe, [
341
- C(a.value) ? (v(), f("span", we, w(a.value?.name), 1)) : p("", !0)
342
+ w(a.value) ? (v(), f("span", we, b(a.value?.name), 1)) : h("", !0)
342
343
  ]),
343
344
  t[6] || (t[6] = s("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
344
- ], 2)) : p("", !0),
345
- r.show ? p("", !0) : (v(), f("div", {
345
+ ], 2)) : h("", !0),
346
+ r.show ? h("", !0) : (v(), f("div", {
346
347
  key: 1,
347
348
  class: B(r.field_name)
348
349
  }, [
@@ -360,7 +361,7 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
360
361
  "gl-label-form-invalid": r.error_message !== "",
361
362
  required: r.is_required
362
363
  })
363
- }, w(r.label_name), 3)) : p("", !0),
364
+ }, b(r.label_name), 3)) : h("", !0),
364
365
  s("div", Se, [
365
366
  s("div", _e, [
366
367
  s("input", {
@@ -370,15 +371,15 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
370
371
  "gl-input-form": r.error_message == "",
371
372
  "gl-input-form-invalid": r.error_message !== "",
372
373
  [`showOptions${g.value}`]: !0,
373
- "pr-14!": C(a.value) && r.has_cancel,
374
- "pr-8!": !(C(a.value) && r.has_cancel)
374
+ "pr-14!": w(a.value) && r.has_cancel,
375
+ "pr-8!": !(w(a.value) && r.has_cancel)
375
376
  }, "truncate showOptions1"]),
376
377
  value: a.value?.name,
377
378
  placeholder: r.placeholder,
378
379
  autocomplete: "off",
379
380
  readonly: ""
380
381
  }, null, 10, Ce),
381
- R(s("i", {
382
+ F(s("i", {
382
383
  onClick: t[0] || (t[0] = ee((l) => fe(), ["stop"])),
383
384
  class: "absolute text-gray-500 cursor-pointer pointer-events-auto ltr:right-8 rtl:left-8 hover:text-red-600 dark:hover:text-red-400",
384
385
  style: { top: "13px" }
@@ -399,10 +400,10 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
399
400
  })
400
401
  ], -1)
401
402
  ]), 512), [
402
- [te, C(a.value) && r.has_cancel]
403
+ [te, w(a.value) && r.has_cancel]
403
404
  ]),
404
405
  s("i", {
405
- onClick: t[1] || (t[1] = ee((l) => A(), ["stop"])),
406
+ onClick: t[1] || (t[1] = ee((l) => V(), ["stop"])),
406
407
  class: "absolute text-xl text-gray-500 cursor-pointer ltr:right-2 rtl:left-2 hover:text-gray-700 dark:hover:text-gray-700 showOptions",
407
408
  style: { top: "14px" }
408
409
  }, [
@@ -422,20 +423,20 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
422
423
  }, null, -1)
423
424
  ]), 2))
424
425
  ]),
425
- R(s("div", De, [
426
- r.hide_search ? p("", !0) : (v(), f("div", Oe, [
426
+ F(s("div", De, [
427
+ r.hide_search ? h("", !0) : (v(), f("div", Oe, [
427
428
  t[10] || (t[10] = s("label", {
428
429
  for: "default-search",
429
430
  class: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"
430
431
  }, "Search", -1)),
431
432
  s("div", Ee, [
432
433
  t[9] || (t[9] = s("div", { class: "absolute inset-y-0 flex items-center pointer-events-none start-0 ps-3" }, null, -1)),
433
- R(s("input", {
434
+ F(s("input", {
434
435
  type: "search",
435
436
  "onUpdate:modelValue": t[2] || (t[2] = (l) => m.value = l),
436
437
  id: `${r.field_name}search${g.value}`,
437
438
  onKeydown: se,
438
- onBlur: t[3] || (t[3] = (l) => P()),
439
+ onBlur: t[3] || (t[3] = (l) => R()),
439
440
  autocomplete: "off",
440
441
  class: "block w-full p-2 text-sm text-gray-900 outline-hidden dark:bg-gray-800 dark:text-white",
441
442
  placeholder: r.search_input_placeholder
@@ -457,16 +458,16 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
457
458
  onMousedown: t[5] || (t[5] = (l) => X())
458
459
  }, [
459
460
  s("div", $e, [
460
- s("span", null, w(r.custom_option_label) + ' "' + w(m.value) + '"', 1)
461
+ s("span", null, b(r.custom_option_label) + ' "' + b(m.value) + '"', 1)
461
462
  ])
462
- ], 32)) : p("", !0),
463
- i.value.length ? (v(!0), f(Z, { key: 1 }, he(i.value, (l, n) => (v(), f("div", {
463
+ ], 32)) : h("", !0),
464
+ i.value.length ? (v(!0), f(Z, { key: 1 }, pe(i.value, (l, n) => (v(), f("div", {
464
465
  class: B([
465
466
  "relative px-2 py-0.5 text-xs leading-4 text-gray-700 no-underline cursor-pointer dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-white hover:rounded-sm",
466
467
  n + 1 == y.value ? "bg-gray-100 dark:bg-gray-700 rounded-sm" : ""
467
468
  ]),
468
- onClick: (u) => N(l),
469
- onMousedown: (u) => N(l),
469
+ onClick: (u) => P(l),
470
+ onMousedown: (u) => P(l),
470
471
  key: n,
471
472
  id: `${n + 1}${g.value}`
472
473
  }, [
@@ -474,7 +475,7 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
474
475
  s("span", {
475
476
  innerHTML: l.name || l.id || "-"
476
477
  }, null, 8, Ie),
477
- a.value?.id === l.id ? (v(), f("svg", Te, t[11] || (t[11] = [
478
+ a.value?.id === l.id ? (v(), f("svg", je, t[11] || (t[11] = [
478
479
  s("path", {
479
480
  stroke: "currentColor",
480
481
  "stroke-linecap": "round",
@@ -482,20 +483,20 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
482
483
  "stroke-width": "2",
483
484
  d: "M1 5.917 5.724 10.5 15 1.5"
484
485
  }, null, -1)
485
- ]))) : p("", !0)
486
+ ]))) : h("", !0)
486
487
  ])
487
- ], 42, Le))), 128)) : p("", !0),
488
- $.value ? (v(), f("div", Ue, " Loading... ")) : p("", !0),
489
- !$.value && i.value.length === 0 && !(r.allow_custom && m.value) ? (v(), f("div", Ve, w(r.no_results_found_placeholder), 1)) : p("", !0)
488
+ ], 42, Le))), 128)) : h("", !0),
489
+ $.value ? (v(), f("div", Te, " Loading... ")) : h("", !0),
490
+ !$.value && i.value.length === 0 && !(r.allow_custom && m.value) ? (v(), f("div", Ue, b(r.no_results_found_placeholder), 1)) : h("", !0)
490
491
  ], 544)
491
492
  ], 512), [
492
493
  [te, x.value]
493
494
  ])
494
495
  ])
495
496
  ])
496
- ])) : p("", !0),
497
- s("span", je, w(r.error_message), 1),
498
- s("small", Ae, w(r.description), 1)
497
+ ])) : h("", !0),
498
+ s("span", Ae, b(r.error_message), 1),
499
+ s("small", qe, b(r.description), 1)
499
500
  ], 2))
500
501
  ], 64));
501
502
  }
@@ -1,20 +1,20 @@
1
- import { computed as M, ref as C, watch as X, onBeforeUnmount as Y, createElementBlock as u, openBlock as d, Fragment as D, createCommentVNode as g, normalizeClass as x, createElementVNode as n, toDisplayString as s, renderList as W, withKeys as E, withModifiers as B, createTextVNode as Z } from "vue";
2
- const tt = {
1
+ import { computed as h, ref as B, watch as Y, onBeforeUnmount as Z, createElementBlock as d, openBlock as c, Fragment as D, createCommentVNode as g, normalizeClass as b, createElementVNode as a, toDisplayString as u, renderList as z, withKeys as V, withModifiers as j, createTextVNode as ee } from "vue";
2
+ const te = {
3
3
  key: 0,
4
4
  class: "gl-label-form"
5
- }, et = { class: "mt-1 text-gray-900 dark:text-white" }, rt = { dir: "ltr" }, at = {
5
+ }, re = { class: "mt-1 text-gray-900 dark:text-white" }, ne = { dir: "ltr" }, ae = {
6
6
  key: 1,
7
7
  class: "text-sm text-gray-500 dark:text-gray-400"
8
- }, nt = ["for"], lt = { class: "flex flex-col items-center gap-2 md:flex-row md:items-start" }, ot = ["for"], st = { class: "relative" }, it = ["id", "name", "required", "placeholder", "value", "aria-expanded", "onFocus", "onInput", "onBlur", "onKeydown"], ut = ["aria-label", "onClick"], dt = {
8
+ }, le = ["for"], oe = { class: "flex flex-col items-center gap-2 md:flex-row md:items-start" }, se = ["for"], ie = { class: "relative" }, ue = ["id", "name", "required", "placeholder", "value", "aria-expanded", "onFocus", "onInput", "onBlur", "onKeydown"], de = ["aria-label", "onClick"], ce = {
9
9
  class: "flex items-center justify-center gap-2",
10
10
  dir: "ltr"
11
- }, ct = { class: "flex flex-col items-center" }, mt = ["aria-label", "onClick"], gt = { class: "w-12 rounded-md border border-gray-300 bg-white py-1 text-center text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white" }, vt = ["aria-label", "onClick"], yt = { class: "flex flex-col items-center" }, ft = ["aria-label", "onClick"], ht = { class: "w-12 rounded-md border border-gray-300 bg-white py-1 text-center text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white" }, xt = ["aria-label", "onClick"], pt = { class: "ms-1 flex flex-col gap-1" }, bt = ["onClick"], kt = { class: "mt-4 flex flex-wrap items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700" }, wt = { dir: "ltr" }, _t = {
11
+ }, me = { class: "flex flex-col items-center" }, ve = ["aria-label", "onClick"], ge = { class: "w-12 rounded-md border border-gray-300 bg-white py-1 text-center text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white" }, ye = ["aria-label", "onClick"], fe = { class: "flex flex-col items-center" }, he = ["aria-label", "onClick"], xe = { class: "w-12 rounded-md border border-gray-300 bg-white py-1 text-center text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white" }, be = ["aria-label", "onClick"], pe = { class: "ms-1 flex flex-col gap-1" }, ke = ["onClick"], _e = { class: "mt-4 flex flex-wrap items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700" }, we = { dir: "ltr" }, $e = {
12
12
  key: 2,
13
13
  class: "mt-1"
14
- }, $t = { class: "gl-span-form-error" }, St = {
14
+ }, Se = { class: "gl-span-form-error" }, Me = {
15
15
  key: 3,
16
16
  class: "mt-1 block text-sm font-normal leading-5 text-gray-500"
17
- }, Ct = {
17
+ }, Be = {
18
18
  __name: "GlTimeRangePicker",
19
19
  props: {
20
20
  modelValue: {
@@ -34,8 +34,13 @@ const tt = {
34
34
  container_class: { type: String, default: "" },
35
35
  // Minutes moved by one press of the minute arrows
36
36
  minute_step: { type: Number, default: 5 },
37
- // Whether an end at or before the start means the next day
37
+ // Whether an end at or before the start means the next day. When false the
38
+ // end must be after the start, except that 00:00 is accepted as midnight
39
+ // (the end of the day), so a range is never longer than 24 hours.
38
40
  allow_overnight: { type: Boolean, default: !0 },
41
+ // With overnight off: whether the end may equal the start, as a date range
42
+ // may start and end on the same day. Off, equal times are refused.
43
+ allow_equal: { type: Boolean, default: !0 },
39
44
  // Show the line explaining the range ("… · 9 hours", "Closes the next day …")
40
45
  show_summary: { type: Boolean, default: !0 },
41
46
  // "en" and "ar" are built in; anything else falls back to English
@@ -44,8 +49,8 @@ const tt = {
44
49
  labels: { type: Object, default: () => ({}) }
45
50
  },
46
51
  emits: ["update:modelValue", "change"],
47
- setup(l, { expose: z, emit: U }) {
48
- const c = l, F = U, L = {
52
+ setup(l, { expose: U, emit: G }) {
53
+ const s = l, F = G, L = {
49
54
  en: {
50
55
  midnight: "Midnight",
51
56
  clear: "Clear",
@@ -57,6 +62,7 @@ const tt = {
57
62
  next_day: "closes the next day",
58
63
  all_day: "open 24 hours",
59
64
  end_after_start: "The end time must be after the start time.",
65
+ end_not_before_start: "The end time must not be before the start time.",
60
66
  invalid: "Enter a time such as 8:30 AM."
61
67
  },
62
68
  ar: {
@@ -70,9 +76,10 @@ const tt = {
70
76
  next_day: "يغلق في اليوم التالي",
71
77
  all_day: "مفتوح 24 ساعة",
72
78
  end_after_start: "يجب أن يكون وقت الانتهاء بعد وقت البدء.",
79
+ end_not_before_start: "يجب ألا يكون وقت الانتهاء قبل وقت البدء.",
73
80
  invalid: "أدخل وقتاً مثل 8:30 AM."
74
81
  }
75
- }, O = M(() => c.locale && c.locale.startsWith("ar") ? "ar" : "en"), m = (r) => c.labels[r] || L[O.value][r] || L.en[r] || r, i = C({ start: "", end: "" }), p = C({ start: null, end: null }), b = C(null), j = C(""), k = C(null), P = (r) => {
82
+ }, O = h(() => s.locale && s.locale.startsWith("ar") ? "ar" : "en"), m = (r) => s.labels[r] || L[O.value][r] || L.en[r] || r, i = B({ start: "", end: "" }), p = B({ start: null, end: null }), k = B(null), q = B(""), _ = B(null), E = (r) => {
76
83
  if (r == null)
77
84
  return null;
78
85
  const e = String(r).trim();
@@ -81,147 +88,154 @@ const tt = {
81
88
  const t = e.match(/^(\d{1,2})(?::(\d{1,2}))?(?::\d{1,2})?\s*([ap])\.?\s*m?\.?$/i) || e.match(/^(\d{1,2})(?::(\d{1,2}))?(?::\d{1,2})?$/);
82
89
  if (!t)
83
90
  return null;
84
- let a = parseInt(t[1], 10);
91
+ let n = parseInt(t[1], 10);
85
92
  const v = parseInt(t[2] || "0", 10), o = t[3] ? t[3].toUpperCase() : null;
86
93
  if (v > 59)
87
94
  return null;
88
95
  if (o) {
89
- if (a < 1 || a > 12)
96
+ if (n < 1 || n > 12)
90
97
  return null;
91
- a = a % 12 + (o === "P" ? 12 : 0);
92
- } else if (a > 23)
98
+ n = n % 12 + (o === "P" ? 12 : 0);
99
+ } else if (n > 23)
93
100
  return null;
94
- return `${String(a).padStart(2, "0")}:${String(v).padStart(2, "0")}`;
101
+ return `${String(n).padStart(2, "0")}:${String(v).padStart(2, "0")}`;
95
102
  };
96
- X(
97
- () => c.modelValue,
103
+ Y(
104
+ () => s.modelValue,
98
105
  (r) => {
99
- i.value.start = P(r?.start) ?? "", i.value.end = P(r?.end) ?? "";
106
+ i.value.start = E(r?.start) ?? "", i.value.end = E(r?.end) ?? "";
100
107
  },
101
108
  { immediate: !0, deep: !0 }
102
109
  );
103
- const f = (r) => {
110
+ const y = (r) => {
104
111
  const [e, t] = r.split(":").map(Number);
105
112
  return e * 60 + t;
106
113
  }, A = (r) => {
107
114
  const e = (r % 1440 + 1440) % 1440;
108
115
  return `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
109
- }, V = (r) => {
110
- const e = r || "08:00", [t, a] = e.split(":").map(Number);
111
- return { hour12: t % 12 || 12, minute: a, meridiem: t >= 12 ? "PM" : "AM" };
116
+ }, P = (r) => {
117
+ const e = r || "08:00", [t, n] = e.split(":").map(Number);
118
+ return { hour12: t % 12 || 12, minute: n, meridiem: t >= 12 ? "PM" : "AM" };
112
119
  }, w = (r) => {
113
- const e = P(r);
120
+ const e = E(r);
114
121
  if (!e)
115
122
  return "";
116
- const t = V(e);
123
+ const t = P(e);
117
124
  return `${t.hour12}:${String(t.minute).padStart(2, "0")} ${t.meridiem}`;
118
- }, G = () => {
125
+ }, R = () => {
119
126
  const r = { start: i.value.start, end: i.value.end };
120
- J(), F("update:modelValue", r), F("change", r);
121
- }, _ = (r, e) => {
122
- i.value[r] = e, p.value[r] = null, G();
123
- }, h = (r, e, t) => {
124
- const a = i.value[r] || (r === "end" ? "17:00" : "08:00"), v = e === "hour" ? t * 60 : t * c.minute_step;
125
- let o = f(a) + v;
126
- e === "minute" && c.minute_step > 1 && (o = t > 0 ? Math.floor(o / c.minute_step) * c.minute_step : Math.ceil(o / c.minute_step) * c.minute_step), _(r, A(o));
127
- }, R = (r, e) => {
128
- const t = i.value[r] || (r === "end" ? "17:00" : "08:00"), a = f(t), v = a >= 720;
129
- e === "PM" !== v && _(r, A(a + (e === "PM" ? 720 : -720)));
127
+ q.value = "", F("update:modelValue", r), F("change", r);
128
+ }, $ = (r, e) => {
129
+ i.value[r] = e, p.value[r] = null, R();
130
+ }, x = (r, e, t) => {
131
+ const n = i.value[r] || (r === "end" ? "17:00" : "08:00"), v = e === "hour" ? t * 60 : t * s.minute_step;
132
+ let o = y(n) + v;
133
+ e === "minute" && s.minute_step > 1 && (o = t > 0 ? Math.floor(o / s.minute_step) * s.minute_step : Math.ceil(o / s.minute_step) * s.minute_step), $(r, A(o));
134
+ }, H = (r, e) => {
135
+ const t = i.value[r] || (r === "end" ? "17:00" : "08:00"), n = y(t), v = n >= 720;
136
+ e === "PM" !== v && $(r, A(n + (e === "PM" ? 720 : -720)));
130
137
  }, I = (r) => {
131
138
  const e = p.value[r];
132
139
  if (e === null)
133
140
  return;
134
- const t = P(e);
141
+ const t = E(e);
135
142
  if (t === null) {
136
- j.value = m("invalid");
143
+ q.value = m("invalid");
137
144
  return;
138
145
  }
139
- _(r, t);
146
+ $(r, t);
140
147
  }, K = (r) => {
141
- b.value = r, document.addEventListener("mousedown", q);
142
- }, y = () => {
143
- b.value = null, document.removeEventListener("mousedown", q);
144
- }, q = (r) => {
145
- k.value && !k.value.contains(r.target) && y();
146
- }, H = (r) => {
147
- k.value && !k.value.contains(r.relatedTarget) && y();
148
+ k.value = r, document.addEventListener("mousedown", T);
149
+ }, f = () => {
150
+ k.value = null, document.removeEventListener("mousedown", T);
151
+ }, T = (r) => {
152
+ _.value && !_.value.contains(r.target) && f();
153
+ }, J = (r) => {
154
+ _.value && !_.value.contains(r.relatedTarget) && f();
148
155
  };
149
- Y(() => document.removeEventListener("mousedown", q));
150
- const N = M(() => {
156
+ Z(() => document.removeEventListener("mousedown", T));
157
+ const S = h(() => {
151
158
  const { start: r, end: e } = i.value;
152
159
  if (!r || !e)
153
160
  return null;
154
- const t = f(r), a = f(e);
155
- return a > t ? a - t : a + 1440 - t;
156
- }), T = M(() => {
161
+ const t = y(r), n = y(e);
162
+ if (s.allow_overnight)
163
+ return n > t ? n - t : n + 1440 - t;
164
+ const v = e === "00:00" ? 1440 : n;
165
+ return v >= t ? v - t : null;
166
+ }), N = h(() => {
157
167
  const { start: r, end: e } = i.value;
158
- return !!r && !!e && f(e) <= f(r);
159
- });
160
- function J() {
161
- j.value = !c.allow_overnight && T.value ? m("end_after_start") : "";
162
- }
163
- const $ = M(() => c.error_message !== "" || j.value !== ""), Q = (r) => {
168
+ return s.allow_overnight && !!r && !!e && y(e) <= y(r);
169
+ }), Q = h(() => {
170
+ const { start: r, end: e } = i.value;
171
+ if (s.allow_overnight || !r || !e)
172
+ return "";
173
+ const t = y(r), n = e === "00:00" ? 1440 : y(e);
174
+ return n > t || n === t && s.allow_equal ? "" : m(s.allow_equal ? "end_not_before_start" : "end_after_start");
175
+ }), W = h(() => q.value || Q.value), M = h(() => s.error_message !== "" || W.value !== ""), X = (r) => {
164
176
  const e = Math.floor(r / 60), t = r % 60;
165
177
  if (O.value === "ar") {
166
- const a = (o) => o === 1 ? "ساعة واحدة" : o === 2 ? "ساعتان" : o <= 10 ? `${o} ساعات` : `${o} ساعة`, v = (o) => o === 1 ? "دقيقة واحدة" : o === 2 ? "دقيقتان" : o <= 10 ? `${o} دقائق` : `${o} دقيقة`;
167
- return [e ? a(e) : "", t ? v(t) : ""].filter(Boolean).join(" و ");
178
+ const n = (o) => o === 1 ? "ساعة واحدة" : o === 2 ? "ساعتان" : o <= 10 ? `${o} ساعات` : `${o} ساعة`, v = (o) => o === 1 ? "دقيقة واحدة" : o === 2 ? "دقيقتان" : o <= 10 ? `${o} دقائق` : `${o} دقيقة`;
179
+ return [e ? n(e) : "", t ? v(t) : ""].filter(Boolean).join(" و ");
168
180
  }
169
181
  return [
170
182
  e ? `${e} ${e === 1 ? "hour" : "hours"}` : "",
171
183
  t ? `${t} ${t === 1 ? "minute" : "minutes"}` : ""
172
184
  ].filter(Boolean).join(" ");
173
- }, S = M(() => {
174
- if (!c.show_summary || N.value === null)
185
+ }, C = h(() => {
186
+ if (!s.show_summary || S.value === null)
175
187
  return null;
176
- const { start: r, end: e } = i.value;
177
- if (r === e)
178
- return { text: m("all_day"), overnight: !0 };
179
- const t = Q(N.value);
180
- return e === "00:00" ? { text: `${m("until_midnight")} · ${t}`, overnight: !1 } : T.value ? { text: `${m("next_day")} · ${t}`, overnight: !0 } : { text: t, overnight: !1 };
188
+ const { end: r } = i.value;
189
+ if (S.value === 1440)
190
+ return { text: m("all_day"), overnight: N.value };
191
+ if (S.value === 0)
192
+ return null;
193
+ const e = X(S.value);
194
+ return r === "00:00" ? { text: `${m("until_midnight")} · ${e}`, overnight: !1 } : N.value ? { text: `${m("next_day")} · ${e}`, overnight: !0 } : { text: e, overnight: !1 };
181
195
  });
182
- return z({ span: N, isOvernight: T }), (r, e) => (d(), u(D, null, [
183
- l.show ? (d(), u("div", {
196
+ return U({ span: S, isOvernight: N }), (r, e) => (c(), d(D, null, [
197
+ l.show ? (c(), d("div", {
184
198
  key: 0,
185
- class: x(["md:col-span-2", l.field_name])
199
+ class: b(["md:col-span-2", l.field_name])
186
200
  }, [
187
- l.label_name ? (d(), u("label", tt, s(l.label_name), 1)) : g("", !0),
188
- n("p", et, [
189
- n("span", rt, s(w(l.modelValue.start)) + " – " + s(w(l.modelValue.end)), 1)
201
+ l.label_name ? (c(), d("label", te, u(l.label_name), 1)) : g("", !0),
202
+ a("p", re, [
203
+ a("span", ne, u(w(l.modelValue.start)) + " – " + u(w(l.modelValue.end)), 1)
190
204
  ]),
191
- S.value ? (d(), u("p", at, s(S.value.text), 1)) : g("", !0),
192
- e[6] || (e[6] = n("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
205
+ C.value ? (c(), d("p", ae, u(C.value.text), 1)) : g("", !0),
206
+ e[6] || (e[6] = a("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
193
207
  ], 2)) : g("", !0),
194
- l.show ? g("", !0) : (d(), u("div", {
208
+ l.show ? g("", !0) : (c(), d("div", {
195
209
  key: 1,
196
210
  ref_key: "root",
197
- ref: k,
198
- class: x(["md:col-span-2", {
211
+ ref: _,
212
+ class: b(["md:col-span-2", {
199
213
  [l.field_name]: l.field_name && l.field_name !== "",
200
214
  [l.container_class]: l.container_class && l.container_class !== ""
201
215
  }]),
202
- onFocusout: H
216
+ onFocusout: J
203
217
  }, [
204
- l.label_name ? (d(), u("label", {
218
+ l.label_name ? (c(), d("label", {
205
219
  key: 0,
206
- class: x({
207
- "gl-label-form": !$.value,
208
- "gl-label-form-invalid": $.value,
220
+ class: b({
221
+ "gl-label-form": !M.value,
222
+ "gl-label-form-invalid": M.value,
209
223
  required: l.is_required
210
224
  }),
211
225
  for: l.field_name + "_start"
212
- }, s(l.label_name), 11, nt)) : g("", !0),
213
- n("div", lt, [
214
- (d(), u(D, null, W(["start", "end"], (t) => n("div", {
226
+ }, u(l.label_name), 11, le)) : g("", !0),
227
+ a("div", oe, [
228
+ (c(), d(D, null, z(["start", "end"], (t) => a("div", {
215
229
  key: t,
216
230
  class: "relative w-full md:flex-1"
217
231
  }, [
218
- (t === "start" ? l.label_name_start : l.label_name_end) ? (d(), u("label", {
232
+ (t === "start" ? l.label_name_start : l.label_name_end) ? (c(), d("label", {
219
233
  key: 0,
220
234
  for: l.field_name + "_" + t,
221
235
  class: "gl-label-form"
222
- }, s(t === "start" ? l.label_name_start : l.label_name_end), 9, ot)) : g("", !0),
223
- n("div", st, [
224
- n("input", {
236
+ }, u(t === "start" ? l.label_name_start : l.label_name_end), 9, se)) : g("", !0),
237
+ a("div", ie, [
238
+ a("input", {
225
239
  id: l.field_name + "_" + t,
226
240
  name: l.field_name + "_" + t,
227
241
  type: "text",
@@ -230,194 +244,194 @@ const tt = {
230
244
  required: l.is_required,
231
245
  placeholder: t === "start" ? l.placeholder_start : l.placeholder_end,
232
246
  value: p.value[t] !== null ? p.value[t] : w(i.value[t]),
233
- class: x([$.value ? "gl-input-form-invalid" : "gl-input-form", "pe-10 text-start"]),
234
- "aria-expanded": b.value === t,
235
- onFocus: (a) => K(t),
236
- onInput: (a) => p.value[t] = a.target.value,
237
- onBlur: (a) => I(t),
247
+ class: b([M.value ? "gl-input-form-invalid" : "gl-input-form", "pe-10 text-start"]),
248
+ "aria-expanded": k.value === t,
249
+ onFocus: (n) => K(t),
250
+ onInput: (n) => p.value[t] = n.target.value,
251
+ onBlur: (n) => I(t),
238
252
  onKeydown: [
239
- E(B((a) => {
240
- I(t), y();
253
+ V(j((n) => {
254
+ I(t), f();
241
255
  }, ["prevent"]), ["enter"]),
242
- e[0] || (e[0] = E((a) => y(), ["esc"])),
243
- E(B((a) => h(t, "minute", 1), ["prevent"]), ["up"]),
244
- E(B((a) => h(t, "minute", -1), ["prevent"]), ["down"])
256
+ e[0] || (e[0] = V((n) => f(), ["esc"])),
257
+ V(j((n) => x(t, "minute", 1), ["prevent"]), ["up"]),
258
+ V(j((n) => x(t, "minute", -1), ["prevent"]), ["down"])
245
259
  ]
246
- }, null, 42, it),
247
- n("button", {
260
+ }, null, 42, ue),
261
+ a("button", {
248
262
  type: "button",
249
263
  tabindex: "-1",
250
264
  class: "absolute inset-y-0 end-0 flex items-center pe-3 text-gray-500 dark:text-gray-400",
251
265
  "aria-label": m("pick_time"),
252
- onMousedown: e[1] || (e[1] = B(() => {
266
+ onMousedown: e[1] || (e[1] = j(() => {
253
267
  }, ["prevent"])),
254
- onClick: (a) => b.value === t ? y() : K(t)
268
+ onClick: (n) => k.value === t ? f() : K(t)
255
269
  }, e[7] || (e[7] = [
256
- n("svg", {
270
+ a("svg", {
257
271
  class: "h-4 w-4",
258
272
  "aria-hidden": "true",
259
273
  fill: "none",
260
274
  stroke: "currentColor",
261
275
  viewBox: "0 0 24 24"
262
276
  }, [
263
- n("circle", {
277
+ a("circle", {
264
278
  cx: "12",
265
279
  cy: "12",
266
280
  r: "9",
267
281
  "stroke-width": "2"
268
282
  }),
269
- n("path", {
283
+ a("path", {
270
284
  "stroke-linecap": "round",
271
285
  "stroke-linejoin": "round",
272
286
  "stroke-width": "2",
273
287
  d: "M12 7v5l3 2"
274
288
  })
275
289
  ], -1)
276
- ]), 40, ut)
290
+ ]), 40, de)
277
291
  ]),
278
- b.value === t ? (d(), u("div", {
292
+ k.value === t ? (c(), d("div", {
279
293
  key: 1,
280
294
  class: "absolute start-0 z-50 mt-1 w-72 rounded-lg border border-gray-200 bg-white p-4 shadow-lg dark:border-gray-700 dark:bg-gray-800",
281
- onMousedown: e[5] || (e[5] = B(() => {
295
+ onMousedown: e[5] || (e[5] = j(() => {
282
296
  }, ["prevent"]))
283
297
  }, [
284
- n("div", dt, [
285
- n("div", ct, [
286
- n("button", {
298
+ a("div", ce, [
299
+ a("div", me, [
300
+ a("button", {
287
301
  type: "button",
288
302
  class: "p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
289
303
  "aria-label": m("later"),
290
- onClick: (a) => h(t, "hour", 1)
304
+ onClick: (n) => x(t, "hour", 1)
291
305
  }, e[8] || (e[8] = [
292
- n("svg", {
306
+ a("svg", {
293
307
  class: "h-3 w-3",
294
308
  fill: "none",
295
309
  stroke: "currentColor",
296
310
  viewBox: "0 0 24 24"
297
311
  }, [
298
- n("path", {
312
+ a("path", {
299
313
  "stroke-linecap": "round",
300
314
  "stroke-linejoin": "round",
301
315
  "stroke-width": "2",
302
316
  d: "M5 15l7-7 7 7"
303
317
  })
304
318
  ], -1)
305
- ]), 8, mt),
306
- n("span", gt, s(String(V(i.value[t]).hour12).padStart(2, "0")), 1),
307
- n("button", {
319
+ ]), 8, ve),
320
+ a("span", ge, u(String(P(i.value[t]).hour12).padStart(2, "0")), 1),
321
+ a("button", {
308
322
  type: "button",
309
323
  class: "p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
310
324
  "aria-label": m("earlier"),
311
- onClick: (a) => h(t, "hour", -1)
325
+ onClick: (n) => x(t, "hour", -1)
312
326
  }, e[9] || (e[9] = [
313
- n("svg", {
327
+ a("svg", {
314
328
  class: "h-3 w-3",
315
329
  fill: "none",
316
330
  stroke: "currentColor",
317
331
  viewBox: "0 0 24 24"
318
332
  }, [
319
- n("path", {
333
+ a("path", {
320
334
  "stroke-linecap": "round",
321
335
  "stroke-linejoin": "round",
322
336
  "stroke-width": "2",
323
337
  d: "M19 9l-7 7-7-7"
324
338
  })
325
339
  ], -1)
326
- ]), 8, vt)
340
+ ]), 8, ye)
327
341
  ]),
328
- e[12] || (e[12] = n("span", { class: "pb-1 text-lg font-semibold text-gray-900 dark:text-white" }, ":", -1)),
329
- n("div", yt, [
330
- n("button", {
342
+ e[12] || (e[12] = a("span", { class: "pb-1 text-lg font-semibold text-gray-900 dark:text-white" }, ":", -1)),
343
+ a("div", fe, [
344
+ a("button", {
331
345
  type: "button",
332
346
  class: "p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
333
347
  "aria-label": m("later"),
334
- onClick: (a) => h(t, "minute", 1)
348
+ onClick: (n) => x(t, "minute", 1)
335
349
  }, e[10] || (e[10] = [
336
- n("svg", {
350
+ a("svg", {
337
351
  class: "h-3 w-3",
338
352
  fill: "none",
339
353
  stroke: "currentColor",
340
354
  viewBox: "0 0 24 24"
341
355
  }, [
342
- n("path", {
356
+ a("path", {
343
357
  "stroke-linecap": "round",
344
358
  "stroke-linejoin": "round",
345
359
  "stroke-width": "2",
346
360
  d: "M5 15l7-7 7 7"
347
361
  })
348
362
  ], -1)
349
- ]), 8, ft),
350
- n("span", ht, s(String(V(i.value[t]).minute).padStart(2, "0")), 1),
351
- n("button", {
363
+ ]), 8, he),
364
+ a("span", xe, u(String(P(i.value[t]).minute).padStart(2, "0")), 1),
365
+ a("button", {
352
366
  type: "button",
353
367
  class: "p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
354
368
  "aria-label": m("earlier"),
355
- onClick: (a) => h(t, "minute", -1)
369
+ onClick: (n) => x(t, "minute", -1)
356
370
  }, e[11] || (e[11] = [
357
- n("svg", {
371
+ a("svg", {
358
372
  class: "h-3 w-3",
359
373
  fill: "none",
360
374
  stroke: "currentColor",
361
375
  viewBox: "0 0 24 24"
362
376
  }, [
363
- n("path", {
377
+ a("path", {
364
378
  "stroke-linecap": "round",
365
379
  "stroke-linejoin": "round",
366
380
  "stroke-width": "2",
367
381
  d: "M19 9l-7 7-7-7"
368
382
  })
369
383
  ], -1)
370
- ]), 8, xt)
384
+ ]), 8, be)
371
385
  ]),
372
- n("div", pt, [
373
- (d(), u(D, null, W(["AM", "PM"], (a) => n("button", {
374
- key: a,
386
+ a("div", pe, [
387
+ (c(), d(D, null, z(["AM", "PM"], (n) => a("button", {
388
+ key: n,
375
389
  type: "button",
376
- class: x(["rounded-md px-2 py-1 text-xs font-medium transition-colors", V(i.value[t]).meridiem === a ? "bg-primary text-white dark:bg-primaryDark" : "bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"]),
377
- onClick: (v) => R(t, a)
378
- }, s(a), 11, bt)), 64))
390
+ class: b(["rounded-md px-2 py-1 text-xs font-medium transition-colors", P(i.value[t]).meridiem === n ? "bg-primary text-white dark:bg-primaryDark" : "bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"]),
391
+ onClick: (v) => H(t, n)
392
+ }, u(n), 11, ke)), 64))
379
393
  ])
380
394
  ]),
381
- n("div", kt, [
382
- t === "end" ? (d(), u("button", {
395
+ a("div", _e, [
396
+ t === "end" ? (c(), d("button", {
383
397
  key: 0,
384
398
  type: "button",
385
399
  class: "text-sm font-medium text-primary hover:text-primary/80 dark:text-primaryDark",
386
- onClick: e[2] || (e[2] = (a) => {
387
- _("end", "00:00"), y();
400
+ onClick: e[2] || (e[2] = (n) => {
401
+ $("end", "00:00"), f();
388
402
  })
389
- }, s(m("midnight")), 1)) : (d(), u("button", {
403
+ }, u(m("midnight")), 1)) : (c(), d("button", {
390
404
  key: 1,
391
405
  type: "button",
392
406
  class: "text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",
393
- onClick: e[3] || (e[3] = (a) => {
394
- _("start", ""), y();
407
+ onClick: e[3] || (e[3] = (n) => {
408
+ $("start", ""), f();
395
409
  })
396
- }, s(m("clear")), 1)),
397
- n("button", {
410
+ }, u(m("clear")), 1)),
411
+ a("button", {
398
412
  type: "button",
399
413
  class: "text-sm font-medium text-primary hover:text-primary/80 dark:text-primaryDark",
400
- onClick: e[4] || (e[4] = (a) => y())
401
- }, s(m("done")), 1)
414
+ onClick: e[4] || (e[4] = (n) => f())
415
+ }, u(m("done")), 1)
402
416
  ])
403
417
  ], 32)) : g("", !0)
404
418
  ])), 64))
405
419
  ]),
406
- S.value && !$.value ? (d(), u("p", {
420
+ C.value && !M.value ? (c(), d("p", {
407
421
  key: 1,
408
- class: x(["mt-1.5 text-sm", S.value.overnight ? "text-amber-700 dark:text-amber-400" : "text-gray-500 dark:text-gray-400"])
422
+ class: b(["mt-1.5 text-sm", C.value.overnight ? "text-amber-700 dark:text-amber-400" : "text-gray-500 dark:text-gray-400"])
409
423
  }, [
410
- n("span", wt, s(w(i.value.start)) + " – " + s(w(i.value.end)), 1),
411
- Z(" · " + s(S.value.text), 1)
424
+ a("span", we, u(w(i.value.start)) + " – " + u(w(i.value.end)), 1),
425
+ ee(" · " + u(C.value.text), 1)
412
426
  ], 2)) : g("", !0),
413
- $.value ? (d(), u("div", _t, [
414
- n("span", $t, s(l.error_message || j.value), 1)
427
+ M.value ? (c(), d("div", $e, [
428
+ a("span", Se, u(l.error_message || W.value), 1)
415
429
  ])) : g("", !0),
416
- l.description ? (d(), u("small", St, s(l.description), 1)) : g("", !0)
430
+ l.description ? (c(), d("small", Me, u(l.description), 1)) : g("", !0)
417
431
  ], 34))
418
432
  ], 64));
419
433
  }
420
434
  };
421
435
  export {
422
- Ct as default
436
+ Be as default
423
437
  };
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "golden-logic-ui",
3
- "description": "The most popular library of interactive components built with Vuejs && Tailwind CSS",
4
- "type": "module",
5
- "private": false,
6
- "version": "1.3.6",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/mrgiant/GoldenLogicUi.git"
10
- },
11
- "author": "Mohamed Al Wahaibi",
12
- "license": "MIT",
13
- "files": [
14
- "dist"
15
- ],
16
- "main": "./dist/main.js",
17
- "module": "./dist/main.js",
18
- "style": "./dist/golden-logic-ui.css",
19
- "sideEffects": [
20
- "**/*.css"
21
- ],
22
- "exports": {
23
- ".": {
24
- "import": "./dist/main.js"
25
- },
26
- "./style.css": "./dist/golden-logic-ui.css",
27
- "./dist/golden-logic-ui.css": "./dist/golden-logic-ui.css",
28
- "./*": "./dist/*"
29
- },
30
- "scripts": {
31
- "dev": "vite",
32
- "build": "vite build",
33
- "preview": "vite preview"
34
- },
35
- "peerDependencies": {
36
- "vue": "^3.4.x"
37
- },
38
- "dependencies": {
39
- "@codemirror/autocomplete": "^6.18.4",
40
- "@codemirror/lang-html": "^6.2.2",
41
- "@codemirror/lang-javascript": "^6.2.2",
42
- "@codemirror/state": "^6.5.0",
43
- "@codemirror/theme-one-dark": "^6.1.2",
44
- "@codemirror/view": "^6.36.1",
45
- "@tailwindcss/vite": "^4.1.18",
46
- "codemirror": "^6.0.1",
47
- "tinymce": "^7.6.0",
48
- "vue3-print-nb": "^0.1.4",
49
- "xlsx": "^0.18.5"
50
- },
51
- "devDependencies": {
52
- "@vitejs/plugin-vue": "^6.0.0",
53
- "sass": "^1.75.0",
54
- "tailwindcss": "^4.1.18",
55
- "vite": "^7.0.0"
56
- }
57
- }
1
+ {
2
+ "name": "golden-logic-ui",
3
+ "description": "The most popular library of interactive components built with Vuejs && Tailwind CSS",
4
+ "type": "module",
5
+ "private": false,
6
+ "version": "1.3.8",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mrgiant/GoldenLogicUi.git"
10
+ },
11
+ "author": "Mohamed Al Wahaibi",
12
+ "license": "MIT",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "main": "./dist/main.js",
17
+ "module": "./dist/main.js",
18
+ "style": "./dist/golden-logic-ui.css",
19
+ "sideEffects": [
20
+ "**/*.css"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "import": "./dist/main.js"
25
+ },
26
+ "./style.css": "./dist/golden-logic-ui.css",
27
+ "./dist/golden-logic-ui.css": "./dist/golden-logic-ui.css",
28
+ "./*": "./dist/*"
29
+ },
30
+ "scripts": {
31
+ "dev": "vite",
32
+ "build": "vite build",
33
+ "preview": "vite preview"
34
+ },
35
+ "peerDependencies": {
36
+ "vue": "^3.4.x"
37
+ },
38
+ "dependencies": {
39
+ "@codemirror/autocomplete": "^6.18.4",
40
+ "@codemirror/lang-html": "^6.2.2",
41
+ "@codemirror/lang-javascript": "^6.2.2",
42
+ "@codemirror/state": "^6.5.0",
43
+ "@codemirror/theme-one-dark": "^6.1.2",
44
+ "@codemirror/view": "^6.36.1",
45
+ "@tailwindcss/vite": "^4.1.18",
46
+ "codemirror": "^6.0.1",
47
+ "tinymce": "^7.6.0",
48
+ "vue3-print-nb": "^0.1.4",
49
+ "xlsx": "^0.18.5"
50
+ },
51
+ "devDependencies": {
52
+ "@vitejs/plugin-vue": "^6.0.0",
53
+ "sass": "^1.75.0",
54
+ "tailwindcss": "^4.1.18",
55
+ "vite": "^7.0.0"
56
+ }
57
+ }