@indielayer/ui 1.10.5 → 1.11.0

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.
@@ -38,5 +38,13 @@ const options = ref([
38
38
  multiple
39
39
  truncate
40
40
  />
41
+ <x-select
42
+ v-model="selectedMultiple"
43
+ label="Multi select - checkbox"
44
+ placeholder="Multiple"
45
+ :options="options"
46
+ multiple-checkbox
47
+ filterable
48
+ />
41
49
  </div>
42
50
  </template>
@@ -34,6 +34,7 @@ declare const menuItemProps: {
34
34
  minimal: BooleanConstructor;
35
35
  prefix: StringConstructor;
36
36
  suffix: StringConstructor;
37
+ checkbox: BooleanConstructor;
37
38
  color: {
38
39
  readonly type: StringConstructor;
39
40
  readonly default: string | undefined;
@@ -84,6 +85,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
84
85
  minimal: BooleanConstructor;
85
86
  prefix: StringConstructor;
86
87
  suffix: StringConstructor;
88
+ checkbox: BooleanConstructor;
87
89
  color: {
88
90
  readonly type: StringConstructor;
89
91
  readonly default: string | undefined;
@@ -93,7 +95,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
93
95
  readonly default: "md";
94
96
  readonly validator: (value: string) => boolean;
95
97
  };
96
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "active")[], "click" | "active", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
98
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "active" | "checkbox-click")[], "click" | "active" | "checkbox-click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
97
99
  item: {
98
100
  type: PropType<MenuArrayItem>;
99
101
  default: () => void;
@@ -126,6 +128,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
126
128
  minimal: BooleanConstructor;
127
129
  prefix: StringConstructor;
128
130
  suffix: StringConstructor;
131
+ checkbox: BooleanConstructor;
129
132
  color: {
130
133
  readonly type: StringConstructor;
131
134
  readonly default: string | undefined;
@@ -138,6 +141,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
138
141
  }>> & Readonly<{
139
142
  onClick?: ((...args: any[]) => any) | undefined;
140
143
  onActive?: ((...args: any[]) => any) | undefined;
144
+ "onCheckbox-click"?: ((...args: any[]) => any) | undefined;
141
145
  }>, {
142
146
  disabled: boolean;
143
147
  color: string;
@@ -151,6 +155,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
151
155
  attrs: Record<string, any>;
152
156
  exact: boolean;
153
157
  selected: boolean;
158
+ checkbox: boolean;
154
159
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
155
160
  prefix?(_: {
156
161
  item: MenuItemProps;
@@ -3,7 +3,7 @@ import o from "./MenuItem.vue3.js";
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  const e = {
5
5
  $style: o
6
- }, c = /* @__PURE__ */ t(s, [["__cssModules", e], ["__scopeId", "data-v-47a57bf7"]]);
6
+ }, _ = /* @__PURE__ */ t(s, [["__cssModules", e], ["__scopeId", "data-v-4c0f9774"]]);
7
7
  export {
8
- c as default
8
+ _ as default
9
9
  };
@@ -1,19 +1,19 @@
1
- import { defineComponent as z, ref as k, computed as g, onMounted as N, watch as h, openBlock as l, createBlock as i, resolveDynamicComponent as R, mergeProps as I, unref as s, withCtx as M, createElementBlock as r, renderSlot as n, createTextVNode as u, toDisplayString as c, createCommentVNode as f, createElementVNode as O, Fragment as P } from "vue";
2
- import { useMutationObserver as j } from "../../node_modules/.pnpm/@vueuse_core@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js";
3
- import { useColors as w } from "../../composables/useColors.js";
4
- import { useCommon as $ } from "../../composables/useCommon.js";
5
- import { useTheme as D } from "../../composables/useTheme.js";
6
- import y from "../icon/Icon.vue.js";
7
- import F from "../spinner/Spinner.vue.js";
8
- const T = {
9
- key: 0,
1
+ import { defineComponent as R, ref as y, computed as b, onMounted as w, watch as x, resolveComponent as I, openBlock as l, createBlock as r, resolveDynamicComponent as O, mergeProps as P, unref as c, withCtx as j, withModifiers as D, createCommentVNode as s, createElementBlock as n, renderSlot as v, createTextVNode as f, toDisplayString as m, createElementVNode as F, Fragment as T } from "vue";
2
+ import { useMutationObserver as V } from "../../node_modules/.pnpm/@vueuse_core@11.1.0_vue@3.5.10_typescript@5.2.2_/node_modules/@vueuse/core/index.js";
3
+ import { useColors as E } from "../../composables/useColors.js";
4
+ import { useCommon as C } from "../../composables/useCommon.js";
5
+ import { useTheme as A } from "../../composables/useTheme.js";
6
+ import $ from "../icon/Icon.vue.js";
7
+ import L from "../spinner/Spinner.vue.js";
8
+ const X = {
9
+ key: 1,
10
10
  class: "mr-2 shrink-0"
11
- }, V = {
12
- key: 2,
11
+ }, q = {
12
+ key: 3,
13
13
  class: "flex-1 truncate"
14
- }, E = { class: "ml-1 shrink-0" }, A = { key: 0 }, L = {
15
- ...$.props(),
16
- ...w.props("secondary"),
14
+ }, G = { class: "ml-1 shrink-0" }, H = { key: 0 }, J = {
15
+ ...C.props(),
16
+ ...E.props("secondary"),
17
17
  item: {
18
18
  type: Object,
19
19
  default: () => {
@@ -47,108 +47,119 @@ const T = {
47
47
  disabled: Boolean,
48
48
  minimal: Boolean,
49
49
  prefix: String,
50
- suffix: String
51
- }, X = {
50
+ suffix: String,
51
+ checkbox: Boolean
52
+ }, K = {
52
53
  name: "XMenuItem",
53
54
  validators: {
54
- ...$.validators()
55
+ ...C.validators()
55
56
  }
56
- }, Y = /* @__PURE__ */ z({
57
- ...X,
58
- props: L,
59
- emits: ["active", "click"],
60
- setup(b, { emit: _ }) {
61
- const v = b, m = _, a = k(), o = k(!1), e = g(() => ({
62
- ...v,
63
- ...v.item
64
- })), p = g(() => e.value.to ? "router-link" : e.value.href ? "a" : "div");
65
- N(() => {
66
- a.value && (d(), p.value === "router-link" && j(a.value.$el, d, {
57
+ }, le = /* @__PURE__ */ R({
58
+ ...K,
59
+ props: J,
60
+ emits: ["active", "click", "checkbox-click"],
61
+ setup(B, { emit: S }) {
62
+ const p = B, d = S, o = y(), a = y(!1), e = b(() => ({
63
+ ...p,
64
+ ...p.item
65
+ })), k = b(() => e.value.to ? "router-link" : e.value.href ? "a" : "div");
66
+ w(() => {
67
+ o.value && (g(), k.value === "router-link" && V(o.value.$el, g, {
67
68
  attributes: !0,
68
69
  attributeFilter: ["class"]
69
70
  }));
70
71
  });
71
- function x(t) {
72
+ function h(t, i) {
72
73
  if (e.value.disabled) {
73
74
  t.stopPropagation(), t.preventDefault();
74
75
  return;
75
76
  }
76
- e.value.onClick && e.value.onClick(t), m("click", t);
77
+ e.value.onClick && e.value.onClick(t), d(i, t);
77
78
  }
78
- function d() {
79
- if (a.value && a.value.$el && (e.value.href || e.value.to)) {
80
- const t = a.value.$el.classList.contains(e.value.exact ? "router-link-exact-active" : "router-link-active") || !1;
81
- o.value = t;
79
+ function g() {
80
+ if (o.value && o.value.$el && (e.value.href || e.value.to)) {
81
+ const t = o.value.$el.classList.contains(e.value.exact ? "router-link-exact-active" : "router-link-active") || !1;
82
+ a.value = t;
82
83
  } else
83
- o.value = !!e.value.active;
84
+ a.value = !!e.value.active;
84
85
  }
85
- h(() => o.value, (t) => {
86
- t && m("active");
87
- }), h(() => e.value.active, (t) => {
88
- o.value = !!t;
86
+ x(() => a.value, (t) => {
87
+ t && d("active");
88
+ }), x(() => e.value.active, (t) => {
89
+ a.value = !!t;
89
90
  });
90
- const { styles: B, classes: C, className: S } = D("MenuItem", {}, e, { isActive: o });
91
- return (t, q) => (l(), i(R(p.value), I({
92
- ref_key: "elRef",
93
- ref: a
94
- }, {
95
- ...e.value.href ? { href: e.value.href } : {},
96
- ...e.value.attrs
97
- }, {
98
- to: e.value.to,
99
- target: e.value.target,
100
- color: e.value.color,
101
- style: s(B),
102
- class: [
103
- s(S),
104
- t.$style["menu-item"],
105
- [o.value ? t.$style["menu-item--active"] : ""],
106
- s(C).wrapper,
107
- {
108
- "flex items-center": t.$slots.prefix || t.$slots.suffix
109
- }
110
- ],
111
- title: e.value.label,
112
- alt: e.value.label,
113
- onClick: x
114
- }), {
115
- default: M(() => [
116
- t.$slots.prefix || e.value.prefix ? (l(), r("span", T, [
117
- n(t.$slots, "prefix", { item: e.value }, () => [
118
- u(c(e.value.prefix), 1)
119
- ], !0)
120
- ])) : e.value.icon ? (l(), i(y, {
121
- key: 1,
122
- size: e.value.size,
123
- icon: e.value.icon,
124
- class: "mr-2"
125
- }, null, 8, ["size", "icon"])) : f("", !0),
126
- t.minimal ? f("", !0) : (l(), r("span", V, [
127
- n(t.$slots, "default", { item: e.value }, () => [
128
- u(c(e.value.label), 1)
129
- ], !0)
130
- ])),
131
- O("span", E, [
132
- e.value.loading ? (l(), i(F, {
91
+ const { styles: z, classes: _, className: M } = A("MenuItem", {}, e, { isActive: a });
92
+ return (t, i) => {
93
+ const N = I("x-checkbox");
94
+ return l(), r(O(k.value), P({
95
+ ref_key: "elRef",
96
+ ref: o
97
+ }, {
98
+ ...e.value.href ? { href: e.value.href } : {},
99
+ ...e.value.attrs
100
+ }, {
101
+ to: e.value.to,
102
+ target: e.value.target,
103
+ color: e.value.color,
104
+ style: c(z),
105
+ class: [
106
+ c(M),
107
+ t.$style["menu-item"],
108
+ [a.value && !t.checkbox ? t.$style["menu-item--active"] : ""],
109
+ c(_).wrapper,
110
+ {
111
+ "flex items-center": t.$slots.prefix || t.$slots.suffix
112
+ }
113
+ ],
114
+ title: e.value.label,
115
+ alt: e.value.label,
116
+ onClick: i[1] || (i[1] = (u) => h(u, "click"))
117
+ }), {
118
+ default: j(() => [
119
+ t.checkbox ? (l(), r(N, {
133
120
  key: 0,
134
- size: e.value.size
135
- }, null, 8, ["size"])) : (l(), r(P, { key: 1 }, [
136
- t.$slots.suffix || e.value.suffix ? (l(), r("span", A, [
137
- n(t.$slots, "suffix", { item: e.value }, () => [
138
- u(c(e.value.suffix), 1)
139
- ], !0)
140
- ])) : e.value.iconRight ? (l(), i(y, {
141
- key: 1,
142
- size: e.value.size,
143
- icon: e.value.iconRight
144
- }, null, 8, ["size", "icon"])) : f("", !0)
145
- ], 64))
146
- ])
147
- ]),
148
- _: 3
149
- }, 16, ["to", "target", "color", "style", "class", "title", "alt"]));
121
+ "model-value": e.value.active,
122
+ "hide-footer": "",
123
+ "skip-form-registry": "",
124
+ onClick: i[0] || (i[0] = D((u) => h(u, "checkbox-click"), ["stop", "prevent"]))
125
+ }, null, 8, ["model-value"])) : s("", !0),
126
+ t.$slots.prefix || e.value.prefix ? (l(), n("span", X, [
127
+ v(t.$slots, "prefix", { item: e.value }, () => [
128
+ f(m(e.value.prefix), 1)
129
+ ], !0)
130
+ ])) : e.value.icon ? (l(), r($, {
131
+ key: 2,
132
+ size: e.value.size,
133
+ icon: e.value.icon,
134
+ class: "mr-2"
135
+ }, null, 8, ["size", "icon"])) : s("", !0),
136
+ t.minimal ? s("", !0) : (l(), n("span", q, [
137
+ v(t.$slots, "default", { item: e.value }, () => [
138
+ f(m(e.value.label), 1)
139
+ ], !0)
140
+ ])),
141
+ F("span", G, [
142
+ e.value.loading ? (l(), r(L, {
143
+ key: 0,
144
+ size: e.value.size
145
+ }, null, 8, ["size"])) : (l(), n(T, { key: 1 }, [
146
+ t.$slots.suffix || e.value.suffix ? (l(), n("span", H, [
147
+ v(t.$slots, "suffix", { item: e.value }, () => [
148
+ f(m(e.value.suffix), 1)
149
+ ], !0)
150
+ ])) : e.value.iconRight ? (l(), r($, {
151
+ key: 1,
152
+ size: e.value.size,
153
+ icon: e.value.iconRight
154
+ }, null, 8, ["size", "icon"])) : s("", !0)
155
+ ], 64))
156
+ ])
157
+ ]),
158
+ _: 3
159
+ }, 16, ["to", "target", "color", "style", "class", "title", "alt"]);
160
+ };
150
161
  }
151
162
  });
152
163
  export {
153
- Y as default
164
+ le as default
154
165
  };
@@ -5,15 +5,15 @@ const l = {
5
5
  return s.disabled || t.push("cursor-pointer"), r.isActive && t.push("font-medium"), s.rounded && t.push("rounded"), s.size === "xs" ? t.push("py-1 text-xs") : s.size === "sm" ? t.push("py-1.5 text-sm") : s.size === "lg" ? t.push("py-3") : s.size === "xl" ? t.push("py-4 text-lg") : t.push("py-1.5"), t;
6
6
  }
7
7
  },
8
- styles: ({ colors: s, props: r, css: t, data: a }) => {
9
- const e = s.getPalette(r.color || "gray"), i = s.getPalette("secondary");
8
+ styles: ({ colors: s, props: r, css: t, data: i }) => {
9
+ const e = s.getPalette(r.color || "gray"), a = s.getPalette("secondary");
10
10
  return r.disabled ? t.variables({
11
- text: i[300],
11
+ text: a[300],
12
12
  dark: {
13
- text: i[600]
13
+ text: a[600]
14
14
  }
15
- }) : r.filled ? a.isActive ? t.variables({
16
- bg: r.selected ? e[100] : e[200],
15
+ }) : r.filled ? i.isActive ? t.variables({
16
+ bg: r.selected ? e[100] : r.checkbox ? "transparent" : e[200],
17
17
  text: e[800],
18
18
  hover: {
19
19
  bg: (r.selected, e[200]),
@@ -42,7 +42,7 @@ const l = {
42
42
  text: e[100]
43
43
  }
44
44
  }
45
- }) : a.isActive ? t.variables({
45
+ }) : i.isActive ? t.variables({
46
46
  text: e[500],
47
47
  hover: {
48
48
  text: e[500],
@@ -56,21 +56,21 @@ const l = {
56
56
  }
57
57
  }
58
58
  }) : t.variables({
59
- text: i[800],
59
+ text: a[800],
60
60
  hover: {
61
- text: i[900],
62
- border: i[300]
61
+ text: a[900],
62
+ border: a[300]
63
63
  },
64
64
  dark: {
65
- text: i[300],
65
+ text: a[300],
66
66
  hover: {
67
- text: i[200],
68
- border: i[800]
67
+ text: a[200],
68
+ border: a[800]
69
69
  }
70
70
  }
71
71
  });
72
72
  }
73
- }, d = l;
73
+ }, x = l;
74
74
  export {
75
- d as default
75
+ x as default
76
76
  };