@pequity/squirrel 1.0.19 → 1.0.20-beta.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.
- package/dist/cjs/chunks/_plugin-vue_export-helper.js +1 -0
- package/dist/cjs/chunks/p-action-bar.js +1 -0
- package/dist/cjs/chunks/p-card.js +1 -0
- package/dist/cjs/chunks/p-checkbox.js +1 -0
- package/dist/cjs/chunks/p-dropdown-select.js +1 -0
- package/dist/cjs/chunks/p-input-percent.js +1 -0
- package/dist/cjs/chunks/p-pagination-info.js +1 -0
- package/dist/cjs/chunks/p-pagination.js +1 -0
- package/dist/cjs/chunks/p-ring-loader.js +1 -0
- package/dist/cjs/chunks/p-select-btn.js +1 -0
- package/dist/cjs/chunks/p-select.js +1 -0
- package/dist/cjs/chunks/p-table-loader.js +1 -0
- package/dist/cjs/chunks/p-tabs.js +1 -0
- package/dist/cjs/config.js +1 -0
- package/dist/cjs/currency.js +1 -0
- package/dist/cjs/dom.js +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/inputClassesMixin.js +1 -0
- package/dist/cjs/inputClassesShared.js +1 -0
- package/dist/cjs/listKeyboardNavigation.js +1 -0
- package/dist/cjs/number.js +1 -0
- package/dist/cjs/object.js +1 -0
- package/dist/cjs/p-action-bar.js +1 -0
- package/dist/cjs/p-alert.js +1 -0
- package/dist/cjs/p-avatar.js +1 -0
- package/dist/cjs/p-btn.js +5 -0
- package/dist/cjs/p-card.js +1 -0
- package/dist/cjs/p-checkbox.js +1 -0
- package/dist/cjs/p-chips.js +1 -0
- package/dist/cjs/p-close-btn.js +1 -0
- package/dist/cjs/p-date-picker.js +1 -0
- package/dist/cjs/p-drawer.js +1 -0
- package/dist/cjs/p-dropdown-select.js +1 -0
- package/dist/cjs/p-dropdown.js +1 -0
- package/dist/cjs/p-file-upload.js +1 -0
- package/dist/cjs/p-info-icon.js +1 -0
- package/dist/cjs/p-inline-date-picker.js +1 -0
- package/dist/cjs/p-input-number.js +1 -0
- package/dist/cjs/p-input-percent.js +1 -0
- package/dist/cjs/p-input-search.js +1 -0
- package/dist/cjs/p-input.js +1 -0
- package/dist/cjs/p-loading.js +1 -0
- package/dist/cjs/p-modal.js +1 -0
- package/dist/cjs/p-pagination-info.js +1 -0
- package/dist/cjs/p-pagination.js +1 -0
- package/dist/cjs/p-progress-bar.js +1 -0
- package/dist/cjs/p-ring-loader.js +1 -0
- package/dist/cjs/p-select-btn.js +1 -0
- package/dist/cjs/p-select-list.js +1 -0
- package/dist/cjs/p-select-pill.js +1 -0
- package/dist/cjs/p-select.js +1 -0
- package/dist/cjs/p-skeleton-loader.js +1 -0
- package/dist/cjs/p-table-filter-icon.js +1 -0
- package/dist/cjs/p-table-header-cell.js +1 -0
- package/dist/cjs/p-table-loader.js +1 -0
- package/dist/cjs/p-table-sort.js +1 -0
- package/dist/cjs/p-table-td.js +1 -0
- package/dist/cjs/p-table.js +1 -0
- package/dist/cjs/p-tabs.js +1 -0
- package/dist/cjs/p-textarea.js +1 -0
- package/dist/cjs/p-toggle.js +1 -0
- package/dist/cjs/pagination.js +1 -0
- package/dist/cjs/string.js +1 -0
- package/dist/cjs/tailwind.js +1 -0
- package/dist/cjs/text.js +1 -0
- package/dist/cjs/useInputClasses.js +1 -0
- package/dist/cjs/usePLoading.js +1 -0
- package/dist/cjs/usePModal.js +1 -0
- package/dist/cjs/usePTableColResize.js +1 -0
- package/dist/cjs/usePTableRowVirtualizer.js +1 -0
- package/dist/cjs/useSelectList.js +1 -0
- package/dist/es/chunks/_plugin-vue_export-helper.js +9 -0
- package/dist/es/chunks/p-action-bar.js +52 -0
- package/dist/es/chunks/p-card.js +25 -0
- package/dist/es/chunks/p-checkbox.js +22 -0
- package/dist/es/chunks/p-dropdown-select.js +366 -0
- package/dist/es/chunks/p-input-percent.js +45 -0
- package/dist/es/chunks/p-pagination-info.js +61 -0
- package/dist/es/chunks/p-pagination.js +93 -0
- package/dist/es/chunks/p-ring-loader.js +59 -0
- package/dist/es/chunks/p-select-btn.js +77 -0
- package/dist/es/chunks/p-select.js +97 -0
- package/dist/es/chunks/p-table-loader.js +57 -0
- package/dist/es/chunks/p-tabs.js +47 -0
- package/dist/es/config.js +105 -0
- package/dist/es/currency.js +9 -0
- package/dist/es/dom.js +15 -0
- package/dist/es/index.js +836 -0
- package/dist/es/inputClassesMixin.js +45 -0
- package/dist/es/inputClassesShared.js +61 -0
- package/dist/es/listKeyboardNavigation.js +60 -0
- package/dist/es/number.js +4 -0
- package/dist/es/object.js +4 -0
- package/dist/es/p-action-bar.js +4 -0
- package/dist/es/p-alert.js +61 -0
- package/dist/es/p-avatar.js +69 -0
- package/dist/es/p-btn.js +317 -0
- package/dist/es/p-card.js +4 -0
- package/dist/es/p-checkbox.js +4 -0
- package/dist/es/p-chips.js +91 -0
- package/dist/es/p-close-btn.js +33 -0
- package/dist/es/p-date-picker.js +132 -0
- package/dist/es/p-drawer.js +235 -0
- package/dist/es/p-dropdown-select.js +4 -0
- package/dist/es/p-dropdown.js +120 -0
- package/dist/es/p-file-upload.js +13 -0
- package/dist/es/p-info-icon.js +31 -0
- package/dist/es/p-inline-date-picker.js +132 -0
- package/dist/es/p-input-number.js +129 -0
- package/dist/es/p-input-percent.js +4 -0
- package/dist/es/p-input-search.js +109 -0
- package/dist/es/p-input.js +84 -0
- package/dist/es/p-loading.js +30 -0
- package/dist/es/p-modal.js +283 -0
- package/dist/es/p-pagination-info.js +4 -0
- package/dist/es/p-pagination.js +4 -0
- package/dist/es/p-progress-bar.js +39 -0
- package/dist/es/p-ring-loader.js +4 -0
- package/dist/es/p-select-btn.js +4 -0
- package/dist/es/p-select-list.js +4 -0
- package/dist/es/p-select-pill.js +95 -0
- package/dist/es/p-select.js +4 -0
- package/dist/es/p-skeleton-loader.js +69 -0
- package/dist/es/p-table-filter-icon.js +21 -0
- package/dist/es/p-table-header-cell.js +71 -0
- package/dist/es/p-table-loader.js +4 -0
- package/dist/es/p-table-sort.js +8 -0
- package/dist/es/p-table-td.js +42 -0
- package/dist/es/p-table.js +8 -0
- package/dist/es/p-tabs.js +4 -0
- package/dist/es/p-textarea.js +72 -0
- package/dist/es/p-toggle.js +110 -0
- package/dist/es/pagination.js +12 -0
- package/dist/es/string.js +4 -0
- package/dist/es/tailwind.js +3794 -0
- package/dist/es/text.js +11 -0
- package/dist/es/useInputClasses.js +28 -0
- package/dist/es/usePLoading.js +19 -0
- package/dist/es/usePModal.js +18 -0
- package/dist/es/usePTableColResize.js +49 -0
- package/dist/es/usePTableRowVirtualizer.js +22 -0
- package/dist/es/useSelectList.js +143 -0
- package/dist/style.css +1 -1
- package/package.json +22 -20
- package/dist/squirrel.cjs.js +0 -5
- package/dist/squirrel.es.js +0 -8220
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { INPUT_SIZES as t, ERROR_MSG as n, INPUT_BASE as a, SPACING_PREFIX as o, SPACING_LEFT as E, SPACING_SUFFIX as l, SPACING_RIGHT as r, INPUT_ERROR as S, INPUT_NORMAL as u, LABEL_BASE as $, LABEL_SIZES as p, LABEL_REQUIRED as c, SELECT_BASE as C, SELECT_ARROW as _, SELECT_SIZES as h, TEXTAREA_BASE as A } from "./inputClassesShared.js";
|
|
2
|
+
import { defineComponent as I } from "vue";
|
|
3
|
+
const L = I({
|
|
4
|
+
props: {
|
|
5
|
+
size: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: "md",
|
|
8
|
+
validator(s) {
|
|
9
|
+
return Object.keys(t).includes(s);
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
errorMsg: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
required: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !1
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
errorMsgClasses: n
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
inputClasses() {
|
|
28
|
+
const s = `${a} ${t[this.size]}`, e = this.$slots.prefix ? o[this.size] : E[this.size], i = this.$slots.suffix ? l[this.size] : r[this.size];
|
|
29
|
+
return `${s} ${e} ${i} ${this.errorMsg ? S : u}`;
|
|
30
|
+
},
|
|
31
|
+
labelClasses() {
|
|
32
|
+
const s = `${$} ${p[this.size]}`;
|
|
33
|
+
return this.required ? `${s} ${c}` : s;
|
|
34
|
+
},
|
|
35
|
+
selectClasses() {
|
|
36
|
+
return `${this.inputClasses.replace(` ${r[this.size]}`, "")} ${C} ${_} ${h[this.size]}`;
|
|
37
|
+
},
|
|
38
|
+
textareaClasses() {
|
|
39
|
+
return `${this.inputClasses} ${A}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
L as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const r = "block mb-1 font-bold", e = {
|
|
2
|
+
sm: "text-xs",
|
|
3
|
+
md: "text-sm",
|
|
4
|
+
lg: "text-base"
|
|
5
|
+
}, t = "after:content-['_*'] after:text-on-error", o = "text-xs text-on-error mt-1", n = [
|
|
6
|
+
"text-night",
|
|
7
|
+
"w-full",
|
|
8
|
+
"bg-surface",
|
|
9
|
+
"focus:outline-none",
|
|
10
|
+
"border-0",
|
|
11
|
+
"ring-1",
|
|
12
|
+
"ring-inset",
|
|
13
|
+
"focus:ring-2",
|
|
14
|
+
"disabled:ring-p-gray-30",
|
|
15
|
+
"disabled:hover:ring-p-gray-30",
|
|
16
|
+
"disabled:bg-p-blue-10",
|
|
17
|
+
"disabled:cursor-default",
|
|
18
|
+
"placeholder:text-p-gray-40"
|
|
19
|
+
].join(" "), s = "ring-p-gray-30 hover:ring-primary focus:ring-primary", g = "ring-on-error hover:ring-on-error focus:ring-on-error", c = {
|
|
20
|
+
sm: "h-8 text-sm rounded",
|
|
21
|
+
md: "h-10 text-base rounded",
|
|
22
|
+
lg: "h-12 text-lg rounded"
|
|
23
|
+
}, l = "resize-y px-3 py-3 overflow-auto h-auto", p = "truncate", d = "squirrel-bg-chevron-down bg-no-repeat appearance-none", i = {
|
|
24
|
+
sm: "bg-[right_0.675rem_center] pr-8",
|
|
25
|
+
md: "bg-[right_1rem_center] pr-10",
|
|
26
|
+
lg: "bg-[right_1.25rem_center] pr-12"
|
|
27
|
+
}, a = {
|
|
28
|
+
sm: "pl-3",
|
|
29
|
+
md: "pl-4",
|
|
30
|
+
lg: "pl-5"
|
|
31
|
+
}, E = {
|
|
32
|
+
sm: "pr-3",
|
|
33
|
+
md: "pr-4",
|
|
34
|
+
lg: "pr-5"
|
|
35
|
+
}, m = {
|
|
36
|
+
sm: "pl-6",
|
|
37
|
+
md: "pl-8",
|
|
38
|
+
lg: "pl-12"
|
|
39
|
+
}, _ = {
|
|
40
|
+
sm: "pr-6",
|
|
41
|
+
md: "pr-8",
|
|
42
|
+
lg: "pr-12"
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
o as ERROR_MSG,
|
|
46
|
+
n as INPUT_BASE,
|
|
47
|
+
g as INPUT_ERROR,
|
|
48
|
+
s as INPUT_NORMAL,
|
|
49
|
+
c as INPUT_SIZES,
|
|
50
|
+
r as LABEL_BASE,
|
|
51
|
+
t as LABEL_REQUIRED,
|
|
52
|
+
e as LABEL_SIZES,
|
|
53
|
+
d as SELECT_ARROW,
|
|
54
|
+
p as SELECT_BASE,
|
|
55
|
+
i as SELECT_SIZES,
|
|
56
|
+
a as SPACING_LEFT,
|
|
57
|
+
m as SPACING_PREFIX,
|
|
58
|
+
E as SPACING_RIGHT,
|
|
59
|
+
_ as SPACING_SUFFIX,
|
|
60
|
+
l as TEXTAREA_BASE
|
|
61
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { isElement as S, isVisible as A, getNextActiveElement as K } from "./dom.js";
|
|
2
|
+
const L = "ArrowUp", y = "ArrowDown", R = "Enter", _ = "focus", F = Object.freeze({
|
|
3
|
+
itemContainer: null,
|
|
4
|
+
// HTMLElement
|
|
5
|
+
itemSelector: ".dropdown-item:not(.disabled), .dropdown-item:not(:disabled)",
|
|
6
|
+
itemFocusClass: _,
|
|
7
|
+
/**
|
|
8
|
+
* The selector for the event trigger
|
|
9
|
+
*/
|
|
10
|
+
itemSelectSelector: "",
|
|
11
|
+
/**
|
|
12
|
+
* The keys to trigger selection
|
|
13
|
+
*/
|
|
14
|
+
itemSelectKeys: [R],
|
|
15
|
+
/**
|
|
16
|
+
* The events to trigger on selection (enter/space)
|
|
17
|
+
*/
|
|
18
|
+
itemSelectEvents: ["click"]
|
|
19
|
+
});
|
|
20
|
+
let c = null;
|
|
21
|
+
const D = (l) => {
|
|
22
|
+
if (!l || !l.itemContainer)
|
|
23
|
+
throw Error("You must define an item container");
|
|
24
|
+
const b = { ...F, ...l }, { itemContainer: n, itemSelector: w, itemFocusClass: a, itemSelectSelector: f, itemSelectEvents: g, itemSelectKeys: C } = b, r = () => !n || !S(n) ? [] : [...n.querySelectorAll(`${w}`)].filter((t) => A(t)), i = () => r().find((e) => e.classList.contains(a)), m = () => {
|
|
25
|
+
r().forEach((e) => e.classList.remove(a));
|
|
26
|
+
}, v = (e) => {
|
|
27
|
+
m(), e == null || e.classList.add(a);
|
|
28
|
+
}, d = (e) => {
|
|
29
|
+
if ([L, y].includes(e.key)) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
const t = r();
|
|
32
|
+
if (!t.length)
|
|
33
|
+
return;
|
|
34
|
+
const o = i() ?? e.target, s = K(t, o, e.key === y, !1);
|
|
35
|
+
v(s), k(s);
|
|
36
|
+
}
|
|
37
|
+
if (C.includes(e.key) && i()) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
const t = i(), o = f ? t == null ? void 0 : t.querySelector(f) : i();
|
|
40
|
+
g.forEach((s) => {
|
|
41
|
+
const p = new Event(s);
|
|
42
|
+
o && o.dispatchEvent(p);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, E = () => {
|
|
46
|
+
c === u || (c && (console.warn("There can only be one instance of list navigation active at a time."), c.destroy()), document.addEventListener("keydown", d), c = u);
|
|
47
|
+
}, h = () => {
|
|
48
|
+
m(), document.removeEventListener("keydown", d), c = null;
|
|
49
|
+
}, k = (e) => {
|
|
50
|
+
if (!n || !S(n))
|
|
51
|
+
return;
|
|
52
|
+
const t = n.getBoundingClientRect(), { top: o, bottom: s } = e.getBoundingClientRect();
|
|
53
|
+
o < t.top ? e.scrollIntoView({ behavior: "auto", block: "nearest", inline: "start" }) : s > t.bottom && e.scrollIntoView({ behavior: "auto", block: "nearest", inline: "end" });
|
|
54
|
+
}, u = { getItems: r, getFocusedItem: i, clearFocusedState: m, setFocusedItem: v, listKeydown: d, init: E, destroy: h };
|
|
55
|
+
return E(), u;
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
_ as ITEM_FOCUS_CLASS,
|
|
59
|
+
D as setupListKeyboardNavigation
|
|
60
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getColor as C } from "./tailwind.js";
|
|
2
|
+
import { defineComponent as l, openBlock as o, createElementBlock as s, normalizeClass as i, createElementVNode as t, renderSlot as n } from "vue";
|
|
3
|
+
import { _ as c } from "./chunks/_plugin-vue_export-helper.js";
|
|
4
|
+
const r = {
|
|
5
|
+
info: "bg-info text-on-info",
|
|
6
|
+
warning: "bg-warning text-on-warning",
|
|
7
|
+
error: "bg-error text-on-error",
|
|
8
|
+
success: "bg-success text-on-success"
|
|
9
|
+
}, a = l({
|
|
10
|
+
name: "PAlert",
|
|
11
|
+
props: {
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "info",
|
|
15
|
+
validator(e) {
|
|
16
|
+
return Object.keys(r).includes(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
classes() {
|
|
22
|
+
return `${r[this.type]}`;
|
|
23
|
+
},
|
|
24
|
+
svgColor() {
|
|
25
|
+
const e = `on-${this.type}`;
|
|
26
|
+
return C(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}), d = { class: "flex" }, p = { class: "pr-2" }, f = {
|
|
30
|
+
width: "16",
|
|
31
|
+
height: "16",
|
|
32
|
+
viewBox: "0 0 16 16",
|
|
33
|
+
fill: "none",
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
35
|
+
}, u = ["fill"];
|
|
36
|
+
function g(e, m, _, h, v, w) {
|
|
37
|
+
return o(), s("div", {
|
|
38
|
+
class: i(["rounded p-4 text-xs font-semibold", e.classes]),
|
|
39
|
+
role: "alert"
|
|
40
|
+
}, [
|
|
41
|
+
t("div", d, [
|
|
42
|
+
t("div", p, [
|
|
43
|
+
n(e.$slots, "icon", {}, () => [
|
|
44
|
+
(o(), s("svg", f, [
|
|
45
|
+
t("path", {
|
|
46
|
+
d: "M8 0C6.41775 0 4.87104 0.469192 3.55544 1.34824C2.23985 2.22729 1.21447 3.47672 0.608967 4.93853C0.00346629 6.40034 -0.15496 8.00887 0.153721 9.56072C0.462403 11.1126 1.22433 12.538 2.34315 13.6569C3.46197 14.7757 4.88743 15.5376 6.43928 15.8463C7.99113 16.155 9.59966 15.9965 11.0615 15.391C12.5233 14.7855 13.7727 13.7602 14.6518 12.4446C15.5308 11.129 16 9.58225 16 8C16 5.87827 15.1571 3.84344 13.6569 2.34315C12.1566 0.842855 10.1217 0 8 0V0ZM8.16667 3.33333C8.36445 3.33333 8.55779 3.39198 8.72224 3.50186C8.88669 3.61175 9.01486 3.76792 9.09055 3.95065C9.16624 4.13338 9.18604 4.33444 9.14746 4.52842C9.10887 4.72241 9.01363 4.90059 8.87378 5.04044C8.73392 5.18029 8.55574 5.27553 8.36176 5.31412C8.16778 5.3527 7.96671 5.3329 7.78399 5.25721C7.60126 5.18153 7.44508 5.05335 7.3352 4.8889C7.22532 4.72445 7.16667 4.53112 7.16667 4.33333C7.16667 4.06812 7.27203 3.81376 7.45956 3.62623C7.6471 3.43869 7.90145 3.33333 8.16667 3.33333ZM9.66667 12.3333H7C6.82319 12.3333 6.65362 12.2631 6.5286 12.1381C6.40358 12.013 6.33334 11.8435 6.33334 11.6667C6.33334 11.4899 6.40358 11.3203 6.5286 11.1953C6.65362 11.0702 6.82319 11 7 11H7.5C7.54421 11 7.5866 10.9824 7.61786 10.9512C7.64911 10.9199 7.66667 10.8775 7.66667 10.8333V7.83333C7.66667 7.78913 7.64911 7.74674 7.61786 7.71548C7.5866 7.68423 7.54421 7.66667 7.5 7.66667H7C6.82319 7.66667 6.65362 7.59643 6.5286 7.47141C6.40358 7.34638 6.33334 7.17681 6.33334 7C6.33334 6.82319 6.40358 6.65362 6.5286 6.5286C6.65362 6.40357 6.82319 6.33333 7 6.33333H7.66667C8.02029 6.33333 8.35943 6.47381 8.60948 6.72386C8.85953 6.97391 9 7.31305 9 7.66667V10.8333C9 10.8775 9.01756 10.9199 9.04882 10.9512C9.08008 10.9824 9.12247 11 9.16667 11H9.66667C9.84348 11 10.0131 11.0702 10.1381 11.1953C10.2631 11.3203 10.3333 11.4899 10.3333 11.6667C10.3333 11.8435 10.2631 12.013 10.1381 12.1381C10.0131 12.2631 9.84348 12.3333 9.66667 12.3333Z",
|
|
47
|
+
fill: e.svgColor
|
|
48
|
+
}, null, 8, u)
|
|
49
|
+
]))
|
|
50
|
+
])
|
|
51
|
+
]),
|
|
52
|
+
t("div", null, [
|
|
53
|
+
n(e.$slots, "default")
|
|
54
|
+
])
|
|
55
|
+
])
|
|
56
|
+
], 2);
|
|
57
|
+
}
|
|
58
|
+
const y = /* @__PURE__ */ c(a, [["render", g]]);
|
|
59
|
+
export {
|
|
60
|
+
y as default
|
|
61
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { defineComponent as n, openBlock as l, createElementBlock as r, normalizeClass as s, toDisplayString as i } from "vue";
|
|
2
|
+
import { _ as o } from "./chunks/_plugin-vue_export-helper.js";
|
|
3
|
+
const a = {
|
|
4
|
+
rectangle: "rectangle",
|
|
5
|
+
circle: "circle"
|
|
6
|
+
}, c = {
|
|
7
|
+
[a.rectangle]: "rounded-lg",
|
|
8
|
+
[a.circle]: "rounded-full"
|
|
9
|
+
}, p = n({
|
|
10
|
+
name: "PAvatar",
|
|
11
|
+
props: {
|
|
12
|
+
shape: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: a.circle,
|
|
15
|
+
validator: (e) => Object.values(a).includes(e)
|
|
16
|
+
},
|
|
17
|
+
imageSrc: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
label: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: !0
|
|
24
|
+
},
|
|
25
|
+
imageClass: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
labelClass: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
imageBroken: !1
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
shapeClass() {
|
|
41
|
+
return c[this.shape];
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
watch: {
|
|
45
|
+
imageSrc() {
|
|
46
|
+
this.imageBroken = !1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}), u = ["src", "alt"];
|
|
50
|
+
function m(e, t, d, f, g, S) {
|
|
51
|
+
return l(), r("div", {
|
|
52
|
+
class: s(e.shapeClass)
|
|
53
|
+
}, [
|
|
54
|
+
e.imageSrc && !e.imageBroken ? (l(), r("img", {
|
|
55
|
+
key: 0,
|
|
56
|
+
src: e.imageSrc,
|
|
57
|
+
alt: e.label,
|
|
58
|
+
class: s(["h-full w-full object-cover", [e.shapeClass, e.imageClass]]),
|
|
59
|
+
onError: t[0] || (t[0] = (h) => e.imageBroken = !0)
|
|
60
|
+
}, null, 42, u)) : (l(), r("div", {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: s(["flex h-full w-full items-center justify-center", [e.shapeClass, e.labelClass]])
|
|
63
|
+
}, i(e.label), 3))
|
|
64
|
+
], 2);
|
|
65
|
+
}
|
|
66
|
+
const k = /* @__PURE__ */ o(p, [["render", m]]);
|
|
67
|
+
export {
|
|
68
|
+
k as default
|
|
69
|
+
};
|
package/dist/es/p-btn.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { _ as P } from "./chunks/p-ring-loader.js";
|
|
2
|
+
import { getColorDeep as U } from "./tailwind.js";
|
|
3
|
+
import { defineComponent as I, reactive as B, inject as b, computed as c, h as x, unref as g, getCurrentInstance as V, watchEffect as $, resolveComponent as w, openBlock as m, createElementBlock as K, mergeProps as y, renderSlot as h, createBlock as S, resolveDynamicComponent as M, withCtx as z, createElementVNode as j, normalizeClass as G, normalizeStyle as H, createCommentVNode as q } from "vue";
|
|
4
|
+
import { _ as Z } from "./chunks/_plugin-vue_export-helper.js";
|
|
5
|
+
/*!
|
|
6
|
+
* vue-router v4.3.0
|
|
7
|
+
* (c) 2024 Eduardo San Martin Morote
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
const W = typeof document < "u", J = () => {
|
|
11
|
+
}, d = Array.isArray;
|
|
12
|
+
function R(e, t) {
|
|
13
|
+
return (e.aliasOf || e) === (t.aliasOf || t);
|
|
14
|
+
}
|
|
15
|
+
function Q(e, t) {
|
|
16
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
17
|
+
return !1;
|
|
18
|
+
for (const r in e)
|
|
19
|
+
if (!X(e[r], t[r]))
|
|
20
|
+
return !1;
|
|
21
|
+
return !0;
|
|
22
|
+
}
|
|
23
|
+
function X(e, t) {
|
|
24
|
+
return d(e) ? O(e, t) : d(t) ? O(t, e) : e === t;
|
|
25
|
+
}
|
|
26
|
+
function O(e, t) {
|
|
27
|
+
return d(t) ? e.length === t.length && e.every((r, o) => r === t[o]) : e.length === 1 && e[0] === t;
|
|
28
|
+
}
|
|
29
|
+
var A;
|
|
30
|
+
(function(e) {
|
|
31
|
+
e.pop = "pop", e.push = "push";
|
|
32
|
+
})(A || (A = {}));
|
|
33
|
+
var _;
|
|
34
|
+
(function(e) {
|
|
35
|
+
e.back = "back", e.forward = "forward", e.unknown = "";
|
|
36
|
+
})(_ || (_ = {}));
|
|
37
|
+
Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
|
|
38
|
+
var C;
|
|
39
|
+
(function(e) {
|
|
40
|
+
e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
|
|
41
|
+
})(C || (C = {}));
|
|
42
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
|
|
43
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
|
|
44
|
+
const T = Symbol(process.env.NODE_ENV !== "production" ? "router" : ""), F = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
|
|
45
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
|
|
46
|
+
function N(e) {
|
|
47
|
+
const t = b(T), r = b(F), o = c(() => t.resolve(g(e.to))), a = c(() => {
|
|
48
|
+
const { matched: s } = o.value, { length: i } = s, f = s[i - 1], p = r.matched;
|
|
49
|
+
if (!f || !p.length)
|
|
50
|
+
return -1;
|
|
51
|
+
const v = p.findIndex(R.bind(null, f));
|
|
52
|
+
if (v > -1)
|
|
53
|
+
return v;
|
|
54
|
+
const E = L(s[i - 2]);
|
|
55
|
+
return (
|
|
56
|
+
// we are dealing with nested routes
|
|
57
|
+
i > 1 && // if the parent and matched route have the same path, this link is
|
|
58
|
+
// referring to the empty child. Or we currently are on a different
|
|
59
|
+
// child of the same parent
|
|
60
|
+
L(f) === E && // avoid comparing the child with its parent
|
|
61
|
+
p[p.length - 1].path !== E ? p.findIndex(R.bind(null, s[i - 2])) : v
|
|
62
|
+
);
|
|
63
|
+
}), l = c(() => a.value > -1 && ne(r.params, o.value.params)), u = c(() => a.value > -1 && a.value === r.matched.length - 1 && Q(r.params, o.value.params));
|
|
64
|
+
function Y(s = {}) {
|
|
65
|
+
return re(s) ? t[g(e.replace) ? "replace" : "push"](
|
|
66
|
+
g(e.to)
|
|
67
|
+
// avoid uncaught errors are they are logged anyway
|
|
68
|
+
).catch(J) : Promise.resolve();
|
|
69
|
+
}
|
|
70
|
+
if (process.env.NODE_ENV !== "production" && W) {
|
|
71
|
+
const s = V();
|
|
72
|
+
if (s) {
|
|
73
|
+
const i = {
|
|
74
|
+
route: o.value,
|
|
75
|
+
isActive: l.value,
|
|
76
|
+
isExactActive: u.value
|
|
77
|
+
};
|
|
78
|
+
s.__vrl_devtools = s.__vrl_devtools || [], s.__vrl_devtools.push(i), $(() => {
|
|
79
|
+
i.route = o.value, i.isActive = l.value, i.isExactActive = u.value;
|
|
80
|
+
}, { flush: "post" });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
route: o,
|
|
85
|
+
href: c(() => o.value.href),
|
|
86
|
+
isActive: l,
|
|
87
|
+
isExactActive: u,
|
|
88
|
+
navigate: Y
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const ee = /* @__PURE__ */ I({
|
|
92
|
+
name: "RouterLink",
|
|
93
|
+
compatConfig: { MODE: 3 },
|
|
94
|
+
props: {
|
|
95
|
+
to: {
|
|
96
|
+
type: [String, Object],
|
|
97
|
+
required: !0
|
|
98
|
+
},
|
|
99
|
+
replace: Boolean,
|
|
100
|
+
activeClass: String,
|
|
101
|
+
// inactiveClass: String,
|
|
102
|
+
exactActiveClass: String,
|
|
103
|
+
custom: Boolean,
|
|
104
|
+
ariaCurrentValue: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: "page"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
useLink: N,
|
|
110
|
+
setup(e, { slots: t }) {
|
|
111
|
+
const r = B(N(e)), { options: o } = b(T), a = c(() => ({
|
|
112
|
+
[k(e.activeClass, o.linkActiveClass, "router-link-active")]: r.isActive,
|
|
113
|
+
// [getLinkClass(
|
|
114
|
+
// props.inactiveClass,
|
|
115
|
+
// options.linkInactiveClass,
|
|
116
|
+
// 'router-link-inactive'
|
|
117
|
+
// )]: !link.isExactActive,
|
|
118
|
+
[k(e.exactActiveClass, o.linkExactActiveClass, "router-link-exact-active")]: r.isExactActive
|
|
119
|
+
}));
|
|
120
|
+
return () => {
|
|
121
|
+
const l = t.default && t.default(r);
|
|
122
|
+
return e.custom ? l : x("a", {
|
|
123
|
+
"aria-current": r.isExactActive ? e.ariaCurrentValue : null,
|
|
124
|
+
href: r.href,
|
|
125
|
+
// this would override user added attrs but Vue will still add
|
|
126
|
+
// the listener, so we end up triggering both
|
|
127
|
+
onClick: r.navigate,
|
|
128
|
+
class: a.value
|
|
129
|
+
}, l);
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}), te = ee;
|
|
133
|
+
function re(e) {
|
|
134
|
+
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && !e.defaultPrevented && !(e.button !== void 0 && e.button !== 0)) {
|
|
135
|
+
if (e.currentTarget && e.currentTarget.getAttribute) {
|
|
136
|
+
const t = e.currentTarget.getAttribute("target");
|
|
137
|
+
if (/\b_blank\b/i.test(t))
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
return e.preventDefault && e.preventDefault(), !0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function ne(e, t) {
|
|
144
|
+
for (const r in t) {
|
|
145
|
+
const o = t[r], a = e[r];
|
|
146
|
+
if (typeof o == "string") {
|
|
147
|
+
if (o !== a)
|
|
148
|
+
return !1;
|
|
149
|
+
} else if (!d(a) || a.length !== o.length || o.some((l, u) => l !== a[u]))
|
|
150
|
+
return !1;
|
|
151
|
+
}
|
|
152
|
+
return !0;
|
|
153
|
+
}
|
|
154
|
+
function L(e) {
|
|
155
|
+
return e ? e.aliasOf ? e.aliasOf.path : e.path : "";
|
|
156
|
+
}
|
|
157
|
+
const k = (e, t, r) => e ?? t ?? r, n = {
|
|
158
|
+
PRIMARY: "primary",
|
|
159
|
+
SECONDARY: "secondary",
|
|
160
|
+
PRIMARY_OUTLINE: "primary-outline",
|
|
161
|
+
SECONDARY_OUTLINE: "secondary-outline",
|
|
162
|
+
SECONDARY_OUTLINE_BLUE: "secondary-outline-blue",
|
|
163
|
+
ERROR: "error",
|
|
164
|
+
SUCCESS: "success",
|
|
165
|
+
PRIMARY_LINK: "primary-link",
|
|
166
|
+
SECONDARY_GHOST: "secondary-ghost",
|
|
167
|
+
SECONDARY_GHOST_DARK: "secondary-ghost-dark"
|
|
168
|
+
}, oe = ["button", "submit", "reset"], ae = "relative inline-block outline-none disabled:opacity-50 disabled:cursor-default disabled:pointer-events-none", se = {
|
|
169
|
+
[n.PRIMARY]: "text-surface bg-primary hover:bg-accent active:bg-p-blue-80",
|
|
170
|
+
[n.SECONDARY]: "bg-p-gray-20 hover:bg-p-gray-30 active:bg-p-gray-40",
|
|
171
|
+
[n.PRIMARY_OUTLINE]: "text-p-purple-60 bg-p-blue-10 border border-p-purple-60 hover:bg-p-gray-20 focus:ring-1 focus:ring-p-purple-60",
|
|
172
|
+
[n.SECONDARY_OUTLINE]: "text-p-purple-60 bg-surface border border-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-10",
|
|
173
|
+
[n.SECONDARY_OUTLINE_BLUE]: "text-p-purple-60 bg-surface border border-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-15 aria-selected:text-p-blue-60",
|
|
174
|
+
[n.ERROR]: "text-white bg-p-red-40 hover:bg-p-red-50",
|
|
175
|
+
[n.SUCCESS]: "text-white bg-p-green-40 hover:bg-p-green-50",
|
|
176
|
+
[n.PRIMARY_LINK]: "text-primary bg-transparent hover:text-accent underline",
|
|
177
|
+
[n.SECONDARY_GHOST]: "text-on-surface hover:bg-p-gray-20",
|
|
178
|
+
[n.SECONDARY_GHOST_DARK]: "text-white hover:bg-p-purple-50"
|
|
179
|
+
}, D = {
|
|
180
|
+
sm: "py-1 px-2 rounded font-medium text-sm",
|
|
181
|
+
md: "py-2 px-6 rounded font-medium text-base",
|
|
182
|
+
lg: "py-3 px-6 rounded font-medium text-lg"
|
|
183
|
+
}, le = {
|
|
184
|
+
sm: 24,
|
|
185
|
+
md: 30,
|
|
186
|
+
lg: 40
|
|
187
|
+
}, ie = {
|
|
188
|
+
[n.PRIMARY]: "p-blue-15",
|
|
189
|
+
[n.SECONDARY]: "p-purple-60",
|
|
190
|
+
[n.PRIMARY_OUTLINE]: "p-blue-60",
|
|
191
|
+
[n.SECONDARY_OUTLINE]: "p-purple-60",
|
|
192
|
+
[n.SECONDARY_OUTLINE_BLUE]: "p-purple-60",
|
|
193
|
+
[n.ERROR]: "p-blue-15",
|
|
194
|
+
[n.SUCCESS]: "p-blue-15",
|
|
195
|
+
[n.PRIMARY_LINK]: "p-blue-60",
|
|
196
|
+
[n.SECONDARY_GHOST]: "p-purple-60",
|
|
197
|
+
[n.SECONDARY_GHOST_DARK]: "p-blue-15"
|
|
198
|
+
}, ue = I({
|
|
199
|
+
name: "PBtn",
|
|
200
|
+
components: {
|
|
201
|
+
PRingLoader: P,
|
|
202
|
+
RouterLink: te
|
|
203
|
+
},
|
|
204
|
+
inheritAttrs: !1,
|
|
205
|
+
props: {
|
|
206
|
+
/**
|
|
207
|
+
* The button style e.g primary, secondary, primary-outline, secondary-outline, error, success, primary-link
|
|
208
|
+
*/
|
|
209
|
+
type: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: "primary",
|
|
212
|
+
validator(e) {
|
|
213
|
+
return Object.values(n).includes(e);
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* The button native type e.g button, submit, reset
|
|
218
|
+
*/
|
|
219
|
+
nativeType: {
|
|
220
|
+
type: String,
|
|
221
|
+
default: "button",
|
|
222
|
+
validator(e) {
|
|
223
|
+
return oe.includes(e);
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* The button size e.g sm, md, lg
|
|
228
|
+
*/
|
|
229
|
+
size: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: "md",
|
|
232
|
+
validator(e) {
|
|
233
|
+
return Object.keys(D).includes(e);
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* Whether the button is loading
|
|
238
|
+
*/
|
|
239
|
+
loading: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: !1
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Whether the button is selected (sets aria-selected attribute)
|
|
245
|
+
*/
|
|
246
|
+
selected: {
|
|
247
|
+
type: Boolean,
|
|
248
|
+
default: !1
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
251
|
+
* Exactly as the `to` prop in `RouterLink`, when used, it renders a link that triggers a navigation on click.
|
|
252
|
+
* See https://router.vuejs.org/api/#RouteLocationRaw
|
|
253
|
+
*/
|
|
254
|
+
to: {
|
|
255
|
+
type: [Object, String],
|
|
256
|
+
default: ""
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
data() {
|
|
260
|
+
return {
|
|
261
|
+
loaderStyle: { position: "absolute" }
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
computed: {
|
|
265
|
+
classes() {
|
|
266
|
+
return `${ae} ${D[this.size]} ${se[this.type]}`;
|
|
267
|
+
},
|
|
268
|
+
loaderSize() {
|
|
269
|
+
return +`${le[this.size]}`;
|
|
270
|
+
},
|
|
271
|
+
loaderColor() {
|
|
272
|
+
const e = ie[this.type];
|
|
273
|
+
return U(e);
|
|
274
|
+
},
|
|
275
|
+
isExternalLink() {
|
|
276
|
+
return typeof this.to == "string" && this.to.startsWith("http");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}), ce = ["href"];
|
|
280
|
+
function pe(e, t, r, o, a, l) {
|
|
281
|
+
const u = w("PRingLoader");
|
|
282
|
+
return e.isExternalLink ? (m(), K("a", y({ key: 0 }, e.$attrs, {
|
|
283
|
+
href: e.to,
|
|
284
|
+
target: "_blank",
|
|
285
|
+
class: e.classes
|
|
286
|
+
}), [
|
|
287
|
+
h(e.$slots, "default")
|
|
288
|
+
], 16, ce)) : (m(), S(M(e.to ? "RouterLink" : "button"), y({
|
|
289
|
+
key: 1,
|
|
290
|
+
type: e.to ? null : e.nativeType,
|
|
291
|
+
to: e.to ? e.to : null,
|
|
292
|
+
"aria-selected": e.selected,
|
|
293
|
+
class: e.classes
|
|
294
|
+
}, e.$attrs, {
|
|
295
|
+
disabled: e.$attrs.disabled || e.loading
|
|
296
|
+
}), {
|
|
297
|
+
default: z(() => [
|
|
298
|
+
j("div", {
|
|
299
|
+
class: G({ invisible: e.loading })
|
|
300
|
+
}, [
|
|
301
|
+
h(e.$slots, "default")
|
|
302
|
+
], 2),
|
|
303
|
+
e.loading ? (m(), S(u, {
|
|
304
|
+
key: 0,
|
|
305
|
+
style: H(e.loaderStyle),
|
|
306
|
+
color: e.loaderColor,
|
|
307
|
+
size: e.loaderSize,
|
|
308
|
+
class: "left-0 right-0 top-0 ml-auto mr-auto pt-1"
|
|
309
|
+
}, null, 8, ["style", "color", "size"])) : q("", !0)
|
|
310
|
+
]),
|
|
311
|
+
_: 3
|
|
312
|
+
}, 16, ["type", "to", "aria-selected", "class", "disabled"]));
|
|
313
|
+
}
|
|
314
|
+
const me = /* @__PURE__ */ Z(ue, [["render", pe]]);
|
|
315
|
+
export {
|
|
316
|
+
me as default
|
|
317
|
+
};
|