@sendelius/vue 0.4.2 → 0.4.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.
Files changed (88) hide show
  1. package/dist/Autocomplete.css +1 -0
  2. package/dist/Btn.css +1 -0
  3. package/dist/Checkbox.css +1 -0
  4. package/dist/Confirm.css +1 -0
  5. package/dist/Cookie.css +1 -0
  6. package/dist/Error.css +1 -0
  7. package/dist/Input.css +1 -0
  8. package/dist/InputCity.css +1 -0
  9. package/dist/InputDate-CRpVPH9p.js +9795 -0
  10. package/dist/InputDate.css +1 -0
  11. package/dist/InputPassword.css +1 -0
  12. package/dist/InputPhone-CTq4y49q.js +272 -0
  13. package/dist/Popup-BIJpeS3t.js +150 -0
  14. package/dist/Popup.css +1 -0
  15. package/dist/Progress.css +1 -0
  16. package/dist/Select.css +1 -0
  17. package/dist/Success.css +1 -0
  18. package/dist/Table.css +1 -0
  19. package/dist/TableFooter.css +1 -0
  20. package/dist/TableHeader.css +1 -0
  21. package/dist/TableItems.css +1 -0
  22. package/dist/TablePagination.css +1 -0
  23. package/dist/Warning.css +1 -0
  24. package/dist/_plugin-vue_export-helper-Djzt4Yr7.js +7 -0
  25. package/dist/index.js +210 -0
  26. package/dist/ui/btn/Btn.d.ts +4 -0
  27. package/dist/ui/btn/Btn.js +102 -0
  28. package/dist/ui/btn/Btn.vue.d.ts +9 -3
  29. package/dist/ui/cookie/Cookie.d.ts +4 -0
  30. package/dist/ui/cookie/Cookie.js +22 -0
  31. package/dist/ui/cookie/Cookie.vue.d.ts +5 -1
  32. package/dist/ui/form/Autocomplete.d.ts +4 -0
  33. package/dist/ui/form/Autocomplete.js +172 -0
  34. package/dist/ui/form/Autocomplete.vue.d.ts +12 -6
  35. package/dist/ui/form/Checkbox.d.ts +4 -0
  36. package/dist/ui/form/Checkbox.js +69 -0
  37. package/dist/ui/form/Checkbox.vue.d.ts +9 -3
  38. package/dist/ui/form/Input.d.ts +4 -0
  39. package/dist/ui/form/Input.js +92 -0
  40. package/dist/ui/form/Input.vue.d.ts +7 -2
  41. package/dist/ui/form/InputCity.d.ts +4 -0
  42. package/dist/ui/form/InputCity.js +86 -0
  43. package/dist/ui/form/InputDate.d.ts +4 -0
  44. package/dist/ui/form/InputDate.js +1 -0
  45. package/dist/ui/form/InputDate.vue.d.ts +7 -2
  46. package/dist/ui/form/InputPassword.d.ts +4 -0
  47. package/dist/ui/form/InputPassword.js +100 -0
  48. package/dist/ui/form/InputPassword.vue.d.ts +7 -2
  49. package/dist/ui/form/InputPhone.d.ts +4 -0
  50. package/dist/ui/form/InputPhone.js +1 -0
  51. package/dist/ui/form/Select.d.ts +4 -0
  52. package/dist/ui/form/Select.js +76 -0
  53. package/dist/ui/form/Select.vue.d.ts +9 -3
  54. package/dist/ui/notice/Error.d.ts +4 -0
  55. package/dist/ui/notice/Error.js +84 -0
  56. package/dist/ui/notice/Error.vue.d.ts +9 -3
  57. package/dist/ui/notice/Success.d.ts +4 -0
  58. package/dist/ui/notice/Success.js +70 -0
  59. package/dist/ui/notice/Success.vue.d.ts +7 -2
  60. package/dist/ui/notice/Warning.d.ts +4 -0
  61. package/dist/ui/notice/Warning.js +74 -0
  62. package/dist/ui/notice/Warning.vue.d.ts +7 -2
  63. package/dist/ui/popup/Confirm.d.ts +4 -0
  64. package/dist/ui/popup/Confirm.js +61 -0
  65. package/dist/ui/popup/Popup.d.ts +4 -0
  66. package/dist/ui/popup/Popup.js +1 -0
  67. package/dist/ui/progress/Progress.d.ts +4 -0
  68. package/dist/ui/progress/Progress.js +23 -0
  69. package/dist/ui/table/Table.d.ts +4 -0
  70. package/dist/ui/table/Table.js +178 -0
  71. package/dist/ui/table/Table.vue.d.ts +21 -12
  72. package/dist/ui/table/TableFilters.d.ts +4 -0
  73. package/dist/ui/table/TableFilters.js +8 -0
  74. package/dist/ui/table/TableFooter.d.ts +4 -0
  75. package/dist/ui/table/TableFooter.js +142 -0
  76. package/dist/ui/table/TableFooter.vue.d.ts +9 -3
  77. package/dist/ui/table/TableHeader.d.ts +4 -0
  78. package/dist/ui/table/TableHeader.js +157 -0
  79. package/dist/ui/table/TableHeader.vue.d.ts +7 -2
  80. package/dist/ui/table/TableItems.d.ts +4 -0
  81. package/dist/ui/table/TableItems.js +83 -0
  82. package/dist/ui/table/TableItems.vue.d.ts +12 -9
  83. package/dist/ui/table/TablePagination.d.ts +4 -0
  84. package/dist/ui/table/TablePagination.js +92 -0
  85. package/dist/ui/table/TablePagination.vue.d.ts +7 -2
  86. package/package.json +16 -13
  87. package/dist/sendelius-vue.css +0 -2
  88. package/dist/sendelius-vue.js +0 -11918
package/dist/index.js ADDED
@@ -0,0 +1,210 @@
1
+ import e from "./ui/progress/Progress.js";
2
+ import t from "./ui/btn/Btn.js";
3
+ import n from "./ui/cookie/Cookie.js";
4
+ import r from "./ui/form/Input.js";
5
+ import i from "./ui/form/Autocomplete.js";
6
+ import { t as a } from "./InputPhone-CTq4y49q.js";
7
+ import o from "./ui/form/Select.js";
8
+ import s from "./ui/form/InputCity.js";
9
+ import { t as c } from "./InputDate-CRpVPH9p.js";
10
+ import l from "./ui/form/InputPassword.js";
11
+ import u from "./ui/form/Checkbox.js";
12
+ import d from "./ui/notice/Warning.js";
13
+ import f from "./ui/notice/Error.js";
14
+ import p from "./ui/notice/Success.js";
15
+ import { n as m, t as h } from "./Popup-BIJpeS3t.js";
16
+ import g from "./ui/table/Table.js";
17
+ import _ from "axios";
18
+ import { defineStore as v } from "pinia";
19
+ import { ref as y } from "vue";
20
+ // src/config/config.js
21
+ var b = {
22
+ router: null,
23
+ baseURL: "",
24
+ baseTitle: "",
25
+ baseTitleSeparator: " - ",
26
+ routeAfterLogin: "/app/",
27
+ routeAfterLogout: "/",
28
+ urlUserInfo: "/auth/me",
29
+ urlLogin: "/auth/login",
30
+ urlLogout: "/auth/logout",
31
+ onUnauthorized: null,
32
+ onLogout: null
33
+ }, x = (e = {}) => {
34
+ b = {
35
+ ...b,
36
+ ...e
37
+ };
38
+ }, S = () => b, C = null, w = () => (C = _.create({
39
+ baseURL: S().baseURL,
40
+ withCredentials: !0,
41
+ headers: {
42
+ "Content-Type": "application/json",
43
+ Accept: "application/json"
44
+ }
45
+ }), C), T = () => {
46
+ if (!C) throw Error("@sendelius/vue: initApi() должен быть запущен до getClient().");
47
+ return C;
48
+ }, E = class extends Error {
49
+ constructor({ status: e = null, data: t = null } = {}) {
50
+ let n = t?.error, r = {
51
+ code: n?.code ?? "UNKNOWN_ERROR",
52
+ message: n?.message ?? "неизвестная ошибка",
53
+ field: n?.field ?? null
54
+ };
55
+ super(r.message), this.name = "ApiError", this.status = e, this.data = t, this.error = r, this.field = r.field;
56
+ }
57
+ };
58
+ // src/api/requests.js
59
+ async function D(e, t = {}, n = {}) {
60
+ return M("get", e, {
61
+ params: t,
62
+ ...n
63
+ });
64
+ }
65
+ async function O(e, t = {}, n = {}) {
66
+ return M("post", e, t, n);
67
+ }
68
+ async function k(e, t = {}, n = {}) {
69
+ return M("put", e, t, n);
70
+ }
71
+ async function A(e, t = {}, n = {}) {
72
+ return M("patch", e, t, n);
73
+ }
74
+ async function j(e, t = {}, n = {}) {
75
+ return M("delete", e, t, n);
76
+ }
77
+ async function M(e, t, n = {}, r = {}) {
78
+ let i;
79
+ try {
80
+ i = e === "get" ? await T().get(t, n) : e === "delete" ? await T().delete(t, {
81
+ data: n,
82
+ ...r
83
+ }) : await T()[e](t, n, r);
84
+ } catch (e) {
85
+ throw e.response?.status === 401 && S().onUnauthorized?.(), new E({
86
+ status: e.response?.status ?? null,
87
+ data: e.response?.data ?? null
88
+ });
89
+ }
90
+ let a = i.data;
91
+ if (a?.status !== "success") throw new E({
92
+ status: i.status,
93
+ data: a
94
+ });
95
+ return a;
96
+ }
97
+ // src/auth/auth.js
98
+ var N = v("auth", {
99
+ state: () => ({
100
+ user: {},
101
+ avatar: {
102
+ color: "#000000",
103
+ initials: "",
104
+ image: ""
105
+ },
106
+ isAuth: !1,
107
+ isInit: !1
108
+ }),
109
+ actions: {
110
+ async init(e = !0) {
111
+ if (this.isInit && e) return this.isAuth;
112
+ try {
113
+ let e = await D(S().urlUserInfo);
114
+ e?.user ? (this.user = e.user, this.avatar = e.user.avatar ?? this.avatar, this.isAuth = !0) : this.clear();
115
+ } catch {
116
+ this.clear();
117
+ } finally {
118
+ this.isInit = !0;
119
+ }
120
+ return this.isAuth;
121
+ },
122
+ async login(e, t, n) {
123
+ n ||= "";
124
+ try {
125
+ await O(S().urlLogin, {
126
+ login: e,
127
+ password: t,
128
+ captcha: n
129
+ }), await this.init(!1);
130
+ let r = S().router;
131
+ return r && await r.push(S().routeAfterLogin), !0;
132
+ } catch (e) {
133
+ throw e;
134
+ }
135
+ },
136
+ async logout() {
137
+ try {
138
+ await j(S().urlLogout);
139
+ } finally {
140
+ this.clear(), S().onLogout?.();
141
+ let e = S().router;
142
+ e && await e.push(S().routeAfterLogout);
143
+ }
144
+ },
145
+ clear() {
146
+ this.user = {}, this.avatar = {
147
+ color: "#000000",
148
+ initials: "",
149
+ image: ""
150
+ }, this.isAuth = !1;
151
+ }
152
+ }
153
+ });
154
+ function P() {
155
+ return N();
156
+ }
157
+ // src/captcha/captcha.js
158
+ async function F() {
159
+ let e = await I(), t = await R(e.challenge);
160
+ return L(e.id, t);
161
+ }
162
+ async function I() {
163
+ return D("/captcha/challenge");
164
+ }
165
+ async function L(e, t) {
166
+ return (await O("/captcha/verify", {
167
+ id: e,
168
+ nonce: t
169
+ }))?.token;
170
+ }
171
+ async function R(e) {
172
+ let t = "0".repeat(4), n = 0;
173
+ for (;;) {
174
+ if ((await z(`${e}:${n}`)).startsWith(t)) return n;
175
+ n++;
176
+ }
177
+ }
178
+ async function z(e) {
179
+ let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
180
+ return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
181
+ }
182
+ // src/captcha/store.js
183
+ var B = v("captcha", () => {
184
+ let e = y(""), t = y(!1), n = y(!1), r = null;
185
+ return {
186
+ token: e,
187
+ isInit: t,
188
+ isLoading: n,
189
+ init: async () => t.value ? e.value : r || (n.value = !0, r = F().then((n) => (e.value = n, t.value = !0, n)).finally(() => {
190
+ n.value = !1, r = null;
191
+ }), r)
192
+ };
193
+ });
194
+ function V() {
195
+ return B();
196
+ }
197
+ // src/helpers/declension.js
198
+ function H(e, t, n, r) {
199
+ let i = Math.abs(e) % 100, a = i % 10, o;
200
+ return o = i >= 11 && i <= 19 ? r : a === 1 ? t : a >= 2 && a <= 4 ? n : r, `${e} ${o}`;
201
+ }
202
+ // src/helpers/title.js
203
+ function U(e, t, n) {
204
+ t ??= S().baseTitle, n ??= S().baseTitleSeparator, t || (n = ""), document.title = e ? `${e}${n}${t}` : t;
205
+ }
206
+ // src/helpers/objects.js
207
+ function W(e) {
208
+ return Array.isArray(e) ? e.length === 0 : e && typeof e == "object" ? Object.keys(e).length === 0 : !0;
209
+ }
210
+ export { E as ApiError, i as SndAutocomplete, t as SndBtn, u as SndCheckbox, n as SndCookie, f as SndError, r as SndInput, s as SndInputCity, c as SndInputDate, l as SndInputPassword, a as SndInputPhone, h as SndPopup, e as SndProgress, o as SndSelect, p as SndSuccess, g as SndTable, d as SndWarning, x as configure, H as declension, D as get, T as getClient, S as getConfig, w as initApi, W as isEmpty, A as patch, O as post, k as put, j as remove, M as request, U as setTitle, P as useAuth, V as useCaptcha, m as usePopup };
@@ -0,0 +1,4 @@
1
+ export {}
2
+ import _default from './Btn.vue.js'
3
+ export default _default
4
+ export {}
@@ -0,0 +1,102 @@
1
+ import e from "../progress/Progress.js";
2
+ import { t } from "../../_plugin-vue_export-helper-Djzt4Yr7.js";
3
+ import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createVNode as o, normalizeClass as s, openBlock as c, renderSlot as l, resolveComponent as u, withCtx as d } from "vue";
4
+ import '../../Btn.css';// src/ui/btn/Btn.vue
5
+ var f = ["href"], p = /*#__PURE__*/ t({
6
+ __name: "Btn",
7
+ props: {
8
+ href: {
9
+ type: String,
10
+ default: ""
11
+ },
12
+ to: {
13
+ type: String,
14
+ default: ""
15
+ },
16
+ size: {
17
+ type: String,
18
+ default: "",
19
+ validator: (e) => [
20
+ "",
21
+ "small",
22
+ "big"
23
+ ].includes(e)
24
+ },
25
+ variant: {
26
+ type: String,
27
+ default: "",
28
+ validator: (e) => [
29
+ "",
30
+ "outline",
31
+ "gray",
32
+ "red",
33
+ "green"
34
+ ].includes(e)
35
+ },
36
+ hover: {
37
+ type: String,
38
+ default: "",
39
+ validator: (e) => [
40
+ "",
41
+ "blue",
42
+ "red",
43
+ "green"
44
+ ].includes(e)
45
+ },
46
+ progressLabel: {
47
+ type: String,
48
+ default: ""
49
+ },
50
+ progressShow: {
51
+ type: Boolean,
52
+ default: !1
53
+ },
54
+ withIcon: {
55
+ type: Boolean,
56
+ default: !1
57
+ }
58
+ },
59
+ setup(t) {
60
+ let p = t, m = n(() => [{
61
+ "btn-big": p.size === "big",
62
+ "btn-small": p.size === "small",
63
+ "btn-outline": p.variant === "outline",
64
+ "btn-gray": p.variant === "gray",
65
+ "btn-red": p.variant === "red",
66
+ "btn-green": p.variant === "green",
67
+ "btn-hover-blue": p.hover === "blue",
68
+ "btn-hover-red": p.hover === "red",
69
+ "btn-hover-green": p.hover === "green",
70
+ "btn-progress": p.progressLabel,
71
+ "btn-with-icon": p.withIcon
72
+ }]);
73
+ return (n, p) => {
74
+ let h = u("RouterLink");
75
+ return t.to ? (c(), r(h, {
76
+ key: 0,
77
+ to: t.to,
78
+ class: s(["btn", m.value])
79
+ }, {
80
+ default: d(() => [o(e, {
81
+ show: t.progressShow,
82
+ label: t.progressLabel
83
+ }, null, 8, ["show", "label"]), t.progressShow ? i("", !0) : l(n.$slots, "default", {}, void 0, !0, 0)]),
84
+ _: 3
85
+ }, 8, ["to", "class"])) : t.href ? (c(), a("a", {
86
+ key: 1,
87
+ href: t.href,
88
+ class: s(["btn", m.value])
89
+ }, [o(e, {
90
+ show: t.progressShow,
91
+ label: t.progressLabel
92
+ }, null, 8, ["show", "label"]), t.progressShow ? i("", !0) : l(n.$slots, "default", {}, void 0, !0, 0)], 10, f)) : (c(), a("button", {
93
+ key: 2,
94
+ class: s(["btn", m.value])
95
+ }, [o(e, {
96
+ show: t.progressShow,
97
+ label: t.progressLabel
98
+ }, null, 8, ["show", "label"]), t.progressShow ? i("", !0) : l(n.$slots, "default", {}, void 0, !0, 0)], 2));
99
+ };
100
+ }
101
+ }, [["__scopeId", "data-v-a0ffba5d"]]);
102
+ export { p as default };
@@ -1,7 +1,13 @@
1
1
  declare const component: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
- declare var __VLS_12: {};
3
- declare var __VLS_19: {};
4
- declare var __VLS_26: {};
2
+ declare function __VLS_template(): {
3
+ __VLS_Slots: {
4
+ default?: (props: {}) => any;
5
+ } & {
6
+ default?: (props: {}) => any;
7
+ } & {
8
+ default?: (props: {}) => any;
9
+ };
10
+ };
5
11
  declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
12
  href: {
7
13
  type: StringConstructor;
@@ -0,0 +1,4 @@
1
+ export {}
2
+ import _default from './Cookie.vue.js'
3
+ export default _default
4
+ export {}
@@ -0,0 +1,22 @@
1
+ import e from "../btn/Btn.js";
2
+ import { t } from "../../_plugin-vue_export-helper-Djzt4Yr7.js";
3
+ import { createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, onMounted as s, openBlock as c, ref as l, renderSlot as u, withCtx as d } from "vue";
4
+ import '../../Cookie.css';// src/ui/cookie/Cookie.vue
5
+ var f = {
6
+ key: 0,
7
+ class: "cookie"
8
+ }, p = /*#__PURE__*/ t({
9
+ __name: "Cookie",
10
+ setup(t) {
11
+ let p = l(!1), m = () => {
12
+ localStorage.setItem("cookieAccepted", "1"), p.value = !1;
13
+ };
14
+ return s(() => {
15
+ p.value = localStorage.getItem("cookieAccepted") !== "1";
16
+ }), (t, s) => p.value ? (c(), r("div", f, [i("div", null, [u(t.$slots, "default", {}, void 0, !0)]), o(e, { onClick: m }, {
17
+ default: d(() => [...s[0] ||= [a("Согласен", -1)]]),
18
+ _: 1
19
+ })])) : n("", !0);
20
+ }
21
+ }, [["__scopeId", "data-v-40628050"]]);
22
+ export { p as default };
@@ -1,5 +1,9 @@
1
1
  declare const component: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
- declare var __VLS_1: {};
2
+ declare function __VLS_template(): {
3
+ __VLS_Slots: {
4
+ default?: (props: {}) => any;
5
+ };
6
+ };
3
7
  declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
8
 
5
9
  export default component;
@@ -0,0 +1,4 @@
1
+ export {}
2
+ import _default from './Autocomplete.vue.js'
3
+ export default _default
4
+ export {}
@@ -0,0 +1,172 @@
1
+ import e from "./Input.js";
2
+ import t from "../progress/Progress.js";
3
+ import { t as n } from "../../_plugin-vue_export-helper-Djzt4Yr7.js";
4
+ import { Fragment as r, Teleport as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, openBlock as h, ref as g, renderList as _, renderSlot as v, watch as y, withCtx as b, withModifiers as x } from "vue";
5
+ import '../../Autocomplete.css';// src/ui/form/Autocomplete.vue
6
+ var S = ["onMousedown"], C = {
7
+ key: 0,
8
+ class: "autocomplete-empty"
9
+ }, w = /*#__PURE__*/ n({
10
+ __name: "Autocomplete",
11
+ props: {
12
+ modelValue: {
13
+ type: [String, Number],
14
+ default: ""
15
+ },
16
+ autocomplete: {
17
+ type: Function,
18
+ default: null
19
+ },
20
+ label: {
21
+ type: [String, Boolean],
22
+ default: ""
23
+ },
24
+ error: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ required: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ minLength: {
33
+ type: Number,
34
+ default: 2
35
+ },
36
+ delay: {
37
+ type: Number,
38
+ default: 300
39
+ }
40
+ },
41
+ emits: [
42
+ "update:modelValue",
43
+ "select",
44
+ "focus",
45
+ "blur"
46
+ ],
47
+ setup(n, { expose: w, emit: T }) {
48
+ let E = n, D = T, O = g(null), k = g(null), A = g(null), j = g(E.modelValue), M = g([]), N = g(-1), P = g(!1), F = g(!1), I = g(!1), L = g({}), R = g({
49
+ "autocomplete-dropdown__top": !1,
50
+ "autocomplete-dropdown__bottom": !0
51
+ }), z = null, B = 0, V = () => {
52
+ P.value = !1, M.value = [], F.value = !1, N.value = -1;
53
+ }, H = async () => {
54
+ let e = j.value;
55
+ if (!E.autocomplete || e.length < E.minLength) {
56
+ V();
57
+ return;
58
+ }
59
+ let t = ++B;
60
+ I.value = !0, P.value = !0, M.value = [], F.value = !1, N.value = -1;
61
+ try {
62
+ let n = await E.autocomplete(e);
63
+ if (t !== B) return;
64
+ M.value = n ?? [], F.value = M.value.length === 0, N.value = M.value.length ? 0 : -1;
65
+ } catch {
66
+ if (t !== B) return;
67
+ M.value = [], F.value = !1, N.value = -1;
68
+ } finally {
69
+ t === B && (I.value = !1);
70
+ }
71
+ await u(), Y();
72
+ }, U = () => {
73
+ clearTimeout(z), j.value.length < E.minLength ? (B++, V(), I.value = !1) : z = setTimeout(H, E.delay);
74
+ }, W = (e) => {
75
+ V(), D("select", e);
76
+ }, G = (e) => {
77
+ if (M.value.length) switch (e.key) {
78
+ case "ArrowDown":
79
+ e.preventDefault(), N.value++, N.value >= M.value.length && (N.value = 0);
80
+ break;
81
+ case "ArrowUp":
82
+ e.preventDefault(), N.value--, N.value < 0 && (N.value = M.value.length - 1);
83
+ break;
84
+ case "Enter":
85
+ e.preventDefault(), N.value >= 0 && W(M.value[N.value]);
86
+ break;
87
+ case "Escape": e.preventDefault(), V();
88
+ }
89
+ }, K = async (e) => {
90
+ D("focus", e), j.value.length >= E.minLength && (P.value = !0, await u(), Y());
91
+ }, q = (e) => {
92
+ D("blur", e);
93
+ }, J = (e) => {
94
+ O.value?.contains(e.target) || A.value?.contains(e.target) || V();
95
+ }, Y = () => {
96
+ if (!O.value) return;
97
+ let e = O.value.getBoundingClientRect(), t = A.value?.offsetHeight ?? 0, n = window.innerHeight - e.bottom, r = e.top;
98
+ t && n < t && r >= t ? (L.value = {
99
+ bottom: `${window.innerHeight - e.top}px`,
100
+ left: `${e.left}px`,
101
+ width: `${e.width}px`,
102
+ top: "auto"
103
+ }, R.value = {
104
+ "autocomplete-dropdown__top": !0,
105
+ "autocomplete-dropdown__bottom": !1
106
+ }) : (L.value = {
107
+ top: `${e.bottom}px`,
108
+ left: `${e.left}px`,
109
+ width: `${e.width}px`,
110
+ bottom: "auto"
111
+ }, R.value = {
112
+ "autocomplete-dropdown__top": !1,
113
+ "autocomplete-dropdown__bottom": !0
114
+ });
115
+ };
116
+ y(() => E.modelValue, (e) => {
117
+ j.value = e;
118
+ }), y(() => E.modelValue, (e) => {
119
+ j.value = e;
120
+ });
121
+ let X = (e) => {
122
+ j.value = e, D("update:modelValue", e), U();
123
+ };
124
+ return m(() => {
125
+ document.addEventListener("mousedown", J), window.addEventListener("resize", Y), window.addEventListener("scroll", Y, !0);
126
+ }), p(() => {
127
+ clearTimeout(z), document.removeEventListener("mousedown", J), window.removeEventListener("resize", Y), window.removeEventListener("scroll", Y, !0);
128
+ }), w({
129
+ focus: () => k.value?.focus(),
130
+ blur: () => k.value?.blur()
131
+ }), (u, p) => (h(), s("div", {
132
+ ref_key: "autocomplete",
133
+ ref: O,
134
+ class: d(["autocomplete", { "show-dropdown": P.value && (M.value.length || F.value) }])
135
+ }, [l(e, {
136
+ ref_key: "input",
137
+ ref: k,
138
+ "model-value": j.value,
139
+ label: n.label,
140
+ error: n.error,
141
+ required: n.required,
142
+ autocompleteOff: "",
143
+ "onUpdate:modelValue": X,
144
+ onFocus: K,
145
+ onBlur: q,
146
+ onKeydown: G
147
+ }, {
148
+ before: b(() => [v(u.$slots, "before", {}, void 0, !0)]),
149
+ after: b(() => [l(t, { show: I.value }, null, 8, ["show"]), (h(), a(i, { to: "body" }, [P.value && (M.value.length || F.value) ? (h(), s("div", {
150
+ key: 0,
151
+ ref_key: "dropdown",
152
+ ref: A,
153
+ class: d(["autocomplete-dropdown", R.value]),
154
+ style: f(L.value)
155
+ }, [(h(!0), s(r, null, _(M.value, (e, t) => (h(), s("div", {
156
+ key: e.id,
157
+ class: d({ active: t === N.value }),
158
+ onMousedown: x((t) => W(e), ["prevent"])
159
+ }, [v(u.$slots, "default", {
160
+ item: e,
161
+ index: t
162
+ }, void 0, !0)], 42, S))), 128)), F.value ? (h(), s("div", C, [v(u.$slots, "empty", {}, () => [p[0] ||= c(" Ничего не найдено ", -1)], !0)])) : o("", !0)], 6)) : o("", !0)]))]),
163
+ _: 3
164
+ }, 8, [
165
+ "model-value",
166
+ "label",
167
+ "error",
168
+ "required"
169
+ ])], 2));
170
+ }
171
+ }, [["__scopeId", "data-v-d783e5e2"]]);
172
+ export { w as default };
@@ -1,10 +1,16 @@
1
1
  declare const component: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
- declare var __VLS_13: {};
3
- declare namespace __VLS_28 {
4
- let item: any;
5
- let index: number;
6
- }
7
- declare var __VLS_30: {};
2
+ declare function __VLS_template(): {
3
+ __VLS_Slots: {
4
+ before?: (props: {}) => any;
5
+ } & {
6
+ default?: (props: {
7
+ item: any;
8
+ index: number;
9
+ }) => any;
10
+ } & {
11
+ empty?: (props: {}) => any;
12
+ };
13
+ };
8
14
  declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
9
15
  modelValue: {
10
16
  type: (StringConstructor | NumberConstructor)[];
@@ -0,0 +1,4 @@
1
+ export {}
2
+ import _default from './Checkbox.vue.js'
3
+ export default _default
4
+ export {}
@@ -0,0 +1,69 @@
1
+ import { t as e } from "../../_plugin-vue_export-helper-Djzt4Yr7.js";
2
+ import { computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, normalizeClass as a, openBlock as o, ref as s, renderSlot as c, toDisplayString as l, unref as u, useSlots as d, vModelCheckbox as f, withDirectives as p, withModifiers as m } from "vue";
3
+ import '../../Checkbox.css';// src/ui/form/Checkbox.vue
4
+ var h = [
5
+ "value",
6
+ "required",
7
+ "disabled"
8
+ ], g = { key: 0 }, _ = { key: 1 }, v = {
9
+ key: 0,
10
+ class: "error"
11
+ }, y = /*#__PURE__*/ e({
12
+ __name: "Checkbox",
13
+ props: {
14
+ modelValue: {
15
+ type: [String, Boolean],
16
+ default: ""
17
+ },
18
+ label: {
19
+ type: String,
20
+ default: ""
21
+ },
22
+ required: {
23
+ type: Boolean,
24
+ default: !1
25
+ },
26
+ disabled: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ value: {
31
+ type: String,
32
+ default: ""
33
+ },
34
+ error: {
35
+ type: String,
36
+ default: ""
37
+ }
38
+ },
39
+ emits: ["update:modelValue"],
40
+ setup(e, { emit: y }) {
41
+ let b = d(), x = e, S = y, C = s(null), w = `checkbox-${Math.random().toString(16).slice(2)}`, T = s(""), E = t(() => [{ "checkbox-error": x.error || T.value }]), D = t({
42
+ get: () => x.modelValue,
43
+ set: (e) => {
44
+ S("update:modelValue", e), T.value = "";
45
+ }
46
+ }), O = () => {
47
+ T.value = C.value?.validationMessage ?? "";
48
+ };
49
+ return (t, s) => (o(), r("div", { class: a(["checkbox", E.value]) }, [
50
+ c(t.$slots, "before", {}, void 0, !0),
51
+ p(i("input", {
52
+ ref_key: "input",
53
+ ref: C,
54
+ id: w,
55
+ type: "checkbox",
56
+ "onUpdate:modelValue": s[0] ||= (e) => D.value = e,
57
+ value: e.value,
58
+ required: e.required,
59
+ disabled: e.disabled,
60
+ onInvalid: m(O, ["prevent"]),
61
+ onInput: O
62
+ }, null, 40, h), [[f, D.value]]),
63
+ i("label", { for: w }, [e.label ? (o(), r("span", g, l(e.label), 1)) : u(b).label ? (o(), r("span", _, [c(t.$slots, "label", {}, void 0, !0)])) : n("", !0)]),
64
+ e.error || T.value ? (o(), r("div", v, l(e.error || T.value), 1)) : n("", !0),
65
+ c(t.$slots, "after", {}, void 0, !0)
66
+ ], 2));
67
+ }
68
+ }, [["__scopeId", "data-v-5152abd6"]]);
69
+ export { y as default };
@@ -1,7 +1,13 @@
1
1
  declare const component: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
- declare var __VLS_1: {};
3
- declare var __VLS_3: {};
4
- declare var __VLS_5: {};
2
+ declare function __VLS_template(): {
3
+ __VLS_Slots: {
4
+ before?: (props: {}) => any;
5
+ } & {
6
+ label?: (props: {}) => any;
7
+ } & {
8
+ after?: (props: {}) => any;
9
+ };
10
+ };
5
11
  declare const __VLS_base: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
12
  modelValue: {
7
13
  type: (StringConstructor | BooleanConstructor)[];
@@ -0,0 +1,4 @@
1
+ export {}
2
+ import _default from './Input.vue.js'
3
+ export default _default
4
+ export {}