@pequity/squirrel 3.1.0 → 3.1.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 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
 
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.2",
5
5
  "packageManager": "pnpm@8.9.2",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -50,67 +50,70 @@
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",
55
- "@commitlint/cli": "^19.3.0",
53
+ "@babel/core": "^7.25.2",
54
+ "@babel/preset-env": "^7.25.3",
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.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",
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/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",
71
+ "@storybook/theming": "^8.2.9",
72
+ "@storybook/vue3": "^8.2.9",
73
+ "@storybook/vue3-vite": "^8.2.9",
74
+ "@tanstack/vue-virtual": "3.9.0",
75
75
  "@types/jest": "^29.5.12",
76
76
  "@types/jsdom": "^21.1.7",
77
77
  "@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",
78
+ "@types/node": "^22.4.1",
79
+ "@vitejs/plugin-vue": "^5.1.2",
80
+ "@vue/compiler-sfc": "3.4.38",
81
81
  "@vue/test-utils": "^2.4.6",
82
82
  "@vue/vue3-jest": "^29.2.6",
83
- "autoprefixer": "^10.4.19",
83
+ "autoprefixer": "^10.4.20",
84
84
  "babel-jest": "^29.7.0",
85
+ "concurrently": "^8.2.2",
85
86
  "dayjs": "1.11.12",
86
87
  "eslint": "^8.57.0",
87
88
  "eslint-plugin-storybook": "^0.8.0",
88
89
  "floating-vue": "5.2.2",
89
90
  "glob": "^10.4.5",
90
- "husky": "^9.1.1",
91
+ "http-server": "^14.1.1",
92
+ "husky": "^9.1.4",
91
93
  "jest": "^29.7.0",
92
94
  "jest-environment-jsdom": "^29.7.0",
93
- "lint-staged": "^15.2.7",
95
+ "lint-staged": "^15.2.9",
94
96
  "lodash-es": "4.17.21",
95
97
  "make-coverage-badge": "^1.2.0",
96
- "postcss": "^8.4.39",
98
+ "postcss": "^8.4.41",
97
99
  "prettier": "^3.3.3",
98
- "prettier-plugin-tailwindcss": "^0.6.5",
100
+ "prettier-plugin-tailwindcss": "^0.6.6",
99
101
  "resolve-tspaths": "^0.8.19",
100
- "rimraf": "^5.0.9",
102
+ "rimraf": "^5.0.10",
101
103
  "sass": "^1.77.8",
102
- "semantic-release": "^24.0.0",
103
- "storybook": "^8.2.5",
104
+ "semantic-release": "^24.1.0",
105
+ "storybook": "^8.2.9",
104
106
  "svgo": "^3.3.2",
105
- "tailwindcss": "^3.4.6",
106
- "ts-jest": "^29.2.3",
107
+ "tailwindcss": "^3.4.10",
108
+ "ts-jest": "^29.2.4",
107
109
  "typescript": "5.5.4",
108
110
  "v-calendar": "3.1.2",
109
- "vite": "^5.3.4",
110
- "vue": "3.4.33",
111
+ "vite": "^5.4.1",
112
+ "vue": "3.4.38",
111
113
  "vue-currency-input": "3.1.0",
112
- "vue-router": "4.4.0",
114
+ "vue-router": "4.4.3",
113
115
  "vue-toastification": "2.0.0-rc.5",
114
- "vue-tsc": "2.0.28"
116
+ "vue-tsc": "2.0.29",
117
+ "wait-on": "^7.2.0"
115
118
  }
116
119
  }
@@ -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