@pequity/squirrel 8.4.3 → 8.4.5

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 (157) hide show
  1. package/README.md +2 -1
  2. package/dist/cjs/chunks/p-alert.js +3 -0
  3. package/dist/cjs/chunks/p-avatar.js +16 -0
  4. package/dist/cjs/chunks/p-btn.js +3 -0
  5. package/dist/cjs/chunks/p-card.js +4 -0
  6. package/dist/cjs/chunks/p-dropdown-select.js +34 -0
  7. package/dist/cjs/chunks/p-input-number.js +32 -0
  8. package/dist/cjs/chunks/p-input-percent.js +13 -2
  9. package/dist/cjs/chunks/p-input.js +28 -0
  10. package/dist/cjs/chunks/p-pagination-info.js +9 -5
  11. package/dist/cjs/chunks/p-pagination.js +23 -13
  12. package/dist/cjs/chunks/p-select-btn.js +2 -1
  13. package/dist/cjs/chunks/p-select.js +33 -0
  14. package/dist/cjs/chunks/p-table-loader.js +20 -0
  15. package/dist/cjs/chunks/p-tabs.js +12 -0
  16. package/dist/cjs/chunks/p-textarea.js +20 -0
  17. package/dist/cjs/index.js +40 -3
  18. package/dist/cjs/p-checkbox.js +8 -1
  19. package/dist/cjs/p-chips.js +17 -1
  20. package/dist/cjs/p-close-btn.js +6 -1
  21. package/dist/cjs/p-drawer.js +90 -2
  22. package/dist/cjs/p-dropdown.js +2 -1
  23. package/dist/cjs/p-icon.js +3 -2
  24. package/dist/cjs/p-input-search.js +13 -1
  25. package/dist/cjs/p-loading.js +1 -1
  26. package/dist/cjs/p-modal.js +82 -2
  27. package/dist/cjs/p-select-pill.js +36 -2
  28. package/dist/cjs/p-skeleton-loader.js +17 -1
  29. package/dist/cjs/p-table-filter-icon.js +4 -1
  30. package/dist/cjs/p-table-header-cell.js +29 -0
  31. package/dist/cjs/p-table-td.js +1 -1
  32. package/dist/cjs/p-toggle.js +22 -1
  33. package/dist/es/chunks/p-alert.js +3 -0
  34. package/dist/es/chunks/p-avatar.js +16 -0
  35. package/dist/es/chunks/p-btn.js +3 -0
  36. package/dist/es/chunks/p-card.js +4 -0
  37. package/dist/es/chunks/p-dropdown-select.js +34 -0
  38. package/dist/es/chunks/p-input-number.js +32 -0
  39. package/dist/es/chunks/p-input-percent.js +13 -2
  40. package/dist/es/chunks/p-input.js +28 -0
  41. package/dist/es/chunks/p-pagination-info.js +9 -5
  42. package/dist/es/chunks/p-pagination.js +24 -14
  43. package/dist/es/chunks/p-select-btn.js +2 -1
  44. package/dist/es/chunks/p-select.js +33 -0
  45. package/dist/es/chunks/p-table-loader.js +20 -0
  46. package/dist/es/chunks/p-tabs.js +12 -0
  47. package/dist/es/chunks/p-textarea.js +20 -0
  48. package/dist/es/index.js +40 -3
  49. package/dist/es/p-checkbox.js +8 -1
  50. package/dist/es/p-chips.js +17 -1
  51. package/dist/es/p-close-btn.js +6 -1
  52. package/dist/es/p-drawer.js +90 -2
  53. package/dist/es/p-dropdown.js +2 -1
  54. package/dist/es/p-icon.js +3 -2
  55. package/dist/es/p-input-search.js +13 -1
  56. package/dist/es/p-loading.js +1 -1
  57. package/dist/es/p-modal.js +82 -2
  58. package/dist/es/p-select-pill.js +36 -2
  59. package/dist/es/p-skeleton-loader.js +17 -1
  60. package/dist/es/p-table-filter-icon.js +4 -1
  61. package/dist/es/p-table-header-cell.js +29 -0
  62. package/dist/es/p-table-td.js +1 -1
  63. package/dist/es/p-toggle.js +22 -1
  64. package/dist/squirrel/components/p-action-bar/p-action-bar.vue.d.ts +15 -3
  65. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +17 -4
  66. package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +36 -1
  67. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +21 -5
  68. package/dist/squirrel/components/p-card/p-card.vue.d.ts +21 -8
  69. package/dist/squirrel/components/p-checkbox/p-checkbox.vue.d.ts +26 -8
  70. package/dist/squirrel/components/p-chips/p-chips.vue.d.ts +24 -0
  71. package/dist/squirrel/components/p-close-btn/p-close-btn.vue.d.ts +14 -1
  72. package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +17 -1
  73. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +144 -6
  74. package/dist/squirrel/components/p-dropdown/p-dropdown.vue.d.ts +11 -2
  75. package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +70 -2
  76. package/dist/squirrel/components/p-file-upload/p-file-upload.vue.d.ts +71 -7
  77. package/dist/squirrel/components/p-icon/p-icon.types.d.ts +3 -2
  78. package/dist/squirrel/components/p-icon/p-icon.vue.d.ts +5 -1
  79. package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +12 -5
  80. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +28 -8
  81. package/dist/squirrel/components/p-input/p-input.vue.d.ts +74 -9
  82. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +83 -12
  83. package/dist/squirrel/components/p-input-percent/p-input-percent.vue.d.ts +23 -3
  84. package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +25 -1
  85. package/dist/squirrel/components/p-link/p-link.vue.d.ts +1 -1
  86. package/dist/squirrel/components/p-loading/p-loading.vue.d.ts +1 -1
  87. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +186 -16
  88. package/dist/squirrel/components/p-pagination/p-pagination.vue.d.ts +23 -13
  89. package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +17 -9
  90. package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +21 -1
  91. package/dist/squirrel/components/p-ring-loader/p-ring-loader.vue.d.ts +11 -1
  92. package/dist/squirrel/components/p-select/p-select.vue.d.ts +77 -7
  93. package/dist/squirrel/components/p-select-btn/p-select-btn.vue.d.ts +68 -11
  94. package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +2 -2
  95. package/dist/squirrel/components/p-select-pill/p-select-pill.vue.d.ts +72 -2
  96. package/dist/squirrel/components/p-skeleton-loader/p-skeleton-loader.vue.d.ts +40 -0
  97. package/dist/squirrel/components/p-steps/p-steps.vue.d.ts +13 -1
  98. package/dist/squirrel/components/p-table/p-table.vue.d.ts +32 -0
  99. package/dist/squirrel/components/p-table-header-cell/p-table-filter-icon.vue.d.ts +7 -1
  100. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +59 -4
  101. package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +41 -1
  102. package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +13 -3
  103. package/dist/squirrel/components/p-table-td/p-table-td.vue.d.ts +13 -1
  104. package/dist/squirrel/components/p-tabs/p-tabs.vue.d.ts +34 -3
  105. package/dist/squirrel/components/p-tabs-pills/p-tabs-pills.vue.d.ts +23 -1
  106. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +53 -9
  107. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +51 -4
  108. package/dist/squirrel.css +68 -68
  109. package/package.json +20 -21
  110. package/squirrel/components/p-action-bar/p-action-bar.stories.js +5 -5
  111. package/squirrel/components/p-action-bar/p-action-bar.vue +30 -3
  112. package/squirrel/components/p-alert/p-alert.vue +24 -0
  113. package/squirrel/components/p-avatar/p-avatar.vue +28 -0
  114. package/squirrel/components/p-btn/p-btn.vue +35 -0
  115. package/squirrel/components/p-card/p-card.vue +24 -1
  116. package/squirrel/components/p-checkbox/p-checkbox.vue +23 -1
  117. package/squirrel/components/p-chips/p-chips.vue +24 -0
  118. package/squirrel/components/p-close-btn/p-close-btn.vue +15 -0
  119. package/squirrel/components/p-date-picker/p-date-picker.vue +23 -1
  120. package/squirrel/components/p-drawer/p-drawer.vue +95 -0
  121. package/squirrel/components/p-dropdown/p-dropdown.vue +12 -1
  122. package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +41 -0
  123. package/squirrel/components/p-file-upload/p-file-upload.vue +58 -3
  124. package/squirrel/components/p-icon/p-icon.types.ts +3 -2
  125. package/squirrel/components/p-icon/p-icon.vue +16 -0
  126. package/squirrel/components/p-info-icon/p-info-icon.vue +19 -0
  127. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +32 -0
  128. package/squirrel/components/p-input/p-input.vue +61 -1
  129. package/squirrel/components/p-input-number/p-input-number.vue +78 -1
  130. package/squirrel/components/p-input-percent/p-input-percent.vue +27 -3
  131. package/squirrel/components/p-input-search/p-input-search.vue +30 -2
  132. package/squirrel/components/p-link/p-link.vue +13 -0
  133. package/squirrel/components/p-loading/p-loading.vue +9 -2
  134. package/squirrel/components/p-modal/p-modal.vue +138 -2
  135. package/squirrel/components/p-pagination/p-pagination.vue +28 -8
  136. package/squirrel/components/p-pagination-info/p-pagination-info.vue +16 -4
  137. package/squirrel/components/p-progress-bar/p-progress-bar.vue +31 -4
  138. package/squirrel/components/p-ring-loader/p-ring-loader.vue +17 -0
  139. package/squirrel/components/p-select/p-select.vue +50 -1
  140. package/squirrel/components/p-select-btn/p-select-btn.vue +90 -2
  141. package/squirrel/components/p-select-list/p-select-list.vue +7 -0
  142. package/squirrel/components/p-select-pill/p-select-pill.vue +52 -2
  143. package/squirrel/components/p-skeleton-loader/p-skeleton-loader.vue +24 -0
  144. package/squirrel/components/p-steps/p-steps.vue +25 -0
  145. package/squirrel/components/p-table/p-table.vue +39 -0
  146. package/squirrel/components/p-table-header-cell/p-table-filter-icon.vue +9 -0
  147. package/squirrel/components/p-table-header-cell/p-table-header-cell.vue +36 -0
  148. package/squirrel/components/p-table-loader/p-table-loader.vue +28 -0
  149. package/squirrel/components/p-table-sort/p-table-sort.vue +19 -1
  150. package/squirrel/components/p-table-td/p-table-td.vue +20 -0
  151. package/squirrel/components/p-tabs/p-tabs.stories.js +2 -2
  152. package/squirrel/components/p-tabs/p-tabs.vue +33 -1
  153. package/squirrel/components/p-tabs-pills/p-tabs-pills.vue +33 -0
  154. package/squirrel/components/p-textarea/p-textarea.vue +43 -1
  155. package/squirrel/components/p-toggle/p-toggle.vue +44 -1
  156. package/squirrel/assets/pagination-left-icon.svg +0 -5
  157. package/squirrel/assets/pagination-right-icon.svg +0 -5
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "8.4.3",
5
- "packageManager": "pnpm@10.12.4",
4
+ "version": "8.4.5",
5
+ "packageManager": "pnpm@10.13.1",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "preinstall": "npx only-allow pnpm",
@@ -50,28 +50,27 @@
50
50
  "@commitlint/cli": "^19.8.1",
51
51
  "@commitlint/config-conventional": "^19.8.1",
52
52
  "@pequity/eslint-config": "^2.0.2",
53
- "@playwright/test": "^1.53.2",
53
+ "@playwright/test": "^1.54.1",
54
54
  "@semantic-release/changelog": "^6.0.3",
55
55
  "@semantic-release/git": "^10.0.1",
56
- "@storybook/addon-a11y": "^9.0.15",
57
- "@storybook/addon-docs": "^9.0.15",
58
- "@storybook/addon-links": "^9.0.15",
59
- "@storybook/addon-vitest": "^9.0.15",
60
- "@storybook/vue3": "^9.0.15",
61
- "@storybook/vue3-vite": "^9.0.15",
56
+ "@storybook/addon-a11y": "^9.0.18",
57
+ "@storybook/addon-docs": "^9.0.18",
58
+ "@storybook/addon-links": "^9.0.18",
59
+ "@storybook/addon-vitest": "^9.0.18",
60
+ "@storybook/vue3-vite": "^9.0.18",
62
61
  "@tanstack/vue-virtual": "3.13.12",
63
62
  "@types/jsdom": "^21.1.7",
64
63
  "@types/lodash-es": "^4.17.12",
65
- "@types/node": "^24.0.10",
66
- "@vitejs/plugin-vue": "^6.0.0",
64
+ "@types/node": "^24.1.0",
65
+ "@vitejs/plugin-vue": "^6.0.1",
67
66
  "@vitest/browser": "3.2.4",
68
67
  "@vitest/coverage-v8": "^3.2.4",
69
- "@vue/compiler-sfc": "3.5.17",
68
+ "@vue/compiler-sfc": "3.5.18",
70
69
  "@vue/test-utils": "^2.4.6",
71
70
  "@vuepic/vue-datepicker": "11.0.2",
72
71
  "autoprefixer": "^10.4.21",
73
- "eslint": "^9.30.1",
74
- "eslint-plugin-storybook": "^9.0.15",
72
+ "eslint": "^9.32.0",
73
+ "eslint-plugin-storybook": "^9.0.18",
75
74
  "floating-vue": "5.2.2",
76
75
  "glob": "^11.0.3",
77
76
  "husky": "^9.1.7",
@@ -80,25 +79,25 @@
80
79
  "lint-staged": "^16.1.2",
81
80
  "lodash-es": "4.17.21",
82
81
  "make-coverage-badge": "^1.2.0",
83
- "playwright": "^1.53.2",
82
+ "playwright": "^1.54.1",
84
83
  "postcss": "^8.5.6",
85
84
  "prettier": "^3.6.2",
86
- "prettier-plugin-tailwindcss": "^0.6.13",
85
+ "prettier-plugin-tailwindcss": "^0.6.14",
87
86
  "resolve-tspaths": "^0.8.23",
88
87
  "rimraf": "^6.0.1",
89
88
  "sass": "^1.89.2",
90
- "semantic-release": "^24.2.6",
91
- "storybook": "^9.0.15",
89
+ "semantic-release": "^24.2.7",
90
+ "storybook": "^9.0.18",
92
91
  "svgo": "^4.0.0",
93
92
  "tailwindcss": "^3.4.17",
94
93
  "typescript": "5.8.3",
95
- "vite": "^7.0.0",
94
+ "vite": "^7.0.6",
96
95
  "vitest": "^3.2.4",
97
- "vue": "3.5.17",
96
+ "vue": "3.5.18",
98
97
  "vue-currency-input": "3.2.1",
99
98
  "vue-router": "4.5.1",
100
99
  "vue-toastification": "2.0.0-rc.5",
101
- "vue-tsc": "3.0.1"
100
+ "vue-tsc": "3.0.4"
102
101
  },
103
102
  "dependencies": {
104
103
  "tailwind-variants": "^1.0.0"
@@ -1,5 +1,5 @@
1
- import PaginateLeftIcon from '@squirrel/assets/pagination-left-icon.svg?inline';
2
- import PaginateRightIcon from '@squirrel/assets/pagination-right-icon.svg?inline';
1
+ import KeyboardPressEnterIcon from '@squirrel/assets/keyboard-press-enter.svg?inline';
2
+ import XIconWhite from '@squirrel/assets/x-icon-white.svg?inline';
3
3
  import PActionBar from '@squirrel/components/p-action-bar/p-action-bar.vue';
4
4
  import PBtn from '@squirrel/components/p-btn/p-btn.vue';
5
5
  import { action } from 'storybook/actions';
@@ -9,7 +9,7 @@ import { markRaw } from 'vue';
9
9
  const actionBarActions = [
10
10
  {
11
11
  label: 'Upload',
12
- icon: markRaw(PaginateRightIcon),
12
+ icon: markRaw(KeyboardPressEnterIcon),
13
13
  name: 'upload',
14
14
  },
15
15
  {
@@ -23,12 +23,12 @@ const actionBarActions = [
23
23
  {
24
24
  label: 'Subaction 1',
25
25
  name: 'subaction1',
26
- icon: markRaw(PaginateLeftIcon),
26
+ icon: markRaw(XIconWhite),
27
27
  },
28
28
  {
29
29
  label: 'Subaction 2',
30
30
  name: 'subaction2',
31
- icon: markRaw(PaginateRightIcon),
31
+ icon: markRaw(KeyboardPressEnterIcon),
32
32
  },
33
33
  {
34
34
  label: 'Subaction 3',
@@ -68,21 +68,48 @@ import PIcon from '@squirrel/components/p-icon/p-icon.vue';
68
68
  import { isComponent } from '@squirrel/utils/component';
69
69
  import { isString } from '@squirrel/utils/string';
70
70
 
71
+ /**
72
+ * A floating action bar component that displays at the bottom of the screen.
73
+ * Provides a teleported action bar with dismiss functionality and customizable actions.
74
+ * Supports both simple action buttons and dropdown menus with sub-actions.
75
+ *
76
+ * @displayName PActionBar
77
+ */
71
78
  defineOptions({
72
79
  name: 'PActionBar',
73
80
  inheritAttrs: false,
74
81
  });
75
82
 
76
83
  type Props = {
84
+ /**
85
+ * Controls visibility of the action bar.
86
+ * When true, the action bar is displayed at the bottom of the screen.
87
+ */
77
88
  show: boolean;
89
+ /**
90
+ * The main text displayed in the action bar.
91
+ * Provides context for the available actions.
92
+ */
78
93
  label: string;
94
+ /**
95
+ * Array of action objects to be rendered as buttons or dropdowns.
96
+ * Each action can have an icon, label, and optional sub-actions.
97
+ */
79
98
  actions: PActionBarAction[];
80
99
  };
81
100
 
101
+ defineProps<Props>();
102
+
82
103
  defineEmits<{
104
+ /**
105
+ * Emitted when the "Clear All" button is clicked.
106
+ * Used to dismiss the action bar and clear selections.
107
+ */
83
108
  'click:dismiss': [];
84
- 'click:action': [PActionBarAction['name']];
109
+ /**
110
+ * Emitted when an action or sub-action is clicked.
111
+ * @param {string} name - The name of the clicked action
112
+ */
113
+ 'click:action': [name: PActionBarAction['name']];
85
114
  }>();
86
-
87
- defineProps<Props>();
88
115
  </script>
@@ -26,11 +26,35 @@ const ALERT_TYPES = {
26
26
  </script>
27
27
 
28
28
  <script setup lang="ts">
29
+ /**
30
+ * An alert component that displays informational, warning, error, or success messages.
31
+ * Supports different alert types with appropriate styling and icons.
32
+ * Provides customizable content through slots.
33
+ *
34
+ * @displayName PAlert
35
+ */
29
36
  defineOptions({
30
37
  name: 'PAlert',
31
38
  });
32
39
 
40
+ defineSlots<{
41
+ /**
42
+ * Custom icon slot - use this to override the default alert type icon.
43
+ * If not provided, a default icon will be shown based on the alert type.
44
+ */
45
+ icon?: () => unknown;
46
+
47
+ /**
48
+ * Default slot - the main content of the alert message.
49
+ * This should contain the text or HTML to display in the alert.
50
+ */
51
+ default?: () => unknown;
52
+ }>();
53
+
33
54
  const props = defineProps({
55
+ /**
56
+ * The type of the alert which determines its appearance and icon
57
+ */
34
58
  type: {
35
59
  type: String as PropType<keyof typeof ALERT_TYPES>,
36
60
  default: 'info',
@@ -17,10 +17,16 @@
17
17
  <script lang="ts">
18
18
  import { computed, type PropType, ref, watch } from 'vue';
19
19
 
20
+ /**
21
+ * Available avatar shapes
22
+ */
20
23
  const SHAPES = ['rectangle', 'circle'] as const;
21
24
 
22
25
  type Shape = (typeof SHAPES)[number];
23
26
 
27
+ /**
28
+ * CSS classes for each avatar shape
29
+ */
24
30
  const SHAPE_CLASSES = {
25
31
  rectangle: 'rounded-lg',
26
32
  circle: 'rounded-full',
@@ -28,28 +34,50 @@ const SHAPE_CLASSES = {
28
34
  </script>
29
35
 
30
36
  <script setup lang="ts">
37
+ /**
38
+ * An avatar component that displays user images or fallback text.
39
+ * Supports different shapes and handles image loading errors gracefully.
40
+ *
41
+ * @displayName PAvatar
42
+ */
31
43
  defineOptions({
32
44
  name: 'PAvatar',
33
45
  });
34
46
 
35
47
  const props = defineProps({
48
+ /**
49
+ * The shape of the avatar
50
+ */
36
51
  shape: {
37
52
  type: String as PropType<Shape>,
38
53
  default: 'circle',
39
54
  validator: (value: Shape) => SHAPES.includes(value),
40
55
  },
56
+ /**
57
+ * URL of the image to display
58
+ */
41
59
  imageSrc: {
42
60
  type: String,
43
61
  default: '',
44
62
  },
63
+ /**
64
+ * Text to display when image is not available
65
+ * Also used as the alt text for the image
66
+ */
45
67
  label: {
46
68
  type: String,
47
69
  required: true,
48
70
  },
71
+ /**
72
+ * Additional CSS classes to apply to the image
73
+ */
49
74
  imageClass: {
50
75
  type: String,
51
76
  default: '',
52
77
  },
78
+ /**
79
+ * Additional CSS classes to apply to the label container
80
+ */
53
81
  labelClass: {
54
82
  type: String,
55
83
  default: '',
@@ -21,8 +21,14 @@ import { tv, type VariantProps } from 'tailwind-variants';
21
21
  import { computed, type PropType, useAttrs } from 'vue';
22
22
  import { type RouteLocationRaw } from 'vue-router';
23
23
 
24
+ /**
25
+ * Type for the icon prop
26
+ */
24
27
  type Icon = InstanceType<typeof PIcon>['$props']['icon'];
25
28
 
29
+ /**
30
+ * Button styles configuration using tailwind-variants
31
+ */
26
32
  const btnClasses = {
27
33
  slots: {
28
34
  button:
@@ -91,8 +97,19 @@ const btnClasses = {
91
97
 
92
98
  const btn = tv(btnClasses);
93
99
 
100
+ /**
101
+ * Available button types
102
+ */
94
103
  const BUTTON_TYPES = Object.keys(btnClasses.variants.type);
104
+
105
+ /**
106
+ * Native button types (HTML attribute values)
107
+ */
95
108
  const BUTTON_NATIVE_TYPES = ['button', 'submit', 'reset'] as const;
109
+
110
+ /**
111
+ * Loader sizes mapped to button sizes
112
+ */
96
113
  const LOADER_SIZES = { sm: 24, md: 30, lg: 40 } as const satisfies { [key in Size]: number };
97
114
 
98
115
  type ButtonNativeType = (typeof BUTTON_NATIVE_TYPES)[number];
@@ -100,10 +117,25 @@ type ButtonType = NonNullable<VariantProps<typeof btn>['type']>;
100
117
  </script>
101
118
 
102
119
  <script setup lang="ts">
120
+ /**
121
+ * A versatile button component with multiple variants, sizes, and states.
122
+ * Supports different button types, loading states, icons, and link functionality.
123
+ * Built with tailwind-variants for consistent styling and theming.
124
+ *
125
+ * @displayName PBtn
126
+ */
103
127
  defineOptions({
104
128
  name: 'PBtn',
105
129
  });
106
130
 
131
+ defineSlots<{
132
+ /**
133
+ * Default slot - the content of the button.
134
+ * This should contain the text or HTML to display inside the button.
135
+ */
136
+ default?: () => void;
137
+ }>();
138
+
107
139
  const attrs = useAttrs();
108
140
 
109
141
  const props = defineProps({
@@ -166,6 +198,9 @@ const props = defineProps({
166
198
  type: String as PropType<Icon>,
167
199
  default: '',
168
200
  },
201
+ /**
202
+ * The icon to display on the right side of the button
203
+ */
169
204
  iconRight: {
170
205
  type: String as PropType<Icon>,
171
206
  default: '',
@@ -5,14 +5,37 @@
5
5
  {{ title }}
6
6
  </div>
7
7
  </slot>
8
- <slot />
8
+ <slot></slot>
9
9
  </div>
10
10
  </template>
11
11
 
12
12
  <script setup lang="ts">
13
+ /**
14
+ * A card component that provides a container for content with optional header and footer.
15
+ * Supports different variants and customizable styling.
16
+ *
17
+ * @displayName PCard
18
+ */
13
19
  defineOptions({ name: 'PCard' });
14
20
 
21
+ defineSlots<{
22
+ /**
23
+ * Title slot - custom content for the card title.
24
+ * Receives the titleClass prop for consistent styling.
25
+ */
26
+ title?: (props: { titleClass: string }) => void;
27
+
28
+ /**
29
+ * Default slot - the main content of the card.
30
+ */
31
+ default?: () => void;
32
+ }>();
33
+
15
34
  defineProps({
35
+ /**
36
+ * The title of the card - displayed at the top
37
+ * If not provided, you can use the title slot instead
38
+ */
16
39
  title: {
17
40
  type: String,
18
41
  default: '',
@@ -32,13 +32,35 @@ defineOptions({
32
32
  inheritAttrs: false,
33
33
  });
34
34
 
35
- defineEmits(['update:modelValue']);
35
+ defineSlots<{
36
+ /**
37
+ * Content displayed before the checkbox
38
+ */
39
+ 'label-before'?: () => void;
40
+
41
+ /**
42
+ * Custom label content - overrides the label prop
43
+ */
44
+ label?: () => void;
45
+ }>();
46
+
47
+ defineEmits<{
48
+ /** Emitted when the checkbox value changes */
49
+ 'update:modelValue': [val: boolean];
50
+ }>();
36
51
 
37
52
  defineProps({
53
+ /**
54
+ * The checked state of the checkbox (v-model)
55
+ */
38
56
  modelValue: {
39
57
  type: Boolean,
40
58
  default: false,
41
59
  },
60
+ /**
61
+ * Text label for the checkbox
62
+ * Ignored if using the label slot
63
+ */
42
64
  label: {
43
65
  type: String,
44
66
  default: '',
@@ -31,18 +31,42 @@
31
31
  import { isObject } from 'lodash-es';
32
32
  import { defineComponent } from 'vue';
33
33
 
34
+ /**
35
+ * A chips component that displays a horizontal list of items with overflow handling.
36
+ * Automatically calculates how many chips can fit in the available space and shows
37
+ * an overflow indicator when there are more items than can be displayed.
38
+ * Supports custom item text properties and before/after slot content.
39
+ *
40
+ * @displayName PChips
41
+ */
34
42
  export default defineComponent({
35
43
  name: 'PChips',
36
44
  props: {
45
+ /**
46
+ * Array of items to display as chips.
47
+ * Can be strings or objects with a text property.
48
+ */
37
49
  items: {
38
50
  type: Array,
39
51
  default: () => [],
40
52
  },
53
+ /**
54
+ * Property name to use as the item display text.
55
+ * Used when items are objects to extract the text value.
56
+ */
41
57
  itemText: {
42
58
  type: String,
43
59
  default: 'text',
44
60
  },
45
61
  },
62
+ /**
63
+ * Emitted when a chip is clicked.
64
+ * @param {any} item - The clicked item
65
+ */
66
+ /**
67
+ * Emitted when the overflow indicator is clicked.
68
+ * Indicates that there are more chips than can be displayed.
69
+ */
46
70
  emits: ['click:chip', 'click:overflow'],
47
71
  data() {
48
72
  return {
@@ -11,13 +11,28 @@
11
11
  <script setup lang="ts">
12
12
  import { type PropType } from 'vue';
13
13
 
14
+ /**
15
+ * A close button component with different visual variants.
16
+ * Provides a consistent close button interface with hover effects and accessibility features.
17
+ * Supports different styling variants for various UI contexts.
18
+ *
19
+ * @displayName PCloseBtn
20
+ */
14
21
  defineOptions({
15
22
  name: 'PCloseBtn',
16
23
  });
17
24
 
25
+ /**
26
+ * Available visual variants for the close button.
27
+ */
18
28
  type Variant = 'transparent' | 'gray' | 'dark';
19
29
 
20
30
  defineProps({
31
+ /**
32
+ * The visual variant of the close button.
33
+ * Controls the background color and hover effects.
34
+ * Valid values: 'transparent', 'gray', 'dark'
35
+ */
21
36
  variant: {
22
37
  type: String as PropType<Variant>,
23
38
  default: 'transparent',
@@ -19,14 +19,33 @@ import PInput from '@squirrel/components/p-input/p-input.vue';
19
19
  import VueDatePicker, { type VueDatePickerProps } from '@vuepic/vue-datepicker';
20
20
  import { computed, useAttrs } from 'vue';
21
21
 
22
+ /**
23
+ * A date picker component that displays a dropdown calendar for date selection.
24
+ * Wraps VueDatePicker with a custom input field using PInput component.
25
+ * Supports custom labels, error states, and inherits all VueDatePicker props.
26
+ *
27
+ * @displayName PDatePicker
28
+ */
22
29
  defineOptions({
23
30
  name: 'PDatePicker',
24
31
  inheritAttrs: false,
25
32
  });
26
33
 
27
34
  type Props = {
35
+ /**
36
+ * Text label for the date picker field.
37
+ * Passed to the underlying PInput component.
38
+ */
28
39
  label?: string;
40
+ /**
41
+ * Error message to display below the date picker.
42
+ * Passed to the underlying PInput component and shows error styling.
43
+ */
29
44
  errorMsg?: string;
45
+ /**
46
+ * Whether the date picker is required.
47
+ * Passed to the underlying PInput component and adds visual indicator.
48
+ */
30
49
  required?: boolean;
31
50
  } & VueDatePickerProps;
32
51
 
@@ -44,6 +63,10 @@ const props = withDefaults(defineProps<Props>(), {
44
63
  format: 'dd-MMM-yyyy',
45
64
  });
46
65
 
66
+ /**
67
+ * The selected date value (v-model).
68
+ * Supports two-way binding for form inputs.
69
+ */
47
70
  const model = defineModel<Date | string | null>({ default: '' });
48
71
 
49
72
  // Data
@@ -70,7 +93,6 @@ const inputPropsAndAttrs = computed(() => {
70
93
  return res;
71
94
  });
72
95
 
73
- // Methods
74
96
  const handleInput = (e: Event, onInputFn: (e: Event) => void, onClearFn: (e: Event) => void) => {
75
97
  if (e.target instanceof HTMLInputElement && e.target.value === '') {
76
98
  onClearFn(e);