@studio-west/component-sw 0.10.7 → 0.10.8

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.
@@ -1,165 +0,0 @@
1
- import { createElementBlock as d, unref as D, openBlock as u, mergeProps as v, createElementVNode as b, ref as A, onMounted as $, onUnmounted as x, computed as I, createBlock as f, Transition as C, withCtx as M, createCommentVNode as P, normalizeClass as N, renderSlot as m, createTextVNode as j, toDisplayString as E, createApp as z, h as F, defineAsyncComponent as O } from "vue";
2
- function q(e) {
3
- return /^(https?:|mailto:|tel:)/.test(e);
4
- }
5
- function V(e, n) {
6
- if (arguments.length === 0 || !e)
7
- return null;
8
- const o = n || "{Y}-{m}-{d} {G}:{i}:{s}";
9
- let t;
10
- typeof e == "object" ? t = e : (typeof e == "string" && (/^[0-9]+$/.test(e) ? e = parseInt(e) : e = e.replace(new RegExp(/-/gm), "/")), typeof e == "number" && e.toString().length === 10 && (e = e * 1e3), t = new Date(e));
11
- const s = "ru-RU", r = {
12
- Y: t.getFullYear(),
13
- m: (t.getMonth() + 1).toString().padStart(2, "0"),
14
- d: t.getDate(),
15
- dd: t.getDate().toString().padStart(2, "0"),
16
- G: t.getHours(),
17
- H: t.getHours().toString().padStart(2, "0"),
18
- i: t.getMinutes().toString().padStart(2, "0"),
19
- s: t.getSeconds().toString().padStart(2, "0"),
20
- D: new Intl.DateTimeFormat(s, { weekday: "short" }).format(t),
21
- F: new Intl.DateTimeFormat(s, { month: "long" }).format(t),
22
- M: new Intl.DateTimeFormat(s, { month: "short" }).format(t)
23
- };
24
- return o.replace(/{(dd|[YmdGHisDFM])+}/g, (c, p) => r[p]);
25
- }
26
- const B = ["href"], S = {
27
- __name: "SwIcon",
28
- props: {
29
- prefix: { type: String, default: "icon" },
30
- iconClass: { type: String, required: !0 },
31
- className: { type: String, default: "" }
32
- },
33
- setup(e) {
34
- const n = e, o = q(n.iconClass);
35
- return (t, s) => D(o) ? (u(), d("div", v({
36
- key: 0,
37
- style: "mask: url(" + n.iconClass + ") no-repeat 50% 50%;",
38
- class: "svg-external-icon svg-icon"
39
- }, t.$attrs), null, 16)) : (u(), d("svg", v({
40
- key: 1,
41
- class: "svg-icon icon-" + (n.className || n.iconClass),
42
- "aria-hidden": "true"
43
- }, t.$attrs), [
44
- b("use", {
45
- href: "#" + n.prefix + "-" + n.iconClass
46
- }, null, 8, B)
47
- ], 16));
48
- }
49
- }, G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50
- __proto__: null,
51
- default: S
52
- }, Symbol.toStringTag, { value: "Module" })), _ = {
53
- __name: "SwAlert",
54
- props: {
55
- message: { type: String, default: "Default message" },
56
- before: { type: String, default: "" },
57
- class: { type: String, default: "" },
58
- after: { type: String, default: "" },
59
- size: { type: String, default: "" },
60
- duration: { type: Number, default: 6e3 },
61
- type: { type: String, default: "info", validator: (e) => ["success", "warning", "error", "info"].includes(e) }
62
- },
63
- emits: ["closed"],
64
- setup(e, { emit: n }) {
65
- const o = e, t = n, s = A(!1);
66
- let r = null;
67
- const c = () => {
68
- document.querySelector(".sw-alert-wrapper").togglePopover(), s.value = !0, document.querySelector(".sw-alert-wrapper").showPopover(), w();
69
- }, p = () => {
70
- s.value = !1, t("closed");
71
- }, a = () => {
72
- r && (clearTimeout(r), r = null);
73
- }, T = () => {
74
- w();
75
- }, w = () => {
76
- r = setTimeout(p, o.duration);
77
- };
78
- $(() => {
79
- c();
80
- }), x(() => {
81
- r && clearTimeout(r);
82
- });
83
- const k = I(() => {
84
- const l = ["sw-alert"];
85
- return o.size.length > 0 && l.push(`sw-${o.size}`), o.type.length > 0 && l.push(`sw-${o.type}`), o.class.length > 0 && l.push(o.class), l;
86
- });
87
- return (l, Y) => (u(), f(C, { name: "fade" }, {
88
- default: M(() => [
89
- s.value ? (u(), d("div", {
90
- key: 0,
91
- class: N(k.value),
92
- onMouseenter: a,
93
- onMouseleave: T
94
- }, [
95
- o.before.length > 0 ? (u(), f(S, {
96
- key: 0,
97
- "icon-class": o.before
98
- }, null, 8, ["icon-class"])) : m(l.$slots, "prefix", { key: 1 }),
99
- m(l.$slots, "default", {}, () => [
100
- j(E(o.message), 1)
101
- ]),
102
- o.after.length > 0 ? (u(), f(S, {
103
- key: 2,
104
- "icon-class": o.after,
105
- onClick: p
106
- }, null, 8, ["icon-class"])) : m(l.$slots, "suffix", { key: 3 }),
107
- b("footer", null, [
108
- m(l.$slots, "footer")
109
- ])
110
- ], 34)) : P("", !0)
111
- ]),
112
- _: 3
113
- }));
114
- }
115
- }, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
116
- __proto__: null,
117
- default: _
118
- }, Symbol.toStringTag, { value: "Module" }));
119
- let i = document.querySelector("div.sw-alert-wrapper");
120
- function y(e = {}) {
121
- i || (i = document.createElement("div"), i.className = "sw-alert-wrapper", i.setAttribute("popover", "manual"), document.body.appendChild(i));
122
- const {
123
- prefix: n,
124
- suffix: o,
125
- footer: t,
126
- ...s
127
- } = e, r = (a) => a == null ? null : typeof a == "function" ? a : typeof a == "string" ? () => [a] : Array.isArray(a) ? () => a : () => [a], c = z({
128
- setup() {
129
- return () => F(
130
- _,
131
- {
132
- ...s,
133
- onClose: () => {
134
- i.removeChild(c._container), c.unmount();
135
- }
136
- },
137
- {
138
- ...n != null && { prefix: r(n) },
139
- ...o != null && { suffix: r(o) },
140
- ...t != null && { footer: r(t) }
141
- }
142
- );
143
- }
144
- }), p = c.mount(document.createElement("div"));
145
- i.appendChild(p.$el);
146
- }
147
- const h = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => H), "./components/SwButton.vue": () => import("./SwButton-85-tKHA7.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-CuN3EbT6.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-C8sfNhY8.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-DQGTnnKw.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-CcFLdoEe.js"), "./components/SwDropdownNew.vue": () => import("./SwDropdownNew-CYfjZFd2.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CaA4jsoa.js"), "./components/SwGide.vue": () => import("./SwGide-BXrOfMXl.js"), "./components/SwIcon.vue": () => Promise.resolve().then(() => G), "./components/SwInput.vue": () => import("./SwInput-BTfGY3HC.js"), "./components/SwMessage.vue": () => import("./SwMessage-C6XT_p2Y.js"), "./components/SwSection.vue": () => import("./SwSection-D8ooQ21I.js"), "./components/SwSelect.vue": () => import("./SwSelect-C2RKinez.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-B7ysp8L9.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSlider.vue": () => import("./SwSlider-CJt83B8G.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-6rl1IT4p.js"), "./components/SwTable.vue": () => import("./SwTable-BLrFhlyO.js"), "./components/SwTableColumn.vue": () => import("./SwTableColumn-BLF5bPuJ.js"), "./components/SwTabs.vue": () => import("./SwTabs-DkSI4oAh.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-Dwtj8g7T.js") }), g = {};
148
- for (const e in h) {
149
- const n = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (o, t) => t.toUpperCase());
150
- g[n] = O(() => h[e]());
151
- }
152
- const L = {
153
- install(e) {
154
- Object.keys(g).forEach((n) => {
155
- e.component(n, g[n]);
156
- }), e.config.globalProperties.$Alert = y, e.provide("Alert", y);
157
- }
158
- };
159
- export {
160
- y as A,
161
- L,
162
- S as _,
163
- g as c,
164
- V as p
165
- };