@pequity/squirrel 3.1.2 → 4.0.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 +4 -2
- package/dist/es/index.js +5 -3
- package/dist/squirrel/components/p-action-bar/p-action-bar.vue.d.ts +1 -0
- package/package.json +8 -9
- package/squirrel/components/p-action-bar/p-action-bar.spec.js +16 -1
- package/squirrel/components/p-action-bar/p-action-bar.stories.js +14 -7
- package/squirrel/components/p-action-bar/p-action-bar.vue +2 -1
package/dist/cjs/index.js
CHANGED
|
@@ -75,6 +75,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
75
75
|
},
|
|
76
76
|
__name: "p-action-bar",
|
|
77
77
|
props: {
|
|
78
|
+
show: { type: Boolean },
|
|
78
79
|
label: {},
|
|
79
80
|
actions: {}
|
|
80
81
|
},
|
|
@@ -82,7 +83,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
82
83
|
setup(__props) {
|
|
83
84
|
return (_ctx, _cache) => {
|
|
84
85
|
return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
85
|
-
vue.
|
|
86
|
+
_ctx.show ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
|
|
87
|
+
key: 0,
|
|
86
88
|
class: "fixed bottom-6 left-1/2 z-[100] -translate-x-2/4",
|
|
87
89
|
role: "alertdialog"
|
|
88
90
|
}, _ctx.$attrs), [
|
|
@@ -169,7 +171,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
169
171
|
}), 128))
|
|
170
172
|
])
|
|
171
173
|
])
|
|
172
|
-
], 16)
|
|
174
|
+
], 16)) : vue.createCommentVNode("", true)
|
|
173
175
|
]);
|
|
174
176
|
};
|
|
175
177
|
}
|
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { config } from "./config.js";
|
|
2
|
-
import { defineComponent, openBlock, createBlock, Teleport,
|
|
2
|
+
import { defineComponent, openBlock, createBlock, Teleport, createElementBlock, mergeProps, createElementVNode, createVNode, toDisplayString, Fragment, renderList, withCtx, resolveDynamicComponent, createCommentVNode, shallowRef, ref, computed, onMounted, normalizeClass, unref, withModifiers, createTextVNode, withDirectives, vShow, pushScopeId, popScopeId, useAttrs, resolveDirective, normalizeStyle, isRef, renderSlot, provide, onBeforeUnmount, watch, toHandlers } from "vue";
|
|
3
3
|
import PBtn from "./p-btn.js";
|
|
4
4
|
import PCloseBtn from "./p-close-btn.js";
|
|
5
5
|
import PDropdown from "./p-dropdown.js";
|
|
@@ -75,6 +75,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
75
75
|
},
|
|
76
76
|
__name: "p-action-bar",
|
|
77
77
|
props: {
|
|
78
|
+
show: { type: Boolean },
|
|
78
79
|
label: {},
|
|
79
80
|
actions: {}
|
|
80
81
|
},
|
|
@@ -82,7 +83,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
82
83
|
setup(__props) {
|
|
83
84
|
return (_ctx, _cache) => {
|
|
84
85
|
return openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
85
|
-
|
|
86
|
+
_ctx.show ? (openBlock(), createElementBlock("div", mergeProps({
|
|
87
|
+
key: 0,
|
|
86
88
|
class: "fixed bottom-6 left-1/2 z-[100] -translate-x-2/4",
|
|
87
89
|
role: "alertdialog"
|
|
88
90
|
}, _ctx.$attrs), [
|
|
@@ -169,7 +171,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
169
171
|
}), 128))
|
|
170
172
|
])
|
|
171
173
|
])
|
|
172
|
-
], 16)
|
|
174
|
+
], 16)) : createCommentVNode("", true)
|
|
173
175
|
]);
|
|
174
176
|
};
|
|
175
177
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pequity/squirrel",
|
|
3
3
|
"description": "Squirrel component library",
|
|
4
|
-
"version": "
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "4.0.0",
|
|
5
|
+
"packageManager": "pnpm@9.7.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"preinstall": "npx only-allow pnpm",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@storybook/theming": "^8.2.9",
|
|
72
72
|
"@storybook/vue3": "^8.2.9",
|
|
73
73
|
"@storybook/vue3-vite": "^8.2.9",
|
|
74
|
-
"@tanstack/vue-virtual": "3.
|
|
74
|
+
"@tanstack/vue-virtual": "3.10.1",
|
|
75
75
|
"@types/jest": "^29.5.12",
|
|
76
76
|
"@types/jsdom": "^21.1.7",
|
|
77
77
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"eslint": "^8.57.0",
|
|
88
88
|
"eslint-plugin-storybook": "^0.8.0",
|
|
89
89
|
"floating-vue": "5.2.2",
|
|
90
|
-
"glob": "^
|
|
90
|
+
"glob": "^11.0.0",
|
|
91
91
|
"http-server": "^14.1.1",
|
|
92
|
-
"husky": "^9.1.
|
|
92
|
+
"husky": "^9.1.5",
|
|
93
93
|
"jest": "^29.7.0",
|
|
94
94
|
"jest-environment-jsdom": "^29.7.0",
|
|
95
95
|
"lint-staged": "^15.2.9",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"prettier": "^3.3.3",
|
|
100
100
|
"prettier-plugin-tailwindcss": "^0.6.6",
|
|
101
101
|
"resolve-tspaths": "^0.8.19",
|
|
102
|
-
"rimraf": "^
|
|
102
|
+
"rimraf": "^6.0.1",
|
|
103
103
|
"sass": "^1.77.8",
|
|
104
104
|
"semantic-release": "^24.1.0",
|
|
105
105
|
"storybook": "^8.2.9",
|
|
@@ -108,12 +108,11 @@
|
|
|
108
108
|
"ts-jest": "^29.2.4",
|
|
109
109
|
"typescript": "5.5.4",
|
|
110
110
|
"v-calendar": "3.1.2",
|
|
111
|
-
"vite": "^5.4.
|
|
111
|
+
"vite": "^5.4.2",
|
|
112
112
|
"vue": "3.4.38",
|
|
113
113
|
"vue-currency-input": "3.1.0",
|
|
114
114
|
"vue-router": "4.4.3",
|
|
115
115
|
"vue-toastification": "2.0.0-rc.5",
|
|
116
|
-
"vue-tsc": "2.0.29"
|
|
117
|
-
"wait-on": "^7.2.0"
|
|
116
|
+
"vue-tsc": "2.0.29"
|
|
118
117
|
}
|
|
119
118
|
}
|
|
@@ -48,9 +48,22 @@ const createComponentWrapper = (args = {}) =>
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
describe('PActionBar.vue', () => {
|
|
51
|
+
it.each([true, false])('shows/hides when the show prop is %s', async (val) => {
|
|
52
|
+
const wrapper = createComponentWrapper({
|
|
53
|
+
props: { show: false, label: 'Hello World', actions: [{ label: 'Say Hi', name: 'greet' }] },
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await wrapper.setProps({ show: val });
|
|
57
|
+
|
|
58
|
+
const mainDiv = wrapper.find('.teleport-stub > .fixed.bottom-6');
|
|
59
|
+
|
|
60
|
+
expect(mainDiv.exists()).toBe(val);
|
|
61
|
+
});
|
|
62
|
+
|
|
51
63
|
it('renders correctly', async () => {
|
|
52
64
|
const wrapper = createComponentWrapper({
|
|
53
65
|
props: {
|
|
66
|
+
show: true,
|
|
54
67
|
label: 'Hello World',
|
|
55
68
|
actions: [
|
|
56
69
|
{ label: 'Say Hi', name: 'greet' },
|
|
@@ -93,6 +106,7 @@ describe('PActionBar.vue', () => {
|
|
|
93
106
|
it('attrs fall through ', async () => {
|
|
94
107
|
const wrapper = createComponentWrapper({
|
|
95
108
|
props: {
|
|
109
|
+
show: true,
|
|
96
110
|
label: 'Hello World',
|
|
97
111
|
actions: [
|
|
98
112
|
{ label: 'Say Hi', name: 'greet' },
|
|
@@ -114,7 +128,7 @@ describe('PActionBar.vue', () => {
|
|
|
114
128
|
|
|
115
129
|
it('emits a click:dismiss event', async () => {
|
|
116
130
|
const wrapper = createComponentWrapper({
|
|
117
|
-
props: { label: 'Hello World', actions: [{ label: 'Say Hi', name: 'greet' }] },
|
|
131
|
+
props: { show: true, label: 'Hello World', actions: [{ label: 'Say Hi', name: 'greet' }] },
|
|
118
132
|
});
|
|
119
133
|
|
|
120
134
|
const button = await wrapper.find('button.inline-flex');
|
|
@@ -127,6 +141,7 @@ describe('PActionBar.vue', () => {
|
|
|
127
141
|
it('emits a click:action event with the correct name', async () => {
|
|
128
142
|
const wrapper = createComponentWrapper({
|
|
129
143
|
props: {
|
|
144
|
+
show: true,
|
|
130
145
|
label: 'Hello World',
|
|
131
146
|
actions: [
|
|
132
147
|
{ label: 'Say Hi', name: 'greet' },
|
|
@@ -5,12 +5,11 @@ import PaginateLeftIcon from '@squirrel/assets/pagination-left-icon.svg?inline';
|
|
|
5
5
|
import PaginateRightIcon from '@squirrel/assets/pagination-right-icon.svg?inline';
|
|
6
6
|
import { action } from '@storybook/addon-actions';
|
|
7
7
|
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
|
|
8
|
-
import { shallowRef } from 'vue';
|
|
9
8
|
|
|
10
9
|
const actionBarActions = [
|
|
11
10
|
{
|
|
12
11
|
label: 'Upload',
|
|
13
|
-
icon:
|
|
12
|
+
icon: FileUploadIcon,
|
|
14
13
|
name: 'upload',
|
|
15
14
|
},
|
|
16
15
|
{
|
|
@@ -23,12 +22,12 @@ const actionBarActions = [
|
|
|
23
22
|
{
|
|
24
23
|
label: 'Subaction 1',
|
|
25
24
|
name: 'subaction1',
|
|
26
|
-
icon:
|
|
25
|
+
icon: PaginateLeftIcon,
|
|
27
26
|
},
|
|
28
27
|
{
|
|
29
28
|
label: 'Subaction 2',
|
|
30
29
|
name: 'subaction2',
|
|
31
|
-
icon:
|
|
30
|
+
icon: PaginateRightIcon,
|
|
32
31
|
},
|
|
33
32
|
],
|
|
34
33
|
},
|
|
@@ -49,22 +48,29 @@ export default {
|
|
|
49
48
|
|
|
50
49
|
export const Default = {
|
|
51
50
|
render: (args) => ({
|
|
52
|
-
components: { PActionBar },
|
|
51
|
+
components: { PActionBar, PBtn },
|
|
53
52
|
setup() {
|
|
54
53
|
const onDismiss = action('dismiss');
|
|
54
|
+
|
|
55
55
|
const onAction = action('action');
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
const setShow = (val) => {
|
|
58
|
+
args.show = val;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return { args, onAction, onDismiss, setShow };
|
|
58
62
|
},
|
|
59
63
|
template: `
|
|
60
64
|
<div class="h-20">
|
|
61
|
-
<
|
|
65
|
+
<PBtn class="mr-2" @click="setShow(!args.show)">Toggle action bar</PBtn>
|
|
66
|
+
<PActionBar v-bind="args" @click:dismiss="onDismiss(), setShow(false)" @click:action="onAction" />
|
|
62
67
|
</div>
|
|
63
68
|
`,
|
|
64
69
|
}),
|
|
65
70
|
args: {
|
|
66
71
|
label: 'Hello World',
|
|
67
72
|
actions: actionBarActions,
|
|
73
|
+
show: false,
|
|
68
74
|
},
|
|
69
75
|
};
|
|
70
76
|
|
|
@@ -89,6 +95,7 @@ export const WithAnElementBehind = {
|
|
|
89
95
|
args: {
|
|
90
96
|
label: 'Hello World',
|
|
91
97
|
actions: actionBarActions,
|
|
98
|
+
show: true,
|
|
92
99
|
onClick: fn(),
|
|
93
100
|
},
|
|
94
101
|
play: async ({ args, canvasElement }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body">
|
|
3
|
-
<div class="fixed bottom-6 left-1/2 z-[100] -translate-x-2/4" role="alertdialog" v-bind="$attrs">
|
|
3
|
+
<div v-if="show" class="fixed bottom-6 left-1/2 z-[100] -translate-x-2/4" role="alertdialog" v-bind="$attrs">
|
|
4
4
|
<div
|
|
5
5
|
class="flex h-12 w-max select-none items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white"
|
|
6
6
|
>
|
|
@@ -64,6 +64,7 @@ defineOptions({
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
type Props = {
|
|
67
|
+
show: boolean;
|
|
67
68
|
label: string;
|
|
68
69
|
actions: PActionBarAction[];
|
|
69
70
|
};
|