@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
@@ -11,20 +11,47 @@
11
11
  </template>
12
12
 
13
13
  <script setup lang="ts">
14
+ /**
15
+ * A progress bar component that displays multiple progress segments with different colors.
16
+ * Each segment represents a portion of the total progress and can have its own color
17
+ * and optional label. Useful for showing complex progress states or multi-part progress.
18
+ *
19
+ * @displayName PProgressBar
20
+ */
21
+ defineOptions({
22
+ name: 'PProgressBar',
23
+ });
24
+
25
+ /**
26
+ * Represents a single progress segment with its value, color, and optional label.
27
+ */
14
28
  export type ProgressItem = {
29
+ /**
30
+ * The numeric value of this progress segment.
31
+ */
15
32
  value: number;
33
+ /**
34
+ * The background color for this progress segment.
35
+ */
16
36
  color: string;
37
+ /**
38
+ * Optional label to display on hover tooltip.
39
+ */
17
40
  label?: string;
18
41
  };
19
42
 
20
43
  type Props = {
44
+ /**
45
+ * The total value used to calculate percentage widths.
46
+ * All segment values should sum to this total for accurate representation.
47
+ */
21
48
  total: number;
49
+ /**
50
+ * Array of progress segments to display.
51
+ * Each item represents a portion of the total progress.
52
+ */
22
53
  items: ProgressItem[];
23
54
  };
24
55
 
25
- defineOptions({
26
- name: 'PProgressBar',
27
- });
28
-
29
56
  defineProps<Props>();
30
57
  </script>
@@ -6,12 +6,29 @@
6
6
  import PIcon from '@squirrel/components/p-icon/p-icon.vue';
7
7
  import { computed } from 'vue';
8
8
 
9
+ /**
10
+ * A ring loader component that displays a spinning ring animation.
11
+ * Provides a consistent loading indicator with customizable size and color.
12
+ * Uses an SVG spinner icon with smooth animation.
13
+ *
14
+ * @displayName PRingLoader
15
+ */
9
16
  defineOptions({
10
17
  name: 'PRingLoader',
11
18
  });
12
19
 
13
20
  type Props = {
21
+ /**
22
+ * The size of the ring loader in pixels.
23
+ * Controls the overall dimensions of the spinner.
24
+ * Default: 80px
25
+ */
14
26
  size?: number;
27
+ /**
28
+ * Custom color for the ring loader.
29
+ * Overrides the default blue color when provided.
30
+ * Can be any valid CSS color value.
31
+ */
15
32
  color?: string;
16
33
  };
17
34
 
@@ -20,6 +20,14 @@ import { useInputClasses } from '@squirrel/composables/useInputClasses';
20
20
  import { type PropType, type StyleValue } from 'vue';
21
21
  import { computed, useAttrs } from 'vue';
22
22
 
23
+ /**
24
+ * A select dropdown component for choosing from a list of options.
25
+ * Provides consistent styling and behavior with other form components.
26
+ * Supports custom labels, error states, and flexible item structure.
27
+ * Automatically handles null values and boolean conversions.
28
+ *
29
+ * @displayName PSelect
30
+ */
23
31
  defineOptions({
24
32
  name: 'PSelect',
25
33
  inheritAttrs: false,
@@ -27,27 +35,61 @@ defineOptions({
27
35
 
28
36
  const emit = defineEmits(['update:modelValue']);
29
37
 
38
+ defineSlots<{
39
+ /**
40
+ * Custom label content - overrides the label prop.
41
+ * @param {string} label - The label text
42
+ * @param {string} label-classes - CSS classes for the label
43
+ */
44
+ label?: (props: { label: string; labelClasses: string }) => unknown;
45
+ }>();
46
+
30
47
  const props = defineProps({
48
+ /**
49
+ * The current selected value (v-model).
50
+ * Supports two-way binding for form inputs.
51
+ */
31
52
  modelValue: {
32
53
  type: [String, Number, Boolean, null] as PropType<string | number | boolean | null>,
33
54
  default: '',
34
55
  },
56
+ /**
57
+ * Array of objects representing the select options.
58
+ * Each object should have properties specified by itemText and itemValue.
59
+ * @example [{ text: 'Option 1', value: 1 }, { text: 'Option 2', value: 2 }]
60
+ */
35
61
  items: {
36
62
  type: Array as PropType<Record<string, unknown>[]>,
37
63
  default: () => [],
38
64
  },
65
+ /**
66
+ * Text label for the select field.
67
+ * If not provided, you can use the label slot instead.
68
+ */
39
69
  label: {
40
70
  type: String,
41
71
  default: '',
42
72
  },
73
+ /**
74
+ * Error message to display below the select.
75
+ * When provided, the select will show error styling.
76
+ */
43
77
  errorMsg: {
44
78
  type: String,
45
79
  default: '',
46
80
  },
81
+ /**
82
+ * Whether the select is required.
83
+ * Adds required attribute and visual indicator.
84
+ */
47
85
  required: {
48
86
  type: Boolean,
49
87
  default: false,
50
88
  },
89
+ /**
90
+ * The size of the select - affects padding, font size, and spacing.
91
+ * Valid values: 'sm', 'md', 'lg'
92
+ */
51
93
  size: {
52
94
  type: String as PropType<Size>,
53
95
  default: 'md',
@@ -55,10 +97,18 @@ const props = defineProps({
55
97
  return SIZES.includes(value);
56
98
  },
57
99
  },
100
+ /**
101
+ * Property name to use as the display text for each option.
102
+ * Defaults to 'text' - each item should have this property.
103
+ */
58
104
  itemText: {
59
105
  type: String,
60
106
  default: 'text',
61
107
  },
108
+ /**
109
+ * Property name to use as the value for each option.
110
+ * Defaults to 'value' - each item should have this property.
111
+ */
62
112
  itemValue: {
63
113
  type: [String, Number, Boolean, null] as PropType<string | number | boolean | null>,
64
114
  default: 'value',
@@ -98,7 +148,6 @@ const innerOptions = computed(() => {
98
148
  });
99
149
  });
100
150
 
101
- // Methods
102
151
  const onChange = (e: Event) => {
103
152
  const value = (e.target as HTMLSelectElement).value;
104
153
 
@@ -31,19 +31,71 @@
31
31
  import { type Size } from '@squirrel/components/p-btn/p-btn.types';
32
32
  import PBtn from '@squirrel/components/p-btn/p-btn.vue';
33
33
 
34
+ /**
35
+ * A select button group component that displays multiple buttons as a connected group.
36
+ * Provides a button-based selection interface with support for single/multiple selection,
37
+ * custom styling, tooltips, and flexible item structure.
38
+ *
39
+ * @displayName PSelectBtn
40
+ */
34
41
  type BtnGroupItem = Record<string, string | number | boolean>;
35
42
 
36
43
  type Props = {
37
- modelValue?: string | number | null | BtnGroupItem[];
44
+ /**
45
+ * The current selected value(s) (v-model).
46
+ * For single selection: string, number, boolean, or null
47
+ * For multiple selection: array of BtnGroupItem objects
48
+ */
49
+ modelValue?: string | number | boolean | null | BtnGroupItem[];
50
+ /**
51
+ * Array of items to display as buttons.
52
+ * Each item should have properties matching itemValue, itemText, and itemTooltipText.
53
+ */
38
54
  items?: BtnGroupItem[] | readonly BtnGroupItem[];
55
+ /**
56
+ * Property name to use as the item value.
57
+ * Used for selection comparison and v-model binding.
58
+ */
39
59
  itemValue?: string | number;
60
+ /**
61
+ * Property name to use as the item display text.
62
+ * Used for button label content.
63
+ */
40
64
  itemText?: string;
65
+ /**
66
+ * Property name to use as the item tooltip text.
67
+ * Used when showTooltip is enabled.
68
+ */
41
69
  itemTooltipText?: string;
70
+ /**
71
+ * The size of the buttons in the group.
72
+ * Valid values: 'sm', 'md', 'lg'
73
+ */
42
74
  size?: Size;
75
+ /**
76
+ * Whether to show tooltips on button hover.
77
+ * Uses the itemTooltipText property for tooltip content.
78
+ */
43
79
  showTooltip?: boolean;
80
+ /**
81
+ * Whether to highlight selected buttons visually.
82
+ * Applies selected styling to chosen buttons.
83
+ */
44
84
  highlightSelected?: boolean;
85
+ /**
86
+ * Whether buttons should grow to fill available space.
87
+ * Makes all buttons equal width within the container.
88
+ */
45
89
  grow?: boolean;
90
+ /**
91
+ * Whether multiple items can be selected simultaneously.
92
+ * When true, modelValue becomes an array of selected items.
93
+ */
46
94
  multiple?: boolean;
95
+ /**
96
+ * Whether to remove padding from button containers.
97
+ * Useful for custom spacing control.
98
+ */
47
99
  noPadding?: boolean;
48
100
  };
49
101
 
@@ -51,7 +103,23 @@ defineOptions({
51
103
  name: 'PSelectBtn',
52
104
  });
53
105
 
54
- const emit = defineEmits(['update:modelValue']);
106
+ defineSlots<{
107
+ /**
108
+ * Custom content for each button in the group.
109
+ * Overrides the default item text display.
110
+ * @param {BtnGroupItem} item - The current item data
111
+ * @param {boolean} isSelected - Whether the current item is selected
112
+ */
113
+ [key: `btn-${number}`]: (props: { item: BtnGroupItem; isSelected: boolean }) => unknown;
114
+ }>();
115
+
116
+ const emit = defineEmits<{
117
+ /**
118
+ * Emitted when the selection changes.
119
+ * @param {string | number | boolean | null | BtnGroupItem[]} value - The new selected value(s)
120
+ */
121
+ 'update:modelValue': [value: string | number | boolean | null | BtnGroupItem[]];
122
+ }>();
55
123
 
56
124
  // Props
57
125
  const props = withDefaults(defineProps<Props>(), {
@@ -69,10 +137,22 @@ const props = withDefaults(defineProps<Props>(), {
69
137
  });
70
138
 
71
139
  // Methods
140
+ /**
141
+ * Gets the tooltip text for a given item.
142
+ * Returns the item's tooltip text if showTooltip is enabled, otherwise empty string.
143
+ * @param {BtnGroupItem} item - The item to get tooltip text for
144
+ * @returns {string} The tooltip text or empty string
145
+ */
72
146
  const tooltipText = (item: BtnGroupItem) => {
73
147
  return props.showTooltip ? item[props.itemTooltipText] : '';
74
148
  };
75
149
 
150
+ /**
151
+ * Handles item selection based on single/multiple mode.
152
+ * For single selection: emits the item value directly.
153
+ * For multiple selection: toggles the item in the selection array.
154
+ * @param {BtnGroupItem} item - The item being selected
155
+ */
76
156
  const select = (item: BtnGroupItem) => {
77
157
  if (!props.multiple) {
78
158
  emit('update:modelValue', item[props.itemValue]);
@@ -95,6 +175,13 @@ const select = (item: BtnGroupItem) => {
95
175
  }
96
176
  };
97
177
 
178
+ /**
179
+ * Checks if a given item is currently selected.
180
+ * For single selection: compares with modelValue directly.
181
+ * For multiple selection: checks if item exists in modelValue array.
182
+ * @param {BtnGroupItem} item - The item to check
183
+ * @returns {boolean} True if the item is selected
184
+ */
98
185
  const isSelected = (item: BtnGroupItem) => {
99
186
  if (!props.multiple) {
100
187
  return props.modelValue === item[props.itemValue];
@@ -105,5 +192,6 @@ const isSelected = (item: BtnGroupItem) => {
105
192
  return index !== -1;
106
193
  }
107
194
  }
195
+ return false;
108
196
  };
109
197
  </script>
@@ -133,6 +133,13 @@ import { toString } from '@squirrel/utils/string';
133
133
  import { splitStringForHighlight } from '@squirrel/utils/text';
134
134
  import { type ComponentPublicInstance, computed, onMounted, type PropType, ref, type StyleValue, useAttrs } from 'vue';
135
135
 
136
+ /**
137
+ * A select list component with advanced features like search, multiple selection, and virtual scrolling.
138
+ * Provides a customizable list interface with support for single/multiple selection, search filtering,
139
+ * and virtual scrolling for large datasets.
140
+ *
141
+ * @displayName PSelectList
142
+ */
136
143
  defineOptions({
137
144
  name: 'PSelectList',
138
145
  inheritAttrs: false,
@@ -30,10 +30,17 @@
30
30
  <script lang="ts">
31
31
  import { defineComponent, type PropType } from 'vue';
32
32
 
33
+ /**
34
+ * Represents a single option in the select pill component.
35
+ */
33
36
  type Option = Record<string, unknown> & {
37
+ /** Display text for the option */
34
38
  text: string;
39
+ /** Optional subtext displayed below the main text */
35
40
  subtext?: string;
41
+ /** Unique value identifier for the option */
36
42
  value: string | number;
43
+ /** Whether the option is disabled and cannot be selected */
37
44
  disabled?: boolean;
38
45
  };
39
46
 
@@ -46,6 +53,8 @@ const ACTIVE_CLASS = 'text-p-purple-60';
46
53
  * In cases that p-select-pill is rendered before its parent component is visible,
47
54
  * we need to calculate the offsets by cloning the container div and put it in the DOM momentarily.
48
55
  * This way the buttons actually have measurable dimensions.
56
+ * @param {HTMLElement} container - The container element to clone
57
+ * @returns {Object} Object containing width and left position of the active button
49
58
  */
50
59
  const getOffsetValues = (container: HTMLElement) => {
51
60
  const el = container.cloneNode(true) as HTMLElement;
@@ -60,29 +69,61 @@ const getOffsetValues = (container: HTMLElement) => {
60
69
  return res;
61
70
  };
62
71
 
72
+ /**
73
+ * A select pill component that displays options as connected buttons with a sliding indicator.
74
+ * Provides a pill-style selection interface with smooth animations and visual feedback.
75
+ * The active option is highlighted with a sliding background indicator.
76
+ *
77
+ * @displayName PSelectPill
78
+ */
63
79
  export default defineComponent({
64
80
  name: 'PSelectPill',
65
81
  props: {
82
+ /**
83
+ * The currently selected value (v-model).
84
+ * Should match one of the item values in the items array.
85
+ */
66
86
  modelValue: {
67
87
  type: [String, Number],
68
88
  default: '',
69
89
  },
90
+ /**
91
+ * Array of options to display as pills.
92
+ * Each option should have text, value, and optional subtext and disabled properties.
93
+ */
70
94
  items: {
71
95
  type: Array as PropType<Option[] | [] | undefined | null>,
72
96
  default: () => [],
73
97
  },
98
+ /**
99
+ * Property name to use as the item display text.
100
+ * Used for button label content.
101
+ */
74
102
  itemText: {
75
103
  type: String,
76
104
  default: 'text',
77
105
  },
106
+ /**
107
+ * Property name to use as the item subtext.
108
+ * Displayed below the main text when provided.
109
+ */
78
110
  itemSubtext: {
79
111
  type: String,
80
112
  default: 'subtext',
81
113
  },
114
+ /**
115
+ * Property name to use as the item value.
116
+ * Used for selection comparison and v-model binding.
117
+ */
82
118
  itemValue: {
83
119
  type: [String, Number],
84
120
  default: 'value',
85
121
  },
122
+ /**
123
+ * The size of the pill buttons.
124
+ * Valid values: 'sm', 'md', 'lg'
125
+ * @values sm, md, lg
126
+ */
86
127
  size: {
87
128
  type: String as PropType<Size>,
88
129
  default: 'md',
@@ -91,7 +132,13 @@ export default defineComponent({
91
132
  },
92
133
  },
93
134
  },
94
- emits: ['update:modelValue'],
135
+ emits: {
136
+ /**
137
+ * Emitted when the selected value changes.
138
+ * @param {string | number} value - The new selected value
139
+ */
140
+ 'update:modelValue': (value: string | number) => true,
141
+ },
95
142
  data() {
96
143
  return {
97
144
  SIZES,
@@ -118,7 +165,10 @@ export default defineComponent({
118
165
  methods: {
119
166
  click(e: Event, option: Option) {
120
167
  if (!option.disabled) {
121
- this.$emit('update:modelValue', option[this.itemValue]);
168
+ const value = option[this.itemValue];
169
+ if (typeof value === 'string' || typeof value === 'number') {
170
+ this.$emit('update:modelValue', value);
171
+ }
122
172
  }
123
173
  },
124
174
  setPillStyle() {
@@ -30,9 +30,21 @@ const isHexColor = (hexColor: string) => {
30
30
 
31
31
  const hexToRgb = (hex: string) => `${hex.match(/\w\w/g)?.map((x) => +`0x${x}`)}`;
32
32
 
33
+ /**
34
+ * A skeleton loader component that displays animated loading placeholders.
35
+ * Provides customizable shapes, colors, and shimmer effects to indicate
36
+ * content loading states. Supports both rectangle and circle shapes with
37
+ * configurable background and shimmer colors.
38
+ *
39
+ * @displayName PSkeletonLoader
40
+ */
33
41
  export default defineComponent({
34
42
  name: 'PSkeletonLoader',
35
43
  props: {
44
+ /**
45
+ * The shape type of the skeleton loader.
46
+ * Determines the border radius and overall appearance.
47
+ */
36
48
  type: {
37
49
  type: String as PropType<LoaderType>,
38
50
  default: LOADER_TYPES.rectangle,
@@ -40,14 +52,26 @@ export default defineComponent({
40
52
  return Object.values(LOADER_TYPES).includes(value);
41
53
  },
42
54
  },
55
+ /**
56
+ * The background CSS class for the skeleton loader.
57
+ * Controls the base color of the loading placeholder.
58
+ */
43
59
  bgClass: {
44
60
  type: String,
45
61
  default: 'bg-p-gray-30',
46
62
  },
63
+ /**
64
+ * Additional CSS classes to apply to the loader.
65
+ * Allows for custom styling beyond the default type-based classes.
66
+ */
47
67
  cssClass: {
48
68
  type: String,
49
69
  default: '',
50
70
  },
71
+ /**
72
+ * The color of the shimmer effect in hex format.
73
+ * Controls the color of the animated shimmer overlay.
74
+ */
51
75
  shimmerColor: {
52
76
  type: String,
53
77
  default: SHIMMER_COLOR,
@@ -25,13 +25,32 @@ import type { StepItem } from '@squirrel/components/p-steps/p-steps.types';
25
25
  import { startCase } from 'lodash-es';
26
26
  import { computed } from 'vue';
27
27
 
28
+ /**
29
+ * A steps component that displays a sequence of steps with visual indicators.
30
+ * Shows the current step, completed steps, and upcoming steps with different styling.
31
+ * Supports clickable steps and custom step text with automatic fallback to formatted step values.
32
+ *
33
+ * @displayName PSteps
34
+ */
28
35
  defineOptions({
29
36
  name: 'PSteps',
30
37
  });
31
38
 
32
39
  type Props = {
40
+ /**
41
+ * The currently active step value.
42
+ * Should match one of the step values in the steps array.
43
+ */
33
44
  activeStep?: StepItem['value'];
45
+ /**
46
+ * Array of step items to display.
47
+ * Each step should have a value and optional text and disabled properties.
48
+ */
34
49
  steps?: readonly StepItem[];
50
+ /**
51
+ * Whether steps are clickable to navigate between them.
52
+ * When true, steps become interactive and emit click events.
53
+ */
35
54
  clickable?: boolean;
36
55
  };
37
56
 
@@ -42,6 +61,12 @@ const props = withDefaults(defineProps<Props>(), {
42
61
  });
43
62
 
44
63
  const emit = defineEmits<{
64
+ /**
65
+ * Emitted when a step is clicked.
66
+ * Only emitted when clickable is true and the step is not disabled.
67
+ * @param {StepItem} step - The clicked step item
68
+ * @param {number} index - The index of the clicked step
69
+ */
45
70
  'click:step': [step: StepItem, index: number];
46
71
  }>();
47
72
 
@@ -114,19 +114,58 @@ import { kebabCase } from 'lodash-es';
114
114
  import { computed, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue';
115
115
 
116
116
  type Props = {
117
+ /**
118
+ * Array of column definitions for the table.
119
+ * Each column defines its display properties, filtering, and styling.
120
+ */
117
121
  cols: TableCol[];
122
+ /**
123
+ * Whether columns can be resized by dragging.
124
+ * Enables column width adjustment functionality.
125
+ */
118
126
  colsResizable?: boolean;
127
+ /**
128
+ * Whether the first column is fixed in position.
129
+ * Useful for keeping important columns visible during horizontal scrolling.
130
+ */
119
131
  isFirstColFixed?: boolean;
132
+ /**
133
+ * Whether the last column is fixed in position.
134
+ * Useful for keeping action columns visible during horizontal scrolling.
135
+ */
120
136
  isLastColFixed?: boolean;
137
+ /**
138
+ * Whether to prevent horizontal scrolling.
139
+ * Forces the table to fit within its container.
140
+ */
121
141
  lockScroll?: boolean;
142
+ /**
143
+ * Whether to show subheader content below the main header.
144
+ * Provides additional header information or controls.
145
+ */
122
146
  subheader?: boolean;
147
+ /**
148
+ * Virtual scrolling configuration for large datasets.
149
+ * Controls padding for virtualized rows.
150
+ */
123
151
  virtualizer?: {
124
152
  paddingTop: number;
125
153
  paddingBottom: number;
126
154
  };
155
+ /**
156
+ * Array of data objects to display in the table.
157
+ * Each object should have properties matching the column names.
158
+ */
127
159
  data?: T[];
128
160
  };
129
161
 
162
+ /**
163
+ * A comprehensive table component with advanced features like column resizing, fixed columns, and virtual scrolling.
164
+ * Provides a flexible table interface with support for custom cell rendering, column filtering, and responsive design.
165
+ * Supports both simple data display and complex interactive features.
166
+ *
167
+ * @displayName PTable
168
+ */
130
169
  defineOptions({ name: 'PTable' });
131
170
 
132
171
  const emit = defineEmits<{
@@ -3,12 +3,21 @@
3
3
  </template>
4
4
 
5
5
  <script setup lang="ts">
6
+ /**
7
+ * A filter icon component for table headers, used to indicate and toggle filter state.
8
+ * Changes its appearance based on the active state and supports hover effects.
9
+ *
10
+ * @displayName PTableFilterIcon
11
+ */
6
12
  defineOptions({
7
13
  name: 'PTableFilterIcon',
8
14
  inheritAttrs: false,
9
15
  });
10
16
 
11
17
  defineProps({
18
+ /**
19
+ * Whether the filter icon is active (filtered state).
20
+ */
12
21
  active: {
13
22
  type: Boolean,
14
23
  default: false,