@paraxe/vue 1.0.3 → 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;
@@ -1,5 +1,5 @@
1
1
  interface Props {
2
- value?: string;
2
+ modelValue?: string;
3
3
  disabled?: boolean;
4
4
  error?: boolean;
5
5
  success?: boolean;
@@ -9,14 +9,14 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_1) => any;
10
10
  };
11
11
  declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
- change: (value: string) => any;
12
+ "update:modelValue": (value: string) => any;
13
13
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
14
- onChange?: ((value: string) => any) | undefined;
14
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
15
15
  }>, {
16
16
  disabled: boolean;
17
+ modelValue: string;
17
18
  error: boolean;
18
19
  success: boolean;
19
- value: string;
20
20
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
21
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
22
  declare const _default: typeof __VLS_export;
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)
@@ -374,26 +374,27 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
374
374
  }), we = ["value", "disabled"], Wt = /* @__PURE__ */ m({
375
375
  __name: "Select",
376
376
  props: {
377
- value: { default: "" },
377
+ modelValue: { default: "" },
378
378
  disabled: { type: Boolean, default: !1 },
379
379
  error: { type: Boolean, default: !1 },
380
380
  success: { type: Boolean, default: !1 }
381
381
  },
382
- emits: ["change"],
382
+ emits: ["update:modelValue"],
383
383
  setup(a, { emit: e }) {
384
- const t = a, s = e, l = b(() => ({
384
+ const t = a, s = e;
385
+ function l(r) {
386
+ const i = r.target;
387
+ s("update:modelValue", i.value);
388
+ }
389
+ const o = b(() => ({
385
390
  "input-error": t.error,
386
391
  "input-success": t.success
387
392
  }));
388
- function o(r) {
389
- const i = r.target;
390
- s("change", i.value);
391
- }
392
393
  return (r, i) => (n(), d("select", {
393
- class: f(["select", l.value]),
394
- value: t.value,
394
+ class: f(["select", o.value]),
395
+ value: t.modelValue,
395
396
  disabled: t.disabled,
396
- onChange: o
397
+ onChange: l
397
398
  }, [
398
399
  u(r.$slots, "default")
399
400
  ], 42, we));
@@ -406,7 +407,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
406
407
  defaultOpen: { default: () => [] }
407
408
  },
408
409
  setup(a) {
409
- const e = a, t = V([...e.defaultOpen]);
410
+ const e = a, t = x([...e.defaultOpen]);
410
411
  function s(o) {
411
412
  return t.value.includes(o);
412
413
  }
@@ -423,7 +424,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
423
424
  }
424
425
  t.value = [o];
425
426
  }
426
- return M("loba-accordion", {
427
+ return K("loba-accordion", {
427
428
  openItems: t,
428
429
  isOpen: s,
429
430
  toggleItem: l
@@ -438,7 +439,7 @@ const Gt = /* @__PURE__ */ H(fe, [["render", be]]), ve = ["for"], he = {
438
439
  disabled: { type: Boolean, default: !1 }
439
440
  },
440
441
  setup(a) {
441
- const e = a, t = z("loba-accordion");
442
+ const e = a, t = O("loba-accordion");
442
443
  if (!t)
443
444
  throw new Error(
444
445
  "AccordionItem must be used inside an Accordion."
@@ -512,7 +513,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
512
513
  const e = a, t = b(() => [
513
514
  "empty-state"
514
515
  ]);
515
- return (s, l) => (n(), T(A(e.as), {
516
+ return (s, l) => (n(), E(z(e.as), {
516
517
  class: f(t.value)
517
518
  }, {
518
519
  default: L(() => [
@@ -542,8 +543,8 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
542
543
  }),
543
544
  emits: /* @__PURE__ */ Q(["update:modelValue"], ["update:modelValue"]),
544
545
  setup(a, { emit: e }) {
545
- const t = a, s = V(/* @__PURE__ */ new Set()), l = se(a, "modelValue");
546
- K(
546
+ const t = a, s = x(/* @__PURE__ */ new Set()), l = se(a, "modelValue");
547
+ P(
547
548
  l,
548
549
  (i) => {
549
550
  if (i == null) {
@@ -569,7 +570,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
569
570
  const y = [...c];
570
571
  l.value = t.multiple ? y : y[0] ?? null;
571
572
  }
572
- return M("loba-list", {
573
+ return K("loba-list", {
573
574
  selectable: t.selectable,
574
575
  multiple: t.multiple,
575
576
  isSelected: o,
@@ -585,7 +586,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
585
586
  disabled: { type: Boolean, default: !1 }
586
587
  },
587
588
  setup(a) {
588
- const e = a, t = z("loba-list");
589
+ const e = a, t = O("loba-list");
589
590
  if (!t)
590
591
  throw new Error(
591
592
  "ListItem must be used inside a List."
@@ -624,7 +625,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
624
625
  }), Ae = { class: "pagination-controls" }, Me = ["disabled"], ze = ["disabled"], Ke = { class: "pagination-pages" }, Oe = {
625
626
  key: 0,
626
627
  class: "pagination-ellipsis"
627
- }, 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({
628
629
  __name: "Pagination",
629
630
  props: {
630
631
  currentPage: {},
@@ -648,27 +649,27 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
648
649
  l.value
649
650
  )
650
651
  ), r = b(() => {
651
- const g = l.value, B = o.value, k = Math.max(
652
+ const g = l.value, B = o.value, w = Math.max(
652
653
  0,
653
654
  t.siblingCount
654
655
  );
655
656
  if (g <= 7)
656
657
  return Array.from(
657
658
  { length: g },
658
- (F, ee) => ee + 1
659
+ (A, ee) => ee + 1
659
660
  );
660
- const _ = Math.max(
661
- B - k,
661
+ const q = Math.max(
662
+ B - w,
662
663
  1
663
- ), w = Math.min(
664
- B + k,
664
+ ), v = Math.min(
665
+ B + w,
665
666
  g
666
- ), v = _ > 2, C = w < g - 1, x = [1];
667
- v && x.push("...");
668
- const I = v ? _ : 2, P = C ? w : g - 1;
669
- for (let F = I; F <= P; F++)
670
- x.push(F);
671
- 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;
672
673
  }), i = b(() => ({
673
674
  pagination: !0,
674
675
  "pagination-compact": t.compact
@@ -686,13 +687,13 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
686
687
  function y() {
687
688
  c(o.value - 1);
688
689
  }
689
- function D() {
690
+ function T() {
690
691
  c(o.value + 1);
691
692
  }
692
- function E() {
693
+ function S() {
693
694
  c(1);
694
695
  }
695
- function h() {
696
+ function _() {
696
697
  c(l.value);
697
698
  }
698
699
  return (g, B) => (n(), d("nav", {
@@ -707,7 +708,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
707
708
  type: "button",
708
709
  disabled: o.value === 1,
709
710
  "aria-label": "First page",
710
- onClick: E
711
+ onClick: S
711
712
  }, " « ", 10, Me),
712
713
  p("button", {
713
714
  class: f(["pagination-item", {
@@ -720,21 +721,21 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
720
721
  }, " ‹ ", 10, ze)
721
722
  ]),
722
723
  p("div", Ke, [
723
- (n(!0), d(q, null, G(r.value, (k, _) => (n(), d(q, {
724
- key: `${k}-${_}`
724
+ (n(!0), d(M, null, G(r.value, (w, q) => (n(), d(M, {
725
+ key: `${w}-${q}`
725
726
  }, [
726
- k === "..." ? (n(), d("span", Oe, " … ")) : (n(), d("button", {
727
+ w === "..." ? (n(), d("span", Oe, " … ")) : (n(), d("button", {
727
728
  key: 1,
728
729
  class: f(["pagination-item", {
729
- "pagination-item--current": k === o.value
730
+ "pagination-item--current": w === o.value
730
731
  }]),
731
732
  type: "button",
732
- "aria-current": k === o.value ? "page" : void 0,
733
- onClick: (w) => c(k)
734
- }, S(k), 11, Pe))
733
+ "aria-current": w === o.value ? "page" : void 0,
734
+ onClick: (v) => c(w)
735
+ }, V(w), 11, Pe))
735
736
  ], 64))), 128))
736
737
  ]),
737
- p("div", Fe, [
738
+ p("div", Re, [
738
739
  p("button", {
739
740
  class: f(["pagination-item", {
740
741
  "pagination-item--disabled": o.value === l.value
@@ -742,8 +743,8 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
742
743
  type: "button",
743
744
  disabled: o.value === l.value,
744
745
  "aria-label": "Next page",
745
- onClick: D
746
- }, " › ", 10, Re),
746
+ onClick: T
747
+ }, " › ", 10, Fe),
747
748
  p("button", {
748
749
  class: f(["pagination-item", {
749
750
  "pagination-item--disabled": o.value === l.value
@@ -751,7 +752,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
751
752
  type: "button",
752
753
  disabled: o.value === l.value,
753
754
  "aria-label": "Last page",
754
- onClick: h
755
+ onClick: _
755
756
  }, " » ", 10, Ge)
756
757
  ])
757
758
  ], 2));
@@ -774,43 +775,41 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
774
775
  multiple: { type: Boolean, default: !1 },
775
776
  loading: { type: Boolean, default: !1 }
776
777
  },
777
- emits: ["update:selectedRows", "sort"],
778
+ emits: ["update:selectedRows", "sort", "row-click"],
778
779
  setup(a, { emit: e }) {
779
- const t = a, s = e, l = V(
780
- null
781
- ), o = V("asc"), r = V(/* @__PURE__ */ new Set());
782
- function i(_, w) {
783
- if (!(typeof _ != "object" || _ === null))
784
- 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];
785
784
  }
786
- function c(_) {
787
- const w = i(
788
- _,
785
+ function c(v) {
786
+ const C = i(
787
+ v,
789
788
  t.rowKey
790
789
  );
791
- return typeof w == "string" || typeof w == "number" ? w : t.rows.indexOf(_);
790
+ return typeof C == "string" || typeof C == "number" ? C : t.rows.indexOf(v);
792
791
  }
793
- function y(_) {
792
+ function y(v) {
794
793
  return r.value.has(
795
- c(_)
794
+ c(v)
796
795
  );
797
796
  }
798
- const D = b(() => {
797
+ const T = b(() => {
799
798
  if (!t.sortable || !l.value)
800
799
  return t.rows;
801
- const _ = l.value, w = o.value;
800
+ const v = l.value, C = o.value;
802
801
  return [...t.rows].sort(
803
- (v, C) => {
804
- const x = i(v, _), I = i(C, _);
805
- if (x === I)
802
+ (h, k) => {
803
+ const D = i(h, v), I = i(k, v);
804
+ if (D === I)
806
805
  return 0;
807
- if (x == null)
806
+ if (D == null)
808
807
  return 1;
809
808
  if (I == null)
810
809
  return -1;
811
- if (typeof x == "number" && typeof I == "number")
812
- return w === "asc" ? x - I : I - x;
813
- 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(
814
813
  String(I),
815
814
  void 0,
816
815
  {
@@ -818,95 +817,104 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
818
817
  sensitivity: "base"
819
818
  }
820
819
  );
821
- return w === "asc" ? P : -P;
820
+ return C === "asc" ? A : -A;
822
821
  }
823
822
  );
824
823
  });
825
- function E(_) {
826
- !t.sortable || !_.sortable || (l.value !== _.key ? (l.value = _.key, o.value = "asc") : o.value = o.value === "asc" ? "desc" : "asc", s("sort", {
827
- 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,
828
827
  direction: o.value
829
828
  }));
830
829
  }
831
- function h(_) {
830
+ function _(v) {
832
831
  if (!t.selectable)
833
832
  return;
834
- const w = c(_), v = new Set(
833
+ const C = c(v), h = new Set(
835
834
  r.value
836
835
  );
837
- 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(
838
837
  "update:selectedRows",
839
838
  t.rows.filter(
840
- (C) => v.has(c(C))
839
+ (k) => h.has(c(k))
841
840
  )
842
841
  );
843
842
  }
844
- function g(_) {
845
- 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" ? "↑" : "↓";
846
848
  }
847
- function B(_) {
849
+ function w(v) {
848
850
  return {
849
- [`table-cell--${_.align ?? "start"}`]: !0
851
+ [`table-cell--${v.align ?? "start"}`]: !0
850
852
  };
851
853
  }
852
- function k(_) {
853
- return l.value === _.key;
854
+ function q(v) {
855
+ return l.value === v.key;
854
856
  }
855
- return (_, w) => (n(), d("div", je, [
857
+ return (v, C) => (n(), d("div", je, [
856
858
  p("table", null, [
857
859
  p("thead", null, [
858
860
  p("tr", null, [
859
- (n(!0), d(q, null, G(a.columns, (v) => (n(), d("th", {
860
- key: v.key,
861
+ (n(!0), d(M, null, G(a.columns, (h) => (n(), d("th", {
862
+ key: h.key,
861
863
  style: W({
862
- width: v.width
864
+ width: h.width
863
865
  }),
864
866
  class: f([
865
- B(v),
867
+ w(h),
866
868
  {
867
- "table-header--sortable": a.sortable && v.sortable,
868
- "table-header--sorted": k(v)
869
+ "table-header--sortable": a.sortable && h.sortable,
870
+ "table-header--sorted": q(h)
869
871
  }
870
872
  ]),
871
- tabindex: a.sortable && v.sortable ? 0 : void 0,
872
- "aria-sort": k(v) ? o.value === "asc" ? "ascending" : "descending" : void 0,
873
- 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),
874
876
  onKeydown: [
875
- j((C) => E(v), ["enter"]),
876
- j(Y((C) => E(v), ["prevent"]), ["space"])
877
+ j((k) => S(h), ["enter"]),
878
+ j(Y((k) => S(h), ["prevent"]), ["space"])
877
879
  ]
878
880
  }, [
879
- p("span", null, S(v.label), 1),
880
- 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)
881
883
  ], 46, He))), 128))
882
884
  ])
883
885
  ]),
884
886
  p("tbody", null, [
885
- (n(!0), d(q, null, G(D.value, (v) => (n(), d("tr", {
886
- key: c(v),
887
+ (n(!0), d(M, null, G(T.value, (h) => (n(), d("tr", {
888
+ key: c(h),
887
889
  class: f({
888
- "table-row--selected": y(v)
890
+ "table-row--selected": y(h),
891
+ "table-row--clickable": !0
889
892
  }),
890
- onClick: (C) => a.selectable && h(v)
893
+ onClick: (k) => g(h)
891
894
  }, [
892
- (n(!0), d(q, null, G(a.columns, (C) => (n(), d("td", {
893
- key: C.key,
895
+ (n(!0), d(M, null, G(a.columns, (k) => (n(), d("td", {
896
+ key: k.key,
894
897
  class: f(
895
- B(C)
898
+ w(k)
896
899
  )
897
900
  }, [
898
- u(_.$slots, `cell-${C.key}`, {
899
- row: v,
900
- value: i(
901
- v,
902
- C.key
903
- )
904
- }, () => [
905
- R(S(i(
906
- v,
907
- C.key
908
- )), 1)
909
- ])
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
+ )
910
918
  ], 2))), 128))
911
919
  ], 10, We))), 128))
912
920
  ])
@@ -1073,7 +1081,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1073
1081
  );
1074
1082
  }
1075
1083
  }
1076
- return M(
1084
+ return K(
1077
1085
  "loba-choice-group",
1078
1086
  {
1079
1087
  multiple: t.multiple,
@@ -1095,7 +1103,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1095
1103
  disabled: { type: Boolean, default: !1 }
1096
1104
  },
1097
1105
  setup(a) {
1098
- const e = a, t = z(
1106
+ const e = a, t = O(
1099
1107
  "loba-choice-group"
1100
1108
  );
1101
1109
  if (!t)
@@ -1164,7 +1172,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1164
1172
  return (s, l) => (n(), d("div", {
1165
1173
  class: f(t.value)
1166
1174
  }, [
1167
- e.label ? (n(), d("div", st, S(e.label), 1)) : $("", !0),
1175
+ e.label ? (n(), d("div", st, V(e.label), 1)) : $("", !0),
1168
1176
  p("div", lt, [
1169
1177
  u(s.$slots, "default")
1170
1178
  ])
@@ -1190,7 +1198,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1190
1198
  expanded: { type: Boolean, default: !1 }
1191
1199
  },
1192
1200
  setup(a) {
1193
- const e = a, t = le(), s = V(
1201
+ const e = a, t = le(), s = x(
1194
1202
  e.expanded
1195
1203
  ), l = b(
1196
1204
  () => !!t.children
@@ -1209,7 +1217,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1209
1217
  l.value && (i.preventDefault(), s.value = !s.value);
1210
1218
  }
1211
1219
  return (i, c) => (n(), d("div", ot, [
1212
- (n(), T(A(l.value ? "button" : "a"), {
1220
+ (n(), E(z(l.value ? "button" : "a"), {
1213
1221
  href: l.value || !e.href ? void 0 : e.href,
1214
1222
  type: l.value ? "button" : void 0,
1215
1223
  class: f(o.value),
@@ -1251,8 +1259,8 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1251
1259
  },
1252
1260
  emits: ["update:modelValue"],
1253
1261
  setup(a, { emit: e }) {
1254
- const t = a, s = e, l = V(t.modelValue);
1255
- K(
1262
+ const t = a, s = e, l = x(t.modelValue);
1263
+ P(
1256
1264
  () => t.modelValue,
1257
1265
  (r) => {
1258
1266
  l.value = r;
@@ -1264,7 +1272,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1264
1272
  r
1265
1273
  );
1266
1274
  }
1267
- return M(
1275
+ return K(
1268
1276
  "loba-tabs",
1269
1277
  {
1270
1278
  activeValue: () => l.value,
@@ -1283,7 +1291,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1283
1291
  disabled: { type: Boolean, default: !1 }
1284
1292
  },
1285
1293
  setup(a) {
1286
- const e = a, t = z("loba-tabs");
1294
+ const e = a, t = O("loba-tabs");
1287
1295
  if (!t)
1288
1296
  throw new Error(
1289
1297
  "Tab must be used inside Tabs."
@@ -1320,7 +1328,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1320
1328
  current: { type: Boolean, default: !1 }
1321
1329
  },
1322
1330
  setup(a) {
1323
- const e = a, t = z(
1331
+ const e = a, t = O(
1324
1332
  "loba-breadcrumbs-separator",
1325
1333
  "/"
1326
1334
  ), s = b(() => ({
@@ -1342,7 +1350,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1342
1350
  }, [
1343
1351
  u(l.$slots, "default")
1344
1352
  ], 8, mt)),
1345
- p("span", bt, S(N(t)), 1)
1353
+ p("span", bt, V(N(t)), 1)
1346
1354
  ], 2));
1347
1355
  }
1348
1356
  }), vt = {
@@ -1354,7 +1362,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1354
1362
  separator: { default: "/" }
1355
1363
  },
1356
1364
  setup(a) {
1357
- return M(
1365
+ return K(
1358
1366
  "loba-breadcrumbs-separator",
1359
1367
  a.separator
1360
1368
  ), (t, s) => (n(), d("nav", vt, [
@@ -1376,7 +1384,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1376
1384
  },
1377
1385
  emits: ["update:modelValue"],
1378
1386
  setup(a, { emit: e }) {
1379
- const t = a, s = e, l = V(null);
1387
+ const t = a, s = e, l = x(null);
1380
1388
  let o = null;
1381
1389
  const r = [
1382
1390
  "button:not([disabled])",
@@ -1392,14 +1400,14 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1392
1400
  function c() {
1393
1401
  t.closeOnBackdrop && i();
1394
1402
  }
1395
- function y(h) {
1403
+ function y(_) {
1396
1404
  if (!t.modelValue || !l.value)
1397
1405
  return;
1398
- if (h.key === "Escape" && t.closeOnEscape) {
1399
- h.preventDefault(), i();
1406
+ if (_.key === "Escape" && t.closeOnEscape) {
1407
+ _.preventDefault(), i();
1400
1408
  return;
1401
1409
  }
1402
- if (h.key !== "Tab")
1410
+ if (_.key !== "Tab")
1403
1411
  return;
1404
1412
  const g = Array.from(
1405
1413
  l.value.querySelectorAll(
@@ -1407,40 +1415,40 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1407
1415
  )
1408
1416
  );
1409
1417
  if (g.length === 0) {
1410
- h.preventDefault();
1418
+ _.preventDefault();
1411
1419
  return;
1412
1420
  }
1413
- const B = g[0], k = g[g.length - 1];
1414
- if (h.shiftKey && document.activeElement === B) {
1415
- h.preventDefault(), k.focus();
1421
+ const B = g[0], w = g[g.length - 1];
1422
+ if (_.shiftKey && document.activeElement === B) {
1423
+ _.preventDefault(), w.focus();
1416
1424
  return;
1417
1425
  }
1418
- !h.shiftKey && document.activeElement === k && (h.preventDefault(), B.focus());
1426
+ !_.shiftKey && document.activeElement === w && (_.preventDefault(), B.focus());
1419
1427
  }
1420
- async function D() {
1428
+ async function T() {
1421
1429
  o = document.activeElement instanceof HTMLElement ? document.activeElement : null, await Z(), l.value?.querySelector(
1422
1430
  r
1423
1431
  )?.focus();
1424
1432
  }
1425
- function E() {
1433
+ function S() {
1426
1434
  o?.focus(), o = null;
1427
1435
  }
1428
- return K(
1436
+ return P(
1429
1437
  () => t.modelValue,
1430
- async (h) => {
1431
- h ? await D() : E();
1438
+ async (_) => {
1439
+ _ ? await T() : S();
1432
1440
  }
1433
1441
  ), J(() => {
1434
- t.modelValue && D(), document.addEventListener(
1442
+ t.modelValue && T(), document.addEventListener(
1435
1443
  "keydown",
1436
1444
  y
1437
1445
  );
1438
- }), O(() => {
1446
+ }), R(() => {
1439
1447
  document.removeEventListener(
1440
1448
  "keydown",
1441
1449
  y
1442
- ), E();
1443
- }), (h, g) => (n(), T(U, { to: "body" }, [
1450
+ ), S();
1451
+ }), (_, g) => (n(), E(U, { to: "body" }, [
1444
1452
  a.modelValue ? (n(), d("div", _t, [
1445
1453
  p("button", {
1446
1454
  class: "dialog-backdrop",
@@ -1456,7 +1464,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1456
1464
  role: "dialog",
1457
1465
  "aria-modal": "true"
1458
1466
  }, [
1459
- u(h.$slots, "default")
1467
+ u(_.$slots, "default")
1460
1468
  ], 512)
1461
1469
  ])) : $("", !0)
1462
1470
  ]));
@@ -1471,7 +1479,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1471
1479
  },
1472
1480
  emits: ["update:modelValue"],
1473
1481
  setup(a, { emit: e }) {
1474
- const t = a, s = e, l = V(null);
1482
+ const t = a, s = e, l = x(null);
1475
1483
  let o = null;
1476
1484
  const r = [
1477
1485
  "button:not([disabled])",
@@ -1487,14 +1495,14 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1487
1495
  function c() {
1488
1496
  t.closeOnBackdrop && i();
1489
1497
  }
1490
- function y(h) {
1498
+ function y(_) {
1491
1499
  if (!t.modelValue || !l.value)
1492
1500
  return;
1493
- if (h.key === "Escape" && t.closeOnEscape) {
1494
- h.preventDefault(), i();
1501
+ if (_.key === "Escape" && t.closeOnEscape) {
1502
+ _.preventDefault(), i();
1495
1503
  return;
1496
1504
  }
1497
- if (h.key !== "Tab")
1505
+ if (_.key !== "Tab")
1498
1506
  return;
1499
1507
  const g = Array.from(
1500
1508
  l.value.querySelectorAll(
@@ -1502,40 +1510,40 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1502
1510
  )
1503
1511
  );
1504
1512
  if (g.length === 0) {
1505
- h.preventDefault();
1513
+ _.preventDefault();
1506
1514
  return;
1507
1515
  }
1508
- const B = g[0], k = g[g.length - 1];
1509
- if (h.shiftKey && document.activeElement === B) {
1510
- h.preventDefault(), k.focus();
1516
+ const B = g[0], w = g[g.length - 1];
1517
+ if (_.shiftKey && document.activeElement === B) {
1518
+ _.preventDefault(), w.focus();
1511
1519
  return;
1512
1520
  }
1513
- !h.shiftKey && document.activeElement === k && (h.preventDefault(), B.focus());
1521
+ !_.shiftKey && document.activeElement === w && (_.preventDefault(), B.focus());
1514
1522
  }
1515
- async function D() {
1523
+ async function T() {
1516
1524
  o = document.activeElement instanceof HTMLElement ? document.activeElement : null, await Z(), l.value?.querySelector(
1517
1525
  r
1518
1526
  )?.focus();
1519
1527
  }
1520
- function E() {
1528
+ function S() {
1521
1529
  o?.focus(), o = null;
1522
1530
  }
1523
- return K(
1531
+ return P(
1524
1532
  () => t.modelValue,
1525
- async (h) => {
1526
- h ? await D() : E();
1533
+ async (_) => {
1534
+ _ ? await T() : S();
1527
1535
  }
1528
1536
  ), J(() => {
1529
1537
  document.addEventListener(
1530
1538
  "keydown",
1531
1539
  y
1532
- ), t.modelValue && D();
1533
- }), O(() => {
1540
+ ), t.modelValue && T();
1541
+ }), R(() => {
1534
1542
  document.removeEventListener(
1535
1543
  "keydown",
1536
1544
  y
1537
- ), E();
1538
- }), (h, g) => (n(), T(U, { to: "body" }, [
1545
+ ), S();
1546
+ }), (_, g) => (n(), E(U, { to: "body" }, [
1539
1547
  a.modelValue ? (n(), d("div", {
1540
1548
  key: 0,
1541
1549
  class: f(["drawer", {
@@ -1560,7 +1568,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1560
1568
  "aria-modal": "true"
1561
1569
  }, [
1562
1570
  p("div", yt, [
1563
- u(h.$slots, "default")
1571
+ u(_.$slots, "default")
1564
1572
  ])
1565
1573
  ], 512)
1566
1574
  ], 2)) : $("", !0)
@@ -1576,7 +1584,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1576
1584
  placement: { default: "bottom" }
1577
1585
  },
1578
1586
  setup(a) {
1579
- const e = a, t = V(!1), s = V(null);
1587
+ const e = a, t = x(!1), s = x(null);
1580
1588
  function l() {
1581
1589
  t.value = !t.value;
1582
1590
  }
@@ -1600,7 +1608,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1600
1608
  "keydown",
1601
1609
  i
1602
1610
  );
1603
- }), O(() => {
1611
+ }), R(() => {
1604
1612
  document.removeEventListener(
1605
1613
  "click",
1606
1614
  r
@@ -1638,7 +1646,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1638
1646
  delay: { default: 300 }
1639
1647
  },
1640
1648
  setup(a) {
1641
- const e = a, t = V(!1);
1649
+ const e = a, t = x(!1);
1642
1650
  let s;
1643
1651
  function l() {
1644
1652
  clearTimeout(s), s = setTimeout(() => {
@@ -1648,7 +1656,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1648
1656
  function o() {
1649
1657
  clearTimeout(s), t.value = !1;
1650
1658
  }
1651
- return O(() => {
1659
+ return R(() => {
1652
1660
  clearTimeout(s);
1653
1661
  }), (r, i) => (n(), d("span", {
1654
1662
  class: f(["tooltip", {
@@ -1663,7 +1671,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1663
1671
  p("span", $t, [
1664
1672
  u(r.$slots, "default")
1665
1673
  ]),
1666
- p("span", kt, S(e.text), 1)
1674
+ p("span", kt, V(e.text), 1)
1667
1675
  ], 34));
1668
1676
  }
1669
1677
  }), wt = { class: "alert-content" }, Ct = {
@@ -1748,7 +1756,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1748
1756
  p("span", null, [
1749
1757
  u(l.$slots, "default")
1750
1758
  ]),
1751
- p("span", null, S(Math.round(t.value)) + "% ", 1)
1759
+ p("span", null, V(Math.round(t.value)) + "% ", 1)
1752
1760
  ])) : u(l.$slots, "label", {}, void 0, void 0, 1)
1753
1761
  ], 10, Bt));
1754
1762
  }
@@ -1787,7 +1795,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1787
1795
  },
1788
1796
  emits: ["update:modelValue", "close"],
1789
1797
  setup(a, { emit: e }) {
1790
- const t = a, s = e, l = V(
1798
+ const t = a, s = e, l = x(
1791
1799
  t.modelValue
1792
1800
  );
1793
1801
  let o;
@@ -1805,7 +1813,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1805
1813
  i();
1806
1814
  }, t.duration));
1807
1815
  }
1808
- return K(
1816
+ return P(
1809
1817
  () => t.modelValue,
1810
1818
  (y) => {
1811
1819
  l.value = y, y ? c() : r();
@@ -1813,9 +1821,9 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1813
1821
  {
1814
1822
  immediate: !0
1815
1823
  }
1816
- ), O(() => {
1824
+ ), R(() => {
1817
1825
  r();
1818
- }), (y, D) => (n(), T(U, { to: "body" }, [
1826
+ }), (y, T) => (n(), E(U, { to: "body" }, [
1819
1827
  l.value ? (n(), d("div", {
1820
1828
  key: 0,
1821
1829
  class: f(["toast", {
@@ -1826,7 +1834,7 @@ const Qt = /* @__PURE__ */ H(Ve, [["render", Ee]]), Xt = /* @__PURE__ */ m({
1826
1834
  "aria-live": "polite"
1827
1835
  }, [
1828
1836
  p("div", St, [
1829
- a.title ? (n(), d("div", Et, S(a.title), 1)) : $("", !0),
1837
+ a.title ? (n(), d("div", Et, V(a.title), 1)) : $("", !0),
1830
1838
  p("div", Tt, [
1831
1839
  u(y.$slots, "default")
1832
1840
  ])
@@ -1850,7 +1858,7 @@ export {
1850
1858
  fa as Breadcrumb,
1851
1859
  ma as Breadcrumbs,
1852
1860
  It as Button,
1853
- Rt as ButtonGroup,
1861
+ Ft as ButtonGroup,
1854
1862
  Lt as Card,
1855
1863
  sa as Checkbox,
1856
1864
  ia as Choice,
@@ -1874,7 +1882,7 @@ export {
1874
1882
  ga as Progress,
1875
1883
  la as Radio,
1876
1884
  At as Section,
1877
- Ft as SectionHeader,
1885
+ Rt as SectionHeader,
1878
1886
  Wt as Select,
1879
1887
  ra as Sidebar,
1880
1888
  da as SidebarGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraxe/vue",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -0,0 +1,2 @@
1
+ allowBuilds:
2
+ esbuild: true
@@ -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
+ />
@@ -2,42 +2,43 @@
2
2
  import { computed } from "vue";
3
3
 
4
4
  interface Props {
5
- value?: string;
5
+ modelValue?: string;
6
6
  disabled?: boolean;
7
7
  error?: boolean;
8
8
  success?: boolean;
9
9
  }
10
10
 
11
11
  const props = withDefaults(defineProps<Props>(), {
12
- value: "",
12
+ modelValue: "",
13
13
  disabled: false,
14
14
  error: false,
15
15
  success: false,
16
16
  });
17
17
 
18
18
  const emit = defineEmits<{
19
- change: [value: string];
19
+ "update:modelValue": [value: string];
20
20
  }>();
21
21
 
22
+ function handleChange(event: Event) {
23
+ const target = event.target as HTMLSelectElement;
24
+ emit("update:modelValue", target.value);
25
+ }
26
+
22
27
  const selectClasses = computed(() => ({
23
28
  "input-error": props.error,
24
29
  "input-success": props.success,
25
30
  }));
26
31
 
27
- function handleChange(event: Event) {
28
- const target = event.target as HTMLSelectElement;
29
- emit("change", target.value);
30
- }
31
32
  </script>
32
33
 
33
34
  <template>
34
- <select
35
- class="select"
36
- :class="selectClasses"
37
- :value="props.value"
38
- :disabled="props.disabled"
39
- @change="handleChange"
40
- >
41
- <slot />
42
- </select>
35
+ <select
36
+ class="select"
37
+ :class="selectClasses"
38
+ :value="props.modelValue"
39
+ :disabled="props.disabled"
40
+ @change="handleChange"
41
+ >
42
+ <slot />
43
+ </select>
43
44
  </template>