@studio-west/component-sw 0.9.0 → 0.9.2

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