design-system-next 2.12.1 → 2.12.6
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 +8040 -8213
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +12 -12
- 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 +1 -1
- package/package.json +1 -1
- package/src/App.vue +49 -1
- 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/avatar/avatar.ts +71 -64
- package/src/components/avatar/avatar.vue +10 -5
- package/src/components/avatar/use-avatar.ts +14 -3
- package/src/components/badge/badge.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/calendar/calendar.ts +12 -2
- package/src/components/card/card.ts +52 -52
- package/src/components/checkbox/checkbox.ts +45 -45
- package/src/components/chips/chips.ts +101 -95
- package/src/components/chips/use-chips.ts +11 -3
- package/src/components/collapsible/collapsible.ts +21 -21
- package/src/components/collapsible/collapsible.vue +27 -27
- package/src/components/date-picker/__tests__/date-picker.test.ts +112 -112
- package/src/components/date-picker/date-picker.ts +157 -157
- package/src/components/dropdown/__tests__/dropdown-fixes.spec.ts +106 -106
- package/src/components/dropdown/__tests__/dropdown-value-types.spec.ts +213 -213
- package/src/components/dropdown/fix-multi-number.ts +92 -92
- package/src/components/dropdown/use-dropdown.ts +488 -488
- 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-contact-number/input-contact-number.ts +83 -83
- package/src/components/input/input-email/input-email.vue +17 -17
- package/src/components/input/input-password/use-input-password.ts +19 -19
- 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/input/input.vue +72 -72
- package/src/components/list/ladderized-list/ladderized-list.ts +39 -39
- 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/modal/modal.ts +45 -45
- package/src/components/progress-bar/progress-bar.ts +39 -39
- package/src/components/radio/radio.ts +42 -42
- package/src/components/select/select.ts +144 -144
- package/src/components/sidenav/sidenav.ts +5 -4
- package/src/components/sidenav/sidenav.vue +66 -50
- package/src/components/sidenav/use-sidenav.ts +29 -20
- 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/table/table-pagination/table-pagination.ts +63 -63
- package/src/components/table/table-pagination/table-pagination.vue +72 -72
- package/src/components/table/table.ts +174 -173
- package/src/components/table/table.vue +2 -2
- package/src/components/table/use-table.ts +13 -8
- package/src/components/tabs/tabs.ts +43 -43
- package/src/components/textarea/textarea.ts +72 -72
- package/src/components/textarea/textarea.vue +45 -45
- 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/examples/dropdown-number-multi-select.vue +0 -76
- package/src/vite-env.d.ts +0 -6
|
@@ -1,64 +1,71 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
const AVATAR_SIZE = ['2xl', 'xl', 'lg', 'md', 'sm', 'xs', '2xs'] as const;
|
|
6
|
-
const AVATAR_PRIMARY = ['primary', 'secondary'] as const;
|
|
7
|
-
const AVATAR_STATUS = ['danger', 'disabled', 'information', 'brand'] as const;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
const AVATAR_SIZE = ['2xl', 'xl', 'lg', 'md', 'sm', 'xs', '2xs'] as const;
|
|
6
|
+
const AVATAR_PRIMARY = ['primary', 'secondary', 'tertiary'] as const;
|
|
7
|
+
const AVATAR_STATUS = ['danger', 'disabled', 'information', 'brand'] as const;
|
|
8
|
+
|
|
9
|
+
export const AVATAR_VARIANT = ['image', 'initial', 'client', 'user', 'user-group', 'count'] as const;
|
|
10
|
+
|
|
11
|
+
export const avatarPropTypes = {
|
|
12
|
+
src: {
|
|
13
|
+
type: String,
|
|
14
|
+
},
|
|
15
|
+
alt: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'Avatar',
|
|
18
|
+
},
|
|
19
|
+
badge: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
type: String,
|
|
25
|
+
validator: (value: (typeof AVATAR_SIZE)[number]) => AVATAR_SIZE.includes(value),
|
|
26
|
+
default: '2xl',
|
|
27
|
+
},
|
|
28
|
+
notification: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
notificationText: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '0',
|
|
35
|
+
},
|
|
36
|
+
initial: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'Avatar',
|
|
39
|
+
},
|
|
40
|
+
color: {
|
|
41
|
+
type: String,
|
|
42
|
+
validator: (value: (typeof AVATAR_PRIMARY)[number]) => AVATAR_PRIMARY.includes(value),
|
|
43
|
+
default: 'primary',
|
|
44
|
+
},
|
|
45
|
+
status: {
|
|
46
|
+
type: String,
|
|
47
|
+
validator: (value: (typeof AVATAR_STATUS)[number]) => AVATAR_STATUS.includes(value),
|
|
48
|
+
default: 'brand',
|
|
49
|
+
},
|
|
50
|
+
count: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 0,
|
|
53
|
+
},
|
|
54
|
+
variant: {
|
|
55
|
+
type: String,
|
|
56
|
+
validator: (value: (typeof AVATAR_VARIANT)[number]) => AVATAR_VARIANT.includes(value),
|
|
57
|
+
default: 'initial',
|
|
58
|
+
},
|
|
59
|
+
loading: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const avatarEmitTypes = {
|
|
66
|
+
'image-error': (error: boolean) => typeof error === 'boolean',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type AvatarEmitTypes = typeof avatarEmitTypes;
|
|
70
|
+
|
|
71
|
+
export type AvatarPropTypes = ExtractPropTypes<typeof avatarPropTypes>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="spr-h-fit spr-w-fit">
|
|
3
|
-
<div v-if="!props.loading" :class="avatarClasses.baseClasses">
|
|
3
|
+
<div v-if="!props.loading && !imageError" :class="avatarClasses.baseClasses">
|
|
4
4
|
<template v-if="['image', 'client', 'user', 'user-group'].includes(props.variant) || $slots.default">
|
|
5
5
|
<div :class="avatarClasses.imageContainerClasses">
|
|
6
6
|
<slot>
|
|
7
|
-
<img v-if="src" :src="src" :alt="alt"
|
|
7
|
+
<img v-if="src" :src="src" :alt="alt" @error="handleImageError" />
|
|
8
8
|
<Icon v-else :icon="getIconVariant" />
|
|
9
9
|
</slot>
|
|
10
10
|
</div>
|
|
@@ -31,13 +31,18 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script lang="ts" setup>
|
|
34
|
-
import { avatarPropTypes } from './avatar';
|
|
35
|
-
import { useAvatar } from './use-avatar';
|
|
36
34
|
import { Icon } from '@iconify/vue';
|
|
37
35
|
|
|
36
|
+
import { avatarPropTypes, avatarEmitTypes } from './avatar';
|
|
37
|
+
import { useAvatar } from './use-avatar';
|
|
38
|
+
|
|
38
39
|
import SprBadge from '@/components/badge/badge.vue';
|
|
39
40
|
|
|
40
41
|
const props = defineProps(avatarPropTypes);
|
|
42
|
+
const emit = defineEmits(avatarEmitTypes);
|
|
41
43
|
|
|
42
|
-
const { avatarClasses, getAvatarSize, getIconVariant, getInitials } = useAvatar(
|
|
44
|
+
const { avatarClasses, getAvatarSize, getIconVariant, getInitials, imageError, handleImageError } = useAvatar(
|
|
45
|
+
props,
|
|
46
|
+
emit,
|
|
47
|
+
);
|
|
43
48
|
</script>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { toRefs, computed, ComputedRef } from 'vue';
|
|
1
|
+
import { toRefs, computed, ComputedRef, ref } from 'vue';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { SetupContext } from 'vue';
|
|
6
|
+
import type { AvatarPropTypes, AvatarEmitTypes } from './avatar';
|
|
6
7
|
|
|
7
8
|
interface AvatarClasses {
|
|
8
9
|
baseClasses: string;
|
|
@@ -12,7 +13,7 @@ interface AvatarClasses {
|
|
|
12
13
|
onlineNotificationClasses: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export const useAvatar = (props: AvatarPropTypes) => {
|
|
16
|
+
export const useAvatar = (props: AvatarPropTypes, emit: SetupContext<AvatarEmitTypes>['emit']) => {
|
|
16
17
|
const { size, color, variant, initial, loading } = toRefs(props);
|
|
17
18
|
|
|
18
19
|
const avatarClasses: ComputedRef<AvatarClasses> = computed(() => {
|
|
@@ -132,10 +133,20 @@ export const useAvatar = (props: AvatarPropTypes) => {
|
|
|
132
133
|
return (firstInitial + lastInitial).slice(0, maxInitials);
|
|
133
134
|
});
|
|
134
135
|
|
|
136
|
+
const imageError = ref<boolean>(false);
|
|
137
|
+
|
|
138
|
+
const handleImageError = () => {
|
|
139
|
+
imageError.value = true;
|
|
140
|
+
|
|
141
|
+
emit('image-error', true);
|
|
142
|
+
};
|
|
143
|
+
|
|
135
144
|
return {
|
|
136
145
|
avatarClasses,
|
|
137
146
|
getAvatarSize,
|
|
138
147
|
getIconVariant,
|
|
139
148
|
getInitials,
|
|
149
|
+
imageError,
|
|
150
|
+
handleImageError,
|
|
140
151
|
};
|
|
141
152
|
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
const BADGE_VARIANT = ['danger', 'disabled', 'information', 'brand'] as const;
|
|
6
|
-
const BADGE_SIZE = ['small', 'big', 'tiny'] as const;
|
|
7
|
-
const BADGE_POSITION = ['top', 'bottom', 'default'] as const;
|
|
8
|
-
|
|
9
|
-
export const badgePropTypes = {
|
|
10
|
-
/**
|
|
11
|
-
* @description Badge Label
|
|
12
|
-
*/
|
|
13
|
-
text: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: '0',
|
|
16
|
-
},
|
|
17
|
-
/**
|
|
18
|
-
* @description Badge variant
|
|
19
|
-
*/
|
|
20
|
-
variant: {
|
|
21
|
-
type: String,
|
|
22
|
-
validator: (value: (typeof BADGE_VARIANT)[number]) => BADGE_VARIANT.includes(value),
|
|
23
|
-
default: 'brand',
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* @description Badge size
|
|
27
|
-
*/
|
|
28
|
-
size: {
|
|
29
|
-
type: String,
|
|
30
|
-
validator: (value: (typeof BADGE_SIZE)[number]) => BADGE_SIZE.includes(value),
|
|
31
|
-
default: 'small',
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* @description Badge position (top, bottom, default)
|
|
35
|
-
*/
|
|
36
|
-
position: {
|
|
37
|
-
type: String,
|
|
38
|
-
validator: (value: (typeof BADGE_POSITION)[number]) => BADGE_POSITION.includes(value),
|
|
39
|
-
default: 'default',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type BadgePropTypes = ExtractPropTypes<typeof badgePropTypes>;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
const BADGE_VARIANT = ['danger', 'disabled', 'information', 'brand'] as const;
|
|
6
|
+
const BADGE_SIZE = ['small', 'big', 'tiny'] as const;
|
|
7
|
+
const BADGE_POSITION = ['top', 'bottom', 'default'] as const;
|
|
8
|
+
|
|
9
|
+
export const badgePropTypes = {
|
|
10
|
+
/**
|
|
11
|
+
* @description Badge Label
|
|
12
|
+
*/
|
|
13
|
+
text: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: '0',
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* @description Badge variant
|
|
19
|
+
*/
|
|
20
|
+
variant: {
|
|
21
|
+
type: String,
|
|
22
|
+
validator: (value: (typeof BADGE_VARIANT)[number]) => BADGE_VARIANT.includes(value),
|
|
23
|
+
default: 'brand',
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* @description Badge size
|
|
27
|
+
*/
|
|
28
|
+
size: {
|
|
29
|
+
type: String,
|
|
30
|
+
validator: (value: (typeof BADGE_SIZE)[number]) => BADGE_SIZE.includes(value),
|
|
31
|
+
default: 'small',
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* @description Badge position (top, bottom, default)
|
|
35
|
+
*/
|
|
36
|
+
position: {
|
|
37
|
+
type: String,
|
|
38
|
+
validator: (value: (typeof BADGE_POSITION)[number]) => BADGE_POSITION.includes(value),
|
|
39
|
+
default: 'default',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type BadgePropTypes = ExtractPropTypes<typeof badgePropTypes>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { PropType, type ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const BANNER_TYPE = ['success', 'error', 'info', 'pending', 'caution'] as const;
|
|
4
|
-
|
|
5
|
-
export const bannerProps = {
|
|
6
|
-
type: {
|
|
7
|
-
type: String as PropType<(typeof BANNER_TYPE)[number]>,
|
|
8
|
-
validator: (value: (typeof BANNER_TYPE)[number]) => BANNER_TYPE.includes(value),
|
|
9
|
-
default: 'success',
|
|
10
|
-
},
|
|
11
|
-
showCloseButton: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: false,
|
|
14
|
-
},
|
|
15
|
-
message: {
|
|
16
|
-
type: String,
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type BannerPropTypes = ExtractPropTypes<typeof bannerProps>;
|
|
1
|
+
import { PropType, type ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const BANNER_TYPE = ['success', 'error', 'info', 'pending', 'caution'] as const;
|
|
4
|
+
|
|
5
|
+
export const bannerProps = {
|
|
6
|
+
type: {
|
|
7
|
+
type: String as PropType<(typeof BANNER_TYPE)[number]>,
|
|
8
|
+
validator: (value: (typeof BANNER_TYPE)[number]) => BANNER_TYPE.includes(value),
|
|
9
|
+
default: 'success',
|
|
10
|
+
},
|
|
11
|
+
showCloseButton: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
message: {
|
|
16
|
+
type: String,
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type BannerPropTypes = ExtractPropTypes<typeof bannerProps>;
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
const BUTTON_TONES = ['neutral', 'success', 'danger'] as const;
|
|
6
|
-
const BUTTON_SIZES = ['small', 'medium', 'large'] as const;
|
|
7
|
-
const BUTTON_TYPES = ['button', 'submit', 'reset'] as const;
|
|
8
|
-
const BUTTON_STATES = ['base', 'hover', 'pressed', 'focus'] as const;
|
|
9
|
-
const BUTTON_VARIANTS = ['primary', 'secondary', 'tertiary'] as const;
|
|
10
|
-
|
|
11
|
-
export const buttonPropTypes = {
|
|
12
|
-
/**
|
|
13
|
-
* @description Button tone
|
|
14
|
-
*/
|
|
15
|
-
tone: {
|
|
16
|
-
type: String as PropType<(typeof BUTTON_TONES)[number]>,
|
|
17
|
-
validator: (value: (typeof BUTTON_TONES)[number]) => BUTTON_TONES.includes(value),
|
|
18
|
-
default: 'neutral',
|
|
19
|
-
},
|
|
20
|
-
/**
|
|
21
|
-
* @description Button size
|
|
22
|
-
*/
|
|
23
|
-
size: {
|
|
24
|
-
type: String as PropType<(typeof BUTTON_SIZES)[number]>,
|
|
25
|
-
validator: (value: (typeof BUTTON_SIZES)[number]) => BUTTON_SIZES.includes(value),
|
|
26
|
-
default: 'medium',
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* @description Native button type
|
|
30
|
-
*/
|
|
31
|
-
type: {
|
|
32
|
-
type: String as PropType<(typeof BUTTON_TYPES)[number]>,
|
|
33
|
-
validator: (value: (typeof BUTTON_TYPES)[number]) => BUTTON_TYPES.includes(value),
|
|
34
|
-
default: 'button',
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* @description Button state
|
|
38
|
-
*/
|
|
39
|
-
state: {
|
|
40
|
-
type: String as PropType<(typeof BUTTON_STATES)[number]>,
|
|
41
|
-
validator: (value: (typeof BUTTON_STATES)[number]) => BUTTON_STATES.includes(value),
|
|
42
|
-
default: 'base',
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* @description Button Variant
|
|
46
|
-
*/
|
|
47
|
-
variant: {
|
|
48
|
-
type: String as PropType<(typeof BUTTON_VARIANTS)[number]>,
|
|
49
|
-
validator: (value: (typeof BUTTON_VARIANTS)[number]) => BUTTON_VARIANTS.includes(value),
|
|
50
|
-
default: 'primary',
|
|
51
|
-
},
|
|
52
|
-
disabled: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: false,
|
|
55
|
-
},
|
|
56
|
-
hasIcon: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false,
|
|
59
|
-
},
|
|
60
|
-
fullwidth: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const buttonEmitTypes = {
|
|
67
|
-
click: (evt: MouseEvent): evt is MouseEvent => evt instanceof MouseEvent,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export type ButtonPropTypes = ExtractPropTypes<typeof buttonPropTypes>;
|
|
71
|
-
export type ButtonEmitTypes = typeof buttonEmitTypes;
|
|
72
|
-
export type ButtonType = ButtonPropTypes['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 BUTTON_TONES = ['neutral', 'success', 'danger'] as const;
|
|
6
|
+
const BUTTON_SIZES = ['small', 'medium', 'large'] as const;
|
|
7
|
+
const BUTTON_TYPES = ['button', 'submit', 'reset'] as const;
|
|
8
|
+
const BUTTON_STATES = ['base', 'hover', 'pressed', 'focus'] as const;
|
|
9
|
+
const BUTTON_VARIANTS = ['primary', 'secondary', 'tertiary'] as const;
|
|
10
|
+
|
|
11
|
+
export const buttonPropTypes = {
|
|
12
|
+
/**
|
|
13
|
+
* @description Button tone
|
|
14
|
+
*/
|
|
15
|
+
tone: {
|
|
16
|
+
type: String as PropType<(typeof BUTTON_TONES)[number]>,
|
|
17
|
+
validator: (value: (typeof BUTTON_TONES)[number]) => BUTTON_TONES.includes(value),
|
|
18
|
+
default: 'neutral',
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* @description Button size
|
|
22
|
+
*/
|
|
23
|
+
size: {
|
|
24
|
+
type: String as PropType<(typeof BUTTON_SIZES)[number]>,
|
|
25
|
+
validator: (value: (typeof BUTTON_SIZES)[number]) => BUTTON_SIZES.includes(value),
|
|
26
|
+
default: 'medium',
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* @description Native button type
|
|
30
|
+
*/
|
|
31
|
+
type: {
|
|
32
|
+
type: String as PropType<(typeof BUTTON_TYPES)[number]>,
|
|
33
|
+
validator: (value: (typeof BUTTON_TYPES)[number]) => BUTTON_TYPES.includes(value),
|
|
34
|
+
default: 'button',
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* @description Button state
|
|
38
|
+
*/
|
|
39
|
+
state: {
|
|
40
|
+
type: String as PropType<(typeof BUTTON_STATES)[number]>,
|
|
41
|
+
validator: (value: (typeof BUTTON_STATES)[number]) => BUTTON_STATES.includes(value),
|
|
42
|
+
default: 'base',
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* @description Button Variant
|
|
46
|
+
*/
|
|
47
|
+
variant: {
|
|
48
|
+
type: String as PropType<(typeof BUTTON_VARIANTS)[number]>,
|
|
49
|
+
validator: (value: (typeof BUTTON_VARIANTS)[number]) => BUTTON_VARIANTS.includes(value),
|
|
50
|
+
default: 'primary',
|
|
51
|
+
},
|
|
52
|
+
disabled: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
hasIcon: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
fullwidth: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const buttonEmitTypes = {
|
|
67
|
+
click: (evt: MouseEvent): evt is MouseEvent => evt instanceof MouseEvent,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type ButtonPropTypes = ExtractPropTypes<typeof buttonPropTypes>;
|
|
71
|
+
export type ButtonEmitTypes = typeof buttonEmitTypes;
|
|
72
|
+
export type ButtonType = ButtonPropTypes['type'];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button ref="buttonRef" :class="buttonClassses" v-bind="buttonProps" @click="handleClick">
|
|
3
|
-
<slot />
|
|
4
|
-
</button>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts" setup>
|
|
8
|
-
import { buttonEmitTypes, buttonPropTypes } from './button';
|
|
9
|
-
import { useButton } from './use-button';
|
|
10
|
-
|
|
11
|
-
const props = defineProps(buttonPropTypes);
|
|
12
|
-
const emit = defineEmits(buttonEmitTypes);
|
|
13
|
-
|
|
14
|
-
const { buttonRef, buttonClassses, buttonProps, handleClick } = useButton(props, emit);
|
|
15
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<button ref="buttonRef" :class="buttonClassses" v-bind="buttonProps" @click="handleClick">
|
|
3
|
+
<slot />
|
|
4
|
+
</button>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { buttonEmitTypes, buttonPropTypes } from './button';
|
|
9
|
+
import { useButton } from './use-button';
|
|
10
|
+
|
|
11
|
+
const props = defineProps(buttonPropTypes);
|
|
12
|
+
const emit = defineEmits(buttonEmitTypes);
|
|
13
|
+
|
|
14
|
+
const { buttonRef, buttonClassses, buttonProps, handleClick } = useButton(props, emit);
|
|
15
|
+
</script>
|
|
@@ -82,8 +82,18 @@ export const calendarPropTypes = {
|
|
|
82
82
|
},
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
export const calendarEmitTypes =
|
|
86
|
-
|
|
85
|
+
export const calendarEmitTypes = [
|
|
86
|
+
'loadMore',
|
|
87
|
+
'onCellClick',
|
|
88
|
+
'update:firstLastDayOfWeek',
|
|
89
|
+
'update:sort',
|
|
90
|
+
'update:search',
|
|
91
|
+
'update:selectedCell',
|
|
92
|
+
'update:selectedCompany',
|
|
93
|
+
'update:selectedDepartment',
|
|
94
|
+
'update:selectedBranch',
|
|
95
|
+
'onClickEmptyButton',
|
|
96
|
+
];
|
|
87
97
|
export type CalendarEmitTypes = typeof calendarEmitTypes;
|
|
88
98
|
|
|
89
99
|
export type CalendarPropTypes = ExtractPropTypes<typeof calendarPropTypes>;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
const BORDER_RADIUS_SIZE = ['xl', 'lg', 'md', 'sm', 'xs', '2xs'] as const;
|
|
6
|
-
|
|
7
|
-
export const cardPropTypes = {
|
|
8
|
-
title: {
|
|
9
|
-
type: String,
|
|
10
|
-
default: '',
|
|
11
|
-
},
|
|
12
|
-
subtitle: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: '',
|
|
15
|
-
},
|
|
16
|
-
headerIcon: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: '',
|
|
19
|
-
},
|
|
20
|
-
showHeader: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
default: true,
|
|
23
|
-
},
|
|
24
|
-
showFooter: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: true,
|
|
27
|
-
},
|
|
28
|
-
borderRadiusSize: {
|
|
29
|
-
type: String,
|
|
30
|
-
validator: (value: (typeof BORDER_RADIUS_SIZE)[number]) => BORDER_RADIUS_SIZE.includes(value),
|
|
31
|
-
default: 'xl',
|
|
32
|
-
},
|
|
33
|
-
hasCollapsible: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: false,
|
|
36
|
-
},
|
|
37
|
-
isCollapsibleOpen: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false,
|
|
40
|
-
},
|
|
41
|
-
hasContentPadding: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: true,
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
flexbox: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type CardPropTypes = ExtractPropTypes<typeof cardPropTypes>;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
const BORDER_RADIUS_SIZE = ['xl', 'lg', 'md', 'sm', 'xs', '2xs'] as const;
|
|
6
|
+
|
|
7
|
+
export const cardPropTypes = {
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: '',
|
|
11
|
+
},
|
|
12
|
+
subtitle: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: '',
|
|
15
|
+
},
|
|
16
|
+
headerIcon: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
showHeader: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true,
|
|
23
|
+
},
|
|
24
|
+
showFooter: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true,
|
|
27
|
+
},
|
|
28
|
+
borderRadiusSize: {
|
|
29
|
+
type: String,
|
|
30
|
+
validator: (value: (typeof BORDER_RADIUS_SIZE)[number]) => BORDER_RADIUS_SIZE.includes(value),
|
|
31
|
+
default: 'xl',
|
|
32
|
+
},
|
|
33
|
+
hasCollapsible: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
isCollapsibleOpen: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
hasContentPadding: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
flexbox: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type CardPropTypes = ExtractPropTypes<typeof cardPropTypes>;
|