spicykatsu 0.0.31 → 0.0.32
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.
- package/dist/spicykatsu.es.js +183 -158
- package/dist/spicykatsu.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/dist/spicykatsu.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
1
|
+
import { ref as p, openBlock as a, createBlock as x, Transition as k, withCtx as T, createElementBlock as l, normalizeClass as g, toDisplayString as d, createCommentVNode as u, normalizeStyle as Y, createElementVNode as m, renderSlot as w, withDirectives as B, vModelText as I, mergeProps as $, withKeys as S, withModifiers as b } from "vue";
|
|
2
|
+
const V = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "spicyAlertIcon"
|
|
5
|
-
}, A = { key: 1 },
|
|
5
|
+
}, A = { key: 1 }, F = {
|
|
6
6
|
__name: "SpicyAlert",
|
|
7
7
|
props: {
|
|
8
8
|
variant: {
|
|
@@ -12,7 +12,7 @@ const B = {
|
|
|
12
12
|
},
|
|
13
13
|
text: {
|
|
14
14
|
type: String,
|
|
15
|
-
default: ""
|
|
15
|
+
default: "Button"
|
|
16
16
|
},
|
|
17
17
|
icon: String,
|
|
18
18
|
iconOnly: Boolean,
|
|
@@ -26,33 +26,33 @@ const B = {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
setup(e) {
|
|
29
|
-
const t = e,
|
|
30
|
-
|
|
29
|
+
const t = e, n = p(!0), r = () => {
|
|
30
|
+
n.value = !1;
|
|
31
31
|
};
|
|
32
32
|
return t.autoClose > 0 && setTimeout(() => {
|
|
33
|
-
|
|
34
|
-
}, t.autoClose), (o, i) => (a(),
|
|
35
|
-
default:
|
|
36
|
-
|
|
33
|
+
n.value = !1;
|
|
34
|
+
}, t.autoClose), (o, i) => (a(), x(k, { name: "fade" }, {
|
|
35
|
+
default: T(() => [
|
|
36
|
+
n.value ? (a(), l("div", {
|
|
37
37
|
key: 0,
|
|
38
|
-
class:
|
|
38
|
+
class: g(["spicyAlert", e.variant])
|
|
39
39
|
}, [
|
|
40
|
-
e.iconOnly || e.text ? (a(), l("span",
|
|
40
|
+
e.iconOnly || e.text ? (a(), l("span", V, d(e.icon), 1)) : u("", !0),
|
|
41
41
|
!e.iconOnly && e.text ? (a(), l("span", A, d(e.text), 1)) : u("", !0),
|
|
42
42
|
e.closable ? (a(), l("button", {
|
|
43
43
|
key: 2,
|
|
44
|
-
class: "
|
|
45
|
-
onClick:
|
|
44
|
+
class: "closeBtn",
|
|
45
|
+
onClick: r
|
|
46
46
|
}, "×")) : u("", !0)
|
|
47
47
|
], 2)) : u("", !0)
|
|
48
48
|
]),
|
|
49
49
|
_: 1
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, z = ["disabled"], E = {
|
|
53
53
|
key: 0,
|
|
54
54
|
class: "spicyBtnIcon"
|
|
55
|
-
},
|
|
55
|
+
}, P = {
|
|
56
56
|
__name: "SpicyBtn",
|
|
57
57
|
props: {
|
|
58
58
|
variant: {
|
|
@@ -85,21 +85,21 @@ const B = {
|
|
|
85
85
|
},
|
|
86
86
|
emits: ["click"],
|
|
87
87
|
setup(e, { emit: t }) {
|
|
88
|
-
return (
|
|
89
|
-
class:
|
|
88
|
+
return (n, r) => (a(), l("button", {
|
|
89
|
+
class: g(["spicyBtn", { outlined: e.variant === "outlined", disabled: e.disabled }]),
|
|
90
90
|
style: Y({ "--color": e.color, "--textColor": e.textColor, "--hoverColor": e.hoverColor }),
|
|
91
91
|
disabled: e.disabled,
|
|
92
|
-
onClick:
|
|
92
|
+
onClick: r[0] || (r[0] = (...o) => n.onClick && n.onClick(...o))
|
|
93
93
|
}, [
|
|
94
94
|
e.icon ? (a(), l("span", E, d(e.icon), 1)) : u("", !0),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
], 14,
|
|
95
|
+
m("span", null, d(e.text), 1),
|
|
96
|
+
w(n.$slots, "default")
|
|
97
|
+
], 14, z));
|
|
98
98
|
}
|
|
99
|
-
},
|
|
99
|
+
}, L = ["placeholder"], U = {
|
|
100
100
|
key: 0,
|
|
101
101
|
class: "spicyInputError"
|
|
102
|
-
},
|
|
102
|
+
}, N = {
|
|
103
103
|
__name: "SpicyLabel",
|
|
104
104
|
props: {
|
|
105
105
|
value: {
|
|
@@ -125,191 +125,179 @@ const B = {
|
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
127
|
setup(e) {
|
|
128
|
-
const t = e,
|
|
128
|
+
const t = e, n = `spicyInput-${i()}`, r = p(t.value), o = p(!1);
|
|
129
129
|
function i() {
|
|
130
130
|
const c = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
131
131
|
let f = "";
|
|
132
|
-
for (let
|
|
132
|
+
for (let y = 0; y < 6; y++)
|
|
133
133
|
f += c.charAt(Math.floor(Math.random() * c.length));
|
|
134
134
|
return f;
|
|
135
135
|
}
|
|
136
136
|
const v = (c) => {
|
|
137
|
-
|
|
138
|
-
}, D = () => {
|
|
139
|
-
o.value = !1;
|
|
137
|
+
r.value = c.target.value;
|
|
140
138
|
}, O = () => {
|
|
139
|
+
o.value = !1;
|
|
140
|
+
}, M = () => {
|
|
141
141
|
o.value = !0;
|
|
142
142
|
};
|
|
143
143
|
return (c, f) => (a(), l("div", {
|
|
144
|
-
class:
|
|
144
|
+
class: g(["spicyInputWrapper", [e.variant, { hasValue: r.value || e.value, hasFocus: o.value, hasError: e.error }]])
|
|
145
145
|
}, [
|
|
146
|
-
|
|
146
|
+
m("label", {
|
|
147
147
|
class: "spicyInputLabel",
|
|
148
|
-
for:
|
|
148
|
+
for: n
|
|
149
149
|
}, d(e.label), 1),
|
|
150
|
-
|
|
151
|
-
id:
|
|
152
|
-
class:
|
|
153
|
-
"onUpdate:modelValue": f[0] || (f[0] = (
|
|
150
|
+
B(m("input", {
|
|
151
|
+
id: n,
|
|
152
|
+
class: g(["spicyInput", e.variant]),
|
|
153
|
+
"onUpdate:modelValue": f[0] || (f[0] = (y) => r.value = y),
|
|
154
154
|
placeholder: e.placeholder,
|
|
155
155
|
onInput: v,
|
|
156
|
-
onBlur:
|
|
157
|
-
onFocus:
|
|
158
|
-
}, null, 42,
|
|
159
|
-
[
|
|
156
|
+
onBlur: O,
|
|
157
|
+
onFocus: M
|
|
158
|
+
}, null, 42, L), [
|
|
159
|
+
[I, r.value]
|
|
160
160
|
]),
|
|
161
|
-
|
|
161
|
+
w(c.$slots, "default"),
|
|
162
162
|
e.error ? (a(), l("span", U, d(e.error), 1)) : u("", !0)
|
|
163
163
|
], 2));
|
|
164
164
|
}
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
],
|
|
165
|
+
}, W = ["aria-checked", "onKeydown", "aria-label"], j = /* @__PURE__ */ m("div", { class: "spicyToggleKnob" }, null, -1), K = [
|
|
166
|
+
j
|
|
167
|
+
], H = {
|
|
168
168
|
__name: "SpicyToggle",
|
|
169
169
|
props: {
|
|
170
|
-
modelValue: Boolean
|
|
170
|
+
modelValue: Boolean,
|
|
171
|
+
label: String,
|
|
172
|
+
variant: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: "filled",
|
|
175
|
+
validator: (e) => ["outlined", "filled"].includes(e)
|
|
176
|
+
},
|
|
177
|
+
borderColor: String,
|
|
178
|
+
activeColor: String,
|
|
179
|
+
focusShadow: String
|
|
171
180
|
},
|
|
172
181
|
emits: ["update:modelValue"],
|
|
173
182
|
setup(e, { emit: t }) {
|
|
174
|
-
const
|
|
175
|
-
|
|
183
|
+
const n = e, r = t, o = () => {
|
|
184
|
+
r("update:modelValue", !n.modelValue);
|
|
176
185
|
};
|
|
177
186
|
return (i, v) => (a(), l("div", $({
|
|
178
|
-
class: ["spicyToggle", { "is-active": e.modelValue }],
|
|
187
|
+
class: ["spicyToggle", { outlined: e.variant === "outlined", "is-active": e.modelValue }],
|
|
188
|
+
style: {
|
|
189
|
+
"--borderColor": e.borderColor,
|
|
190
|
+
"--activeColor": e.activeColor,
|
|
191
|
+
"--focusShadow": e.focusShadow
|
|
192
|
+
},
|
|
179
193
|
onClick: o,
|
|
180
194
|
role: "switch",
|
|
181
195
|
"aria-checked": e.modelValue.toString(),
|
|
182
196
|
tabindex: "0",
|
|
183
|
-
onKeydown:
|
|
184
|
-
|
|
197
|
+
onKeydown: [
|
|
198
|
+
S(b(o, ["prevent"]), ["space"]),
|
|
199
|
+
S(b(o, ["prevent"]), ["enter"])
|
|
200
|
+
],
|
|
201
|
+
"aria-label": e.label
|
|
202
|
+
}, i.$attrs), K, 16, W));
|
|
185
203
|
}
|
|
186
204
|
};
|
|
187
|
-
function
|
|
188
|
-
|
|
189
|
-
return new URL(e), !0;
|
|
190
|
-
} catch (t) {
|
|
191
|
-
return console.error("Invalid URL:", t), !1;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
function N(e) {
|
|
195
|
-
return m(e) ? new URL(e).hostname : null;
|
|
196
|
-
}
|
|
197
|
-
function K(e, t) {
|
|
198
|
-
if (!m(e))
|
|
199
|
-
return e;
|
|
200
|
-
const r = new URL(e);
|
|
201
|
-
return Object.keys(t).forEach((n) => r.searchParams.append(n, t[n])), r.toString();
|
|
202
|
-
}
|
|
203
|
-
function W(e, t, r = "https") {
|
|
204
|
-
if (!["http", "https", "ftp", "sftp", "ftps", "ssh"].includes(r.toLowerCase()))
|
|
205
|
-
throw new Error("Invalid protocol: " + r);
|
|
206
|
-
if (!/^(?!:\/\/)([a-z0-9-]+\.)*[a-z0-9-]+$/i.test(e))
|
|
207
|
-
throw new Error("Invalid hostname: " + e);
|
|
208
|
-
return t.startsWith("/") || (t = "/" + t), t.endsWith("/") && t.length > 1 && (t = t.slice(0, -1)), t === "/" && (t = ""), `${r.toLowerCase()}://${e}${t}`;
|
|
209
|
-
}
|
|
210
|
-
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
211
|
-
__proto__: null,
|
|
212
|
-
appendParamsToUrl: K,
|
|
213
|
-
generateUrl: W,
|
|
214
|
-
getHostname: N,
|
|
215
|
-
isUrlValid: m
|
|
216
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
217
|
-
function S(e, t) {
|
|
218
|
-
const r = {
|
|
205
|
+
function C(e, t) {
|
|
206
|
+
const n = {
|
|
219
207
|
YYYY: () => e.getFullYear().toString(),
|
|
220
208
|
MM: () => (e.getMonth() + 1).toString().padStart(2, "0"),
|
|
221
209
|
DD: () => e.getDate().toString().padStart(2, "0")
|
|
222
210
|
};
|
|
223
|
-
return t.replace(/YYYY|MM|DD/g, (
|
|
211
|
+
return t.replace(/YYYY|MM|DD/g, (r) => n[r]());
|
|
224
212
|
}
|
|
225
213
|
function R(e) {
|
|
226
|
-
const [t,
|
|
227
|
-
return new Date(Number(t), Number(
|
|
214
|
+
const [t, n, r] = e.split("-");
|
|
215
|
+
return new Date(Number(t), Number(n) - 1, Number(r));
|
|
228
216
|
}
|
|
229
217
|
function q(e, t) {
|
|
230
|
-
const
|
|
231
|
-
return Math.ceil(
|
|
232
|
-
}
|
|
233
|
-
function H(e, t) {
|
|
234
|
-
const r = new Date(e);
|
|
235
|
-
return r.setDate(e.getDate() + t), r;
|
|
218
|
+
const n = Math.abs(t.getTime() - e.getTime());
|
|
219
|
+
return Math.ceil(n / (1e3 * 60 * 60 * 24));
|
|
236
220
|
}
|
|
237
221
|
function G(e, t) {
|
|
238
|
-
const
|
|
239
|
-
return
|
|
222
|
+
const n = new Date(e);
|
|
223
|
+
return n.setDate(e.getDate() + t), n;
|
|
224
|
+
}
|
|
225
|
+
function J(e, t) {
|
|
226
|
+
const n = new Date(e);
|
|
227
|
+
return n.setDate(e.getDate() - t), n;
|
|
240
228
|
}
|
|
241
|
-
function
|
|
229
|
+
function Q(e) {
|
|
242
230
|
const t = /* @__PURE__ */ new Date();
|
|
243
231
|
return e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
|
|
244
232
|
}
|
|
245
|
-
function
|
|
233
|
+
function X(e) {
|
|
246
234
|
const t = /* @__PURE__ */ new Date();
|
|
247
235
|
return t.setDate(t.getDate() - 1), e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
|
|
248
236
|
}
|
|
249
|
-
function
|
|
237
|
+
function Z(e) {
|
|
250
238
|
const t = /* @__PURE__ */ new Date();
|
|
251
239
|
return t.setDate(t.getDate() + 1), e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
|
|
252
240
|
}
|
|
253
|
-
function
|
|
241
|
+
function _(e = "YYYY-MM-DD", t = { show: !0, separator: "-" }) {
|
|
254
242
|
if (typeof e != "string" || typeof t != "object" || !t.hasOwnProperty("show") || typeof t.show != "boolean")
|
|
255
243
|
throw new Error(
|
|
256
244
|
'Invalid parameters: Please provide a valid format string and options object with a boolean "show" property.'
|
|
257
245
|
);
|
|
258
|
-
let
|
|
259
|
-
return t.separator && t.separator !== "-" && (
|
|
246
|
+
let r = C(/* @__PURE__ */ new Date(), e);
|
|
247
|
+
return t.separator && t.separator !== "-" && (r = r.replace(/-/g, t.separator)), t.show ? { value: r, isVisible: !0 } : { value: r, isVisible: !1 };
|
|
260
248
|
}
|
|
261
249
|
const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
262
250
|
__proto__: null,
|
|
263
|
-
currentDate:
|
|
264
|
-
dateAdd:
|
|
251
|
+
currentDate: _,
|
|
252
|
+
dateAdd: G,
|
|
265
253
|
dateDiff: q,
|
|
266
|
-
dateIsToday:
|
|
267
|
-
dateIsTomorrow:
|
|
268
|
-
dateIsYesterday:
|
|
269
|
-
dateSubtract:
|
|
270
|
-
formatDate:
|
|
254
|
+
dateIsToday: Q,
|
|
255
|
+
dateIsTomorrow: Z,
|
|
256
|
+
dateIsYesterday: X,
|
|
257
|
+
dateSubtract: J,
|
|
258
|
+
formatDate: C,
|
|
271
259
|
parseDate: R
|
|
272
260
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
273
|
-
function
|
|
261
|
+
function ee(e) {
|
|
274
262
|
const t = /* @__PURE__ */ new WeakMap();
|
|
275
|
-
function r
|
|
276
|
-
if (s(
|
|
277
|
-
return
|
|
278
|
-
if (t.has(
|
|
279
|
-
return t.get(
|
|
280
|
-
const o = Array.isArray(
|
|
281
|
-
t.set(
|
|
282
|
-
for (const i in
|
|
283
|
-
Object.prototype.hasOwnProperty.call(
|
|
263
|
+
function n(r) {
|
|
264
|
+
if (s(r) || typeof r != "object")
|
|
265
|
+
return r;
|
|
266
|
+
if (t.has(r))
|
|
267
|
+
return t.get(r);
|
|
268
|
+
const o = Array.isArray(r) ? [] : {};
|
|
269
|
+
t.set(r, o);
|
|
270
|
+
for (const i in r)
|
|
271
|
+
Object.prototype.hasOwnProperty.call(r, i) && (o[i] = n(r[i]));
|
|
284
272
|
return o;
|
|
285
273
|
}
|
|
286
|
-
return
|
|
274
|
+
return n(e);
|
|
287
275
|
}
|
|
288
|
-
function
|
|
276
|
+
function D(...e) {
|
|
289
277
|
const t = {};
|
|
290
|
-
return e.forEach((
|
|
291
|
-
if (!s(
|
|
292
|
-
for (const
|
|
293
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
294
|
-
const o = r
|
|
295
|
-
o !== void 0 && (typeof o == "object" && o !== null && !Array.isArray(o) ? t[
|
|
296
|
-
t[
|
|
278
|
+
return e.forEach((n) => {
|
|
279
|
+
if (!s(n)) {
|
|
280
|
+
for (const r in n)
|
|
281
|
+
if (Object.prototype.hasOwnProperty.call(n, r)) {
|
|
282
|
+
const o = n[r];
|
|
283
|
+
o !== void 0 && (typeof o == "object" && o !== null && !Array.isArray(o) ? t[r] = D(
|
|
284
|
+
t[r] || {},
|
|
297
285
|
o
|
|
298
|
-
) : t[
|
|
286
|
+
) : t[r] = o);
|
|
299
287
|
}
|
|
300
288
|
}
|
|
301
289
|
}), t;
|
|
302
290
|
}
|
|
303
|
-
function
|
|
291
|
+
function te(...e) {
|
|
304
292
|
return s(e[0]) ? e[0] : Object.assign({}, ...e);
|
|
305
293
|
}
|
|
306
|
-
function
|
|
294
|
+
function re(e) {
|
|
307
295
|
return s(e) ? [] : Object.keys(e);
|
|
308
296
|
}
|
|
309
297
|
function ne(e) {
|
|
310
298
|
return s(e) ? [] : Object.values(e);
|
|
311
299
|
}
|
|
312
|
-
function
|
|
300
|
+
function oe(e) {
|
|
313
301
|
return s(e) ? [] : Object.entries(e);
|
|
314
302
|
}
|
|
315
303
|
function s(e) {
|
|
@@ -317,43 +305,80 @@ function s(e) {
|
|
|
317
305
|
}
|
|
318
306
|
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
319
307
|
__proto__: null,
|
|
320
|
-
deepClone:
|
|
321
|
-
deepMerge:
|
|
322
|
-
getObjectEntries:
|
|
323
|
-
getObjectKeys:
|
|
308
|
+
deepClone: ee,
|
|
309
|
+
deepMerge: D,
|
|
310
|
+
getObjectEntries: oe,
|
|
311
|
+
getObjectKeys: re,
|
|
324
312
|
getObjectValues: ne,
|
|
325
313
|
isObjectEmpty: s,
|
|
326
|
-
mergeObjects:
|
|
327
|
-
}, Symbol.toStringTag, { value: "Module" })), fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
328
|
-
__proto__: null
|
|
314
|
+
mergeObjects: te
|
|
329
315
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
316
|
+
function h(e) {
|
|
317
|
+
try {
|
|
318
|
+
return new URL(e), !0;
|
|
319
|
+
} catch (t) {
|
|
320
|
+
return console.error("Invalid URL:", t), !1;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function ae(e) {
|
|
324
|
+
return h(e) ? new URL(e).hostname : null;
|
|
325
|
+
}
|
|
326
|
+
function le(e, t) {
|
|
327
|
+
if (!h(e))
|
|
328
|
+
return e;
|
|
329
|
+
const n = new URL(e);
|
|
330
|
+
return Object.keys(t).forEach((r) => n.searchParams.append(r, t[r])), n.toString();
|
|
331
|
+
}
|
|
332
|
+
function ie(e, t, n = "https") {
|
|
333
|
+
if (!["http", "https", "ftp", "sftp", "ftps", "ssh"].includes(n.toLowerCase()))
|
|
334
|
+
throw new Error("Invalid protocol: " + n);
|
|
335
|
+
if (!/^(?!:\/\/)([a-z0-9-]+\.)*[a-z0-9-]+$/i.test(e))
|
|
336
|
+
throw new Error("Invalid hostname: " + e);
|
|
337
|
+
return t.startsWith("/") || (t = "/" + t), t.endsWith("/") && t.length > 1 && (t = t.slice(0, -1)), t === "/" && (t = ""), `${n.toLowerCase()}://${e}${t}`;
|
|
338
|
+
}
|
|
339
|
+
const fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
340
|
+
__proto__: null,
|
|
341
|
+
appendParamsToUrl: le,
|
|
342
|
+
generateUrl: ie,
|
|
343
|
+
getHostname: ae,
|
|
344
|
+
isUrlValid: h
|
|
345
|
+
}, Symbol.toStringTag, { value: "Module" })), se = ':root{--primaryColor: #5e1381;--primaryColorHover: #811faf;--secondaryColor: #2757f7;--errorColor: #ff0000;--primaryBorderColor: #ccc;--primaryTextColor: #ddd;--disabledOpacity: .5;--labelFocus: var(--primaryColor);--fontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;--fontSize: 14px;--fontWeight: 500;--borderWidth: 2px;--borderRadius: 4px}.spicyText{color:var(--primaryTextColor);font-family:var(--fontFamily);font-size:var(--fontSize);font-weight:var(--fontWeight)}.spicyHeader{color:var(--primaryTextColor);font-family:var(--fontFamily);font-size:24px;font-weight:700}', ye = {
|
|
346
|
+
install(e, t = {}) {
|
|
347
|
+
const { useComponents: n = !0, useStyles: r = !0 } = t;
|
|
348
|
+
if (n && (e.component("SpicyAlert", F), e.component("SpicyBtn", P), e.component("SpicyLabel", N), e.component("SpicyToggle", H)), r) {
|
|
349
|
+
const o = document.createElement("style");
|
|
350
|
+
o.textContent = se, document.head.appendChild(o);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
330
354
|
export {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
H as dateAdd,
|
|
355
|
+
F as SpicyAlert,
|
|
356
|
+
P as SpicyBtn,
|
|
357
|
+
N as SpicyLabel,
|
|
358
|
+
H as SpicyToggle,
|
|
359
|
+
le as appendParamsToUrl,
|
|
360
|
+
_ as currentDate,
|
|
361
|
+
G as dateAdd,
|
|
339
362
|
q as dateDiff,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
363
|
+
Q as dateIsToday,
|
|
364
|
+
Z as dateIsTomorrow,
|
|
365
|
+
X as dateIsYesterday,
|
|
366
|
+
J as dateSubtract,
|
|
344
367
|
ue as dateUtils,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
368
|
+
ee as deepClone,
|
|
369
|
+
D as deepMerge,
|
|
370
|
+
ye as default,
|
|
371
|
+
C as formatDate,
|
|
372
|
+
ie as generateUrl,
|
|
373
|
+
ae as getHostname,
|
|
374
|
+
oe as getObjectEntries,
|
|
375
|
+
re as getObjectKeys,
|
|
352
376
|
ne as getObjectValues,
|
|
353
377
|
s as isObjectEmpty,
|
|
354
|
-
|
|
355
|
-
|
|
378
|
+
h as isUrlValid,
|
|
379
|
+
te as mergeObjects,
|
|
356
380
|
de as objUtils,
|
|
357
381
|
R as parseDate,
|
|
358
|
-
|
|
382
|
+
se as spicyStyles,
|
|
383
|
+
fe as urlUtils
|
|
359
384
|
};
|
package/dist/spicykatsu.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(l=typeof globalThis<"u"?globalThis:l||self,n(l.SpicyKatsu={},l.Vue))})(this,function(l,n){"use strict";const
|
|
1
|
+
(function(l,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(l=typeof globalThis<"u"?globalThis:l||self,n(l.SpicyKatsu={},l.Vue))})(this,function(l,n){"use strict";const A={key:0,class:"spicyAlertIcon"},j={key:1},m={__name:"SpicyAlert",props:{variant:{type:String,default:"info",validator:e=>["info","success","warning","error","custom"].includes(e)},text:{type:String,default:"Button"},icon:String,iconOnly:Boolean,closable:{type:Boolean,default:!1},autoClose:{type:Number,default:0}},setup(e){const t=e,o=n.ref(!0),r=()=>{o.value=!1};return t.autoClose>0&&setTimeout(()=>{o.value=!1},t.autoClose),(a,c)=>(n.openBlock(),n.createBlock(n.Transition,{name:"fade"},{default:n.withCtx(()=>[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["spicyAlert",e.variant])},[e.iconOnly||e.text?(n.openBlock(),n.createElementBlock("span",A,n.toDisplayString(e.icon),1)):n.createCommentVNode("",!0),!e.iconOnly&&e.text?(n.openBlock(),n.createElementBlock("span",j,n.toDisplayString(e.text),1)):n.createCommentVNode("",!0),e.closable?(n.openBlock(),n.createElementBlock("button",{key:2,class:"closeBtn",onClick:r},"×")):n.createCommentVNode("",!0)],2)):n.createCommentVNode("",!0)]),_:1}))}},F=["disabled"],P={key:0,class:"spicyBtnIcon"},h={__name:"SpicyBtn",props:{variant:{type:String,default:"filled",validator:e=>["outlined","filled"].includes(e)},disabled:{type:Boolean,default:!1},text:{type:String,default:"Button"},icon:String,color:String,textColor:String,hoverColor:String,borderColor:String,fontSize:{type:[Number,String],default:14},fontWeight:{type:[Number,String],default:500}},emits:["click"],setup(e,{emit:t}){return(o,r)=>(n.openBlock(),n.createElementBlock("button",{class:n.normalizeClass(["spicyBtn",{outlined:e.variant==="outlined",disabled:e.disabled}]),style:n.normalizeStyle({"--color":e.color,"--textColor":e.textColor,"--hoverColor":e.hoverColor}),disabled:e.disabled,onClick:r[0]||(r[0]=(...a)=>o.onClick&&o.onClick(...a))},[e.icon?(n.openBlock(),n.createElementBlock("span",P,n.toDisplayString(e.icon),1)):n.createCommentVNode("",!0),n.createElementVNode("span",null,n.toDisplayString(e.text),1),n.renderSlot(o.$slots,"default")],14,F))}},L=["placeholder"],K={key:0,class:"spicyInputError"},p={__name:"SpicyLabel",props:{value:{type:String,default:""},placeholder:{type:String,default:""},label:{type:String,default:"Label"},error:{type:String,default:""},variant:{type:String,default:"filled",validator:e=>["outlined","filled"].includes(e)}},setup(e){const t=e,o=`spicyInput-${c()}`,r=n.ref(t.value),a=n.ref(!1);function c(){const s="0123456789abcdefghijklmnopqrstuvwxyz";let d="";for(let f=0;f<6;f++)d+=s.charAt(Math.floor(Math.random()*s.length));return d}const z=s=>{r.value=s.target.value},Q=()=>{a.value=!1},X=()=>{a.value=!0};return(s,d)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["spicyInputWrapper",[e.variant,{hasValue:r.value||e.value,hasFocus:a.value,hasError:e.error}]])},[n.createElementVNode("label",{class:"spicyInputLabel",for:o},n.toDisplayString(e.label),1),n.withDirectives(n.createElementVNode("input",{id:o,class:n.normalizeClass(["spicyInput",e.variant]),"onUpdate:modelValue":d[0]||(d[0]=f=>r.value=f),placeholder:e.placeholder,onInput:z,onBlur:Q,onFocus:X},null,42,L),[[n.vModelText,r.value]]),n.renderSlot(s.$slots,"default"),e.error?(n.openBlock(),n.createElementBlock("span",K,n.toDisplayString(e.error),1)):n.createCommentVNode("",!0)],2))}},W=["aria-checked","onKeydown","aria-label"],H=[n.createElementVNode("div",{class:"spicyToggleKnob"},null,-1)],S={__name:"SpicyToggle",props:{modelValue:Boolean,label:String,variant:{type:String,default:"filled",validator:e=>["outlined","filled"].includes(e)},borderColor:String,activeColor:String,focusShadow:String},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,r=t,a=()=>{r("update:modelValue",!o.modelValue)};return(c,z)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["spicyToggle",{outlined:e.variant==="outlined","is-active":e.modelValue}],style:{"--borderColor":e.borderColor,"--activeColor":e.activeColor,"--focusShadow":e.focusShadow},onClick:a,role:"switch","aria-checked":e.modelValue.toString(),tabindex:"0",onKeydown:[n.withKeys(n.withModifiers(a,["prevent"]),["space"]),n.withKeys(n.withModifiers(a,["prevent"]),["enter"])],"aria-label":e.label},c.$attrs),H,16,W))}};function y(e,t){const o={YYYY:()=>e.getFullYear().toString(),MM:()=>(e.getMonth()+1).toString().padStart(2,"0"),DD:()=>e.getDate().toString().padStart(2,"0")};return t.replace(/YYYY|MM|DD/g,r=>o[r]())}function b(e){const[t,o,r]=e.split("-");return new Date(Number(t),Number(o)-1,Number(r))}function w(e,t){const o=Math.abs(t.getTime()-e.getTime());return Math.ceil(o/(1e3*60*60*24))}function C(e,t){const o=new Date(e);return o.setDate(e.getDate()+t),o}function D(e,t){const o=new Date(e);return o.setDate(e.getDate()-t),o}function k(e){const t=new Date;return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function B(e){const t=new Date;return t.setDate(t.getDate()-1),e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function O(e){const t=new Date;return t.setDate(t.getDate()+1),e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function M(e="YYYY-MM-DD",t={show:!0,separator:"-"}){if(typeof e!="string"||typeof t!="object"||!t.hasOwnProperty("show")||typeof t.show!="boolean")throw new Error('Invalid parameters: Please provide a valid format string and options object with a boolean "show" property.');let r=y(new Date,e);return t.separator&&t.separator!=="-"&&(r=r.replace(/-/g,t.separator)),t.show?{value:r,isVisible:!0}:{value:r,isVisible:!1}}const R=Object.freeze(Object.defineProperty({__proto__:null,currentDate:M,dateAdd:C,dateDiff:w,dateIsToday:k,dateIsTomorrow:O,dateIsYesterday:B,dateSubtract:D,formatDate:y,parseDate:b},Symbol.toStringTag,{value:"Module"}));function T(e){const t=new WeakMap;function o(r){if(i(r)||typeof r!="object")return r;if(t.has(r))return t.get(r);const a=Array.isArray(r)?[]:{};t.set(r,a);for(const c in r)Object.prototype.hasOwnProperty.call(r,c)&&(a[c]=o(r[c]));return a}return o(e)}function g(...e){const t={};return e.forEach(o=>{if(!i(o)){for(const r in o)if(Object.prototype.hasOwnProperty.call(o,r)){const a=o[r];a!==void 0&&(typeof a=="object"&&a!==null&&!Array.isArray(a)?t[r]=g(t[r]||{},a):t[r]=a)}}}),t}function V(...e){return i(e[0])?e[0]:Object.assign({},...e)}function E(e){return i(e)?[]:Object.keys(e)}function Y(e){return i(e)?[]:Object.values(e)}function I(e){return i(e)?[]:Object.entries(e)}function i(e){return e===null||typeof e!="object"?!1:Array.isArray(e)?e.length===0:Object.keys(e).length===0}const q=Object.freeze(Object.defineProperty({__proto__:null,deepClone:T,deepMerge:g,getObjectEntries:I,getObjectKeys:E,getObjectValues:Y,isObjectEmpty:i,mergeObjects:V},Symbol.toStringTag,{value:"Module"}));function u(e){try{return new URL(e),!0}catch(t){return console.error("Invalid URL:",t),!1}}function v(e){return u(e)?new URL(e).hostname:null}function N(e,t){if(!u(e))return e;const o=new URL(e);return Object.keys(t).forEach(r=>o.searchParams.append(r,t[r])),o.toString()}function U(e,t,o="https"){if(!["http","https","ftp","sftp","ftps","ssh"].includes(o.toLowerCase()))throw new Error("Invalid protocol: "+o);if(!/^(?!:\/\/)([a-z0-9-]+\.)*[a-z0-9-]+$/i.test(e))throw new Error("Invalid hostname: "+e);return t.startsWith("/")||(t="/"+t),t.endsWith("/")&&t.length>1&&(t=t.slice(0,-1)),t==="/"&&(t=""),`${o.toLowerCase()}://${e}${t}`}const G=Object.freeze(Object.defineProperty({__proto__:null,appendParamsToUrl:N,generateUrl:U,getHostname:v,isUrlValid:u},Symbol.toStringTag,{value:"Module"})),$=':root{--primaryColor: #5e1381;--primaryColorHover: #811faf;--secondaryColor: #2757f7;--errorColor: #ff0000;--primaryBorderColor: #ccc;--primaryTextColor: #ddd;--disabledOpacity: .5;--labelFocus: var(--primaryColor);--fontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;--fontSize: 14px;--fontWeight: 500;--borderWidth: 2px;--borderRadius: 4px}.spicyText{color:var(--primaryTextColor);font-family:var(--fontFamily);font-size:var(--fontSize);font-weight:var(--fontWeight)}.spicyHeader{color:var(--primaryTextColor);font-family:var(--fontFamily);font-size:24px;font-weight:700}',J={install(e,t={}){const{useComponents:o=!0,useStyles:r=!0}=t;if(o&&(e.component("SpicyAlert",m),e.component("SpicyBtn",h),e.component("SpicyLabel",p),e.component("SpicyToggle",S)),r){const a=document.createElement("style");a.textContent=$,document.head.appendChild(a)}}};l.SpicyAlert=m,l.SpicyBtn=h,l.SpicyLabel=p,l.SpicyToggle=S,l.appendParamsToUrl=N,l.currentDate=M,l.dateAdd=C,l.dateDiff=w,l.dateIsToday=k,l.dateIsTomorrow=O,l.dateIsYesterday=B,l.dateSubtract=D,l.dateUtils=R,l.deepClone=T,l.deepMerge=g,l.default=J,l.formatDate=y,l.generateUrl=U,l.getHostname=v,l.getObjectEntries=I,l.getObjectKeys=E,l.getObjectValues=Y,l.isObjectEmpty=i,l.isUrlValid=u,l.mergeObjects=V,l.objUtils=q,l.parseDate=b,l.spicyStyles=$,l.urlUtils=G,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.fade-enter-active,.fade-leave-active{transition:opacity .5s}.fade-enter,.fade-leave-to{opacity:0}.spicyAlert{display:flex;align-items:center;padding:12px;border-radius:4px;margin-bottom:12px}.info{background-color:#e0e0e0;color:#333}.success{background-color:#d4edda;color:#155724}.warning{background-color:#fff3cd;color:#856404}.error{background-color:#ffbdc2;color:#911f2a}.spicyAlertIcon{margin-right:8px}.
|
|
1
|
+
.fade-enter-active,.fade-leave-active{transition:opacity .5s}.fade-enter,.fade-leave-to{opacity:0}.spicyAlert{display:flex;align-items:center;padding:12px;border-radius:4px;margin-bottom:12px}.info{background-color:#e0e0e0;color:#333}.success{background-color:#d4edda;color:#155724}.warning{background-color:#fff3cd;color:#856404}.error{background-color:#ffbdc2;color:#911f2a}.spicyAlertIcon{margin-right:8px}.closeBtn{margin-left:auto;background:none;border:none;cursor:pointer}.spicyBtn{padding:8px 16px;background-color:var(--color, var(--primaryColor));border:none;border-radius:4px;color:var(--textColor, var(--primaryTextColor));cursor:pointer;font-size:14px;font-weight:500;text-transform:uppercase;transition:background-color .25s}.spicyBtn.outlined{background-color:transparent;border:2px solid var(--borderColor, var(--primaryBorderColor));color:#424242}.spicyBtn.disabled{opacity:.5;cursor:not-allowed}.spicyBtn:hover:not(.disabled){background-color:var(--hoverColor, grey)}.spicyBtn.outlined:hover:not(.disabled){background-color:var(--hoverColor, grey);color:var(--textColor, var(--primaryTextColor))}.spicyBtnIcon{margin-right:6px}.spicyInputWrapper{display:flex;flex-direction:column;position:relative}.spicyInputLabel{position:absolute;top:12px;left:16px;color:var(--textColor, var(--primaryTextColor));transition:top .25s,font-size .25s,color .25s;pointer-events:none;font-size:18px;background-color:transparent}.spicyInput{padding:20px 16px 8px;border:none;border-bottom:1px solid var(--borderColor, var(--primaryBorderColor));font-size:16px;width:100%;box-sizing:border-box;transition:border-color .25s;background-color:transparent;color:var(--textColor, var(--primaryTextColor))}.spicyInputWrapper .spicyInput:focus{outline:none;border-color:var(--labelFocus)}.outlined .spicyInput{border:1px solid var(--borderColor, var(--primaryBorderColor));border-radius:4px}.filled .spicyInput{border:none;border-bottom:1px solid var(--borderColor, var(--primaryBorderColor))}.hasValue .spicyInputLabel,.hasFocus .spicyInputLabel{top:-16px;font-size:16px;color:var(--labelFocus);font-weight:700}.hasError .spicyInput{border-color:red}.spicyInputError{color:red;font-size:12px;margin-top:4px}.spicyToggle{width:50px;height:24px;background-color:var(--borderColor, var(--primaryBorderColor));border-radius:30px;cursor:pointer;padding:2px;transition:background-color .2s;display:inline-flex;align-items:center}.spicyToggle.is-active{background-color:var(--activeColor, var(--primaryColor))}.spicyToggleKnob{width:20px;height:20px;background-color:#fff;border-radius:50%;transition:transform .2s;box-shadow:0 2px 4px #0003}.spicyToggle.is-active .spicyToggleKnob{transform:translate(26px)}.spicyToggle:focus{outline:none;box-shadow:0 0 0 2px var(--foucsShadow, var(--primaryColor))}.spicyToggle.outlined{background-color:transparent;border:2px solid var(--borderColor, var(--primaryBorderColor))}.spicyToggle.outlined.is-active{background-color:var(--activeColor, var(--primaryColor))}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Sato",
|
|
6
6
|
"private": false,
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.32",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist/",
|
|
10
10
|
"package.json",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"test": "jest"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"vue": "^3.4.
|
|
23
|
+
"vue": "^3.4.23"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
27
|
-
"typescript": "^5.4.
|
|
28
|
-
"vite": "^5.2.
|
|
29
|
-
"vue-tsc": "^2.0.
|
|
27
|
+
"typescript": "^5.4.5",
|
|
28
|
+
"vite": "^5.2.9",
|
|
29
|
+
"vue-tsc": "^2.0.13"
|
|
30
30
|
}
|
|
31
31
|
}
|