@pequity/squirrel 6.0.9 → 6.0.11

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.
Files changed (62) hide show
  1. package/dist/cjs/chunks/p-icon.js +24 -4
  2. package/dist/cjs/chunks/p-ring-loader.js +13 -65
  3. package/dist/cjs/p-btn.js +13 -21
  4. package/dist/cjs/p-loading.js +38 -4
  5. package/dist/es/chunks/p-action-bar.js +1 -1
  6. package/dist/es/chunks/p-card.js +1 -1
  7. package/dist/es/chunks/p-date-picker.js +1 -1
  8. package/dist/es/chunks/p-dropdown-select.js +1 -1
  9. package/dist/es/chunks/p-icon.js +25 -5
  10. package/dist/es/chunks/p-inline-date-picker.js +1 -1
  11. package/dist/es/chunks/p-input-percent.js +1 -1
  12. package/dist/es/chunks/p-link.js +1 -1
  13. package/dist/es/chunks/p-pagination-info.js +1 -1
  14. package/dist/es/chunks/p-pagination.js +1 -1
  15. package/dist/es/chunks/p-ring-loader.js +14 -66
  16. package/dist/es/chunks/p-select-btn.js +1 -1
  17. package/dist/es/chunks/p-select.js +1 -1
  18. package/dist/es/chunks/p-table-loader.js +1 -1
  19. package/dist/es/chunks/p-tabs.js +1 -1
  20. package/dist/es/index.js +1 -1
  21. package/dist/es/inputClassesMixin.js +1 -1
  22. package/dist/es/listKeyboardNavigation.js +1 -1
  23. package/dist/es/p-alert.js +1 -1
  24. package/dist/es/p-avatar.js +1 -1
  25. package/dist/es/p-btn.js +14 -22
  26. package/dist/es/p-checkbox.js +1 -1
  27. package/dist/es/p-chips.js +1 -1
  28. package/dist/es/p-close-btn.js +1 -1
  29. package/dist/es/p-drawer.js +1 -1
  30. package/dist/es/p-dropdown.js +1 -1
  31. package/dist/es/p-info-icon.js +1 -1
  32. package/dist/es/p-input-number.js +1 -1
  33. package/dist/es/p-input-search.js +1 -1
  34. package/dist/es/p-input.js +1 -1
  35. package/dist/es/p-loading.js +39 -5
  36. package/dist/es/p-modal.js +1 -1
  37. package/dist/es/p-progress-bar.js +1 -1
  38. package/dist/es/p-select-pill.js +1 -1
  39. package/dist/es/p-skeleton-loader.js +1 -1
  40. package/dist/es/p-table-filter-icon.js +1 -1
  41. package/dist/es/p-table-header-cell.js +1 -1
  42. package/dist/es/p-table-td.js +1 -1
  43. package/dist/es/p-textarea.js +1 -1
  44. package/dist/es/p-toggle.js +1 -1
  45. package/dist/es/useSelectList.js +1 -1
  46. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +1 -1
  47. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +10 -37
  48. package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +1 -1
  49. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +7 -7
  50. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +1 -1
  51. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +1 -1
  52. package/dist/squirrel/components/p-ring-loader/p-ring-loader.vue.d.ts +6 -31
  53. package/dist/squirrel/components/p-table/p-table.vue.d.ts +2 -2
  54. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +1 -1
  55. package/dist/squirrel.css +6 -6
  56. package/package.json +29 -29
  57. package/squirrel/assets/p-loading-spinner.svg +9 -0
  58. package/squirrel/components/p-btn/p-btn.vue +12 -21
  59. package/squirrel/components/p-loading/p-loading.vue +4 -3
  60. package/squirrel/components/p-ring-loader/p-ring-loader.spec.js +15 -34
  61. package/squirrel/components/p-ring-loader/p-ring-loader.stories.js +0 -6
  62. package/squirrel/components/p-ring-loader/p-ring-loader.vue +13 -56
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "6.0.9",
5
- "packageManager": "pnpm@9.15.4",
4
+ "version": "6.0.11",
5
+ "packageManager": "pnpm@9.15.5",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "preinstall": "npx only-allow pnpm",
@@ -47,58 +47,58 @@
47
47
  "vue-toastification": "^2.0.0-rc.5"
48
48
  },
49
49
  "devDependencies": {
50
- "@commitlint/cli": "^19.6.1",
51
- "@commitlint/config-conventional": "^19.6.0",
52
- "@pequity/eslint-config": "^1.0.4",
53
- "@playwright/test": "^1.49.1",
50
+ "@commitlint/cli": "^19.7.1",
51
+ "@commitlint/config-conventional": "^19.7.1",
52
+ "@pequity/eslint-config": "^1.1.1",
53
+ "@playwright/test": "^1.50.1",
54
54
  "@semantic-release/changelog": "^6.0.3",
55
55
  "@semantic-release/git": "^10.0.1",
56
- "@storybook/addon-a11y": "^8.5.0",
57
- "@storybook/addon-actions": "^8.5.0",
58
- "@storybook/addon-essentials": "^8.5.0",
59
- "@storybook/addon-interactions": "^8.5.0",
60
- "@storybook/addon-links": "^8.5.0",
61
- "@storybook/blocks": "^8.5.0",
62
- "@storybook/manager-api": "^8.5.0",
63
- "@storybook/test": "^8.5.0",
56
+ "@storybook/addon-a11y": "^8.5.4",
57
+ "@storybook/addon-actions": "^8.5.4",
58
+ "@storybook/addon-essentials": "^8.5.4",
59
+ "@storybook/addon-interactions": "^8.5.4",
60
+ "@storybook/addon-links": "^8.5.4",
61
+ "@storybook/blocks": "^8.5.4",
62
+ "@storybook/manager-api": "^8.5.4",
63
+ "@storybook/test": "^8.5.4",
64
64
  "@storybook/test-runner": "^0.21.0",
65
- "@storybook/theming": "^8.5.0",
66
- "@storybook/vue3": "^8.5.0",
67
- "@storybook/vue3-vite": "^8.5.0",
68
- "@tanstack/vue-virtual": "3.11.2",
65
+ "@storybook/theming": "^8.5.4",
66
+ "@storybook/vue3": "^8.5.4",
67
+ "@storybook/vue3-vite": "^8.5.4",
68
+ "@tanstack/vue-virtual": "3.13.0",
69
69
  "@types/jsdom": "^21.1.7",
70
70
  "@types/lodash-es": "^4.17.12",
71
- "@types/node": "^22.10.7",
71
+ "@types/node": "^22.13.1",
72
72
  "@vitejs/plugin-vue": "^5.2.1",
73
- "@vitest/coverage-v8": "^3.0.3",
73
+ "@vitest/coverage-v8": "^3.0.5",
74
74
  "@vue/compiler-sfc": "3.5.13",
75
75
  "@vue/test-utils": "^2.4.6",
76
76
  "@vuepic/vue-datepicker": "11.0.1",
77
77
  "autoprefixer": "^10.4.20",
78
78
  "dayjs": "1.11.13",
79
- "eslint": "^9.18.0",
79
+ "eslint": "^9.20.1",
80
80
  "eslint-plugin-storybook": "^0.11.2",
81
81
  "floating-vue": "5.2.2",
82
82
  "glob": "^11.0.1",
83
83
  "husky": "^9.1.7",
84
84
  "iconify-icon": "^2.3.0",
85
85
  "jsdom": "^26.0.0",
86
- "lint-staged": "^15.4.1",
86
+ "lint-staged": "^15.4.3",
87
87
  "lodash-es": "4.17.21",
88
88
  "make-coverage-badge": "^1.2.0",
89
- "postcss": "^8.5.1",
89
+ "postcss": "^8.5.2",
90
90
  "prettier": "^3.4.2",
91
- "prettier-plugin-tailwindcss": "^0.6.10",
91
+ "prettier-plugin-tailwindcss": "^0.6.11",
92
92
  "resolve-tspaths": "^0.8.23",
93
93
  "rimraf": "^6.0.1",
94
- "sass": "^1.83.4",
95
- "semantic-release": "^24.2.1",
96
- "storybook": "^8.5.0",
94
+ "sass": "^1.84.0",
95
+ "semantic-release": "^24.2.2",
96
+ "storybook": "^8.5.4",
97
97
  "svgo": "^3.3.2",
98
98
  "tailwindcss": "^3.4.17",
99
99
  "typescript": "5.7.3",
100
- "vite": "^6.0.11",
101
- "vitest": "^3.0.3",
100
+ "vite": "^6.1.0",
101
+ "vitest": "^3.0.5",
102
102
  "vue": "3.5.13",
103
103
  "vue-currency-input": "3.2.1",
104
104
  "vue-router": "4.5.0",
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24">
2
+ <path fill="currentColor" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
3
+ opacity="0.25" />
4
+ <path fill="currentColor"
5
+ d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z">
6
+ <animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate"
7
+ values="0 12 12;360 12 12" />
8
+ </path>
9
+ </svg>
@@ -24,10 +24,9 @@
24
24
  <div :class="{ invisible: loading }"><slot></slot></div>
25
25
  <PRingLoader
26
26
  v-if="loading"
27
- :style="loaderStyle"
28
27
  :color="loaderColor"
29
28
  :size="loaderSize"
30
- class="left-0 right-0 top-0 ml-auto mr-auto pt-1"
29
+ class="absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center"
31
30
  />
32
31
  </Component>
33
32
  </template>
@@ -37,7 +36,6 @@ import { type Size } from '@squirrel/components/p-btn/p-btn.types';
37
36
  import PRingLoader from '@squirrel/components/p-ring-loader/p-ring-loader.vue';
38
37
  import { isExternalLink } from '@squirrel/utils/link';
39
38
  import { sanitizeUrl } from '@squirrel/utils/sanitization';
40
- import { type Color, getColorDeep } from '@squirrel/utils/tailwind';
41
39
  import { defineComponent, type PropType } from 'vue';
42
40
  import { type RouteLocationRaw, RouterLink } from 'vue-router';
43
41
 
@@ -94,16 +92,16 @@ const LOADER_SIZES = {
94
92
  } as const satisfies { [key in Size]: number };
95
93
 
96
94
  const LOADER_COLORS = {
97
- [BUTTON_TYPES.PRIMARY]: 'p-blue-15',
98
- [BUTTON_TYPES.SECONDARY]: 'p-purple-60',
99
- [BUTTON_TYPES.PRIMARY_OUTLINE]: 'p-blue-60',
100
- [BUTTON_TYPES.SECONDARY_OUTLINE]: 'p-purple-60',
101
- [BUTTON_TYPES.SECONDARY_OUTLINE_BLUE]: 'p-purple-60',
102
- [BUTTON_TYPES.ERROR]: 'p-blue-15',
103
- [BUTTON_TYPES.SUCCESS]: 'p-blue-15',
104
- [BUTTON_TYPES.PRIMARY_LINK]: 'p-blue-60',
105
- [BUTTON_TYPES.SECONDARY_GHOST]: 'p-purple-60',
106
- [BUTTON_TYPES.SECONDARY_GHOST_DARK]: 'p-blue-15',
95
+ [BUTTON_TYPES.PRIMARY]: 'var(--color-p-blue-15)',
96
+ [BUTTON_TYPES.SECONDARY]: 'var(--color-p-purple-60)',
97
+ [BUTTON_TYPES.PRIMARY_OUTLINE]: 'var(--color-p-blue-60)',
98
+ [BUTTON_TYPES.SECONDARY_OUTLINE]: 'var(--color-p-purple-60)',
99
+ [BUTTON_TYPES.SECONDARY_OUTLINE_BLUE]: 'var(--color-p-purple-60)',
100
+ [BUTTON_TYPES.ERROR]: 'var(--color-p-blue-15)',
101
+ [BUTTON_TYPES.SUCCESS]: 'var(--color-p-blue-15)',
102
+ [BUTTON_TYPES.PRIMARY_LINK]: 'var(--color-p-blue-60)',
103
+ [BUTTON_TYPES.SECONDARY_GHOST]: 'var(--color-p-purple-60)',
104
+ [BUTTON_TYPES.SECONDARY_GHOST_DARK]: 'var(--color-p-blue-15)',
107
105
  } as const;
108
106
 
109
107
  export default defineComponent({
@@ -167,11 +165,6 @@ export default defineComponent({
167
165
  default: '',
168
166
  },
169
167
  },
170
- data() {
171
- return {
172
- loaderStyle: { position: 'absolute' },
173
- };
174
- },
175
168
  computed: {
176
169
  classes() {
177
170
  return `${DEFAULT_CLASSES} ${BUTTON_SIZES[this.size]} ${BUTTON_CLASSES[this.type]}`;
@@ -180,9 +173,7 @@ export default defineComponent({
180
173
  return Number(`${LOADER_SIZES[this.size]}`);
181
174
  },
182
175
  loaderColor() {
183
- const type = LOADER_COLORS[this.type] as Color;
184
-
185
- return getColorDeep(type);
176
+ return LOADER_COLORS[this.type];
186
177
  },
187
178
  },
188
179
  methods: {
@@ -13,7 +13,7 @@
13
13
  >
14
14
  <Transition enter-from-class="opacity-0" enter-active-class="transition duration-500">
15
15
  <Component :is="content" v-if="isComponent(content)" v-bind="componentProps" />
16
- <div v-else :class="textDivClass">{{ content }}</div>
16
+ <div v-else :class="textDivClass"><PLoadingSpinner class="pt-0.5" /> {{ content }}</div>
17
17
  </Transition>
18
18
  </div>
19
19
  </div>
@@ -21,18 +21,19 @@
21
21
  <div v-if="content" class="invisible fixed">
22
22
  <div ref="dimsReference">
23
23
  <Component :is="content" v-if="isComponent(content)" v-bind="componentProps" />
24
- <div v-else :class="textDivClass">{{ content }}</div>
24
+ <div v-else :class="textDivClass"><PLoadingSpinner class="pt-0.5" /> {{ content }}</div>
25
25
  </div>
26
26
  </div>
27
27
  </Teleport>
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
+ import PLoadingSpinner from '@squirrel/assets//p-loading-spinner.svg?inline';
31
32
  import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
32
33
  import { isComponent } from '@squirrel/utils/component';
33
34
  import { onBeforeUnmount, ref, toValue, watch } from 'vue';
34
35
 
35
- const textDivClass = `overflow-hidden whitespace-nowrap px-4 pt-1 h-8 text-center text-sm font-semibold text-p-purple-60`;
36
+ const textDivClass = `flex h-8 justify-center gap-x-1.5 overflow-hidden whitespace-nowrap px-6 pt-1 text-sm font-semibold text-p-purple-60`;
36
37
 
37
38
  defineOptions({
38
39
  name: 'PLoading',
@@ -1,4 +1,5 @@
1
1
  import PRingLoader from '@squirrel/components/p-ring-loader/p-ring-loader.vue';
2
+ import { expect } from '@storybook/test';
2
3
  import { createWrapperFor } from '@tests/vitest.helpers';
3
4
 
4
5
  describe('PRingLoader.vue', () => {
@@ -9,35 +10,20 @@ describe('PRingLoader.vue', () => {
9
10
  color: '#ccc',
10
11
  duration: '1s',
11
12
  },
13
+ global: { stubs: { PIcon: true } },
12
14
  });
13
15
 
14
- const loader = await wrapper.find('.relative.inline-block');
15
-
16
- const innerDivs = await loader.findAll('div');
17
-
18
- innerDivs.forEach((innerDiv, i) => {
19
- expect(innerDiv.attributes().style).toContain(
20
- 'border-width: 7px; border-color: #ccc transparent transparent transparent; animation-duration: 1s; animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1);'
21
- );
22
- if (i === 0) {
23
- expect(innerDiv.attributes().style).toContain('animation-delay: -0.375s;');
24
- }
25
- if (i === 1) {
26
- expect(innerDiv.attributes().style).toContain('animation-delay: -0.25s;');
27
- }
28
- if (i === 2) {
29
- expect(innerDiv.attributes().style).toContain('animation-delay: -0.125s;');
30
- }
31
- if (i === 3) {
32
- expect(innerDiv.attributes().style).not.toContain('animation-delay');
33
- }
34
- expect(innerDiv.attributes().class).toBe(
35
- 'block animate-spin absolute box-border rounded-full w-4/5 h-4/5 m-[10%]'
36
- );
37
- });
16
+ const loader = wrapper.findComponent({ name: 'PIcon' });
38
17
 
39
18
  expect(loader.exists()).toBe(true);
40
- expect(innerDivs.length).toBe(4);
19
+ expect(loader.props()).toEqual({ icon: 'svg-spinners:90-ring-with-bg' });
20
+ expect(loader.attributes()).toEqual({
21
+ duration: '1s',
22
+ icon: 'svg-spinners:90-ring-with-bg',
23
+ style: 'color: rgb(204, 204, 204);',
24
+ width: '62.44',
25
+ class: 'text-p-blue-60',
26
+ });
41
27
  });
42
28
 
43
29
  it('changes the color dynamically', async () => {
@@ -45,20 +31,15 @@ describe('PRingLoader.vue', () => {
45
31
  props: {
46
32
  color: '#ccc',
47
33
  },
34
+ global: { stubs: { PIcon: true } },
48
35
  });
49
36
 
50
- const loader = await wrapper.find('.relative.inline-block');
37
+ const loader = wrapper.findComponent({ name: 'PIcon' });
51
38
 
52
- const innerDivs = await loader.findAll('div');
53
-
54
- innerDivs.forEach((innerDiv, i) => {
55
- expect(innerDiv.element.style['border-color']).toBe('#ccc transparent transparent transparent');
56
- });
39
+ expect(loader.attributes().style).toBe('color: rgb(204, 204, 204);');
57
40
 
58
41
  await wrapper.setProps({ color: '#ddd' });
59
42
 
60
- innerDivs.forEach((innerDiv, i) => {
61
- expect(innerDiv.element.style['border-color']).toBe('#ddd transparent transparent transparent');
62
- });
43
+ expect(loader.attributes().style).toBe('color: rgb(221, 221, 221);');
63
44
  });
64
45
  });
@@ -13,12 +13,7 @@ export default {
13
13
  control: { type: 'color' },
14
14
  description: 'color of the loader',
15
15
  },
16
- duration: {
17
- control: { type: 'text' },
18
- description: 'duration of the animation in seconds e.g. 1.2s, 2s',
19
- },
20
16
  },
21
-
22
17
  parameters: {
23
18
  docs: {
24
19
  description: {
@@ -39,6 +34,5 @@ export const Default = {
39
34
  args: {
40
35
  size: 100,
41
36
  color: '#333393',
42
- duration: '1.8s',
43
37
  },
44
38
  };
@@ -1,71 +1,28 @@
1
1
  <template>
2
- <div class="relative inline-block" :style="{ width: `${size}px`, height: `${size}px` }">
3
- <div :class="INNER_DIV_CLASS" :style="[spinnerStyle, animDiv1]"></div>
4
- <div :class="INNER_DIV_CLASS" :style="[spinnerStyle, animDiv2]"></div>
5
- <div :class="INNER_DIV_CLASS" :style="[spinnerStyle, animDiv3]"></div>
6
- <div :class="INNER_DIV_CLASS" :style="[spinnerStyle]"></div>
7
- </div>
2
+ <PIcon icon="svg-spinners:90-ring-with-bg" :width="spinnerSize" class="text-p-blue-60" :style="style" />
8
3
  </template>
9
4
 
10
5
  <script setup lang="ts">
11
- import { type Color, getColor } from '@squirrel/utils/tailwind';
6
+ import PIcon from '@squirrel/components/p-icon/p-icon.vue';
12
7
  import { computed } from 'vue';
13
8
 
14
- const calcPropertyValue = (propName: string, originalValue: string, modificator: number) => {
15
- const computedStyle: Record<string, string> = {};
16
- const timeQuantityOuter = originalValue.match(/^\d*\.?\d+/)?.[0];
17
- const timeUnit = originalValue.match(/s|(ms)$/)?.[0] || 's';
18
- const timeQuantityInner = Math.round(Number(timeQuantityOuter) * 1000 * modificator) / 1000;
19
-
20
- computedStyle[propName] = timeQuantityInner + timeUnit;
21
-
22
- return computedStyle;
23
- };
24
-
25
- const INNER_DIV_CLASS = 'block animate-spin absolute box-border rounded-full w-4/5 h-4/5 m-[10%]';
26
-
27
9
  defineOptions({
28
10
  name: 'PRingLoader',
29
11
  });
30
12
 
31
- const props = defineProps({
32
- size: {
33
- type: Number,
34
- default: 80,
35
- },
36
- color: {
37
- type: String,
38
- default: getColor('primary' as Color),
39
- },
40
- duration: {
41
- type: String,
42
- default: '1.2s',
43
- validator(value: string) {
44
- const res = /^\d*\.?\d+(s|ms)$/;
45
-
46
- return res.test(value);
47
- },
48
- },
49
- });
50
-
51
- const spinnerStyle = computed(() => {
52
- return {
53
- borderWidth: `${props.size * 0.1}px`,
54
- borderColor: `${props.color} transparent transparent transparent`,
55
- animationDuration: props.duration,
56
- animationTimingFunction: 'cubic-bezier(0.5, 0, 0.5, 1)',
57
- };
58
- });
13
+ type Props = {
14
+ size?: number;
15
+ color?: string;
16
+ };
59
17
 
60
- const animDiv1 = computed(() => {
61
- return calcPropertyValue('animationDelay', props.duration, -0.375);
18
+ const props = withDefaults(defineProps<Props>(), {
19
+ size: 80,
20
+ color: '',
62
21
  });
63
22
 
64
- const animDiv2 = computed(() => {
65
- return calcPropertyValue('animationDelay', props.duration, -0.25);
66
- });
23
+ const spinnerSize = computed(() => props.size * 0.892);
67
24
 
68
- const animDiv3 = computed(() => {
69
- return calcPropertyValue('animationDelay', props.duration, -0.125);
70
- });
25
+ const style = computed(() => ({
26
+ color: props.color,
27
+ }));
71
28
  </script>