@indielayer/ui 0.0.0-dev-20240127005325 → 0.0.0-dev-20240129122517

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,22 +1,22 @@
1
- const t = {
1
+ const s = {
2
2
  classes: {
3
3
  wrapper: "",
4
- box: ({ props: e, data: s }) => {
4
+ box: ({ props: e, data: t }) => {
5
5
  const r = ["w-full border border-gray-300 dark:border-gray-700 pr-8 outline-transparent outline outline-2 outline-offset-[-1px] transition-all duration-150 ease-in-out rounded-md shadow-sm"];
6
- return !s.errorInternal && !e.disabled && r.push("hover:border-gray-400 dark:hover:border-gray-500"), e.size === "xs" ? r.push("px-2 py-1 text-xs") : e.size === "sm" ? r.push("px-2 py-2 text-sm") : e.size === "lg" ? r.push("px-4 py-3 text-lg") : e.size === "xl" ? r.push("px-5 py-4 text-xl") : r.push("px-3 py-2"), e.disabled ? r.push("bg-gray-100 dark:bg-gray-900 text-gray-500 cursor-not-allowed") : r.push("bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200"), s.errorInternal ? r.push("border-red-500 dark:border-red-400 group-focus:outline-red-500") : e.disabled || r.push("group-focus:outline-[color:var(--x-select-border)]"), r;
6
+ return !t.errorInternal && !e.disabled && r.push("hover:border-gray-400 dark:hover:border-gray-500"), e.size === "xs" ? r.push("px-2 py-1 text-xs") : e.size === "sm" ? r.push("px-2 py-2 text-sm") : e.size === "lg" ? r.push("px-4 py-3 text-lg") : e.size === "xl" ? r.push("px-5 py-4 text-xl") : r.push("px-3 py-2"), e.disabled ? r.push("bg-gray-100 dark:bg-gray-900 text-gray-500 cursor-not-allowed") : r.push("bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200"), t.errorInternal ? r.push("border-red-500 dark:border-red-400 group-focus:outline-red-500") : e.disabled || r.push("group-focus:outline-[color:var(--x-select-border)]"), r;
7
7
  },
8
- content: "py-1 max-h-72 overflow-scroll",
8
+ content: "py-1 max-h-72 overflow-y-auto",
9
9
  iconWrapper: "pointer-events-none absolute inset-y-0 right-0 flex items-center px-2",
10
10
  icon: ({ props: e }) => {
11
- const s = [""];
12
- return e.size === "sm" || e.size === "xs" ? s.push("h-3 w-3") : e.size === "lg" ? s.push("h-6 w-6") : e.size === "xl" ? s.push("h-7 w-7") : s.push("h-5 w-5"), e.disabled ? s.push("text-gray-300 dark:text-gray-500") : s.push("text-gray-500 dark:text-gray-400"), s;
11
+ const t = [""];
12
+ return e.size === "sm" || e.size === "xs" ? t.push("h-3 w-3") : e.size === "lg" ? t.push("h-6 w-6") : e.size === "xl" ? t.push("h-7 w-7") : t.push("h-5 w-5"), e.disabled ? t.push("text-gray-300 dark:text-gray-500") : t.push("text-gray-500 dark:text-gray-400"), t;
13
13
  }
14
14
  },
15
- styles: ({ colors: e, css: s }) => {
15
+ styles: ({ colors: e, css: t }) => {
16
16
  const r = e.getPalette("primary");
17
- return s.get("border", r[500]);
17
+ return t.get("border", r[500]);
18
18
  }
19
- }, l = t;
19
+ }, a = s;
20
20
  export {
21
- l as default
21
+ a as default
22
22
  };
@@ -1,11 +1,11 @@
1
- const s = {
1
+ const a = {
2
2
  classes: {
3
3
  wrapper: "",
4
4
  box: ({ props: e, data: t }) => {
5
5
  const r = ["w-full border-b text-sm px-4 border-gray-300 dark:border-gray-700 pr-8 outline-transparent outline outline-2 outline-offset-[-1px] transition-all duration-150 ease-in-out"];
6
6
  return !t.errorInternal && !e.disabled && r.push("hover:border-gray-400 dark:hover:border-gray-500"), e.size === "xs" || e.size === "sm" ? r.push("py-1.5") : e.size === "lg" || e.size === "xl" ? r.push("py-3.5") : r.push("py-2.5"), e.disabled ? r.push("bg-gray-100 dark:bg-gray-900 text-gray-300 cursor-not-allowed") : e.readonly ? r.push("bg-white dark:bg-gray-900 text-gray-700") : r.push("bg-gray-50 dark:bg-gray-800 text-gray-700 dark:text-gray-200"), t.errorInternal ? r.push("border-red-500 dark:border-red-400 group-focus:outline-red-500") : e.disabled || r.push("group-focus:outline-[color:var(--x-select-border)]"), r;
7
7
  },
8
- content: "py-1 max-h-72 overflow-scroll",
8
+ content: "py-1 max-h-72 overflow-y-auto",
9
9
  iconWrapper: "pointer-events-none absolute inset-y-0 right-0 flex items-center px-2",
10
10
  icon: ({ props: e }) => {
11
11
  const t = ["h-5 w-5"];
@@ -16,7 +16,7 @@ const s = {
16
16
  const r = e.getPalette("primary");
17
17
  return t.get("border", r[500]);
18
18
  }
19
- }, a = s;
19
+ }, s = a;
20
20
  export {
21
- a as default
21
+ s as default
22
22
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as J, ref as X, watch as F, resolveComponent as O, openBlock as l, createElementBlock as i, normalizeClass as p, unref as c, renderSlot as d, createElementVNode as f, normalizeStyle as P, createVNode as m, withCtx as u, createBlock as y, createCommentVNode as b, Fragment as k, renderList as v, createTextVNode as C, toDisplayString as N } from "vue";
1
+ import { defineComponent as J, ref as X, watch as F, resolveComponent as O, openBlock as n, createElementBlock as i, normalizeClass as p, unref as c, renderSlot as d, createElementVNode as f, normalizeStyle as P, createVNode as m, withCtx as u, createBlock as y, createCommentVNode as b, Fragment as k, renderList as v, createTextVNode as C, toDisplayString as N } from "vue";
2
2
  import { useTheme as W } from "../../composables/useTheme.js";
3
3
  import q from "./TableHead.vue.js";
4
4
  import S from "./TableHeader.vue.js";
@@ -41,8 +41,8 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
41
41
  default: !0
42
42
  },
43
43
  expandable: Boolean
44
- }, le = { name: "XTable" }, fe = /* @__PURE__ */ J({
45
- ...le,
44
+ }, ne = { name: "XTable" }, fe = /* @__PURE__ */ J({
45
+ ...ne,
46
46
  props: {
47
47
  ...te,
48
48
  items: {
@@ -65,41 +65,41 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
65
65
  $.expandable && (g.value = T(e));
66
66
  }, { immediate: !0 });
67
67
  const H = A;
68
- function V(e, n) {
68
+ function V(e, l) {
69
69
  if (e)
70
- for (let r = 0; r < n.length; r++) {
71
- const { 0: t, 1: s } = n[r].split(",");
70
+ for (let r = 0; r < l.length; r++) {
71
+ const { 0: t, 1: o } = l[r].split(",");
72
72
  if (e === t)
73
- return parseInt(s) > 0 ? 1 : -1;
73
+ return parseInt(o) > 0 ? 1 : -1;
74
74
  }
75
75
  }
76
76
  function I(e) {
77
- const n = $.sort.slice(0);
77
+ const l = $.sort.slice(0);
78
78
  let r = !1;
79
- for (let t = 0; t < n.length; t++) {
80
- const { 0: s, 1: o } = n[t].split(",");
81
- if (s === e.value) {
82
- if (r = !0, o === "-1") {
83
- n.splice(t, 1, `${e.value},1`);
79
+ for (let t = 0; t < l.length; t++) {
80
+ const { 0: o, 1: s } = l[t].split(",");
81
+ if (o === e.value) {
82
+ if (r = !0, s === "-1") {
83
+ l.splice(t, 1, `${e.value},1`);
84
84
  break;
85
- } else if (o === "1") {
86
- n.splice(t, 1);
85
+ } else if (s === "1") {
86
+ l.splice(t, 1);
87
87
  break;
88
88
  }
89
89
  }
90
90
  }
91
- r || n.push(`${e.value},-1`), H("update:sort", n);
91
+ r || l.push(`${e.value},-1`), H("update:sort", l);
92
92
  }
93
- function L(e, n) {
94
- if (!n)
93
+ function L(e, l) {
94
+ if (!l)
95
95
  return "";
96
- const r = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
97
- return (r == null ? void 0 : r.reduce((s, o) => s && s[o], e)) ?? "";
96
+ const r = Array.isArray(l) ? l : l.match(/([^[.\]])+/g);
97
+ return (r == null ? void 0 : r.reduce((o, s) => o && o[s], e)) ?? "";
98
98
  }
99
99
  const { styles: D, classes: w, className: E } = W("Table", {}, $);
100
- return (e, n) => {
100
+ return (e, l) => {
101
101
  const r = O("x-icon");
102
- return l(), i("div", {
102
+ return n(), i("div", {
103
103
  class: p([c(E), c(w).wrapper])
104
104
  }, [
105
105
  d(e.$slots, "title"),
@@ -110,20 +110,20 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
110
110
  }, [
111
111
  m(q, null, {
112
112
  default: u(() => [
113
- e.expandable ? (l(), y(S, {
113
+ e.expandable ? (n(), y(S, {
114
114
  key: 0,
115
115
  width: "48",
116
116
  class: "!p-0",
117
117
  "sticky-header": e.stickyHeader
118
118
  }, null, 8, ["sticky-header"])) : b("", !0),
119
- (l(!0), i(k, null, v(e.headers, (t, s) => (l(), y(S, {
120
- key: s,
119
+ (n(!0), i(k, null, v(e.headers, (t, o) => (n(), y(S, {
120
+ key: o,
121
121
  "sticky-header": e.stickyHeader,
122
122
  "text-align": t.align,
123
123
  sort: V(t.value, e.sort),
124
124
  sortable: t.sortable,
125
125
  width: t.width,
126
- onClick: (o) => t.sortable ? I(t) : null
126
+ onClick: (s) => t.sortable ? I(t) : null
127
127
  }, {
128
128
  default: u(() => [
129
129
  d(e.$slots, `header-${t.value}`, { header: t }, () => [
@@ -137,26 +137,26 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
137
137
  }),
138
138
  m(c(G), null, {
139
139
  default: u(() => [
140
- e.loading ? (l(!0), i(k, { key: 0 }, v(Number(e.loadingLines), (t, s) => (l(), y(z, {
141
- key: s,
140
+ e.loading ? (n(!0), i(k, { key: 0 }, v(Number(e.loadingLines), (t, o) => (n(), y(z, {
141
+ key: o,
142
142
  striped: e.striped
143
143
  }, {
144
144
  default: u(() => [
145
- (l(!0), i(k, null, v(e.headers, (o, a) => (l(), y(_, {
145
+ (n(!0), i(k, null, v(e.headers, (s, a) => (n(), y(_, {
146
146
  key: a,
147
- "text-align": o.align,
148
- width: o.width,
147
+ "text-align": s.align,
148
+ width: s.width,
149
149
  dense: e.dense,
150
150
  fixed: e.fixed
151
151
  }, {
152
152
  default: u(() => [
153
- d(e.$slots, `loading-${o.value}`, { item: t }, () => [
153
+ d(e.$slots, `loading-${s.value}`, { item: t }, () => [
154
154
  m(M, {
155
155
  class: p(["max-w-[60%]", {
156
- "mx-auto": o.align === "center",
157
- "ml-auto": o.align === "right"
156
+ "mx-auto": s.align === "center",
157
+ "ml-auto": s.align === "right"
158
158
  }]),
159
- shape: o.skeletonShape || "line"
159
+ shape: s.skeletonShape || "line"
160
160
  }, null, 8, ["shape", "class"])
161
161
  ])
162
162
  ]),
@@ -164,28 +164,28 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
164
164
  }, 1032, ["text-align", "width", "dense", "fixed"]))), 128))
165
165
  ]),
166
166
  _: 2
167
- }, 1032, ["striped"]))), 128)) : e.error ? (l(), i("tr", R, [
167
+ }, 1032, ["striped"]))), 128)) : e.error ? (n(), i("tr", R, [
168
168
  f("td", {
169
169
  colspan: e.headers.length
170
170
  }, [
171
171
  d(e.$slots, "error")
172
172
  ], 8, U)
173
- ])) : !h.items || h.items.length === 0 ? (l(), i("tr", Y, [
173
+ ])) : !h.items || h.items.length === 0 ? (n(), i("tr", Y, [
174
174
  f("td", {
175
175
  colspan: e.headers.length
176
176
  }, [
177
177
  d(e.$slots, "empty")
178
178
  ], 8, Z)
179
- ])) : (l(!0), i(k, { key: 3 }, v(h.items, (t, s) => {
180
- var o;
181
- return l(), i(k, { key: s }, [
179
+ ])) : (n(!0), i(k, { key: 3 }, v(h.items, (t, o) => {
180
+ var s;
181
+ return n(), i(k, { key: o }, [
182
182
  m(z, {
183
183
  pointer: e.pointer,
184
184
  striped: e.striped,
185
185
  onClick: (a) => e.$emit("click-row", t)
186
186
  }, {
187
187
  default: u(() => [
188
- e.expandable ? (l(), y(_, {
188
+ e.expandable ? (n(), y(_, {
189
189
  key: 0,
190
190
  width: "48",
191
191
  class: "!p-1"
@@ -195,13 +195,13 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
195
195
  return [
196
196
  f("button", {
197
197
  class: "p-4",
198
- onClick: (B) => g.value[s].__expanded = !g.value[s].__expanded
198
+ onClick: (B) => g.value[o].__expanded = !g.value[o].__expanded
199
199
  }, [
200
200
  m(r, {
201
201
  icon: c(Q),
202
202
  size: e.dense ? "xs" : "md",
203
203
  class: p(["transition-transform", {
204
- "rotate-180": (a = g.value[s]) == null ? void 0 : a.__expanded
204
+ "rotate-180": (a = g.value[o]) == null ? void 0 : a.__expanded
205
205
  }])
206
206
  }, null, 8, ["icon", "size", "class"])
207
207
  ], 8, j)
@@ -209,7 +209,7 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
209
209
  }),
210
210
  _: 2
211
211
  }, 1024)) : b("", !0),
212
- (l(!0), i(k, null, v(e.headers, (a, B) => (l(), y(_, {
212
+ (n(!0), i(k, null, v(e.headers, (a, B) => (n(), y(_, {
213
213
  key: B,
214
214
  "text-align": a.align,
215
215
  truncate: a.truncate,
@@ -227,10 +227,10 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
227
227
  ]),
228
228
  _: 2
229
229
  }, 1032, ["pointer", "striped", "onClick"]),
230
- e.expandable ? (l(), i("tr", x, [
230
+ e.expandable ? (n(), i("tr", x, [
231
231
  f("td", ee, [
232
232
  f("div", {
233
- class: p(["overflow-hidden", [(o = g.value[s]) != null && o.__expanded ? "" : "max-h-0"]])
233
+ class: p(["overflow-hidden transition-opacity", [(s = g.value[o]) != null && s.__expanded ? "" : "opacity-0 max-h-0"]])
234
234
  }, [
235
235
  d(e.$slots, "expanded-row", { item: t })
236
236
  ], 2)
@@ -241,7 +241,7 @@ const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["on
241
241
  ]),
242
242
  _: 3
243
243
  }),
244
- e.loading ? (l(), i("div", {
244
+ e.loading ? (n(), i("div", {
245
245
  key: 0,
246
246
  class: p(c(w).loadingWrapper)
247
247
  }, [