@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
@@ -25,6 +25,13 @@ import { defineComponent } from 'vue';
25
25
 
26
26
  const DEFAULT_CLASSES = `text-xs leading-5 font-semibold truncate shrink`;
27
27
 
28
+ /**
29
+ * A table header cell component that displays text with optional tooltip and filter icon.
30
+ * Provides consistent styling for table headers with support for custom text colors,
31
+ * tooltips, and filter functionality.
32
+ *
33
+ * @displayName PTableHeaderCell
34
+ */
28
35
  export default defineComponent({
29
36
  name: 'PTableHeaderCell',
30
37
  components: {
@@ -32,31 +39,60 @@ export default defineComponent({
32
39
  PInfoIcon,
33
40
  },
34
41
  props: {
42
+ /**
43
+ * The text content to display in the header cell.
44
+ * Also used as the title attribute for accessibility.
45
+ */
35
46
  text: {
36
47
  type: String,
37
48
  default: '',
38
49
  },
50
+ /**
51
+ * CSS classes to apply to the text element.
52
+ * Can be a string, object, or array for flexible styling.
53
+ */
39
54
  textClass: {
40
55
  type: [String, Object, Array],
41
56
  default: 'text-left',
42
57
  },
58
+ /**
59
+ * Whether the filter icon is in an active state.
60
+ * Controls the visual appearance of the filter icon and text color.
61
+ */
43
62
  filterActive: {
44
63
  type: Boolean,
45
64
  default: false,
46
65
  },
66
+ /**
67
+ * Whether to show the filter icon.
68
+ * When false, the filter icon is hidden regardless of other states.
69
+ */
47
70
  showFilterIcon: {
48
71
  type: Boolean,
49
72
  default: false,
50
73
  },
74
+ /**
75
+ * Tooltip text to display when hovering over the info icon.
76
+ * When provided, shows an info icon with the tooltip content.
77
+ */
51
78
  tooltipText: {
52
79
  type: String,
53
80
  default: '',
54
81
  },
82
+ /**
83
+ * Custom text color to apply to the header text.
84
+ * Overrides the default text color when provided.
85
+ */
55
86
  textColor: {
56
87
  type: String,
57
88
  default: '',
58
89
  },
59
90
  },
91
+ /**
92
+ * Emitted when the filter icon is clicked.
93
+ * @param {Event} event - The click event
94
+ * @param {boolean} filterActive - The current filter active state
95
+ */
60
96
  emits: ['click-filter-icon'],
61
97
  data() {
62
98
  return {
@@ -25,27 +25,55 @@
25
25
  <script setup lang="ts">
26
26
  import PSkeletonLoader from '@squirrel/components/p-skeleton-loader/p-skeleton-loader.vue';
27
27
 
28
+ /**
29
+ * A table skeleton loader component that displays a loading placeholder for table data.
30
+ * Renders a complete table structure with skeleton loaders for headers and data cells.
31
+ * Supports customizable dimensions, styling, and optional subheaders to match
32
+ * the expected table layout during loading states.
33
+ *
34
+ * @displayName PTableLoader
35
+ */
28
36
  defineOptions({
29
37
  name: 'PTableLoader',
30
38
  });
31
39
 
32
40
  defineProps({
41
+ /**
42
+ * The number of rows to display in the skeleton table.
43
+ * Controls the vertical size of the loading placeholder.
44
+ */
33
45
  rows: {
34
46
  type: [Number, String],
35
47
  default: 4,
36
48
  },
49
+ /**
50
+ * The number of columns to display in the skeleton table.
51
+ * Controls the horizontal size of the loading placeholder.
52
+ */
37
53
  columns: {
38
54
  type: [Number, String],
39
55
  default: 6,
40
56
  },
57
+ /**
58
+ * CSS classes to apply to each table cell.
59
+ * Allows customization of cell padding and styling.
60
+ */
41
61
  tdClasses: {
42
62
  type: String,
43
63
  default: 'px-4 py-5',
44
64
  },
65
+ /**
66
+ * CSS classes to apply to the skeleton loader within each cell.
67
+ * Controls the height and appearance of individual skeleton elements.
68
+ */
45
69
  tdSkeletonClasses: {
46
70
  type: String,
47
71
  default: 'h-5',
48
72
  },
73
+ /**
74
+ * Whether to display subheaders in the table header.
75
+ * Adds an additional row below the main header for more complex table structures.
76
+ */
49
77
  withSubheader: {
50
78
  type: Boolean,
51
79
  default: false,
@@ -59,13 +59,31 @@
59
59
  import { SORTING_TYPES, type SortingType } from '@squirrel/components/p-table-sort/p-table-sort.config';
60
60
  import { type PropType } from 'vue';
61
61
 
62
+ /**
63
+ * A table sorting component that provides ascending, descending, and no-sorting options.
64
+ * Displays sort options with visual indicators and allows clearing the sort state.
65
+ * Used for table column sorting functionality.
66
+ *
67
+ * @displayName PTableSort
68
+ */
62
69
  defineOptions({
63
70
  name: 'PTableSort',
64
71
  });
65
72
 
66
- defineEmits(['update:modelValue']);
73
+ defineEmits<{
74
+ /**
75
+ * Emitted when the sorting state changes.
76
+ * @param {SortingType} value - The new sorting state
77
+ */
78
+ 'update:modelValue': [value: SortingType];
79
+ }>();
67
80
 
68
81
  defineProps({
82
+ /**
83
+ * The current sorting state (v-model).
84
+ * Valid values: 'asc', 'desc', 'no-sorting'
85
+ * Controls which sort option is visually active.
86
+ */
69
87
  modelValue: {
70
88
  type: String as PropType<SortingType>,
71
89
  default: SORTING_TYPES.NO_SORTING,
@@ -22,11 +22,31 @@ import {
22
22
  } from '@squirrel/components/p-table/p-table.types';
23
23
  import { computed, inject, type Ref, ref } from 'vue';
24
24
 
25
+ /**
26
+ * A table cell component that provides advanced styling and behavior for table data.
27
+ * Supports fixed columns, editable cells, selection states, and responsive design.
28
+ * Integrates with the table system through dependency injection for coordinated
29
+ * styling and behavior across the entire table structure.
30
+ *
31
+ * @displayName PTableTd
32
+ */
25
33
  defineOptions({ name: 'PTableTd', inheritAttrs: false });
26
34
 
27
35
  type Props = {
36
+ /**
37
+ * The index of the column this cell belongs to.
38
+ * Used for determining positioning and styling based on column position.
39
+ */
28
40
  colIndex: number;
41
+ /**
42
+ * Whether the cell is editable.
43
+ * Adds cursor pointer styling and enables edit functionality.
44
+ */
29
45
  isEditable?: boolean;
46
+ /**
47
+ * Whether the cell is part of a selected row.
48
+ * Applies selection styling and hover effects.
49
+ */
30
50
  isSelected?: boolean;
31
51
  };
32
52
 
@@ -1,4 +1,4 @@
1
- import PaginateRightIcon from '@squirrel/assets/pagination-right-icon.svg?inline';
1
+ import KeyboardPressEnterIcon from '@squirrel/assets/keyboard-press-enter.svg?inline';
2
2
  import PTabs from '@squirrel/components/p-tabs/p-tabs.vue';
3
3
  import { action } from 'storybook/actions';
4
4
  import { markRaw } from 'vue';
@@ -35,7 +35,7 @@ export const Default = {
35
35
  {
36
36
  title: 'Tab 2',
37
37
  name: 'tab2',
38
- icon: markRaw(PaginateRightIcon),
38
+ icon: markRaw(KeyboardPressEnterIcon),
39
39
  },
40
40
  {
41
41
  title: 'Tab 3',
@@ -30,31 +30,63 @@
30
30
  import { type ShallowRef } from 'vue';
31
31
  import { type RouteLocationRaw } from 'vue-router';
32
32
 
33
+ /**
34
+ * A tabs component for navigation between different sections.
35
+ * Displays tabs with optional icons and supports router navigation.
36
+ * Provides hover effects and active state styling.
37
+ *
38
+ * @displayName PTabs
39
+ */
33
40
  defineOptions({
34
41
  name: 'PTabs',
35
42
  });
36
43
 
44
+ /**
45
+ * Represents a single tab in the tabs component.
46
+ */
37
47
  type Tab = {
48
+ /** Unique identifier for the tab */
38
49
  name: string;
50
+ /** Display text for the tab */
39
51
  title: string;
52
+ /** Optional icon component or icon name */
40
53
  icon?: string | ShallowRef<string>;
54
+ /** Optional router link destination */
41
55
  to?: RouteLocationRaw;
42
56
  };
43
57
 
44
58
  defineProps({
59
+ /**
60
+ * Array of tab objects to display.
61
+ * Each tab should have a name, title, and optional icon and route.
62
+ */
45
63
  tabs: {
46
64
  type: Array as () => Tab[],
47
65
  required: true,
48
66
  },
67
+ /**
68
+ * The currently active tab name.
69
+ * Controls which tab is visually highlighted.
70
+ */
49
71
  activeTab: {
50
72
  type: String,
51
73
  required: true,
52
74
  },
75
+ /**
76
+ * Left padding for the tabs container in pixels.
77
+ * Useful for aligning tabs with other content.
78
+ */
53
79
  tabsLeftPadding: {
54
80
  type: Number,
55
81
  default: 0,
56
82
  },
57
83
  });
58
84
 
59
- defineEmits(['click:tab']);
85
+ defineEmits<{
86
+ /**
87
+ * Emitted when a tab is clicked.
88
+ * @param {string} tabName - The name of the clicked tab
89
+ */
90
+ 'click:tab': [tabName: string];
91
+ }>();
60
92
  </script>
@@ -30,20 +30,49 @@
30
30
  </template>
31
31
 
32
32
  <script setup lang="ts">
33
+ /**
34
+ * A tabs pills component that displays navigation tabs in a pill-style interface.
35
+ * Provides a compact tab navigation with smooth transitions and accessibility features.
36
+ * Supports disabled states and custom item text/value properties.
37
+ *
38
+ * @displayName PTabsPills
39
+ */
33
40
  defineOptions({
34
41
  name: 'PTabsPills',
35
42
  });
36
43
 
44
+ /**
45
+ * Valid value types for tab items.
46
+ */
37
47
  type Value = string | number | boolean;
38
48
 
49
+ /**
50
+ * Represents a single tab option in the pills component.
51
+ */
39
52
  type Option = {
40
53
  [key: string]: Value;
41
54
  };
42
55
 
43
56
  type Props = {
57
+ /**
58
+ * The currently selected tab value (v-model).
59
+ * Should match one of the item values in the items array.
60
+ */
44
61
  modelValue?: Value;
62
+ /**
63
+ * Array of tab items to display as pills.
64
+ * Each item should have properties matching itemValue and itemText.
65
+ */
45
66
  items?: readonly Option[];
67
+ /**
68
+ * Property name to use as the item display text.
69
+ * Used for button label content.
70
+ */
46
71
  itemText?: string;
72
+ /**
73
+ * Property name to use as the item value.
74
+ * Used for selection comparison and v-model binding.
75
+ */
47
76
  itemValue?: string;
48
77
  };
49
78
 
@@ -55,6 +84,10 @@ withDefaults(defineProps<Props>(), {
55
84
  });
56
85
 
57
86
  defineEmits<{
87
+ /**
88
+ * Emitted when the selected tab value changes.
89
+ * @param {Value} val - The new selected tab value
90
+ */
58
91
  'update:modelValue': [val: Value];
59
92
  }>();
60
93
  </script>
@@ -15,30 +15,72 @@ import { type Size, SIZES } from '@squirrel/components/p-btn/p-btn.types';
15
15
  import { useInputClasses } from '@squirrel/composables/useInputClasses';
16
16
  import { computed, type PropType, type StyleValue, useAttrs } from 'vue';
17
17
 
18
+ /**
19
+ * A textarea component for multi-line text input.
20
+ * Provides consistent styling and behavior with other form components.
21
+ * Supports custom labels, error states, and various sizes.
22
+ *
23
+ * @displayName PTextarea
24
+ */
18
25
  defineOptions({
19
26
  name: 'PTextarea',
20
27
  inheritAttrs: false,
21
28
  });
22
29
 
23
- const emit = defineEmits(['update:modelValue']);
30
+ const emit = defineEmits<{
31
+ /**
32
+ * Emitted when the textarea value changes.
33
+ * @param {string} value - The new textarea value
34
+ */
35
+ 'update:modelValue': [value: string];
36
+ }>();
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
+ }>();
24
46
 
25
47
  const props = defineProps({
48
+ /**
49
+ * The current value of the textarea (v-model).
50
+ * Supports two-way binding for form inputs.
51
+ */
26
52
  modelValue: {
27
53
  type: [String, Number, null] as PropType<string | number | null>,
28
54
  default: '',
29
55
  },
56
+ /**
57
+ * Text label for the textarea field.
58
+ * If not provided, you can use the label slot instead.
59
+ */
30
60
  label: {
31
61
  type: String,
32
62
  default: '',
33
63
  },
64
+ /**
65
+ * Error message to display below the textarea.
66
+ * When provided, the textarea will show error styling.
67
+ */
34
68
  errorMsg: {
35
69
  type: String,
36
70
  default: '',
37
71
  },
72
+ /**
73
+ * Whether the textarea is required.
74
+ * Adds required attribute and visual indicator.
75
+ */
38
76
  required: {
39
77
  type: Boolean,
40
78
  default: false,
41
79
  },
80
+ /**
81
+ * The size of the textarea - affects padding, font size, and spacing.
82
+ * Valid values: 'sm', 'md', 'lg'
83
+ */
42
84
  size: {
43
85
  type: String as PropType<Size>,
44
86
  default: 'md',
@@ -56,30 +56,73 @@ const TOGGLE_CLASSES = [
56
56
  </script>
57
57
 
58
58
  <script setup lang="ts">
59
+ /**
60
+ * A toggle switch component that provides a modern switch interface.
61
+ * Supports different sizes, labels, error states, and accessibility features.
62
+ * Uses a checkbox input with custom styling for the toggle appearance.
63
+ *
64
+ * @displayName PToggle
65
+ */
59
66
  defineOptions({
60
67
  name: 'PToggle',
61
68
  inheritAttrs: false,
62
69
  });
63
70
 
64
- const emit = defineEmits(['update:modelValue']);
71
+ defineSlots<{
72
+ /**
73
+ * Custom label content - overrides the label prop.
74
+ * @param {string} label - The label text
75
+ * @param {string} label-classes - CSS classes for the label
76
+ */
77
+ label?: (props: { label: string; labelClasses: string }) => unknown;
78
+ }>();
79
+
80
+ const emit = defineEmits<{
81
+ /**
82
+ * Emitted when the toggle state changes.
83
+ * @param {boolean} value - The new toggle state
84
+ */
85
+ 'update:modelValue': [value: boolean];
86
+ }>();
65
87
 
66
88
  const props = defineProps({
89
+ /**
90
+ * The current toggle state (v-model).
91
+ * Supports two-way binding for form inputs.
92
+ */
67
93
  modelValue: {
68
94
  type: Boolean,
69
95
  default: false,
70
96
  },
97
+ /**
98
+ * Text label for the toggle switch.
99
+ * If not provided, you can use the label slot instead.
100
+ */
71
101
  label: {
72
102
  type: String,
73
103
  default: '',
74
104
  },
105
+ /**
106
+ * Error message to display below the toggle.
107
+ * When provided, the toggle will show error styling.
108
+ */
75
109
  errorMsg: {
76
110
  type: String,
77
111
  default: '',
78
112
  },
113
+ /**
114
+ * Whether the toggle is required.
115
+ * Adds required attribute and visual indicator.
116
+ */
79
117
  required: {
80
118
  type: Boolean,
81
119
  default: false,
82
120
  },
121
+ /**
122
+ * The size of the toggle switch.
123
+ * Valid values: 'sm', 'md', 'lg'
124
+ * @values sm, md, lg
125
+ */
83
126
  size: {
84
127
  type: String as PropType<Size>,
85
128
  default: 'md',
@@ -1,5 +0,0 @@
1
- <svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M0.25 5.99968C0.25 5.64968 0.4 5.34968 0.65 5.14968L6.25 0.249681C6.65 -0.100319 7.2 -0.0503187 7.55 0.349681C7.85 0.749681 7.85 1.29968 7.45 1.59968L2.55 5.89968C2.5 5.94968 2.5 5.99968 2.55 6.04968L7.45 10.3497C7.85 10.6997 7.9 11.2497 7.55 11.6497C7.2 12.0497 6.65 12.0997 6.25 11.7497C6.25 11.7497 6.25 11.7497 6.2 11.6997L0.65 6.84968C0.4 6.64968 0.25 6.29968 0.25 5.99968Z"
4
- fill="#918da1" />
5
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M7.75695 6.98136C7.75695 7.33136 7.60695 7.63136 7.35695 7.83136L1.75695 12.7814C1.35695 13.1314 0.756947 13.0814 0.456947 12.6814C0.156947 12.2814 0.156947 11.7314 0.556947 11.3814L5.45695 7.08136C5.50695 7.03136 5.50695 6.98136 5.45695 6.88136L0.556947 2.58136C0.156947 2.23136 0.156947 1.63136 0.506947 1.28136C0.856947 0.931361 1.40695 0.881361 1.80695 1.18136L7.40695 6.08136C7.60695 6.33136 7.75695 6.63136 7.75695 6.98136Z"
4
- fill="#918da1" />
5
- </svg>