@pequity/squirrel 8.4.4 → 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.
- package/README.md +2 -1
- package/dist/cjs/chunks/p-alert.js +3 -0
- package/dist/cjs/chunks/p-avatar.js +16 -0
- package/dist/cjs/chunks/p-btn.js +3 -0
- package/dist/cjs/chunks/p-card.js +4 -0
- package/dist/cjs/chunks/p-dropdown-select.js +34 -0
- package/dist/cjs/chunks/p-input-number.js +32 -0
- package/dist/cjs/chunks/p-input-percent.js +13 -2
- package/dist/cjs/chunks/p-input.js +28 -0
- package/dist/cjs/chunks/p-pagination-info.js +9 -5
- package/dist/cjs/chunks/p-pagination.js +23 -13
- package/dist/cjs/chunks/p-select-btn.js +2 -1
- package/dist/cjs/chunks/p-select.js +33 -0
- package/dist/cjs/chunks/p-table-loader.js +20 -0
- package/dist/cjs/chunks/p-tabs.js +12 -0
- package/dist/cjs/chunks/p-textarea.js +20 -0
- package/dist/cjs/index.js +40 -3
- package/dist/cjs/p-checkbox.js +8 -1
- package/dist/cjs/p-chips.js +17 -1
- package/dist/cjs/p-close-btn.js +6 -1
- package/dist/cjs/p-drawer.js +90 -2
- package/dist/cjs/p-dropdown.js +2 -1
- package/dist/cjs/p-input-search.js +13 -1
- package/dist/cjs/p-loading.js +1 -1
- package/dist/cjs/p-modal.js +82 -2
- package/dist/cjs/p-select-pill.js +36 -2
- package/dist/cjs/p-skeleton-loader.js +17 -1
- package/dist/cjs/p-table-filter-icon.js +4 -1
- package/dist/cjs/p-table-header-cell.js +29 -0
- package/dist/cjs/p-table-td.js +1 -1
- package/dist/cjs/p-toggle.js +22 -1
- package/dist/es/chunks/p-alert.js +3 -0
- package/dist/es/chunks/p-avatar.js +16 -0
- package/dist/es/chunks/p-btn.js +3 -0
- package/dist/es/chunks/p-card.js +4 -0
- package/dist/es/chunks/p-dropdown-select.js +34 -0
- package/dist/es/chunks/p-input-number.js +32 -0
- package/dist/es/chunks/p-input-percent.js +13 -2
- package/dist/es/chunks/p-input.js +28 -0
- package/dist/es/chunks/p-pagination-info.js +9 -5
- package/dist/es/chunks/p-pagination.js +24 -14
- package/dist/es/chunks/p-select-btn.js +2 -1
- package/dist/es/chunks/p-select.js +33 -0
- package/dist/es/chunks/p-table-loader.js +20 -0
- package/dist/es/chunks/p-tabs.js +12 -0
- package/dist/es/chunks/p-textarea.js +20 -0
- package/dist/es/index.js +40 -3
- package/dist/es/p-checkbox.js +8 -1
- package/dist/es/p-chips.js +17 -1
- package/dist/es/p-close-btn.js +6 -1
- package/dist/es/p-drawer.js +90 -2
- package/dist/es/p-dropdown.js +2 -1
- package/dist/es/p-input-search.js +13 -1
- package/dist/es/p-loading.js +1 -1
- package/dist/es/p-modal.js +82 -2
- package/dist/es/p-select-pill.js +36 -2
- package/dist/es/p-skeleton-loader.js +17 -1
- package/dist/es/p-table-filter-icon.js +4 -1
- package/dist/es/p-table-header-cell.js +29 -0
- package/dist/es/p-table-td.js +1 -1
- package/dist/es/p-toggle.js +22 -1
- package/dist/squirrel/components/p-action-bar/p-action-bar.vue.d.ts +14 -2
- package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +16 -3
- package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +35 -0
- package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +18 -2
- package/dist/squirrel/components/p-card/p-card.vue.d.ts +20 -7
- package/dist/squirrel/components/p-checkbox/p-checkbox.vue.d.ts +25 -7
- package/dist/squirrel/components/p-chips/p-chips.vue.d.ts +24 -0
- package/dist/squirrel/components/p-close-btn/p-close-btn.vue.d.ts +13 -0
- package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +16 -0
- package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +141 -3
- package/dist/squirrel/components/p-dropdown/p-dropdown.vue.d.ts +11 -2
- package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +69 -1
- package/dist/squirrel/components/p-file-upload/p-file-upload.vue.d.ts +70 -6
- package/dist/squirrel/components/p-icon/p-icon.vue.d.ts +4 -0
- package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +11 -4
- package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +27 -7
- package/dist/squirrel/components/p-input/p-input.vue.d.ts +73 -8
- package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +83 -12
- package/dist/squirrel/components/p-input-percent/p-input-percent.vue.d.ts +22 -2
- package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +24 -0
- package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +185 -15
- package/dist/squirrel/components/p-pagination/p-pagination.vue.d.ts +22 -12
- package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +16 -8
- package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +20 -0
- package/dist/squirrel/components/p-ring-loader/p-ring-loader.vue.d.ts +10 -0
- package/dist/squirrel/components/p-select/p-select.vue.d.ts +76 -6
- package/dist/squirrel/components/p-select-btn/p-select-btn.vue.d.ts +67 -10
- package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +1 -1
- package/dist/squirrel/components/p-select-pill/p-select-pill.vue.d.ts +72 -2
- package/dist/squirrel/components/p-skeleton-loader/p-skeleton-loader.vue.d.ts +40 -0
- package/dist/squirrel/components/p-steps/p-steps.vue.d.ts +12 -0
- package/dist/squirrel/components/p-table/p-table.vue.d.ts +32 -0
- package/dist/squirrel/components/p-table-header-cell/p-table-filter-icon.vue.d.ts +6 -0
- package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +56 -1
- package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +40 -0
- package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +12 -2
- package/dist/squirrel/components/p-table-td/p-table-td.vue.d.ts +12 -0
- package/dist/squirrel/components/p-tabs/p-tabs.vue.d.ts +33 -2
- package/dist/squirrel/components/p-tabs-pills/p-tabs-pills.vue.d.ts +22 -0
- package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +52 -8
- package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +50 -3
- package/dist/squirrel.css +68 -68
- package/package.json +15 -15
- package/squirrel/components/p-action-bar/p-action-bar.stories.js +5 -5
- package/squirrel/components/p-action-bar/p-action-bar.vue +30 -3
- package/squirrel/components/p-alert/p-alert.vue +24 -0
- package/squirrel/components/p-avatar/p-avatar.vue +28 -0
- package/squirrel/components/p-btn/p-btn.vue +35 -0
- package/squirrel/components/p-card/p-card.vue +24 -1
- package/squirrel/components/p-checkbox/p-checkbox.vue +23 -1
- package/squirrel/components/p-chips/p-chips.vue +24 -0
- package/squirrel/components/p-close-btn/p-close-btn.vue +15 -0
- package/squirrel/components/p-date-picker/p-date-picker.vue +23 -1
- package/squirrel/components/p-drawer/p-drawer.vue +95 -0
- package/squirrel/components/p-dropdown/p-dropdown.vue +12 -1
- package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +41 -0
- package/squirrel/components/p-file-upload/p-file-upload.vue +58 -3
- package/squirrel/components/p-icon/p-icon.vue +16 -0
- package/squirrel/components/p-info-icon/p-info-icon.vue +19 -0
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +32 -0
- package/squirrel/components/p-input/p-input.vue +61 -1
- package/squirrel/components/p-input-number/p-input-number.vue +78 -1
- package/squirrel/components/p-input-percent/p-input-percent.vue +27 -3
- package/squirrel/components/p-input-search/p-input-search.vue +30 -2
- package/squirrel/components/p-link/p-link.vue +13 -0
- package/squirrel/components/p-loading/p-loading.vue +9 -2
- package/squirrel/components/p-modal/p-modal.vue +138 -2
- package/squirrel/components/p-pagination/p-pagination.vue +28 -8
- package/squirrel/components/p-pagination-info/p-pagination-info.vue +16 -4
- package/squirrel/components/p-progress-bar/p-progress-bar.vue +31 -4
- package/squirrel/components/p-ring-loader/p-ring-loader.vue +17 -0
- package/squirrel/components/p-select/p-select.vue +50 -1
- package/squirrel/components/p-select-btn/p-select-btn.vue +90 -2
- package/squirrel/components/p-select-list/p-select-list.vue +7 -0
- package/squirrel/components/p-select-pill/p-select-pill.vue +52 -2
- package/squirrel/components/p-skeleton-loader/p-skeleton-loader.vue +24 -0
- package/squirrel/components/p-steps/p-steps.vue +25 -0
- package/squirrel/components/p-table/p-table.vue +39 -0
- package/squirrel/components/p-table-header-cell/p-table-filter-icon.vue +9 -0
- package/squirrel/components/p-table-header-cell/p-table-header-cell.vue +36 -0
- package/squirrel/components/p-table-loader/p-table-loader.vue +28 -0
- package/squirrel/components/p-table-sort/p-table-sort.vue +19 -1
- package/squirrel/components/p-table-td/p-table-td.vue +20 -0
- package/squirrel/components/p-tabs/p-tabs.stories.js +2 -2
- package/squirrel/components/p-tabs/p-tabs.vue +33 -1
- package/squirrel/components/p-tabs-pills/p-tabs-pills.vue +33 -0
- package/squirrel/components/p-textarea/p-textarea.vue +43 -1
- package/squirrel/components/p-toggle/p-toggle.vue +44 -1
- package/squirrel/assets/pagination-left-icon.svg +0 -5
- package/squirrel/assets/pagination-right-icon.svg +0 -5
|
@@ -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
|
-
|
|
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);
|
|
@@ -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,
|