design-system-next 2.12.1 → 2.12.3

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 (84) hide show
  1. package/dist/design-system-next.es.js +5986 -6186
  2. package/dist/design-system-next.es.js.gz +0 -0
  3. package/dist/design-system-next.umd.js +12 -12
  4. package/dist/design-system-next.umd.js.gz +0 -0
  5. package/dist/main.css +1 -1
  6. package/dist/main.css.gz +0 -0
  7. package/dist/package.json.d.ts +1 -1
  8. package/package.json +1 -1
  9. package/src/App.vue +49 -1
  10. package/src/assets/scripts/border-radius.ts +15 -15
  11. package/src/assets/scripts/colors.ts +134 -134
  12. package/src/assets/scripts/max-width.ts +11 -11
  13. package/src/assets/scripts/spacing.ts +23 -23
  14. package/src/assets/scripts/utilities.ts +15 -15
  15. package/src/components/accordion/accordion.ts +43 -43
  16. package/src/components/accordion/use-accordion.ts +43 -43
  17. package/src/components/avatar/avatar.ts +64 -64
  18. package/src/components/badge/badge.ts +43 -43
  19. package/src/components/banner/banner.ts +20 -20
  20. package/src/components/button/button.ts +72 -72
  21. package/src/components/button/button.vue +15 -15
  22. package/src/components/card/card.ts +52 -52
  23. package/src/components/checkbox/checkbox.ts +45 -45
  24. package/src/components/chips/chips.ts +101 -95
  25. package/src/components/chips/use-chips.ts +11 -3
  26. package/src/components/collapsible/collapsible.ts +21 -21
  27. package/src/components/collapsible/collapsible.vue +27 -27
  28. package/src/components/date-picker/__tests__/date-picker.test.ts +112 -112
  29. package/src/components/date-picker/date-picker.ts +157 -157
  30. package/src/components/dropdown/__tests__/dropdown-fixes.spec.ts +106 -106
  31. package/src/components/dropdown/__tests__/dropdown-value-types.spec.ts +213 -213
  32. package/src/components/dropdown/fix-multi-number.ts +92 -92
  33. package/src/components/dropdown/use-dropdown.ts +488 -488
  34. package/src/components/empty-state/empty-state.ts +50 -50
  35. package/src/components/file-upload/file-upload.ts +87 -87
  36. package/src/components/floating-action/floating-action.ts +12 -12
  37. package/src/components/input/input-contact-number/input-contact-number.ts +83 -83
  38. package/src/components/input/input-email/input-email.vue +17 -17
  39. package/src/components/input/input-password/use-input-password.ts +19 -19
  40. package/src/components/input/input-search/input-search.vue +13 -13
  41. package/src/components/input/input-url/input-url.vue +20 -20
  42. package/src/components/input/input-username/input-username.vue +17 -17
  43. package/src/components/input/input.vue +72 -72
  44. package/src/components/list/ladderized-list/ladderized-list.ts +39 -39
  45. package/src/components/logo/logo.ts +43 -43
  46. package/src/components/logo/logo.vue +14 -14
  47. package/src/components/logo/use-logo.ts +41 -41
  48. package/src/components/modal/modal.ts +45 -45
  49. package/src/components/progress-bar/progress-bar.ts +39 -39
  50. package/src/components/radio/radio.ts +42 -42
  51. package/src/components/select/select.ts +144 -144
  52. package/src/components/sidepanel/sidepanel.vue +55 -55
  53. package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.ts +16 -16
  54. package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.vue +39 -39
  55. package/src/components/slider/slider.ts +38 -38
  56. package/src/components/snackbar/snack/snack.ts +71 -71
  57. package/src/components/snackbar/use-snackbar.ts +34 -34
  58. package/src/components/status/status.ts +19 -19
  59. package/src/components/status/status.vue +13 -13
  60. package/src/components/stepper/step/step.ts +47 -47
  61. package/src/components/stepper/stepper.ts +47 -47
  62. package/src/components/stepper/stepper.vue +34 -34
  63. package/src/components/switch/switch.ts +42 -42
  64. package/src/components/table/table-actions/table-actions.ts +42 -42
  65. package/src/components/table/table-actions/table-actions.vue +40 -40
  66. package/src/components/table/table-chips-title/table-chips-title.ts +27 -27
  67. package/src/components/table/table-chips-title/table-chips-title.vue +32 -32
  68. package/src/components/table/table-chips-title/use-table-chips-title.ts +22 -22
  69. package/src/components/table/table-lozenge-title/table-lozenge-title.ts +23 -23
  70. package/src/components/table/table-lozenge-title/table-lozenge-title.vue +26 -26
  71. package/src/components/table/table-lozenge-title/use-table-lozenge-title.ts +21 -21
  72. package/src/components/table/table-pagination/table-pagination.ts +63 -63
  73. package/src/components/table/table-pagination/table-pagination.vue +72 -72
  74. package/src/components/table/table.ts +174 -173
  75. package/src/components/table/table.vue +1 -1
  76. package/src/components/table/use-table.ts +13 -8
  77. package/src/components/tabs/tabs.ts +43 -43
  78. package/src/components/textarea/textarea.ts +72 -72
  79. package/src/components/textarea/textarea.vue +45 -45
  80. package/src/components/time-picker/time-picker.ts +69 -69
  81. package/src/components/tooltip/use-tooltip.ts +13 -13
  82. package/src/examples/dropdown-number-multi-select.vue +76 -76
  83. package/src/stores/useSnackbarStore.ts +44 -44
  84. package/src/vite-env.d.ts +0 -6
@@ -1,134 +1,134 @@
1
- /*
2
- Toge Design System v3.0 - Color Scheme
3
- (https://www.figma.com/design/tlGkN8uKvxVIHB1FgYRIaF/%F0%9F%8C%B1-Toge-Styles-3.0?node-id=2281-4697&node-type=section&m=dev)
4
- */
5
-
6
- type ColorShadesTypes = {
7
- [key: number]: string;
8
- };
9
-
10
- type ColorPaletteTypes = {
11
- [colorName: string]: ColorShadesTypes;
12
- };
13
-
14
- const colorScheme: ColorPaletteTypes = {
15
- white: {
16
- 50: '#FFFFFF',
17
- 100: '#F1F2F3',
18
- 200: '#DBDBDD',
19
- 300: '#BABCC0',
20
- 400: '#989898',
21
- 500: '#7C7C7C',
22
- 600: '#656565',
23
- 700: '#525252',
24
- 800: '#464646',
25
- 900: '#3D3D3D',
26
- 950: '#292929',
27
- },
28
- mushroom: {
29
- 50: '#EFF1F1',
30
- 100: '#E6EAEA',
31
- 200: '#D9DEDE',
32
- 300: '#B8C1C0',
33
- 400: '#919F9D',
34
- 500: '#738482',
35
- 600: '#5D6C6B',
36
- 700: '#4C5857',
37
- 800: '#414B4B',
38
- 900: '#394141',
39
- 950: '#262B2B',
40
- },
41
- tomato: {
42
- 50: '#FEF2F3',
43
- 100: '#FEE2E3',
44
- 200: '#FDCBCE',
45
- 300: '#FBA6AA',
46
- 400: '#F6737A',
47
- 500: '#EC4750',
48
- 600: '#DA2F38',
49
- 700: '#B61F27',
50
- 800: '#971D23',
51
- 900: '#7D1F24',
52
- 950: '#440B0E',
53
- },
54
- carrot: {
55
- 50: '#FFFAEC',
56
- 100: '#FFF4D3',
57
- 200: '#FFE5A5',
58
- 300: '#FFD16D',
59
- 400: '#FFB132',
60
- 500: '#FF970A',
61
- 600: '#FF7F00',
62
- 700: '#CC5C02',
63
- 800: '#A1470B',
64
- 900: '#823C0C',
65
- 950: '#461C04',
66
- },
67
- mango: {
68
- 50: '#FFFFEA',
69
- 100: '#FFFBC5',
70
- 200: '#FFF885',
71
- 300: '#FFED46',
72
- 400: '#FFDF1B',
73
- 500: '#FFBF00',
74
- 600: '#E29300',
75
- 700: '#BB6802',
76
- 800: '#985008',
77
- 900: '#7C420B',
78
- 950: '#482200',
79
- },
80
- kangkong: {
81
- 50: '#F0FDF4',
82
- 100: '#DCFCE6',
83
- 200: '#BBF7CE',
84
- 300: '#86EFA8',
85
- 400: '#4ADE7B',
86
- 500: '#22C558',
87
- 600: '#17AD49',
88
- 700: '#158039',
89
- 800: '#166531',
90
- 900: '#14532B',
91
- 950: '#052E15',
92
- },
93
- wintermelon: {
94
- 50: '#ECFEFF',
95
- 100: '#CEFBFF',
96
- 200: '#A3F3FE',
97
- 300: '#64E9FC',
98
- 400: '#1ED5F2',
99
- 500: '#02AFCE',
100
- 600: '#0592B5',
101
- 700: '#0C7492',
102
- 800: '#135E77',
103
- 900: '#154E64',
104
- 950: '#073345',
105
- },
106
- blueberry: {
107
- 50: '#EEF7FF',
108
- 100: '#D8EBFF',
109
- 200: '#BADCFF',
110
- 300: '#8BBDFF',
111
- 400: '#549EFF',
112
- 500: '#2D88FF',
113
- 600: '#1679FA',
114
- 700: '#0F6EEB',
115
- 800: '#1356BA',
116
- 900: '#164B92',
117
- 950: '#122E59',
118
- },
119
- ubas: {
120
- 50: '#F5F3FF',
121
- 100: '#EEE9FE',
122
- 200: '#DED6FE',
123
- 300: '#C6B5FD',
124
- 400: '#AA8BFA',
125
- 500: '#8952F6',
126
- 600: '#8139EE',
127
- 700: '#7227DA',
128
- 800: '#5F21B6',
129
- 900: '#501D95',
130
- 950: '#311065',
131
- },
132
- };
133
- export type { ColorShadesTypes, ColorPaletteTypes };
134
- export default colorScheme;
1
+ /*
2
+ Toge Design System v3.0 - Color Scheme
3
+ (https://www.figma.com/design/tlGkN8uKvxVIHB1FgYRIaF/%F0%9F%8C%B1-Toge-Styles-3.0?node-id=2281-4697&node-type=section&m=dev)
4
+ */
5
+
6
+ type ColorShadesTypes = {
7
+ [key: number]: string;
8
+ };
9
+
10
+ type ColorPaletteTypes = {
11
+ [colorName: string]: ColorShadesTypes;
12
+ };
13
+
14
+ const colorScheme: ColorPaletteTypes = {
15
+ white: {
16
+ 50: '#FFFFFF',
17
+ 100: '#F1F2F3',
18
+ 200: '#DBDBDD',
19
+ 300: '#BABCC0',
20
+ 400: '#989898',
21
+ 500: '#7C7C7C',
22
+ 600: '#656565',
23
+ 700: '#525252',
24
+ 800: '#464646',
25
+ 900: '#3D3D3D',
26
+ 950: '#292929',
27
+ },
28
+ mushroom: {
29
+ 50: '#EFF1F1',
30
+ 100: '#E6EAEA',
31
+ 200: '#D9DEDE',
32
+ 300: '#B8C1C0',
33
+ 400: '#919F9D',
34
+ 500: '#738482',
35
+ 600: '#5D6C6B',
36
+ 700: '#4C5857',
37
+ 800: '#414B4B',
38
+ 900: '#394141',
39
+ 950: '#262B2B',
40
+ },
41
+ tomato: {
42
+ 50: '#FEF2F3',
43
+ 100: '#FEE2E3',
44
+ 200: '#FDCBCE',
45
+ 300: '#FBA6AA',
46
+ 400: '#F6737A',
47
+ 500: '#EC4750',
48
+ 600: '#DA2F38',
49
+ 700: '#B61F27',
50
+ 800: '#971D23',
51
+ 900: '#7D1F24',
52
+ 950: '#440B0E',
53
+ },
54
+ carrot: {
55
+ 50: '#FFFAEC',
56
+ 100: '#FFF4D3',
57
+ 200: '#FFE5A5',
58
+ 300: '#FFD16D',
59
+ 400: '#FFB132',
60
+ 500: '#FF970A',
61
+ 600: '#FF7F00',
62
+ 700: '#CC5C02',
63
+ 800: '#A1470B',
64
+ 900: '#823C0C',
65
+ 950: '#461C04',
66
+ },
67
+ mango: {
68
+ 50: '#FFFFEA',
69
+ 100: '#FFFBC5',
70
+ 200: '#FFF885',
71
+ 300: '#FFED46',
72
+ 400: '#FFDF1B',
73
+ 500: '#FFBF00',
74
+ 600: '#E29300',
75
+ 700: '#BB6802',
76
+ 800: '#985008',
77
+ 900: '#7C420B',
78
+ 950: '#482200',
79
+ },
80
+ kangkong: {
81
+ 50: '#F0FDF4',
82
+ 100: '#DCFCE6',
83
+ 200: '#BBF7CE',
84
+ 300: '#86EFA8',
85
+ 400: '#4ADE7B',
86
+ 500: '#22C558',
87
+ 600: '#17AD49',
88
+ 700: '#158039',
89
+ 800: '#166531',
90
+ 900: '#14532B',
91
+ 950: '#052E15',
92
+ },
93
+ wintermelon: {
94
+ 50: '#ECFEFF',
95
+ 100: '#CEFBFF',
96
+ 200: '#A3F3FE',
97
+ 300: '#64E9FC',
98
+ 400: '#1ED5F2',
99
+ 500: '#02AFCE',
100
+ 600: '#0592B5',
101
+ 700: '#0C7492',
102
+ 800: '#135E77',
103
+ 900: '#154E64',
104
+ 950: '#073345',
105
+ },
106
+ blueberry: {
107
+ 50: '#EEF7FF',
108
+ 100: '#D8EBFF',
109
+ 200: '#BADCFF',
110
+ 300: '#8BBDFF',
111
+ 400: '#549EFF',
112
+ 500: '#2D88FF',
113
+ 600: '#1679FA',
114
+ 700: '#0F6EEB',
115
+ 800: '#1356BA',
116
+ 900: '#164B92',
117
+ 950: '#122E59',
118
+ },
119
+ ubas: {
120
+ 50: '#F5F3FF',
121
+ 100: '#EEE9FE',
122
+ 200: '#DED6FE',
123
+ 300: '#C6B5FD',
124
+ 400: '#AA8BFA',
125
+ 500: '#8952F6',
126
+ 600: '#8139EE',
127
+ 700: '#7227DA',
128
+ 800: '#5F21B6',
129
+ 900: '#501D95',
130
+ 950: '#311065',
131
+ },
132
+ };
133
+ export type { ColorShadesTypes, ColorPaletteTypes };
134
+ export default colorScheme;
@@ -1,11 +1,11 @@
1
- type MaxWidthTypes = {
2
- [key: string]: string;
3
- };
4
-
5
- const maxWidth: MaxWidthTypes = {
6
- 'sm': '640px',
7
- 'md': '1000px',
8
- 'lg': '1320px',
9
- };
10
-
11
- export default maxWidth;
1
+ type MaxWidthTypes = {
2
+ [key: string]: string;
3
+ };
4
+
5
+ const maxWidth: MaxWidthTypes = {
6
+ 'sm': '640px',
7
+ 'md': '1000px',
8
+ 'lg': '1320px',
9
+ };
10
+
11
+ export default maxWidth;
@@ -1,23 +1,23 @@
1
- type spacingTypes = {
2
- [key: string]: string;
3
- };
4
-
5
- const spacing: spacingTypes = {
6
- 'size-spacing-6xs': 'var(--size-50)',
7
- 'size-spacing-5xs': 'var(--size-100)',
8
- 'size-spacing-4xs': 'var(--size-150)',
9
- 'size-spacing-3xs': 'var(--size-200)',
10
- 'size-spacing-2xs': 'var(--size-250)',
11
- 'size-spacing-xs': 'var(--size-300)',
12
- 'size-spacing-sm': 'var(--size-400)',
13
- 'size-spacing-md': 'var(--size-500)',
14
- 'size-spacing-lg': 'var(--size-600)',
15
- 'size-spacing-xl': 'var(--size-700)',
16
- 'size-spacing-2xl': 'var(--size-800)',
17
- 'size-spacing-3xl': 'var(--size-900)',
18
- 'size-spacing-4xl': 'var(--size-1000)',
19
- 'size-spacing-5xl': 'var(--size-1100)',
20
- 'size-spacing-6xl': 'var(--size-1200)',
21
- };
22
-
23
- export default spacing;
1
+ type spacingTypes = {
2
+ [key: string]: string;
3
+ };
4
+
5
+ const spacing: spacingTypes = {
6
+ 'size-spacing-6xs': 'var(--size-50)',
7
+ 'size-spacing-5xs': 'var(--size-100)',
8
+ 'size-spacing-4xs': 'var(--size-150)',
9
+ 'size-spacing-3xs': 'var(--size-200)',
10
+ 'size-spacing-2xs': 'var(--size-250)',
11
+ 'size-spacing-xs': 'var(--size-300)',
12
+ 'size-spacing-sm': 'var(--size-400)',
13
+ 'size-spacing-md': 'var(--size-500)',
14
+ 'size-spacing-lg': 'var(--size-600)',
15
+ 'size-spacing-xl': 'var(--size-700)',
16
+ 'size-spacing-2xl': 'var(--size-800)',
17
+ 'size-spacing-3xl': 'var(--size-900)',
18
+ 'size-spacing-4xl': 'var(--size-1000)',
19
+ 'size-spacing-5xl': 'var(--size-1100)',
20
+ 'size-spacing-6xl': 'var(--size-1200)',
21
+ };
22
+
23
+ export default spacing;
@@ -1,15 +1,15 @@
1
- type utilitiesTypes = {
2
- [key: string]: {
3
- backgroundColor?: string;
4
- opacity?: string;
5
- };
6
- };
7
-
8
- const utilities: utilitiesTypes = {
9
- 'bg-overlay': {
10
- backgroundColor: '#4C5857',
11
- opacity: '0.6',
12
- },
13
- };
14
-
15
- export default utilities;
1
+ type utilitiesTypes = {
2
+ [key: string]: {
3
+ backgroundColor?: string;
4
+ opacity?: string;
5
+ };
6
+ };
7
+
8
+ const utilities: utilitiesTypes = {
9
+ 'bg-overlay': {
10
+ backgroundColor: '#4C5857',
11
+ opacity: '0.6',
12
+ },
13
+ };
14
+
15
+ export default utilities;
@@ -1,43 +1,43 @@
1
- import type { PropType, ExtractPropTypes } from 'vue';
2
-
3
- const ACCORDION_TRIGGER = ['header', 'button'] as const;
4
-
5
- export interface AccordionItem {
6
- title: string;
7
- subtitle?: string;
8
- collapseId: string;
9
- }
10
-
11
- /**
12
- * Defines the prop types for the Accordion component.
13
- *
14
- * @property accordionItems - An array of accordion items. This property is required and defaults to an empty array.
15
- * @property alwaysOpen - A boolean indicating whether multiple accordion items can be open at the same time. Defaults to `false`.
16
- * @property isDefaultOpen - A boolean indicating whether the accordion is open by default. Defaults to `false`. Won't work if alwaysOpen is false.
17
- */
18
- export const accordionPropTypes = {
19
- accordionItems: {
20
- type: Array as PropType<AccordionItem[]>,
21
- required: true,
22
- default: () => [],
23
- },
24
- alwaysOpen: {
25
- type: Boolean,
26
- default: false,
27
- },
28
- isDefaultOpen: {
29
- type: Boolean,
30
- default: false
31
- },
32
- accordionTrigger: {
33
- type: String,
34
- validator: (value: (typeof ACCORDION_TRIGGER)[number]) => ACCORDION_TRIGGER.includes(value),
35
- default: 'button'
36
- },
37
- bordered: {
38
- type: Boolean,
39
- default: true
40
- }
41
- }
42
-
43
- export type AccordionPropTypes = ExtractPropTypes<typeof accordionPropTypes>;
1
+ import type { PropType, ExtractPropTypes } from 'vue';
2
+
3
+ const ACCORDION_TRIGGER = ['header', 'button'] as const;
4
+
5
+ export interface AccordionItem {
6
+ title: string;
7
+ subtitle?: string;
8
+ collapseId: string;
9
+ }
10
+
11
+ /**
12
+ * Defines the prop types for the Accordion component.
13
+ *
14
+ * @property accordionItems - An array of accordion items. This property is required and defaults to an empty array.
15
+ * @property alwaysOpen - A boolean indicating whether multiple accordion items can be open at the same time. Defaults to `false`.
16
+ * @property isDefaultOpen - A boolean indicating whether the accordion is open by default. Defaults to `false`. Won't work if alwaysOpen is false.
17
+ */
18
+ export const accordionPropTypes = {
19
+ accordionItems: {
20
+ type: Array as PropType<AccordionItem[]>,
21
+ required: true,
22
+ default: () => [],
23
+ },
24
+ alwaysOpen: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ isDefaultOpen: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ accordionTrigger: {
33
+ type: String,
34
+ validator: (value: (typeof ACCORDION_TRIGGER)[number]) => ACCORDION_TRIGGER.includes(value),
35
+ default: 'button'
36
+ },
37
+ bordered: {
38
+ type: Boolean,
39
+ default: true
40
+ }
41
+ }
42
+
43
+ export type AccordionPropTypes = ExtractPropTypes<typeof accordionPropTypes>;
@@ -1,43 +1,43 @@
1
-
2
- import type { AccordionPropTypes } from './accordion';
3
- import { toRefs, reactive, ref } from 'vue';
4
-
5
- export const useAccordion = (props: AccordionPropTypes) => {
6
- const { accordionItems, isDefaultOpen, alwaysOpen } = toRefs(props);
7
- const clickedIndex = ref<number>()
8
-
9
- const collapsedState = reactive(accordionItems.value.map(() => isDefaultOpen.value && alwaysOpen.value));
10
-
11
- const toggleCollapse = (index: number) => {
12
- if (index < 0 || index >= collapsedState.length) return;
13
-
14
- collapsedState[index] = !collapsedState[index];
15
-
16
- if (!props.alwaysOpen) {
17
- collapsedState.forEach((_, i) => {
18
- if (i !== index) {
19
- collapsedState[i] = false;
20
- }
21
- });
22
- }
23
- };
24
-
25
- const setClickedIndex = (index: number) => {
26
- clickedIndex.value = index
27
- }
28
-
29
- const clearIndex = () => {
30
- clickedIndex.value = undefined
31
- }
32
-
33
- return {
34
- accordionItems,
35
- isDefaultOpen,
36
- alwaysOpen,
37
- collapsedState,
38
- toggleCollapse,
39
- setClickedIndex,
40
- clearIndex,
41
- clickedIndex
42
- }
43
- };
1
+
2
+ import type { AccordionPropTypes } from './accordion';
3
+ import { toRefs, reactive, ref } from 'vue';
4
+
5
+ export const useAccordion = (props: AccordionPropTypes) => {
6
+ const { accordionItems, isDefaultOpen, alwaysOpen } = toRefs(props);
7
+ const clickedIndex = ref<number>()
8
+
9
+ const collapsedState = reactive(accordionItems.value.map(() => isDefaultOpen.value && alwaysOpen.value));
10
+
11
+ const toggleCollapse = (index: number) => {
12
+ if (index < 0 || index >= collapsedState.length) return;
13
+
14
+ collapsedState[index] = !collapsedState[index];
15
+
16
+ if (!props.alwaysOpen) {
17
+ collapsedState.forEach((_, i) => {
18
+ if (i !== index) {
19
+ collapsedState[i] = false;
20
+ }
21
+ });
22
+ }
23
+ };
24
+
25
+ const setClickedIndex = (index: number) => {
26
+ clickedIndex.value = index
27
+ }
28
+
29
+ const clearIndex = () => {
30
+ clickedIndex.value = undefined
31
+ }
32
+
33
+ return {
34
+ accordionItems,
35
+ isDefaultOpen,
36
+ alwaysOpen,
37
+ collapsedState,
38
+ toggleCollapse,
39
+ setClickedIndex,
40
+ clearIndex,
41
+ clickedIndex
42
+ }
43
+ };
@@ -1,64 +1,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'] as const;
7
- const AVATAR_STATUS = ['danger', 'disabled', 'information', 'brand'] as const;
8
- export const AVATAR_VARIANT = ['image', 'initial', 'client', 'user', 'user-group', 'count'] as const;
9
-
10
- export const avatarPropTypes = {
11
- src: {
12
- type: String,
13
- },
14
- alt: {
15
- type: String,
16
- default: 'Avatar',
17
- },
18
- badge: {
19
- type: Boolean,
20
- default: false,
21
- },
22
- size: {
23
- type: String,
24
- validator: (value: (typeof AVATAR_SIZE)[number]) => AVATAR_SIZE.includes(value),
25
- default: '2xl',
26
- },
27
- notification: {
28
- type: Boolean,
29
- default: false,
30
- },
31
- notificationText: {
32
- type: String,
33
- default: '0',
34
- },
35
- initial: {
36
- type: String,
37
- default: 'Avatar',
38
- },
39
- color: {
40
- type: String,
41
- validator: (value: (typeof AVATAR_PRIMARY)[number]) => AVATAR_PRIMARY.includes(value),
42
- default: 'primary',
43
- },
44
- status: {
45
- type: String,
46
- validator: (value: (typeof AVATAR_STATUS)[number]) => AVATAR_STATUS.includes(value),
47
- default: 'brand',
48
- },
49
- count: {
50
- type: Number,
51
- default: 0,
52
- },
53
- variant: {
54
- type: String,
55
- validator: (value: (typeof AVATAR_VARIANT)[number]) => AVATAR_VARIANT.includes(value),
56
- default: 'initial',
57
- },
58
- loading: {
59
- type: Boolean,
60
- default: false,
61
- },
62
- };
63
-
64
- export type AvatarPropTypes = ExtractPropTypes<typeof avatarPropTypes>;
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
+ export const AVATAR_VARIANT = ['image', 'initial', 'client', 'user', 'user-group', 'count'] as const;
9
+
10
+ export const avatarPropTypes = {
11
+ src: {
12
+ type: String,
13
+ },
14
+ alt: {
15
+ type: String,
16
+ default: 'Avatar',
17
+ },
18
+ badge: {
19
+ type: Boolean,
20
+ default: false,
21
+ },
22
+ size: {
23
+ type: String,
24
+ validator: (value: (typeof AVATAR_SIZE)[number]) => AVATAR_SIZE.includes(value),
25
+ default: '2xl',
26
+ },
27
+ notification: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ notificationText: {
32
+ type: String,
33
+ default: '0',
34
+ },
35
+ initial: {
36
+ type: String,
37
+ default: 'Avatar',
38
+ },
39
+ color: {
40
+ type: String,
41
+ validator: (value: (typeof AVATAR_PRIMARY)[number]) => AVATAR_PRIMARY.includes(value),
42
+ default: 'primary',
43
+ },
44
+ status: {
45
+ type: String,
46
+ validator: (value: (typeof AVATAR_STATUS)[number]) => AVATAR_STATUS.includes(value),
47
+ default: 'brand',
48
+ },
49
+ count: {
50
+ type: Number,
51
+ default: 0,
52
+ },
53
+ variant: {
54
+ type: String,
55
+ validator: (value: (typeof AVATAR_VARIANT)[number]) => AVATAR_VARIANT.includes(value),
56
+ default: 'initial',
57
+ },
58
+ loading: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
62
+ };
63
+
64
+ export type AvatarPropTypes = ExtractPropTypes<typeof avatarPropTypes>;