@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
@@ -84,6 +84,13 @@ import PAlert from '@squirrel/components/p-alert/p-alert.vue';
84
84
  import PCloseBtn from '@squirrel/components/p-close-btn/p-close-btn.vue';
85
85
  import { defineComponent } from 'vue';
86
86
 
87
+ /**
88
+ * A drawer component that slides in from the side with backdrop and animations.
89
+ * Provides a side panel interface with customizable position, width, and content areas.
90
+ * Supports teleporting to different DOM elements and comprehensive lifecycle events.
91
+ *
92
+ * @displayName PDrawer
93
+ */
87
94
  export default defineComponent({
88
95
  name: 'PDrawer',
89
96
  components: {
@@ -91,66 +98,132 @@ export default defineComponent({
91
98
  PCloseBtn,
92
99
  },
93
100
  props: {
101
+ /**
102
+ * Target element to append the drawer to.
103
+ * Usually 'body' for proper z-index stacking.
104
+ */
94
105
  appendTo: {
95
106
  type: String,
96
107
  default: 'body',
97
108
  },
109
+ /**
110
+ * Title displayed in the drawer header.
111
+ * Used for accessibility and visual identification.
112
+ */
98
113
  title: {
99
114
  type: String,
100
115
  default: '',
101
116
  },
117
+ /**
118
+ * Whether the drawer content is disabled.
119
+ * Prevents user interaction with drawer content.
120
+ */
102
121
  disabled: {
103
122
  type: Boolean,
104
123
  default: false,
105
124
  },
125
+ /**
126
+ * Error message to display in the drawer.
127
+ * Shows an error alert above the drawer content.
128
+ */
106
129
  errorMsg: {
107
130
  type: String,
108
131
  default: '',
109
132
  },
133
+ /**
134
+ * The position of the drawer on the screen.
135
+ * Valid values: 'left', 'right'
136
+ * @values left, right
137
+ */
110
138
  position: {
111
139
  type: String,
112
140
  default: 'right',
113
141
  },
142
+ /**
143
+ * Base z-index for the drawer.
144
+ * Higher values ensure the drawer appears above other content.
145
+ */
114
146
  zIndex: {
115
147
  type: Number,
116
148
  default: 900,
117
149
  },
150
+ /**
151
+ * Inline styles for the drawer element.
152
+ * Applied directly to the drawer element.
153
+ */
118
154
  drawerStyle: {
119
155
  type: Object,
120
156
  default: () => ({}),
121
157
  },
158
+ /**
159
+ * CSS class for the drawer container.
160
+ * Controls the base styling of the drawer.
161
+ */
122
162
  drawerClass: {
123
163
  type: String,
124
164
  default: 'drawer',
125
165
  },
166
+ /**
167
+ * CSS class for the drawer entrance animation.
168
+ * Overrides the default position-based animation.
169
+ */
126
170
  inClass: {
127
171
  type: String,
128
172
  default: '',
129
173
  },
174
+ /**
175
+ * CSS class for the drawer exit animation.
176
+ * Overrides the default position-based animation.
177
+ */
130
178
  outClass: {
131
179
  type: String,
132
180
  default: '',
133
181
  },
182
+ /**
183
+ * Whether the drawer should be mounted immediately.
184
+ * Useful for drawers that are always present in the DOM.
185
+ */
134
186
  live: {
135
187
  type: Boolean,
136
188
  default: false,
137
189
  },
190
+ /**
191
+ * Controls the visibility of the drawer (v-model).
192
+ * Supports two-way binding for drawer state.
193
+ */
138
194
  modelValue: {
139
195
  type: Boolean,
140
196
  default: false,
141
197
  },
198
+ /**
199
+ * Accessibility label for the close button.
200
+ * Used by screen readers for better accessibility.
201
+ */
142
202
  closeLabel: {
143
203
  type: String,
144
204
  default: 'Close',
145
205
  },
206
+ /**
207
+ * Whether to show the backdrop behind the drawer.
208
+ * When true, displays a semi-transparent overlay.
209
+ */
146
210
  showBackdrop: {
147
211
  type: Boolean,
148
212
  default: false,
149
213
  },
214
+ /**
215
+ * Whether the drawer can be closed by user interaction.
216
+ * Controls close button visibility and backdrop click behavior.
217
+ */
150
218
  enableClose: {
151
219
  type: Boolean,
152
220
  default: true,
153
221
  },
222
+ /**
223
+ * Width of the drawer.
224
+ * Must be a valid CSS width value ending with 'px'.
225
+ * @values 460px, 600px, 800px, etc.
226
+ */
154
227
  width: {
155
228
  type: String,
156
229
  default: '460px',
@@ -159,6 +232,28 @@ export default defineComponent({
159
232
  },
160
233
  },
161
234
  },
235
+ /**
236
+ * Emitted before the drawer starts opening.
237
+ */
238
+ /**
239
+ * Emitted when the drawer is opening (animation in progress).
240
+ */
241
+ /**
242
+ * Emitted when the drawer has finished opening.
243
+ */
244
+ /**
245
+ * Emitted before the drawer starts closing.
246
+ */
247
+ /**
248
+ * Emitted when the drawer is closing (animation in progress).
249
+ */
250
+ /**
251
+ * Emitted when the drawer has finished closing.
252
+ */
253
+ /**
254
+ * Emitted when the drawer visibility changes (v-model).
255
+ * @param {boolean} value - The new visibility state
256
+ */
162
257
  emits: ['update:modelValue', 'before-open', 'opening', 'opened', 'before-close', 'closing', 'closed'],
163
258
  data() {
164
259
  return {
@@ -90,6 +90,9 @@ import {
90
90
  } from '@squirrel/utils/listKeyboardNavigation';
91
91
  import { defineComponent } from 'vue';
92
92
 
93
+ /**
94
+ * Represents the VPopper component structure for type safety.
95
+ */
93
96
  type VPopper = {
94
97
  $refs: {
95
98
  popperContent: {
@@ -120,6 +123,13 @@ const nextFrame = () => {
120
123
  );
121
124
  };
122
125
 
126
+ /**
127
+ * A dropdown component that extends VDropdown with keyboard navigation and Pequity design system styling.
128
+ * Provides dropdown menu functionality with arrow key navigation, escape key closing, and customizable styling.
129
+ * Supports both dropdown lists and generic popover content with comprehensive accessibility features.
130
+ *
131
+ * @displayName PDropdown
132
+ */
123
133
  export default defineComponent({
124
134
  name: 'PDropdown',
125
135
  inheritAttrs: false,
@@ -134,6 +144,7 @@ export default defineComponent({
134
144
  },
135
145
  /**
136
146
  * Enables closing the dropdown with the Escape key.
147
+ * When true, pressing Escape will close the dropdown.
137
148
  */
138
149
  enableCloseOnEsc: {
139
150
  type: Boolean,
@@ -141,7 +152,7 @@ export default defineComponent({
141
152
  },
142
153
  /**
143
154
  * v-tooltip wraps the popper trigger with a div that has `display: inline-block` set by default.
144
- * This prop is used to override the CSS style of that wrapper div
155
+ * This prop is used to override the CSS style of that wrapper div.
145
156
  */
146
157
  triggerStyle: {
147
158
  type: Object,
@@ -224,6 +224,13 @@ import {
224
224
  type AnyValue = string | number | boolean | null | undefined | Record<string, unknown>;
225
225
  type AnyObject = Record<string, AnyValue>;
226
226
 
227
+ /**
228
+ * A dropdown select component with advanced features like search, multiple selection, and virtual scrolling.
229
+ * Provides a customizable dropdown interface with support for single/multiple selection, search filtering,
230
+ * pill display for multiple selections, and virtual scrolling for large datasets.
231
+ *
232
+ * @displayName PDropdownSelect
233
+ */
227
234
  defineOptions({
228
235
  name: 'PDropdownSelect',
229
236
  inheritAttrs: false,
@@ -241,6 +248,10 @@ defineSlots<{
241
248
  const emit = defineEmits(['update:modelValue', 'select', 'create']);
242
249
 
243
250
  const props = defineProps({
251
+ /**
252
+ * The selected value(s) for the dropdown (v-model).
253
+ * Can be a single value or array of values depending on multiple prop.
254
+ */
244
255
  modelValue: {
245
256
  type: [String, Number, Boolean, Array, Object] as PropType<ModelValue>,
246
257
  default: null,
@@ -262,18 +273,30 @@ const props = defineProps({
262
273
  type: Array as PropType<AnyValue[] | AnyObject[]>,
263
274
  default: () => [],
264
275
  },
276
+ /**
277
+ * Label text displayed above the dropdown.
278
+ */
265
279
  label: {
266
280
  type: String,
267
281
  default: '',
268
282
  },
283
+ /**
284
+ * Error message to display below the dropdown.
285
+ */
269
286
  errorMsg: {
270
287
  type: String,
271
288
  default: '',
272
289
  },
290
+ /**
291
+ * Whether the field is required.
292
+ */
273
293
  required: {
274
294
  type: Boolean,
275
295
  default: false,
276
296
  },
297
+ /**
298
+ * The size of the dropdown component.
299
+ */
277
300
  size: {
278
301
  type: String as PropType<Size>,
279
302
  default: 'md',
@@ -310,26 +333,44 @@ const props = defineProps({
310
333
  type: Number,
311
334
  default: 7,
312
335
  },
336
+ /**
337
+ * Additional attributes to apply to the dropdown menu.
338
+ */
313
339
  dropdownMenuAttrs: {
314
340
  type: Object,
315
341
  default: () => ({}),
316
342
  },
343
+ /**
344
+ * CSS classes to apply to the dropdown menu.
345
+ */
317
346
  dropdownMenuClass: {
318
347
  type: String,
319
348
  default: 'overflow-x-hidden',
320
349
  },
350
+ /**
351
+ * Inline styles to apply to the dropdown menu.
352
+ */
321
353
  dropdownMenuStyle: {
322
354
  type: Object,
323
355
  default: () => ({}),
324
356
  },
357
+ /**
358
+ * Props to pass to the underlying PDropdown component.
359
+ */
325
360
  pDropdownProps: {
326
361
  type: Object,
327
362
  default: () => ({}),
328
363
  },
364
+ /**
365
+ * Whether to enable search functionality within the dropdown.
366
+ */
329
367
  searchable: {
330
368
  type: Boolean,
331
369
  default: false,
332
370
  },
371
+ /**
372
+ * Whether to show a clear button when items are selected.
373
+ */
333
374
  clearable: {
334
375
  type: Boolean,
335
376
  default: false,
@@ -76,16 +76,31 @@ import { uniq } from 'lodash-es';
76
76
  import { computed, onMounted, type PropType, ref, shallowRef } from 'vue';
77
77
  import { useToast } from 'vue-toastification';
78
78
 
79
+ /**
80
+ * A file upload component with drag-and-drop support and comprehensive validation.
81
+ * Provides a user-friendly interface for file selection with visual feedback,
82
+ * file type validation, size limits, and multiple file support.
83
+ *
84
+ * @displayName PFileUpload
85
+ */
79
86
  defineOptions({
80
87
  name: 'PFileUpload',
81
88
  });
82
89
 
83
90
  // Props
84
91
  const props = defineProps({
92
+ /**
93
+ * The current file(s) value (v-model).
94
+ * Supports both single file and multiple files based on the multiple prop.
95
+ */
85
96
  modelValue: {
86
97
  type: [Object, Array] as PropType<FileUploadFile | FileUploadFile[]>,
87
98
  default: () => [],
88
99
  },
100
+ /**
101
+ * Whether multiple files can be selected.
102
+ * When true, allows selecting multiple files at once.
103
+ */
89
104
  multiple: {
90
105
  type: Boolean,
91
106
  default: false,
@@ -98,33 +113,73 @@ const props = defineProps({
98
113
  type: Array as PropType<string[] | readonly string[]>,
99
114
  default: () => [],
100
115
  },
116
+ /**
117
+ * Whether the file upload is disabled.
118
+ * Prevents user interaction when true.
119
+ */
101
120
  disabled: {
102
121
  type: Boolean,
103
122
  default: false,
104
123
  },
124
+ /**
125
+ * Whether the file upload is required.
126
+ * Adds required attribute and visual indicator.
127
+ */
105
128
  required: {
106
129
  type: Boolean,
107
130
  default: false,
108
131
  },
132
+ /**
133
+ * Error message to display below the file upload.
134
+ * When provided, the upload area will show error styling.
135
+ */
109
136
  errorMsg: {
110
137
  type: String,
111
138
  default: '',
112
139
  },
140
+ /**
141
+ * Text label for the file upload field.
142
+ * Displayed above the upload area.
143
+ */
113
144
  label: {
114
145
  type: String,
115
146
  default: '',
116
147
  },
148
+ /**
149
+ * Maximum file size in bytes.
150
+ * Files exceeding this size will be rejected with an error message.
151
+ */
117
152
  maxSizeInBytes: {
118
153
  type: Number,
119
154
  default: 256 * 1000, // 256 KB
120
155
  },
156
+ /**
157
+ * Maximum number of files that can be uploaded.
158
+ * Only applies when multiple is true.
159
+ */
121
160
  maxNumberOfFiles: {
122
161
  type: Number,
123
162
  default: 10,
124
163
  },
125
164
  });
126
165
 
127
- const emit = defineEmits(['update:modelValue', 'file-removed', 'file-added']);
166
+ const emit = defineEmits<{
167
+ /**
168
+ * Emitted when the file selection changes.
169
+ * @param {FileUploadFile | FileUploadFile[]} value - The new file selection
170
+ */
171
+ 'update:modelValue': [value: FileUploadFile | FileUploadFile[]];
172
+ /**
173
+ * Emitted when a file is removed from the selection.
174
+ * @param {FileUploadFile} file - The removed file
175
+ */
176
+ 'file-removed': [file: FileUploadFile];
177
+ /**
178
+ * Emitted when new files are added to the selection.
179
+ * @param {FileUploadFile[]} files - The newly added files
180
+ */
181
+ 'file-added': [files: FileUploadFile[]];
182
+ }>();
128
183
 
129
184
  // Data
130
185
  const fileInputRef = shallowRef<HTMLInputElement>();
@@ -217,9 +272,9 @@ const uploadFile = (e: Event | DragEvent) => {
217
272
  return;
218
273
  }
219
274
 
220
- const validatedFiles = props.fileTypes ? validateFiles(Array.from(f)) : f;
275
+ const validatedFiles = props.fileTypes ? validateFiles(Array.from(f)) : Array.from(f);
221
276
 
222
- files.value = props.multiple ? [...files.value, ...validatedFiles] : (validatedFiles as FileUploadFile[]);
277
+ files.value = props.multiple ? [...files.value, ...validatedFiles] : validatedFiles;
223
278
 
224
279
  emit('file-added', validatedFiles);
225
280
  };
@@ -2,7 +2,7 @@ export const P_ICON_ALIASES = {
2
2
  delete: 'octicon:trash-24',
3
3
  edit: 'simple-line-icons:pencil',
4
4
  send: 'mingcute:send-plane-fill',
5
- settings: 'heroicons:cog-8-tooth-20-solid',
5
+ settings: 'heroicons:cog-8-tooth',
6
6
  empty: 'ph:empty',
7
7
  'chevron-left': 'material-symbols:chevron-left-rounded',
8
8
  'chevron-right': 'material-symbols:chevron-right-rounded',
@@ -24,7 +24,7 @@ export const P_ICON_ALIASES = {
24
24
  copy: 'ph:copy',
25
25
  plus: 'ic:outline-plus',
26
26
  add: 'ic:outline-plus',
27
- more: 'lineicons:more-alt',
27
+ more: 'ep:more-filled',
28
28
  filters: 'mage:filter',
29
29
  'bar-chart': 'material-symbols:bar-chart-4-bars-rounded',
30
30
  list: 'material-symbols:format-list-bulleted',
@@ -33,6 +33,7 @@ export const P_ICON_ALIASES = {
33
33
  download: 'tdesign:download',
34
34
  upload: 'tdesign:upload',
35
35
  info: 'streamline:information-circle',
36
+ help: 'ph:question',
36
37
  search: 'streamline:magnifying-glass-solid',
37
38
  } as const;
38
39
 
@@ -7,15 +7,31 @@ import 'iconify-icon';
7
7
  import { P_ICON_ALIASES, type PIconAlias } from '@squirrel/components/p-icon/p-icon.types';
8
8
  import { type IconifyIconProperties } from 'iconify-icon';
9
9
 
10
+ /**
11
+ * An icon component that renders icons using Iconify.
12
+ * Supports both custom icon aliases and standard Iconify icon names.
13
+ * Inherits all IconifyIconProperties for full icon customization.
14
+ *
15
+ * @displayName PIcon
16
+ */
10
17
  defineOptions({
11
18
  name: 'PIcon',
12
19
  });
13
20
 
14
21
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
15
22
  interface Props extends /* @vue-ignore */ IconifyIconProperties {
23
+ /**
24
+ * The icon to display. Can be an icon alias or any valid Iconify icon name.
25
+ * Icon aliases provide consistent icon naming across the application.
26
+ */
16
27
  icon: PIconAlias | (string & {});
17
28
  }
18
29
 
30
+ /**
31
+ * Checks if the provided icon is an icon alias.
32
+ * @param {string} icon - The icon name to check
33
+ * @returns {boolean} True if the icon is an icon alias
34
+ */
19
35
  const isPIcon = (icon: string): icon is PIconAlias => !!P_ICON_ALIASES[icon as PIconAlias];
20
36
 
21
37
  defineProps<Props>();
@@ -10,11 +10,30 @@
10
10
  <script setup lang="ts">
11
11
  import PIcon from '@squirrel/components/p-icon/p-icon.vue';
12
12
 
13
+ /**
14
+ * An info icon component that displays a tooltip on hover.
15
+ * Shows an info icon with customizable tooltip content.
16
+ * Tooltip appears after 750ms delay and disappears immediately on mouse leave.
17
+ *
18
+ * @displayName PInfoIcon
19
+ */
13
20
  defineOptions({
14
21
  name: 'PInfoIcon',
15
22
  });
16
23
 
24
+ defineSlots<{
25
+ /**
26
+ * Custom tooltip content - overrides the text prop.
27
+ * Use this slot for custom tooltip content instead of the text prop.
28
+ */
29
+ default?: () => unknown;
30
+ }>();
31
+
17
32
  type Props = {
33
+ /**
34
+ * Text content for the tooltip.
35
+ * If not provided, you can use the default slot instead.
36
+ */
18
37
  text?: string | null;
19
38
  };
20
39
 
@@ -15,14 +15,42 @@ import { useInputClasses } from '@squirrel/composables/useInputClasses';
15
15
  import VueDatePicker, { type VueDatePickerProps } from '@vuepic/vue-datepicker';
16
16
  import { computed, type StyleValue, useAttrs } from 'vue';
17
17
 
18
+ /**
19
+ * An inline date picker component that displays a calendar for date selection.
20
+ * Wraps VueDatePicker with consistent styling and form integration.
21
+ * Supports custom labels, error states, and inherits all VueDatePicker props.
22
+ *
23
+ * @displayName PInlineDatePicker
24
+ */
18
25
  defineOptions({
19
26
  name: 'PInlineDatePicker',
20
27
  inheritAttrs: false,
21
28
  });
22
29
 
30
+ defineSlots<{
31
+ /**
32
+ * Custom label content - overrides the label prop.
33
+ * @param {string} label - The label text
34
+ * @param {string} label-classes - CSS classes for the label
35
+ */
36
+ label?: (props: { label: string; labelClasses: string }) => unknown;
37
+ }>();
38
+
23
39
  type Props = {
40
+ /**
41
+ * Text label for the date picker field.
42
+ * If not provided, you can use the label slot instead.
43
+ */
24
44
  label?: string;
45
+ /**
46
+ * Error message to display below the date picker.
47
+ * When provided, the date picker will show error styling.
48
+ */
25
49
  errorMsg?: string;
50
+ /**
51
+ * Whether the date picker is required.
52
+ * Adds required attribute and visual indicator.
53
+ */
26
54
  required?: boolean;
27
55
  } & VueDatePickerProps;
28
56
 
@@ -38,6 +66,10 @@ const props = withDefaults(defineProps<Props>(), {
38
66
  weekStart: 0,
39
67
  });
40
68
 
69
+ /**
70
+ * The selected date value (v-model).
71
+ * Supports two-way binding for form inputs.
72
+ */
41
73
  const model = defineModel<Date | string | null>({ default: '' });
42
74
 
43
75
  // Data
@@ -7,6 +7,7 @@
7
7
  </slot>
8
8
  <div class="relative w-full">
9
9
  <div v-if="!!$slots.prefix">
10
+ <!-- Slot for content displayed before the input field -->
10
11
  <slot name="prefix"></slot>
11
12
  </div>
12
13
  <input
@@ -17,6 +18,7 @@
17
18
  @input="(event: Event) => $emit('update:modelValue', (event.target as HTMLInputElement).value)"
18
19
  />
19
20
  <div v-if="!!$slots.suffix">
21
+ <!-- Slot for content displayed after the input field -->
20
22
  <slot name="suffix"></slot>
21
23
  </div>
22
24
  </div>
@@ -36,18 +38,56 @@ type InputType = (typeof INPUT_TYPES)[InputTypeKeys];
36
38
  </script>
37
39
 
38
40
  <script setup lang="ts">
41
+ /**
42
+ * A versatile input component that supports various types, sizes, and states.
43
+ * Provides consistent styling and behavior across different input types.
44
+ * Supports custom labels, error states, and prefix/suffix content.
45
+ */
39
46
  defineOptions({
40
47
  name: 'PInput',
41
48
  inheritAttrs: false,
42
49
  });
43
50
 
44
- defineEmits(['update:modelValue']);
51
+ defineEmits<{
52
+ /**
53
+ * Emitted when the input value changes.
54
+ * @param {string} value - The new input value
55
+ */
56
+ 'update:modelValue': [value: string];
57
+ }>();
58
+
59
+ defineSlots<{
60
+ /**
61
+ * Custom label content - overrides the label prop.
62
+ * @param {string} label - The label text
63
+ * @param {string} label-classes - CSS classes for the label
64
+ */
65
+ label?: (props: { label: string; labelClasses: string }) => unknown;
66
+
67
+ /**
68
+ * Content displayed before the input field.
69
+ */
70
+ prefix?: () => unknown;
71
+
72
+ /**
73
+ * Content displayed after the input field.
74
+ */
75
+ suffix?: () => unknown;
76
+ }>();
45
77
 
46
78
  const props = defineProps({
79
+ /**
80
+ * The current value of the input (v-model).
81
+ * Supports two-way binding for form inputs.
82
+ */
47
83
  modelValue: {
48
84
  type: [String, Number, Boolean, null] as PropType<string | number | boolean | null>,
49
85
  default: '',
50
86
  },
87
+ /**
88
+ * The type of the input field.
89
+ * Valid values: 'text', 'password'
90
+ */
51
91
  type: {
52
92
  type: String as PropType<InputType>,
53
93
  default: INPUT_TYPES.TEXT,
@@ -55,18 +95,34 @@ const props = defineProps({
55
95
  return Object.values(INPUT_TYPES).includes(value);
56
96
  },
57
97
  },
98
+ /**
99
+ * Text label for the input field.
100
+ * If not provided, you can use the label slot instead.
101
+ */
58
102
  label: {
59
103
  type: String,
60
104
  default: '',
61
105
  },
106
+ /**
107
+ * Error message to display below the input.
108
+ * When provided, the input will show error styling.
109
+ */
62
110
  errorMsg: {
63
111
  type: String,
64
112
  default: '',
65
113
  },
114
+ /**
115
+ * Whether the input is required.
116
+ * Adds required attribute and visual indicator.
117
+ */
66
118
  required: {
67
119
  type: Boolean,
68
120
  default: false,
69
121
  },
122
+ /**
123
+ * The size of the input - affects padding, font size, and spacing.
124
+ * Valid values: 'sm', 'md', 'lg'
125
+ */
70
126
  size: {
71
127
  type: String as PropType<Size>,
72
128
  default: 'md',
@@ -74,6 +130,10 @@ const props = defineProps({
74
130
  return SIZES.includes(value);
75
131
  },
76
132
  },
133
+ /**
134
+ * Whether the input has rounded corners.
135
+ * Applies rounded styling to the input field.
136
+ */
77
137
  rounded: {
78
138
  type: Boolean,
79
139
  default: false,