@davidbirchall/core 1.0.2 → 1.0.4
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/components/Badge/Badge.stories.d.ts +1 -21
- package/dist/components/Button/Button.stories.d.ts +1 -23
- package/dist/components/Calendar/Calendar.stories.d.ts +1 -16
- package/dist/components/Card/Card.stories.d.ts +1 -14
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -32
- package/dist/components/DataTable/DataTable.stories.d.ts +1 -19
- package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -5
- package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -23
- package/dist/components/EmptyState/EmptyState.stories.d.ts +1 -40
- package/dist/components/FormGroup/FormGroup.stories.d.ts +1 -32
- package/dist/components/Heading/Heading.stories.d.ts +1 -23
- package/dist/components/Input/Input.stories.d.ts +1 -36
- package/dist/components/Modal/Modal.stories.d.ts +1 -34
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +1 -54
- package/dist/components/Select/Select.stories.d.ts +1 -31
- package/dist/components/StatCard/StatCard.stories.d.ts +1 -42
- package/dist/components/Tag/Tag.stories.d.ts +1 -19
- package/dist/components/TextArea/TextArea.stories.d.ts +1 -38
- package/dist/core.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +108 -104
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as C, openBlock as a, createBlock as W, resolveDynamicComponent as K, mergeProps as fe, toHandlers as ve, withCtx as j, renderSlot as D, createElementBlock as l, createCommentVNode as c, normalizeClass as w, ref as V, computed as M, createElementVNode as n, withModifiers as O, toDisplayString as r, Fragment as L, renderList as
|
|
1
|
+
import { defineComponent as C, openBlock as a, createBlock as W, resolveDynamicComponent as K, mergeProps as fe, toHandlers as ve, withCtx as j, renderSlot as D, createElementBlock as l, createCommentVNode as c, normalizeClass as w, ref as V, computed as M, createElementVNode as n, withModifiers as O, toDisplayString as r, Fragment as L, renderList as N, createTextVNode as Y, watch as Q, onMounted as Z, onBeforeUnmount as ee, Teleport as J, normalizeStyle as U, createVNode as X, onUnmounted as he, Transition as te } from "vue";
|
|
2
2
|
const be = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "sr-only"
|
|
@@ -73,80 +73,83 @@ const be = {
|
|
|
73
73
|
setup(e, { emit: m }) {
|
|
74
74
|
const t = e, f = m, v = (() => {
|
|
75
75
|
if (t.initialDate) {
|
|
76
|
-
const [s,
|
|
77
|
-
return new Date(s,
|
|
76
|
+
const [s, k, i] = t.initialDate.split("-").map(Number);
|
|
77
|
+
return new Date(s, k - 1, i);
|
|
78
78
|
}
|
|
79
79
|
if (t.modelValue) {
|
|
80
80
|
if (typeof t.modelValue == "string") {
|
|
81
|
-
const [s,
|
|
82
|
-
return new Date(s,
|
|
81
|
+
const [s, k, i] = t.modelValue.split("-").map(Number);
|
|
82
|
+
return new Date(s, k - 1, i);
|
|
83
83
|
}
|
|
84
84
|
if (typeof t.modelValue == "object" && "start" in t.modelValue && t.modelValue.start) {
|
|
85
|
-
const [s,
|
|
86
|
-
return new Date(s,
|
|
85
|
+
const [s, k, i] = t.modelValue.start.split("-").map(Number);
|
|
86
|
+
return new Date(s, k - 1, i);
|
|
87
87
|
}
|
|
88
88
|
if (Array.isArray(t.modelValue) && t.modelValue.length > 0) {
|
|
89
|
-
const [s,
|
|
90
|
-
return new Date(s,
|
|
89
|
+
const [s, k, i] = t.modelValue[0].split("-").map(Number);
|
|
90
|
+
return new Date(s, k - 1, i);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return /* @__PURE__ */ new Date();
|
|
94
|
-
})(), d = V(v.getMonth()), g = V(v.getFullYear()), o = V(null), h = V(null), b = V(Math.floor(v.getFullYear() / 12) * 12), I = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
94
|
+
})(), d = V(v.getMonth()), g = V(v.getFullYear()), o = V(null), h = V(null), b = V(Math.floor(v.getFullYear() / 12) * 12), I = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], q = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], P = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], z = M(() => q[d.value]), _ = M(() => {
|
|
95
95
|
const s = [...P];
|
|
96
96
|
return t.firstDayOfWeek > 0 ? [...s.slice(t.firstDayOfWeek), ...s.slice(0, t.firstDayOfWeek)] : s;
|
|
97
|
-
}), y = M(() => Array.from({ length: 12 }, (s,
|
|
98
|
-
const s = b.value,
|
|
99
|
-
return `${s} - ${
|
|
97
|
+
}), y = M(() => Array.from({ length: 12 }, (s, k) => b.value + k)), p = M(() => {
|
|
98
|
+
const s = b.value, k = s + 11;
|
|
99
|
+
return `${s} - ${k}`;
|
|
100
100
|
}), S = M(() => {
|
|
101
|
-
const s = [],
|
|
102
|
-
let T =
|
|
101
|
+
const s = [], k = new Date(g.value, d.value, 1), i = new Date(g.value, d.value + 1, 0);
|
|
102
|
+
let T = k.getDay() - t.firstDayOfWeek;
|
|
103
103
|
T < 0 && (T += 7);
|
|
104
104
|
const G = new Date(g.value, d.value, 0).getDate();
|
|
105
105
|
for (let E = T - 1; E >= 0; E--) {
|
|
106
106
|
const F = new Date(g.value, d.value - 1, G - E);
|
|
107
|
-
s.push(
|
|
107
|
+
s.push($(F, !1));
|
|
108
108
|
}
|
|
109
109
|
for (let E = 1; E <= i.getDate(); E++) {
|
|
110
110
|
const F = new Date(g.value, d.value, E);
|
|
111
|
-
s.push(
|
|
111
|
+
s.push($(F, !0));
|
|
112
112
|
}
|
|
113
113
|
const me = 42 - s.length;
|
|
114
114
|
for (let E = 1; E <= me; E++) {
|
|
115
115
|
const F = new Date(g.value, d.value + 1, E);
|
|
116
|
-
s.push(
|
|
116
|
+
s.push($(F, !1));
|
|
117
117
|
}
|
|
118
118
|
return s;
|
|
119
|
-
}),
|
|
119
|
+
}), $ = (s, k) => {
|
|
120
120
|
const i = B(s), T = B(/* @__PURE__ */ new Date());
|
|
121
121
|
return {
|
|
122
122
|
date: s,
|
|
123
123
|
dateString: i,
|
|
124
|
-
isCurrentMonth:
|
|
124
|
+
isCurrentMonth: k,
|
|
125
125
|
isToday: i === T,
|
|
126
|
-
isSelected:
|
|
127
|
-
isDisabled:
|
|
126
|
+
isSelected: A(i),
|
|
127
|
+
isDisabled: R(i),
|
|
128
128
|
isInRange: H(i)
|
|
129
129
|
};
|
|
130
130
|
}, B = (s) => {
|
|
131
|
-
const
|
|
132
|
-
return `${
|
|
133
|
-
},
|
|
131
|
+
const k = s.getFullYear(), i = String(s.getMonth() + 1).padStart(2, "0"), T = String(s.getDate()).padStart(2, "0");
|
|
132
|
+
return `${k}-${i}-${T}`;
|
|
133
|
+
}, A = (s) => t.modelValue ? t.mode === "single" ? t.modelValue === s : t.mode === "multiple" && Array.isArray(t.modelValue) ? t.modelValue.includes(s) : t.mode === "range" && typeof t.modelValue == "object" && "start" in t.modelValue ? s === t.modelValue.start || s === t.modelValue.end : !1 : !1, R = (s) => {
|
|
134
|
+
var k;
|
|
135
|
+
return !!(t.minDate && s < t.minDate || t.maxDate && s > t.maxDate || (k = t.disabledDates) != null && k.includes(s));
|
|
136
|
+
}, H = (s) => {
|
|
134
137
|
if (t.mode !== "range" || typeof t.modelValue != "object" || !("start" in t.modelValue)) return !1;
|
|
135
|
-
const { start:
|
|
136
|
-
return !
|
|
138
|
+
const { start: k, end: i } = t.modelValue;
|
|
139
|
+
return !k || !i ? !1 : s > k && s < i;
|
|
137
140
|
}, le = (s) => {
|
|
138
141
|
if (!s.isDisabled) {
|
|
139
142
|
if (t.mode === "single")
|
|
140
143
|
f("update:modelValue", s.dateString);
|
|
141
144
|
else if (t.mode === "multiple") {
|
|
142
|
-
const
|
|
143
|
-
i > -1 ?
|
|
145
|
+
const k = Array.isArray(t.modelValue) ? [...t.modelValue] : [], i = k.indexOf(s.dateString);
|
|
146
|
+
i > -1 ? k.splice(i, 1) : k.push(s.dateString), f("update:modelValue", k);
|
|
144
147
|
} else if (t.mode === "range")
|
|
145
148
|
if (!h.value)
|
|
146
149
|
h.value = s.dateString, f("update:modelValue", { start: s.dateString, end: s.dateString });
|
|
147
150
|
else {
|
|
148
|
-
const
|
|
149
|
-
f("update:modelValue", { start:
|
|
151
|
+
const k = h.value < s.dateString ? h.value : s.dateString, i = h.value < s.dateString ? s.dateString : h.value;
|
|
152
|
+
f("update:modelValue", { start: k, end: i }), h.value = null;
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
155
|
}, ne = () => {
|
|
@@ -166,7 +169,7 @@ const be = {
|
|
|
166
169
|
}, ue = () => {
|
|
167
170
|
b.value += 12;
|
|
168
171
|
};
|
|
169
|
-
return (s,
|
|
172
|
+
return (s, k) => (a(), l("div", $e, [
|
|
170
173
|
n("div", _e, [
|
|
171
174
|
n("button", {
|
|
172
175
|
onClick: O(ne, ["stop"]),
|
|
@@ -178,7 +181,7 @@ const be = {
|
|
|
178
181
|
onClick: O(oe, ["stop"]),
|
|
179
182
|
class: "calendar-month-btn",
|
|
180
183
|
type: "button"
|
|
181
|
-
}, r(
|
|
184
|
+
}, r(z.value), 1),
|
|
182
185
|
n("button", {
|
|
183
186
|
onClick: O(re, ["stop"]),
|
|
184
187
|
class: "calendar-year-btn",
|
|
@@ -193,7 +196,7 @@ const be = {
|
|
|
193
196
|
]),
|
|
194
197
|
o.value ? o.value === "month" ? (a(), l("div", Ie, [
|
|
195
198
|
n("div", Se, [
|
|
196
|
-
(a(), l(L, null,
|
|
199
|
+
(a(), l(L, null, N(I, (i, T) => n("button", {
|
|
197
200
|
key: i,
|
|
198
201
|
onClick: O((G) => de(T), ["stop"]),
|
|
199
202
|
type: "button",
|
|
@@ -218,7 +221,7 @@ const be = {
|
|
|
218
221
|
}, " › ")
|
|
219
222
|
]),
|
|
220
223
|
n("div", Oe, [
|
|
221
|
-
(a(!0), l(L, null,
|
|
224
|
+
(a(!0), l(L, null, N(y.value, (i) => (a(), l("button", {
|
|
222
225
|
key: i,
|
|
223
226
|
onClick: O((T) => ie(i), ["stop"]),
|
|
224
227
|
type: "button",
|
|
@@ -230,13 +233,13 @@ const be = {
|
|
|
230
233
|
])
|
|
231
234
|
])) : c("", !0) : (a(), l("div", Ve, [
|
|
232
235
|
n("div", De, [
|
|
233
|
-
(a(!0), l(L, null,
|
|
236
|
+
(a(!0), l(L, null, N(_.value, (i) => (a(), l("div", {
|
|
234
237
|
key: i,
|
|
235
238
|
class: "calendar-weekday"
|
|
236
239
|
}, r(i), 1))), 128))
|
|
237
240
|
]),
|
|
238
241
|
n("div", Ce, [
|
|
239
|
-
(a(!0), l(L, null,
|
|
242
|
+
(a(!0), l(L, null, N(S.value, (i) => (a(), l("button", {
|
|
240
243
|
key: i.dateString,
|
|
241
244
|
onClick: (T) => le(i),
|
|
242
245
|
type: "button",
|
|
@@ -321,7 +324,7 @@ const be = {
|
|
|
321
324
|
e.error ? (a(), l("span", He, r(e.error), 1)) : c("", !0)
|
|
322
325
|
]));
|
|
323
326
|
}
|
|
324
|
-
}), je = /* @__PURE__ */ x(Ue, [["__scopeId", "data-v-
|
|
327
|
+
}), je = /* @__PURE__ */ x(Ue, [["__scopeId", "data-v-ce644bb9"]]), Je = { class: "data-table" }, Xe = { class: "data-table__wrapper" }, Ge = { class: "data-table__table" }, Ke = { class: "data-table__head" }, Qe = ["onClick"], Ze = { class: "data-table__header-content" }, et = {
|
|
325
328
|
key: 0,
|
|
326
329
|
class: "data-table__sort-icon"
|
|
327
330
|
}, tt = { key: 0 }, at = {
|
|
@@ -349,7 +352,7 @@ const be = {
|
|
|
349
352
|
n("table", Ge, [
|
|
350
353
|
n("thead", Ke, [
|
|
351
354
|
n("tr", null, [
|
|
352
|
-
(a(!0), l(L, null,
|
|
355
|
+
(a(!0), l(L, null, N(e.columns, (o) => (a(), l("th", {
|
|
353
356
|
key: o.key,
|
|
354
357
|
class: w(["data-table__header", { "data-table__header--sortable": o.sortable }]),
|
|
355
358
|
onClick: (h) => o.sortable ? u(o.key) : void 0
|
|
@@ -364,11 +367,11 @@ const be = {
|
|
|
364
367
|
])
|
|
365
368
|
]),
|
|
366
369
|
n("tbody", null, [
|
|
367
|
-
(a(!0), l(L, null,
|
|
370
|
+
(a(!0), l(L, null, N(v.value, (o, h) => (a(), l("tr", {
|
|
368
371
|
key: h,
|
|
369
372
|
class: "data-table__row"
|
|
370
373
|
}, [
|
|
371
|
-
(a(!0), l(L, null,
|
|
374
|
+
(a(!0), l(L, null, N(e.columns, (b) => (a(), l("td", {
|
|
372
375
|
key: b.key,
|
|
373
376
|
class: "data-table__cell"
|
|
374
377
|
}, [
|
|
@@ -420,24 +423,24 @@ const be = {
|
|
|
420
423
|
left: "0px",
|
|
421
424
|
width: "320px"
|
|
422
425
|
}), I = V(t.modelValue);
|
|
423
|
-
Q(() => t.modelValue, (
|
|
424
|
-
I.value =
|
|
426
|
+
Q(() => t.modelValue, ($) => {
|
|
427
|
+
I.value = $;
|
|
425
428
|
}, { immediate: !0 });
|
|
426
|
-
const
|
|
429
|
+
const q = M(() => {
|
|
427
430
|
if (!t.modelValue) return "";
|
|
428
431
|
if (t.mode === "single" && typeof t.modelValue == "string")
|
|
429
432
|
return P(t.modelValue);
|
|
430
433
|
if (t.mode === "multiple" && Array.isArray(t.modelValue))
|
|
431
|
-
return t.modelValue.map((
|
|
434
|
+
return t.modelValue.map(($) => P($)).join(", ");
|
|
432
435
|
if (t.mode === "range" && typeof t.modelValue == "object" && "start" in t.modelValue) {
|
|
433
|
-
const { start:
|
|
434
|
-
if (
|
|
435
|
-
return `${P(
|
|
436
|
-
if (
|
|
436
|
+
const { start: $, end: B } = t.modelValue;
|
|
437
|
+
if ($ && B)
|
|
438
|
+
return `${P($)} - ${P(B)}`;
|
|
439
|
+
if ($) return P($);
|
|
437
440
|
}
|
|
438
441
|
return "";
|
|
439
|
-
}), P = (
|
|
440
|
-
const [B,
|
|
442
|
+
}), P = ($) => {
|
|
443
|
+
const [B, A, R] = $.split("-").map(Number), H = new Date(B, A - 1, R);
|
|
441
444
|
return t.format === "long" ? H.toLocaleDateString("en-US", {
|
|
442
445
|
year: "numeric",
|
|
443
446
|
month: "long",
|
|
@@ -447,53 +450,54 @@ const be = {
|
|
|
447
450
|
month: "short",
|
|
448
451
|
day: "numeric"
|
|
449
452
|
});
|
|
450
|
-
},
|
|
451
|
-
t.disabled || (u.value ? y() :
|
|
452
|
-
},
|
|
453
|
+
}, z = () => {
|
|
454
|
+
t.disabled || (u.value ? y() : _());
|
|
455
|
+
}, _ = () => {
|
|
453
456
|
u.value = !0, setTimeout(() => {
|
|
454
457
|
if (o.value) {
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
top: `${
|
|
458
|
-
left: `${
|
|
458
|
+
const $ = o.value.getBoundingClientRect(), A = window.innerHeight - $.bottom, R = 400;
|
|
459
|
+
A < R && $.top > R ? b.value = {
|
|
460
|
+
top: `${$.top - R + window.scrollY}px`,
|
|
461
|
+
left: `${$.left + window.scrollX}px`,
|
|
459
462
|
width: "320px"
|
|
460
463
|
} : b.value = {
|
|
461
|
-
top: `${
|
|
462
|
-
left: `${
|
|
464
|
+
top: `${$.bottom + 4 + window.scrollY}px`,
|
|
465
|
+
left: `${$.left + window.scrollX}px`,
|
|
463
466
|
width: "320px"
|
|
464
467
|
};
|
|
465
468
|
}
|
|
466
469
|
}, 0);
|
|
467
470
|
}, y = () => {
|
|
468
471
|
u.value = !1;
|
|
469
|
-
}, p = (
|
|
470
|
-
I.value =
|
|
472
|
+
}, p = ($) => {
|
|
473
|
+
I.value = $, f("update:modelValue", $), t.mode === "single" && setTimeout(() => {
|
|
471
474
|
y();
|
|
472
|
-
}, 200), t.mode === "range" && typeof
|
|
475
|
+
}, 200), t.mode === "range" && typeof $ == "object" && "start" in $ && $.end && setTimeout(() => {
|
|
473
476
|
y();
|
|
474
477
|
}, 200);
|
|
475
|
-
}, S = (
|
|
478
|
+
}, S = ($) => {
|
|
479
|
+
var A, R;
|
|
476
480
|
if (!u.value) return;
|
|
477
|
-
const B =
|
|
478
|
-
o.value
|
|
481
|
+
const B = $.target;
|
|
482
|
+
(A = o.value) != null && A.contains(B) || (R = h.value) != null && R.contains(B) || y();
|
|
479
483
|
};
|
|
480
484
|
return Z(() => {
|
|
481
485
|
document.addEventListener("click", S);
|
|
482
486
|
}), ee(() => {
|
|
483
487
|
document.removeEventListener("click", S);
|
|
484
|
-
}), (
|
|
488
|
+
}), ($, B) => (a(), l("div", {
|
|
485
489
|
class: "date-picker",
|
|
486
490
|
ref_key: "datePickerRef",
|
|
487
491
|
ref: o
|
|
488
492
|
}, [
|
|
489
493
|
n("div", {
|
|
490
494
|
class: "date-picker-input",
|
|
491
|
-
onClick:
|
|
495
|
+
onClick: z
|
|
492
496
|
}, [
|
|
493
497
|
n("input", {
|
|
494
498
|
type: "text",
|
|
495
499
|
id: g.value,
|
|
496
|
-
value:
|
|
500
|
+
value: q.value,
|
|
497
501
|
placeholder: e.placeholder,
|
|
498
502
|
readonly: "",
|
|
499
503
|
disabled: e.disabled,
|
|
@@ -513,7 +517,7 @@ const be = {
|
|
|
513
517
|
X(ae, {
|
|
514
518
|
modelValue: I.value,
|
|
515
519
|
"onUpdate:modelValue": [
|
|
516
|
-
B[0] || (B[0] = (
|
|
520
|
+
B[0] || (B[0] = (A) => I.value = A),
|
|
517
521
|
p
|
|
518
522
|
],
|
|
519
523
|
mode: e.mode,
|
|
@@ -564,40 +568,40 @@ const be = {
|
|
|
564
568
|
d.value = !1, f("close");
|
|
565
569
|
}, I = () => {
|
|
566
570
|
if (!u.value || !v.value) return;
|
|
567
|
-
const
|
|
571
|
+
const _ = u.value.getBoundingClientRect(), y = v.value.getBoundingClientRect();
|
|
568
572
|
let p = 0, S = 0;
|
|
569
573
|
switch (t.placement) {
|
|
570
574
|
case "bottom-left":
|
|
571
|
-
p =
|
|
575
|
+
p = _.bottom + 8, S = _.left;
|
|
572
576
|
break;
|
|
573
577
|
case "bottom-right":
|
|
574
|
-
p =
|
|
578
|
+
p = _.bottom + 8, S = _.right - y.width;
|
|
575
579
|
break;
|
|
576
580
|
case "top-left":
|
|
577
|
-
p =
|
|
581
|
+
p = _.top - y.height - 8, S = _.left;
|
|
578
582
|
break;
|
|
579
583
|
case "top-right":
|
|
580
|
-
p =
|
|
584
|
+
p = _.top - y.height - 8, S = _.right - y.width;
|
|
581
585
|
break;
|
|
582
586
|
}
|
|
583
587
|
g.value = {
|
|
584
588
|
top: `${p}px`,
|
|
585
589
|
left: `${S}px`
|
|
586
590
|
};
|
|
587
|
-
},
|
|
588
|
-
|
|
589
|
-
}, P = (
|
|
590
|
-
|
|
591
|
-
},
|
|
591
|
+
}, q = (_) => {
|
|
592
|
+
_.disabled || (f("select", _), t.closeOnClick && b());
|
|
593
|
+
}, P = (_) => {
|
|
594
|
+
_.stopPropagation();
|
|
595
|
+
}, z = (_) => {
|
|
592
596
|
if (!u.value || !v.value) return;
|
|
593
|
-
const y =
|
|
597
|
+
const y = _.target;
|
|
594
598
|
!u.value.contains(y) && !v.value.contains(y) && b();
|
|
595
599
|
};
|
|
596
600
|
return Z(() => {
|
|
597
|
-
document.addEventListener("click",
|
|
601
|
+
document.addEventListener("click", z), window.addEventListener("scroll", I, !0), window.addEventListener("resize", I);
|
|
598
602
|
}), he(() => {
|
|
599
|
-
document.removeEventListener("click",
|
|
600
|
-
}), (
|
|
603
|
+
document.removeEventListener("click", z), window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I);
|
|
604
|
+
}), (_, y) => (a(), l("div", {
|
|
601
605
|
ref_key: "dropdownRef",
|
|
602
606
|
ref: u,
|
|
603
607
|
class: w(["dropdown", { "dropdown--disabled": e.disabled }])
|
|
@@ -606,7 +610,7 @@ const be = {
|
|
|
606
610
|
onClick: o,
|
|
607
611
|
class: "dropdown__trigger"
|
|
608
612
|
}, [
|
|
609
|
-
D(
|
|
613
|
+
D(_.$slots, "trigger", {}, () => [
|
|
610
614
|
y[0] || (y[0] = n("button", {
|
|
611
615
|
type: "button",
|
|
612
616
|
class: "dropdown__button"
|
|
@@ -624,18 +628,18 @@ const be = {
|
|
|
624
628
|
style: U(g.value),
|
|
625
629
|
onClick: P
|
|
626
630
|
}, [
|
|
627
|
-
|
|
628
|
-
D(
|
|
631
|
+
_.$slots.header ? (a(), l("div", ut, [
|
|
632
|
+
D(_.$slots, "header", {}, void 0, !0)
|
|
629
633
|
])) : c("", !0),
|
|
630
634
|
n("div", mt, [
|
|
631
|
-
D(
|
|
632
|
-
(a(!0), l(L, null,
|
|
635
|
+
D(_.$slots, "default", {}, () => [
|
|
636
|
+
(a(!0), l(L, null, N(e.items, (p, S) => (a(), l(L, { key: S }, [
|
|
633
637
|
p.divider ? (a(), l("div", ft)) : (a(), l("button", {
|
|
634
638
|
key: 1,
|
|
635
639
|
type: "button",
|
|
636
640
|
class: w(["dropdown__item", { "dropdown__item--disabled": p.disabled }]),
|
|
637
641
|
disabled: p.disabled,
|
|
638
|
-
onClick: () =>
|
|
642
|
+
onClick: () => q(p)
|
|
639
643
|
}, [
|
|
640
644
|
p.icon ? (a(), l("span", ht, r(p.icon), 1)) : c("", !0),
|
|
641
645
|
n("span", bt, r(p.label), 1)
|
|
@@ -643,8 +647,8 @@ const be = {
|
|
|
643
647
|
], 64))), 128))
|
|
644
648
|
], !0)
|
|
645
649
|
]),
|
|
646
|
-
|
|
647
|
-
D(
|
|
650
|
+
_.$slots.footer ? (a(), l("div", yt, [
|
|
651
|
+
D(_.$slots, "footer", {}, void 0, !0)
|
|
648
652
|
])) : c("", !0)
|
|
649
653
|
], 6)) : c("", !0)
|
|
650
654
|
]),
|
|
@@ -718,7 +722,7 @@ const be = {
|
|
|
718
722
|
])) : c("", !0)
|
|
719
723
|
], 2));
|
|
720
724
|
}
|
|
721
|
-
}), It = /* @__PURE__ */ x(xt, [["__scopeId", "data-v-
|
|
725
|
+
}), It = /* @__PURE__ */ x(xt, [["__scopeId", "data-v-24e65287"]]), St = {
|
|
722
726
|
key: 0,
|
|
723
727
|
class: "error-summary",
|
|
724
728
|
role: "alert",
|
|
@@ -743,7 +747,7 @@ const be = {
|
|
|
743
747
|
])
|
|
744
748
|
]),
|
|
745
749
|
n("ul", Ot, [
|
|
746
|
-
(a(!0), l(L, null,
|
|
750
|
+
(a(!0), l(L, null, N(e.errors, (f) => (a(), l("li", {
|
|
747
751
|
key: f.id,
|
|
748
752
|
class: "error-summary__item"
|
|
749
753
|
}, [
|
|
@@ -802,7 +806,7 @@ const be = {
|
|
|
802
806
|
_: 3
|
|
803
807
|
}, 8, ["class"]));
|
|
804
808
|
}
|
|
805
|
-
}), Wt = /* @__PURE__ */ x(Ft, [["__scopeId", "data-v-
|
|
809
|
+
}), Wt = /* @__PURE__ */ x(Ft, [["__scopeId", "data-v-507e54e1"]]), Ht = { class: "input-wrapper" }, Ut = ["for"], jt = ["id", "type", "value", "placeholder", "disabled", "required"], Jt = {
|
|
806
810
|
key: 1,
|
|
807
811
|
class: "input-error"
|
|
808
812
|
}, Xt = {
|
|
@@ -864,27 +868,27 @@ const be = {
|
|
|
864
868
|
setup(e, { emit: m }) {
|
|
865
869
|
const t = e, f = m, u = () => {
|
|
866
870
|
f("update:modelValue", !1), f("close");
|
|
867
|
-
}, v = V(null), d = V(!1), g = V(!1), o = V(0), h = V(0), b = V(null), I = V(null),
|
|
871
|
+
}, v = V(null), d = V(!1), g = V(!1), o = V(0), h = V(0), b = V(null), I = V(null), q = (y) => {
|
|
868
872
|
if (!d.value) return;
|
|
869
873
|
const p = Math.abs(y.clientX - o.value), S = Math.abs(y.clientY - h.value);
|
|
870
874
|
(p > 5 || S > 5) && (g.value = !0);
|
|
871
875
|
}, P = (y) => {
|
|
872
|
-
if (window.removeEventListener("pointermove",
|
|
876
|
+
if (window.removeEventListener("pointermove", q), window.removeEventListener("pointerup", P), !d.value || I.value !== "overlay") {
|
|
873
877
|
d.value = !1, g.value = !1, I.value = null;
|
|
874
878
|
return;
|
|
875
879
|
}
|
|
876
880
|
const p = v.value, S = p && y.target === p;
|
|
877
881
|
t.closeOnOverlay && S && !g.value && u(), p && b.value !== null && p.hasPointerCapture(b.value) && p.releasePointerCapture(b.value), b.value = null, d.value = !1, g.value = !1, I.value = null;
|
|
878
|
-
},
|
|
882
|
+
}, z = (y) => {
|
|
879
883
|
if (!t.closeOnOverlay || y.target !== y.currentTarget) return;
|
|
880
884
|
d.value = !0, g.value = !1, I.value = "overlay", o.value = y.clientX, h.value = y.clientY;
|
|
881
885
|
const p = v.value;
|
|
882
|
-
p && (b.value = y.pointerId, p.setPointerCapture(y.pointerId)), window.addEventListener("pointermove",
|
|
883
|
-
},
|
|
886
|
+
p && (b.value = y.pointerId, p.setPointerCapture(y.pointerId)), window.addEventListener("pointermove", q), window.addEventListener("pointerup", P);
|
|
887
|
+
}, _ = () => {
|
|
884
888
|
I.value = "content";
|
|
885
889
|
};
|
|
886
890
|
return ee(() => {
|
|
887
|
-
window.removeEventListener("pointermove",
|
|
891
|
+
window.removeEventListener("pointermove", q), window.removeEventListener("pointerup", P);
|
|
888
892
|
}), Q(() => t.modelValue, (y) => {
|
|
889
893
|
y ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
|
|
890
894
|
}), (y, p) => (a(), W(J, { to: "body" }, [
|
|
@@ -895,13 +899,13 @@ const be = {
|
|
|
895
899
|
ref_key: "overlayRef",
|
|
896
900
|
ref: v,
|
|
897
901
|
class: "modal-overlay",
|
|
898
|
-
onPointerdown: O(
|
|
902
|
+
onPointerdown: O(z, ["self"])
|
|
899
903
|
}, [
|
|
900
904
|
n("div", {
|
|
901
905
|
class: w(["modal-content", [`modal-content--${e.size}`]]),
|
|
902
906
|
onClick: p[0] || (p[0] = O(() => {
|
|
903
907
|
}, ["stop"])),
|
|
904
|
-
onPointerdown: O(
|
|
908
|
+
onPointerdown: O(_, ["stop"]),
|
|
905
909
|
onPointerup: p[1] || (p[1] = O(() => {
|
|
906
910
|
}, ["stop"]))
|
|
907
911
|
}, [
|
|
@@ -1021,7 +1025,7 @@ const be = {
|
|
|
1021
1025
|
onChange: g
|
|
1022
1026
|
}, [
|
|
1023
1027
|
e.placeholder ? (a(), l("option", va, r(e.placeholder), 1)) : c("", !0),
|
|
1024
|
-
(a(!0), l(L, null,
|
|
1028
|
+
(a(!0), l(L, null, N(e.options, (b) => (a(), l("option", {
|
|
1025
1029
|
key: b.value,
|
|
1026
1030
|
value: b.value
|
|
1027
1031
|
}, r(b.label), 9, ha))), 128))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@davidbirchall/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Vue 3 component library with TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
-
"./
|
|
15
|
+
"./core.css": "./dist/core.css"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"components",
|
|
33
33
|
"typescript"
|
|
34
34
|
],
|
|
35
|
-
"author": "",
|
|
35
|
+
"author": "David Birchall",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"vue": "^3.4.0"
|
|
@@ -45,15 +45,16 @@
|
|
|
45
45
|
"@testing-library/jest-dom": "^6.9.1",
|
|
46
46
|
"@testing-library/user-event": "^14.6.1",
|
|
47
47
|
"@testing-library/vue": "^8.1.0",
|
|
48
|
-
"@vitejs/plugin-vue": "^
|
|
48
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
49
49
|
"@vitest/ui": "^4.0.17",
|
|
50
50
|
"@vue/test-utils": "^2.4.6",
|
|
51
51
|
"happy-dom": "^20.3.4",
|
|
52
52
|
"storybook": "^8.6.15",
|
|
53
53
|
"typescript": "^5.3.3",
|
|
54
|
-
"vite": "^
|
|
54
|
+
"vite": "^6.0.0",
|
|
55
55
|
"vitest": "^4.0.17",
|
|
56
56
|
"vue": "^3.4.15",
|
|
57
|
-
"vue-tsc": "^3.2.4"
|
|
57
|
+
"vue-tsc": "^3.2.4",
|
|
58
|
+
"vite-plugin-dts": "^3.0.0"
|
|
58
59
|
}
|
|
59
60
|
}
|