@pequity/squirrel 3.1.1 → 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 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.createElementVNode("div", vue.mergeProps({
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, createElementVNode, mergeProps, createVNode, toDisplayString, createElementBlock, 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";
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
- createElementVNode("div", mergeProps({
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
  }
@@ -1,5 +1,6 @@
1
1
  import { type PActionBarAction } from './p-action-bar.types';
2
2
  type Props = {
3
+ show: boolean;
3
4
  label: string;
4
5
  actions: PActionBarAction[];
5
6
  };
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<{
25
25
  default: string;
26
26
  };
27
27
  }, {
28
- inputRef: import("vue").Ref<any, any>;
28
+ inputRef: import("vue").Ref<any>;
29
29
  computedAttrs: import("vue").ComputedRef<{
30
30
  [x: string]: unknown;
31
31
  }>;
@@ -31,10 +31,10 @@ export declare const useSelectList: (props: Props, inputSearch: InputSearch, vir
31
31
  computedItems: import("vue").ComputedRef<AnyObject[]>;
32
32
  computedItemSize: import("vue").ComputedRef<number>;
33
33
  computedInsideSelected: import("vue").ComputedRef<boolean>;
34
- internalItems: Ref<AnyObject[], AnyObject[]>;
35
- internalValue: Ref<AnyValue[], AnyValue[]>;
36
- search: Ref<string, string>;
37
- rowVirtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>, import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
34
+ internalItems: Ref<AnyObject[]>;
35
+ internalValue: Ref<AnyValue[]>;
36
+ search: Ref<string>;
37
+ rowVirtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
38
38
  getValue: (index: number) => AnyValue;
39
39
  getText: (index: number) => AnyValue;
40
40
  isSelected: (val: AnyValue) => boolean;
@@ -4,10 +4,10 @@ type Options = {
4
4
  ths: Ref<HTMLElement[]>;
5
5
  };
6
6
  export declare const usePTableColResize: (options: Options) => {
7
- isColResizing: Ref<boolean, boolean>;
8
- colResizeHandleLeft: Ref<string, string>;
9
- colResizingIndex: Ref<number, number>;
10
- colResizingWidth: Ref<number, number>;
7
+ isColResizing: Ref<boolean>;
8
+ colResizeHandleLeft: Ref<string>;
9
+ colResizingIndex: Ref<number>;
10
+ colResizingWidth: Ref<number>;
11
11
  colResize: (e: MouseEvent) => void;
12
12
  colResizeStart: (e: MouseEvent, i: number) => void;
13
13
  colResizeStop: () => void;
@@ -11,18 +11,12 @@ export declare const usePTableRowVirtualizer: (options: Options) => {
11
11
  virtualRows: Ref<{
12
12
  key: number;
13
13
  index: number;
14
- }[], {
15
- key: number;
16
- index: number;
17
- }[] | {
18
- key: number;
19
- index: number;
20
14
  }[]>;
21
- paddingTop: Ref<number, number>;
22
- paddingBottom: Ref<number, number>;
23
- measureElement: () => Ref<undefined, undefined>;
15
+ paddingTop: Ref<number>;
16
+ paddingBottom: Ref<number>;
17
+ measureElement: () => Ref<undefined>;
24
18
  } | {
25
- virtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>, import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
19
+ virtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
26
20
  virtualRows: ComputedRef<import("@tanstack/vue-virtual").VirtualItem<Element>[]>;
27
21
  paddingTop: ComputedRef<number>;
28
22
  paddingBottom: ComputedRef<number>;
@@ -12,6 +12,6 @@ export declare function useInputClasses(props: Partial<Props>): {
12
12
  labelClasses: import("vue").ComputedRef<string>;
13
13
  selectClasses: import("vue").ComputedRef<string>;
14
14
  textareaClasses: import("vue").ComputedRef<string>;
15
- errorMsgClasses: import("vue").Ref<string, string>;
15
+ errorMsgClasses: import("vue").Ref<string>;
16
16
  };
17
17
  export {};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "3.1.1",
5
- "packageManager": "pnpm@8.9.2",
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",
@@ -52,63 +52,66 @@
52
52
  "devDependencies": {
53
53
  "@babel/core": "^7.25.2",
54
54
  "@babel/preset-env": "^7.25.3",
55
- "@commitlint/cli": "^19.3.0",
55
+ "@commitlint/cli": "^19.4.0",
56
56
  "@commitlint/config-conventional": "^19.2.2",
57
57
  "@pequity/eslint-config": "^0.0.13",
58
+ "@playwright/test": "^1.46.1",
58
59
  "@popperjs/core": "2.11.8",
59
60
  "@semantic-release/changelog": "^6.0.3",
60
61
  "@semantic-release/git": "^10.0.1",
61
- "@storybook/addon-a11y": "^8.2.7",
62
- "@storybook/addon-actions": "^8.2.7",
63
- "@storybook/addon-essentials": "^8.2.7",
64
- "@storybook/addon-interactions": "^8.2.7",
65
- "@storybook/addon-links": "^8.2.7",
66
- "@storybook/blocks": "^8.2.7",
67
- "@storybook/manager-api": "^8.2.7",
68
- "@storybook/test": "^8.2.7",
62
+ "@storybook/addon-a11y": "^8.2.9",
63
+ "@storybook/addon-actions": "^8.2.9",
64
+ "@storybook/addon-essentials": "^8.2.9",
65
+ "@storybook/addon-interactions": "^8.2.9",
66
+ "@storybook/addon-links": "^8.2.9",
67
+ "@storybook/blocks": "^8.2.9",
68
+ "@storybook/manager-api": "^8.2.9",
69
+ "@storybook/test": "^8.2.9",
69
70
  "@storybook/test-runner": "^0.19.1",
70
- "@storybook/theming": "^8.2.7",
71
- "@storybook/vue3": "^8.2.7",
72
- "@storybook/vue3-vite": "^8.2.7",
73
- "@tanstack/vue-virtual": "3.8.4",
71
+ "@storybook/theming": "^8.2.9",
72
+ "@storybook/vue3": "^8.2.9",
73
+ "@storybook/vue3-vite": "^8.2.9",
74
+ "@tanstack/vue-virtual": "3.10.1",
74
75
  "@types/jest": "^29.5.12",
75
76
  "@types/jsdom": "^21.1.7",
76
77
  "@types/lodash-es": "^4.17.12",
77
- "@types/node": "^22.1.0",
78
+ "@types/node": "^22.4.1",
78
79
  "@vitejs/plugin-vue": "^5.1.2",
79
- "@vue/compiler-sfc": "3.4.35",
80
+ "@vue/compiler-sfc": "3.4.38",
80
81
  "@vue/test-utils": "^2.4.6",
81
82
  "@vue/vue3-jest": "^29.2.6",
82
- "autoprefixer": "^10.4.19",
83
+ "autoprefixer": "^10.4.20",
83
84
  "babel-jest": "^29.7.0",
85
+ "concurrently": "^8.2.2",
84
86
  "dayjs": "1.11.12",
85
87
  "eslint": "^8.57.0",
86
88
  "eslint-plugin-storybook": "^0.8.0",
87
89
  "floating-vue": "5.2.2",
88
- "glob": "^10.4.5",
89
- "husky": "^9.1.4",
90
+ "glob": "^11.0.0",
91
+ "http-server": "^14.1.1",
92
+ "husky": "^9.1.5",
90
93
  "jest": "^29.7.0",
91
94
  "jest-environment-jsdom": "^29.7.0",
92
- "lint-staged": "^15.2.7",
95
+ "lint-staged": "^15.2.9",
93
96
  "lodash-es": "4.17.21",
94
97
  "make-coverage-badge": "^1.2.0",
95
- "postcss": "^8.4.40",
98
+ "postcss": "^8.4.41",
96
99
  "prettier": "^3.3.3",
97
- "prettier-plugin-tailwindcss": "^0.6.5",
100
+ "prettier-plugin-tailwindcss": "^0.6.6",
98
101
  "resolve-tspaths": "^0.8.19",
99
- "rimraf": "^5.0.10",
102
+ "rimraf": "^6.0.1",
100
103
  "sass": "^1.77.8",
101
- "semantic-release": "^24.0.0",
102
- "storybook": "^8.2.7",
104
+ "semantic-release": "^24.1.0",
105
+ "storybook": "^8.2.9",
103
106
  "svgo": "^3.3.2",
104
- "tailwindcss": "^3.4.7",
107
+ "tailwindcss": "^3.4.10",
105
108
  "ts-jest": "^29.2.4",
106
109
  "typescript": "5.5.4",
107
110
  "v-calendar": "3.1.2",
108
- "vite": "^5.3.5",
109
- "vue": "3.4.35",
111
+ "vite": "^5.4.2",
112
+ "vue": "3.4.38",
110
113
  "vue-currency-input": "3.1.0",
111
- "vue-router": "4.4.2",
114
+ "vue-router": "4.4.3",
112
115
  "vue-toastification": "2.0.0-rc.5",
113
116
  "vue-tsc": "2.0.29"
114
117
  }
@@ -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: shallowRef(FileUploadIcon),
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: shallowRef(PaginateLeftIcon),
25
+ icon: PaginateLeftIcon,
27
26
  },
28
27
  {
29
28
  label: 'Subaction 2',
30
29
  name: 'subaction2',
31
- icon: shallowRef(PaginateRightIcon),
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
- return { args, onAction, onDismiss };
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
- <PActionBar v-bind="args" @click:dismiss="onDismiss" @click:action="onAction" />
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
  };