@pequity/squirrel 3.0.2-beta.2 → 3.0.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/index.js +1 -0
- package/dist/cjs/p-loading.js +16 -28
- package/dist/cjs/p-select-pill.js +1 -0
- package/dist/cjs/p-toggle.js +2 -1
- package/dist/cjs/usePLoading.js +3 -15
- package/dist/es/index.js +1 -0
- package/dist/es/p-loading.js +17 -29
- package/dist/es/p-select-pill.js +1 -0
- package/dist/es/p-toggle.js +2 -1
- package/dist/es/usePLoading.js +3 -15
- package/dist/squirrel/components/p-loading/usePLoading.d.ts +0 -2
- package/dist/style.css +7 -7
- package/package.json +20 -20
- package/squirrel/components/p-action-bar/p-action-bar.vue +1 -0
- package/squirrel/components/p-loading/p-loading.vue +11 -17
- package/squirrel/components/p-loading/usePLoading.ts +2 -15
- package/squirrel/components/p-select-pill/p-select-pill.vue +1 -0
- package/squirrel/components/p-toggle/p-toggle.vue +1 -0
package/dist/cjs/index.js
CHANGED
|
@@ -70,6 +70,7 @@ const _hoisted_7$3 = { class: "flex flex-col bg-p-purple-60" };
|
|
|
70
70
|
const _hoisted_8$1 = { class: "flex items-center gap-2 px-1 py-0.5" };
|
|
71
71
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
72
72
|
...{
|
|
73
|
+
name: "PActionBar",
|
|
73
74
|
inheritAttrs: false
|
|
74
75
|
},
|
|
75
76
|
__name: "p-action-bar",
|
package/dist/cjs/p-loading.js
CHANGED
|
@@ -12,23 +12,20 @@ const _hoisted_2 = {
|
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "invisible fixed"
|
|
14
14
|
};
|
|
15
|
-
const textDivClass = `overflow-hidden whitespace-nowrap px-4 py-2.5 leading-none text-center text-sm font-semibold text-p-purple-60`;
|
|
16
15
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
17
16
|
...{
|
|
18
17
|
name: "PLoading"
|
|
19
18
|
},
|
|
20
19
|
__name: "p-loading",
|
|
21
20
|
setup(__props) {
|
|
22
|
-
const { show, content
|
|
23
|
-
const
|
|
21
|
+
const { show, content } = usePLoading.usePLoading();
|
|
22
|
+
const widthReference = vue.ref(null);
|
|
24
23
|
const width = vue.ref(0);
|
|
25
|
-
const height = vue.ref(0);
|
|
26
24
|
vue.watch(
|
|
27
25
|
() => vue.toValue(content),
|
|
28
26
|
() => {
|
|
29
|
-
if (
|
|
30
|
-
width.value =
|
|
31
|
-
height.value = dimsReference.value.offsetHeight;
|
|
27
|
+
if (widthReference.value) {
|
|
28
|
+
width.value = widthReference.value.offsetWidth;
|
|
32
29
|
}
|
|
33
30
|
},
|
|
34
31
|
{ flush: "post" }
|
|
@@ -47,21 +44,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
47
44
|
default: vue.withCtx(() => [
|
|
48
45
|
vue.unref(show) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
49
46
|
vue.createElementVNode("div", {
|
|
50
|
-
style: vue.normalizeStyle({ width: `${width.value}px
|
|
51
|
-
class: "rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-
|
|
47
|
+
style: vue.normalizeStyle({ width: `${width.value}px` }),
|
|
48
|
+
class: "h-8 overflow-hidden whitespace-nowrap rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 px-4 pt-2 text-center text-sm font-semibold leading-none text-p-purple-60 shadow-sm transition-all duration-500"
|
|
52
49
|
}, [
|
|
53
|
-
vue.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, {
|
|
57
|
-
default: vue.withCtx(() => [
|
|
58
|
-
isComponent(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(componentProps))), null, 16)) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
59
|
-
key: 1,
|
|
60
|
-
class: vue.normalizeClass(textDivClass)
|
|
61
|
-
}, vue.toDisplayString(vue.unref(content)), 1))
|
|
62
|
-
]),
|
|
63
|
-
_: 1
|
|
64
|
-
})
|
|
50
|
+
isComponent(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
51
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(content)), 1)
|
|
52
|
+
], 64))
|
|
65
53
|
], 4)
|
|
66
54
|
])) : vue.createCommentVNode("", true)
|
|
67
55
|
]),
|
|
@@ -69,18 +57,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
69
57
|
}),
|
|
70
58
|
vue.unref(content) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
71
59
|
vue.createElementVNode("div", {
|
|
72
|
-
ref_key: "
|
|
73
|
-
ref:
|
|
60
|
+
ref_key: "widthReference",
|
|
61
|
+
ref: widthReference,
|
|
62
|
+
class: "inline-flex px-4"
|
|
74
63
|
}, [
|
|
75
|
-
isComponent(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, vue.toDisplayString(vue.unref(content)), 1))
|
|
64
|
+
isComponent(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
65
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(content)), 1)
|
|
66
|
+
], 64))
|
|
79
67
|
], 512)
|
|
80
68
|
])) : vue.createCommentVNode("", true)
|
|
81
69
|
], 64);
|
|
82
70
|
};
|
|
83
71
|
}
|
|
84
72
|
});
|
|
85
|
-
const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
73
|
+
const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-8c0c66ab"]]);
|
|
86
74
|
module.exports = pLoading;
|
package/dist/cjs/p-toggle.js
CHANGED
|
@@ -26,6 +26,7 @@ const TOGGLE_CLASSES = [
|
|
|
26
26
|
"peer-disabled:after:border-p-blue-10"
|
|
27
27
|
].join(" ");
|
|
28
28
|
const _sfc_main = vue.defineComponent({
|
|
29
|
+
name: "PToggle",
|
|
29
30
|
mixins: [inputClassesMixin],
|
|
30
31
|
inheritAttrs: false,
|
|
31
32
|
props: {
|
|
@@ -110,5 +111,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
110
111
|
])
|
|
111
112
|
], 14, _hoisted_1);
|
|
112
113
|
}
|
|
113
|
-
const pToggle = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
114
|
+
const pToggle = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7aa9c3e7"]]);
|
|
114
115
|
module.exports = pToggle;
|
package/dist/cjs/usePLoading.js
CHANGED
|
@@ -8,10 +8,6 @@ const content = vue.computed(() => {
|
|
|
8
8
|
var _a;
|
|
9
9
|
return (_a = loadingItems.value[loadingItems.value.length - 1]) == null ? void 0 : _a.content;
|
|
10
10
|
});
|
|
11
|
-
const props = vue.computed(() => {
|
|
12
|
-
var _a;
|
|
13
|
-
return (_a = loadingItems.value[loadingItems.value.length - 1]) == null ? void 0 : _a.props;
|
|
14
|
-
});
|
|
15
11
|
let timer;
|
|
16
12
|
const usePLoading = (options) => {
|
|
17
13
|
const { delay } = { delay: 200, ...options };
|
|
@@ -29,19 +25,11 @@ const usePLoading = (options) => {
|
|
|
29
25
|
}
|
|
30
26
|
loadingItems.value.push({
|
|
31
27
|
id: loadingItem.id,
|
|
32
|
-
content: loadingItem.content && typeof loadingItem.content === "object" ? vue.markRaw(loadingItem.content) : loadingItem.content || LOADING_TEXT
|
|
33
|
-
props: loadingItem.props
|
|
28
|
+
content: loadingItem.content && typeof loadingItem.content === "object" ? vue.markRaw(loadingItem.content) : loadingItem.content || LOADING_TEXT
|
|
34
29
|
});
|
|
35
30
|
};
|
|
36
31
|
const loadingHide = (id) => {
|
|
37
|
-
|
|
38
|
-
const index = loadingItems.value.findIndex((item) => item.id === id);
|
|
39
|
-
if (index !== -1) {
|
|
40
|
-
loadingItems.value.splice(index, 1);
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
loadingItems.value = [];
|
|
44
|
-
}
|
|
32
|
+
loadingItems.value = id && typeof id === "string" ? loadingItems.value.filter((item) => item.id !== id) : [];
|
|
45
33
|
if (loadingItems.value.length === 0) {
|
|
46
34
|
show.value = false;
|
|
47
35
|
}
|
|
@@ -54,6 +42,6 @@ const usePLoading = (options) => {
|
|
|
54
42
|
clearTimeout(timer);
|
|
55
43
|
});
|
|
56
44
|
}
|
|
57
|
-
return { show, content,
|
|
45
|
+
return { show, content, loadingShow, loadingHide };
|
|
58
46
|
};
|
|
59
47
|
exports.usePLoading = usePLoading;
|
package/dist/es/index.js
CHANGED
|
@@ -70,6 +70,7 @@ const _hoisted_7$3 = { class: "flex flex-col bg-p-purple-60" };
|
|
|
70
70
|
const _hoisted_8$1 = { class: "flex items-center gap-2 px-1 py-0.5" };
|
|
71
71
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
72
72
|
...{
|
|
73
|
+
name: "PActionBar",
|
|
73
74
|
inheritAttrs: false
|
|
74
75
|
},
|
|
75
76
|
__name: "p-action-bar",
|
package/dist/es/p-loading.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, toValue, openBlock, createElementBlock, Fragment, createVNode, Transition, withCtx, unref, createElementVNode, normalizeStyle, createBlock, resolveDynamicComponent,
|
|
1
|
+
import { defineComponent, ref, watch, toValue, openBlock, createElementBlock, Fragment, createVNode, Transition, withCtx, unref, createElementVNode, normalizeStyle, createBlock, resolveDynamicComponent, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
2
|
import { usePLoading } from "./usePLoading.js";
|
|
3
3
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
4
4
|
const _hoisted_1 = {
|
|
@@ -11,23 +11,20 @@ const _hoisted_2 = {
|
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "invisible fixed"
|
|
13
13
|
};
|
|
14
|
-
const textDivClass = `overflow-hidden whitespace-nowrap px-4 py-2.5 leading-none text-center text-sm font-semibold text-p-purple-60`;
|
|
15
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
15
|
...{
|
|
17
16
|
name: "PLoading"
|
|
18
17
|
},
|
|
19
18
|
__name: "p-loading",
|
|
20
19
|
setup(__props) {
|
|
21
|
-
const { show, content
|
|
22
|
-
const
|
|
20
|
+
const { show, content } = usePLoading();
|
|
21
|
+
const widthReference = ref(null);
|
|
23
22
|
const width = ref(0);
|
|
24
|
-
const height = ref(0);
|
|
25
23
|
watch(
|
|
26
24
|
() => toValue(content),
|
|
27
25
|
() => {
|
|
28
|
-
if (
|
|
29
|
-
width.value =
|
|
30
|
-
height.value = dimsReference.value.offsetHeight;
|
|
26
|
+
if (widthReference.value) {
|
|
27
|
+
width.value = widthReference.value.offsetWidth;
|
|
31
28
|
}
|
|
32
29
|
},
|
|
33
30
|
{ flush: "post" }
|
|
@@ -46,21 +43,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
43
|
default: withCtx(() => [
|
|
47
44
|
unref(show) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
48
45
|
createElementVNode("div", {
|
|
49
|
-
style: normalizeStyle({ width: `${width.value}px
|
|
50
|
-
class: "rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-
|
|
46
|
+
style: normalizeStyle({ width: `${width.value}px` }),
|
|
47
|
+
class: "h-8 overflow-hidden whitespace-nowrap rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 px-4 pt-2 text-center text-sm font-semibold leading-none text-p-purple-60 shadow-sm transition-all duration-500"
|
|
51
48
|
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, {
|
|
56
|
-
default: withCtx(() => [
|
|
57
|
-
isComponent(unref(content)) ? (openBlock(), createBlock(resolveDynamicComponent(unref(content)), normalizeProps(mergeProps({ key: 0 }, unref(componentProps))), null, 16)) : (openBlock(), createElementBlock("div", {
|
|
58
|
-
key: 1,
|
|
59
|
-
class: normalizeClass(textDivClass)
|
|
60
|
-
}, toDisplayString(unref(content)), 1))
|
|
61
|
-
]),
|
|
62
|
-
_: 1
|
|
63
|
-
})
|
|
49
|
+
isComponent(unref(content)) ? (openBlock(), createBlock(resolveDynamicComponent(unref(content)), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
50
|
+
createTextVNode(toDisplayString(unref(content)), 1)
|
|
51
|
+
], 64))
|
|
64
52
|
], 4)
|
|
65
53
|
])) : createCommentVNode("", true)
|
|
66
54
|
]),
|
|
@@ -68,20 +56,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
68
56
|
}),
|
|
69
57
|
unref(content) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
70
58
|
createElementVNode("div", {
|
|
71
|
-
ref_key: "
|
|
72
|
-
ref:
|
|
59
|
+
ref_key: "widthReference",
|
|
60
|
+
ref: widthReference,
|
|
61
|
+
class: "inline-flex px-4"
|
|
73
62
|
}, [
|
|
74
|
-
isComponent(unref(content)) ? (openBlock(), createBlock(resolveDynamicComponent(unref(content)),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}, toDisplayString(unref(content)), 1))
|
|
63
|
+
isComponent(unref(content)) ? (openBlock(), createBlock(resolveDynamicComponent(unref(content)), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
64
|
+
createTextVNode(toDisplayString(unref(content)), 1)
|
|
65
|
+
], 64))
|
|
78
66
|
], 512)
|
|
79
67
|
])) : createCommentVNode("", true)
|
|
80
68
|
], 64);
|
|
81
69
|
};
|
|
82
70
|
}
|
|
83
71
|
});
|
|
84
|
-
const pLoading = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
72
|
+
const pLoading = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8c0c66ab"]]);
|
|
85
73
|
export {
|
|
86
74
|
pLoading as default
|
|
87
75
|
};
|
package/dist/es/p-select-pill.js
CHANGED
package/dist/es/p-toggle.js
CHANGED
|
@@ -25,6 +25,7 @@ const TOGGLE_CLASSES = [
|
|
|
25
25
|
"peer-disabled:after:border-p-blue-10"
|
|
26
26
|
].join(" ");
|
|
27
27
|
const _sfc_main = defineComponent({
|
|
28
|
+
name: "PToggle",
|
|
28
29
|
mixins: [inputClassesMixin],
|
|
29
30
|
inheritAttrs: false,
|
|
30
31
|
props: {
|
|
@@ -109,7 +110,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
109
110
|
])
|
|
110
111
|
], 14, _hoisted_1);
|
|
111
112
|
}
|
|
112
|
-
const pToggle = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
113
|
+
const pToggle = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7aa9c3e7"]]);
|
|
113
114
|
export {
|
|
114
115
|
pToggle as default
|
|
115
116
|
};
|
package/dist/es/usePLoading.js
CHANGED
|
@@ -6,10 +6,6 @@ const content = computed(() => {
|
|
|
6
6
|
var _a;
|
|
7
7
|
return (_a = loadingItems.value[loadingItems.value.length - 1]) == null ? void 0 : _a.content;
|
|
8
8
|
});
|
|
9
|
-
const props = computed(() => {
|
|
10
|
-
var _a;
|
|
11
|
-
return (_a = loadingItems.value[loadingItems.value.length - 1]) == null ? void 0 : _a.props;
|
|
12
|
-
});
|
|
13
9
|
let timer;
|
|
14
10
|
const usePLoading = (options) => {
|
|
15
11
|
const { delay } = { delay: 200, ...options };
|
|
@@ -27,19 +23,11 @@ const usePLoading = (options) => {
|
|
|
27
23
|
}
|
|
28
24
|
loadingItems.value.push({
|
|
29
25
|
id: loadingItem.id,
|
|
30
|
-
content: loadingItem.content && typeof loadingItem.content === "object" ? markRaw(loadingItem.content) : loadingItem.content || LOADING_TEXT
|
|
31
|
-
props: loadingItem.props
|
|
26
|
+
content: loadingItem.content && typeof loadingItem.content === "object" ? markRaw(loadingItem.content) : loadingItem.content || LOADING_TEXT
|
|
32
27
|
});
|
|
33
28
|
};
|
|
34
29
|
const loadingHide = (id) => {
|
|
35
|
-
|
|
36
|
-
const index = loadingItems.value.findIndex((item) => item.id === id);
|
|
37
|
-
if (index !== -1) {
|
|
38
|
-
loadingItems.value.splice(index, 1);
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
loadingItems.value = [];
|
|
42
|
-
}
|
|
30
|
+
loadingItems.value = id && typeof id === "string" ? loadingItems.value.filter((item) => item.id !== id) : [];
|
|
43
31
|
if (loadingItems.value.length === 0) {
|
|
44
32
|
show.value = false;
|
|
45
33
|
}
|
|
@@ -52,7 +40,7 @@ const usePLoading = (options) => {
|
|
|
52
40
|
clearTimeout(timer);
|
|
53
41
|
});
|
|
54
42
|
}
|
|
55
|
-
return { show, content,
|
|
43
|
+
return { show, content, loadingShow, loadingHide };
|
|
56
44
|
};
|
|
57
45
|
export {
|
|
58
46
|
usePLoading
|
|
@@ -6,12 +6,10 @@ type Content = string | Component;
|
|
|
6
6
|
type LoadingItem = {
|
|
7
7
|
id: string;
|
|
8
8
|
content?: Content;
|
|
9
|
-
props?: Ref;
|
|
10
9
|
};
|
|
11
10
|
type UsePLoading = {
|
|
12
11
|
show: Ref<boolean>;
|
|
13
12
|
content: Content;
|
|
14
|
-
props: Ref;
|
|
15
13
|
loadingShow: (loadingItem: LoadingItem) => void;
|
|
16
14
|
loadingHide: (id: LoadingItem['id']) => void;
|
|
17
15
|
};
|
package/dist/style.css
CHANGED
|
@@ -233,7 +233,7 @@ div[id^=popper_].dropdown .v-popper__inner .dropdown-menu .dropdown-divider {
|
|
|
233
233
|
.filter.active[data-v-cbac2434]:hover {
|
|
234
234
|
background: url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='4'%20fill='black'%20fill-opacity='0.05'/%3e%3cpath%20d='M15.5%206.72998H4.5C4.36739%206.72998%204.24021%206.6773%204.14645%206.58353C4.05268%206.48977%204%206.36259%204%206.22998C4%206.09737%204.05268%205.9702%204.14645%205.87643C4.24021%205.78266%204.36739%205.72998%204.5%205.72998H15.5C15.6326%205.72998%2015.7598%205.78266%2015.8536%205.87643C15.9473%205.9702%2016%206.09737%2016%206.22998C16%206.36259%2015.9473%206.48977%2015.8536%206.58353C15.7598%206.6773%2015.6326%206.72998%2015.5%206.72998Z'%20fill='%230F45AF'/%3e%3cpath%20d='M14.33%209.245H5.67C5.53739%209.245%205.41021%209.19232%205.31644%209.09855C5.22268%209.00478%205.17%208.8776%205.17%208.745C5.17%208.61239%205.22268%208.48521%205.31644%208.39144C5.41021%208.29767%205.53739%208.245%205.67%208.245H14.33C14.4626%208.245%2014.5898%208.29767%2014.6836%208.39144C14.7773%208.48521%2014.83%208.61239%2014.83%208.745C14.83%208.8776%2014.7773%209.00478%2014.6836%209.09855C14.5898%209.19232%2014.4626%209.245%2014.33%209.245Z'%20fill='%230F45AF'/%3e%3cpath%20d='M11.605%2014.27H8.395C8.2624%2014.27%208.13522%2014.2173%208.04145%2014.1235C7.94768%2014.0297%207.895%2013.9026%207.895%2013.77C7.895%2013.6374%207.94768%2013.5102%208.04145%2013.4164C8.13522%2013.3226%208.2624%2013.27%208.395%2013.27H11.605C11.7376%2013.27%2011.8648%2013.3226%2011.9586%2013.4164C12.0523%2013.5102%2012.105%2013.6374%2012.105%2013.77C12.105%2013.9026%2012.0523%2014.0297%2011.9586%2014.1235C11.8648%2014.2173%2011.7376%2014.27%2011.605%2014.27Z'%20fill='%230F45AF'/%3e%3cpath%20d='M13.155%2011.755H6.845C6.71239%2011.755%206.58522%2011.7023%206.49145%2011.6086C6.39768%2011.5148%206.345%2011.3876%206.345%2011.255C6.345%2011.1224%206.39768%2010.9952%206.49145%2010.9015C6.58522%2010.8077%206.71239%2010.755%206.845%2010.755H13.155C13.2876%2010.755%2013.4148%2010.8077%2013.5086%2010.9015C13.6023%2010.9952%2013.655%2011.1224%2013.655%2011.255C13.655%2011.3876%2013.6023%2011.5148%2013.5086%2011.6086C13.4148%2011.7023%2013.2876%2011.755%2013.155%2011.755Z'%20fill='%230F45AF'/%3e%3c/svg%3e") no-repeat;
|
|
235
235
|
}
|
|
236
|
-
.shadow-inner-toggle[data-v-
|
|
236
|
+
.shadow-inner-toggle[data-v-7aa9c3e7]::after {
|
|
237
237
|
box-shadow:
|
|
238
238
|
rgba(0, 0, 0, 0.3) 0px 1px 2px 0px,
|
|
239
239
|
rgba(0, 0, 0, 0.05) 0px 0px 1px 0px inset;
|
|
@@ -381,12 +381,12 @@ from {
|
|
|
381
381
|
to {
|
|
382
382
|
opacity: 0;
|
|
383
383
|
}
|
|
384
|
-
}.fadeInDown[data-v-
|
|
384
|
+
}.fadeInDown[data-v-8c0c66ab] {
|
|
385
385
|
animation-duration: 0.4s;
|
|
386
386
|
animation-fill-mode: both;
|
|
387
|
-
animation-name: fadeInDown-
|
|
387
|
+
animation-name: fadeInDown-8c0c66ab;
|
|
388
388
|
}
|
|
389
|
-
@keyframes fadeInDown-
|
|
389
|
+
@keyframes fadeInDown-8c0c66ab {
|
|
390
390
|
0% {
|
|
391
391
|
opacity: 0;
|
|
392
392
|
transform: translate3d(0, -100%, 0);
|
|
@@ -396,12 +396,12 @@ to {
|
|
|
396
396
|
transform: none;
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
.fadeOutUp[data-v-
|
|
399
|
+
.fadeOutUp[data-v-8c0c66ab] {
|
|
400
400
|
animation-duration: 0.25s;
|
|
401
401
|
animation-fill-mode: both;
|
|
402
|
-
animation-name: fadeOutUp-
|
|
402
|
+
animation-name: fadeOutUp-8c0c66ab;
|
|
403
403
|
}
|
|
404
|
-
@keyframes fadeOutUp-
|
|
404
|
+
@keyframes fadeOutUp-8c0c66ab {
|
|
405
405
|
0% {
|
|
406
406
|
opacity: 1;
|
|
407
407
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pequity/squirrel",
|
|
3
3
|
"description": "Squirrel component library",
|
|
4
|
-
"version": "3.0.2
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"packageManager": "pnpm@8.9.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"module": "./dist/es/index.js",
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@popperjs/core": "^2.11.8",
|
|
42
|
-
"@tanstack/vue-virtual": "^3.
|
|
43
|
-
"dayjs": "^1.11.
|
|
42
|
+
"@tanstack/vue-virtual": "^3.8.3",
|
|
43
|
+
"dayjs": "^1.11.12",
|
|
44
44
|
"floating-vue": "^5.2.2",
|
|
45
45
|
"lodash-es": "^4.17.21",
|
|
46
46
|
"v-calendar": "^3.1.2",
|
|
47
|
-
"vue": "^3.4.
|
|
47
|
+
"vue": "^3.4.33",
|
|
48
48
|
"vue-currency-input": "^3.1.0",
|
|
49
|
-
"vue-router": "^4.
|
|
49
|
+
"vue-router": "^4.4.0",
|
|
50
50
|
"vue-toastification": "^2.0.0-rc.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -58,26 +58,26 @@
|
|
|
58
58
|
"@popperjs/core": "2.11.8",
|
|
59
59
|
"@semantic-release/changelog": "^6.0.3",
|
|
60
60
|
"@semantic-release/git": "^10.0.1",
|
|
61
|
-
"@storybook/addon-a11y": "^8.2.
|
|
62
|
-
"@storybook/addon-actions": "^8.2.
|
|
63
|
-
"@storybook/addon-essentials": "^8.2.
|
|
64
|
-
"@storybook/addon-interactions": "^8.2.
|
|
65
|
-
"@storybook/addon-links": "^8.2.
|
|
66
|
-
"@storybook/blocks": "^8.2.
|
|
61
|
+
"@storybook/addon-a11y": "^8.2.5",
|
|
62
|
+
"@storybook/addon-actions": "^8.2.5",
|
|
63
|
+
"@storybook/addon-essentials": "^8.2.5",
|
|
64
|
+
"@storybook/addon-interactions": "^8.2.5",
|
|
65
|
+
"@storybook/addon-links": "^8.2.5",
|
|
66
|
+
"@storybook/blocks": "^8.2.5",
|
|
67
67
|
"@storybook/jest": "^0.2.3",
|
|
68
|
-
"@storybook/manager-api": "^8.2.
|
|
68
|
+
"@storybook/manager-api": "^8.2.5",
|
|
69
69
|
"@storybook/test-runner": "^0.19.1",
|
|
70
70
|
"@storybook/testing-library": "^0.2.2",
|
|
71
|
-
"@storybook/theming": "^8.2.
|
|
72
|
-
"@storybook/vue3": "^8.2.
|
|
73
|
-
"@storybook/vue3-vite": "^8.2.
|
|
71
|
+
"@storybook/theming": "^8.2.5",
|
|
72
|
+
"@storybook/vue3": "^8.2.5",
|
|
73
|
+
"@storybook/vue3-vite": "^8.2.5",
|
|
74
74
|
"@tanstack/vue-virtual": "3.8.3",
|
|
75
75
|
"@types/jest": "^29.5.12",
|
|
76
76
|
"@types/jsdom": "^21.1.7",
|
|
77
77
|
"@types/lodash-es": "^4.17.12",
|
|
78
78
|
"@types/node": "^20.14.11",
|
|
79
79
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
80
|
-
"@vue/compiler-sfc": "3.4.
|
|
80
|
+
"@vue/compiler-sfc": "3.4.33",
|
|
81
81
|
"@vue/test-utils": "^2.4.6",
|
|
82
82
|
"@vue/vue3-jest": "^29.2.6",
|
|
83
83
|
"autoprefixer": "^10.4.19",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"eslint-plugin-storybook": "^0.8.0",
|
|
88
88
|
"floating-vue": "5.2.2",
|
|
89
89
|
"glob": "^10.4.3",
|
|
90
|
-
"husky": "^9.
|
|
90
|
+
"husky": "^9.1.1",
|
|
91
91
|
"jest": "^29.7.0",
|
|
92
92
|
"jest-environment-jsdom": "^29.7.0",
|
|
93
93
|
"lint-staged": "^15.2.7",
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"rimraf": "^5.0.8",
|
|
101
101
|
"sass": "^1.77.8",
|
|
102
102
|
"semantic-release": "^24.0.0",
|
|
103
|
-
"storybook": "^8.2.
|
|
103
|
+
"storybook": "^8.2.5",
|
|
104
104
|
"svgo": "^3.3.2",
|
|
105
105
|
"tailwindcss": "^3.4.6",
|
|
106
|
-
"ts-jest": "^29.2.
|
|
106
|
+
"ts-jest": "^29.2.3",
|
|
107
107
|
"typescript": "5.5.3",
|
|
108
108
|
"v-calendar": "3.1.2",
|
|
109
109
|
"vite": "^5.3.4",
|
|
@@ -111,6 +111,6 @@
|
|
|
111
111
|
"vue-currency-input": "3.1.0",
|
|
112
112
|
"vue-router": "4.4.0",
|
|
113
113
|
"vue-toastification": "2.0.0-rc.5",
|
|
114
|
-
"vue-tsc": "2.0.
|
|
114
|
+
"vue-tsc": "2.0.28"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
<Transition name="pm-backdrop-transition" enter-active-class="fadeInDown" leave-active-class="fadeOutUp">
|
|
3
3
|
<div v-if="show" class="fixed left-0 top-0 z-[120] flex w-full justify-center" aria-live="polite" aria-busy="true">
|
|
4
4
|
<div
|
|
5
|
-
:style="{ width: `${width}px
|
|
6
|
-
class="rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-
|
|
5
|
+
:style="{ width: `${width}px` }"
|
|
6
|
+
class="h-8 overflow-hidden whitespace-nowrap rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 px-4 pt-2 text-center text-sm font-semibold leading-none text-p-purple-60 shadow-sm transition-all duration-500"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
<div v-else :class="textDivClass">{{ content }}</div>
|
|
11
|
-
</Transition>
|
|
8
|
+
<Component :is="content" v-if="isComponent(content)" />
|
|
9
|
+
<template v-else>{{ content }}</template>
|
|
12
10
|
</div>
|
|
13
11
|
</div>
|
|
14
12
|
</Transition>
|
|
15
13
|
<div v-if="content" class="invisible fixed">
|
|
16
|
-
<div ref="
|
|
17
|
-
<Component :is="content" v-if="isComponent(content)"
|
|
18
|
-
<
|
|
14
|
+
<div ref="widthReference" class="inline-flex px-4">
|
|
15
|
+
<Component :is="content" v-if="isComponent(content)" />
|
|
16
|
+
<template v-else>{{ content }}</template>
|
|
19
17
|
</div>
|
|
20
18
|
</div>
|
|
21
19
|
</template>
|
|
@@ -24,23 +22,19 @@
|
|
|
24
22
|
import { type Component, ref, toValue, watch } from 'vue';
|
|
25
23
|
import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
|
|
26
24
|
|
|
27
|
-
const textDivClass = `overflow-hidden whitespace-nowrap px-4 py-2.5 leading-none text-center text-sm font-semibold text-p-purple-60`;
|
|
28
|
-
|
|
29
25
|
defineOptions({
|
|
30
26
|
name: 'PLoading',
|
|
31
27
|
});
|
|
32
28
|
|
|
33
|
-
const { show, content
|
|
34
|
-
const
|
|
29
|
+
const { show, content } = usePLoading();
|
|
30
|
+
const widthReference = ref<HTMLElement | null>(null);
|
|
35
31
|
const width = ref(0);
|
|
36
|
-
const height = ref(0);
|
|
37
32
|
|
|
38
33
|
watch(
|
|
39
34
|
() => toValue(content),
|
|
40
35
|
() => {
|
|
41
|
-
if (
|
|
42
|
-
width.value =
|
|
43
|
-
height.value = dimsReference.value.offsetHeight;
|
|
36
|
+
if (widthReference.value) {
|
|
37
|
+
width.value = widthReference.value.offsetWidth;
|
|
44
38
|
}
|
|
45
39
|
},
|
|
46
40
|
{ flush: 'post' }
|
|
@@ -9,13 +9,11 @@ type Content = string | Component;
|
|
|
9
9
|
type LoadingItem = {
|
|
10
10
|
id: string;
|
|
11
11
|
content?: Content;
|
|
12
|
-
props?: Ref;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
type UsePLoading = {
|
|
16
15
|
show: Ref<boolean>;
|
|
17
16
|
content: Content;
|
|
18
|
-
props: Ref;
|
|
19
17
|
loadingShow: (loadingItem: LoadingItem) => void;
|
|
20
18
|
loadingHide: (id: LoadingItem['id']) => void;
|
|
21
19
|
};
|
|
@@ -24,7 +22,6 @@ const LOADING_TEXT = 'Loading...';
|
|
|
24
22
|
const show = ref(false);
|
|
25
23
|
const loadingItems = ref<LoadingItem[]>([]);
|
|
26
24
|
const content = computed(() => loadingItems.value[loadingItems.value.length - 1]?.content);
|
|
27
|
-
const props = computed(() => loadingItems.value[loadingItems.value.length - 1]?.props);
|
|
28
25
|
let timer: ReturnType<typeof setTimeout>;
|
|
29
26
|
|
|
30
27
|
export const usePLoading = (options?: Options): UsePLoading => {
|
|
@@ -50,21 +47,11 @@ export const usePLoading = (options?: Options): UsePLoading => {
|
|
|
50
47
|
loadingItem.content && typeof loadingItem.content === 'object'
|
|
51
48
|
? markRaw(loadingItem.content)
|
|
52
49
|
: loadingItem.content || LOADING_TEXT,
|
|
53
|
-
props: loadingItem.props,
|
|
54
50
|
});
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
const loadingHide = (id?: LoadingItem['id']) => {
|
|
58
|
-
|
|
59
|
-
const index = loadingItems.value.findIndex((item) => item.id === id);
|
|
60
|
-
|
|
61
|
-
if (index !== -1) {
|
|
62
|
-
loadingItems.value.splice(index, 1);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
loadingItems.value = [];
|
|
66
|
-
}
|
|
67
|
-
|
|
54
|
+
loadingItems.value = id && typeof id === 'string' ? loadingItems.value.filter((item) => item.id !== id) : [];
|
|
68
55
|
if (loadingItems.value.length === 0) {
|
|
69
56
|
show.value = false;
|
|
70
57
|
}
|
|
@@ -79,5 +66,5 @@ export const usePLoading = (options?: Options): UsePLoading => {
|
|
|
79
66
|
});
|
|
80
67
|
}
|
|
81
68
|
|
|
82
|
-
return { show, content,
|
|
69
|
+
return { show, content, loadingShow, loadingHide };
|
|
83
70
|
};
|