@cocoar/vue-ui 1.7.0 → 1.9.0-script-editor.4

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/index.js CHANGED
@@ -5,7 +5,7 @@ import { Maskito as ne } from "@maskito/core";
5
5
  import { maskitoDateOptionsGenerator as re, maskitoDateTimeOptionsGenerator as ie, maskitoNumberOptionsGenerator as ae } from "@maskito/kit";
6
6
  import { Temporal as J } from "@js-temporal/polyfill";
7
7
  //#region src/components/form-field/constants.ts
8
- var oe = Symbol("CoarFormField"), se = ["id", "for"], ce = {
8
+ var oe = Symbol.for("coar:form-field"), se = ["id", "for"], ce = {
9
9
  key: 0,
10
10
  class: "coar-form-field__required",
11
11
  "aria-hidden": "true"
@@ -2538,8 +2538,17 @@ var tt = { class: "coar-code-header" }, nt = { class: "coar-code-header-left" },
2538
2538
  //#region src/components/select/useSelectBase.ts
2539
2539
  function fn(e) {
2540
2540
  let t = E(!1), n = E(!1), i = E(""), a = E(-1), o = E("bottom"), s = `coar-select-${crypto.randomUUID?.() ?? Date.now().toString(16)}`, c = r(() => e.id.value || s), l = r(() => `${c.value}-message`), u = r(() => `${c.value}-listbox`), d = r(() => {
2541
- let t = i.value.toLowerCase().trim(), n = t ? e.options.value.filter((e) => e.label.toLowerCase().includes(t)) : e.options.value;
2542
- return n.some((e) => e.group) ? [...n].sort((e, t) => !e.group && !t.group ? 0 : e.group ? t.group ? e.group.localeCompare(t.group) : 1 : -1) : n;
2541
+ let t = i.value.toLowerCase().trim(), n = t ? e.options.value.filter((e) => e.label.toLowerCase().includes(t)) : e.options.value, r = e.sortOptions.value, a = e.sortGroups.value, o = n.some((e) => e.group), s = typeof r == "function" ? r : r === "asc" ? (e, t) => e.label.localeCompare(t.label) : r === "desc" ? (e, t) => t.label.localeCompare(e.label) : null;
2542
+ if (!o) return s ? [...n].sort(s) : n;
2543
+ let c = typeof a == "function" ? a : a === "asc" ? (e, t) => e.localeCompare(t) : a === "desc" ? (e, t) => t.localeCompare(e) : null, l = [], u = /* @__PURE__ */ new Map(), d = [];
2544
+ for (let e of n) e.group ? (u.has(e.group) || (l.push(e.group), u.set(e.group, [])), u.get(e.group).push(e)) : d.push(e);
2545
+ if (c && l.sort(c), s) {
2546
+ d.sort(s);
2547
+ for (let e of u.values()) e.sort(s);
2548
+ }
2549
+ let f = [...d];
2550
+ for (let e of l) f.push(...u.get(e));
2551
+ return f;
2543
2552
  });
2544
2553
  B(d, () => {
2545
2554
  a.value = -1;
@@ -4420,7 +4429,15 @@ var Uo = { class: "coar-select-wrapper" }, Wo = [
4420
4429
  type: Function,
4421
4430
  default: void 0
4422
4431
  },
4423
- dropdownPosition: { default: "auto" }
4432
+ dropdownPosition: { default: "auto" },
4433
+ sortGroups: {
4434
+ type: [String, Function],
4435
+ default: "asc"
4436
+ },
4437
+ sortOptions: {
4438
+ type: [String, Function],
4439
+ default: "none"
4440
+ }
4424
4441
  }, {
4425
4442
  modelValue: { default: null },
4426
4443
  modelModifiers: {}
@@ -4433,7 +4450,9 @@ var Uo = { class: "coar-select-wrapper" }, Wo = [
4433
4450
  disabled: N(u, "disabled"),
4434
4451
  readonly: N(u, "readonly"),
4435
4452
  id: N(u, "id"),
4436
- dropdownPositionPreference: N(u, "dropdownPosition")
4453
+ dropdownPositionPreference: N(u, "dropdownPosition"),
4454
+ sortGroups: N(u, "sortGroups"),
4455
+ sortOptions: N(u, "sortOptions")
4437
4456
  }), te = r(() => u.id || m?.inputId.value || j.value), ne = r(() => m?.messageId.value || void 0), { left: re, top: ie, minWidth: ae } = En({
4438
4457
  isOpen: E,
4439
4458
  triggerEl: v,
@@ -4595,7 +4614,7 @@ var Uo = { class: "coar-select-wrapper" }, Wo = [
4595
4614
  defer: !1
4596
4615
  }]])], 14, Jo)) : a("", !0)]))])], 2));
4597
4616
  }
4598
- }), [["__scopeId", "data-v-9d5cd526"]]), ts = null, ns = 0;
4617
+ }), [["__scopeId", "data-v-c097763c"]]), ts = null, ns = 0;
4599
4618
  function rs(e) {
4600
4619
  let t = e.value;
4601
4620
  return typeof t == "string" ? { content: t } : t;
@@ -4838,7 +4857,15 @@ var ms = /* @__PURE__ */ new WeakMap(), hs = {
4838
4857
  type: Function,
4839
4858
  default: void 0
4840
4859
  },
4841
- dropdownPosition: { default: "auto" }
4860
+ dropdownPosition: { default: "auto" },
4861
+ sortGroups: {
4862
+ type: [String, Function],
4863
+ default: "asc"
4864
+ },
4865
+ sortOptions: {
4866
+ type: [String, Function],
4867
+ default: "none"
4868
+ }
4842
4869
  }, {
4843
4870
  modelValue: { default: () => [] },
4844
4871
  modelModifiers: {}
@@ -4851,7 +4878,9 @@ var ms = /* @__PURE__ */ new WeakMap(), hs = {
4851
4878
  disabled: N(c, "disabled"),
4852
4879
  readonly: N(c, "readonly"),
4853
4880
  id: N(c, "id"),
4854
- dropdownPositionPreference: N(c, "dropdownPosition")
4881
+ dropdownPositionPreference: N(c, "dropdownPosition"),
4882
+ sortGroups: N(c, "sortGroups"),
4883
+ sortOptions: N(c, "sortOptions")
4855
4884
  }), q = r(() => c.id || p?.inputId.value || A.value), te = r(() => p?.messageId.value || void 0), { left: ne, top: re, minWidth: ie } = En({
4856
4885
  isOpen: T,
4857
4886
  triggerEl: h,
@@ -5051,7 +5080,7 @@ var ms = /* @__PURE__ */ new WeakMap(), hs = {
5051
5080
  defer: !1
5052
5081
  }]])], 14, Ss)) : a("", !0)]))])], 2));
5053
5082
  }
5054
- }), [["__scopeId", "data-v-29389b8d"]]), Ps = { class: "coar-select-wrapper" }, Fs = { class: "coar-tag-select-tags" }, Is = { class: "coar-tag-select-tag-label" }, Ls = ["aria-label", "onClick"], Rs = [
5083
+ }), [["__scopeId", "data-v-f8a0a781"]]), Ps = { class: "coar-select-wrapper" }, Fs = { class: "coar-tag-select-tags" }, Is = { class: "coar-tag-select-tag-label" }, Ls = ["aria-label", "onClick"], Rs = [
5055
5084
  "id",
5056
5085
  "placeholder",
5057
5086
  "disabled",
@@ -5101,7 +5130,15 @@ var ms = /* @__PURE__ */ new WeakMap(), hs = {
5101
5130
  type: Function,
5102
5131
  default: void 0
5103
5132
  },
5104
- dropdownPosition: { default: "auto" }
5133
+ dropdownPosition: { default: "auto" },
5134
+ sortGroups: {
5135
+ type: [String, Function],
5136
+ default: "asc"
5137
+ },
5138
+ sortOptions: {
5139
+ type: [String, Function],
5140
+ default: "none"
5141
+ }
5105
5142
  }, {
5106
5143
  modelValue: { default: () => [] },
5107
5144
  modelModifiers: {}
@@ -5114,7 +5151,9 @@ var ms = /* @__PURE__ */ new WeakMap(), hs = {
5114
5151
  disabled: N(c, "disabled"),
5115
5152
  readonly: N(c, "readonly"),
5116
5153
  id: N(c, "id"),
5117
- dropdownPositionPreference: N(c, "dropdownPosition")
5154
+ dropdownPositionPreference: N(c, "dropdownPosition"),
5155
+ sortGroups: N(c, "sortGroups"),
5156
+ sortOptions: N(c, "sortOptions")
5118
5157
  }), q = r(() => c.id || p?.inputId.value || z.value), te = r(() => p?.messageId.value || void 0), { left: ne, top: re, minWidth: ie } = En({
5119
5158
  isOpen: A,
5120
5159
  triggerEl: h,
@@ -5264,7 +5303,7 @@ var ms = /* @__PURE__ */ new WeakMap(), hs = {
5264
5303
  defer: !1
5265
5304
  }]])], 14, zs)) : a("", !0)]))])], 2));
5266
5305
  }
5267
- }), [["__scopeId", "data-v-8b78bca7"]]), Gs = {
5306
+ }), [["__scopeId", "data-v-259216f6"]]), Gs = {
5268
5307
  anchor: {
5269
5308
  kind: "virtual",
5270
5309
  placement: "center"
@@ -5651,14 +5690,13 @@ var cc = ["data-placement"], lc = /* @__PURE__ */ u({
5651
5690
  style: {
5652
5691
  position: "fixed",
5653
5692
  inset: "unset",
5654
- top: "0px",
5655
- left: "0px",
5693
+ left: `${e.instance.left}px`,
5694
+ top: `${e.instance.top}px`,
5656
5695
  margin: "0",
5657
5696
  border: "none",
5658
5697
  padding: "0",
5659
5698
  background: "transparent",
5660
5699
  overflow: "visible",
5661
- transform: `translate3d(${e.instance.left}px, ${e.instance.top}px, 0px)`,
5662
5700
  zIndex: `calc(var(--coar-z-overlay, 1000) + ${e.instance.id * 2})`,
5663
5701
  opacity: e.instance.presented ? "1" : "0",
5664
5702
  pointerEvents: e.instance.presented ? "auto" : "none"
@@ -7022,21 +7060,23 @@ var Ml = /* @__PURE__ */ Y(kl, [["render", jl], ["__scopeId", "data-v-a0d5d1e3"]
7022
7060
  }
7023
7061
  });
7024
7062
  let C = r(() => n.disabled ? -1 : p ? p.items.value.findIndex((e) => e.el === v.value) === p.activeIndex.value ? 0 : -1 : 0), w = null;
7025
- d.onChildPanelEnter = () => L(), yl(() => {
7026
- D();
7063
+ d.onChildPanelEnter = () => R();
7064
+ let T = bl();
7065
+ yl(() => {
7066
+ k(), T?.();
7027
7067
  });
7028
- function T(e) {
7068
+ function D(e) {
7029
7069
  m.value || (d.closeSiblings(), m.value = !0, g(() => {
7030
- k(e), d.overlayRef = {
7070
+ A(e), d.overlayRef = {
7031
7071
  panelEl: h.value,
7032
- close: () => D()
7072
+ close: () => k()
7033
7073
  }, u?.notifyChildOpened();
7034
7074
  }));
7035
7075
  }
7036
- function D() {
7076
+ function k() {
7037
7077
  m.value && (m.value = !1, d.overlayRef &&= null, u?.notifyChildClosed(d));
7038
7078
  }
7039
- function k(e) {
7079
+ function A(e) {
7040
7080
  let t = h.value;
7041
7081
  if (!t) return;
7042
7082
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = bn({
@@ -7060,79 +7100,79 @@ var Ml = /* @__PURE__ */ Y(kl, [["render", jl], ["__scopeId", "data-v-a0d5d1e3"]
7060
7100
  });
7061
7101
  t.style.left = `${i.left}px`, t.style.top = `${i.top}px`;
7062
7102
  }
7063
- function A(e) {
7103
+ function j(e) {
7064
7104
  if (n.disabled) return;
7065
- L();
7105
+ R();
7066
7106
  let t = e.currentTarget;
7067
- u ? u.requestOpenFromChild(d, () => T(t), {
7107
+ u ? u.requestOpenFromChild(d, () => D(t), {
7068
7108
  x: e.clientX,
7069
7109
  y: e.clientY
7070
- }) : T(t);
7071
- }
7072
- function j() {
7073
- n.disabled || I();
7110
+ }) : D(t);
7074
7111
  }
7075
7112
  function N() {
7076
- L(), u?.cancelAncestorCloseTimers();
7113
+ n.disabled || L();
7077
7114
  }
7078
7115
  function P() {
7079
- I();
7116
+ R(), u?.cancelAncestorCloseTimers();
7080
7117
  }
7081
7118
  function I() {
7082
- L(), w = setTimeout(() => {
7083
- D();
7084
- }, 80);
7119
+ L();
7085
7120
  }
7086
7121
  function L() {
7122
+ R(), w = setTimeout(() => {
7123
+ k();
7124
+ }, 80);
7125
+ }
7126
+ function R() {
7087
7127
  w &&= (clearTimeout(w), null);
7088
7128
  }
7089
- function R(e) {
7129
+ function z(e) {
7090
7130
  if (n.disabled) {
7091
7131
  e.preventDefault(), e.stopPropagation();
7092
7132
  return;
7093
7133
  }
7094
- e.stopPropagation(), m.value ? D() : T(e.currentTarget);
7134
+ e.stopPropagation(), m.value ? k() : D(e.currentTarget);
7095
7135
  }
7096
- function z(e) {
7136
+ function V(e) {
7097
7137
  if (!n.disabled) {
7098
7138
  if (e.key === "Enter" || e.key === " ") {
7099
- e.preventDefault(), m.value ? D() : T(v.value);
7139
+ e.preventDefault(), m.value ? k() : D(v.value);
7100
7140
  return;
7101
7141
  }
7102
7142
  if (e.key === "ArrowRight") {
7103
- e.preventDefault(), e.stopPropagation(), m.value || T(v.value), g(() => {
7143
+ e.preventDefault(), e.stopPropagation(), m.value || D(v.value), g(() => {
7104
7144
  (h.value?.querySelector("[role=\"menuitem\"]:not([aria-disabled=\"true\"])"))?.focus();
7105
7145
  });
7106
7146
  return;
7107
7147
  }
7108
7148
  if (e.key === "ArrowLeft") {
7109
- m.value && (e.preventDefault(), e.stopPropagation(), D(), v.value?.focus());
7149
+ m.value && (e.preventDefault(), e.stopPropagation(), k(), v.value?.focus());
7110
7150
  return;
7111
7151
  }
7112
7152
  }
7113
7153
  }
7114
- let V = null;
7115
- function H(e) {
7154
+ let H = null;
7155
+ function U(e) {
7116
7156
  if (!m.value) return;
7117
- if (e === V) {
7118
- V = null;
7157
+ if (e === H) {
7158
+ H = null;
7119
7159
  return;
7120
7160
  }
7121
- V = null;
7161
+ H = null;
7122
7162
  let t = e.target;
7123
- v.value?.contains(t) || h.value?.contains(t) || D();
7124
- }
7125
- let U = !1;
7126
- function W() {
7127
- U ||= (document.addEventListener("click", H), !0);
7163
+ v.value?.contains(t) || h.value?.contains(t) || k();
7128
7164
  }
7165
+ let W = !1;
7129
7166
  function G() {
7130
- document.removeEventListener("click", H), U = !1;
7167
+ W ||= (document.addEventListener("click", U), !0);
7168
+ }
7169
+ function K() {
7170
+ document.removeEventListener("click", U), W = !1;
7131
7171
  }
7132
7172
  return B(m, (e) => {
7133
- e ? requestAnimationFrame(() => W()) : G();
7173
+ e ? requestAnimationFrame(() => G()) : K();
7134
7174
  }), b(() => {
7135
- y?.(), L(), G(), d.destroy();
7175
+ y?.(), R(), K(), d.destroy();
7136
7176
  }), (e, r) => (S(), o("div", Vl, [s("div", {
7137
7177
  ref_key: "itemRef",
7138
7178
  ref: v,
@@ -7146,10 +7186,10 @@ var Ml = /* @__PURE__ */ Y(kl, [["render", jl], ["__scopeId", "data-v-a0d5d1e3"]
7146
7186
  "aria-controls": c,
7147
7187
  "aria-disabled": n.disabled || void 0,
7148
7188
  tabindex: C.value,
7149
- onMouseenter: A,
7150
- onMouseleave: j,
7151
- onClick: R,
7152
- onKeydown: z
7189
+ onMouseenter: j,
7190
+ onMouseleave: N,
7191
+ onClick: z,
7192
+ onKeydown: V
7153
7193
  }, [
7154
7194
  s("span", Ul, [l(X, {
7155
7195
  name: n.icon || "square-dashed",
@@ -7168,11 +7208,11 @@ var Ml = /* @__PURE__ */ Y(kl, [["render", jl], ["__scopeId", "data-v-a0d5d1e3"]
7168
7208
  ref_key: "panelRef",
7169
7209
  ref: h,
7170
7210
  class: "coar-submenu-panel",
7171
- onMouseenter: N,
7172
- onMouseleave: P
7211
+ onMouseenter: P,
7212
+ onMouseleave: I
7173
7213
  }, [O(e.$slots, "default", {}, void 0, !0)], 544)) : a("", !0)]))]));
7174
7214
  }
7175
- }), [["__scopeId", "data-v-da19ff9a"]]), Kl = /* @__PURE__ */ u({
7215
+ }), [["__scopeId", "data-v-4f413627"]]), Kl = /* @__PURE__ */ u({
7176
7216
  __name: "CoarContextMenu",
7177
7217
  props: { menu: {} },
7178
7218
  setup(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocoar/vue-ui",
3
- "version": "1.7.0",
3
+ "version": "1.9.0-script-editor.4",
4
4
  "description": "Cocoar Design System — a touch-first Vue 3 component library with 30+ accessible, themeable components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -48,7 +48,7 @@
48
48
  "lint": "eslint src/"
49
49
  },
50
50
  "dependencies": {
51
- "@cocoar/vue-localization": "1.7.0",
51
+ "@cocoar/vue-localization": "1.9.0-script-editor.4",
52
52
  "@fontsource/inter": "^5.2.8",
53
53
  "@fontsource/poppins": "^5.2.7",
54
54
  "@js-temporal/polyfill": "^0.5.1",