@paraxe/vue 1.0.4 → 1.0.5

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.
@@ -28,12 +28,14 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
28
28
  direction: "asc" | "desc";
29
29
  }) => any;
30
30
  "update:selectedRows": (rows: unknown[]) => any;
31
+ "row-click": (row: unknown) => any;
31
32
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
32
33
  onSort?: ((payload: {
33
34
  key: string;
34
35
  direction: "asc" | "desc";
35
36
  }) => any) | undefined;
36
37
  "onUpdate:selectedRows"?: ((rows: unknown[]) => any) | undefined;
38
+ "onRow-click"?: ((row: unknown) => any) | undefined;
37
39
  }>, {
38
40
  loading: boolean;
39
41
  multiple: boolean;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as m, computed as b, openBlock as n, createElementBlock as d, normalizeClass as f, renderSlot as u, createBlock as T, resolveDynamicComponent as A, withCtx as L, createCommentVNode as $, createElementVNode as p, createTextVNode as R, toDisplayString as S, ref as V, provide as M, inject as z, withDirectives as te, vShow as ae, useModel as se, watch as K, mergeModels as Q, withKeys as j, withModifiers as Y, unref as N, Fragment as q, renderList as G, normalizeStyle as W, useSlots as le, onMounted as J, onBeforeUnmount as O, Teleport as U, nextTick as Z } from "vue";
1
+ import { defineComponent as m, computed as b, openBlock as n, createElementBlock as d, normalizeClass as f, renderSlot as u, createBlock as E, resolveDynamicComponent as z, withCtx as L, createCommentVNode as $, createElementVNode as p, createTextVNode as F, toDisplayString as V, ref as x, provide as K, inject as O, withDirectives as te, vShow as ae, useModel as se, watch as P, mergeModels as Q, withKeys as j, withModifiers as Y, unref as N, Fragment as M, renderList as G, normalizeStyle as W, useSlots as le, onMounted as J, onBeforeUnmount as R, Teleport as U, nextTick as Z } from "vue";
2
2
  const oe = ["disabled"], It = /* @__PURE__ */ m({
3
3
  __name: "Button",
4
4
  props: {
@@ -39,7 +39,7 @@ const oe = ["disabled"], It = /* @__PURE__ */ m({
39
39
  "card",
40
40
  `card-${e.variant}`
41
41
  ]);
42
- return (s, l) => (n(), T(A(e.as), {
42
+ return (s, l) => (n(), E(z(e.as), {
43
43
  class: f(t.value)
44
44
  }, {
45
45
  default: L(() => [
@@ -161,7 +161,7 @@ const At = /* @__PURE__ */ H(ie, [["render", de]]), Mt = /* @__PURE__ */ m({
161
161
  "heading-sm": e.level === "h4",
162
162
  "heading-xs": e.level === "h5" || e.level === "h6"
163
163
  }));
164
- return (s, l) => (n(), T(A(a.level), {
164
+ return (s, l) => (n(), E(z(a.level), {
165
165
  class: f(t.value)
166
166
  }, {
167
167
  default: L(() => [
@@ -185,7 +185,7 @@ const At = /* @__PURE__ */ H(ie, [["render", de]]), Mt = /* @__PURE__ */ m({
185
185
  "text-inverse": e.tone === "inverse",
186
186
  "text-brand": e.tone === "brand"
187
187
  }));
188
- return (s, l) => (n(), T(A(e.as), {
188
+ return (s, l) => (n(), E(z(e.as), {
189
189
  class: f(t.value)
190
190
  }, {
191
191
  default: L(() => [
@@ -200,7 +200,7 @@ function pe(a, e) {
200
200
  u(a.$slots, "default")
201
201
  ]);
202
202
  }
203
- const Pt = /* @__PURE__ */ H(ce, [["render", pe]]), Ft = /* @__PURE__ */ m({
203
+ const Pt = /* @__PURE__ */ H(ce, [["render", pe]]), Rt = /* @__PURE__ */ m({
204
204
  __name: "SectionHeader",
205
205
  props: {
206
206
  width: { default: "default" },
@@ -217,7 +217,7 @@ const Pt = /* @__PURE__ */ H(ce, [["render", pe]]), Ft = /* @__PURE__ */ m({
217
217
  u(t.$slots, "default")
218
218
  ], 2));
219
219
  }
220
- }), Rt = /* @__PURE__ */ m({
220
+ }), Ft = /* @__PURE__ */ m({
221
221
  __name: "ButtonGroup",
222
222
  props: {
223
223
  align: { default: "start" },
@@ -304,7 +304,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
304
304
  setup(a) {
305
305
  const e = a;
306
306
  return (t, s) => (n(), d("div", $e, [
307
- e.label ? (n(), T(ye, {
307
+ e.label ? (n(), E(ye, {
308
308
  key: 0,
309
309
  for: e.id,
310
310
  required: e.required,
@@ -312,26 +312,26 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
312
312
  disabled: e.disabled
313
313
  }, {
314
314
  default: L(() => [
315
- R(S(e.label), 1)
315
+ F(V(e.label), 1)
316
316
  ]),
317
317
  _: 1
318
318
  }, 8, ["for", "required", "optional", "disabled"])) : $("", !0),
319
319
  u(t.$slots, "default"),
320
- e.description && !e.error ? (n(), T(X, {
320
+ e.description && !e.error ? (n(), E(X, {
321
321
  key: 1,
322
322
  tone: "muted"
323
323
  }, {
324
324
  default: L(() => [
325
- R(S(e.description), 1)
325
+ F(V(e.description), 1)
326
326
  ]),
327
327
  _: 1
328
328
  })) : $("", !0),
329
- e.error ? (n(), T(X, {
329
+ e.error ? (n(), E(X, {
330
330
  key: 2,
331
331
  tone: "accent"
332
332
  }, {
333
333
  default: L(() => [
334
- R(S(e.error), 1)
334
+ F(V(e.error), 1)
335
335
  ]),
336
336
  _: 1
337
337
  })) : $("", !0)
@@ -407,7 +407,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
407
407
  defaultOpen: { default: () => [] }
408
408
  },
409
409
  setup(a) {
410
- const e = a, t = V([...e.defaultOpen]);
410
+ const e = a, t = x([...e.defaultOpen]);
411
411
  function s(o) {
412
412
  return t.value.includes(o);
413
413
  }
@@ -424,7 +424,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
424
424
  }
425
425
  t.value = [o];
426
426
  }
427
- return M("loba-accordion", {
427
+ return K("loba-accordion", {
428
428
  openItems: t,
429
429
  isOpen: s,
430
430
  toggleItem: l
@@ -439,7 +439,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
439
439
  disabled: { type: Boolean, default: !1 }
440
440
  },
441
441
  setup(a) {
442
- const e = a, t = z("loba-accordion");
442
+ const e = a, t = O("loba-accordion");
443
443
  if (!t)
444
444
  throw new Error(
445
445
  "AccordionItem must be used inside an Accordion."
@@ -513,7 +513,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
513
513
  const e = a, t = b(() => [
514
514
  "empty-state"
515
515
  ]);
516
- return (s, l) => (n(), T(A(e.as), {
516
+ return (s, l) => (n(), E(z(e.as), {
517
517
  class: f(t.value)
518
518
  }, {
519
519
  default: L(() => [
@@ -543,8 +543,8 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
543
543
  }),
544
544
  emits: /* @__PURE__ */ Q(["update:modelValue"], ["update:modelValue"]),
545
545
  setup(a, { emit: e }) {
546
- const t = a, s = V(/* @__PURE__ */ new Set()), l = se(a, "modelValue");
547
- K(
546
+ const t = a, s = x(/* @__PURE__ */ new Set()), l = se(a, "modelValue");
547
+ P(
548
548
  l,
549
549
  (i) => {
550
550
  if (i == null) {
@@ -570,7 +570,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
570
570
  const y = [...c];
571
571
  l.value = t.multiple ? y : y[0] ?? null;
572
572
  }
573
- return M("loba-list", {
573
+ return K("loba-list", {
574
574
  selectable: t.selectable,
575
575
  multiple: t.multiple,
576
576
  isSelected: o,
@@ -586,7 +586,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
586
586
  disabled: { type: Boolean, default: !1 }
587
587
  },
588
588
  setup(a) {
589
- const e = a, t = z("loba-list");
589
+ const e = a, t = O("loba-list");
590
590
  if (!t)
591
591
  throw new Error(
592
592
  "ListItem must be used inside a List."
@@ -625,7 +625,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
625
625
  }), Ae = { class: "pagination-controls" }, Me = ["disabled"], ze = ["disabled"], Ke = { class: "pagination-pages" }, Oe = {
626
626
  key: 0,
627
627
  class: "pagination-ellipsis"
628
- }, Pe = ["aria-current", "onClick"], Fe = { class: "pagination-controls" }, Re = ["disabled"], Ge = ["disabled"], ta = /* @__PURE__ */ m({
628
+ }, Pe = ["aria-current", "onClick"], Re = { class: "pagination-controls" }, Fe = ["disabled"], Ge = ["disabled"], ta = /* @__PURE__ */ m({
629
629
  __name: "Pagination",
630
630
  props: {
631
631
  currentPage: {},
@@ -649,27 +649,27 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
649
649
  l.value
650
650
  )
651
651
  ), r = b(() => {
652
- const g = l.value, B = o.value, k = Math.max(
652
+ const g = l.value, B = o.value, w = Math.max(
653
653
  0,
654
654
  t.siblingCount
655
655
  );
656
656
  if (g <= 7)
657
657
  return Array.from(
658
658
  { length: g },
659
- (F, ee) => ee + 1
659
+ (A, ee) => ee + 1
660
660
  );
661
- const _ = Math.max(
662
- B - k,
661
+ const q = Math.max(
662
+ B - w,
663
663
  1
664
- ), w = Math.min(
665
- B + k,
664
+ ), v = Math.min(
665
+ B + w,
666
666
  g
667
- ), v = _ > 2, C = w < g - 1, x = [1];
668
- v && x.push("...");
669
- const I = v ? _ : 2, P = C ? w : g - 1;
670
- for (let F = I; F <= P; F++)
671
- x.push(F);
672
- return C && x.push("..."), x.push(g), x;
667
+ ), C = q > 2, h = v < g - 1, k = [1];
668
+ C && k.push("...");
669
+ const D = C ? q : 2, I = h ? v : g - 1;
670
+ for (let A = D; A <= I; A++)
671
+ k.push(A);
672
+ return h && k.push("..."), k.push(g), k;
673
673
  }), i = b(() => ({
674
674
  pagination: !0,
675
675
  "pagination-compact": t.compact
@@ -687,13 +687,13 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
687
687
  function y() {
688
688
  c(o.value - 1);
689
689
  }
690
- function D() {
690
+ function T() {
691
691
  c(o.value + 1);
692
692
  }
693
- function E() {
693
+ function S() {
694
694
  c(1);
695
695
  }
696
- function h() {
696
+ function _() {
697
697
  c(l.value);
698
698
  }
699
699
  return (g, B) => (n(), d("nav", {
@@ -708,7 +708,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
708
708
  type: "button",
709
709
  disabled: o.value === 1,
710
710
  "aria-label": "First page",
711
- onClick: E
711
+ onClick: S
712
712
  }, " « ", 10, Me),
713
713
  p("button", {
714
714
  class: f(["pagination-item", {
@@ -721,21 +721,21 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
721
721
  }, " ‹ ", 10, ze)
722
722
  ]),
723
723
  p("div", Ke, [
724
- (n(!0), d(q, null, G(r.value, (k, _) => (n(), d(q, {
725
- key: `${k}-${_}`
724
+ (n(!0), d(M, null, G(r.value, (w, q) => (n(), d(M, {
725
+ key: `${w}-${q}`
726
726
  }, [
727
- k === "..." ? (n(), d("span", Oe, " … ")) : (n(), d("button", {
727
+ w === "..." ? (n(), d("span", Oe, " … ")) : (n(), d("button", {
728
728
  key: 1,
729
729
  class: f(["pagination-item", {
730
- "pagination-item--current": k === o.value
730
+ "pagination-item--current": w === o.value
731
731
  }]),
732
732
  type: "button",
733
- "aria-current": k === o.value ? "page" : void 0,
734
- onClick: (w) => c(k)
735
- }, S(k), 11, Pe))
733
+ "aria-current": w === o.value ? "page" : void 0,
734
+ onClick: (v) => c(w)
735
+ }, V(w), 11, Pe))
736
736
  ], 64))), 128))
737
737
  ]),
738
- p("div", Fe, [
738
+ p("div", Re, [
739
739
  p("button", {
740
740
  class: f(["pagination-item", {
741
741
  "pagination-item--disabled": o.value === l.value
@@ -743,8 +743,8 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
743
743
  type: "button",
744
744
  disabled: o.value === l.value,
745
745
  "aria-label": "Next page",
746
- onClick: D
747
- }, " › ", 10, Re),
746
+ onClick: T
747
+ }, " › ", 10, Fe),
748
748
  p("button", {
749
749
  class: f(["pagination-item", {
750
750
  "pagination-item--disabled": o.value === l.value
@@ -752,7 +752,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
752
752
  type: "button",
753
753
  disabled: o.value === l.value,
754
754
  "aria-label": "Last page",
755
- onClick: h
755
+ onClick: _
756
756
  }, " » ", 10, Ge)
757
757
  ])
758
758
  ], 2));
@@ -775,43 +775,41 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
775
775
  multiple: { type: Boolean, default: !1 },
776
776
  loading: { type: Boolean, default: !1 }
777
777
  },
778
- emits: ["update:selectedRows", "sort"],
778
+ emits: ["update:selectedRows", "sort", "row-click"],
779
779
  setup(a, { emit: e }) {
780
- const t = a, s = e, l = V(
781
- null
782
- ), o = V("asc"), r = V(/* @__PURE__ */ new Set());
783
- function i(_, w) {
784
- if (!(typeof _ != "object" || _ === null))
785
- return _[w];
780
+ const t = a, s = e, l = x(null), o = x("asc"), r = x(/* @__PURE__ */ new Set());
781
+ function i(v, C) {
782
+ if (!(typeof v != "object" || v === null))
783
+ return v[C];
786
784
  }
787
- function c(_) {
788
- const w = i(
789
- _,
785
+ function c(v) {
786
+ const C = i(
787
+ v,
790
788
  t.rowKey
791
789
  );
792
- return typeof w == "string" || typeof w == "number" ? w : t.rows.indexOf(_);
790
+ return typeof C == "string" || typeof C == "number" ? C : t.rows.indexOf(v);
793
791
  }
794
- function y(_) {
792
+ function y(v) {
795
793
  return r.value.has(
796
- c(_)
794
+ c(v)
797
795
  );
798
796
  }
799
- const D = b(() => {
797
+ const T = b(() => {
800
798
  if (!t.sortable || !l.value)
801
799
  return t.rows;
802
- const _ = l.value, w = o.value;
800
+ const v = l.value, C = o.value;
803
801
  return [...t.rows].sort(
804
- (v, C) => {
805
- const x = i(v, _), I = i(C, _);
806
- if (x === I)
802
+ (h, k) => {
803
+ const D = i(h, v), I = i(k, v);
804
+ if (D === I)
807
805
  return 0;
808
- if (x == null)
806
+ if (D == null)
809
807
  return 1;
810
808
  if (I == null)
811
809
  return -1;
812
- if (typeof x == "number" && typeof I == "number")
813
- return w === "asc" ? x - I : I - x;
814
- const P = String(x).localeCompare(
810
+ if (typeof D == "number" && typeof I == "number")
811
+ return C === "asc" ? D - I : I - D;
812
+ const A = String(D).localeCompare(
815
813
  String(I),
816
814
  void 0,
817
815
  {
@@ -819,95 +817,104 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
819
817
  sensitivity: "base"
820
818
  }
821
819
  );
822
- return w === "asc" ? P : -P;
820
+ return C === "asc" ? A : -A;
823
821
  }
824
822
  );
825
823
  });
826
- function E(_) {
827
- !t.sortable || !_.sortable || (l.value !== _.key ? (l.value = _.key, o.value = "asc") : o.value = o.value === "asc" ? "desc" : "asc", s("sort", {
828
- key: _.key,
824
+ function S(v) {
825
+ !t.sortable || !v.sortable || (l.value !== v.key ? (l.value = v.key, o.value = "asc") : o.value = o.value === "asc" ? "desc" : "asc", s("sort", {
826
+ key: v.key,
829
827
  direction: o.value
830
828
  }));
831
829
  }
832
- function h(_) {
830
+ function _(v) {
833
831
  if (!t.selectable)
834
832
  return;
835
- const w = c(_), v = new Set(
833
+ const C = c(v), h = new Set(
836
834
  r.value
837
835
  );
838
- t.multiple ? v.has(w) ? v.delete(w) : v.add(w) : (v.clear(), v.add(w)), r.value = v, s(
836
+ t.multiple ? h.has(C) ? h.delete(C) : h.add(C) : (h.clear(), h.add(C)), r.value = h, s(
839
837
  "update:selectedRows",
840
838
  t.rows.filter(
841
- (C) => v.has(c(C))
839
+ (k) => h.has(c(k))
842
840
  )
843
841
  );
844
842
  }
845
- function g(_) {
846
- return l.value !== _.key ? "" : o.value === "asc" ? "↑" : "↓";
843
+ function g(v) {
844
+ t.selectable && _(v), s("row-click", v);
845
+ }
846
+ function B(v) {
847
+ return l.value !== v.key ? "" : o.value === "asc" ? "↑" : "↓";
847
848
  }
848
- function B(_) {
849
+ function w(v) {
849
850
  return {
850
- [`table-cell--${_.align ?? "start"}`]: !0
851
+ [`table-cell--${v.align ?? "start"}`]: !0
851
852
  };
852
853
  }
853
- function k(_) {
854
- return l.value === _.key;
854
+ function q(v) {
855
+ return l.value === v.key;
855
856
  }
856
- return (_, w) => (n(), d("div", je, [
857
+ return (v, C) => (n(), d("div", je, [
857
858
  p("table", null, [
858
859
  p("thead", null, [
859
860
  p("tr", null, [
860
- (n(!0), d(q, null, G(a.columns, (v) => (n(), d("th", {
861
- key: v.key,
861
+ (n(!0), d(M, null, G(a.columns, (h) => (n(), d("th", {
862
+ key: h.key,
862
863
  style: W({
863
- width: v.width
864
+ width: h.width
864
865
  }),
865
866
  class: f([
866
- B(v),
867
+ w(h),
867
868
  {
868
- "table-header--sortable": a.sortable && v.sortable,
869
- "table-header--sorted": k(v)
869
+ "table-header--sortable": a.sortable && h.sortable,
870
+ "table-header--sorted": q(h)
870
871
  }
871
872
  ]),
872
- tabindex: a.sortable && v.sortable ? 0 : void 0,
873
- "aria-sort": k(v) ? o.value === "asc" ? "ascending" : "descending" : void 0,
874
- onClick: (C) => E(v),
873
+ tabindex: a.sortable && h.sortable ? 0 : void 0,
874
+ "aria-sort": q(h) ? o.value === "asc" ? "ascending" : "descending" : void 0,
875
+ onClick: (k) => S(h),
875
876
  onKeydown: [
876
- j((C) => E(v), ["enter"]),
877
- j(Y((C) => E(v), ["prevent"]), ["space"])
877
+ j((k) => S(h), ["enter"]),
878
+ j(Y((k) => S(h), ["prevent"]), ["space"])
878
879
  ]
879
880
  }, [
880
- p("span", null, S(v.label), 1),
881
- a.sortable && v.sortable ? (n(), d("span", Ne, S(g(v)), 1)) : $("", !0)
881
+ p("span", null, V(h.label), 1),
882
+ a.sortable && h.sortable ? (n(), d("span", Ne, V(B(h)), 1)) : $("", !0)
882
883
  ], 46, He))), 128))
883
884
  ])
884
885
  ]),
885
886
  p("tbody", null, [
886
- (n(!0), d(q, null, G(D.value, (v) => (n(), d("tr", {
887
- key: c(v),
887
+ (n(!0), d(M, null, G(T.value, (h) => (n(), d("tr", {
888
+ key: c(h),
888
889
  class: f({
889
- "table-row--selected": y(v)
890
+ "table-row--selected": y(h),
891
+ "table-row--clickable": !0
890
892
  }),
891
- onClick: (C) => a.selectable && h(v)
893
+ onClick: (k) => g(h)
892
894
  }, [
893
- (n(!0), d(q, null, G(a.columns, (C) => (n(), d("td", {
894
- key: C.key,
895
+ (n(!0), d(M, null, G(a.columns, (k) => (n(), d("td", {
896
+ key: k.key,
895
897
  class: f(
896
- B(C)
898
+ w(k)
897
899
  )
898
900
  }, [
899
- u(_.$slots, `cell-${C.key}`, {
900
- row: v,
901
- value: i(
902
- v,
903
- C.key
904
- )
905
- }, () => [
906
- R(S(i(
907
- v,
908
- C.key
909
- )), 1)
910
- ])
901
+ u(
902
+ v.$slots,
903
+ `cell-${k.key}`,
904
+ {
905
+ row: h,
906
+ value: i(
907
+ h,
908
+ k.key
909
+ )
910
+ },
911
+ () => [
912
+ F(V(i(
913
+ h,
914
+ k.key
915
+ )), 1)
916
+ ]
917
+ )
911
918
  ], 2))), 128))
912
919
  ], 10, We))), 128))
913
920
  ])
@@ -1074,7 +1081,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1074
1081
  );
1075
1082
  }
1076
1083
  }
1077
- return M(
1084
+ return K(
1078
1085
  "loba-choice-group",
1079
1086
  {
1080
1087
  multiple: t.multiple,
@@ -1096,7 +1103,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1096
1103
  disabled: { type: Boolean, default: !1 }
1097
1104
  },
1098
1105
  setup(a) {
1099
- const e = a, t = z(
1106
+ const e = a, t = O(
1100
1107
  "loba-choice-group"
1101
1108
  );
1102
1109
  if (!t)
@@ -1165,7 +1172,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1165
1172
  return (s, l) => (n(), d("div", {
1166
1173
  class: f(t.value)
1167
1174
  }, [
1168
- e.label ? (n(), d("div", st, S(e.label), 1)) : $("", !0),
1175
+ e.label ? (n(), d("div", st, V(e.label), 1)) : $("", !0),
1169
1176
  p("div", lt, [
1170
1177
  u(s.$slots, "default")
1171
1178
  ])
@@ -1191,7 +1198,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1191
1198
  expanded: { type: Boolean, default: !1 }
1192
1199
  },
1193
1200
  setup(a) {
1194
- const e = a, t = le(), s = V(
1201
+ const e = a, t = le(), s = x(
1195
1202
  e.expanded
1196
1203
  ), l = b(
1197
1204
  () => !!t.children
@@ -1210,7 +1217,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1210
1217
  l.value && (i.preventDefault(), s.value = !s.value);
1211
1218
  }
1212
1219
  return (i, c) => (n(), d("div", ot, [
1213
- (n(), T(A(l.value ? "button" : "a"), {
1220
+ (n(), E(z(l.value ? "button" : "a"), {
1214
1221
  href: l.value || !e.href ? void 0 : e.href,
1215
1222
  type: l.value ? "button" : void 0,
1216
1223
  class: f(o.value),
@@ -1252,8 +1259,8 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1252
1259
  },
1253
1260
  emits: ["update:modelValue"],
1254
1261
  setup(a, { emit: e }) {
1255
- const t = a, s = e, l = V(t.modelValue);
1256
- K(
1262
+ const t = a, s = e, l = x(t.modelValue);
1263
+ P(
1257
1264
  () => t.modelValue,
1258
1265
  (r) => {
1259
1266
  l.value = r;
@@ -1265,7 +1272,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1265
1272
  r
1266
1273
  );
1267
1274
  }
1268
- return M(
1275
+ return K(
1269
1276
  "loba-tabs",
1270
1277
  {
1271
1278
  activeValue: () => l.value,
@@ -1284,7 +1291,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1284
1291
  disabled: { type: Boolean, default: !1 }
1285
1292
  },
1286
1293
  setup(a) {
1287
- const e = a, t = z("loba-tabs");
1294
+ const e = a, t = O("loba-tabs");
1288
1295
  if (!t)
1289
1296
  throw new Error(
1290
1297
  "Tab must be used inside Tabs."
@@ -1321,7 +1328,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1321
1328
  current: { type: Boolean, default: !1 }
1322
1329
  },
1323
1330
  setup(a) {
1324
- const e = a, t = z(
1331
+ const e = a, t = O(
1325
1332
  "loba-breadcrumbs-separator",
1326
1333
  "/"
1327
1334
  ), s = b(() => ({
@@ -1343,7 +1350,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1343
1350
  }, [
1344
1351
  u(l.$slots, "default")
1345
1352
  ], 8, mt)),
1346
- p("span", bt, S(N(t)), 1)
1353
+ p("span", bt, V(N(t)), 1)
1347
1354
  ], 2));
1348
1355
  }
1349
1356
  }), vt = {
@@ -1355,7 +1362,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1355
1362
  separator: { default: "/" }
1356
1363
  },
1357
1364
  setup(a) {
1358
- return M(
1365
+ return K(
1359
1366
  "loba-breadcrumbs-separator",
1360
1367
  a.separator
1361
1368
  ), (t, s) => (n(), d("nav", vt, [
@@ -1377,7 +1384,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1377
1384
  },
1378
1385
  emits: ["update:modelValue"],
1379
1386
  setup(a, { emit: e }) {
1380
- const t = a, s = e, l = V(null);
1387
+ const t = a, s = e, l = x(null);
1381
1388
  let o = null;
1382
1389
  const r = [
1383
1390
  "button:not([disabled])",
@@ -1393,14 +1400,14 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1393
1400
  function c() {
1394
1401
  t.closeOnBackdrop && i();
1395
1402
  }
1396
- function y(h) {
1403
+ function y(_) {
1397
1404
  if (!t.modelValue || !l.value)
1398
1405
  return;
1399
- if (h.key === "Escape" && t.closeOnEscape) {
1400
- h.preventDefault(), i();
1406
+ if (_.key === "Escape" && t.closeOnEscape) {
1407
+ _.preventDefault(), i();
1401
1408
  return;
1402
1409
  }
1403
- if (h.key !== "Tab")
1410
+ if (_.key !== "Tab")
1404
1411
  return;
1405
1412
  const g = Array.from(
1406
1413
  l.value.querySelectorAll(
@@ -1408,40 +1415,40 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1408
1415
  )
1409
1416
  );
1410
1417
  if (g.length === 0) {
1411
- h.preventDefault();
1418
+ _.preventDefault();
1412
1419
  return;
1413
1420
  }
1414
- const B = g[0], k = g[g.length - 1];
1415
- if (h.shiftKey && document.activeElement === B) {
1416
- h.preventDefault(), k.focus();
1421
+ const B = g[0], w = g[g.length - 1];
1422
+ if (_.shiftKey && document.activeElement === B) {
1423
+ _.preventDefault(), w.focus();
1417
1424
  return;
1418
1425
  }
1419
- !h.shiftKey && document.activeElement === k && (h.preventDefault(), B.focus());
1426
+ !_.shiftKey && document.activeElement === w && (_.preventDefault(), B.focus());
1420
1427
  }
1421
- async function D() {
1428
+ async function T() {
1422
1429
  o = document.activeElement instanceof HTMLElement ? document.activeElement : null, await Z(), l.value?.querySelector(
1423
1430
  r
1424
1431
  )?.focus();
1425
1432
  }
1426
- function E() {
1433
+ function S() {
1427
1434
  o?.focus(), o = null;
1428
1435
  }
1429
- return K(
1436
+ return P(
1430
1437
  () => t.modelValue,
1431
- async (h) => {
1432
- h ? await D() : E();
1438
+ async (_) => {
1439
+ _ ? await T() : S();
1433
1440
  }
1434
1441
  ), J(() => {
1435
- t.modelValue && D(), document.addEventListener(
1442
+ t.modelValue && T(), document.addEventListener(
1436
1443
  "keydown",
1437
1444
  y
1438
1445
  );
1439
- }), O(() => {
1446
+ }), R(() => {
1440
1447
  document.removeEventListener(
1441
1448
  "keydown",
1442
1449
  y
1443
- ), E();
1444
- }), (h, g) => (n(), T(U, { to: "body" }, [
1450
+ ), S();
1451
+ }), (_, g) => (n(), E(U, { to: "body" }, [
1445
1452
  a.modelValue ? (n(), d("div", _t, [
1446
1453
  p("button", {
1447
1454
  class: "dialog-backdrop",
@@ -1457,7 +1464,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1457
1464
  role: "dialog",
1458
1465
  "aria-modal": "true"
1459
1466
  }, [
1460
- u(h.$slots, "default")
1467
+ u(_.$slots, "default")
1461
1468
  ], 512)
1462
1469
  ])) : $("", !0)
1463
1470
  ]));
@@ -1472,7 +1479,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1472
1479
  },
1473
1480
  emits: ["update:modelValue"],
1474
1481
  setup(a, { emit: e }) {
1475
- const t = a, s = e, l = V(null);
1482
+ const t = a, s = e, l = x(null);
1476
1483
  let o = null;
1477
1484
  const r = [
1478
1485
  "button:not([disabled])",
@@ -1488,14 +1495,14 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1488
1495
  function c() {
1489
1496
  t.closeOnBackdrop && i();
1490
1497
  }
1491
- function y(h) {
1498
+ function y(_) {
1492
1499
  if (!t.modelValue || !l.value)
1493
1500
  return;
1494
- if (h.key === "Escape" && t.closeOnEscape) {
1495
- h.preventDefault(), i();
1501
+ if (_.key === "Escape" && t.closeOnEscape) {
1502
+ _.preventDefault(), i();
1496
1503
  return;
1497
1504
  }
1498
- if (h.key !== "Tab")
1505
+ if (_.key !== "Tab")
1499
1506
  return;
1500
1507
  const g = Array.from(
1501
1508
  l.value.querySelectorAll(
@@ -1503,40 +1510,40 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1503
1510
  )
1504
1511
  );
1505
1512
  if (g.length === 0) {
1506
- h.preventDefault();
1513
+ _.preventDefault();
1507
1514
  return;
1508
1515
  }
1509
- const B = g[0], k = g[g.length - 1];
1510
- if (h.shiftKey && document.activeElement === B) {
1511
- h.preventDefault(), k.focus();
1516
+ const B = g[0], w = g[g.length - 1];
1517
+ if (_.shiftKey && document.activeElement === B) {
1518
+ _.preventDefault(), w.focus();
1512
1519
  return;
1513
1520
  }
1514
- !h.shiftKey && document.activeElement === k && (h.preventDefault(), B.focus());
1521
+ !_.shiftKey && document.activeElement === w && (_.preventDefault(), B.focus());
1515
1522
  }
1516
- async function D() {
1523
+ async function T() {
1517
1524
  o = document.activeElement instanceof HTMLElement ? document.activeElement : null, await Z(), l.value?.querySelector(
1518
1525
  r
1519
1526
  )?.focus();
1520
1527
  }
1521
- function E() {
1528
+ function S() {
1522
1529
  o?.focus(), o = null;
1523
1530
  }
1524
- return K(
1531
+ return P(
1525
1532
  () => t.modelValue,
1526
- async (h) => {
1527
- h ? await D() : E();
1533
+ async (_) => {
1534
+ _ ? await T() : S();
1528
1535
  }
1529
1536
  ), J(() => {
1530
1537
  document.addEventListener(
1531
1538
  "keydown",
1532
1539
  y
1533
- ), t.modelValue && D();
1534
- }), O(() => {
1540
+ ), t.modelValue && T();
1541
+ }), R(() => {
1535
1542
  document.removeEventListener(
1536
1543
  "keydown",
1537
1544
  y
1538
- ), E();
1539
- }), (h, g) => (n(), T(U, { to: "body" }, [
1545
+ ), S();
1546
+ }), (_, g) => (n(), E(U, { to: "body" }, [
1540
1547
  a.modelValue ? (n(), d("div", {
1541
1548
  key: 0,
1542
1549
  class: f(["drawer", {
@@ -1561,7 +1568,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1561
1568
  "aria-modal": "true"
1562
1569
  }, [
1563
1570
  p("div", yt, [
1564
- u(h.$slots, "default")
1571
+ u(_.$slots, "default")
1565
1572
  ])
1566
1573
  ], 512)
1567
1574
  ], 2)) : $("", !0)
@@ -1577,7 +1584,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1577
1584
  placement: { default: "bottom" }
1578
1585
  },
1579
1586
  setup(a) {
1580
- const e = a, t = V(!1), s = V(null);
1587
+ const e = a, t = x(!1), s = x(null);
1581
1588
  function l() {
1582
1589
  t.value = !t.value;
1583
1590
  }
@@ -1601,7 +1608,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1601
1608
  "keydown",
1602
1609
  i
1603
1610
  );
1604
- }), O(() => {
1611
+ }), R(() => {
1605
1612
  document.removeEventListener(
1606
1613
  "click",
1607
1614
  r
@@ -1639,7 +1646,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1639
1646
  delay: { default: 300 }
1640
1647
  },
1641
1648
  setup(a) {
1642
- const e = a, t = V(!1);
1649
+ const e = a, t = x(!1);
1643
1650
  let s;
1644
1651
  function l() {
1645
1652
  clearTimeout(s), s = setTimeout(() => {
@@ -1649,7 +1656,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1649
1656
  function o() {
1650
1657
  clearTimeout(s), t.value = !1;
1651
1658
  }
1652
- return O(() => {
1659
+ return R(() => {
1653
1660
  clearTimeout(s);
1654
1661
  }), (r, i) => (n(), d("span", {
1655
1662
  class: f(["tooltip", {
@@ -1664,7 +1671,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1664
1671
  p("span", $t, [
1665
1672
  u(r.$slots, "default")
1666
1673
  ]),
1667
- p("span", kt, S(e.text), 1)
1674
+ p("span", kt, V(e.text), 1)
1668
1675
  ], 34));
1669
1676
  }
1670
1677
  }), wt = { class: "alert-content" }, Ct = {
@@ -1749,7 +1756,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1749
1756
  p("span", null, [
1750
1757
  u(l.$slots, "default")
1751
1758
  ]),
1752
- p("span", null, S(Math.round(t.value)) + "% ", 1)
1759
+ p("span", null, V(Math.round(t.value)) + "% ", 1)
1753
1760
  ])) : u(l.$slots, "label", {}, void 0, void 0, 1)
1754
1761
  ], 10, Bt));
1755
1762
  }
@@ -1788,7 +1795,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1788
1795
  },
1789
1796
  emits: ["update:modelValue", "close"],
1790
1797
  setup(a, { emit: e }) {
1791
- const t = a, s = e, l = V(
1798
+ const t = a, s = e, l = x(
1792
1799
  t.modelValue
1793
1800
  );
1794
1801
  let o;
@@ -1806,7 +1813,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1806
1813
  i();
1807
1814
  }, t.duration));
1808
1815
  }
1809
- return K(
1816
+ return P(
1810
1817
  () => t.modelValue,
1811
1818
  (y) => {
1812
1819
  l.value = y, y ? c() : r();
@@ -1814,9 +1821,9 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1814
1821
  {
1815
1822
  immediate: !0
1816
1823
  }
1817
- ), O(() => {
1824
+ ), R(() => {
1818
1825
  r();
1819
- }), (y, D) => (n(), T(U, { to: "body" }, [
1826
+ }), (y, T) => (n(), E(U, { to: "body" }, [
1820
1827
  l.value ? (n(), d("div", {
1821
1828
  key: 0,
1822
1829
  class: f(["toast", {
@@ -1827,7 +1834,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1827
1834
  "aria-live": "polite"
1828
1835
  }, [
1829
1836
  p("div", St, [
1830
- a.title ? (n(), d("div", Et, S(a.title), 1)) : $("", !0),
1837
+ a.title ? (n(), d("div", Et, V(a.title), 1)) : $("", !0),
1831
1838
  p("div", Tt, [
1832
1839
  u(y.$slots, "default")
1833
1840
  ])
@@ -1851,7 +1858,7 @@ export {
1851
1858
  fa as Breadcrumb,
1852
1859
  ma as Breadcrumbs,
1853
1860
  It as Button,
1854
- Rt as ButtonGroup,
1861
+ Ft as ButtonGroup,
1855
1862
  Lt as Card,
1856
1863
  sa as Checkbox,
1857
1864
  ia as Choice,
@@ -1875,7 +1882,7 @@ export {
1875
1882
  ga as Progress,
1876
1883
  la as Radio,
1877
1884
  At as Section,
1878
- Ft as SectionHeader,
1885
+ Rt as SectionHeader,
1879
1886
  Wt as Select,
1880
1887
  ra as Sidebar,
1881
1888
  da as SidebarGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraxe/vue",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,12 +1,11 @@
1
+ ```vue
1
2
  <script setup lang="ts">
2
3
  import {
3
4
  computed,
4
5
  ref,
5
6
  } from "vue";
6
7
 
7
- export interface TableColumn<
8
- T = unknown,
9
- > {
8
+ export interface TableColumn<T = unknown> {
10
9
  key: string;
11
10
  label: string;
12
11
  sortable?: boolean;
@@ -14,9 +13,7 @@ export interface TableColumn<
14
13
  align?: "start" | "center" | "end";
15
14
  }
16
15
 
17
- export interface TableProps<
18
- T = unknown,
19
- > {
16
+ export interface TableProps<T = unknown> {
20
17
  columns: TableColumn<T>[];
21
18
  rows: T[];
22
19
  rowKey?: string;
@@ -41,18 +38,16 @@ const emit = defineEmits<{
41
38
  "update:selectedRows": [
42
39
  rows: unknown[],
43
40
  ];
44
-
45
41
  sort: [
46
42
  payload: {
47
43
  key: string;
48
44
  direction: "asc" | "desc";
49
45
  },
50
46
  ];
47
+ "row-click": [row: unknown];
51
48
  }>();
52
49
 
53
- const sortKey = ref<string | null>(
54
- null,
55
- );
50
+ const sortKey = ref<string | null>(null);
56
51
 
57
52
  const sortDirection = ref<
58
53
  "asc" | "desc"
@@ -101,7 +96,7 @@ function getRowKey(
101
96
 
102
97
  function isSelected(
103
98
  row: unknown,
104
- ) {
99
+ ): boolean {
105
100
  return selectedKeys.value.has(
106
101
  getRowKey(row),
107
102
  );
@@ -123,12 +118,11 @@ const sortedRows = computed(() => {
123
118
  (a, b) => {
124
119
  const aValue =
125
120
  getRowValue(a, key);
121
+
126
122
  const bValue =
127
123
  getRowValue(b, key);
128
124
 
129
- if (
130
- aValue === bValue
131
- ) {
125
+ if (aValue === bValue) {
132
126
  return 0;
133
127
  }
134
128
 
@@ -174,7 +168,7 @@ const sortedRows = computed(() => {
174
168
 
175
169
  function toggleSort(
176
170
  column: TableColumn,
177
- ) {
171
+ ): void {
178
172
  if (
179
173
  !props.sortable ||
180
174
  !column.sortable
@@ -182,7 +176,9 @@ function toggleSort(
182
176
  return;
183
177
  }
184
178
 
185
- if (sortKey.value !== column.key) {
179
+ if (
180
+ sortKey.value !== column.key
181
+ ) {
186
182
  sortKey.value = column.key;
187
183
  sortDirection.value = "asc";
188
184
  } else {
@@ -201,7 +197,7 @@ function toggleSort(
201
197
 
202
198
  function toggleRowSelection(
203
199
  row: unknown,
204
- ) {
200
+ ): void {
205
201
  if (!props.selectable) {
206
202
  return;
207
203
  }
@@ -233,9 +229,19 @@ function toggleRowSelection(
233
229
  );
234
230
  }
235
231
 
232
+ function handleRowClick(
233
+ row: unknown,
234
+ ): void {
235
+ if (props.selectable) {
236
+ toggleRowSelection(row);
237
+ }
238
+
239
+ emit("row-click", row);
240
+ }
241
+
236
242
  function sortIndicator(
237
243
  column: TableColumn,
238
- ) {
244
+ ): string {
239
245
  if (
240
246
  sortKey.value !== column.key
241
247
  ) {
@@ -252,14 +258,15 @@ function cellClass(
252
258
  column: TableColumn,
253
259
  ) {
254
260
  return {
255
- [`table-cell--${column.align ?? "start"}`]:
256
- true,
261
+ [`table-cell--${
262
+ column.align ?? "start"
263
+ }`]: true,
257
264
  };
258
265
  }
259
266
 
260
267
  function isSorted(
261
268
  column: TableColumn,
262
- ) {
269
+ ): boolean {
263
270
  return (
264
271
  sortKey.value === column.key
265
272
  );
@@ -283,7 +290,6 @@ function isSorted(
283
290
  'table-header--sortable':
284
291
  sortable &&
285
292
  column.sortable,
286
-
287
293
  'table-header--sorted':
288
294
  isSorted(column),
289
295
  },
@@ -338,10 +344,10 @@ function isSorted(
338
344
  :class="{
339
345
  'table-row--selected':
340
346
  isSelected(row),
347
+ 'table-row--clickable': true,
341
348
  }"
342
349
  @click="
343
- selectable &&
344
- toggleRowSelection(row)
350
+ handleRowClick(row)
345
351
  "
346
352
  >
347
353
  <td
@@ -352,7 +358,9 @@ function isSorted(
352
358
  "
353
359
  >
354
360
  <slot
355
- :name="`cell-${column.key}`"
361
+ :name="
362
+ `cell-${column.key}`
363
+ "
356
364
  :row="row"
357
365
  :value="
358
366
  getRowValue(
@@ -379,4 +387,12 @@ function isSorted(
379
387
  aria-hidden="true"
380
388
  />
381
389
  </div>
382
- </template>
390
+ </template>
391
+
392
+ <Table
393
+ :columns="columns"
394
+ :rows="currentPageProspects"
395
+ row-key="id"
396
+ sortable
397
+ @row-click="openProspect"
398
+ />