design-system-next 2.19.3 → 2.20.0
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/dist/design-system-next.es.js +11824 -8467
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +13 -13
- package/dist/design-system-next.umd.js.gz +0 -0
- package/dist/main.css +1 -1
- package/dist/main.css.gz +0 -0
- package/dist/package.json.d.ts +36 -33
- package/package.json +36 -33
- package/src/assets/scripts/border-radius.ts +15 -15
- package/src/assets/scripts/colors.ts +134 -134
- package/src/assets/scripts/max-width.ts +11 -11
- package/src/assets/scripts/spacing.ts +23 -23
- package/src/assets/scripts/utilities.ts +15 -15
- package/src/components/accordion/accordion.ts +43 -43
- package/src/components/accordion/use-accordion.ts +43 -43
- package/src/components/banner/banner.ts +20 -20
- package/src/components/button/button.ts +72 -72
- package/src/components/button/button.vue +15 -15
- package/src/components/card/card.vue +4 -1
- package/src/components/card/use-card.ts +12 -12
- package/src/components/checkbox/checkbox.ts +45 -45
- package/src/components/collapsible/collapsible.ts +21 -21
- package/src/components/collapsible/collapsible.vue +27 -27
- package/src/components/date-picker/date-picker.ts +3 -3
- package/src/components/date-picker/tabs/DatePickerCalendarTab.vue +4 -13
- package/src/components/dropdown/dropdown.vue +1 -1
- package/src/components/dropdown/fix-multi-number.ts +92 -92
- package/src/components/empty-state/empty-state.ts +50 -50
- package/src/components/file-upload/file-upload.ts +87 -87
- package/src/components/floating-action/floating-action.ts +12 -12
- package/src/components/input/input-email/input-email.vue +17 -17
- package/src/components/input/input-password/input-password.vue +5 -1
- package/src/components/input/input-search/input-search.vue +13 -13
- package/src/components/input/input-url/input-url.vue +20 -20
- package/src/components/input/input-username/input-username.vue +17 -17
- package/src/components/list/ladderized-list/ladderized-list.ts +39 -39
- package/src/components/list/list.ts +13 -0
- package/src/components/list/list.vue +106 -32
- package/src/components/list/use-list.ts +21 -5
- package/src/components/logo/logo.ts +43 -43
- package/src/components/logo/logo.vue +14 -14
- package/src/components/logo/use-logo.ts +41 -41
- package/src/components/progress-bar/progress-bar.ts +39 -39
- package/src/components/radio/radio.ts +42 -42
- package/src/components/select/select-ladderized/select-ladderized.ts +2 -1
- package/src/components/select/select-multiple/select-multiple.ts +20 -0
- package/src/components/select/select-multiple/select-multiple.vue +6 -4
- package/src/components/select/select-multiple/use-select-multiple.ts +87 -54
- package/src/components/sidepanel/sidepanel.vue +55 -55
- package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.ts +16 -16
- package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.vue +39 -39
- package/src/components/slider/slider.ts +38 -38
- package/src/components/snackbar/snack/snack.ts +71 -71
- package/src/components/snackbar/use-snackbar.ts +34 -34
- package/src/components/status/status.ts +19 -19
- package/src/components/status/status.vue +13 -13
- package/src/components/stepper/step/step.ts +47 -47
- package/src/components/stepper/stepper.ts +47 -47
- package/src/components/stepper/stepper.vue +34 -34
- package/src/components/switch/switch.ts +42 -42
- package/src/components/table/table-actions/table-actions.ts +42 -42
- package/src/components/table/table-actions/table-actions.vue +40 -40
- package/src/components/table/table-chips-title/table-chips-title.ts +27 -27
- package/src/components/table/table-chips-title/table-chips-title.vue +32 -32
- package/src/components/table/table-chips-title/use-table-chips-title.ts +22 -22
- package/src/components/table/table-lozenge-title/table-lozenge-title.ts +23 -23
- package/src/components/table/table-lozenge-title/table-lozenge-title.vue +26 -26
- package/src/components/table/table-lozenge-title/use-table-lozenge-title.ts +21 -21
- package/src/components/tabs/tabs.ts +43 -43
- package/src/components/time-picker/time-picker.ts +69 -69
- package/src/components/tooltip/use-tooltip.ts +13 -13
- package/src/stores/useSnackbarStore.ts +44 -44
- package/src/vite-env.d.ts +6 -0
- package/src/vue.d.ts +5 -0
|
@@ -22,10 +22,7 @@
|
|
|
22
22
|
'spr-text-color-brand-base': isTodayIndicator(day) && !isSelectedDate(day),
|
|
23
23
|
|
|
24
24
|
// Active Month Dates - only apply if not selected and not today
|
|
25
|
-
'spr-text-color-strong':
|
|
26
|
-
isActiveMonthDates(day) &&
|
|
27
|
-
!isSelectedDate(day) &&
|
|
28
|
-
!isTodayIndicator(day),
|
|
25
|
+
'spr-text-color-strong': isActiveMonthDates(day) && !isSelectedDate(day) && !isTodayIndicator(day),
|
|
29
26
|
|
|
30
27
|
// Inactive Month Dates (Past/Future)
|
|
31
28
|
'spr-text-color-disabled': isInactiveMonthDates(day),
|
|
@@ -74,17 +71,15 @@ interface Props extends TabComponentProps {
|
|
|
74
71
|
selectedDay?: number;
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
type Emits = CalendarTabEmits;
|
|
78
|
-
|
|
79
74
|
const props = defineProps<Props>();
|
|
80
|
-
const emit = defineEmits<
|
|
75
|
+
const emit = defineEmits<CalendarTabEmits>();
|
|
81
76
|
|
|
82
77
|
const daysOfWeek = computed(() =>
|
|
83
78
|
Array.from({ length: 7 }, (_, i) => ({
|
|
84
79
|
text: dayjs().day(i).format('dd'),
|
|
85
80
|
fullText: dayjs().day(i).format('dddd'),
|
|
86
81
|
dayValue: i,
|
|
87
|
-
}))
|
|
82
|
+
})),
|
|
88
83
|
);
|
|
89
84
|
|
|
90
85
|
const currentDate = computed(() => dayjs());
|
|
@@ -154,7 +149,6 @@ const isSelectedDate = (day: { date: Date; inactive: boolean }) => {
|
|
|
154
149
|
return day.date.getDate() === props.selectedDay && !day.inactive;
|
|
155
150
|
}
|
|
156
151
|
|
|
157
|
-
|
|
158
152
|
return false;
|
|
159
153
|
};
|
|
160
154
|
|
|
@@ -184,10 +178,7 @@ const isUnSelectedDate = (day: { date: Date }) => {
|
|
|
184
178
|
|
|
185
179
|
// If day and month are selected, check if this date matches
|
|
186
180
|
if (props.selectedDay && props.selectedMonth !== undefined && !props.selectedYear) {
|
|
187
|
-
return !(
|
|
188
|
-
day.date.getDate() === props.selectedDay &&
|
|
189
|
-
day.date.getMonth() === props.selectedMonth
|
|
190
|
-
);
|
|
181
|
+
return !(day.date.getDate() === props.selectedDay && day.date.getMonth() === props.selectedMonth);
|
|
191
182
|
}
|
|
192
183
|
|
|
193
184
|
// If only day is selected, check if this date matches
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
// This file contains the fixed version of the handleSelectedItem function
|
|
2
|
-
// for handling multiple primitive number values in dropdowns
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Fixed version of the handleSelectedItem function that properly handles number values in multi-select mode
|
|
6
|
-
* This is designed to be copied into the use-dropdown.ts file
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// Handle selected item for simple list component
|
|
10
|
-
// This function is exported to be used as a reference for implementation
|
|
11
|
-
export const handleSelectedItem = (selectedItems: MenuListType[]) => {
|
|
12
|
-
if (!props.ladderized) {
|
|
13
|
-
// Determine the type of value to emit based on the original data type and multiSelect
|
|
14
|
-
if (multiSelect.value) {
|
|
15
|
-
// For multi-select, always return an array
|
|
16
|
-
const values = selectedItems.map(item => {
|
|
17
|
-
// If we stored the original object, use it
|
|
18
|
-
if ('_originalObject' in item) {
|
|
19
|
-
return item._originalObject;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// For simple types, handle value type conversion properly
|
|
23
|
-
const val = item.value;
|
|
24
|
-
|
|
25
|
-
// If it's already a number, keep it as a number
|
|
26
|
-
if (typeof val === 'number') {
|
|
27
|
-
return val;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// For strings that look like numbers, convert them
|
|
31
|
-
if (typeof val === 'string' && !isNaN(Number(val)) && val.trim() !== '') {
|
|
32
|
-
// Only convert if it looks like a proper number format
|
|
33
|
-
if (/^-?\d+(\.\d+)?$/.test(val)) {
|
|
34
|
-
return Number(val);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Return the original value for all other cases
|
|
39
|
-
return val;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Set the dropdown value
|
|
43
|
-
dropdownValue.value = values as (string | number | Record<string, unknown>)[];
|
|
44
|
-
} else {
|
|
45
|
-
// For single-select
|
|
46
|
-
if (selectedItems.length === 0) {
|
|
47
|
-
dropdownValue.value = props.multiSelect ? [] : '';
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const item = selectedItems[0];
|
|
52
|
-
|
|
53
|
-
// If we stored the original object, use it
|
|
54
|
-
if ('_originalObject' in item) {
|
|
55
|
-
dropdownValue.value = item._originalObject as Record<string, unknown>;
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// For simple types, return the value (try to convert number strings to numbers)
|
|
60
|
-
const val = item.value;
|
|
61
|
-
if (typeof val === 'string' && !isNaN(Number(val)) && val.trim() !== '') {
|
|
62
|
-
dropdownValue.value = Number(val);
|
|
63
|
-
} else {
|
|
64
|
-
dropdownValue.value = val;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
} else if (props.ladderized) {
|
|
68
|
-
if (props.searchString !== '') {
|
|
69
|
-
// generate dropdown value if ladderized with search string
|
|
70
|
-
const subvalue = selectedItems[0]?.subvalue;
|
|
71
|
-
const value = selectedItems[0]?.value;
|
|
72
|
-
if (subvalue !== undefined && value !== undefined) {
|
|
73
|
-
dropdownValue.value = [subvalue, value] as [string, string | number];
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
// For regular ladderized dropdown selection without search
|
|
77
|
-
if (selectedItems.length > 0) {
|
|
78
|
-
const item = selectedItems[0];
|
|
79
|
-
// Use the value directly for ladderized items
|
|
80
|
-
if (item && item.value) {
|
|
81
|
-
dropdownValue.value = item.value;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!multiSelect.value) {
|
|
88
|
-
setTimeout(() => {
|
|
89
|
-
dropdownPopperState.value = false;
|
|
90
|
-
}, 10);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
1
|
+
// This file contains the fixed version of the handleSelectedItem function
|
|
2
|
+
// for handling multiple primitive number values in dropdowns
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fixed version of the handleSelectedItem function that properly handles number values in multi-select mode
|
|
6
|
+
* This is designed to be copied into the use-dropdown.ts file
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Handle selected item for simple list component
|
|
10
|
+
// This function is exported to be used as a reference for implementation
|
|
11
|
+
export const handleSelectedItem = (selectedItems: MenuListType[]) => {
|
|
12
|
+
if (!props.ladderized) {
|
|
13
|
+
// Determine the type of value to emit based on the original data type and multiSelect
|
|
14
|
+
if (multiSelect.value) {
|
|
15
|
+
// For multi-select, always return an array
|
|
16
|
+
const values = selectedItems.map(item => {
|
|
17
|
+
// If we stored the original object, use it
|
|
18
|
+
if ('_originalObject' in item) {
|
|
19
|
+
return item._originalObject;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// For simple types, handle value type conversion properly
|
|
23
|
+
const val = item.value;
|
|
24
|
+
|
|
25
|
+
// If it's already a number, keep it as a number
|
|
26
|
+
if (typeof val === 'number') {
|
|
27
|
+
return val;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// For strings that look like numbers, convert them
|
|
31
|
+
if (typeof val === 'string' && !isNaN(Number(val)) && val.trim() !== '') {
|
|
32
|
+
// Only convert if it looks like a proper number format
|
|
33
|
+
if (/^-?\d+(\.\d+)?$/.test(val)) {
|
|
34
|
+
return Number(val);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Return the original value for all other cases
|
|
39
|
+
return val;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Set the dropdown value
|
|
43
|
+
dropdownValue.value = values as (string | number | Record<string, unknown>)[];
|
|
44
|
+
} else {
|
|
45
|
+
// For single-select
|
|
46
|
+
if (selectedItems.length === 0) {
|
|
47
|
+
dropdownValue.value = props.multiSelect ? [] : '';
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const item = selectedItems[0];
|
|
52
|
+
|
|
53
|
+
// If we stored the original object, use it
|
|
54
|
+
if ('_originalObject' in item) {
|
|
55
|
+
dropdownValue.value = item._originalObject as Record<string, unknown>;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// For simple types, return the value (try to convert number strings to numbers)
|
|
60
|
+
const val = item.value;
|
|
61
|
+
if (typeof val === 'string' && !isNaN(Number(val)) && val.trim() !== '') {
|
|
62
|
+
dropdownValue.value = Number(val);
|
|
63
|
+
} else {
|
|
64
|
+
dropdownValue.value = val;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} else if (props.ladderized) {
|
|
68
|
+
if (props.searchString !== '') {
|
|
69
|
+
// generate dropdown value if ladderized with search string
|
|
70
|
+
const subvalue = selectedItems[0]?.subvalue;
|
|
71
|
+
const value = selectedItems[0]?.value;
|
|
72
|
+
if (subvalue !== undefined && value !== undefined) {
|
|
73
|
+
dropdownValue.value = [subvalue, value] as [string, string | number];
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
// For regular ladderized dropdown selection without search
|
|
77
|
+
if (selectedItems.length > 0) {
|
|
78
|
+
const item = selectedItems[0];
|
|
79
|
+
// Use the value directly for ladderized items
|
|
80
|
+
if (item && item.value) {
|
|
81
|
+
dropdownValue.value = item.value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!multiSelect.value) {
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
dropdownPopperState.value = false;
|
|
90
|
+
}, 10);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
const STATE_SIZE = ['small', 'large'] as const;
|
|
6
|
-
const STATE_IMAGE = [
|
|
7
|
-
'bug',
|
|
8
|
-
'clock',
|
|
9
|
-
'dashboard',
|
|
10
|
-
'employees',
|
|
11
|
-
'government-id',
|
|
12
|
-
'integration',
|
|
13
|
-
'list',
|
|
14
|
-
'social-media-handles',
|
|
15
|
-
'work-in-progress',
|
|
16
|
-
'work-location',
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
export const emptyStatePropTypes = {
|
|
20
|
-
description: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: false,
|
|
23
|
-
default: 'No results found',
|
|
24
|
-
},
|
|
25
|
-
subDescription: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: false,
|
|
28
|
-
default: 'Try a different search term.',
|
|
29
|
-
},
|
|
30
|
-
size: {
|
|
31
|
-
type: String as PropType<(typeof STATE_SIZE)[number]>,
|
|
32
|
-
validator: (value: (typeof STATE_SIZE)[number]) => STATE_SIZE.includes(value),
|
|
33
|
-
default: 'small',
|
|
34
|
-
},
|
|
35
|
-
image: {
|
|
36
|
-
type: String as PropType<(typeof STATE_IMAGE)[number]>,
|
|
37
|
-
default: 'list',
|
|
38
|
-
validator: (value: (typeof STATE_IMAGE)[number] | undefined) => value === undefined || STATE_IMAGE.includes(value),
|
|
39
|
-
},
|
|
40
|
-
hasButton: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false,
|
|
43
|
-
},
|
|
44
|
-
emptyStateCustomClasses: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: '',
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type EmptyStatePropTypes = ExtractPropTypes<typeof emptyStatePropTypes>;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
const STATE_SIZE = ['small', 'large'] as const;
|
|
6
|
+
const STATE_IMAGE = [
|
|
7
|
+
'bug',
|
|
8
|
+
'clock',
|
|
9
|
+
'dashboard',
|
|
10
|
+
'employees',
|
|
11
|
+
'government-id',
|
|
12
|
+
'integration',
|
|
13
|
+
'list',
|
|
14
|
+
'social-media-handles',
|
|
15
|
+
'work-in-progress',
|
|
16
|
+
'work-location',
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
export const emptyStatePropTypes = {
|
|
20
|
+
description: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: false,
|
|
23
|
+
default: 'No results found',
|
|
24
|
+
},
|
|
25
|
+
subDescription: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false,
|
|
28
|
+
default: 'Try a different search term.',
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
type: String as PropType<(typeof STATE_SIZE)[number]>,
|
|
32
|
+
validator: (value: (typeof STATE_SIZE)[number]) => STATE_SIZE.includes(value),
|
|
33
|
+
default: 'small',
|
|
34
|
+
},
|
|
35
|
+
image: {
|
|
36
|
+
type: String as PropType<(typeof STATE_IMAGE)[number]>,
|
|
37
|
+
default: 'list',
|
|
38
|
+
validator: (value: (typeof STATE_IMAGE)[number] | undefined) => value === undefined || STATE_IMAGE.includes(value),
|
|
39
|
+
},
|
|
40
|
+
hasButton: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
emptyStateCustomClasses: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '',
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type EmptyStatePropTypes = ExtractPropTypes<typeof emptyStatePropTypes>;
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
const FILE_UPLOAD_TYPE = ['default', 'center'] as const;
|
|
6
|
-
|
|
7
|
-
const FILE_UPLOAD_DOCUMENT_TYPE = [
|
|
8
|
-
'application/pdf',
|
|
9
|
-
'application/msword',
|
|
10
|
-
'application/vnd.ms-excel',
|
|
11
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
12
|
-
'application/vnd.ms-powerpoint',
|
|
13
|
-
'text/plain',
|
|
14
|
-
'text/csv'
|
|
15
|
-
];
|
|
16
|
-
const FILE_UPLOAD_IMAGE_TYPE = [
|
|
17
|
-
'image/apng',
|
|
18
|
-
'image/avif',
|
|
19
|
-
'image/gif',
|
|
20
|
-
'image/jpeg',
|
|
21
|
-
'image/png',
|
|
22
|
-
'image/svg+xml',
|
|
23
|
-
'image/webp'
|
|
24
|
-
];
|
|
25
|
-
const FILE_UPLOAD_VALID_TYPE = [...FILE_UPLOAD_IMAGE_TYPE, ...FILE_UPLOAD_DOCUMENT_TYPE];
|
|
26
|
-
|
|
27
|
-
export const fileUploadPropTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* @description Media upload type
|
|
30
|
-
*/
|
|
31
|
-
type: {
|
|
32
|
-
type: String as PropType<(typeof FILE_UPLOAD_TYPE)[number]>,
|
|
33
|
-
validator: (value: (typeof FILE_UPLOAD_TYPE)[number]) => FILE_UPLOAD_TYPE.includes(value),
|
|
34
|
-
default: 'default',
|
|
35
|
-
},
|
|
36
|
-
title: {
|
|
37
|
-
type: String
|
|
38
|
-
},
|
|
39
|
-
disabled: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false,
|
|
42
|
-
},
|
|
43
|
-
multiple: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false,
|
|
46
|
-
},
|
|
47
|
-
modelValue: {
|
|
48
|
-
type: Array<File>,
|
|
49
|
-
required: true,
|
|
50
|
-
default: [],
|
|
51
|
-
},
|
|
52
|
-
maxFileSize: {
|
|
53
|
-
type: Number,
|
|
54
|
-
default: 10, // 10MB
|
|
55
|
-
},
|
|
56
|
-
fileTypes: {
|
|
57
|
-
type: Array as PropType<(typeof FILE_UPLOAD_VALID_TYPE)>,
|
|
58
|
-
validator: (fileTypes: (typeof FILE_UPLOAD_VALID_TYPE)) => fileTypes.every(fileType => FILE_UPLOAD_VALID_TYPE.includes(fileType)),
|
|
59
|
-
default: () => [...FILE_UPLOAD_VALID_TYPE], // If null, accept all file types
|
|
60
|
-
},
|
|
61
|
-
showError: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: false,
|
|
64
|
-
},
|
|
65
|
-
errorMessages: {
|
|
66
|
-
type: Array as PropType<string[]>,
|
|
67
|
-
default: [],
|
|
68
|
-
},
|
|
69
|
-
hideFilePreviewIcon: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
default: false,
|
|
72
|
-
},
|
|
73
|
-
hideDropzoneLabel: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
default: false,
|
|
76
|
-
},
|
|
77
|
-
supportedFileTypeLabel: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: null,
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const fileUploadEmitTypes = ['update:modelValue']
|
|
84
|
-
|
|
85
|
-
export type FileUploadPropTypes = ExtractPropTypes<typeof fileUploadPropTypes>;
|
|
86
|
-
export type FileUploadEmitTypes = typeof fileUploadEmitTypes;
|
|
87
|
-
export type FileUploadType = FileUploadPropTypes['type'];
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
const FILE_UPLOAD_TYPE = ['default', 'center'] as const;
|
|
6
|
+
|
|
7
|
+
const FILE_UPLOAD_DOCUMENT_TYPE = [
|
|
8
|
+
'application/pdf',
|
|
9
|
+
'application/msword',
|
|
10
|
+
'application/vnd.ms-excel',
|
|
11
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
12
|
+
'application/vnd.ms-powerpoint',
|
|
13
|
+
'text/plain',
|
|
14
|
+
'text/csv'
|
|
15
|
+
];
|
|
16
|
+
const FILE_UPLOAD_IMAGE_TYPE = [
|
|
17
|
+
'image/apng',
|
|
18
|
+
'image/avif',
|
|
19
|
+
'image/gif',
|
|
20
|
+
'image/jpeg',
|
|
21
|
+
'image/png',
|
|
22
|
+
'image/svg+xml',
|
|
23
|
+
'image/webp'
|
|
24
|
+
];
|
|
25
|
+
const FILE_UPLOAD_VALID_TYPE = [...FILE_UPLOAD_IMAGE_TYPE, ...FILE_UPLOAD_DOCUMENT_TYPE];
|
|
26
|
+
|
|
27
|
+
export const fileUploadPropTypes = {
|
|
28
|
+
/**
|
|
29
|
+
* @description Media upload type
|
|
30
|
+
*/
|
|
31
|
+
type: {
|
|
32
|
+
type: String as PropType<(typeof FILE_UPLOAD_TYPE)[number]>,
|
|
33
|
+
validator: (value: (typeof FILE_UPLOAD_TYPE)[number]) => FILE_UPLOAD_TYPE.includes(value),
|
|
34
|
+
default: 'default',
|
|
35
|
+
},
|
|
36
|
+
title: {
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
multiple: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
modelValue: {
|
|
48
|
+
type: Array<File>,
|
|
49
|
+
required: true,
|
|
50
|
+
default: [],
|
|
51
|
+
},
|
|
52
|
+
maxFileSize: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 10, // 10MB
|
|
55
|
+
},
|
|
56
|
+
fileTypes: {
|
|
57
|
+
type: Array as PropType<(typeof FILE_UPLOAD_VALID_TYPE)>,
|
|
58
|
+
validator: (fileTypes: (typeof FILE_UPLOAD_VALID_TYPE)) => fileTypes.every(fileType => FILE_UPLOAD_VALID_TYPE.includes(fileType)),
|
|
59
|
+
default: () => [...FILE_UPLOAD_VALID_TYPE], // If null, accept all file types
|
|
60
|
+
},
|
|
61
|
+
showError: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
errorMessages: {
|
|
66
|
+
type: Array as PropType<string[]>,
|
|
67
|
+
default: [],
|
|
68
|
+
},
|
|
69
|
+
hideFilePreviewIcon: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
73
|
+
hideDropzoneLabel: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
77
|
+
supportedFileTypeLabel: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: null,
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const fileUploadEmitTypes = ['update:modelValue']
|
|
84
|
+
|
|
85
|
+
export type FileUploadPropTypes = ExtractPropTypes<typeof fileUploadPropTypes>;
|
|
86
|
+
export type FileUploadEmitTypes = typeof fileUploadEmitTypes;
|
|
87
|
+
export type FileUploadType = FileUploadPropTypes['type'];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
export const floatingActionPropTypes = {
|
|
6
|
-
show: {
|
|
7
|
-
type: Boolean,
|
|
8
|
-
default: false,
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type FloatingActionProps = ExtractPropTypes<typeof floatingActionPropTypes>;
|
|
1
|
+
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
export const floatingActionPropTypes = {
|
|
6
|
+
show: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: false,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type FloatingActionProps = ExtractPropTypes<typeof floatingActionPropTypes>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<spr-input v-bind="$attrs">
|
|
3
|
-
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
-
<slot :name="slotName" />
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<template #prefix>
|
|
8
|
-
<Icon icon="ph:envelope" />
|
|
9
|
-
</template>
|
|
10
|
-
</spr-input>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup lang="ts">
|
|
14
|
-
import { Icon } from '@iconify/vue';
|
|
15
|
-
|
|
16
|
-
import SprInput from '@/components/input/input.vue';
|
|
17
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<spr-input v-bind="$attrs">
|
|
3
|
+
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
+
<slot :name="slotName" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #prefix>
|
|
8
|
+
<Icon icon="ph:envelope" />
|
|
9
|
+
</template>
|
|
10
|
+
</spr-input>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { Icon } from '@iconify/vue';
|
|
15
|
+
|
|
16
|
+
import SprInput from '@/components/input/input.vue';
|
|
17
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<spr-input v-bind="
|
|
2
|
+
<spr-input v-bind="props" :type="evaluatePasswordInputType" @update:model-value="emit('update:modelValue', $event)">
|
|
3
3
|
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
4
|
<slot :name="slotName" />
|
|
5
5
|
</template>
|
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
import { Icon } from '@iconify/vue';
|
|
19
19
|
|
|
20
20
|
import SprInput from '@/components/input/input.vue';
|
|
21
|
+
import { inputPropTypes, inputEmitTypes } from '@/components/input/input';
|
|
21
22
|
|
|
22
23
|
import { useInputPassword } from './use-input-password';
|
|
23
24
|
|
|
25
|
+
const emit = defineEmits(inputEmitTypes);
|
|
26
|
+
const props = defineProps(inputPropTypes);
|
|
27
|
+
|
|
24
28
|
const { showPassword, evaluateEyeIcon, evaluatePasswordInputType } = useInputPassword();
|
|
25
29
|
</script>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<spr-input v-bind="$attrs">
|
|
3
|
-
<template #icon>
|
|
4
|
-
<Icon icon="ph:magnifying-glass" />
|
|
5
|
-
</template>
|
|
6
|
-
</spr-input>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
import { Icon } from '@iconify/vue';
|
|
11
|
-
|
|
12
|
-
import SprInput from '@/components/input/input.vue';
|
|
13
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<spr-input v-bind="$attrs">
|
|
3
|
+
<template #icon>
|
|
4
|
+
<Icon icon="ph:magnifying-glass" />
|
|
5
|
+
</template>
|
|
6
|
+
</spr-input>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { Icon } from '@iconify/vue';
|
|
11
|
+
|
|
12
|
+
import SprInput from '@/components/input/input.vue';
|
|
13
|
+
</script>
|