@pequity/squirrel 5.4.0 → 5.4.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.
Files changed (94) hide show
  1. package/dist/cjs/chunks/p-action-bar.js +10 -11
  2. package/dist/cjs/chunks/p-date-picker.js +108 -0
  3. package/dist/cjs/chunks/p-dropdown-select.js +7 -8
  4. package/dist/cjs/chunks/p-inline-date-picker.js +112 -0
  5. package/dist/cjs/chunks/p-input-percent.js +3 -5
  6. package/dist/cjs/chunks/p-pagination-info.js +1 -1
  7. package/dist/cjs/chunks/p-pagination.js +12 -16
  8. package/dist/cjs/config.js +54 -54
  9. package/dist/cjs/index.js +47 -52
  10. package/dist/cjs/p-btn.js +8 -5
  11. package/dist/cjs/p-chips.js +3 -5
  12. package/dist/cjs/p-date-picker.js +2 -138
  13. package/dist/cjs/p-drawer.js +3 -3
  14. package/dist/cjs/p-info-icon.js +1 -3
  15. package/dist/cjs/p-inline-date-picker.js +2 -143
  16. package/dist/cjs/p-modal.js +3 -3
  17. package/dist/cjs/p-table-td.js +3 -5
  18. package/dist/es/chunks/p-action-bar.js +10 -11
  19. package/dist/es/chunks/p-date-picker.js +109 -0
  20. package/dist/es/chunks/p-dropdown-select.js +7 -8
  21. package/dist/es/chunks/p-inline-date-picker.js +113 -0
  22. package/dist/es/chunks/p-input-percent.js +3 -5
  23. package/dist/es/chunks/p-pagination-info.js +1 -1
  24. package/dist/es/chunks/p-pagination.js +12 -16
  25. package/dist/es/config.js +54 -54
  26. package/dist/es/index.js +96 -101
  27. package/dist/es/p-btn.js +8 -5
  28. package/dist/es/p-chips.js +4 -6
  29. package/dist/es/p-date-picker.js +2 -138
  30. package/dist/es/p-drawer.js +3 -3
  31. package/dist/es/p-info-icon.js +2 -4
  32. package/dist/es/p-inline-date-picker.js +2 -143
  33. package/dist/es/p-modal.js +3 -3
  34. package/dist/es/p-table-td.js +4 -6
  35. package/dist/squirrel/components/p-action-bar/p-action-bar.vue.d.ts +5 -14
  36. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +4 -4
  37. package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +5 -5
  38. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +40 -5
  39. package/dist/squirrel/components/p-card/p-card.vue.d.ts +4 -4
  40. package/dist/squirrel/components/p-checkbox/p-checkbox.vue.d.ts +5 -5
  41. package/dist/squirrel/components/p-chips/p-chips.vue.d.ts +5 -5
  42. package/dist/squirrel/components/p-close-btn/p-close-btn.vue.d.ts +4 -4
  43. package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +35 -128
  44. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +37 -5
  45. package/dist/squirrel/components/p-dropdown/p-dropdown.vue.d.ts +5 -5
  46. package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +128 -29
  47. package/dist/squirrel/components/p-file-upload/p-file-upload.vue.d.ts +5 -5
  48. package/dist/squirrel/components/p-icon/p-icon.vue.d.ts +1 -10
  49. package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +2 -23
  50. package/dist/squirrel/components/p-input/p-input.vue.d.ts +9 -9
  51. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +40 -10
  52. package/dist/squirrel/components/p-input-percent/p-input-percent.vue.d.ts +5 -5
  53. package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +121 -5
  54. package/dist/squirrel/components/p-link/p-link.vue.d.ts +1 -10
  55. package/dist/squirrel/components/p-loading/p-loading.vue.d.ts +1 -1
  56. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +5 -5
  57. package/dist/squirrel/components/p-pagination/p-pagination.vue.d.ts +5 -5
  58. package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +4 -4
  59. package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +3 -3
  60. package/dist/squirrel/components/p-ring-loader/p-ring-loader.vue.d.ts +4 -4
  61. package/dist/squirrel/components/p-select/p-select.vue.d.ts +5 -5
  62. package/dist/squirrel/components/p-select-btn/p-select-btn.vue.d.ts +4 -45
  63. package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +128 -29
  64. package/dist/squirrel/components/p-select-list/useSelectList.d.ts +4 -4
  65. package/dist/squirrel/components/p-select-pill/p-select-pill.vue.d.ts +5 -5
  66. package/dist/squirrel/components/p-skeleton-loader/p-skeleton-loader.vue.d.ts +4 -4
  67. package/dist/squirrel/components/p-table/p-table.vue.d.ts +10 -47
  68. package/dist/squirrel/components/p-table/usePTableColResize.d.ts +4 -4
  69. package/dist/squirrel/components/p-table/usePTableRowVirtualizer.d.ts +10 -4
  70. package/dist/squirrel/components/p-table-header-cell/p-table-filter-icon.vue.d.ts +4 -4
  71. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +48 -5
  72. package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +4 -4
  73. package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +5 -5
  74. package/dist/squirrel/components/p-table-td/p-table-td.vue.d.ts +2 -25
  75. package/dist/squirrel/components/p-tabs/p-tabs.vue.d.ts +5 -5
  76. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +9 -9
  77. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +9 -9
  78. package/dist/squirrel/composables/useInputClasses.d.ts +1 -1
  79. package/dist/squirrel/tailwind/config.d.ts +54 -54
  80. package/dist/squirrel/utils/inputClassesMixin.d.ts +4 -4
  81. package/dist/style.css +92 -92
  82. package/dist/tailwind/config.js +54 -54
  83. package/package.json +25 -25
  84. package/squirrel/assets/squirrel.css +41 -41
  85. package/squirrel/components/p-alert/p-alert.spec.js +1 -1
  86. package/squirrel/components/p-btn/p-btn.spec.js +33 -4
  87. package/squirrel/components/p-btn/p-btn.vue +5 -2
  88. package/squirrel/components/p-date-picker/p-date-picker.vue +79 -86
  89. package/squirrel/components/p-drawer/p-drawer.vue +1 -1
  90. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +12 -14
  91. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +87 -99
  92. package/squirrel/components/p-modal/p-modal.vue +1 -1
  93. package/squirrel/tailwind/config.ts +54 -54
  94. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +0 -154
@@ -8,71 +8,71 @@ exports.config = {
8
8
  transparent: 'transparent',
9
9
  current: 'currentColor',
10
10
  /* Design system colors */
11
- white: '#fff',
12
- black: '#000',
13
- night: 'var(--color-night)',
14
- 'barley-white': 'var(--color-barley-white)',
15
- 'horses-neck': 'var(--color-horses-neck)',
16
- 'active-blue': 'var(--color-active-blue)',
11
+ white: 'rgb(var(--color-white))',
12
+ black: 'rgb(var(--color-black))',
13
+ night: 'rgb(var(--color-night))',
14
+ 'barley-white': 'rgb(var(--color-barley-white))',
15
+ 'horses-neck': 'rgb(var(--color-horses-neck))',
16
+ 'active-blue': 'rgb(var(--color-active-blue))',
17
17
  /* Pequity colors */
18
18
  'p-gray': {
19
- 10: 'var(--color-p-gray-10)',
20
- 20: 'var(--color-p-gray-20)',
21
- 30: 'var(--color-p-gray-30)',
22
- 40: 'var(--color-p-gray-40)',
23
- 50: 'var(--color-p-gray-50)',
24
- 60: 'var(--color-p-gray-60)',
25
- 70: 'var(--color-p-gray-70)',
26
- 80: 'var(--color-p-gray-80)',
27
- 90: 'var(--color-p-gray-90)',
28
- 100: 'var(--color-p-gray-100)',
19
+ 10: 'rgb(var(--color-p-gray-10))',
20
+ 20: 'rgb(var(--color-p-gray-20))',
21
+ 30: 'rgb(var(--color-p-gray-30))',
22
+ 40: 'rgb(var(--color-p-gray-40))',
23
+ 50: 'rgb(var(--color-p-gray-50))',
24
+ 60: 'rgb(var(--color-p-gray-60))',
25
+ 70: 'rgb(var(--color-p-gray-70))',
26
+ 80: 'rgb(var(--color-p-gray-80))',
27
+ 90: 'rgb(var(--color-p-gray-90))',
28
+ 100: 'rgb(var(--color-p-gray-100))',
29
29
  },
30
30
  'p-blue': {
31
- 10: 'var(--color-p-blue-10)',
32
- 15: 'var(--color-p-blue-15)',
33
- 20: 'var(--color-p-blue-20)',
34
- 30: 'var(--color-p-blue-30)',
35
- 40: 'var(--color-p-blue-40)',
36
- 50: 'var(--color-p-blue-50)',
37
- 60: 'var(--color-p-blue-60)',
38
- 70: 'var(--color-p-blue-70)',
39
- 80: 'var(--color-p-blue-80)',
31
+ 10: 'rgb(var(--color-p-blue-10))',
32
+ 15: 'rgb(var(--color-p-blue-15))',
33
+ 20: 'rgb(var(--color-p-blue-20))',
34
+ 30: 'rgb(var(--color-p-blue-30))',
35
+ 40: 'rgb(var(--color-p-blue-40))',
36
+ 50: 'rgb(var(--color-p-blue-50))',
37
+ 60: 'rgb(var(--color-p-blue-60))',
38
+ 70: 'rgb(var(--color-p-blue-70))',
39
+ 80: 'rgb(var(--color-p-blue-80))',
40
40
  },
41
41
  'p-purple': {
42
- 10: 'var(--color-p-purple-10)',
43
- 20: 'var(--color-p-purple-20)',
44
- 30: 'var(--color-p-purple-30)',
45
- 40: 'var(--color-p-purple-40)',
46
- 50: 'var(--color-p-purple-50)',
47
- 60: 'var(--color-p-purple-60)',
42
+ 10: 'rgb(var(--color-p-purple-10))',
43
+ 20: 'rgb(var(--color-p-purple-20))',
44
+ 30: 'rgb(var(--color-p-purple-30))',
45
+ 40: 'rgb(var(--color-p-purple-40))',
46
+ 50: 'rgb(var(--color-p-purple-50))',
47
+ 60: 'rgb(var(--color-p-purple-60))',
48
48
  },
49
49
  'p-green': {
50
- 10: 'var(--color-p-green-10)',
51
- 20: 'var(--color-p-green-20)',
52
- 30: 'var(--color-p-green-30)',
53
- 40: 'var(--color-p-green-40)',
54
- 50: 'var(--color-p-green-50)',
50
+ 10: 'rgb(var(--color-p-green-10))',
51
+ 20: 'rgb(var(--color-p-green-20))',
52
+ 30: 'rgb(var(--color-p-green-30))',
53
+ 40: 'rgb(var(--color-p-green-40))',
54
+ 50: 'rgb(var(--color-p-green-50))',
55
55
  },
56
56
  'p-red': {
57
- 10: 'var(--color-p-red-10)',
58
- 20: 'var(--color-p-red-20)',
59
- 30: 'var(--color-p-red-30)',
60
- 40: 'var(--color-p-red-40)',
61
- 50: 'var(--color-p-red-50)',
57
+ 10: 'rgb(var(--color-p-red-10))',
58
+ 20: 'rgb(var(--color-p-red-20))',
59
+ 30: 'rgb(var(--color-p-red-30))',
60
+ 40: 'rgb(var(--color-p-red-40))',
61
+ 50: 'rgb(var(--color-p-red-50))',
62
62
  },
63
63
  /* Aliases */
64
- primary: 'var(--color-primary)',
65
- accent: 'var(--color-accent)',
66
- surface: 'var(--color-surface)',
67
- 'on-surface': 'var(--color-on-surface)',
68
- error: 'var(--color-error)',
69
- 'on-error': 'var(--color-on-error)',
70
- info: 'var(--color-info)',
71
- 'on-info': 'var(--color-on-info)',
72
- success: 'var(--color-success)',
73
- 'on-success': 'var(--color-on-success)',
74
- warning: 'var(--color-warning)',
75
- 'on-warning': 'var(--color-on-warning)',
64
+ primary: 'rgb(var(--color-primary))',
65
+ accent: 'rgb(var(--color-accent))',
66
+ surface: 'rgb(var(--color-surface))',
67
+ 'on-surface': 'rgb(var(--color-on-surface))',
68
+ error: 'rgb(var(--color-error))',
69
+ 'on-error': 'rgb(var(--color-on-error))',
70
+ info: 'rgb(var(--color-info))',
71
+ 'on-info': 'rgb(var(--color-on-info))',
72
+ success: 'rgb(var(--color-success))',
73
+ 'on-success': 'rgb(var(--color-on-success))',
74
+ warning: 'rgb(var(--color-warning))',
75
+ 'on-warning': 'rgb(var(--color-on-warning))',
76
76
  },
77
77
  fontFamily: {
78
78
  sans: ['Inter', 'Helvetica', 'Arial', 'sans-serif'],
@@ -91,7 +91,7 @@ exports.config = {
91
91
  },
92
92
  extend: {
93
93
  borderColor: {
94
- DEFAULT: 'var(--color-p-gray-30)',
94
+ DEFAULT: 'rgb(var(--color-p-gray-30))',
95
95
  },
96
96
  spacing: {
97
97
  7.5: '1.875rem',
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "5.4.0",
5
- "packageManager": "pnpm@9.11.0",
4
+ "version": "5.4.2",
5
+ "packageManager": "pnpm@9.12.1",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "preinstall": "npx only-allow pnpm",
@@ -53,33 +53,33 @@
53
53
  "@commitlint/cli": "^19.5.0",
54
54
  "@commitlint/config-conventional": "^19.5.0",
55
55
  "@pequity/eslint-config": "^0.0.13",
56
- "@playwright/test": "^1.47.2",
56
+ "@playwright/test": "^1.48.0",
57
57
  "@popperjs/core": "2.11.8",
58
58
  "@semantic-release/changelog": "^6.0.3",
59
59
  "@semantic-release/git": "^10.0.1",
60
- "@storybook/addon-a11y": "^8.3.3",
61
- "@storybook/addon-actions": "^8.3.3",
62
- "@storybook/addon-essentials": "^8.3.3",
63
- "@storybook/addon-interactions": "^8.3.3",
64
- "@storybook/addon-links": "^8.3.3",
65
- "@storybook/blocks": "^8.3.3",
66
- "@storybook/manager-api": "^8.3.3",
67
- "@storybook/test": "^8.3.3",
60
+ "@storybook/addon-a11y": "^8.3.5",
61
+ "@storybook/addon-actions": "^8.3.5",
62
+ "@storybook/addon-essentials": "^8.3.5",
63
+ "@storybook/addon-interactions": "^8.3.5",
64
+ "@storybook/addon-links": "^8.3.5",
65
+ "@storybook/blocks": "^8.3.5",
66
+ "@storybook/manager-api": "^8.3.5",
67
+ "@storybook/test": "^8.3.5",
68
68
  "@storybook/test-runner": "^0.19.1",
69
- "@storybook/theming": "^8.3.3",
70
- "@storybook/vue3": "^8.3.3",
71
- "@storybook/vue3-vite": "^8.3.3",
69
+ "@storybook/theming": "^8.3.5",
70
+ "@storybook/vue3": "^8.3.5",
71
+ "@storybook/vue3-vite": "^8.3.5",
72
72
  "@tanstack/vue-virtual": "3.10.8",
73
73
  "@types/jsdom": "^21.1.7",
74
74
  "@types/lodash-es": "^4.17.12",
75
- "@types/node": "^22.7.3",
75
+ "@types/node": "^22.7.5",
76
76
  "@vitejs/plugin-vue": "^5.1.4",
77
- "@vitest/coverage-v8": "^2.1.1",
78
- "@vue/compiler-sfc": "3.4.38",
77
+ "@vitest/coverage-v8": "^2.1.3",
78
+ "@vue/compiler-sfc": "3.5.12",
79
79
  "@vue/test-utils": "^2.4.6",
80
80
  "autoprefixer": "^10.4.20",
81
81
  "dayjs": "1.11.13",
82
- "eslint": "^8.57.0",
82
+ "eslint": "^8.57.1",
83
83
  "eslint-plugin-storybook": "^0.9.0",
84
84
  "floating-vue": "5.2.2",
85
85
  "glob": "^11.0.0",
@@ -94,16 +94,16 @@
94
94
  "prettier-plugin-tailwindcss": "^0.6.8",
95
95
  "resolve-tspaths": "^0.8.22",
96
96
  "rimraf": "^6.0.1",
97
- "sass": "^1.79.3",
98
- "semantic-release": "^24.1.1",
99
- "storybook": "^8.3.3",
97
+ "sass": "^1.79.5",
98
+ "semantic-release": "^24.1.2",
99
+ "storybook": "^8.3.5",
100
100
  "svgo": "^3.3.2",
101
101
  "tailwindcss": "^3.4.13",
102
- "typescript": "5.6.2",
102
+ "typescript": "5.6.3",
103
103
  "v-calendar": "3.1.2",
104
- "vite": "^5.4.8",
105
- "vitest": "^2.1.1",
106
- "vue": "3.4.38",
104
+ "vite": "^5.4.9",
105
+ "vitest": "^2.1.3",
106
+ "vue": "3.5.12",
107
107
  "vue-currency-input": "3.1.0",
108
108
  "vue-router": "4.4.5",
109
109
  "vue-toastification": "2.0.0-rc.5",
@@ -4,48 +4,48 @@
4
4
 
5
5
  :root {
6
6
  /* Design system colors */
7
- --color-white: #fff;
8
- --color-black: #000;
9
- --color-night: #1a123b;
10
- --color-barley-white: #fff5ce;
11
- --color-horses-neck: #634816;
12
- --color-active-blue: #0f45af;
7
+ --color-white: 255 255 255;
8
+ --color-black: 0 0 0;
9
+ --color-night: 26 18 59;
10
+ --color-barley-white: 255 245 206;
11
+ --color-horses-neck: 99 72 22;
12
+ --color-active-blue: 15 69 175;
13
13
  /* Pequity Colors */
14
- --color-p-gray-10: #f5f5fa;
15
- --color-p-gray-20: #e4e3e7;
16
- --color-p-gray-30: #d6d4dc;
17
- --color-p-gray-40: #918da1;
18
- --color-p-gray-50: #767189;
19
- --color-p-gray-60: #5e5a6e;
20
- --color-p-gray-70: #474452;
21
- --color-p-gray-80: #2f2d37;
22
- --color-p-gray-90: #232229;
23
- --color-p-gray-100: #0c0b0e;
24
- --color-p-blue-10: #f5f5fa;
25
- --color-p-blue-15: #e4edfa;
26
- --color-p-blue-20: #e4e4f0;
27
- --color-p-blue-30: #9999c9;
28
- --color-p-blue-40: #6666ae;
29
- --color-p-blue-50: #333393;
30
- --color-p-blue-60: #000078;
31
- --color-p-blue-70: #000060;
32
- --color-p-blue-80: #000048;
33
- --color-p-purple-10: #cdc5ed;
34
- --color-p-purple-20: #a9a1c9;
35
- --color-p-purple-30: #978fb8;
36
- --color-p-purple-40: #857da6;
37
- --color-p-purple-50: #625a82;
38
- --color-p-purple-60: #1a123b;
39
- --color-p-green-10: #e9f8f2;
40
- --color-p-green-20: #bee9d7;
41
- --color-p-green-30: #7dd2ae;
42
- --color-p-green-40: #27b478;
43
- --color-p-green-50: #176c48;
44
- --color-p-red-10: #fef3f3;
45
- --color-p-red-20: #f8b8b4;
46
- --color-p-red-30: #f48882;
47
- --color-p-red-40: #f45148;
48
- --color-p-red-50: #f0453c;
14
+ --color-p-gray-10: 245 245 250;
15
+ --color-p-gray-20: 228 227 231;
16
+ --color-p-gray-30: 214 212 220;
17
+ --color-p-gray-40: 145 141 161;
18
+ --color-p-gray-50: 118 113 137;
19
+ --color-p-gray-60: 94 90 110;
20
+ --color-p-gray-70: 71 68 82;
21
+ --color-p-gray-80: 47 45 55;
22
+ --color-p-gray-90: 35 34 41;
23
+ --color-p-gray-100: 12 11 14;
24
+ --color-p-blue-10: 245 245 250;
25
+ --color-p-blue-15: 228 237 250;
26
+ --color-p-blue-20: 228 228 240;
27
+ --color-p-blue-30: 153 153 201;
28
+ --color-p-blue-40: 102 102 174;
29
+ --color-p-blue-50: 51 51 147;
30
+ --color-p-blue-60: 0 0 120;
31
+ --color-p-blue-70: 0 0 96;
32
+ --color-p-blue-80: 0 0 72;
33
+ --color-p-purple-10: 205 197 237;
34
+ --color-p-purple-20: 169 161 201;
35
+ --color-p-purple-30: 151 143 184;
36
+ --color-p-purple-40: 133 125 166;
37
+ --color-p-purple-50: 98 90 130;
38
+ --color-p-purple-60: 26 18 59;
39
+ --color-p-green-10: 233 248 242;
40
+ --color-p-green-20: 190 233 215;
41
+ --color-p-green-30: 125 210 174;
42
+ --color-p-green-40: 39 180 120;
43
+ --color-p-green-50: 23 108 72;
44
+ --color-p-red-10: 254 243 243;
45
+ --color-p-red-20: 248 184 180;
46
+ --color-p-red-30: 244 136 130;
47
+ --color-p-red-40: 244 81 72;
48
+ --color-p-red-50: 240 69 60;
49
49
  /* Aliases */
50
50
  --color-primary: var(--color-p-blue-60);
51
51
  --color-accent: var(--color-p-blue-70);
@@ -14,7 +14,7 @@ describe('PAlert.vue', () => {
14
14
  const path = wrapper.find('path');
15
15
 
16
16
  expect(classes.every((c) => alert.classes().includes(c))).toBe(true);
17
- expect(path.attributes().fill).toBe(`var(--color-on-${type})`);
17
+ expect(path.attributes().fill).toBe(`rgb(var(--color-on-${type}))`);
18
18
  });
19
19
 
20
20
  it('renders slots for icon and content', async () => {
@@ -14,6 +14,18 @@ const ELEMENTS_MAP = {
14
14
  section: { name: 'home', params: { id: 1 } },
15
15
  };
16
16
 
17
+ const DEFAULT_CLASSES_ARRAY = [
18
+ 'relative',
19
+ 'inline-block',
20
+ 'outline-none',
21
+ 'disabled:opacity-50',
22
+ 'disabled:cursor-default',
23
+ 'disabled:pointer-events-none',
24
+ 'aria-disabled:opacity-50',
25
+ 'aria-disabled:cursor-default',
26
+ 'aria-disabled:pointer-events-none',
27
+ ];
28
+
17
29
  describe('PBtn.vue', () => {
18
30
  Object.keys(ELEMENTS_MAP).forEach((el) => {
19
31
  const to = ELEMENTS_MAP[el];
@@ -66,6 +78,7 @@ describe('PBtn.vue', () => {
66
78
  const element = await wrapper.find(el);
67
79
 
68
80
  expect(classes.every((c) => element.classes().includes(c))).toBe(true);
81
+ expect(DEFAULT_CLASSES_ARRAY.every((c) => element.classes().includes(c))).toBe(true);
69
82
  });
70
83
  });
71
84
 
@@ -81,26 +94,42 @@ describe('PBtn.vue', () => {
81
94
  expect(button.text()).toContain(`This is a button`);
82
95
  });
83
96
 
84
- it('gets disabled when the disabled attr is set to true', async () => {
97
+ it.each([
98
+ ['button', undefined],
99
+ ['a', 'https://pequity.com/'],
100
+ ['a', { name: 'home', params: { id: 1 } }],
101
+ ])('gets disabled when the element is a %s and points to %s', async (el, to) => {
85
102
  const wrapper = createWrapperFor(PBtn, {
103
+ props: {
104
+ to,
105
+ },
86
106
  attrs: {
87
107
  disabled: true,
88
108
  },
109
+ global: {
110
+ stubs: { RouterLink: { template: '<a class="router-link-stub"><slot /></a>' } },
111
+ },
89
112
  });
90
113
 
91
- const button = await wrapper.find('button');
114
+ const button = await wrapper.find(el);
92
115
 
93
116
  await button.trigger('click');
94
117
 
95
- expect(wrapper.emitted().click).toBeFalsy();
118
+ if (el === 'button') {
119
+ expect(wrapper.emitted().click).toBeFalsy();
120
+ }
96
121
  expect(button.attributes()).toHaveProperty('disabled');
122
+ expect(button.attributes()['aria-disabled']).toBe('true');
97
123
 
98
124
  await wrapper.setProps({ disabled: false });
99
125
 
100
126
  await button.trigger('click');
101
127
 
102
- expect(wrapper.emitted().click[0][0] instanceof MouseEvent).toBe(true);
128
+ if (el === 'button') {
129
+ expect(wrapper.emitted().click[0][0] instanceof MouseEvent).toBe(true);
130
+ }
103
131
  expect(button.attributes()).not.toHaveProperty('disabled');
132
+ expect(button.attributes()['aria-disabled']).toBe('false');
104
133
  });
105
134
 
106
135
  it('has a loading state', async () => {
@@ -5,6 +5,8 @@
5
5
  :href="sanitizeUrl(to)"
6
6
  target="_blank"
7
7
  :class="classes"
8
+ :disabled="!!$attrs.disabled ? true : null"
9
+ :aria-disabled="!!$attrs.disabled"
8
10
  >
9
11
  <slot></slot>
10
12
  </a>
@@ -16,7 +18,8 @@
16
18
  :aria-selected="selected"
17
19
  :class="classes"
18
20
  v-bind="$attrs"
19
- :disabled="($attrs.disabled as boolean) || loading"
21
+ :disabled="!!$attrs.disabled || loading ? true : null"
22
+ :aria-disabled="$attrs.disabled"
20
23
  >
21
24
  <div :class="{ invisible: loading }"><slot></slot></div>
22
25
  <PRingLoader
@@ -57,7 +60,7 @@ type ButtonNativeType = (typeof BUTTON_NATIVE_TYPES)[number];
57
60
  type ButtonTypeKeys = keyof typeof BUTTON_TYPES;
58
61
  type ButtonType = (typeof BUTTON_TYPES)[ButtonTypeKeys];
59
62
 
60
- const DEFAULT_CLASSES = `relative inline-block outline-none disabled:opacity-50 disabled:cursor-default disabled:pointer-events-none`;
63
+ const DEFAULT_CLASSES = `relative inline-block outline-none disabled:opacity-50 disabled:cursor-default disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none`;
61
64
 
62
65
  type ButtonClass = {
63
66
  [key in ButtonType]: string;
@@ -15,10 +15,9 @@
15
15
  :timezone="timezone"
16
16
  >
17
17
  <template #default="{ inputValue, inputEvents }">
18
- <input
19
- :class="[inputClasses, { 'cursor-pointer': !attrs.disabled }]"
18
+ <PInput
20
19
  :value="inputValue"
21
- v-bind="attrs"
20
+ v-bind="attrsWithoutClassAndStyle"
22
21
  :placeholder="displayPlaceholder"
23
22
  v-on="inputEvents"
24
23
  />
@@ -28,12 +27,18 @@
28
27
  </div>
29
28
  </template>
30
29
 
31
- <script lang="ts">
30
+ <script setup lang="ts">
31
+ import PInput from '@squirrel/components/p-input/p-input.vue';
32
32
  import dayjs from 'dayjs';
33
- import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
34
33
  import { DatePicker } from 'v-calendar';
35
- import { type PropType, type StyleValue, defineComponent } from 'vue';
34
+ import { type StyleValue, computed, nextTick, ref, useAttrs, watch } from 'vue';
36
35
  import { isDate, isString } from 'lodash-es';
36
+ import { useInputClasses } from '@squirrel/composables/useInputClasses';
37
+
38
+ defineOptions({
39
+ name: 'PDatePicker',
40
+ inheritAttrs: false,
41
+ });
37
42
 
38
43
  // The type of the select attribute is defined in node_modules/v-calendar/dist/types/src/utils/attribute.d.ts
39
44
  // but there was no way to import it, so as a workaround we cast the selectAttribute as `any`.
@@ -47,87 +52,75 @@ const DEFAULT_MASKS = {
47
52
  data: 'YYYY-MM-DD',
48
53
  };
49
54
 
50
- export default defineComponent({
51
- name: 'PDatePicker',
52
- components: {
53
- DatePicker,
54
- },
55
- mixins: [inputClassesMixin],
56
- inheritAttrs: false,
57
- props: {
58
- modelValue: {
59
- type: String as PropType<string | null | undefined>,
60
- default: '',
61
- },
62
- label: {
63
- type: String,
64
- default: '',
65
- },
66
- errorMsg: {
67
- type: String,
68
- default: '',
69
- },
70
- required: {
71
- type: Boolean,
72
- default: false,
73
- },
74
- minDate: {
75
- type: Date,
76
- default: null,
77
- },
78
- maxDate: {
79
- type: Date,
80
- default: null,
81
- },
82
- timezone: {
83
- type: String,
84
- default: '',
85
- },
86
- },
87
- emits: ['update:modelValue'],
88
- data() {
89
- return {
90
- // innerValue is a Date object
91
- innerValue: null as Date | null,
92
- stopWatch: false,
93
- selectAttribute,
94
- };
95
- },
96
- computed: {
97
- displayPlaceholder(): string {
98
- return isString(this.$attrs.placeholder) ? this.$attrs.placeholder : this.masks.input;
99
- },
100
- masks() {
101
- return Object.assign(DEFAULT_MASKS, this.$attrs.masks);
102
- },
103
- attrs() {
104
- const { class: classes, style, ...rest } = this.$attrs;
55
+ type Props = {
56
+ modelValue?: string | null;
57
+ label?: string;
58
+ errorMsg?: string;
59
+ required?: boolean;
60
+ minDate?: Date | null;
61
+ maxDate?: Date | null;
62
+ timezone?: string;
63
+ };
105
64
 
106
- return rest;
107
- },
108
- style() {
109
- return this.$attrs.style as StyleValue;
110
- },
111
- },
112
- watch: {
113
- modelValue: {
114
- handler(nV) {
115
- if (!this.stopWatch) {
116
- this.innerValue = nV ? dayjs(nV, this.masks.data).toDate() : null;
117
- }
118
- },
119
- immediate: true,
120
- },
121
- innerValue(nV) {
122
- // We're emitting back a formatted String (value) or null in case we have an invalid date
123
- const toEmit = isDate(nV) && nV.toString() !== 'Invalid Date' ? dayjs(nV).format(this.masks.data) : null;
124
- // Stop watching when updating the value by clicking in the datepicker, in order to prevent double-emit.
125
- this.stopWatch = true;
126
- this.$emit('update:modelValue', toEmit);
127
- this.$nextTick(() => {
128
- this.stopWatch = false;
129
- });
130
- },
65
+ const props = withDefaults(defineProps<Props>(), {
66
+ modelValue: '',
67
+ label: '',
68
+ errorMsg: '',
69
+ required: false,
70
+ minDate: null,
71
+ maxDate: null,
72
+ timezone: '',
73
+ });
74
+
75
+ const emit = defineEmits<{
76
+ 'update:modelValue': [value: string | null];
77
+ }>();
78
+
79
+ // Data
80
+ const { labelClasses, errorMsgClasses } = useInputClasses(props);
81
+ const attrs = useAttrs();
82
+ // innerValue is a Date object
83
+ const innerValue = ref<Date | null>(null);
84
+ const stopWatch = ref(false);
85
+
86
+ // Computed
87
+ const masks = computed(() => {
88
+ return Object.assign(DEFAULT_MASKS, attrs.masks);
89
+ });
90
+
91
+ const displayPlaceholder = computed(() => {
92
+ return isString(attrs.placeholder) ? attrs.placeholder : masks.value.input;
93
+ });
94
+
95
+ const attrsWithoutClassAndStyle = computed(() => {
96
+ const { class: classes, style, ...rest } = attrs;
97
+
98
+ return rest;
99
+ });
100
+
101
+ const style = computed(() => {
102
+ return attrs.style as StyleValue;
103
+ });
104
+
105
+ // Watch
106
+ watch(
107
+ () => props.modelValue,
108
+ (nV) => {
109
+ if (!stopWatch.value) {
110
+ innerValue.value = nV ? dayjs(nV, masks.value.data).toDate() : null;
111
+ }
131
112
  },
113
+ { immediate: true }
114
+ );
115
+
116
+ watch(innerValue, (nV) => {
117
+ // We're emitting back a formatted String (value) or null in case we have an invalid date
118
+ const toEmit = isDate(nV) && nV.toString() !== 'Invalid Date' ? dayjs(nV).format(masks.value.data) : null;
119
+ // Stop watching when updating the value by clicking in the datepicker, in order to prevent double-emit.
120
+ stopWatch.value = true;
121
+ emit('update:modelValue', toEmit);
122
+ nextTick(() => {
123
+ stopWatch.value = false;
124
+ });
132
125
  });
133
126
  </script>
@@ -3,7 +3,7 @@
3
3
  <Transition name="pd-backdrop-transition" enter-active-class="fadeIn" leave-active-class="fadeOut">
4
4
  <div
5
5
  v-show="show && showBackdrop"
6
- :class="['fixed bottom-0 left-0 right-0 top-0 bg-black bg-opacity-20', { 'cursor-pointer': enableClose }]"
6
+ :class="['fixed bottom-0 left-0 right-0 top-0 bg-black/20', { 'cursor-pointer': enableClose }]"
7
7
  :style="{ 'z-index': zIndex - 1 }"
8
8
  tabindex="-1"
9
9
  @click="close"