@pequity/squirrel 3.0.2-beta.2 → 3.1.0
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 +3 -3
- package/dist/cjs/p-select-pill.js +1 -0
- package/dist/cjs/p-toggle.js +2 -1
- package/dist/es/index.js +1 -0
- package/dist/es/p-loading.js +3 -3
- package/dist/es/p-select-pill.js +1 -0
- package/dist/es/p-toggle.js +2 -1
- package/dist/style.css +7 -7
- package/package.json +25 -25
- package/squirrel/components/p-action-bar/p-action-bar.vue +1 -0
- package/squirrel/components/p-loading/p-loading.spec.js +58 -0
- package/squirrel/components/p-loading/p-loading.stories.js +57 -2
- package/squirrel/components/p-loading/p-loading.vue +2 -2
- 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,7 +12,7 @@ const _hoisted_2 = {
|
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "invisible fixed"
|
|
14
14
|
};
|
|
15
|
-
const textDivClass = `overflow-hidden whitespace-nowrap px-4
|
|
15
|
+
const textDivClass = `overflow-hidden whitespace-nowrap px-4 pt-1 h-8 text-center text-sm font-semibold text-p-purple-60`;
|
|
16
16
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
17
17
|
...{
|
|
18
18
|
name: "PLoading"
|
|
@@ -48,7 +48,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
48
48
|
vue.unref(show) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
49
49
|
vue.createElementVNode("div", {
|
|
50
50
|
style: vue.normalizeStyle({ width: `${width.value}px`, height: `${height.value}px` }),
|
|
51
|
-
class: "rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-300"
|
|
51
|
+
class: "overflow-hidden rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-300"
|
|
52
52
|
}, [
|
|
53
53
|
vue.createVNode(vue.Transition, {
|
|
54
54
|
"enter-from-class": "opacity-0",
|
|
@@ -82,5 +82,5 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
85
|
+
const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-6f528d56"]]);
|
|
86
86
|
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/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
|
@@ -11,7 +11,7 @@ const _hoisted_2 = {
|
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "invisible fixed"
|
|
13
13
|
};
|
|
14
|
-
const textDivClass = `overflow-hidden whitespace-nowrap px-4
|
|
14
|
+
const textDivClass = `overflow-hidden whitespace-nowrap px-4 pt-1 h-8 text-center text-sm font-semibold text-p-purple-60`;
|
|
15
15
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
16
|
...{
|
|
17
17
|
name: "PLoading"
|
|
@@ -47,7 +47,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
47
|
unref(show) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
48
48
|
createElementVNode("div", {
|
|
49
49
|
style: normalizeStyle({ width: `${width.value}px`, height: `${height.value}px` }),
|
|
50
|
-
class: "rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-300"
|
|
50
|
+
class: "overflow-hidden rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-300"
|
|
51
51
|
}, [
|
|
52
52
|
createVNode(Transition, {
|
|
53
53
|
"enter-from-class": "opacity-0",
|
|
@@ -81,7 +81,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
const pLoading = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
84
|
+
const pLoading = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6f528d56"]]);
|
|
85
85
|
export {
|
|
86
86
|
pLoading as default
|
|
87
87
|
};
|
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/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-6f528d56] {
|
|
385
385
|
animation-duration: 0.4s;
|
|
386
386
|
animation-fill-mode: both;
|
|
387
|
-
animation-name: fadeInDown-
|
|
387
|
+
animation-name: fadeInDown-6f528d56;
|
|
388
388
|
}
|
|
389
|
-
@keyframes fadeInDown-
|
|
389
|
+
@keyframes fadeInDown-6f528d56 {
|
|
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-6f528d56] {
|
|
400
400
|
animation-duration: 0.25s;
|
|
401
401
|
animation-fill-mode: both;
|
|
402
|
-
animation-name: fadeOutUp-
|
|
402
|
+
animation-name: fadeOutUp-6f528d56;
|
|
403
403
|
}
|
|
404
|
-
@keyframes fadeOutUp-
|
|
404
|
+
@keyframes fadeOutUp-6f528d56 {
|
|
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
|
|
4
|
+
"version": "3.1.0",
|
|
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,36 +58,36 @@
|
|
|
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",
|
|
84
84
|
"babel-jest": "^29.7.0",
|
|
85
|
-
"dayjs": "1.11.
|
|
85
|
+
"dayjs": "1.11.12",
|
|
86
86
|
"eslint": "^8.57.0",
|
|
87
87
|
"eslint-plugin-storybook": "^0.8.0",
|
|
88
88
|
"floating-vue": "5.2.2",
|
|
89
|
-
"glob": "^10.4.
|
|
90
|
-
"husky": "^9.
|
|
89
|
+
"glob": "^10.4.5",
|
|
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",
|
|
@@ -97,20 +97,20 @@
|
|
|
97
97
|
"prettier": "^3.3.3",
|
|
98
98
|
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
99
99
|
"resolve-tspaths": "^0.8.19",
|
|
100
|
-
"rimraf": "^5.0.
|
|
100
|
+
"rimraf": "^5.0.9",
|
|
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.
|
|
107
|
-
"typescript": "5.5.
|
|
106
|
+
"ts-jest": "^29.2.3",
|
|
107
|
+
"typescript": "5.5.4",
|
|
108
108
|
"v-calendar": "3.1.2",
|
|
109
109
|
"vite": "^5.3.4",
|
|
110
|
-
"vue": "3.4.
|
|
110
|
+
"vue": "3.4.33",
|
|
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
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import PLoading from '@squirrel/components/p-loading/p-loading.vue';
|
|
2
2
|
import PSkeletonLoader from '@squirrel/components/p-skeleton-loader/p-skeleton-loader.vue';
|
|
3
3
|
import { createWrapperFor, waitNT } from '@tests/jest.helpers';
|
|
4
|
+
import { defineComponent, ref } from 'vue';
|
|
4
5
|
import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
|
|
5
6
|
|
|
6
7
|
const createAppWrapper = () =>
|
|
@@ -218,4 +219,61 @@ describe('PLoading.vue', () => {
|
|
|
218
219
|
});
|
|
219
220
|
}).toThrowError('id is required');
|
|
220
221
|
});
|
|
222
|
+
|
|
223
|
+
it(`accepts a component with reactive props as the content`, async () => {
|
|
224
|
+
const TestComponent = defineComponent({
|
|
225
|
+
name: 'TestComponent',
|
|
226
|
+
props: {
|
|
227
|
+
modelValue: {
|
|
228
|
+
type: Number,
|
|
229
|
+
required: true,
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
template: `<div>{{ modelValue }}</div>`,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const wrapper = createWrapperFor({
|
|
236
|
+
template: `
|
|
237
|
+
<button class="request-1-sec-component-props" @click="fireRequestComponentProps"></button>
|
|
238
|
+
<button class="update-props" @click="updateProps"></button>
|
|
239
|
+
`,
|
|
240
|
+
components: { TestComponent },
|
|
241
|
+
setup() {
|
|
242
|
+
const componentProps = ref({ modelValue: 0 });
|
|
243
|
+
const { loadingShow, loadingHide } = usePLoading();
|
|
244
|
+
|
|
245
|
+
const fireRequestComponentProps = async () => {
|
|
246
|
+
const id = `component-props`;
|
|
247
|
+
componentProps.value.modelValue = 10;
|
|
248
|
+
loadingShow({ id, content: TestComponent, props: componentProps });
|
|
249
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
250
|
+
loadingHide(id);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const updateProps = () => {
|
|
254
|
+
componentProps.value.modelValue = 20;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
return { loadingShow, loadingHide, fireRequestComponentProps, updateProps };
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
await wrapper.find('.request-1-sec-component-props').trigger('click');
|
|
262
|
+
|
|
263
|
+
jest.advanceTimersByTime(300);
|
|
264
|
+
await waitNT(appWrapper.vm);
|
|
265
|
+
const testComponent = appWrapper.findComponent(TestComponent);
|
|
266
|
+
expect(appWrapper.find('[aria-busy]').exists()).toBe(true);
|
|
267
|
+
expect(testComponent.exists()).toBe(true);
|
|
268
|
+
expect(testComponent.props().modelValue).toBe(10);
|
|
269
|
+
|
|
270
|
+
jest.advanceTimersByTime(300);
|
|
271
|
+
await waitNT(appWrapper.vm);
|
|
272
|
+
await wrapper.find('.update-props').trigger('click');
|
|
273
|
+
expect(testComponent.props().modelValue).toBe(20);
|
|
274
|
+
|
|
275
|
+
jest.advanceTimersByTime(500);
|
|
276
|
+
await waitNT(appWrapper.vm);
|
|
277
|
+
expect(appWrapper.find('[aria-busy]').exists()).toBe(false);
|
|
278
|
+
});
|
|
221
279
|
});
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ComputationStatus1 from '@/playground/components/ComputationStatus1.vue';
|
|
2
2
|
import PBtn from '@squirrel/components/p-btn/p-btn.vue';
|
|
3
3
|
import PLoading from '@squirrel/components/p-loading/p-loading.vue';
|
|
4
|
+
import { defineComponent, ref } from 'vue';
|
|
4
5
|
import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
|
|
5
6
|
|
|
7
|
+
const TestComponent = defineComponent({
|
|
8
|
+
name: 'TestComponent',
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: '',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
template: `<div class="text-sm px-4 py-2 whitespace-nowrap">{{ modelValue }}</div>`,
|
|
16
|
+
});
|
|
17
|
+
|
|
6
18
|
export default {
|
|
7
19
|
title: 'Components/PLoading',
|
|
8
20
|
component: PLoading,
|
|
@@ -87,7 +99,7 @@ export const WithComponentAsContent = {
|
|
|
87
99
|
|
|
88
100
|
const fireRequestComponent = async (time) => {
|
|
89
101
|
const id = `component-${time}`;
|
|
90
|
-
loadingShow({ id, content:
|
|
102
|
+
loadingShow({ id, content: ComputationStatus1 });
|
|
91
103
|
await new Promise((resolve) => setTimeout(resolve, time));
|
|
92
104
|
loadingHide(id);
|
|
93
105
|
};
|
|
@@ -107,3 +119,46 @@ export const WithComponentAsContent = {
|
|
|
107
119
|
`,
|
|
108
120
|
}),
|
|
109
121
|
};
|
|
122
|
+
|
|
123
|
+
export const WithComponentWithPropsAsContent = {
|
|
124
|
+
render: (args) => ({
|
|
125
|
+
components: { PLoading, PBtn, TestComponent },
|
|
126
|
+
setup() {
|
|
127
|
+
const { loadingShow, loadingHide } = usePLoading();
|
|
128
|
+
const loading = ref(false);
|
|
129
|
+
const componentProps = ref({ modelValue: '' });
|
|
130
|
+
|
|
131
|
+
const fireRequestComponentProps = async () => {
|
|
132
|
+
const id = `component-props`;
|
|
133
|
+
componentProps.value = { modelValue: 'Loading, please wait' };
|
|
134
|
+
|
|
135
|
+
loading.value = true;
|
|
136
|
+
loadingShow({ id, content: TestComponent, props: componentProps });
|
|
137
|
+
|
|
138
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
139
|
+
|
|
140
|
+
componentProps.value = { modelValue: 'Still loading...' };
|
|
141
|
+
|
|
142
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
143
|
+
|
|
144
|
+
componentProps.value = { modelValue: 'Almost there!' };
|
|
145
|
+
|
|
146
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
147
|
+
|
|
148
|
+
loadingHide(id);
|
|
149
|
+
loading.value = false;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return { args, loadingShow, fireRequestComponentProps, loading };
|
|
153
|
+
},
|
|
154
|
+
template: `
|
|
155
|
+
<PLoading />
|
|
156
|
+
<div class="mt-10">
|
|
157
|
+
<div>Demo with a component with props as content</div>
|
|
158
|
+
<div class="flex gap-4 mt-2">
|
|
159
|
+
<PBtn @click="fireRequestComponentProps" :disabled="loading">Display loader</PBtn>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
`,
|
|
163
|
+
}),
|
|
164
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
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
5
|
:style="{ width: `${width}px`, height: `${height}px` }"
|
|
6
|
-
class="rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-300"
|
|
6
|
+
class="overflow-hidden rounded-b border-x border-b border-p-gray-30 bg-p-blue-10 shadow-sm transition-all duration-300"
|
|
7
7
|
>
|
|
8
8
|
<Transition enter-from-class="opacity-0" enter-active-class="transition duration-500">
|
|
9
9
|
<Component :is="content" v-if="isComponent(content)" v-bind="componentProps" />
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import { type Component, ref, toValue, watch } from 'vue';
|
|
25
25
|
import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
|
|
26
26
|
|
|
27
|
-
const textDivClass = `overflow-hidden whitespace-nowrap px-4
|
|
27
|
+
const textDivClass = `overflow-hidden whitespace-nowrap px-4 pt-1 h-8 text-center text-sm font-semibold text-p-purple-60`;
|
|
28
28
|
|
|
29
29
|
defineOptions({
|
|
30
30
|
name: 'PLoading',
|