@indielayer/ui 1.7.2 → 1.7.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.
@@ -33,6 +33,7 @@ function onSubmit(isValid: boolean) {
33
33
  show-close
34
34
  backdrop
35
35
  is-form
36
+ size="full"
36
37
  title="Modal title"
37
38
  label="Modal label"
38
39
  description="Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sapiente, fugit."
@@ -7,13 +7,16 @@ const show3 = ref(false)
7
7
  </script>
8
8
 
9
9
  <template>
10
- <x-modal v-model="show" show-close backdrop>
10
+ <x-modal
11
+ v-model="show"
12
+ title="Header"
13
+ show-close
14
+ backdrop
15
+ size="sm"
16
+ >
11
17
  <template #image>
12
18
  <x-image src="https://images.unsplash.com/photo-1543352634-99a5d50ae78e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1742&q=80" alt=""/>
13
19
  </template>
14
- <template #header>
15
- Modal Header
16
- </template>
17
20
 
18
21
  <div>
19
22
  Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iure praesentium non id dolores vitae. Nam ratione veritatis ab cumque voluptas porro illum, voluptate perferendis ducimus dolorem optio magni assumenda dolore! Doloremque facere aliquid facilis distinctio accusamus, dolorum eligendi consequuntur molestias sapiente non rem vero sed eos minus itaque sunt officiis iste ea repellendus possimus earum maiores? Quo laudantium fuga odit tenetur sint fugit deleniti dolores placeat, accusamus magni consectetur unde totam sunt labore dolor rem consequatur quaerat! Iure temporibus voluptatem cumque, dolore maiores rerum neque vero, iusto veritatis repellat eligendi amet! Molestiae cumque officiis eius harum iste, fuga corporis molestias.
@@ -21,7 +24,7 @@ const show3 = ref(false)
21
24
 
22
25
  <template #actions>
23
26
  <div class="text-right space-x-4">
24
- <x-button>Cancel</x-button>
27
+ <x-button @click="show = false">Cancel</x-button>
25
28
  <x-button color="success">Confirm</x-button>
26
29
  </div>
27
30
  </template>
@@ -46,7 +49,7 @@ const show3 = ref(false)
46
49
  Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iure praesentium non id dolores vitae. Nam ratione veritatis ab cumque voluptas porro illum, voluptate perferendis ducimus dolorem optio magni assumenda dolore! Doloremque facere aliquid facilis distinctio accusamus, dolorum eligendi consequuntur molestias sapiente non rem vero sed eos minus itaque sunt officiis iste ea repellendus possimus earum maiores? Quo laudantium fuga odit tenetur sint fugit deleniti dolores placeat, accusamus magni consectetur unde totam sunt labore dolor rem consequatur quaerat! Iure temporibus voluptatem cumque, dolore maiores rerum neque vero, iusto veritatis repellat eligendi amet! Molestiae cumque officiis eius harum iste, fuga corporis molestias.
47
50
 
48
51
  <template #actions>
49
- <x-button>Cancel</x-button>
52
+ <x-button @click="show2 = false">Cancel</x-button>
50
53
  <x-button color="success">Confirm</x-button>
51
54
  </template>
52
55
  </x-modal>
@@ -1,4 +1,4 @@
1
- import { defineComponent as X, ref as f, watch as g, nextTick as B, useSlots as H, computed as I, openBlock as t, createBlock as p, Teleport as M, createElementBlock as r, normalizeStyle as j, unref as o, normalizeClass as a, createCommentVNode as s, createElementVNode as S, resolveDynamicComponent as K, withCtx as w, renderSlot as i, toDisplayString as v } from "vue";
1
+ import { defineComponent as X, ref as f, watch as g, nextTick as B, useSlots as H, computed as I, openBlock as l, createBlock as p, Teleport as M, createElementBlock as r, normalizeStyle as j, unref as o, normalizeClass as t, createCommentVNode as a, createElementVNode as S, resolveDynamicComponent as K, withCtx as w, renderSlot as i, toDisplayString as v } from "vue";
2
2
  import { onClickOutside as L, useEventListener as q } from "../../node_modules/.pnpm/@vueuse_core@10.2.0_vue@3.3.9/node_modules/@vueuse/core/index.js";
3
3
  import { useTheme as G } from "../../composables/useTheme.js";
4
4
  import { useFocusTrap as J } from "../../composables/useFocusTrap.js";
@@ -9,7 +9,7 @@ import Z from "../form/Form.vue.js";
9
9
  const _ = { key: 0 }, x = ["xs", "sm", "md", "lg", "xl", "full"], ee = ["top", "center", "bottom"], oe = {
10
10
  size: {
11
11
  type: String,
12
- default: "xl"
12
+ default: "lg"
13
13
  },
14
14
  position: {
15
15
  type: String,
@@ -49,38 +49,38 @@ const _ = { key: 0 }, x = ["xs", "sm", "md", "lg", "xl", "full"], ee = ["top", "
49
49
  default: () => []
50
50
  },
51
51
  persistent: Boolean
52
- }, te = {
52
+ }, le = {
53
53
  name: "XModal",
54
54
  validators: {
55
55
  size: x,
56
56
  position: ee
57
57
  }
58
- }, me = /* @__PURE__ */ X({
59
- ...te,
58
+ }, ce = /* @__PURE__ */ X({
59
+ ...le,
60
60
  props: oe,
61
61
  emits: ["update:modelValue", "submit"],
62
62
  setup($, { expose: V, emit: C }) {
63
- const n = $, b = C, u = f(n.modelValue), d = f(!1), y = f(null), T = f(null), { initFocusTrap: D, clearFocusTrap: z } = J();
64
- let m;
63
+ const n = $, b = C, u = f(n.modelValue), d = f(!1), y = f(null), T = f(null), { initFocusTrap: z, clearFocusTrap: D } = J();
64
+ let c;
65
65
  g(u, (e) => {
66
- m && (m(), m = void 0), e && setTimeout(() => {
67
- m = L(y, F, {
66
+ c && (c(), c = void 0), e && setTimeout(() => {
67
+ c = L(y, F, {
68
68
  ignore: [".v-popper__popper"]
69
69
  });
70
70
  });
71
71
  }), g(() => n.modelValue, E, { immediate: !0 });
72
72
  async function E() {
73
73
  const e = n.modelValue;
74
- e ? (u.value = e, await B(), d.value = e, await B(), D(y), document.body.style.overflow = "hidden") : (d.value = e, u.value = e, z(), document.body.style.overflow = "auto");
74
+ e ? (u.value = e, await B(), d.value = e, await B(), z(y), document.body.style.overflow = "hidden") : (d.value = e, u.value = e, D(), document.body.style.overflow = "auto");
75
75
  }
76
76
  typeof window < "u" && q(document, "keydown", A);
77
77
  function A(e) {
78
- e.key === "Escape" && u.value && !n.persistent && c();
78
+ e.key === "Escape" && u.value && !n.persistent && m();
79
79
  }
80
80
  function F() {
81
- n.persistent || c();
81
+ n.persistent || m();
82
82
  }
83
- function c() {
83
+ function m() {
84
84
  d.value = !1, setTimeout(() => {
85
85
  b("update:modelValue", !1);
86
86
  }, 150);
@@ -88,32 +88,32 @@ const _ = { key: 0 }, x = ["xs", "sm", "md", "lg", "xl", "full"], ee = ["top", "
88
88
  function O() {
89
89
  b("update:modelValue", !0), d.value = !0;
90
90
  }
91
- const k = H(), R = I(() => !!(k["tertiary-action"] || k["cancel-action"])), { styles: N, classes: l, className: P } = G("Modal", {}, n, {
91
+ const k = H(), R = I(() => !!(k["tertiary-action"] || k["cancel-action"])), { styles: N, classes: s, className: P } = G("Modal", {}, n, {
92
92
  visible: d
93
93
  });
94
- return V({ open: O, close: c }), (e, h) => (t(), p(M, { to: "body" }, [
95
- u.value ? (t(), r("div", {
94
+ return V({ open: O, close: m }), (e, h) => (l(), p(M, { to: "body" }, [
95
+ u.value ? (l(), r("div", {
96
96
  key: 0,
97
97
  ref_key: "modalWrapperRef",
98
98
  ref: T,
99
99
  style: j(o(N)),
100
- class: a([
100
+ class: t([
101
101
  o(P),
102
- o(l).wrapper,
102
+ o(s).wrapper,
103
103
  d.value ? "visible" : "invisible ease-in duration-100"
104
104
  ])
105
105
  }, [
106
- e.backdrop ? (t(), r("div", {
106
+ e.backdrop ? (l(), r("div", {
107
107
  key: 0,
108
- class: a(o(l).backdrop)
109
- }, null, 2)) : s("", !0),
108
+ class: t(o(s).backdrop)
109
+ }, null, 2)) : a("", !0),
110
110
  S("div", {
111
- class: a(o(l).modalWrapper)
111
+ class: t(o(s).modalWrapper)
112
112
  }, [
113
- (t(), p(K(e.isForm ? Z : "div"), {
113
+ (l(), p(K(e.isForm ? Z : "div"), {
114
114
  ref_key: "modalRef",
115
115
  ref: y,
116
- class: a(["max-h-full", o(l).modal]),
116
+ class: t(["max-h-full", o(s).modal]),
117
117
  disabled: e.formDisabled,
118
118
  "auto-validate": e.formAutoValidate,
119
119
  title: e.formTitle,
@@ -129,71 +129,74 @@ const _ = { key: 0 }, x = ["xs", "sm", "md", "lg", "xl", "full"], ee = ["top", "
129
129
  default: w(() => [
130
130
  i(e.$slots, "image"),
131
131
  i(e.$slots, "header", {}, () => [
132
- e.hasHeader ? (t(), r("div", {
132
+ e.hasHeader ? (l(), r("div", {
133
133
  key: 0,
134
- class: a(o(l).header)
134
+ class: t(o(s).header)
135
135
  }, [
136
136
  i(e.$slots, "header-content", {}, () => [
137
- e.label ? (t(), r("div", {
137
+ e.label ? (l(), r("div", {
138
138
  key: 0,
139
- class: a(o(l).label)
140
- }, v(e.label), 3)) : s("", !0),
141
- e.title ? (t(), r("div", {
139
+ class: t(o(s).label)
140
+ }, v(e.label), 3)) : a("", !0),
141
+ e.title ? (l(), r("div", {
142
142
  key: 1,
143
- class: a(o(l).title)
144
- }, v(e.title), 3)) : s("", !0)
143
+ class: t(o(s).title)
144
+ }, v(e.title), 3)) : a("", !0)
145
145
  ])
146
- ], 2)) : s("", !0)
146
+ ], 2)) : a("", !0)
147
147
  ]),
148
- e.$slots.default ? (t(), p(Y, {
148
+ e.$slots.default ? (l(), p(Y, {
149
149
  key: 0,
150
150
  scrollbar: !1,
151
+ class: t({
152
+ "h-full": e.size === "full"
153
+ }),
151
154
  vertical: ""
152
155
  }, {
153
156
  default: w(() => [
154
157
  S("div", {
155
- class: a(o(l).content)
158
+ class: t(o(s).content)
156
159
  }, [
157
- e.description ? (t(), r("div", {
160
+ e.description ? (l(), r("div", {
158
161
  key: 0,
159
- class: a(o(l).description)
160
- }, v(e.description), 3)) : s("", !0),
162
+ class: t(o(s).description)
163
+ }, v(e.description), 3)) : a("", !0),
161
164
  i(e.$slots, "default")
162
165
  ], 2)
163
166
  ]),
164
167
  _: 3
165
- })) : s("", !0),
166
- e.showClose ? (t(), p(U, {
168
+ }, 8, ["class"])) : a("", !0),
169
+ e.showClose ? (l(), p(U, {
167
170
  key: 1,
168
171
  ghost: "",
169
172
  size: "sm",
170
173
  tabindex: "-1",
171
174
  icon: o(Q),
172
- class: a(o(l).closeIcon),
173
- onClick: c
174
- }, null, 8, ["icon", "class"])) : s("", !0),
175
+ class: t(o(s).closeIcon),
176
+ onClick: m
177
+ }, null, 8, ["icon", "class"])) : a("", !0),
175
178
  i(e.$slots, "footer", {}, () => [
176
- e.hasActions ? (t(), r("div", {
179
+ e.hasActions ? (l(), r("div", {
177
180
  key: 0,
178
- class: a(o(l).actions)
181
+ class: t(o(s).actions)
179
182
  }, [
180
183
  i(e.$slots, "actions", {}, () => [
181
184
  i(e.$slots, "cancel-action"),
182
- R.value ? (t(), r("div", _)) : s("", !0),
185
+ R.value ? (l(), r("div", _)) : a("", !0),
183
186
  i(e.$slots, "tertiary-action"),
184
187
  i(e.$slots, "secondary-action"),
185
188
  i(e.$slots, "primary-action")
186
189
  ])
187
- ], 2)) : s("", !0)
190
+ ], 2)) : a("", !0)
188
191
  ])
189
192
  ]),
190
193
  _: 3
191
194
  }, 40, ["disabled", "auto-validate", "title", "description", "errors", "class"]))
192
195
  ], 2)
193
- ], 6)) : s("", !0)
196
+ ], 6)) : a("", !0)
194
197
  ]));
195
198
  }
196
199
  });
197
200
  export {
198
- me as default
201
+ ce as default
199
202
  };
@@ -6,12 +6,12 @@ const a = {
6
6
  return e.visible ? s.push("ease-out duration-200 opacity-30 dark:opacity-70") : s.push("ease-in duration-100 opacity-0"), s;
7
7
  },
8
8
  modalWrapper: ({ props: e }) => {
9
- const s = ["flex justify-center p-4 sm:p-8 md:py-20 h-screen"];
9
+ const s = ["flex justify-center p-4 sm:p-8 h-screen"];
10
10
  return e.position === "top" ? s.push("items-start") : e.position === "bottom" ? s.push("items-end") : s.push("items-end sm:items-center"), s;
11
11
  },
12
12
  modal: ({ props: e, data: s }) => {
13
13
  const t = ["relative flex flex-col z-10 bg-white dark:bg-secondary-900 rounded-md shadow-lg transform transition-all overflow-hidden max-h-full w-full"];
14
- return s.visible ? t.push("ease-out duration-200 opacity-100 translate-y-0 sm:scale-100") : t.push("ease-in duration-200 opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"), e.size === "xs" ? t.push("sm:max-w-xs") : e.size === "sm" ? t.push("sm:max-w-sm") : e.size === "md" ? t.push("sm:max-w-lg") : e.size === "lg" ? t.push("sm:max-w-3xl") : e.size === "xl" && t.push("sm:max-w-6xl"), t;
14
+ return s.visible ? t.push("ease-out duration-200 opacity-100 translate-y-0 sm:scale-100") : t.push("ease-in duration-200 opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"), e.size === "xs" ? t.push("sm:max-w-xs") : e.size === "sm" ? t.push("sm:max-w-sm") : e.size === "md" ? t.push("sm:max-w-lg") : e.size === "lg" ? t.push("sm:max-w-3xl") : e.size === "xl" ? t.push("sm:max-w-6xl") : e.size === "full" && t.push("h-full"), t;
15
15
  },
16
16
  closeIcon: "!absolute top-2 z-10 right-2",
17
17
  header: "text-lg pl-6 py-4 border-b pr-12",
@@ -21,7 +21,7 @@ const a = {
21
21
  title: "text-xl font-semibold",
22
22
  description: "text-sm mb-8"
23
23
  }
24
- }, i = a;
24
+ }, l = a;
25
25
  export {
26
- i as default
26
+ l as default
27
27
  };
@@ -1,29 +1,29 @@
1
1
  const a = {
2
2
  classes: {
3
3
  wrapper: "fixed z-40 inset-0 overflow-y-auto transition-all",
4
- backdrop: ({ data: t }) => {
5
- const e = ["fixed inset-0 bg-secondary-500 dark:bg-black transition-opacity"];
6
- return t.visible ? e.push("ease-out duration-200 opacity-70 dark:opacity-70") : e.push("ease-in duration-100 opacity-0"), e;
4
+ backdrop: ({ data: e }) => {
5
+ const t = ["fixed inset-0 bg-secondary-500 dark:bg-black transition-opacity"];
6
+ return e.visible ? t.push("ease-out duration-200 opacity-70 dark:opacity-70") : t.push("ease-in duration-100 opacity-0"), t;
7
7
  },
8
- modal: ({ props: t, data: e }) => {
8
+ modal: ({ props: e, data: t }) => {
9
9
  const s = ["relative flex flex-col z-10 bg-secondary-200 dark:bg-secondary-900 shadow-lg transform transition-all overflow-hidden max-h-full w-full"];
10
- return e.visible ? s.push("ease-out duration-200 opacity-100 translate-y-0 sm:scale-100") : s.push("ease-in duration-200 opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"), t.size === "xs" ? s.push("sm:max-w-xs") : t.size === "sm" ? s.push("sm:max-w-sm") : t.size === "md" ? s.push("sm:max-w-lg") : t.size === "lg" ? s.push("sm:max-w-3xl") : t.size === "xl" && s.push("sm:max-w-6xl"), s;
10
+ return t.visible ? s.push("ease-out duration-200 opacity-100 translate-y-0 sm:scale-100") : s.push("ease-in duration-200 opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"), e.size === "xs" ? s.push("sm:max-w-xs") : e.size === "sm" ? s.push("sm:max-w-sm") : e.size === "md" ? s.push("sm:max-w-lg") : e.size === "lg" ? s.push("sm:max-w-3xl") : e.size === "xl" ? s.push("sm:max-w-6xl") : e.size === "full" && s.push("h-full"), s;
11
11
  },
12
12
  closeIcon: "!absolute top-0 z-10 right-0",
13
13
  header: "text-lg pl-4 pt-4 pr-12",
14
- content: ({ props: t }) => {
15
- const e = ["pb-8"];
16
- return t.fluid || e.push("px-4"), e;
14
+ content: ({ props: e }) => {
15
+ const t = ["pb-8"];
16
+ return e.fluid || t.push("px-4"), t;
17
17
  },
18
- actions: ({ props: t, slots: e }) => {
18
+ actions: ({ props: e, slots: t }) => {
19
19
  const s = ["grid grid-flow-col gap-[1px]"];
20
- return e["tertiary-action"] || e["cancel-action"] ? s.push("grid-cols-4") : s.push("grid-cols-2"), s;
20
+ return t["tertiary-action"] || t["cancel-action"] ? s.push("grid-cols-4") : s.push("grid-cols-2"), s;
21
21
  },
22
22
  label: "text-xs text-secondary-500 mb-1",
23
23
  title: "text-xl mb-4",
24
24
  description: "text-sm mb-4"
25
25
  }
26
- }, i = a;
26
+ }, l = a;
27
27
  export {
28
- i as default
28
+ l as default
29
29
  };