@pequity/squirrel 6.1.0 → 7.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.
Files changed (98) hide show
  1. package/dist/cjs/chunks/p-alert.js +52 -0
  2. package/dist/cjs/chunks/p-avatar.js +65 -0
  3. package/dist/cjs/chunks/p-btn.js +4 -4
  4. package/dist/cjs/chunks/p-date-picker.js +2 -2
  5. package/dist/cjs/chunks/p-input-number.js +161 -0
  6. package/dist/cjs/chunks/p-input-percent.js +2 -2
  7. package/dist/cjs/chunks/p-input.js +111 -0
  8. package/dist/cjs/chunks/p-progress-bar.js +38 -0
  9. package/dist/cjs/chunks/p-select-btn.js +3 -4
  10. package/dist/cjs/chunks/p-textarea.js +89 -0
  11. package/dist/cjs/index.js +69 -76
  12. package/dist/cjs/inputClasses.js +8 -2
  13. package/dist/cjs/p-alert.js +2 -64
  14. package/dist/cjs/p-avatar.js +2 -70
  15. package/dist/cjs/p-drawer.js +2 -2
  16. package/dist/cjs/p-input-number.js +2 -145
  17. package/dist/cjs/p-input-search.js +2 -2
  18. package/dist/cjs/p-input.js +2 -92
  19. package/dist/cjs/p-modal.js +2 -2
  20. package/dist/cjs/p-progress-bar.js +2 -40
  21. package/dist/cjs/p-table-filter-icon.js +14 -9
  22. package/dist/cjs/p-textarea.js +2 -72
  23. package/dist/cjs/p-toggle.js +76 -64
  24. package/dist/cjs/useInputClasses.js +13 -18
  25. package/dist/es/chunks/p-alert.js +53 -0
  26. package/dist/es/chunks/p-avatar.js +66 -0
  27. package/dist/es/chunks/p-btn.js +4 -4
  28. package/dist/es/chunks/p-date-picker.js +2 -2
  29. package/dist/es/chunks/p-input-number.js +162 -0
  30. package/dist/es/chunks/p-input-percent.js +2 -2
  31. package/dist/es/chunks/p-input.js +112 -0
  32. package/dist/es/chunks/p-progress-bar.js +39 -0
  33. package/dist/es/chunks/p-select-btn.js +4 -5
  34. package/dist/es/chunks/p-textarea.js +90 -0
  35. package/dist/es/index.js +119 -126
  36. package/dist/es/inputClasses.js +8 -2
  37. package/dist/es/p-alert.js +2 -64
  38. package/dist/es/p-avatar.js +2 -70
  39. package/dist/es/p-drawer.js +2 -2
  40. package/dist/es/p-input-number.js +2 -145
  41. package/dist/es/p-input-search.js +2 -2
  42. package/dist/es/p-input.js +2 -92
  43. package/dist/es/p-modal.js +2 -2
  44. package/dist/es/p-progress-bar.js +2 -40
  45. package/dist/es/p-table-filter-icon.js +14 -9
  46. package/dist/es/p-textarea.js +2 -72
  47. package/dist/es/p-toggle.js +77 -65
  48. package/dist/es/useInputClasses.js +14 -19
  49. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +27 -10
  50. package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +9 -10
  51. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +28 -28
  52. package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +2 -2
  53. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +37 -13
  54. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +2 -2
  55. package/dist/squirrel/components/p-input/p-input.vue.d.ts +30 -61
  56. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +101 -65
  57. package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +113 -83
  58. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +2 -2
  59. package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +5 -20
  60. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +1 -1
  61. package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +1 -1
  62. package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +3 -7
  63. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +79 -42
  64. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +25 -62
  65. package/dist/squirrel/composables/useInputClasses.d.ts +2 -1
  66. package/dist/squirrel/utils/index.d.ts +1 -3
  67. package/dist/squirrel/utils/inputClasses.d.ts +12 -0
  68. package/dist/squirrel.css +5 -5
  69. package/package.json +19 -19
  70. package/squirrel/components/p-alert/p-alert.spec.js +9 -8
  71. package/squirrel/components/p-alert/p-alert.vue +19 -31
  72. package/squirrel/components/p-avatar/p-avatar.spec.ts +10 -3
  73. package/squirrel/components/p-avatar/p-avatar.vue +40 -42
  74. package/squirrel/components/p-btn/p-btn.spec.js +7 -7
  75. package/squirrel/components/p-btn/p-btn.vue +4 -4
  76. package/squirrel/components/p-input/p-input.vue +63 -40
  77. package/squirrel/components/p-input-number/p-input-number.vue +101 -86
  78. package/squirrel/components/p-progress-bar/p-progress-bar.vue +9 -14
  79. package/squirrel/components/p-select-btn/p-select-btn.spec.js +24 -5
  80. package/squirrel/components/p-select-btn/p-select-btn.vue +1 -1
  81. package/squirrel/components/p-table-header-cell/p-table-filter-icon.vue +8 -9
  82. package/squirrel/components/p-table-sort/p-table-sort.vue +13 -16
  83. package/squirrel/components/p-textarea/p-textarea.vue +55 -37
  84. package/squirrel/components/p-toggle/p-toggle.vue +59 -43
  85. package/squirrel/composables/useInputClasses.spec.js +50 -13
  86. package/squirrel/composables/useInputClasses.ts +18 -24
  87. package/squirrel/utils/index.ts +0 -7
  88. package/squirrel/utils/inputClasses.ts +8 -2
  89. package/dist/cjs/inputClassesMixin.js +0 -58
  90. package/dist/cjs/tailwind.js +0 -25
  91. package/dist/es/inputClassesMixin.js +0 -59
  92. package/dist/es/tailwind.js +0 -25
  93. package/dist/squirrel/utils/inputClassesMixin.d.ts +0 -56
  94. package/dist/squirrel/utils/tailwind.d.ts +0 -8
  95. package/squirrel/utils/inputClassesMixin.spec.js +0 -241
  96. package/squirrel/utils/inputClassesMixin.ts +0 -60
  97. package/squirrel/utils/tailwind.spec.js +0 -27
  98. package/squirrel/utils/tailwind.ts +0 -28
package/dist/squirrel.css CHANGED
@@ -436,16 +436,16 @@ to {
436
436
  100% {
437
437
  transform: translateX(100%);
438
438
  }
439
- }.filter[data-v-cbac2434] {
439
+ }.filter[data-v-84864117] {
440
440
  background: url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15.5%206.73H4.5C4.36739%206.73%204.24021%206.67732%204.14645%206.58355C4.05268%206.48978%204%206.3626%204%206.23C4%206.09739%204.05268%205.97021%204.14645%205.87644C4.24021%205.78267%204.36739%205.73%204.5%205.73H15.5C15.6326%205.73%2015.7598%205.78267%2015.8536%205.87644C15.9473%205.97021%2016%206.09739%2016%206.23C16%206.3626%2015.9473%206.48978%2015.8536%206.58355C15.7598%206.67732%2015.6326%206.73%2015.5%206.73Z'%20fill='%23424E6E'/%3e%3cpath%20d='M14.33%209.245H5.67C5.53739%209.245%205.41021%209.19232%205.31644%209.09855C5.22268%209.00478%205.17%208.8776%205.17%208.745C5.17%208.61239%205.22268%208.48521%205.31644%208.39144C5.41021%208.29767%205.53739%208.245%205.67%208.245H14.33C14.4626%208.245%2014.5898%208.29767%2014.6836%208.39144C14.7773%208.48521%2014.83%208.61239%2014.83%208.745C14.83%208.8776%2014.7773%209.00478%2014.6836%209.09855C14.5898%209.19232%2014.4626%209.245%2014.33%209.245Z'%20fill='%23424E6E'/%3e%3cpath%20d='M11.605%2014.27H8.395C8.2624%2014.27%208.13522%2014.2173%208.04145%2014.1235C7.94768%2014.0298%207.895%2013.9026%207.895%2013.77C7.895%2013.6374%207.94768%2013.5102%208.04145%2013.4164C8.13522%2013.3227%208.2624%2013.27%208.395%2013.27H11.605C11.7376%2013.27%2011.8648%2013.3227%2011.9586%2013.4164C12.0523%2013.5102%2012.105%2013.6374%2012.105%2013.77C12.105%2013.9026%2012.0523%2014.0298%2011.9586%2014.1235C11.8648%2014.2173%2011.7376%2014.27%2011.605%2014.27Z'%20fill='%23424E6E'/%3e%3cpath%20d='M13.155%2011.755H6.845C6.71239%2011.755%206.58522%2011.7023%206.49145%2011.6085C6.39768%2011.5148%206.345%2011.3876%206.345%2011.255C6.345%2011.1224%206.39768%2010.9952%206.49145%2010.9014C6.58522%2010.8077%206.71239%2010.755%206.845%2010.755H13.155C13.2876%2010.755%2013.4148%2010.8077%2013.5086%2010.9014C13.6023%2010.9952%2013.655%2011.1224%2013.655%2011.255C13.655%2011.3876%2013.6023%2011.5148%2013.5086%2011.6085C13.4148%2011.7023%2013.2876%2011.755%2013.155%2011.755Z'%20fill='%23424E6E'/%3e%3c/svg%3e") no-repeat;
441
441
  }
442
- .filter[data-v-cbac2434]:hover {
442
+ .filter[data-v-84864117]:hover {
443
443
  background: url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='4'%20fill='black'%20fill-opacity='0.05'/%3e%3cpath%20d='M15.5%206.73001H4.5C4.36739%206.73001%204.24021%206.67733%204.14645%206.58356C4.05268%206.4898%204%206.36262%204%206.23001C4%206.0974%204.05268%205.97023%204.14645%205.87646C4.24021%205.78269%204.36739%205.73001%204.5%205.73001H15.5C15.6326%205.73001%2015.7598%205.78269%2015.8536%205.87646C15.9473%205.97023%2016%206.0974%2016%206.23001C16%206.36262%2015.9473%206.4898%2015.8536%206.58356C15.7598%206.67733%2015.6326%206.73001%2015.5%206.73001Z'%20fill='%23424E6E'/%3e%3cpath%20d='M14.33%209.24503H5.67C5.53739%209.24503%205.41021%209.19235%205.31644%209.09858C5.22268%209.00481%205.17%208.87763%205.17%208.74503C5.17%208.61242%205.22268%208.48524%205.31644%208.39147C5.41021%208.2977%205.53739%208.24503%205.67%208.24503H14.33C14.4626%208.24503%2014.5898%208.2977%2014.6836%208.39147C14.7773%208.48524%2014.83%208.61242%2014.83%208.74503C14.83%208.87763%2014.7773%209.00481%2014.6836%209.09858C14.5898%209.19235%2014.4626%209.24503%2014.33%209.24503Z'%20fill='%23424E6E'/%3e%3cpath%20d='M11.605%2014.27H8.395C8.2624%2014.27%208.13522%2014.2173%208.04145%2014.1236C7.94768%2014.0298%207.895%2013.9026%207.895%2013.77C7.895%2013.6374%207.94768%2013.5102%208.04145%2013.4165C8.13522%2013.3227%208.2624%2013.27%208.395%2013.27H11.605C11.7376%2013.27%2011.8648%2013.3227%2011.9586%2013.4165C12.0523%2013.5102%2012.105%2013.6374%2012.105%2013.77C12.105%2013.9026%2012.0523%2014.0298%2011.9586%2014.1236C11.8648%2014.2173%2011.7376%2014.27%2011.605%2014.27Z'%20fill='%23424E6E'/%3e%3cpath%20d='M13.155%2011.755H6.845C6.71239%2011.755%206.58522%2011.7023%206.49145%2011.6086C6.39768%2011.5148%206.345%2011.3876%206.345%2011.255C6.345%2011.1224%206.39768%2010.9952%206.49145%2010.9015C6.58522%2010.8077%206.71239%2010.755%206.845%2010.755H13.155C13.2876%2010.755%2013.4148%2010.8077%2013.5086%2010.9015C13.6023%2010.9952%2013.655%2011.1224%2013.655%2011.255C13.655%2011.3876%2013.6023%2011.5148%2013.5086%2011.6086C13.4148%2011.7023%2013.2876%2011.755%2013.155%2011.755Z'%20fill='%23424E6E'/%3e%3c/svg%3e") no-repeat;
444
444
  }
445
- .filter.active[data-v-cbac2434] {
445
+ .filter.active[data-v-84864117] {
446
446
  background: url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15.5%206.72998H4.5C4.36739%206.72998%204.24021%206.6773%204.14645%206.58353C4.05268%206.48977%204%206.36259%204%206.22998C4%206.09737%204.05268%205.9702%204.14645%205.87643C4.24021%205.78266%204.36739%205.72998%204.5%205.72998H15.5C15.6326%205.72998%2015.7598%205.78266%2015.8536%205.87643C15.9473%205.9702%2016%206.09737%2016%206.22998C16%206.36259%2015.9473%206.48977%2015.8536%206.58353C15.7598%206.6773%2015.6326%206.72998%2015.5%206.72998Z'%20fill='%230F45AF'/%3e%3cpath%20d='M14.33%209.245H5.67C5.53739%209.245%205.41021%209.19232%205.31644%209.09855C5.22268%209.00478%205.17%208.8776%205.17%208.745C5.17%208.61239%205.22268%208.48521%205.31644%208.39144C5.41021%208.29767%205.53739%208.245%205.67%208.245H14.33C14.4626%208.245%2014.5898%208.29767%2014.6836%208.39144C14.7773%208.48521%2014.83%208.61239%2014.83%208.745C14.83%208.8776%2014.7773%209.00478%2014.6836%209.09855C14.5898%209.19232%2014.4626%209.245%2014.33%209.245Z'%20fill='%230F45AF'/%3e%3cpath%20d='M11.605%2014.27H8.395C8.2624%2014.27%208.13522%2014.2173%208.04145%2014.1235C7.94768%2014.0297%207.895%2013.9026%207.895%2013.77C7.895%2013.6374%207.94768%2013.5102%208.04145%2013.4164C8.13522%2013.3226%208.2624%2013.27%208.395%2013.27H11.605C11.7376%2013.27%2011.8648%2013.3226%2011.9586%2013.4164C12.0523%2013.5102%2012.105%2013.6374%2012.105%2013.77C12.105%2013.9026%2012.0523%2014.0297%2011.9586%2014.1235C11.8648%2014.2173%2011.7376%2014.27%2011.605%2014.27Z'%20fill='%230F45AF'/%3e%3cpath%20d='M13.155%2011.755H6.845C6.71239%2011.755%206.58522%2011.7023%206.49145%2011.6086C6.39768%2011.5148%206.345%2011.3876%206.345%2011.255C6.345%2011.1224%206.39768%2010.9952%206.49145%2010.9015C6.58522%2010.8077%206.71239%2010.755%206.845%2010.755H13.155C13.2876%2010.755%2013.4148%2010.8077%2013.5086%2010.9015C13.6023%2010.9952%2013.655%2011.1224%2013.655%2011.255C13.655%2011.3876%2013.6023%2011.5148%2013.5086%2011.6086C13.4148%2011.7023%2013.2876%2011.755%2013.155%2011.755Z'%20fill='%230F45AF'/%3e%3c/svg%3e") no-repeat;
447
447
  }
448
- .filter.active[data-v-cbac2434]:hover {
448
+ .filter.active[data-v-84864117]:hover {
449
449
  background: url("data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='4'%20fill='black'%20fill-opacity='0.05'/%3e%3cpath%20d='M15.5%206.72998H4.5C4.36739%206.72998%204.24021%206.6773%204.14645%206.58353C4.05268%206.48977%204%206.36259%204%206.22998C4%206.09737%204.05268%205.9702%204.14645%205.87643C4.24021%205.78266%204.36739%205.72998%204.5%205.72998H15.5C15.6326%205.72998%2015.7598%205.78266%2015.8536%205.87643C15.9473%205.9702%2016%206.09737%2016%206.22998C16%206.36259%2015.9473%206.48977%2015.8536%206.58353C15.7598%206.6773%2015.6326%206.72998%2015.5%206.72998Z'%20fill='%230F45AF'/%3e%3cpath%20d='M14.33%209.245H5.67C5.53739%209.245%205.41021%209.19232%205.31644%209.09855C5.22268%209.00478%205.17%208.8776%205.17%208.745C5.17%208.61239%205.22268%208.48521%205.31644%208.39144C5.41021%208.29767%205.53739%208.245%205.67%208.245H14.33C14.4626%208.245%2014.5898%208.29767%2014.6836%208.39144C14.7773%208.48521%2014.83%208.61239%2014.83%208.745C14.83%208.8776%2014.7773%209.00478%2014.6836%209.09855C14.5898%209.19232%2014.4626%209.245%2014.33%209.245Z'%20fill='%230F45AF'/%3e%3cpath%20d='M11.605%2014.27H8.395C8.2624%2014.27%208.13522%2014.2173%208.04145%2014.1235C7.94768%2014.0297%207.895%2013.9026%207.895%2013.77C7.895%2013.6374%207.94768%2013.5102%208.04145%2013.4164C8.13522%2013.3226%208.2624%2013.27%208.395%2013.27H11.605C11.7376%2013.27%2011.8648%2013.3226%2011.9586%2013.4164C12.0523%2013.5102%2012.105%2013.6374%2012.105%2013.77C12.105%2013.9026%2012.0523%2014.0297%2011.9586%2014.1235C11.8648%2014.2173%2011.7376%2014.27%2011.605%2014.27Z'%20fill='%230F45AF'/%3e%3cpath%20d='M13.155%2011.755H6.845C6.71239%2011.755%206.58522%2011.7023%206.49145%2011.6086C6.39768%2011.5148%206.345%2011.3876%206.345%2011.255C6.345%2011.1224%206.39768%2010.9952%206.49145%2010.9015C6.58522%2010.8077%206.71239%2010.755%206.845%2010.755H13.155C13.2876%2010.755%2013.4148%2010.8077%2013.5086%2010.9015C13.6023%2010.9952%2013.655%2011.1224%2013.655%2011.255C13.655%2011.3876%2013.6023%2011.5148%2013.5086%2011.6086C13.4148%2011.7023%2013.2876%2011.755%2013.155%2011.755Z'%20fill='%230F45AF'/%3e%3c/svg%3e") no-repeat;
450
450
  }.td-shadow-right[data-v-c9978e26] {
451
451
  box-shadow: -1px 1px 5px 4px rgba(0, 0, 0, 0.15);
@@ -465,7 +465,7 @@ to {
465
465
  --tw-content: "";
466
466
  content: var(--tw-content);
467
467
  }
468
- .shadow-inner-toggle[data-v-152f5bf8]::after {
468
+ .shadow-inner-toggle[data-v-be9ecb77]::after {
469
469
  box-shadow:
470
470
  rgba(0, 0, 0, 0.3) 0px 1px 2px 0px,
471
471
  rgba(0, 0, 0, 0.05) 0px 0px 1px 0px inset;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "6.1.0",
5
- "packageManager": "pnpm@9.15.5",
4
+ "version": "7.0.0",
5
+ "packageManager": "pnpm@9.15.6",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "preinstall": "npx only-allow pnpm",
@@ -54,22 +54,22 @@
54
54
  "@playwright/test": "^1.50.1",
55
55
  "@semantic-release/changelog": "^6.0.3",
56
56
  "@semantic-release/git": "^10.0.1",
57
- "@storybook/addon-a11y": "^8.5.8",
58
- "@storybook/addon-actions": "^8.5.8",
59
- "@storybook/addon-essentials": "^8.5.8",
60
- "@storybook/addon-interactions": "^8.5.8",
61
- "@storybook/addon-links": "^8.5.8",
62
- "@storybook/blocks": "^8.5.8",
63
- "@storybook/manager-api": "^8.5.8",
64
- "@storybook/test": "^8.5.8",
65
- "@storybook/test-runner": "^0.21.3",
66
- "@storybook/theming": "^8.5.8",
67
- "@storybook/vue3": "^8.5.8",
68
- "@storybook/vue3-vite": "^8.5.8",
69
- "@tanstack/vue-virtual": "3.13.1",
57
+ "@storybook/addon-a11y": "^8.6.3",
58
+ "@storybook/addon-actions": "^8.6.3",
59
+ "@storybook/addon-essentials": "^8.6.3",
60
+ "@storybook/addon-interactions": "^8.6.3",
61
+ "@storybook/addon-links": "^8.6.3",
62
+ "@storybook/blocks": "^8.6.3",
63
+ "@storybook/manager-api": "^8.6.3",
64
+ "@storybook/test": "^8.6.3",
65
+ "@storybook/test-runner": "^0.22.0",
66
+ "@storybook/theming": "^8.6.3",
67
+ "@storybook/vue3": "^8.6.3",
68
+ "@storybook/vue3-vite": "^8.6.3",
69
+ "@tanstack/vue-virtual": "3.13.2",
70
70
  "@types/jsdom": "^21.1.7",
71
71
  "@types/lodash-es": "^4.17.12",
72
- "@types/node": "^22.13.5",
72
+ "@types/node": "^22.13.8",
73
73
  "@vitejs/plugin-vue": "^5.2.1",
74
74
  "@vitest/coverage-v8": "^3.0.7",
75
75
  "@vue/compiler-sfc": "3.5.13",
@@ -88,13 +88,13 @@
88
88
  "lodash-es": "4.17.21",
89
89
  "make-coverage-badge": "^1.2.0",
90
90
  "postcss": "^8.5.3",
91
- "prettier": "^3.5.2",
91
+ "prettier": "^3.5.3",
92
92
  "prettier-plugin-tailwindcss": "^0.6.11",
93
93
  "resolve-tspaths": "^0.8.23",
94
94
  "rimraf": "^6.0.1",
95
95
  "sass": "^1.85.1",
96
96
  "semantic-release": "^24.2.3",
97
- "storybook": "^8.5.8",
97
+ "storybook": "^8.6.3",
98
98
  "svgo": "^3.3.2",
99
99
  "tailwindcss": "^3.4.17",
100
100
  "typescript": "5.7.3",
@@ -104,7 +104,7 @@
104
104
  "vue-currency-input": "3.2.1",
105
105
  "vue-router": "4.5.0",
106
106
  "vue-toastification": "2.0.0-rc.5",
107
- "vue-tsc": "2.2.4"
107
+ "vue-tsc": "2.2.8"
108
108
  },
109
109
  "dependencies": {
110
110
  "tailwind-variants": "^0.3.1"
@@ -3,18 +3,18 @@ import { createWrapperFor } from '@tests/vitest.helpers';
3
3
 
4
4
  describe('PAlert.vue', () => {
5
5
  it.each([
6
- ['info', ['bg-info', 'text-on-info']],
7
- ['warning', ['bg-warning', 'text-on-warning']],
8
- ['success', ['bg-success', 'text-on-success']],
9
- ['error', ['bg-error', 'text-on-error']],
10
- ])('renders an alert of type %s', async (type, classes) => {
11
- const wrapper = createWrapperFor(PAlert, { props: { type } });
6
+ ['info', ['bg-info', 'text-on-info'], 'streamline:information-circle-solid'],
7
+ ['warning', ['bg-warning', 'text-on-warning'], 'streamline:warning-triangle-solid'],
8
+ ['error', ['bg-error', 'text-on-error'], 'streamline:warning-octagon-solid'],
9
+ ['success', ['bg-success', 'text-on-success'], 'streamline:check-square-solid'],
10
+ ])('renders an alert of type %s', async (type, classes, iconName) => {
11
+ const wrapper = createWrapperFor(PAlert, { props: { type }, global: { stubs: { PIcon: true } } });
12
12
 
13
13
  const alert = await wrapper.find('div[role="alert"]');
14
- const path = wrapper.find('path');
14
+ const icon = wrapper.findComponent({ name: 'PIcon' });
15
15
 
16
16
  expect(classes.every((c) => alert.classes().includes(c))).toBe(true);
17
- expect(path.attributes().fill).toBe(`rgb(var(--color-on-${type}))`);
17
+ expect(icon.props().icon).toBe(iconName);
18
18
  });
19
19
 
20
20
  it('renders slots for icon and content', async () => {
@@ -23,6 +23,7 @@ describe('PAlert.vue', () => {
23
23
  default: `This is an alert`,
24
24
  icon: `<i class="test-icon"></i>`,
25
25
  },
26
+ global: { stubs: { PIcon: true } },
26
27
  });
27
28
 
28
29
  const alert = await wrapper.find('div[role="alert"]');
@@ -1,53 +1,41 @@
1
1
  <template>
2
- <div :class="['rounded p-4 text-xs font-semibold', classes]" role="alert">
2
+ <div :class="['rounded p-4 text-xs font-semibold', ALERT_TYPES[props.type].classes]" role="alert">
3
3
  <div class="flex">
4
4
  <div class="pr-2">
5
5
  <slot name="icon">
6
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
7
- <path
8
- d="M8 0C6.41775 0 4.87104 0.469192 3.55544 1.34824C2.23985 2.22729 1.21447 3.47672 0.608967 4.93853C0.00346629 6.40034 -0.15496 8.00887 0.153721 9.56072C0.462403 11.1126 1.22433 12.538 2.34315 13.6569C3.46197 14.7757 4.88743 15.5376 6.43928 15.8463C7.99113 16.155 9.59966 15.9965 11.0615 15.391C12.5233 14.7855 13.7727 13.7602 14.6518 12.4446C15.5308 11.129 16 9.58225 16 8C16 5.87827 15.1571 3.84344 13.6569 2.34315C12.1566 0.842855 10.1217 0 8 0V0ZM8.16667 3.33333C8.36445 3.33333 8.55779 3.39198 8.72224 3.50186C8.88669 3.61175 9.01486 3.76792 9.09055 3.95065C9.16624 4.13338 9.18604 4.33444 9.14746 4.52842C9.10887 4.72241 9.01363 4.90059 8.87378 5.04044C8.73392 5.18029 8.55574 5.27553 8.36176 5.31412C8.16778 5.3527 7.96671 5.3329 7.78399 5.25721C7.60126 5.18153 7.44508 5.05335 7.3352 4.8889C7.22532 4.72445 7.16667 4.53112 7.16667 4.33333C7.16667 4.06812 7.27203 3.81376 7.45956 3.62623C7.6471 3.43869 7.90145 3.33333 8.16667 3.33333ZM9.66667 12.3333H7C6.82319 12.3333 6.65362 12.2631 6.5286 12.1381C6.40358 12.013 6.33334 11.8435 6.33334 11.6667C6.33334 11.4899 6.40358 11.3203 6.5286 11.1953C6.65362 11.0702 6.82319 11 7 11H7.5C7.54421 11 7.5866 10.9824 7.61786 10.9512C7.64911 10.9199 7.66667 10.8775 7.66667 10.8333V7.83333C7.66667 7.78913 7.64911 7.74674 7.61786 7.71548C7.5866 7.68423 7.54421 7.66667 7.5 7.66667H7C6.82319 7.66667 6.65362 7.59643 6.5286 7.47141C6.40358 7.34638 6.33334 7.17681 6.33334 7C6.33334 6.82319 6.40358 6.65362 6.5286 6.5286C6.65362 6.40357 6.82319 6.33333 7 6.33333H7.66667C8.02029 6.33333 8.35943 6.47381 8.60948 6.72386C8.85953 6.97391 9 7.31305 9 7.66667V10.8333C9 10.8775 9.01756 10.9199 9.04882 10.9512C9.08008 10.9824 9.12247 11 9.16667 11H9.66667C9.84348 11 10.0131 11.0702 10.1381 11.1953C10.2631 11.3203 10.3333 11.4899 10.3333 11.6667C10.3333 11.8435 10.2631 12.013 10.1381 12.1381C10.0131 12.2631 9.84348 12.3333 9.66667 12.3333Z"
9
- :fill="svgColor"
10
- />
11
- </svg>
6
+ <PIcon :icon="ALERT_TYPES[props.type].icon" width="16" class="-mb-0.5" inline />
12
7
  </slot>
13
8
  </div>
14
9
  <div>
15
- <slot />
10
+ <slot></slot>
16
11
  </div>
17
12
  </div>
18
13
  </div>
19
14
  </template>
20
15
 
21
16
  <script lang="ts">
22
- import { type Color, getColor } from '@squirrel/utils/tailwind';
23
- import { defineComponent, type PropType } from 'vue';
17
+ import PIcon from '@squirrel/components/p-icon/p-icon.vue';
18
+ import { type PropType } from 'vue';
24
19
 
25
20
  const ALERT_TYPES = {
26
- info: `bg-info text-on-info`,
27
- warning: `bg-warning text-on-warning`,
28
- error: `bg-error text-on-error`,
29
- success: `bg-success text-on-success`,
21
+ info: { classes: `bg-info text-on-info`, icon: 'streamline:information-circle-solid' },
22
+ warning: { classes: `bg-warning text-on-warning`, icon: 'streamline:warning-triangle-solid' },
23
+ error: { classes: `bg-error text-on-error`, icon: 'streamline:warning-octagon-solid' },
24
+ success: { classes: `bg-success text-on-success`, icon: 'streamline:check-square-solid' },
30
25
  };
26
+ </script>
31
27
 
32
- export default defineComponent({
28
+ <script setup lang="ts">
29
+ defineOptions({
33
30
  name: 'PAlert',
34
- props: {
35
- type: {
36
- type: String as PropType<keyof typeof ALERT_TYPES>,
37
- default: 'info',
38
- validator(value: keyof typeof ALERT_TYPES) {
39
- return Object.keys(ALERT_TYPES).includes(value);
40
- },
41
- },
42
- },
43
- computed: {
44
- classes() {
45
- return `${ALERT_TYPES[this.type]}`;
46
- },
47
- svgColor() {
48
- const type = `on-${this.type}` as Color;
31
+ });
49
32
 
50
- return getColor(type);
33
+ const props = defineProps({
34
+ type: {
35
+ type: String as PropType<keyof typeof ALERT_TYPES>,
36
+ default: 'info',
37
+ validator(value: keyof typeof ALERT_TYPES) {
38
+ return Object.keys(ALERT_TYPES).includes(value);
51
39
  },
52
40
  },
53
41
  });
@@ -76,10 +76,17 @@ describe('PAvatar.vue', () => {
76
76
  },
77
77
  });
78
78
 
79
- await wrapper.setData({ imageBroken: true });
80
- expect(wrapper.vm.imageBroken).toBe(true);
79
+ const img = () => wrapper.find('img');
80
+ const label = () => wrapper.find('div.items-center');
81
+
82
+ await img().trigger('error');
83
+
84
+ expect(img().exists()).toBe(false);
85
+ expect(label().exists()).toBe(true);
81
86
 
82
87
  await wrapper.setProps({ imageSrc: 'new-src.jpg' });
83
- expect(wrapper.vm.imageBroken).toBe(false);
88
+
89
+ expect(img().exists()).toBe(true);
90
+ expect(label().exists()).toBe(false);
84
91
  });
85
92
  });
@@ -15,57 +15,55 @@
15
15
  </template>
16
16
 
17
17
  <script lang="ts">
18
- import { defineComponent } from 'vue';
18
+ import { computed, type PropType, ref, watch } from 'vue';
19
19
 
20
- const SHAPES = {
21
- rectangle: 'rectangle',
22
- circle: 'circle',
23
- };
20
+ const SHAPES = ['rectangle', 'circle'] as const;
21
+
22
+ type Shape = (typeof SHAPES)[number];
24
23
 
25
24
  const SHAPE_CLASSES = {
26
- [SHAPES.rectangle]: 'rounded-lg',
27
- [SHAPES.circle]: 'rounded-full',
25
+ rectangle: 'rounded-lg',
26
+ circle: 'rounded-full',
28
27
  };
28
+ </script>
29
29
 
30
- export default defineComponent({
30
+ <script setup lang="ts">
31
+ defineOptions({
31
32
  name: 'PAvatar',
32
- props: {
33
- shape: {
34
- type: String,
35
- default: SHAPES.circle,
36
- validator: (value: string) => Object.values(SHAPES).includes(value),
37
- },
38
- imageSrc: {
39
- type: String,
40
- default: '',
41
- },
42
- label: {
43
- type: String,
44
- required: true,
45
- },
46
- imageClass: {
47
- type: String,
48
- default: '',
49
- },
50
- labelClass: {
51
- type: String,
52
- default: '',
53
- },
33
+ });
34
+
35
+ const props = defineProps({
36
+ shape: {
37
+ type: String as PropType<Shape>,
38
+ default: 'circle',
39
+ validator: (value: Shape) => SHAPES.includes(value),
54
40
  },
55
- data() {
56
- return {
57
- imageBroken: false,
58
- };
41
+ imageSrc: {
42
+ type: String,
43
+ default: '',
59
44
  },
60
- computed: {
61
- shapeClass() {
62
- return SHAPE_CLASSES[this.shape];
63
- },
45
+ label: {
46
+ type: String,
47
+ required: true,
64
48
  },
65
- watch: {
66
- imageSrc() {
67
- this.imageBroken = false;
68
- },
49
+ imageClass: {
50
+ type: String,
51
+ default: '',
52
+ },
53
+ labelClass: {
54
+ type: String,
55
+ default: '',
69
56
  },
70
57
  });
58
+
59
+ const imageBroken = ref<boolean>(false);
60
+
61
+ const shapeClass = computed(() => SHAPE_CLASSES[props.shape]);
62
+
63
+ watch(
64
+ () => props.imageSrc,
65
+ () => {
66
+ imageBroken.value = false;
67
+ }
68
+ );
71
69
  </script>
@@ -175,9 +175,9 @@ describe('PBtn.vue', () => {
175
175
  });
176
176
 
177
177
  it.each([
178
- ['sm', ['py-1', 'px-2', 'rounded', 'font-medium', 'text-sm']],
178
+ ['sm', ['py-1.5', 'px-3', 'rounded', 'font-medium', 'text-sm', 'leading-5']],
179
179
  ['md', ['py-2', 'px-6', 'rounded', 'font-medium', 'text-base']],
180
- ['lg', ['py-2.5', 'px-6', 'rounded', 'font-medium', 'text-lg']],
180
+ ['lg', ['py-3', 'px-6', 'rounded', 'font-medium', 'text-lg', 'leading-6']],
181
181
  ])('renders a button of size %s', async (size, classes) => {
182
182
  const wrapper = createWrapperFor(PBtn, { props: { size }, slots: { default: `button` } });
183
183
 
@@ -256,7 +256,7 @@ describe('PBtn.vue', () => {
256
256
 
257
257
  describe('icon button', () => {
258
258
  it.each([
259
- ['sm', ['shrink-0', 'text-lg']],
259
+ ['sm', ['shrink-0', 'text-[20px]']],
260
260
  ['md', ['shrink-0', 'text-xl']],
261
261
  ['lg', ['shrink-0', 'text-2xl']],
262
262
  ])('renders a button with icon of size %s', async (size, classes) => {
@@ -272,7 +272,7 @@ describe('PBtn.vue', () => {
272
272
  });
273
273
 
274
274
  it.each([
275
- ['sm', ['shrink-0', 'text-lg']],
275
+ ['sm', ['shrink-0', 'text-[20px]']],
276
276
  ['md', ['shrink-0', 'text-xl']],
277
277
  ['lg', ['shrink-0', 'text-2xl']],
278
278
  ])('renders a button with a right icon of size %s', async (size, classes) => {
@@ -288,9 +288,9 @@ describe('PBtn.vue', () => {
288
288
  });
289
289
 
290
290
  it.each([
291
- ['sm', ['shrink-0', 'text-lg'], ['has-[.slot-wrapper:empty]:px-1']],
292
- ['md', ['shrink-0', 'text-xl'], ['has-[.slot-wrapper:empty]:px-2']],
293
- ['lg', ['shrink-0', 'text-2xl'], ['has-[.slot-wrapper:empty]:px-2.5']],
291
+ ['sm', ['shrink-0', 'text-[20px]'], ['has-[.slot-wrapper:empty]:px-1.5']],
292
+ ['md', ['shrink-0', 'text-xl'], ['has-[.slot-wrapper:empty]:px-2.5']],
293
+ ['lg', ['shrink-0', 'text-2xl'], ['has-[.slot-wrapper:empty]:px-3']],
294
294
  ])('renders a button with an icon without text of size %s', async (size, classes, buttonClasses) => {
295
295
  const wrapper = createWrapperFor(PBtn, {
296
296
  props: { size, icon: 'edit' },
@@ -84,17 +84,17 @@ const btnClasses = {
84
84
  },
85
85
  size: {
86
86
  sm: {
87
- button: 'px-2 has-[.slot-wrapper:empty]:px-1 py-1 text-sm',
87
+ button: 'px-3 has-[.slot-wrapper:empty]:px-1.5 py-1.5 text-sm leading-5',
88
88
  content: 'gap-1',
89
- icon: 'text-lg',
89
+ icon: 'text-[20px]',
90
90
  },
91
91
  md: {
92
- button: 'px-6 has-[.slot-wrapper:empty]:px-2 py-2 text-base',
92
+ button: 'px-6 has-[.slot-wrapper:empty]:px-2.5 has-[.slot-wrapper:empty]:py-2.5 py-2 text-base',
93
93
  content: 'gap-2',
94
94
  icon: 'text-xl',
95
95
  },
96
96
  lg: {
97
- button: 'px-6 has-[.slot-wrapper:empty]:px-2.5 py-2.5 text-lg',
97
+ button: 'px-6 has-[.slot-wrapper:empty]:px-3 py-3 text-lg leading-6',
98
98
  content: 'gap-2.5',
99
99
  icon: 'text-2xl',
100
100
  },
@@ -25,57 +25,80 @@
25
25
  </template>
26
26
 
27
27
  <script lang="ts">
28
- import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
29
- import { defineComponent, type PropType, type StyleValue } from 'vue';
28
+ import { type Size, SIZES } from '@squirrel/components/p-btn/p-btn.types';
29
+ import { useInputClasses } from '@squirrel/composables/useInputClasses';
30
+ import { computed, type PropType, type StyleValue, useAttrs, useSlots } from 'vue';
30
31
 
31
32
  const INPUT_TYPES = { TEXT: 'text', PASSWORD: 'password' };
32
33
 
33
34
  type InputTypeKeys = keyof typeof INPUT_TYPES;
34
35
  type InputType = (typeof INPUT_TYPES)[InputTypeKeys];
36
+ </script>
35
37
 
36
- export default defineComponent({
38
+ <script setup lang="ts">
39
+ defineOptions({
37
40
  name: 'PInput',
38
- mixins: [inputClassesMixin],
39
41
  inheritAttrs: false,
40
- props: {
41
- modelValue: {
42
- type: [String, Number],
43
- default: '',
44
- },
45
- type: {
46
- type: String as PropType<InputType>,
47
- default: INPUT_TYPES.TEXT,
48
- validator(value: InputType) {
49
- return Object.values(INPUT_TYPES).includes(value);
50
- },
51
- },
52
- label: {
53
- type: String,
54
- default: '',
55
- },
56
- errorMsg: {
57
- type: String,
58
- default: '',
59
- },
60
- required: {
61
- type: Boolean,
62
- default: false,
63
- },
64
- rounded: {
65
- type: Boolean,
66
- default: false,
67
- },
68
- },
69
- emits: ['update:modelValue'],
70
- computed: {
71
- attrs() {
72
- const { class: classes, style, ...rest } = this.$attrs;
42
+ });
73
43
 
74
- return rest;
44
+ defineEmits(['update:modelValue']);
45
+
46
+ const props = defineProps({
47
+ modelValue: {
48
+ type: [String, Number, Boolean, null] as PropType<string | number | boolean | null>,
49
+ default: '',
50
+ },
51
+ type: {
52
+ type: String as PropType<InputType>,
53
+ default: INPUT_TYPES.TEXT,
54
+ validator(value: InputType) {
55
+ return Object.values(INPUT_TYPES).includes(value);
75
56
  },
76
- style() {
77
- return this.$attrs.style as StyleValue;
57
+ },
58
+ label: {
59
+ type: String,
60
+ default: '',
61
+ },
62
+ errorMsg: {
63
+ type: String,
64
+ default: '',
65
+ },
66
+ required: {
67
+ type: Boolean,
68
+ default: false,
69
+ },
70
+ size: {
71
+ type: String as PropType<Size>,
72
+ default: 'md',
73
+ validator(value: Size) {
74
+ return SIZES.includes(value);
78
75
  },
79
76
  },
77
+ rounded: {
78
+ type: Boolean,
79
+ default: false,
80
+ },
81
+ });
82
+
83
+ const slots = useSlots();
84
+
85
+ const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
86
+ computed(() => ({
87
+ ...props,
88
+ prefix: !!slots.prefix,
89
+ suffix: !!slots.suffix,
90
+ }))
91
+ );
92
+
93
+ const allAttrs = useAttrs();
94
+
95
+ const attrs = computed(() => {
96
+ const { class: classes, style, ...rest } = allAttrs;
97
+
98
+ return rest;
99
+ });
100
+
101
+ const style = computed(() => {
102
+ return allAttrs.style as StyleValue;
80
103
  });
81
104
  </script>