golden-logic-ui 1.3.9 → 1.3.11

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,27 +1,30 @@
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";
1
+ import { ref as v, shallowRef as Y, onMounted as ve, onBeforeUnmount as me, watch as I, createElementBlock as c, openBlock as f, Fragment as Z, createCommentVNode as h, normalizeClass as O, createElementVNode as s, toDisplayString as w, withDirectives as F, withModifiers as ee, vShow as te, vModelText as ge, renderList as he, nextTick as pe } 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"
5
5
  }, be = ["name", "id", "value"], ke = {
6
6
  key: 0,
7
7
  class: "dropdown"
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 = {
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", "disabled"], De = {
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"], je = {
11
+ }, Oe = { class: "relative" }, Ee = ["id", "placeholder"], Be = { class: "flex items-center py-2 pr-4" }, $e = ["onClick", "onMousedown", "id"], Le = { class: "flex justify-between items-center py-2" }, Me = { class: "min-w-0" }, Ie = ["innerHTML"], je = {
12
+ key: 0,
13
+ class: "ms-2 text-gray-500 dark:text-gray-400"
14
+ }, Te = {
12
15
  key: 0,
13
16
  class: "flex items-center shrink-0 w-4 h-4 text-green-500 ltr:right-2 rtl:left-2 dark:text-green-400",
14
17
  "aria-hidden": "true",
15
18
  xmlns: "http://www.w3.org/2000/svg",
16
19
  fill: "none",
17
20
  viewBox: "0 0 16 12"
18
- }, Te = {
21
+ }, Ue = {
19
22
  key: 2,
20
23
  class: "p-2 text-center text-gray-500"
21
- }, Ue = {
24
+ }, Ae = {
22
25
  key: 3,
23
26
  class: "p-2 text-gray-500"
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 = {
27
+ }, qe = { class: "block mt-1 text-sm font-normal leading-5 text-red-500" }, Ve = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, Pe = {
25
28
  __name: "GlDropdown",
26
29
  props: {
27
30
  modelValue: {
@@ -106,46 +109,60 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
106
109
  custom_option_label: {
107
110
  type: String,
108
111
  default: "Use:"
112
+ },
113
+ /** Extra classes on the field itself, e.g. to square a corner when it sits against another field. */
114
+ input_class: {
115
+ type: String,
116
+ default: ""
117
+ },
118
+ /** Extra classes on the open list, e.g. a minimum width wider than a narrow field. */
119
+ options_class: {
120
+ type: String,
121
+ default: ""
122
+ },
123
+ disabled: {
124
+ type: Boolean,
125
+ default: !1
109
126
  }
110
127
  },
111
128
  emits: ["update:modelValue", "selected", "selectionChanged"],
112
- setup(r, { emit: le }) {
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;
129
+ setup(o, { emit: le }) {
130
+ const r = o, k = le, a = v({}), T = v(!1), y = v(0), x = v(!1), m = v(""), g = v(""), $ = v(!1), S = v(1), _ = v(null), L = v(1), i = Y([]), E = v(!1), j = Y([]), U = v([]), ne = v(null), H = v(null);
131
+ let B = !1, p = null, A = 0, C = null;
115
132
  const z = (e) => e?.name === "CanceledError" || e?.name === "AbortError" || typeof axios < "u" && axios.isCancel?.(e), q = async (e = "down") => {
116
- if ($.value || !o.api_url) return;
133
+ if ($.value || !r.api_url) return;
117
134
  p && p.abort(), p = new AbortController();
118
135
  const t = ++A;
119
136
  $.value = !0;
120
137
  try {
121
- const l = e === "up" ? Math.max(S.value - 1, L.value) : S.value, { data: n } = await axios.get(o.api_url, {
138
+ const l = e === "up" ? Math.max(S.value - 1, L.value) : S.value, { data: n } = await axios.get(r.api_url, {
122
139
  params: { search: m.value, page: l, per_page: 20 },
123
140
  signal: p.signal
124
141
  });
125
- if (E || t !== A) return;
142
+ if (B || t !== A) return;
126
143
  if (!n || !n.data) {
127
- i.value = [], O.value = !1;
144
+ i.value = [], E.value = !1;
128
145
  return;
129
146
  }
130
147
  const u = W(n.data);
131
148
  if (e === "down") {
132
149
  const d = i.value.length ? i.value.concat(u) : u, D = a.value;
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;
150
+ b(D) && D.id !== void 0 && D.name && !d.some((M) => String(M.id) === String(D.id)) && d.unshift(D), i.value = d, S.value++, _.value = n.last_page, E.value = !0;
134
151
  }
135
152
  _.value || (_.value = n.last_page), L.value || (L.value = 1);
136
153
  } catch (l) {
137
154
  if (z(l)) return;
138
155
  console.error("Error fetching data:", l);
139
156
  } finally {
140
- !E && t === A && ($.value = !1, p = null);
157
+ !B && t === A && ($.value = !1, p = null);
141
158
  }
142
159
  }, ae = async (e) => {
143
- if (!o.api_url || e === null || e === void 0 || e === "") return null;
160
+ if (!r.api_url || e === null || e === void 0 || e === "") return null;
144
161
  try {
145
- const { data: t } = await axios.get(o.api_url, {
162
+ const { data: t } = await axios.get(r.api_url, {
146
163
  params: { search: e, per_page: 20 }
147
164
  });
148
- if (E) return null;
165
+ if (B) return null;
149
166
  const l = t?.data;
150
167
  if (!l || !l.length) return null;
151
168
  const n = String(e);
@@ -167,56 +184,56 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
167
184
  return;
168
185
  }
169
186
  const u = await ae(t);
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: "" });
187
+ B || (u ? (a.value = u, i.value.some((d) => String(d.id) === String(u.id)) || (i.value = [u, ...i.value])) : r.allow_custom ? a.value = { id: t, name: t } : a.value = { id: t, name: "" });
171
188
  }, re = (e) => {
172
189
  const t = e.target;
173
190
  t && t.scrollHeight - t.clientHeight <= t.scrollTop + 10 && S.value <= _.value && q("down");
174
191
  }, K = (e) => {
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));
192
+ e.target && (document.activeElement.classList.contains("showOptions" + g.value) ? x.value || V() : e.target.id != r.field_name + "search" + g.value && e.target.id != r.field_name && !e.target.classList.contains("showOptions" + g.value) && (R(), y.value = 0, x.value = !1));
176
193
  }, V = () => {
177
- if (!o.show) {
194
+ if (!(r.show || r.disabled)) {
178
195
  if (x.value) {
179
196
  x.value = !1;
180
197
  return;
181
198
  }
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(() => {
199
+ m.value = "", x.value = !0, r.api_url && (!E.value || i.value.length === 0) && (S.value = 1, _.value = null, i.value = [], E.value = !1, q("down")), pe(() => {
183
200
  const e = document.getElementById(
184
- `${o.field_name}search${g.value}`
201
+ `${r.field_name}search${g.value}`
185
202
  );
186
203
  e && e.focus();
187
204
  });
188
205
  }
189
206
  }, N = () => {
190
207
  const e = (t) => {
191
- if (o.allow_custom && t) {
208
+ if (r.allow_custom && t) {
192
209
  const l = typeof t == "object" ? t.id : t;
193
210
  return { id: l, name: l };
194
211
  }
195
212
  return {};
196
213
  };
197
- return w(a.value) ? typeof a.value == "object" ? i.value.find(
214
+ return b(a.value) ? typeof a.value == "object" ? i.value.find(
198
215
  (t) => String(t.id) === String(a.value.id)
199
216
  ) || e(a.value) : i.value.find(
200
217
  (t) => String(t.id) === String(a.value)
201
- ) || e(a.value) : o.modelValue ? typeof o.modelValue == "object" ? i.value.find(
202
- (t) => String(t.id) === String(o.modelValue.id)
203
- ) || e(o.modelValue) : i.value.find(
204
- (t) => String(t.id) === String(o.modelValue)
205
- ) || e(o.modelValue) : {};
218
+ ) || e(a.value) : r.modelValue ? typeof r.modelValue == "object" ? i.value.find(
219
+ (t) => String(t.id) === String(r.modelValue.id)
220
+ ) || e(r.modelValue) : i.value.find(
221
+ (t) => String(t.id) === String(r.modelValue)
222
+ ) || e(r.modelValue) : {};
206
223
  };
207
224
  ve(() => {
208
- g.value = ue(), o.show || (document.body.addEventListener("click", G), document.addEventListener("focusin", K));
225
+ g.value = ue(), r.show || (document.body.addEventListener("click", G), document.addEventListener("focusin", K));
209
226
  }), me(() => {
210
- E = !0, p && (p.abort(), p = null), C && (clearTimeout(C), C = null), document.body.removeEventListener("click", G), document.removeEventListener("focusin", K);
227
+ B = !0, p && (p.abort(), p = null), C && (clearTimeout(C), C = null), document.body.removeEventListener("click", G), document.removeEventListener("focusin", K);
211
228
  });
212
229
  function ie() {
213
- const e = I.value, t = o.maxItem, l = m.value;
230
+ const e = j.value, t = r.maxItem, l = m.value;
214
231
  if (!l)
215
232
  return e.length > t ? e.slice(0, t) : e;
216
233
  const n = l.toLowerCase(), u = [];
217
234
  for (let d = 0, D = e.length; d < D && u.length < t; d++) {
218
- const j = e[d];
219
- String(j.name).toLowerCase().includes(n) && u.push(j);
235
+ const M = e[d];
236
+ (String(M.name).toLowerCase().includes(n) || String(M.keywords ?? "").toLowerCase().includes(n)) && u.push(M);
220
237
  }
221
238
  return u;
222
239
  }
@@ -240,11 +257,11 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
240
257
  return e = Math.floor(e / 16), (t === "x" ? l : l & 3 | 8).toString(16);
241
258
  });
242
259
  }
243
- function w(e) {
260
+ function b(e) {
244
261
  return e && typeof e == "object" && Object.keys(e).length > 0;
245
262
  }
246
263
  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) && (R(), y.value = 0, x.value = !1);
264
+ e.target.id != r.field_name + "search" + g.value && e.target.id != r.field_name && !e.target.classList.contains("showOptions" + g.value) && (R(), y.value = 0, x.value = !1);
248
265
  }
249
266
  function J(e) {
250
267
  const t = `${e}${g.value}`, l = document.getElementById(t), n = H.value;
@@ -269,7 +286,7 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
269
286
  return t;
270
287
  }
271
288
  function ce() {
272
- const e = o.options, t = new Array(e.length);
289
+ const e = r.options, t = new Array(e.length);
273
290
  for (let l = 0; l < e.length; l++) {
274
291
  const n = e[l];
275
292
  t[l] = typeof n == "object" ? n : { id: n, name: n };
@@ -278,104 +295,107 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
278
295
  }
279
296
  function X() {
280
297
  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]), P(t);
298
+ 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], j.value = [...j.value, t]), P(t);
282
299
  }
283
300
  function P(e) {
284
301
  T.value = !0, a.value = e, x.value = !1, k("update:modelValue", a.value.id), k("selected", a.value), k("selectionChanged", a.value);
285
302
  }
286
303
  function fe() {
287
- o.show || (a.value = {}, m.value = "", k("update:modelValue", ""), k("selected", a.value), k("selectionChanged", a.value), V());
304
+ r.show || (a.value = {}, m.value = "", k("update:modelValue", ""), k("selected", a.value), k("selectionChanged", a.value), V());
288
305
  }
289
306
  function R() {
290
307
  (!a.value || !a.value.id) && (a.value = {}, m.value = "");
291
308
  }
292
- return M(m, () => {
293
- if (!o.api_url) {
309
+ return I(m, () => {
310
+ if (!r.api_url) {
294
311
  i.value = ie(), i.value.length === 0 && (a.value = {});
295
312
  return;
296
313
  }
297
314
  C && clearTimeout(C), C = setTimeout(() => {
298
- C = null, !E && (S.value = 1, _.value = null, L.value = 1, i.value = [], O.value = !1, q("down"));
315
+ C = null, !B && (S.value = 1, _.value = null, L.value = 1, i.value = [], E.value = !1, q("down"));
299
316
  }, 250);
300
- }), M(a, (e) => {
301
- w(e) && e.id !== o.modelValue && k("update:modelValue", e.id);
302
- }), M(
303
- () => o.api_url,
317
+ }), I(a, (e) => {
318
+ b(e) && e.id !== r.modelValue && k("update:modelValue", e.id);
319
+ }), I(
320
+ () => r.api_url,
304
321
  () => {
305
- p && (p.abort(), p = null), S.value = 1, _.value = null, L.value = 1, i.value = [], O.value = !1;
322
+ p && (p.abort(), p = null), S.value = 1, _.value = null, L.value = 1, i.value = [], E.value = !1;
306
323
  },
307
324
  { immediate: !0 }
308
- ), M(
309
- () => o.modelValue,
325
+ ), I(
326
+ () => r.modelValue,
310
327
  async (e) => {
311
328
  if (!e) {
312
329
  a.value = {};
313
330
  return;
314
331
  }
315
332
  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();
333
+ b(a.value) && String(a.value.id) !== String(t) && (a.value = {}, T.value = !1), r.api_url ? T.value ? a.value = N() : await oe(e) : a.value = N();
317
334
  },
318
335
  { immediate: !0 }
319
- ), M(
320
- () => o.options,
336
+ ), I(
337
+ () => r.options,
321
338
  () => {
322
- if (!o.api_url) {
339
+ if (!r.api_url) {
323
340
  const e = ce(), t = new Set(e.map((n) => String(n.id))), l = e;
324
341
  for (const n of U.value) {
325
342
  const u = String(n.id);
326
343
  t.has(u) || (l.push(n), t.add(u));
327
344
  }
328
- I.value = l, i.value = l, a.value = N();
345
+ j.value = l, i.value = l, a.value = N();
329
346
  }
330
347
  },
331
348
  // deep so the list still updates when options load late by mutating the SAME
332
349
  // array in place (e.g. column.options.push(...)) — a reference-only watch
333
350
  // would miss that and leave the dropdown list empty.
334
351
  { immediate: !0, deep: !0 }
335
- ), (e, t) => (v(), f(Z, null, [
336
- r.show ? (v(), f("div", {
352
+ ), (e, t) => (f(), c(Z, null, [
353
+ o.show ? (f(), c("div", {
337
354
  key: 0,
338
- class: B(r.field_name)
355
+ class: O(o.field_name)
339
356
  }, [
340
- s("h3", ye, b(r.label_name), 1),
357
+ s("h3", ye, w(o.label_name), 1),
341
358
  s("p", xe, [
342
- w(a.value) ? (v(), f("span", we, b(a.value?.name), 1)) : h("", !0)
359
+ b(a.value) ? (f(), c("span", we, w(a.value?.name), 1)) : h("", !0)
343
360
  ]),
344
361
  t[6] || (t[6] = s("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
345
362
  ], 2)) : h("", !0),
346
- r.show ? h("", !0) : (v(), f("div", {
363
+ o.show ? h("", !0) : (f(), c("div", {
347
364
  key: 1,
348
- class: B(r.field_name)
365
+ class: O(o.field_name)
349
366
  }, [
350
367
  s("input", {
351
368
  type: "hidden",
352
- name: r.field_name,
353
- id: r.field_name,
369
+ name: o.field_name,
370
+ id: o.field_name,
354
371
  value: a.value?.id
355
372
  }, null, 8, be),
356
- r.options ? (v(), f("div", ke, [
357
- r.label_name ? (v(), f("label", {
373
+ o.options ? (f(), c("div", ke, [
374
+ o.label_name ? (f(), c("label", {
358
375
  key: 0,
359
- class: B({
360
- "gl-label-form": r.error_message == "",
361
- "gl-label-form-invalid": r.error_message !== "",
362
- required: r.is_required
376
+ class: O({
377
+ "gl-label-form": o.error_message == "",
378
+ "gl-label-form-invalid": o.error_message !== "",
379
+ required: o.is_required
363
380
  })
364
- }, b(r.label_name), 3)) : h("", !0),
381
+ }, w(o.label_name), 3)) : h("", !0),
365
382
  s("div", Se, [
366
383
  s("div", _e, [
367
384
  s("input", {
368
385
  ref_key: "myDivDropDown",
369
386
  ref: ne,
370
- class: B([{
371
- "gl-input-form": r.error_message == "",
372
- "gl-input-form-invalid": r.error_message !== "",
387
+ class: O([{
388
+ "gl-input-form": o.error_message == "",
389
+ "gl-input-form-invalid": o.error_message !== "",
373
390
  [`showOptions${g.value}`]: !0,
374
- "pr-14!": w(a.value) && r.has_cancel,
375
- "pr-8!": !(w(a.value) && r.has_cancel)
391
+ "pr-14!": b(a.value) && o.has_cancel,
392
+ "pr-8!": !(b(a.value) && o.has_cancel),
393
+ "opacity-70 cursor-not-allowed": o.disabled,
394
+ [o.input_class]: o.input_class !== ""
376
395
  }, "truncate showOptions1"]),
377
396
  value: a.value?.name,
378
- placeholder: r.placeholder,
397
+ placeholder: o.placeholder,
398
+ disabled: o.disabled,
379
399
  autocomplete: "off",
380
400
  readonly: ""
381
401
  }, null, 10, Ce),
@@ -400,15 +420,15 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
400
420
  })
401
421
  ], -1)
402
422
  ]), 512), [
403
- [te, w(a.value) && r.has_cancel]
423
+ [te, b(a.value) && o.has_cancel]
404
424
  ]),
405
425
  s("i", {
406
426
  onClick: t[1] || (t[1] = ee((l) => V(), ["stop"])),
407
427
  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",
408
428
  style: { top: "14px" }
409
429
  }, [
410
- (v(), f("svg", {
411
- class: B([x.value ? "" : "rotate-180", "w-3 h-3 shrink-0"]),
430
+ (f(), c("svg", {
431
+ class: O([x.value ? "" : "rotate-180", "w-3 h-3 shrink-0"]),
412
432
  "aria-hidden": "true",
413
433
  xmlns: "http://www.w3.org/2000/svg",
414
434
  fill: "none",
@@ -423,24 +443,26 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
423
443
  }, null, -1)
424
444
  ]), 2))
425
445
  ]),
426
- F(s("div", De, [
427
- r.hide_search ? h("", !0) : (v(), f("div", Oe, [
446
+ F(s("div", {
447
+ class: O(["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", o.options_class])
448
+ }, [
449
+ o.hide_search ? h("", !0) : (f(), c("div", De, [
428
450
  t[10] || (t[10] = s("label", {
429
451
  for: "default-search",
430
452
  class: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"
431
453
  }, "Search", -1)),
432
- s("div", Ee, [
454
+ s("div", Oe, [
433
455
  t[9] || (t[9] = s("div", { class: "absolute inset-y-0 flex items-center pointer-events-none start-0 ps-3" }, null, -1)),
434
456
  F(s("input", {
435
457
  type: "search",
436
458
  "onUpdate:modelValue": t[2] || (t[2] = (l) => m.value = l),
437
- id: `${r.field_name}search${g.value}`,
459
+ id: `${o.field_name}search${g.value}`,
438
460
  onKeydown: se,
439
461
  onBlur: t[3] || (t[3] = (l) => R()),
440
462
  autocomplete: "off",
441
463
  class: "block w-full p-2 text-sm text-gray-900 outline-hidden dark:bg-gray-800 dark:text-white",
442
- placeholder: r.search_input_placeholder
443
- }, null, 40, Be), [
464
+ placeholder: o.search_input_placeholder
465
+ }, null, 40, Ee), [
444
466
  [ge, m.value]
445
467
  ])
446
468
  ])
@@ -451,18 +473,18 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
451
473
  ref_key: "dropdownRef",
452
474
  ref: H
453
475
  }, [
454
- r.allow_custom && m.value && !i.value.find((l) => String(l.name) === String(m.value)) ? (v(), f("div", {
476
+ o.allow_custom && m.value && !i.value.find((l) => String(l.name) === String(m.value)) ? (f(), c("div", {
455
477
  key: 0,
456
478
  class: "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",
457
479
  onClick: t[4] || (t[4] = (l) => X()),
458
480
  onMousedown: t[5] || (t[5] = (l) => X())
459
481
  }, [
460
- s("div", $e, [
461
- s("span", null, b(r.custom_option_label) + ' "' + b(m.value) + '"', 1)
482
+ s("div", Be, [
483
+ s("span", null, w(o.custom_option_label) + ' "' + w(m.value) + '"', 1)
462
484
  ])
463
485
  ], 32)) : h("", !0),
464
- i.value.length ? (v(!0), f(Z, { key: 1 }, pe(i.value, (l, n) => (v(), f("div", {
465
- class: B([
486
+ i.value.length ? (f(!0), c(Z, { key: 1 }, he(i.value, (l, n) => (f(), c("div", {
487
+ class: O([
466
488
  "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",
467
489
  n + 1 == y.value ? "bg-gray-100 dark:bg-gray-700 rounded-sm" : ""
468
490
  ]),
@@ -471,11 +493,14 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
471
493
  key: n,
472
494
  id: `${n + 1}${g.value}`
473
495
  }, [
474
- s("div", Me, [
475
- s("span", {
476
- innerHTML: l.name || l.id || "-"
477
- }, null, 8, Ie),
478
- a.value?.id === l.id ? (v(), f("svg", je, t[11] || (t[11] = [
496
+ s("div", Le, [
497
+ s("span", Me, [
498
+ s("span", {
499
+ innerHTML: l.name || l.id || "-"
500
+ }, null, 8, Ie),
501
+ l.hint ? (f(), c("span", je, w(l.hint), 1)) : h("", !0)
502
+ ]),
503
+ a.value?.id === l.id ? (f(), c("svg", Te, t[11] || (t[11] = [
479
504
  s("path", {
480
505
  stroke: "currentColor",
481
506
  "stroke-linecap": "round",
@@ -485,22 +510,22 @@ const ye = { class: "font-bold ptext-lg dark:text-white" }, xe = { class: "mt-3
485
510
  }, null, -1)
486
511
  ]))) : h("", !0)
487
512
  ])
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)
513
+ ], 42, $e))), 128)) : h("", !0),
514
+ $.value ? (f(), c("div", Ue, " Loading... ")) : h("", !0),
515
+ !$.value && i.value.length === 0 && !(o.allow_custom && m.value) ? (f(), c("div", Ae, w(o.no_results_found_placeholder), 1)) : h("", !0)
491
516
  ], 544)
492
- ], 512), [
517
+ ], 2), [
493
518
  [te, x.value]
494
519
  ])
495
520
  ])
496
521
  ])
497
522
  ])) : h("", !0),
498
- s("span", Ae, b(r.error_message), 1),
499
- s("small", qe, b(r.description), 1)
523
+ s("span", qe, w(o.error_message), 1),
524
+ s("small", Ve, w(o.description), 1)
500
525
  ], 2))
501
526
  ], 64));
502
527
  }
503
528
  };
504
529
  export {
505
- Ne as default
530
+ Pe as default
506
531
  };
@@ -0,0 +1,182 @@
1
+ import { ref as E, computed as d, watch as I, createElementBlock as s, openBlock as u, normalizeClass as S, createCommentVNode as x, createElementVNode as b, toDisplayString as f, Fragment as T, createTextVNode as U, createBlock as z } from "vue";
2
+ import G from "./GlDropdown.vue.js";
3
+ import { PHONE_PREFERRED as L, PHONE_COUNTRIES as j, PHONE_CODE_DEFAULTS as J } from "./phoneCountries.js";
4
+ const K = {
5
+ key: 0,
6
+ class: "gl-label-form"
7
+ }, M = {
8
+ class: "mt-1 text-gray-900 dark:text-white tabular-nums",
9
+ dir: "ltr"
10
+ }, Q = ["for"], X = {
11
+ class: "flex",
12
+ dir: "ltr"
13
+ }, Y = {
14
+ key: 0,
15
+ class: "h-10 inline-flex shrink-0 items-center rounded-s-lg border border-e-0 border-gray-200 bg-gray-100 px-3 text-sm font-medium text-gray-700 tabular-nums dark:border-gray-700 dark:bg-gray-700 dark:text-gray-200"
16
+ }, Z = ["id", "name", "value", "placeholder", "required", "disabled", "aria-invalid"], ee = { class: "gl-span-form-error" }, te = {
17
+ key: 1,
18
+ class: "block mt-1 text-sm font-normal leading-5 text-gray-500"
19
+ }, re = {
20
+ __name: "GlPhoneInput",
21
+ props: {
22
+ /** The number without its country code, digits only. */
23
+ modelValue: { type: [String, Number], default: "" },
24
+ /** The dialling code, such as +968. Bind with v-model:country_code. */
25
+ country_code: { type: String, default: "+968" },
26
+ /** The country's ISO code, such as OM, where a code is shared. Optional. */
27
+ country: { type: String, default: "" },
28
+ /**
29
+ * The countries offered: [{ code: 'OM', dial: '+968', name: 'Oman', length: 8 }].
30
+ * length is the digits after the code, used to warn on a short or long
31
+ * number; leave it out where numbers vary. Defaults to every country.
32
+ */
33
+ countries: { type: Array, default: () => j },
34
+ /** ISO codes listed first; the rest follow alphabetically. */
35
+ preferred: { type: Array, default: () => L },
36
+ /** Show the code as fixed text instead of a picker. */
37
+ lock_country: { type: Boolean, default: !1 },
38
+ field_name: { type: String, default: "" },
39
+ label_name: { type: String, default: "" },
40
+ is_required: { type: Boolean, default: !1 },
41
+ show: { type: Boolean, default: !1 },
42
+ disabled: { type: Boolean, default: !1 },
43
+ error_message: { type: String, default: "" },
44
+ description: { type: String, default: "" },
45
+ placeholder: { type: String, default: "" },
46
+ /** Shown when the length is off. :country and :length are filled in. */
47
+ length_message: { type: String, default: ":country numbers have :length digits." },
48
+ search_placeholder: { type: String, default: "Search country or code" }
49
+ },
50
+ emits: ["update:modelValue", "update:country_code", "update:country", "change", "blur"],
51
+ setup(a, { expose: $, emit: C }) {
52
+ const n = a, g = C, h = E(null), B = E(!1), i = (e) => e.code || e.dial, c = d(() => {
53
+ const e = n.countries;
54
+ return !n.country_code || e.some((t) => t.dial === n.country_code) ? e : [...e, { code: "", dial: n.country_code, name: n.country_code }];
55
+ }), O = d(
56
+ () => n.preferred.map((e) => c.value.find((t) => t.code === e)).filter(Boolean)
57
+ ), q = d(() => [
58
+ ...O.value,
59
+ ...c.value.filter((e) => !n.preferred.includes(e.code)).sort((e, t) => e.name.localeCompare(t.name))
60
+ ]), D = d(
61
+ () => q.value.map((e) => ({
62
+ id: i(e),
63
+ name: e.code ? `${e.dial} ${e.code}` : e.dial,
64
+ hint: e.code ? e.name : "",
65
+ keywords: `${e.name} ${e.dial} ${e.code}`
66
+ }))
67
+ );
68
+ function w(e, t = "") {
69
+ const l = c.value.filter((r) => r.dial === e);
70
+ return l.find((r) => t && r.code === t) || O.value.find((r) => r.dial === e) || l.find((r) => r.code === J[e]) || l[0] || null;
71
+ }
72
+ const v = E(i(w(n.country_code, n.country) || { dial: n.country_code }));
73
+ I(
74
+ () => [n.country_code, n.country],
75
+ ([e, t]) => {
76
+ const l = c.value.find((k) => i(k) === v.value);
77
+ if (l && l.dial === e && (!t || l.code === t))
78
+ return;
79
+ const r = w(e, t);
80
+ v.value = r ? i(r) : e;
81
+ }
82
+ );
83
+ const o = d(() => c.value.find((e) => i(e) === v.value) || null), m = d(() => String(n.modelValue ?? "")), P = d(() => {
84
+ const e = o.value?.length;
85
+ return !B.value || !e || m.value === "" || m.value.length === e ? "" : n.length_message.replace(":country", o.value.name).replace(":length", String(e));
86
+ }), y = d(() => n.error_message || P.value), W = (e) => String(e ?? "").replace(/\D/g, ""), p = (e) => e.replace(/\D/g, "");
87
+ function F(e) {
88
+ return [...new Set(c.value.map((l) => l.dial).filter(Boolean))].sort((l, r) => p(r).length - p(l).length).find((l) => e.startsWith(p(l)));
89
+ }
90
+ function N(e) {
91
+ v.value = i(e), e.dial !== n.country_code && g("update:country_code", e.dial), e.code && e.code !== n.country && g("update:country", e.code);
92
+ }
93
+ function V(e) {
94
+ const t = o.value?.dial || n.country_code;
95
+ g("change", { country_code: t, country: o.value?.code || "", number: e, full: e ? `${t}${e}` : "" });
96
+ }
97
+ function H(e) {
98
+ const t = String(e ?? "").trim();
99
+ let l = W(t);
100
+ if (!n.lock_country && (t.startsWith("+") || t.startsWith("00"))) {
101
+ const k = t.startsWith("00") ? l.slice(2) : l, _ = F(k);
102
+ _ && (N(o.value?.dial === _ ? o.value : w(_)), l = k.slice(p(_).length));
103
+ }
104
+ const r = o.value?.length;
105
+ r && l.length === r + 1 && l.startsWith("0") && (l = l.slice(1)), g("update:modelValue", l), V(l), h.value && h.value.value !== l && (h.value.value = l);
106
+ }
107
+ function R(e) {
108
+ const t = e?.id ? c.value.find((l) => i(l) === e.id) : null;
109
+ t && (N(t), V(m.value));
110
+ }
111
+ function A(e) {
112
+ B.value = !0, g("blur", e);
113
+ }
114
+ return $({ focus: () => h.value?.focus() }), (e, t) => a.show ? (u(), s("div", {
115
+ key: 0,
116
+ class: S(a.field_name)
117
+ }, [
118
+ a.label_name ? (u(), s("label", K, f(a.label_name), 1)) : x("", !0),
119
+ b("p", M, [
120
+ m.value ? (u(), s(T, { key: 0 }, [
121
+ U(f(o.value?.dial || a.country_code) + " " + f(m.value), 1)
122
+ ], 64)) : x("", !0)
123
+ ]),
124
+ t[1] || (t[1] = b("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
125
+ ], 2)) : (u(), s("div", {
126
+ key: 1,
127
+ class: S(a.field_name)
128
+ }, [
129
+ a.label_name ? (u(), s("label", {
130
+ key: 0,
131
+ for: a.field_name,
132
+ class: S({
133
+ "gl-label-form": !y.value,
134
+ "gl-label-form-invalid": y.value,
135
+ required: a.is_required
136
+ })
137
+ }, f(a.label_name), 11, Q)) : x("", !0),
138
+ b("div", X, [
139
+ a.lock_country ? (u(), s("span", Y, f(o.value?.dial || a.country_code), 1)) : (u(), z(G, {
140
+ key: 1,
141
+ class: "w-32 shrink-0",
142
+ field_name: `${a.field_name}_country`,
143
+ options: D.value,
144
+ modelValue: v.value,
145
+ has_cancel: !1,
146
+ disabled: a.disabled,
147
+ search_input_placeholder: a.search_placeholder,
148
+ input_class: "rounded-e-none! border-e-0! bg-gray-100! dark:bg-gray-700! font-medium tabular-nums",
149
+ options_class: "min-w-72",
150
+ onSelectionChanged: R
151
+ }, null, 8, ["field_name", "options", "modelValue", "disabled", "search_input_placeholder"])),
152
+ b("input", {
153
+ ref_key: "input",
154
+ ref: h,
155
+ type: "tel",
156
+ inputmode: "numeric",
157
+ autocomplete: "tel-national",
158
+ id: a.field_name,
159
+ name: a.field_name,
160
+ value: m.value,
161
+ placeholder: a.placeholder || (o.value?.length ? "0".repeat(o.value.length) : ""),
162
+ maxlength: "24",
163
+ required: a.is_required,
164
+ disabled: a.disabled,
165
+ "aria-invalid": y.value ? "true" : "false",
166
+ class: S(["min-w-0 rounded-s-none! tabular-nums", {
167
+ "gl-input-form": !y.value,
168
+ "gl-input-form-invalid": y.value,
169
+ "opacity-70 cursor-not-allowed bg-gray-100 dark:bg-gray-700": a.disabled
170
+ }]),
171
+ onInput: t[0] || (t[0] = (l) => H(l.target.value)),
172
+ onBlur: A
173
+ }, null, 42, Z)
174
+ ]),
175
+ b("span", ee, f(y.value), 1),
176
+ a.description ? (u(), s("small", te, f(a.description), 1)) : x("", !0)
177
+ ], 2));
178
+ }
179
+ };
180
+ export {
181
+ re as default
182
+ };
@@ -0,0 +1,250 @@
1
+ const a = (n, i, e, r) => r ? { code: n, name: i, dial: e, length: r } : { code: n, name: i, dial: e }, o = [
2
+ a("AF", "Afghanistan", "+93", 9),
3
+ a("AX", "Åland Islands", "+358"),
4
+ a("AL", "Albania", "+355", 9),
5
+ a("DZ", "Algeria", "+213", 9),
6
+ a("AS", "American Samoa", "+1"),
7
+ a("AD", "Andorra", "+376", 6),
8
+ a("AO", "Angola", "+244", 9),
9
+ a("AI", "Anguilla", "+1"),
10
+ a("AG", "Antigua and Barbuda", "+1"),
11
+ a("AR", "Argentina", "+54"),
12
+ a("AM", "Armenia", "+374", 8),
13
+ a("AW", "Aruba", "+297", 7),
14
+ a("AU", "Australia", "+61", 9),
15
+ a("AT", "Austria", "+43"),
16
+ a("AZ", "Azerbaijan", "+994", 9),
17
+ a("BS", "Bahamas", "+1"),
18
+ a("BH", "Bahrain", "+973", 8),
19
+ a("BD", "Bangladesh", "+880", 10),
20
+ a("BB", "Barbados", "+1"),
21
+ a("BY", "Belarus", "+375", 9),
22
+ a("BE", "Belgium", "+32", 9),
23
+ a("BZ", "Belize", "+501", 7),
24
+ a("BJ", "Benin", "+229"),
25
+ a("BM", "Bermuda", "+1"),
26
+ a("BT", "Bhutan", "+975", 8),
27
+ a("BO", "Bolivia", "+591", 8),
28
+ a("BQ", "Caribbean Netherlands", "+599"),
29
+ a("BA", "Bosnia and Herzegovina", "+387"),
30
+ a("BW", "Botswana", "+267", 8),
31
+ a("BR", "Brazil", "+55", 11),
32
+ a("IO", "British Indian Ocean Territory", "+246"),
33
+ a("VG", "British Virgin Islands", "+1"),
34
+ a("BN", "Brunei", "+673", 7),
35
+ a("BG", "Bulgaria", "+359", 9),
36
+ a("BF", "Burkina Faso", "+226", 8),
37
+ a("BI", "Burundi", "+257", 8),
38
+ a("CV", "Cape Verde", "+238", 7),
39
+ a("KH", "Cambodia", "+855"),
40
+ a("CM", "Cameroon", "+237", 9),
41
+ a("CA", "Canada", "+1", 10),
42
+ a("KY", "Cayman Islands", "+1"),
43
+ a("CF", "Central African Republic", "+236", 8),
44
+ a("TD", "Chad", "+235", 8),
45
+ a("CL", "Chile", "+56", 9),
46
+ a("CN", "China", "+86", 11),
47
+ a("CX", "Christmas Island", "+61"),
48
+ a("CC", "Cocos (Keeling) Islands", "+61"),
49
+ a("CO", "Colombia", "+57", 10),
50
+ a("KM", "Comoros", "+269", 7),
51
+ a("CG", "Congo", "+242", 9),
52
+ a("CD", "Congo (DRC)", "+243", 9),
53
+ a("CK", "Cook Islands", "+682", 5),
54
+ a("CR", "Costa Rica", "+506", 8),
55
+ a("CI", "Côte d'Ivoire", "+225", 10),
56
+ a("HR", "Croatia", "+385"),
57
+ a("CU", "Cuba", "+53", 8),
58
+ a("CW", "Curaçao", "+599"),
59
+ a("CY", "Cyprus", "+357", 8),
60
+ a("CZ", "Czechia", "+420", 9),
61
+ a("DK", "Denmark", "+45", 8),
62
+ a("DJ", "Djibouti", "+253", 8),
63
+ a("DM", "Dominica", "+1"),
64
+ a("DO", "Dominican Republic", "+1"),
65
+ a("EC", "Ecuador", "+593", 9),
66
+ a("EG", "Egypt", "+20", 10),
67
+ a("SV", "El Salvador", "+503", 8),
68
+ a("GQ", "Equatorial Guinea", "+240", 9),
69
+ a("ER", "Eritrea", "+291", 7),
70
+ a("EE", "Estonia", "+372"),
71
+ a("SZ", "Eswatini", "+268", 8),
72
+ a("ET", "Ethiopia", "+251", 9),
73
+ a("FK", "Falkland Islands", "+500", 5),
74
+ a("FO", "Faroe Islands", "+298", 6),
75
+ a("FJ", "Fiji", "+679", 7),
76
+ a("FI", "Finland", "+358"),
77
+ a("FR", "France", "+33", 9),
78
+ a("GF", "French Guiana", "+594", 9),
79
+ a("PF", "French Polynesia", "+689", 8),
80
+ a("GA", "Gabon", "+241"),
81
+ a("GM", "Gambia", "+220", 7),
82
+ a("GE", "Georgia", "+995", 9),
83
+ a("DE", "Germany", "+49"),
84
+ a("GH", "Ghana", "+233", 9),
85
+ a("GI", "Gibraltar", "+350", 8),
86
+ a("GR", "Greece", "+30", 10),
87
+ a("GL", "Greenland", "+299", 6),
88
+ a("GD", "Grenada", "+1"),
89
+ a("GP", "Guadeloupe", "+590", 9),
90
+ a("GU", "Guam", "+1"),
91
+ a("GT", "Guatemala", "+502", 8),
92
+ a("GG", "Guernsey", "+44"),
93
+ a("GN", "Guinea", "+224", 9),
94
+ a("GW", "Guinea-Bissau", "+245"),
95
+ a("GY", "Guyana", "+592", 7),
96
+ a("HT", "Haiti", "+509", 8),
97
+ a("HN", "Honduras", "+504", 8),
98
+ a("HK", "Hong Kong", "+852", 8),
99
+ a("HU", "Hungary", "+36", 9),
100
+ a("IS", "Iceland", "+354", 7),
101
+ a("IN", "India", "+91", 10),
102
+ a("ID", "Indonesia", "+62"),
103
+ a("IR", "Iran", "+98", 10),
104
+ a("IQ", "Iraq", "+964", 10),
105
+ a("IE", "Ireland", "+353", 9),
106
+ a("IM", "Isle of Man", "+44"),
107
+ a("IL", "Israel", "+972", 9),
108
+ a("IT", "Italy", "+39"),
109
+ a("JM", "Jamaica", "+1"),
110
+ a("JP", "Japan", "+81", 10),
111
+ a("JE", "Jersey", "+44"),
112
+ a("JO", "Jordan", "+962", 9),
113
+ a("KZ", "Kazakhstan", "+7", 10),
114
+ a("KE", "Kenya", "+254", 9),
115
+ a("KI", "Kiribati", "+686"),
116
+ a("XK", "Kosovo", "+383"),
117
+ a("KW", "Kuwait", "+965", 8),
118
+ a("KG", "Kyrgyzstan", "+996", 9),
119
+ a("LA", "Laos", "+856"),
120
+ a("LV", "Latvia", "+371", 8),
121
+ a("LB", "Lebanon", "+961"),
122
+ a("LS", "Lesotho", "+266", 8),
123
+ a("LR", "Liberia", "+231"),
124
+ a("LY", "Libya", "+218", 9),
125
+ a("LI", "Liechtenstein", "+423"),
126
+ a("LT", "Lithuania", "+370", 8),
127
+ a("LU", "Luxembourg", "+352", 9),
128
+ a("MO", "Macao", "+853", 8),
129
+ a("MG", "Madagascar", "+261", 9),
130
+ a("MW", "Malawi", "+265", 9),
131
+ a("MY", "Malaysia", "+60"),
132
+ a("MV", "Maldives", "+960", 7),
133
+ a("ML", "Mali", "+223", 8),
134
+ a("MT", "Malta", "+356", 8),
135
+ a("MH", "Marshall Islands", "+692", 7),
136
+ a("MQ", "Martinique", "+596", 9),
137
+ a("MR", "Mauritania", "+222", 8),
138
+ a("MU", "Mauritius", "+230", 8),
139
+ a("YT", "Mayotte", "+262"),
140
+ a("MX", "Mexico", "+52", 10),
141
+ a("FM", "Micronesia", "+691", 7),
142
+ a("MD", "Moldova", "+373", 8),
143
+ a("MC", "Monaco", "+377"),
144
+ a("MN", "Mongolia", "+976", 8),
145
+ a("ME", "Montenegro", "+382"),
146
+ a("MS", "Montserrat", "+1"),
147
+ a("MA", "Morocco", "+212", 9),
148
+ a("MZ", "Mozambique", "+258", 9),
149
+ a("MM", "Myanmar", "+95"),
150
+ a("NA", "Namibia", "+264", 9),
151
+ a("NR", "Nauru", "+674", 7),
152
+ a("NP", "Nepal", "+977", 10),
153
+ a("NL", "Netherlands", "+31", 9),
154
+ a("NC", "New Caledonia", "+687", 6),
155
+ a("NZ", "New Zealand", "+64"),
156
+ a("NI", "Nicaragua", "+505", 8),
157
+ a("NE", "Niger", "+227", 8),
158
+ a("NG", "Nigeria", "+234", 10),
159
+ a("NU", "Niue", "+683"),
160
+ a("NF", "Norfolk Island", "+672"),
161
+ a("KP", "North Korea", "+850"),
162
+ a("MK", "North Macedonia", "+389", 8),
163
+ a("MP", "Northern Mariana Islands", "+1"),
164
+ a("NO", "Norway", "+47", 8),
165
+ a("OM", "Oman", "+968", 8),
166
+ a("PK", "Pakistan", "+92", 10),
167
+ a("PW", "Palau", "+680", 7),
168
+ a("PS", "Palestine", "+970", 9),
169
+ a("PA", "Panama", "+507", 8),
170
+ a("PG", "Papua New Guinea", "+675", 8),
171
+ a("PY", "Paraguay", "+595", 9),
172
+ a("PE", "Peru", "+51", 9),
173
+ a("PH", "Philippines", "+63", 10),
174
+ a("PL", "Poland", "+48", 9),
175
+ a("PT", "Portugal", "+351", 9),
176
+ a("PR", "Puerto Rico", "+1"),
177
+ a("QA", "Qatar", "+974", 8),
178
+ a("RE", "Réunion", "+262", 9),
179
+ a("RO", "Romania", "+40", 9),
180
+ a("RU", "Russia", "+7", 10),
181
+ a("RW", "Rwanda", "+250", 9),
182
+ a("BL", "Saint Barthélemy", "+590"),
183
+ a("SH", "Saint Helena", "+290"),
184
+ a("KN", "Saint Kitts and Nevis", "+1"),
185
+ a("LC", "Saint Lucia", "+1"),
186
+ a("MF", "Saint Martin", "+590"),
187
+ a("PM", "Saint Pierre and Miquelon", "+508", 6),
188
+ a("VC", "Saint Vincent and the Grenadines", "+1"),
189
+ a("WS", "Samoa", "+685"),
190
+ a("SM", "San Marino", "+378"),
191
+ a("ST", "São Tomé and Príncipe", "+239", 7),
192
+ a("SA", "Saudi Arabia", "+966", 9),
193
+ a("SN", "Senegal", "+221", 9),
194
+ a("RS", "Serbia", "+381"),
195
+ a("SC", "Seychelles", "+248", 7),
196
+ a("SL", "Sierra Leone", "+232", 8),
197
+ a("SG", "Singapore", "+65", 8),
198
+ a("SX", "Sint Maarten", "+1"),
199
+ a("SK", "Slovakia", "+421", 9),
200
+ a("SI", "Slovenia", "+386", 8),
201
+ a("SB", "Solomon Islands", "+677"),
202
+ a("SO", "Somalia", "+252"),
203
+ a("ZA", "South Africa", "+27", 9),
204
+ a("KR", "South Korea", "+82"),
205
+ a("SS", "South Sudan", "+211", 9),
206
+ a("ES", "Spain", "+34", 9),
207
+ a("LK", "Sri Lanka", "+94", 9),
208
+ a("SD", "Sudan", "+249", 9),
209
+ a("SR", "Suriname", "+597", 7),
210
+ a("SJ", "Svalbard and Jan Mayen", "+47"),
211
+ a("SE", "Sweden", "+46", 9),
212
+ a("CH", "Switzerland", "+41", 9),
213
+ a("SY", "Syria", "+963", 9),
214
+ a("TW", "Taiwan", "+886", 9),
215
+ a("TJ", "Tajikistan", "+992", 9),
216
+ a("TZ", "Tanzania", "+255", 9),
217
+ a("TH", "Thailand", "+66", 9),
218
+ a("TL", "Timor-Leste", "+670", 8),
219
+ a("TG", "Togo", "+228", 8),
220
+ a("TK", "Tokelau", "+690"),
221
+ a("TO", "Tonga", "+676"),
222
+ a("TT", "Trinidad and Tobago", "+1"),
223
+ a("TN", "Tunisia", "+216", 8),
224
+ a("TR", "Türkiye", "+90", 10),
225
+ a("TM", "Turkmenistan", "+993", 8),
226
+ a("TC", "Turks and Caicos Islands", "+1"),
227
+ a("TV", "Tuvalu", "+688"),
228
+ a("UG", "Uganda", "+256", 9),
229
+ a("UA", "Ukraine", "+380", 9),
230
+ a("AE", "United Arab Emirates", "+971", 9),
231
+ a("GB", "United Kingdom", "+44", 10),
232
+ a("US", "United States", "+1", 10),
233
+ a("UY", "Uruguay", "+598", 8),
234
+ a("VI", "U.S. Virgin Islands", "+1"),
235
+ a("UZ", "Uzbekistan", "+998", 9),
236
+ a("VU", "Vanuatu", "+678"),
237
+ a("VA", "Vatican City", "+39"),
238
+ a("VE", "Venezuela", "+58", 10),
239
+ a("VN", "Vietnam", "+84", 9),
240
+ a("WF", "Wallis and Futuna", "+681", 6),
241
+ a("EH", "Western Sahara", "+212"),
242
+ a("YE", "Yemen", "+967", 9),
243
+ a("ZM", "Zambia", "+260", 9),
244
+ a("ZW", "Zimbabwe", "+263", 9)
245
+ ], s = ["OM", "AE", "SA", "QA", "KW", "BH", "EG"], t = { "+1": "US", "+7": "RU", "+44": "GB", "+47": "NO", "+61": "AU", "+39": "IT", "+212": "MA", "+262": "RE", "+358": "FI", "+590": "GP", "+599": "CW" };
246
+ export {
247
+ t as PHONE_CODE_DEFAULTS,
248
+ o as PHONE_COUNTRIES,
249
+ s as PHONE_PREFERRED
250
+ };
package/dist/main.js CHANGED
@@ -6,142 +6,148 @@ import { default as u } from "./components/GeneralComponents/GlMultiSelectDropdo
6
6
  import { default as p } from "./components/GeneralComponents/GLButton.vue.js";
7
7
  import { default as G } from "./components/GeneralComponents/GlTextareaTranslate.vue.js";
8
8
  import { default as n } from "./components/GeneralComponents/GlTextTranslate.vue.js";
9
- import { default as c } from "./components/GeneralComponents/GlTextInput.vue.js";
10
- import { default as b } from "./components/GeneralComponents/GlDatePicker.vue.js";
11
- import { default as C } from "./components/GeneralComponents/GlDateTimePicker.vue.js";
12
- import { default as L } from "./components/GeneralComponents/GlDateRangePicker.vue.js";
13
- import { default as P } from "./components/GeneralComponents/GlDateTimeRangePicker.vue.js";
14
- import { default as y } from "./components/GeneralComponents/GlTimeRangePicker.vue.js";
15
- import { default as k } from "./components/GeneralComponents/GlDateRangeCalendar.vue.js";
16
- import { default as A } from "./components/GeneralComponents/GlTextInputFile.vue.js";
9
+ import { default as T } from "./components/GeneralComponents/GlTextInput.vue.js";
10
+ import { default as b } from "./components/GeneralComponents/GlPhoneInput.vue.js";
11
+ import { PHONE_CODE_DEFAULTS as C, PHONE_COUNTRIES as g, PHONE_PREFERRED as P } from "./components/GeneralComponents/phoneCountries.js";
12
+ import { default as E } from "./components/GeneralComponents/GlDatePicker.vue.js";
13
+ import { default as F } from "./components/GeneralComponents/GlDateTimePicker.vue.js";
14
+ import { default as w } from "./components/GeneralComponents/GlDateRangePicker.vue.js";
15
+ import { default as O } from "./components/GeneralComponents/GlDateTimeRangePicker.vue.js";
16
+ import { default as v } from "./components/GeneralComponents/GlTimeRangePicker.vue.js";
17
+ import { default as I } from "./components/GeneralComponents/GlDateRangeCalendar.vue.js";
18
+ import { default as N } from "./components/GeneralComponents/GlTextInputFile.vue.js";
17
19
  import { default as B } from "./components/GeneralComponents/GlTabsWrapper.vue.js";
18
- import { default as h } from "./components/GeneralComponents/GlTab.vue.js";
19
- import { default as H } from "./components/GeneralComponents/GlTabShow.vue.js";
20
- import { default as E } from "./components/GeneralComponents/GlMultiItemSlide.vue.js";
21
- import { default as U } from "./components/GeneralComponents/GlMultiItemSlideDynamic.vue.js";
22
- import { default as q } from "./components/GeneralComponents/GlModal.vue.js";
23
- import { default as J } from "./components/GeneralComponents/GlModalWithoutOverflow.vue.js";
24
- import { default as Q } from "./components/GeneralComponents/GlModalShow.vue.js";
25
- import { default as X } from "./components/GeneralComponents/GlToggleBox.vue.js";
26
- import { default as Z } from "./components/GeneralComponents/GlToggleBoxTrueFalse.vue.js";
27
- import { default as $ } from "./components/GeneralComponents/GlDropdown.vue.js";
28
- import { default as ea } from "./components/GeneralComponents/GLTextarea.vue.js";
29
- import { default as oa } from "./components/GeneralComponents/GlTinymce.vue.js";
30
- import { default as ra } from "./components/GeneralComponents/GlCodeMirror.vue.js";
31
- import { default as sa } from "./components/GeneralComponents/GlCodeMirrorTranslate.vue.js";
32
- import { default as ua } from "./components/GeneralComponents/GlTinymceTranslate.vue.js";
33
- import { default as pa } from "./components/GeneralComponents/DataTable/GLDataTableServerSide.vue.js";
34
- import { default as Ga } from "./components/GeneralComponents/DataTable/GlDataTableComponent.vue.js";
35
- import { default as na } from "./components/GeneralComponents/DataTable/GlDataTableServerSideGroupBy.vue.js";
36
- import { default as ca } from "./components/GeneralComponents/DataTable/GLDataTable.vue.js";
37
- import { default as ba } from "./components/GeneralComponents/DataTable/DatatableConvertCronToHuman.vue.js";
38
- import { default as Ca } from "./components/GeneralComponents/DeleteConfirmationModal.vue.js";
39
- import { default as La } from "./components/GeneralComponents/GlAccordionsWrapper.vue.js";
40
- import { default as Pa } from "./components/GeneralComponents/GlAccordion.vue.js";
41
- import { default as ya } from "./components/GeneralComponents/GlToastList.vue.js";
42
- import { default as ka } from "./Stores/toast.js";
43
- import { default as Aa } from "./components/GeneralComponents/DataTable/DatatableAction.vue.js";
20
+ import { default as U } from "./components/GeneralComponents/GlTab.vue.js";
21
+ import { default as j } from "./components/GeneralComponents/GlTabShow.vue.js";
22
+ import { default as z } from "./components/GeneralComponents/GlMultiItemSlide.vue.js";
23
+ import { default as K } from "./components/GeneralComponents/GlMultiItemSlideDynamic.vue.js";
24
+ import { default as V } from "./components/GeneralComponents/GlModal.vue.js";
25
+ import { default as Y } from "./components/GeneralComponents/GlModalWithoutOverflow.vue.js";
26
+ import { default as $ } from "./components/GeneralComponents/GlModalShow.vue.js";
27
+ import { default as ea } from "./components/GeneralComponents/GlToggleBox.vue.js";
28
+ import { default as oa } from "./components/GeneralComponents/GlToggleBoxTrueFalse.vue.js";
29
+ import { default as ra } from "./components/GeneralComponents/GlDropdown.vue.js";
30
+ import { default as sa } from "./components/GeneralComponents/GLTextarea.vue.js";
31
+ import { default as ua } from "./components/GeneralComponents/GlTinymce.vue.js";
32
+ import { default as pa } from "./components/GeneralComponents/GlCodeMirror.vue.js";
33
+ import { default as Ga } from "./components/GeneralComponents/GlCodeMirrorTranslate.vue.js";
34
+ import { default as na } from "./components/GeneralComponents/GlTinymceTranslate.vue.js";
35
+ import { default as Ta } from "./components/GeneralComponents/DataTable/GLDataTableServerSide.vue.js";
36
+ import { default as ba } from "./components/GeneralComponents/DataTable/GlDataTableComponent.vue.js";
37
+ import { default as Ca } from "./components/GeneralComponents/DataTable/GlDataTableServerSideGroupBy.vue.js";
38
+ import { default as Pa } from "./components/GeneralComponents/DataTable/GLDataTable.vue.js";
39
+ import { default as Ea } from "./components/GeneralComponents/DataTable/DatatableConvertCronToHuman.vue.js";
40
+ import { default as Fa } from "./components/GeneralComponents/DeleteConfirmationModal.vue.js";
41
+ import { default as wa } from "./components/GeneralComponents/GlAccordionsWrapper.vue.js";
42
+ import { default as Oa } from "./components/GeneralComponents/GlAccordion.vue.js";
43
+ import { default as va } from "./components/GeneralComponents/GlToastList.vue.js";
44
+ import { default as Ia } from "./Stores/toast.js";
45
+ import { default as Na } from "./components/GeneralComponents/DataTable/DatatableAction.vue.js";
44
46
  import { default as Ba } from "./components/GeneralComponents/DataTable/DatatableDeleteAction.vue.js";
45
- import { default as ha } from "./components/GeneralComponents/DataTable/DatatableDeleteEditAction.vue.js";
46
- import { default as Ha } from "./components/GeneralComponents/DataTable/DatatableFileDownload.vue.js";
47
- import { default as Ea } from "./components/GeneralComponents/DataTable/DatatableFiles.vue.js";
48
- import { default as Ua } from "./components/GeneralComponents/DataTable/DatatableHtml.vue.js";
49
- import { default as qa } from "./components/GeneralComponents/DataTable/DatatableList.vue.js";
50
- import { default as Ja } from "./components/GeneralComponents/DataTable/DatatableListNested.vue.js";
51
- import { default as Qa } from "./components/GeneralComponents/DataTable/DatatablePicture.vue.js";
52
- import { default as Xa } from "./components/GeneralComponents/DataTable/DatatablePictures.vue.js";
53
- import { default as Za } from "./components/GeneralComponents/DataTable/DatatableStatus.vue.js";
54
- import { default as $a } from "./components/GeneralComponents/DataTable/DatatableStatusGeneral.vue.js";
55
- import { default as ee } from "./components/GeneralComponents/DataTable/DatatableStatusSpecficColor.vue.js";
56
- import { default as oe } from "./components/GeneralComponents/DataTable/DatatableStatusTextLabelGeneral.vue.js";
57
- import { default as re } from "./components/GeneralComponents/DataTable/DatatableDateTime.vue.js";
58
- import { default as se } from "./components/GeneralComponents/DataTable/DatatableDate.vue.js";
59
- import { default as ue } from "./components/GeneralComponents/DataTable/DatatableStatusServer.vue.js";
60
- import { default as pe } from "./components/GeneralComponents/DataTable/DatatableCommand.vue.js";
61
- import { default as Ge } from "./components/LaravelVuePagination/TailwindPagination.vue.js";
62
- import { default as ne } from "./components/GeneralComponents/ConfirmationModal.vue.js";
63
- import { default as ce } from "./components/GeneralComponents/DynamicConfirmation.vue.js";
64
- import { default as be } from "./components/GeneralComponents/GlCodeCopy.vue.js";
65
- import { default as Ce } from "./components/GeneralComponents/GlTextCopy.vue.js";
66
- import { default as Le } from "./components/GeneralComponents/StatusRunningSuccessFailed.vue.js";
67
- import { default as Pe } from "./components/GeneralComponents/StatusConnectingConnectedDisconnected.vue.js";
68
- import { default as ye } from "./ClickOutsideDirective.js";
69
- import { default as ke } from "./Form.js";
70
- import { default as Ae } from "./multilingual.js";
71
- import { glLocale as Be, setGlLocales as Ie } from "./localeStore.js";
72
- import { default as We, triggerPrint as He } from "./print/print.js";
47
+ import { default as Ua } from "./components/GeneralComponents/DataTable/DatatableDeleteEditAction.vue.js";
48
+ import { default as ja } from "./components/GeneralComponents/DataTable/DatatableFileDownload.vue.js";
49
+ import { default as za } from "./components/GeneralComponents/DataTable/DatatableFiles.vue.js";
50
+ import { default as Ka } from "./components/GeneralComponents/DataTable/DatatableHtml.vue.js";
51
+ import { default as Va } from "./components/GeneralComponents/DataTable/DatatableList.vue.js";
52
+ import { default as Ya } from "./components/GeneralComponents/DataTable/DatatableListNested.vue.js";
53
+ import { default as $a } from "./components/GeneralComponents/DataTable/DatatablePicture.vue.js";
54
+ import { default as ee } from "./components/GeneralComponents/DataTable/DatatablePictures.vue.js";
55
+ import { default as oe } from "./components/GeneralComponents/DataTable/DatatableStatus.vue.js";
56
+ import { default as re } from "./components/GeneralComponents/DataTable/DatatableStatusGeneral.vue.js";
57
+ import { default as se } from "./components/GeneralComponents/DataTable/DatatableStatusSpecficColor.vue.js";
58
+ import { default as ue } from "./components/GeneralComponents/DataTable/DatatableStatusTextLabelGeneral.vue.js";
59
+ import { default as pe } from "./components/GeneralComponents/DataTable/DatatableDateTime.vue.js";
60
+ import { default as Ge } from "./components/GeneralComponents/DataTable/DatatableDate.vue.js";
61
+ import { default as ne } from "./components/GeneralComponents/DataTable/DatatableStatusServer.vue.js";
62
+ import { default as Te } from "./components/GeneralComponents/DataTable/DatatableCommand.vue.js";
63
+ import { default as be } from "./components/LaravelVuePagination/TailwindPagination.vue.js";
64
+ import { default as Ce } from "./components/GeneralComponents/ConfirmationModal.vue.js";
65
+ import { default as Pe } from "./components/GeneralComponents/DynamicConfirmation.vue.js";
66
+ import { default as Ee } from "./components/GeneralComponents/GlCodeCopy.vue.js";
67
+ import { default as Fe } from "./components/GeneralComponents/GlTextCopy.vue.js";
68
+ import { default as we } from "./components/GeneralComponents/StatusRunningSuccessFailed.vue.js";
69
+ import { default as Oe } from "./components/GeneralComponents/StatusConnectingConnectedDisconnected.vue.js";
70
+ import { default as ve } from "./ClickOutsideDirective.js";
71
+ import { default as Ie } from "./Form.js";
72
+ import { default as Ne } from "./multilingual.js";
73
+ import { glLocale as Be, setGlLocales as _e } from "./localeStore.js";
74
+ import { default as We, triggerPrint as je } from "./print/print.js";
73
75
  export {
74
- ye as ClickOutsideDirective,
75
- oe as DatatableStatusTextLabelGeneral,
76
- ke as Form,
77
- pe as GLDatatableCommand,
78
- se as GLDatatableDate,
79
- re as GLDatatableDateTime,
80
- ue as GLDatatableStatusServer,
81
- Pa as GlAccordion,
82
- La as GlAccordionsWrapper,
76
+ ve as ClickOutsideDirective,
77
+ ue as DatatableStatusTextLabelGeneral,
78
+ Ie as Form,
79
+ Te as GLDatatableCommand,
80
+ Ge as GLDatatableDate,
81
+ pe as GLDatatableDateTime,
82
+ ne as GLDatatableStatusServer,
83
+ Oa as GlAccordion,
84
+ wa as GlAccordionsWrapper,
83
85
  p as GlButton,
84
86
  s as GlCard,
85
- be as GlCodeCopy,
86
- ra as GlCodeMirror,
87
- sa as GlCodeMirrorTranslate,
88
- ne as GlConfirmationModal,
89
- ca as GlDataTable,
90
- Ga as GlDataTableComponent,
91
- pa as GlDataTableServerSide,
92
- na as GlDataTableServerSideGroupBy,
93
- Aa as GlDatatableAction,
94
- ba as GlDatatableConvertCronToHuman,
87
+ Ee as GlCodeCopy,
88
+ pa as GlCodeMirror,
89
+ Ga as GlCodeMirrorTranslate,
90
+ Ce as GlConfirmationModal,
91
+ Pa as GlDataTable,
92
+ ba as GlDataTableComponent,
93
+ Ta as GlDataTableServerSide,
94
+ Ca as GlDataTableServerSideGroupBy,
95
+ Na as GlDatatableAction,
96
+ Ea as GlDatatableConvertCronToHuman,
95
97
  Ba as GlDatatableDeleteAction,
96
- ha as GlDatatableDeleteEditAction,
97
- Ha as GlDatatableFileDownload,
98
- Ea as GlDatatableFiles,
99
- Ua as GlDatatableHtml,
100
- qa as GlDatatableList,
101
- Ja as GlDatatableListNested,
102
- Qa as GlDatatablePicture,
103
- Xa as GlDatatablePictures,
104
- Za as GlDatatableStatus,
105
- $a as GlDatatableStatusGeneral,
106
- ee as GlDatatableStatusSpecficColor,
107
- b as GlDatePicker,
108
- k as GlDateRangeCalendar,
109
- L as GlDateRangePicker,
110
- C as GlDateTimePicker,
111
- P as GlDateTimeRangePicker,
112
- Ca as GlDeleteConfirmationModal,
113
- $ as GlDropdown,
114
- ce as GlDynamicConfirmation,
98
+ Ua as GlDatatableDeleteEditAction,
99
+ ja as GlDatatableFileDownload,
100
+ za as GlDatatableFiles,
101
+ Ka as GlDatatableHtml,
102
+ Va as GlDatatableList,
103
+ Ya as GlDatatableListNested,
104
+ $a as GlDatatablePicture,
105
+ ee as GlDatatablePictures,
106
+ oe as GlDatatableStatus,
107
+ re as GlDatatableStatusGeneral,
108
+ se as GlDatatableStatusSpecficColor,
109
+ E as GlDatePicker,
110
+ I as GlDateRangeCalendar,
111
+ w as GlDateRangePicker,
112
+ F as GlDateTimePicker,
113
+ O as GlDateTimeRangePicker,
114
+ Fa as GlDeleteConfirmationModal,
115
+ ra as GlDropdown,
116
+ Pe as GlDynamicConfirmation,
115
117
  o as GlFilesUpload,
116
118
  r as GlLanguageSelector,
117
- q as GlModal,
118
- Q as GlModalShow,
119
- J as GlModalWithoutOverflow,
120
- E as GlMultiItemSlide,
121
- U as GlMultiItemSlideDynamic,
119
+ V as GlModal,
120
+ $ as GlModalShow,
121
+ Y as GlModalWithoutOverflow,
122
+ z as GlMultiItemSlide,
123
+ K as GlMultiItemSlideDynamic,
122
124
  u as GlMultiSelectDropdown,
125
+ b as GlPhoneInput,
123
126
  We as GlPrint,
124
- Pe as GlStatusConnectingConnectedDisconnected,
125
- Le as GlStatusRunningSuccessFailed,
126
- h as GlTab,
127
- H as GlTabShow,
127
+ Oe as GlStatusConnectingConnectedDisconnected,
128
+ we as GlStatusRunningSuccessFailed,
129
+ U as GlTab,
130
+ j as GlTabShow,
128
131
  B as GlTabsWrapper,
129
- Ge as GlTailwindPagination,
130
- Ce as GlTextCopy,
131
- c as GlTextInput,
132
- A as GlTextInputFile,
132
+ be as GlTailwindPagination,
133
+ Fe as GlTextCopy,
134
+ T as GlTextInput,
135
+ N as GlTextInputFile,
133
136
  n as GlTextTranslate,
134
- ea as GlTextarea,
137
+ sa as GlTextarea,
135
138
  G as GlTextareaTranslate,
136
- y as GlTimeRangePicker,
137
- oa as GlTinymce,
138
- ua as GlTinymceTranslate,
139
- ka as GlToast,
140
- ya as GlToastList,
141
- X as GlToggleBox,
142
- Z as GlToggleBoxTrueFalse,
139
+ v as GlTimeRangePicker,
140
+ ua as GlTinymce,
141
+ na as GlTinymceTranslate,
142
+ Ia as GlToast,
143
+ va as GlToastList,
144
+ ea as GlToggleBox,
145
+ oa as GlToggleBoxTrueFalse,
146
+ C as PHONE_CODE_DEFAULTS,
147
+ g as PHONE_COUNTRIES,
148
+ P as PHONE_PREFERRED,
143
149
  Be as glLocale,
144
- Ae as multilingual,
145
- Ie as setGlLocales,
146
- He as triggerPrint
150
+ Ne as multilingual,
151
+ _e as setGlLocales,
152
+ je as triggerPrint
147
153
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The most popular library of interactive components built with Vuejs && Tailwind CSS",
4
4
  "type": "module",
5
5
  "private": false,
6
- "version": "1.3.9",
6
+ "version": "1.3.11",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/mrgiant/GoldenLogicUi.git"