@pequity/squirrel 3.1.0 → 3.1.1

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
@@ -60,10 +60,10 @@ const dom = require("./dom.js");
60
60
  const object = require("./object.js");
61
61
  const listKeyboardNavigation = require("./listKeyboardNavigation.js");
62
62
  const number = require("./number.js");
63
- const _hoisted_1$4 = { class: "flex h-12 min-w-fit select-none items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white" };
63
+ const _hoisted_1$4 = { class: "flex h-12 w-max select-none items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white" };
64
64
  const _hoisted_2$4 = { class: "whitespace-nowrap px-3" };
65
65
  const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "mx-4 h-9 w-0.5 shrink-0 rounded bg-p-purple-50" }, null, -1);
66
- const _hoisted_4$4 = { class: "flex min-w-fit" };
66
+ const _hoisted_4$4 = { class: "flex" };
67
67
  const _hoisted_5$4 = { class: "flex items-center gap-2 px-1 py-0.5" };
68
68
  const _hoisted_6$4 = { class: "flex items-center gap-2 px-1 py-0.5" };
69
69
  const _hoisted_7$3 = { class: "flex flex-col bg-p-purple-60" };
@@ -83,7 +83,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
83
83
  return (_ctx, _cache) => {
84
84
  return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
85
85
  vue.createElementVNode("div", vue.mergeProps({
86
- class: "fixed bottom-6 z-[100] flex w-full justify-center",
86
+ class: "fixed bottom-6 left-1/2 z-[100] -translate-x-2/4",
87
87
  role: "alertdialog"
88
88
  }, _ctx.$attrs), [
89
89
  vue.createElementVNode("div", _hoisted_1$4, [
package/dist/es/index.js CHANGED
@@ -60,10 +60,10 @@ import { getNextActiveElement, isElement, isVisible } from "./dom.js";
60
60
  import { isObject } from "./object.js";
61
61
  import { setupListKeyboardNavigation } from "./listKeyboardNavigation.js";
62
62
  import { toNumberOrNull } from "./number.js";
63
- const _hoisted_1$4 = { class: "flex h-12 min-w-fit select-none items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white" };
63
+ const _hoisted_1$4 = { class: "flex h-12 w-max select-none items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white" };
64
64
  const _hoisted_2$4 = { class: "whitespace-nowrap px-3" };
65
65
  const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("div", { class: "mx-4 h-9 w-0.5 shrink-0 rounded bg-p-purple-50" }, null, -1);
66
- const _hoisted_4$4 = { class: "flex min-w-fit" };
66
+ const _hoisted_4$4 = { class: "flex" };
67
67
  const _hoisted_5$4 = { class: "flex items-center gap-2 px-1 py-0.5" };
68
68
  const _hoisted_6$4 = { class: "flex items-center gap-2 px-1 py-0.5" };
69
69
  const _hoisted_7$3 = { class: "flex flex-col bg-p-purple-60" };
@@ -83,7 +83,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
83
83
  return (_ctx, _cache) => {
84
84
  return openBlock(), createBlock(Teleport, { to: "body" }, [
85
85
  createElementVNode("div", mergeProps({
86
- class: "fixed bottom-6 z-[100] flex w-full justify-center",
86
+ class: "fixed bottom-6 left-1/2 z-[100] -translate-x-2/4",
87
87
  role: "alertdialog"
88
88
  }, _ctx.$attrs), [
89
89
  createElementVNode("div", _hoisted_1$4, [
@@ -5,10 +5,10 @@ type Props = {
5
5
  };
6
6
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
7
  "click:dismiss": () => void;
8
- "click:action": (value: string | undefined) => void;
8
+ "click:action": (args_0: string | undefined) => void;
9
9
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>> & {
10
10
  "onClick:dismiss"?: (() => any) | undefined;
11
- "onClick:action"?: ((value: string | undefined) => any) | undefined;
11
+ "onClick:action"?: ((args_0: string | undefined) => any) | undefined;
12
12
  }, {}, {}>;
13
13
  export default _default;
14
14
 
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<{
25
25
  default: string;
26
26
  };
27
27
  }, {
28
- inputRef: import("vue").Ref<any>;
28
+ inputRef: import("vue").Ref<any, 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[]>;
35
- internalValue: Ref<AnyValue[]>;
36
- search: Ref<string>;
37
- rowVirtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
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>>;
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>;
8
- colResizeHandleLeft: Ref<string>;
9
- colResizingIndex: Ref<number>;
10
- colResizingWidth: Ref<number>;
7
+ isColResizing: Ref<boolean, boolean>;
8
+ colResizeHandleLeft: Ref<string, string>;
9
+ colResizingIndex: Ref<number, number>;
10
+ colResizingWidth: Ref<number, number>;
11
11
  colResize: (e: MouseEvent) => void;
12
12
  colResizeStart: (e: MouseEvent, i: number) => void;
13
13
  colResizeStop: () => void;
@@ -11,12 +11,18 @@ 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;
14
20
  }[]>;
15
- paddingTop: Ref<number>;
16
- paddingBottom: Ref<number>;
17
- measureElement: () => Ref<undefined>;
21
+ paddingTop: Ref<number, number>;
22
+ paddingBottom: Ref<number, number>;
23
+ measureElement: () => Ref<undefined, undefined>;
18
24
  } | {
19
- virtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
25
+ virtualizer: Ref<import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>, import("@tanstack/vue-virtual").Virtualizer<HTMLElement, Element>>;
20
26
  virtualRows: ComputedRef<import("@tanstack/vue-virtual").VirtualItem<Element>[]>;
21
27
  paddingTop: ComputedRef<number>;
22
28
  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>;
15
+ errorMsgClasses: import("vue").Ref<string, string>;
16
16
  };
17
17
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "3.1.0",
4
+ "version": "3.1.1",
5
5
  "packageManager": "pnpm@8.9.2",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -50,34 +50,33 @@
50
50
  "vue-toastification": "^2.0.0-rc.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@babel/core": "^7.24.9",
54
- "@babel/preset-env": "^7.24.8",
53
+ "@babel/core": "^7.25.2",
54
+ "@babel/preset-env": "^7.25.3",
55
55
  "@commitlint/cli": "^19.3.0",
56
56
  "@commitlint/config-conventional": "^19.2.2",
57
57
  "@pequity/eslint-config": "^0.0.13",
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.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
- "@storybook/jest": "^0.2.3",
68
- "@storybook/manager-api": "^8.2.5",
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",
69
69
  "@storybook/test-runner": "^0.19.1",
70
- "@storybook/testing-library": "^0.2.2",
71
- "@storybook/theming": "^8.2.5",
72
- "@storybook/vue3": "^8.2.5",
73
- "@storybook/vue3-vite": "^8.2.5",
74
- "@tanstack/vue-virtual": "3.8.3",
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",
75
74
  "@types/jest": "^29.5.12",
76
75
  "@types/jsdom": "^21.1.7",
77
76
  "@types/lodash-es": "^4.17.12",
78
- "@types/node": "^20.14.11",
79
- "@vitejs/plugin-vue": "^5.0.5",
80
- "@vue/compiler-sfc": "3.4.33",
77
+ "@types/node": "^22.1.0",
78
+ "@vitejs/plugin-vue": "^5.1.2",
79
+ "@vue/compiler-sfc": "3.4.35",
81
80
  "@vue/test-utils": "^2.4.6",
82
81
  "@vue/vue3-jest": "^29.2.6",
83
82
  "autoprefixer": "^10.4.19",
@@ -87,30 +86,30 @@
87
86
  "eslint-plugin-storybook": "^0.8.0",
88
87
  "floating-vue": "5.2.2",
89
88
  "glob": "^10.4.5",
90
- "husky": "^9.1.1",
89
+ "husky": "^9.1.4",
91
90
  "jest": "^29.7.0",
92
91
  "jest-environment-jsdom": "^29.7.0",
93
92
  "lint-staged": "^15.2.7",
94
93
  "lodash-es": "4.17.21",
95
94
  "make-coverage-badge": "^1.2.0",
96
- "postcss": "^8.4.39",
95
+ "postcss": "^8.4.40",
97
96
  "prettier": "^3.3.3",
98
97
  "prettier-plugin-tailwindcss": "^0.6.5",
99
98
  "resolve-tspaths": "^0.8.19",
100
- "rimraf": "^5.0.9",
99
+ "rimraf": "^5.0.10",
101
100
  "sass": "^1.77.8",
102
101
  "semantic-release": "^24.0.0",
103
- "storybook": "^8.2.5",
102
+ "storybook": "^8.2.7",
104
103
  "svgo": "^3.3.2",
105
- "tailwindcss": "^3.4.6",
106
- "ts-jest": "^29.2.3",
104
+ "tailwindcss": "^3.4.7",
105
+ "ts-jest": "^29.2.4",
107
106
  "typescript": "5.5.4",
108
107
  "v-calendar": "3.1.2",
109
- "vite": "^5.3.4",
110
- "vue": "3.4.33",
108
+ "vite": "^5.3.5",
109
+ "vue": "3.4.35",
111
110
  "vue-currency-input": "3.1.0",
112
- "vue-router": "4.4.0",
111
+ "vue-router": "4.4.2",
113
112
  "vue-toastification": "2.0.0-rc.5",
114
- "vue-tsc": "2.0.28"
113
+ "vue-tsc": "2.0.29"
115
114
  }
116
115
  }
@@ -62,13 +62,13 @@ describe('PActionBar.vue', () => {
62
62
  const mainDiv = await wrapper.find('.teleport-stub > .fixed.bottom-6');
63
63
  expect(mainDiv.exists()).toBe(true);
64
64
 
65
- expect(mainDiv.classes()).toEqual(['fixed', 'bottom-6', 'z-[100]', 'flex', 'w-full', 'justify-center']);
65
+ expect(mainDiv.classes()).toEqual(['fixed', 'bottom-6', 'left-1/2', 'z-[100]', '-translate-x-2/4']);
66
66
  const actionBarDiv = mainDiv.find('.bg-p-purple-60');
67
67
  expect(actionBarDiv.exists()).toBe(true);
68
68
  expect(actionBarDiv.classes()).toEqual([
69
69
  'flex',
70
70
  'h-12',
71
- 'min-w-fit',
71
+ 'w-max',
72
72
  'select-none',
73
73
  'items-center',
74
74
  'rounded-lg',
@@ -1,10 +1,39 @@
1
1
  import FileUploadIcon from '@squirrel/assets/file-upload-upload-icon.svg?inline';
2
2
  import PActionBar from '@squirrel/components/p-action-bar/p-action-bar.vue';
3
+ import PBtn from '@squirrel/components/p-btn/p-btn.vue';
3
4
  import PaginateLeftIcon from '@squirrel/assets/pagination-left-icon.svg?inline';
4
5
  import PaginateRightIcon from '@squirrel/assets/pagination-right-icon.svg?inline';
5
6
  import { action } from '@storybook/addon-actions';
7
+ import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
6
8
  import { shallowRef } from 'vue';
7
9
 
10
+ const actionBarActions = [
11
+ {
12
+ label: 'Upload',
13
+ icon: shallowRef(FileUploadIcon),
14
+ name: 'upload',
15
+ },
16
+ {
17
+ label: 'Say Hi',
18
+ name: 'greet',
19
+ },
20
+ {
21
+ label: 'Action Menu',
22
+ subActions: [
23
+ {
24
+ label: 'Subaction 1',
25
+ name: 'subaction1',
26
+ icon: shallowRef(PaginateLeftIcon),
27
+ },
28
+ {
29
+ label: 'Subaction 2',
30
+ name: 'subaction2',
31
+ icon: shallowRef(PaginateRightIcon),
32
+ },
33
+ ],
34
+ },
35
+ ];
36
+
8
37
  export default {
9
38
  title: 'Components/PActionBar',
10
39
  component: PActionBar,
@@ -27,35 +56,53 @@ export const Default = {
27
56
 
28
57
  return { args, onAction, onDismiss };
29
58
  },
30
- template: `<div class="h-20"><PActionBar v-bind="args" @click:dismiss="onDismiss" @click:action="onAction" /></div>`,
59
+ template: `
60
+ <div class="h-20">
61
+ <PActionBar v-bind="args" @click:dismiss="onDismiss" @click:action="onAction" />
62
+ </div>
63
+ `,
31
64
  }),
32
65
  args: {
33
66
  label: 'Hello World',
34
- actions: [
35
- {
36
- label: 'Upload',
37
- icon: shallowRef(FileUploadIcon),
38
- name: 'upload',
39
- },
40
- {
41
- label: 'Say Hi',
42
- name: 'greet',
43
- },
44
- {
45
- label: 'Action Menu',
46
- subActions: [
47
- {
48
- label: 'Subaction 1',
49
- name: 'subaction1',
50
- icon: shallowRef(PaginateLeftIcon),
51
- },
52
- {
53
- label: 'Subaction 2',
54
- name: 'subaction2',
55
- icon: shallowRef(PaginateRightIcon),
56
- },
57
- ],
67
+ actions: actionBarActions,
68
+ },
69
+ };
70
+
71
+ export const WithAnElementBehind = {
72
+ render: (args) => ({
73
+ components: { PActionBar, PBtn },
74
+ setup() {
75
+ const onDismiss = action('dismiss');
76
+ const onAction = action('action');
77
+
78
+ return { args, onAction, onDismiss };
79
+ },
80
+ template: `
81
+ <div class="h-20">
82
+ <div class="flex items-center fixed bottom-0 h-28 w-full z-10 bg-p-gray-30">
83
+ <PBtn @click="args.onClick">Click me!</PBtn>
84
+ </div>
85
+ <PActionBar v-bind="args" @click:dismiss="onDismiss" @click:action="onAction" />
86
+ </div>
87
+ `,
88
+ }),
89
+ args: {
90
+ label: 'Hello World',
91
+ actions: actionBarActions,
92
+ onClick: fn(),
93
+ },
94
+ play: async ({ args, canvasElement }) => {
95
+ const canvas = within(canvasElement);
96
+
97
+ await userEvent.click(canvas.getByRole('button', { name: 'Click me!' }));
98
+
99
+ await waitFor(() => expect(args.onClick).toHaveBeenCalled());
100
+ },
101
+ parameters: {
102
+ docs: {
103
+ description: {
104
+ story: 'Elements behind `PActionBar` should be clickable.',
58
105
  },
59
- ],
106
+ },
60
107
  },
61
108
  };
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <Teleport to="body">
3
- <div class="fixed bottom-6 z-[100] flex w-full justify-center" role="alertdialog" v-bind="$attrs">
3
+ <div class="fixed bottom-6 left-1/2 z-[100] -translate-x-2/4" role="alertdialog" v-bind="$attrs">
4
4
  <div
5
- class="flex h-12 min-w-fit select-none items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white"
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
  >
7
7
  <PCloseBtn variant="dark" @click="$emit('click:dismiss')"></PCloseBtn>
8
8
  <p class="whitespace-nowrap px-3">{{ label }}</p>
9
9
  <div class="mx-4 h-9 w-0.5 shrink-0 rounded bg-p-purple-50"></div>
10
- <div class="flex min-w-fit">
10
+ <div class="flex">
11
11
  <template v-for="actionOrMenu in actions" :key="`action-${actionOrMenu.label}`">
12
12
  <PBtn
13
13
  v-if="!actionOrMenu.subActions"
@@ -69,8 +69,8 @@ type Props = {
69
69
  };
70
70
 
71
71
  defineEmits<{
72
- (e: 'click:dismiss'): void;
73
- (e: 'click:action', value: PActionBarAction['name']): void;
72
+ 'click:dismiss': [];
73
+ 'click:action': [PActionBarAction['name']];
74
74
  }>();
75
75
 
76
76
  defineProps<Props>();
@@ -1,6 +1,5 @@
1
1
  import PAlert from '@squirrel/components/p-alert/p-alert.vue';
2
- import { expect } from '@storybook/jest';
3
- import { within } from '@storybook/testing-library';
2
+ import { expect, within } from '@storybook/test';
4
3
 
5
4
  export default {
6
5
  title: 'Components/PAlert',
@@ -1,8 +1,7 @@
1
1
  import Icon from '@squirrel/assets/info-circle-icon.svg?inline';
2
2
  import PBtn from '@squirrel/components/p-btn/p-btn.vue';
3
3
  import { action } from '@storybook/addon-actions';
4
- import { expect } from '@storybook/jest';
5
- import { within } from '@storybook/testing-library';
4
+ import { expect, within } from '@storybook/test';
6
5
 
7
6
  // You can also import an `md` file and use it as a story's description
8
7
  // import PBtnReadme from './PBtn.readme.md';
@@ -1,7 +1,6 @@
1
1
  import PCloseBtn from '@squirrel/components/p-close-btn/p-close-btn.vue';
2
2
  import { action } from '@storybook/addon-actions';
3
- import { expect } from '@storybook/jest';
4
- import { within } from '@storybook/testing-library';
3
+ import { expect, within } from '@storybook/test';
5
4
 
6
5
  export default {
7
6
  title: 'Components/PCloseBtn',
@@ -1,7 +1,6 @@
1
1
  import PSelectBtn from '@squirrel/components/p-select-btn/p-select-btn.vue';
2
- import { expect } from '@storybook/jest';
2
+ import { expect, userEvent, within } from '@storybook/test';
3
3
  import { fieldArgTypes } from '@root/stories/common/field';
4
- import { userEvent, within } from '@storybook/testing-library';
5
4
 
6
5
  const selectItems = Object.freeze([
7
6
  { value: 1, text: 'Aleksandr Chappel', tooltip: 'lorem ipsum text 1' },
@@ -1,8 +1,7 @@
1
1
  import PSelectPill from '@squirrel/components/p-select-pill/p-select-pill.vue';
2
- import { expect } from '@storybook/jest';
2
+ import { expect, userEvent, within } from '@storybook/test';
3
3
  import { fieldArgTypes } from '@root/stories/common/field';
4
4
  import { getCSSTransitionDuration, sleep } from '@root/stories/common/helpers';
5
- import { userEvent, within } from '@storybook/testing-library';
6
5
 
7
6
  const ACTIVE_CLASS = 'text-p-purple-60';
8
7