@dolanske/vui 1.13.2 → 1.13.3

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.
package/dist/vui.js CHANGED
@@ -1719,7 +1719,7 @@ var Qn = { key: 0 }, $n = ["alt", "src"], er = { key: 2 }, tr = {
1719
1719
  case or.s: return "6px";
1720
1720
  case or.l: return "16px";
1721
1721
  case or.m:
1722
- default: return "8px";
1722
+ default: return "10px";
1723
1723
  }
1724
1724
  });
1725
1725
  return () => C(e.href ? "a" : "button", {
@@ -10821,7 +10821,9 @@ var Sd = /* @__PURE__ */ v({
10821
10821
  type: Boolean,
10822
10822
  default: !0
10823
10823
  },
10824
- headerAlign: {}
10824
+ headerAlign: {},
10825
+ centered: { type: Boolean },
10826
+ borderStyle: { default: "solid" }
10825
10827
  },
10826
10828
  setup(e) {
10827
10829
  return (t, n) => (R(), d("div", {
@@ -10829,20 +10831,26 @@ var Sd = /* @__PURE__ */ v({
10829
10831
  separators: e.separators,
10830
10832
  "header-separator": e.separators || e.headerSeparator,
10831
10833
  "footer-separator": e.separators || e.footerSeparator,
10832
- "no-padding": !e.padding
10834
+ "no-padding": !e.padding,
10835
+ centered: e.centered
10833
10836
  }]),
10834
- style: P({ "--vui-card-header-align": e.headerAlign })
10837
+ style: P({
10838
+ "--vui-card-header-align": e.headerAlign,
10839
+ "--vui-card-border-style": e.borderStyle
10840
+ })
10835
10841
  }, [
10836
10842
  t.$slots.header || t.$slots["header-end"] ? (R(), d("div", Td, [f("div", Ed, [H(t.$slots, "header")]), H(t.$slots, "header-end")])) : u("", !0),
10837
10843
  (e.separators || e.headerSeparator) && (t.$slots.header || t.$slots["header-end"]) ? (R(), l(wd, {
10838
10844
  key: 1,
10845
+ type: e.borderStyle,
10839
10846
  size: 1
10840
- })) : u("", !0),
10847
+ }, null, 8, ["type"])) : u("", !0),
10841
10848
  t.$slots.default ? (R(), d("div", Dd, [H(t.$slots, "default")])) : u("", !0),
10842
10849
  (e.separators || e.footerSeparator) && t.$slots.footer ? (R(), l(wd, {
10843
10850
  key: 3,
10851
+ type: e.borderStyle,
10844
10852
  size: 1
10845
- })) : u("", !0),
10853
+ }, null, 8, ["type"])) : u("", !0),
10846
10854
  t.$slots.footer ? (R(), d("div", Od, [H(t.$slots, "footer")])) : u("", !0)
10847
10855
  ], 6));
10848
10856
  }
@@ -10931,10 +10939,12 @@ var Sd = /* @__PURE__ */ v({
10931
10939
  }, null, 40, Nd), [[he, i.value]]), f("label", { for: q(a) }, [f("span", Fd, [i.value ? H(t.$slots, "icon-on", { key: 0 }, () => [g(q(Ge))]) : H(t.$slots, "icon-off", { key: 1 }, () => [g(q(at))])]), e.label || r.default ? (R(), d("p", Id, [H(t.$slots, "default", {}, () => [h(G(e.label), 1)])])) : u("", !0)], 8, Pd)], 2));
10932
10940
  }
10933
10941
  }), Rd = /* @__PURE__ */ function(e) {
10934
- return e.Mobile = "mobile", e.Tablet = "tablet", e;
10942
+ return e.Mobile = "mobile", e.Tablet = "tablet", e.SmallDesktop = "smallDesktop", e.Desktop = "desktop", e;
10935
10943
  }({}), zd = B({
10936
10944
  mobile: 572,
10937
- tablet: 768
10945
+ tablet: 768,
10946
+ smallDesktop: 1228,
10947
+ desktop: 1920
10938
10948
  }), { width: Bd } = Cn();
10939
10949
  function Vd(e) {
10940
10950
  return c(() => {
@@ -11118,10 +11128,7 @@ var Zd = /* @__PURE__ */ v({
11118
11128
  }, cf = {
11119
11129
  key: 0,
11120
11130
  class: "vui-commands-group-title"
11121
- }, lf = {
11122
- class: "vui-commands-list",
11123
- tabindex: "-1"
11124
- }, uf = ["data-index", "onClick"], df = { class: "vui-commands-list-item" }, ff = {
11131
+ }, lf = { class: "vui-commands-list" }, uf = ["data-index", "onClick"], df = { class: "vui-commands-list-item" }, ff = {
11125
11132
  key: 0,
11126
11133
  class: "vui-commands-list-item-icon"
11127
11134
  }, pf = { class: "vui-command-body" }, mf = {
@@ -11133,7 +11140,8 @@ var Zd = /* @__PURE__ */ v({
11133
11140
  open: { type: Boolean },
11134
11141
  placeholder: { default: "Write a command.." },
11135
11142
  commands: {},
11136
- loading: { type: Boolean }
11143
+ loading: { type: Boolean },
11144
+ compact: { type: Boolean }
11137
11145
  }, {
11138
11146
  search: { default: "" },
11139
11147
  searchModifiers: {},
@@ -11142,70 +11150,69 @@ var Zd = /* @__PURE__ */ v({
11142
11150
  }),
11143
11151
  emits: /* @__PURE__ */ k(["close"], ["update:search", "update:group"]),
11144
11152
  setup(e, { emit: t }) {
11145
- let r = e, i = t, a = pe(e, "search"), o = pe(e, "group"), s = c(() => r.commands.filter((e) => o.value && o.value !== "All" ? (e.group ?? hf) === o.value : !0).filter((e) => zn([
11153
+ let r = e, i = t, a = Vd(Rd.Mobile), o = pe(e, "search"), s = pe(e, "group"), p = c(() => r.commands.filter((e) => s.value && s.value !== "All" ? (e.group ?? hf) === s.value : !0).filter((e) => zn([
11146
11154
  e.title,
11147
11155
  e.description,
11148
11156
  ...e.keywords ?? []
11149
- ], a.value))), p = c(() => {
11150
- if (s.value.length === 0) return null;
11151
- let e = Object.groupBy(s.value, (e) => e.group ?? hf);
11157
+ ], o.value))), _ = c(() => {
11158
+ if (p.value.length === 0) return null;
11159
+ let e = Object.groupBy(p.value, (e) => e.group ?? hf);
11152
11160
  return Object.fromEntries(Object.entries(e).sort(([e], [t]) => e.localeCompare(t)));
11153
- }), m = c(() => {
11161
+ }), v = c(() => {
11154
11162
  let e = /* @__PURE__ */ new Set();
11155
11163
  for (let t of r.commands) e.add(t.group ?? hf);
11156
11164
  let t = [...e].toSorted((e, t) => e === hf ? 1 : t === hf ? -1 : e.localeCompare(t));
11157
11165
  return t.unshift("All"), t;
11158
- }), _ = c(() => {
11159
- if (!p.value) return [];
11166
+ }), y = c(() => {
11167
+ if (!_.value) return [];
11160
11168
  let e = [], t = 0;
11161
- for (let n of Object.values(p.value)) e.push(t), t += n.length;
11169
+ for (let n of Object.values(_.value)) e.push(t), t += n.length;
11162
11170
  return e;
11163
- }), v = c(() => p.value ? Object.values(p.value).flat() : []), y = vn(), b = B(0);
11171
+ }), b = c(() => _.value ? Object.values(_.value).flat() : []), x = vn(), S = B(0);
11164
11172
  be(() => {
11165
- for (let e of r.commands) if (e.shortcut && y[e.shortcut].value) {
11166
- x(e);
11173
+ for (let e of r.commands) if (e.shortcut && x[e.shortcut].value) {
11174
+ C(e);
11167
11175
  break;
11168
11176
  }
11169
- }), zt(() => !!a.value, () => {
11170
- b.value = 0;
11171
- }), zt(y.ArrowUp, () => {
11172
- b.value > 0 ? b.value-- : b.value = v.value.length - 1;
11173
- }), zt(y.ArrowDown, () => {
11174
- b.value < v.value.length - 1 ? b.value++ : b.value = 0;
11175
- }), Y(b, (e) => {
11177
+ }), zt(() => !!o.value, () => {
11178
+ S.value = 0;
11179
+ }), zt(x.ArrowUp, () => {
11180
+ S.value > 0 ? S.value-- : S.value = b.value.length - 1;
11181
+ }), zt(x.ArrowDown, () => {
11182
+ S.value < b.value.length - 1 ? S.value++ : S.value = 0;
11183
+ }), Y(S, (e) => {
11176
11184
  let t = document.querySelector(`[data-index="${e}"]`);
11177
11185
  t && t.scrollIntoView({
11178
11186
  behavior: "smooth",
11179
11187
  block: "nearest",
11180
11188
  inline: "nearest"
11181
11189
  });
11182
- }), zt(y.Enter, () => {
11183
- x(v.value[b.value]);
11190
+ }), zt(x.Enter, () => {
11191
+ C(b.value[S.value]);
11184
11192
  });
11185
- function x(e) {
11193
+ function C(e) {
11186
11194
  r.open && (e.handler ? e.handler() : e.href && window.open(e.href, "_blank"));
11187
11195
  }
11188
- zt(y.Escape, () => {
11196
+ zt(x.Escape, () => {
11189
11197
  i("close");
11190
11198
  });
11191
- let S = J("searchRef");
11192
- function C() {
11193
- a.value = "", S.value?.focus({ preventScroll: !0 });
11194
- }
11195
- Y(() => r.open, async (e) => {
11196
- e && (await j(), requestAnimationFrame(C));
11197
- }, { flush: "post" });
11198
- let w = Vd(Rd.Mobile);
11199
- return (t, s) => (R(), l(ef, {
11199
+ let w = J("searchRef");
11200
+ function T() {
11201
+ o.value = "", a.value || w.value?.focus({ preventScroll: !0 });
11202
+ }
11203
+ return Y(() => r.open, async (e) => {
11204
+ e && (await j(), requestAnimationFrame(T));
11205
+ }, { flush: "post" }), (t, c) => (R(), l(ef, {
11200
11206
  open: r.open,
11201
11207
  "hide-close-button": "",
11202
11208
  card: {
11203
11209
  separators: !0,
11204
11210
  padding: !1
11205
11211
  },
11206
- class: "vui-commands",
11207
- onClose: s[2] ||= (e) => i("close")
11208
- }, {
11212
+ class: M(["vui-commands", { compact: r.compact }]),
11213
+ size: r.compact ? "s" : "m",
11214
+ onClose: c[2] ||= (e) => i("close")
11215
+ }, m({
11209
11216
  header: X(() => [f("div", tf, [
11210
11217
  f("div", nf, [e.loading ? (R(), l(pr, {
11211
11218
  key: 0,
@@ -11213,82 +11220,60 @@ var Zd = /* @__PURE__ */ v({
11213
11220
  })) : (R(), l(q(Qe), { key: 1 }))]),
11214
11221
  Se(f("input", {
11215
11222
  ref: "searchRef",
11216
- "onUpdate:modelValue": s[0] ||= (e) => a.value = e,
11223
+ "onUpdate:modelValue": c[0] ||= (e) => o.value = e,
11217
11224
  type: "text",
11218
11225
  autofocus: "",
11219
11226
  placeholder: r.placeholder
11220
- }, null, 8, rf), [[ve, a.value]]),
11227
+ }, null, 8, rf), [[ve, o.value]]),
11221
11228
  g(ir, { gap: 2 }, {
11222
- default: X(() => [a.value ? (R(), l(mr, {
11229
+ default: X(() => [o.value ? (R(), l(mr, {
11223
11230
  key: 0,
11224
11231
  size: "s",
11225
11232
  square: "",
11226
- onClick: C
11233
+ onClick: T
11227
11234
  }, {
11228
11235
  default: X(() => [g(q(ut), { class: "text-color-light" })]),
11229
11236
  _: 1
11230
- })) : u("", !0), q(w) ? (R(), l(mr, {
11237
+ })) : u("", !0), q(a) ? (R(), l(mr, {
11231
11238
  key: 1,
11232
11239
  size: "s",
11233
- onClick: s[1] ||= (e) => i("close")
11240
+ onClick: c[1] ||= (e) => i("close")
11234
11241
  }, {
11235
- default: X(() => [...s[3] ||= [h(" Close ", -1)]]),
11242
+ default: X(() => [...c[3] ||= [h(" Close ", -1)]]),
11236
11243
  _: 1
11237
11244
  })) : u("", !0)]),
11238
11245
  _: 1
11239
11246
  })
11240
- ]), f("div", af, [g(Md, { gap: "xs" }, {
11241
- default: X(() => [(R(!0), d(n, null, V(m.value, (e) => (R(), d("button", {
11247
+ ]), f("div", af, [g(Md, {
11248
+ gap: r.compact ? "xxs" : "xs",
11249
+ "hide-scrollbar": "",
11250
+ "hide-shadows": ""
11251
+ }, {
11252
+ default: X(() => [(R(!0), d(n, null, V(v.value, (e) => (R(), d("button", {
11242
11253
  key: e,
11243
11254
  tabindex: 0,
11244
- onClick: (t) => o.value = e
11255
+ onClick: (t) => s.value = e
11245
11256
  }, [g(sr, {
11246
- variant: e === o.value ? "accent" : "neutral",
11257
+ variant: e === s.value ? "accent" : "neutral",
11247
11258
  role: "button"
11248
11259
  }, {
11249
11260
  default: X(() => [h(G(e === hf ? "Other" : e), 1)]),
11250
11261
  _: 2
11251
11262
  }, 1032, ["variant"])], 8, of))), 128))]),
11252
11263
  _: 1
11253
- })])]),
11254
- footer: X(() => [g(ir, {
11255
- gap: "xxs",
11256
- "y-center": ""
11257
- }, {
11258
- default: X(() => [
11259
- g(Hd, null, {
11260
- default: X(() => [g(q(Ne))]),
11261
- _: 1
11262
- }),
11263
- g(Hd, null, {
11264
- default: X(() => [g(q(Me))]),
11265
- _: 1
11266
- }),
11267
- s[6] ||= f("span", { class: "text-color-lighter mr-s" }, "Move", -1),
11268
- g(Hd, null, {
11269
- default: X(() => [...s[4] ||= [h(" Enter ", -1)]]),
11270
- _: 1
11271
- }),
11272
- s[7] ||= f("span", { class: "text-color-lighter mr-s" }, "Select", -1),
11273
- g(Hd, null, {
11274
- default: X(() => [...s[5] ||= [h(" Esc ", -1)]]),
11275
- _: 1
11276
- }),
11277
- s[8] ||= f("span", { class: "text-color-lighter" }, "Close", -1)
11278
- ]),
11279
- _: 1
11280
- })]),
11281
- default: X(() => [p.value ? H(t.$slots, "default", {
11264
+ }, 8, ["gap"])])]),
11265
+ default: X(() => [_.value ? H(t.$slots, "default", {
11282
11266
  key: 1,
11283
- commands: p.value
11284
- }, () => [(R(!0), d(n, null, V(p.value, (e, r, i) => (R(), d("div", {
11267
+ commands: _.value
11268
+ }, () => [(R(!0), d(n, null, V(_.value, (e, r, i) => (R(), d("div", {
11285
11269
  key: r,
11286
- class: "vui-commands-group"
11287
- }, [r !== hf && o.value === "All" ? (R(), d("span", cf, G(r), 1)) : u("", !0), f("ul", lf, [(R(!0), d(n, null, V(e, (e, a) => (R(), d("li", {
11270
+ class: "vui-commands-group",
11271
+ tabindex: "-1"
11272
+ }, [r !== hf && s.value === "All" ? (R(), d("span", cf, G(r), 1)) : u("", !0), f("ul", lf, [(R(!0), d(n, null, V(e, (e, a) => (R(), d("li", {
11288
11273
  key: e.title,
11289
- "data-index": _.value[i] + a,
11290
- class: M({ "vui-commands-list-item-focused": b.value === _.value[i] + a }),
11291
- onClick: (t) => x(e)
11274
+ "data-index": y.value[i] + a,
11275
+ class: M({ "vui-commands-list-item-focused": S.value === y.value[i] + a }),
11276
+ onClick: (t) => C(e)
11292
11277
  }, [H(t.$slots, "command", {
11293
11278
  command: e,
11294
11279
  group: r
@@ -11306,9 +11291,44 @@ var Zd = /* @__PURE__ */ v({
11306
11291
  }, null, 8, ["keys"]))), 128))]),
11307
11292
  _: 2
11308
11293
  }, 1024)) : u("", !0)
11309
- ])])], 10, uf))), 128))])]))), 128))]) : (R(), d("div", sf, [...s[9] ||= [f("p", null, "No results found", -1)]]))]),
11310
- _: 3
11311
- }, 8, ["open"]));
11294
+ ])])], 10, uf))), 128))])]))), 128))]) : (R(), d("div", sf, [...c[9] ||= [f("p", null, "No results found", -1)]]))]),
11295
+ _: 2
11296
+ }, [r.compact ? void 0 : {
11297
+ name: "footer",
11298
+ fn: X(() => [g(ir, {
11299
+ gap: "xxs",
11300
+ "y-center": "",
11301
+ tabindex: "-1"
11302
+ }, {
11303
+ default: X(() => [
11304
+ g(Hd, null, {
11305
+ default: X(() => [g(q(Ne))]),
11306
+ _: 1
11307
+ }),
11308
+ g(Hd, null, {
11309
+ default: X(() => [g(q(Me))]),
11310
+ _: 1
11311
+ }),
11312
+ c[6] ||= f("span", { class: "text-color-lighter mr-s" }, "Move", -1),
11313
+ g(Hd, null, {
11314
+ default: X(() => [...c[4] ||= [h(" Enter ", -1)]]),
11315
+ _: 1
11316
+ }),
11317
+ c[7] ||= f("span", { class: "text-color-lighter mr-s" }, "Select", -1),
11318
+ g(Hd, null, {
11319
+ default: X(() => [...c[5] ||= [h(" Esc ", -1)]]),
11320
+ _: 1
11321
+ }),
11322
+ c[8] ||= f("span", { class: "text-color-lighter" }, "Close", -1)
11323
+ ]),
11324
+ _: 1
11325
+ })]),
11326
+ key: "0"
11327
+ }]), 1032, [
11328
+ "open",
11329
+ "class",
11330
+ "size"
11331
+ ]));
11312
11332
  }
11313
11333
  }), _f = /* @__PURE__ */ v({
11314
11334
  inheritAttrs: !1,
@@ -14752,7 +14772,7 @@ var Gh = ["aria-describedby"], Kh = /* @__PURE__ */ $d(/* @__PURE__ */ v({
14752
14772
  function _() {
14753
14773
  r.value = void 0, m.value?.close();
14754
14774
  }
14755
- let v = fe();
14775
+ let v = fe(), y = Vd(Rd.Mobile);
14756
14776
  return (c, m) => (R(), d("div", {
14757
14777
  class: M(["vui-input-container vui-select", {
14758
14778
  expand: e.expand,
@@ -14806,7 +14826,7 @@ var Gh = ["aria-describedby"], Kh = /* @__PURE__ */ $d(/* @__PURE__ */ v({
14806
14826
  modelValue: o.value,
14807
14827
  "onUpdate:modelValue": m[0] ||= (e) => o.value = e,
14808
14828
  placeholder: "Search...",
14809
- focus: i,
14829
+ focus: i && !q(y),
14810
14830
  expand: ""
14811
14831
  }, {
14812
14832
  start: X(() => [g(q(Qe))]),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dolanske/vui",
3
3
  "type": "module",
4
- "version": "1.13.2",
4
+ "version": "1.13.3",
5
5
  "private": false,
6
6
  "description": "Brother in Christ there's a new UI library",
7
7
  "author": "dolanske",