design-system-next 2.20.0 → 2.20.4

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 (79) hide show
  1. package/dist/design-system-next.es.js +7499 -7435
  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 +3 -2
  8. package/package.json +3 -2
  9. package/src/App.vue +51 -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/banner/banner.ts +20 -20
  18. package/src/components/button/button.ts +72 -72
  19. package/src/components/button/button.vue +15 -15
  20. package/src/components/checkbox/checkbox.ts +45 -45
  21. package/src/components/collapsible/collapsible.ts +21 -21
  22. package/src/components/collapsible/collapsible.vue +27 -27
  23. package/src/components/dropdown/fix-multi-number.ts +92 -92
  24. package/src/components/empty-state/empty-state.ts +50 -50
  25. package/src/components/file-upload/file-upload.ts +99 -87
  26. package/src/components/file-upload/file-upload.vue +13 -6
  27. package/src/components/file-upload/use-file-upload.ts +24 -0
  28. package/src/components/floating-action/floating-action.ts +12 -12
  29. package/src/components/input/input-email/input-email.vue +17 -17
  30. package/src/components/input/input-search/input-search.vue +13 -13
  31. package/src/components/input/input-url/input-url.vue +20 -20
  32. package/src/components/input/input-username/input-username.vue +17 -17
  33. package/src/components/list/ladderized-list/ladderized-list.ts +43 -39
  34. package/src/components/list/ladderized-list/ladderized-list.vue +1 -0
  35. package/src/components/list/list-item/list-item.ts +48 -0
  36. package/src/components/list/list-item/list-item.vue +112 -0
  37. package/src/components/list/list-item/use-list-item.ts +30 -0
  38. package/src/components/list/list.vue +60 -258
  39. package/src/components/list/use-list.ts +19 -5
  40. package/src/components/logo/logo.ts +43 -43
  41. package/src/components/logo/logo.vue +14 -14
  42. package/src/components/logo/use-logo.ts +41 -41
  43. package/src/components/lozenge/lozenge.ts +4 -18
  44. package/src/components/lozenge/lozenge.vue +14 -4
  45. package/src/components/lozenge/use-lozenge.ts +6 -0
  46. package/src/components/progress-bar/progress-bar.ts +50 -39
  47. package/src/components/progress-bar/progress-bar.vue +3 -2
  48. package/src/components/progress-bar/use-progress-bar.ts +7 -0
  49. package/src/components/radio/radio.ts +42 -42
  50. package/src/components/select/select-ladderized/select-ladderized.ts +9 -1
  51. package/src/components/select/select-ladderized/select-ladderized.vue +3 -1
  52. package/src/components/select/select-multiple/select-multiple.ts +12 -2
  53. package/src/components/select/select-multiple/select-multiple.vue +3 -2
  54. package/src/components/select/select.ts +8 -0
  55. package/src/components/select/select.vue +5 -1
  56. package/src/components/sidepanel/sidepanel.vue +55 -55
  57. package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.ts +16 -16
  58. package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.vue +39 -39
  59. package/src/components/slider/slider.ts +38 -38
  60. package/src/components/snackbar/snack/snack.ts +71 -71
  61. package/src/components/snackbar/use-snackbar.ts +34 -34
  62. package/src/components/status/status.ts +19 -19
  63. package/src/components/status/status.vue +13 -13
  64. package/src/components/stepper/step/step.ts +47 -47
  65. package/src/components/stepper/stepper.ts +47 -47
  66. package/src/components/stepper/stepper.vue +34 -34
  67. package/src/components/switch/switch.ts +42 -42
  68. package/src/components/table/table-actions/table-actions.ts +42 -42
  69. package/src/components/table/table-actions/table-actions.vue +40 -40
  70. package/src/components/table/table-chips-title/table-chips-title.ts +27 -27
  71. package/src/components/table/table-chips-title/table-chips-title.vue +32 -32
  72. package/src/components/table/table-chips-title/use-table-chips-title.ts +22 -22
  73. package/src/components/table/table-lozenge-title/table-lozenge-title.ts +23 -23
  74. package/src/components/table/table-lozenge-title/table-lozenge-title.vue +26 -26
  75. package/src/components/table/table-lozenge-title/use-table-lozenge-title.ts +21 -21
  76. package/src/components/tabs/tabs.ts +43 -43
  77. package/src/components/time-picker/time-picker.ts +69 -69
  78. package/src/components/tooltip/use-tooltip.ts +13 -13
  79. package/src/stores/useSnackbarStore.ts +44 -44
package/src/App.vue CHANGED
@@ -1,3 +1,53 @@
1
1
  <template>
2
- <div>Test Component Here</div>
2
+ <spr-dropdown
3
+ id="sample-dropdownCustomPopper"
4
+ width="150px"
5
+ :triggers="['click']"
6
+ :popper-triggers="['click']"
7
+ popper-width="500px"
8
+ :auto-hide="false"
9
+ >
10
+ <spr-button class="spr-w-full" tone="success" has-icon>
11
+ <span>Custom Popper</span>
12
+ <Icon icon="ph:caret-down" />
13
+ </spr-button>
14
+
15
+ <template #popper>
16
+ <spr-select-multiple
17
+ id="sample-select"
18
+ v-model="selectModel"
19
+ label="Select Label"
20
+ placeholder="Select an option"
21
+ :options="options"
22
+ popper-container="body"
23
+ wrapper-position="relative"
24
+ popper-strategy="fixed"
25
+ placement="bottom"
26
+ />
27
+ </template>
28
+ </spr-dropdown>
3
29
  </template>
30
+
31
+ <script setup>
32
+ import { ref } from 'vue';
33
+
34
+ import SprDropdown from './components/dropdown/dropdown.vue';
35
+ import SprButton from './components/button/button.vue';
36
+ import SprSelectMultiple from './components/select/select-multiple/select-multiple.vue';
37
+
38
+ const selectModel = ref('');
39
+
40
+ const options = ref([
41
+ { text: 'Apple', value: 'apple' },
42
+ { text: 'Banana', value: 'banana' },
43
+ { text: 'Cherry', value: 'cherry' },
44
+ { text: 'Date', value: 'date' },
45
+ { text: 'Elderberry', value: 'elderberry' },
46
+ { text: 'Fig', value: 'fig' },
47
+ { text: 'Grape', value: 'grape' },
48
+ { text: 'Nectarine', value: 'nectarine' },
49
+ { text: 'Orange', value: 'orange' },
50
+ { text: 'Papaya', value: 'papaya' },
51
+ { text: '89 Quince', value: '50' },
52
+ ]);
53
+ </script>
@@ -1,15 +1,15 @@
1
- type BorderRadius = {
2
- [key: string]: string;
3
- };
4
-
5
- const borderRadius: BorderRadius = {
6
- 'border-radius-2xs': 'var(--size-50)',
7
- 'border-radius-xs': 'var(--size-100)',
8
- 'border-radius-sm': 'var(--size-150)',
9
- 'border-radius-md': 'var(--size-200)',
10
- 'border-radius-lg': 'var(--size-250)',
11
- 'border-radius-xl': 'var(--size-300)',
12
- 'border-radius-full': '999px',
13
- };
14
-
15
- export default borderRadius;
1
+ type BorderRadius = {
2
+ [key: string]: string;
3
+ };
4
+
5
+ const borderRadius: BorderRadius = {
6
+ 'border-radius-2xs': 'var(--size-50)',
7
+ 'border-radius-xs': 'var(--size-100)',
8
+ 'border-radius-sm': 'var(--size-150)',
9
+ 'border-radius-md': 'var(--size-200)',
10
+ 'border-radius-lg': 'var(--size-250)',
11
+ 'border-radius-xl': 'var(--size-300)',
12
+ 'border-radius-full': '999px',
13
+ };
14
+
15
+ export default borderRadius;
@@ -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,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>;