@studio-west/component-sw 0.11.10 → 0.11.12

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 (49) hide show
  1. package/README.md +5 -5
  2. package/dist/SwButton-yS_tKW9w.js +4 -0
  3. package/dist/{SwButton-jKDKwFV9.js → SwButton.vue_vue_type_script_setup_true_lang-aODPwFa6.js} +11 -11
  4. package/dist/{SwDatePicker-CJjKSM8k.js → SwDatePicker-BVVouucy.js} +1 -1
  5. package/dist/{SwDropdownItem-CtlMVgsX.js → SwDropdownItem-C1-FnGEY.js} +1 -1
  6. package/dist/{SwGide-DbSSyZ-y.js → SwGide-CgNyNocW.js} +2 -2
  7. package/dist/SwInput-BkN2M-SL.js +90 -0
  8. package/dist/{SwMessage-CovKkpf6.js → SwMessage-Bkt1orr8.js} +6 -6
  9. package/dist/SwSection-CQe2kE0O.js +34 -0
  10. package/dist/SwSelect-BxbCfof-.js +1883 -0
  11. package/dist/{SwSlider-YncjYKPw.js → SwSlider-o3z_9DLW.js} +1 -1
  12. package/dist/SwSwitch-DeMdyD0-.js +47 -0
  13. package/dist/index-urBWY4_1.js +188 -0
  14. package/dist/index.cjs +6 -1
  15. package/dist/index.js +1 -1
  16. package/package.json +6 -2
  17. package/src/Alert.ts +65 -0
  18. package/src/components/SwAlert.vue +70 -0
  19. package/src/components/SwButton.vue +50 -0
  20. package/src/components/SwButtonGroup.vue +67 -0
  21. package/src/components/SwCollapse.vue +36 -0
  22. package/src/components/SwDatePicker.vue +375 -0
  23. package/src/components/SwDropdown.vue +202 -0
  24. package/src/components/SwDropdownItem.vue +26 -0
  25. package/src/components/SwDropdownNew.vue +175 -0
  26. package/src/components/SwFormItem.vue +21 -0
  27. package/src/components/SwGide.vue +128 -0
  28. package/src/components/SwIcon.vue +16 -0
  29. package/src/components/SwInput.vue +100 -0
  30. package/src/components/SwMessage.vue +53 -0
  31. package/src/components/SwSection.vue +17 -0
  32. package/src/components/SwSelect.vue +151 -0
  33. package/src/components/SwSkeleton.vue +13 -0
  34. package/src/components/SwSkeletonItem.vue +27 -0
  35. package/src/components/SwSlider.vue +281 -0
  36. package/src/components/SwSwitch.vue +51 -0
  37. package/src/components/SwTable.vue +239 -0
  38. package/src/components/SwTableColumn.vue +25 -0
  39. package/src/components/SwTabs.vue +41 -0
  40. package/src/components/SwTabsPane.vue +44 -0
  41. package/src/index.ts +43 -0
  42. package/src/utils/index.ts +149 -0
  43. package/types/components.d.ts +64 -31
  44. package/types/index.d.ts +83 -59
  45. package/dist/SwInput-DCV1rrWa.js +0 -89
  46. package/dist/SwSection-D8ooQ21I.js +0 -37
  47. package/dist/SwSelect-C2RKinez.js +0 -72
  48. package/dist/SwSwitch-6rl1IT4p.js +0 -47
  49. package/dist/index-B5koqczP.js +0 -190
@@ -1,5 +1,5 @@
1
1
  import { mergeModels as F, useModel as I, ref as p, computed as v, onMounted as q, onUnmounted as U, createElementBlock as M, openBlock as x, normalizeClass as D, createElementVNode as N, withModifiers as P, normalizeStyle as B, Fragment as j, renderList as G, renderSlot as H, createCommentVNode as J, toDisplayString as K } from "vue";
2
- import { c as O } from "./index-B5koqczP.js";
2
+ import { c as O } from "./index-urBWY4_1.js";
3
3
  const Q = ["onMouseenter", "onMouseleave", "onFocus", "onBlur", "onMousedown", "onTouchstart"], _ = {
4
4
  __name: "SwSlider",
5
5
  props: /* @__PURE__ */ F({
@@ -0,0 +1,47 @@
1
+ import { defineComponent as n, mergeModels as d, useModel as u, computed as f, createElementBlock as i, openBlock as h, normalizeClass as r, createElementVNode as t, renderSlot as m } from "vue";
2
+ const p = ["name", "id", "checked"], b = ["for", "data-onlabel", "data-offlabel"], _ = /* @__PURE__ */ n({
3
+ __name: "SwSwitch",
4
+ props: /* @__PURE__ */ d({
5
+ id: { default: "checkbox" },
6
+ class: { default: "" },
7
+ name: { default: "" },
8
+ on: { default: "" },
9
+ off: { default: "" },
10
+ size: { default: "" },
11
+ checkbox: { type: Boolean, default: !1 }
12
+ }, {
13
+ modelValue: { type: Boolean },
14
+ modelModifiers: {}
15
+ }),
16
+ emits: ["update:modelValue"],
17
+ setup(a) {
18
+ const o = u(a, "modelValue"), e = a, s = f(() => {
19
+ let l = ["sw-switch"];
20
+ return e.size.length > 0 && l.push("sw-" + e.size), e.checkbox && l.push("sw-checkbox"), e.class.length > 0 && l.push(e.class), l;
21
+ }), c = (l) => {
22
+ o.value = l.target.checked;
23
+ };
24
+ return (l, k) => (h(), i("div", {
25
+ class: r(s.value)
26
+ }, [
27
+ t("input", {
28
+ type: "checkbox",
29
+ name: e.name,
30
+ class: "sw-control",
31
+ id: e.id,
32
+ checked: o.value,
33
+ onChange: c
34
+ }, null, 40, p),
35
+ t("label", {
36
+ for: e.id,
37
+ class: "sw-label",
38
+ "data-onlabel": e.on,
39
+ "data-offlabel": e.off
40
+ }, null, 8, b),
41
+ m(l.$slots, "default")
42
+ ], 2));
43
+ }
44
+ });
45
+ export {
46
+ _ as default
47
+ };
@@ -0,0 +1,188 @@
1
+ import { createElementBlock as g, unref as x, openBlock as u, mergeProps as h, createElementVNode as b, ref as k, onMounted as A, onUnmounted as C, computed as P, createBlock as f, Transition as I, withCtx as j, createCommentVNode as M, normalizeClass as N, renderSlot as m, createTextVNode as E, toDisplayString as O, createApp as z, h as y, defineAsyncComponent as B } from "vue";
2
+ function F(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 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, 10) : e = e.replace(new RegExp(/-/gm), "/")), typeof e == "number" && e.toString().length === 10 && (e = e * 1e3), t = new Date(e));
11
+ const a = "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(a, { weekday: "short" }).format(t),
21
+ F: new Intl.DateTimeFormat(a, { month: "long" }).format(t),
22
+ M: new Intl.DateTimeFormat(a, { month: "short" }).format(t)
23
+ };
24
+ return o.replace(/{(dd|[YmdGHisDFM])+}/g, (s, i) => r[i]?.toString() || s);
25
+ }
26
+ function U(e) {
27
+ const n = e.match(/\D.*?\D?/);
28
+ if (!n) return e + "T00:00:01";
29
+ const o = e.split(n[0]);
30
+ return o[0].length > 2 ? o.join("-") + "T00:00:01" : o.reverse().join("-") + "T00:00:01";
31
+ }
32
+ function V(e, n) {
33
+ if (n && /^\+[0-9]\s/.test(n) && e.length === 2 || /^\+0\s/.test(e)) return "";
34
+ if (typeof e > "u" || e.length === 0) return e;
35
+ const o = "+0 (___) ___-__-__";
36
+ let t = 0;
37
+ const a = o.replace(/\D/g, ""), r = e.replace(/\D/g, "");
38
+ let s = o.replace(/[_\d]/g, (l) => t < r.length ? r.charAt(t++) || a.charAt(t) : l);
39
+ t = s.indexOf("_"), t !== -1 && (t = t < 5 ? 3 : t, s = s.slice(0, t));
40
+ let i = o.slice(0, e.length).replace(
41
+ /_+/g,
42
+ (l) => `\\d{1,${l.length}}`
43
+ ).replace(/[+()]/g, "\\$&");
44
+ return i = new RegExp(`^${i}$`), s = s.replace(/[-—]$|(\) )$/g, ""), !i.test(e) || e.length < 5 ? s : e;
45
+ }
46
+ function J(e, n = !1) {
47
+ const o = e.getBoundingClientRect();
48
+ return n ? o.left > 50 ? { right: "100%", marginRight: "10px" } : { left: "100%", marginLeft: "10px" } : { bottom: "100%", marginBottom: "10px" };
49
+ }
50
+ const G = ["href"], d = {
51
+ __name: "SwIcon",
52
+ props: {
53
+ prefix: { type: String, default: "icon" },
54
+ iconClass: { type: String, required: !0 },
55
+ className: { type: String, default: "" }
56
+ },
57
+ setup(e) {
58
+ const n = e, o = F(n.iconClass);
59
+ return (t, a) => x(o) ? (u(), g("div", h({
60
+ key: 0,
61
+ style: "mask: url(" + n.iconClass + ") no-repeat 50% 50%;",
62
+ class: "sw-external-icon svg-icon"
63
+ }, t.$attrs), null, 16)) : (u(), g("svg", h({
64
+ key: 1,
65
+ class: "sw-icon icon-" + (n.className || n.iconClass),
66
+ "aria-hidden": "true"
67
+ }, t.$attrs), [
68
+ b("use", {
69
+ href: "#" + n.prefix + "-" + n.iconClass
70
+ }, null, 8, G)
71
+ ], 16));
72
+ }
73
+ }, R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74
+ __proto__: null,
75
+ default: d
76
+ }, Symbol.toStringTag, { value: "Module" })), T = {
77
+ __name: "SwAlert",
78
+ props: {
79
+ message: { type: String, default: "Default message" },
80
+ before: { type: String, default: "" },
81
+ class: { type: String, default: "" },
82
+ after: { type: String, default: "" },
83
+ size: { type: String, default: "" },
84
+ duration: { type: Number, default: 6e3 },
85
+ type: { type: String, default: "info", validator: (e) => ["success", "warning", "error", "info"].includes(e) }
86
+ },
87
+ emits: ["closed"],
88
+ setup(e, { emit: n }) {
89
+ const o = e, t = n, a = k(!1);
90
+ let r = null;
91
+ const s = () => {
92
+ document.querySelector(".sw-alert-wrapper").togglePopover(), a.value = !0, document.querySelector(".sw-alert-wrapper").showPopover(), w();
93
+ }, i = () => {
94
+ a.value = !1, t("closed");
95
+ }, l = () => {
96
+ r && (clearTimeout(r), r = null);
97
+ }, D = () => {
98
+ w();
99
+ }, w = () => {
100
+ r = setTimeout(i, o.duration);
101
+ };
102
+ A(() => {
103
+ s();
104
+ }), C(() => {
105
+ r && clearTimeout(r);
106
+ });
107
+ const $ = P(() => {
108
+ const c = ["sw-alert"];
109
+ return o.size.length > 0 && c.push(`sw-${o.size}`), o.type.length > 0 && c.push(`sw-${o.type}`), o.class.length > 0 && c.push(o.class), c;
110
+ });
111
+ return (c, H) => (u(), f(I, { name: "fade" }, {
112
+ default: j(() => [
113
+ a.value ? (u(), g("div", {
114
+ key: 0,
115
+ class: N($.value),
116
+ onMouseenter: l,
117
+ onMouseleave: D
118
+ }, [
119
+ o.before.length > 0 ? (u(), f(d, {
120
+ key: 0,
121
+ "icon-class": o.before
122
+ }, null, 8, ["icon-class"])) : m(c.$slots, "prefix", { key: 1 }),
123
+ m(c.$slots, "default", {}, () => [
124
+ E(O(o.message), 1)
125
+ ]),
126
+ o.after.length > 0 ? (u(), f(d, {
127
+ key: 2,
128
+ "icon-class": o.after,
129
+ onClick: i
130
+ }, null, 8, ["icon-class"])) : m(c.$slots, "suffix", { key: 3 }),
131
+ b("footer", null, [
132
+ m(c.$slots, "footer")
133
+ ])
134
+ ], 34)) : M("", !0)
135
+ ]),
136
+ _: 3
137
+ }));
138
+ }
139
+ }, q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
140
+ __proto__: null,
141
+ default: T
142
+ }, Symbol.toStringTag, { value: "Module" }));
143
+ let p = document.querySelector("div.sw-alert-wrapper");
144
+ function v(e = {}) {
145
+ p || (p = document.createElement("div"), p.className = "sw-alert-wrapper", p.setAttribute("popover", "manual"), document.body.appendChild(p));
146
+ const {
147
+ prefix: n,
148
+ suffix: o,
149
+ footer: t,
150
+ ...a
151
+ } = e, r = (l) => l == null ? null : typeof l == "function" ? l : typeof l == "string" ? () => [y("span", l)] : Array.isArray(l) ? () => l : () => [l], s = z({
152
+ setup() {
153
+ return () => y(T, {
154
+ ...a,
155
+ onClose: () => {
156
+ p && s._container && (p.removeChild(s._container), s.unmount()), e.onClose && e.onClose();
157
+ }
158
+ }, {
159
+ ...n != null && { prefix: r(n) },
160
+ ...o != null && { suffix: r(o) },
161
+ ...t != null && { footer: r(t) }
162
+ });
163
+ }
164
+ }), i = s.mount(document.createElement("div"));
165
+ p && i.$el && p.appendChild(i.$el);
166
+ }
167
+ const _ = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => q), "./components/SwButton.vue": () => import("./SwButton-yS_tKW9w.js"), "./components/SwButtonGroup.vue": () => import("./SwButtonGroup-D9HH5POO.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-CuN3EbT6.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-BVVouucy.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-DQGTnnKw.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-C1-FnGEY.js"), "./components/SwDropdownNew.vue": () => import("./SwDropdownNew-CYfjZFd2.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CaA4jsoa.js"), "./components/SwGide.vue": () => import("./SwGide-CgNyNocW.js"), "./components/SwIcon.vue": () => Promise.resolve().then(() => R), "./components/SwInput.vue": () => import("./SwInput-BkN2M-SL.js"), "./components/SwMessage.vue": () => import("./SwMessage-Bkt1orr8.js"), "./components/SwSection.vue": () => import("./SwSection-CQe2kE0O.js"), "./components/SwSelect.vue": () => import("./SwSelect-BxbCfof-.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-B7ysp8L9.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSlider.vue": () => import("./SwSlider-o3z_9DLW.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-DeMdyD0-.js"), "./components/SwTable.vue": () => import("./SwTable-BKZ5idCi.js"), "./components/SwTableColumn.vue": () => import("./SwTableColumn-BLF5bPuJ.js"), "./components/SwTabs.vue": () => import("./SwTabs-DkSI4oAh.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-Dwtj8g7T.js") }), S = {};
168
+ for (const e in _) {
169
+ const n = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (o, t) => t.toUpperCase());
170
+ S[n] = B(() => _[e]());
171
+ }
172
+ const K = {
173
+ install(e) {
174
+ Object.keys(S).forEach((n) => {
175
+ e.component(n, S[n]);
176
+ }), e.config.globalProperties.$Alert = v, e.provide("Alert", v);
177
+ }
178
+ };
179
+ export {
180
+ v as A,
181
+ K as L,
182
+ d as _,
183
+ L as a,
184
+ S as b,
185
+ J as c,
186
+ V as f,
187
+ U as p
188
+ };