design-system-next 1.2.25 → 1.3.2
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.js +2937 -2937
- package/dist/design-system-next.js.gz +0 -0
- package/dist/main.css +1 -1
- package/dist/main.css.gz +0 -0
- package/dist/main.d.ts +1 -6
- package/package.json +1 -1
- package/src/App.vue +8 -8
- package/src/assets/styles/tailwind.css +366 -367
- package/src/components/avatar/avatar.vue +1 -1
- package/src/components/avatar/use-avatar.ts +40 -34
- package/src/components/badge/badge.vue +2 -2
- package/src/components/badge/use-badge.ts +16 -16
- package/src/components/button/use-button.ts +39 -34
- package/src/components/checkbox/checkbox.vue +2 -2
- package/src/components/checkbox/use-checkbox.ts +23 -20
- package/src/components/dropdown/dropdown.vue +6 -6
- package/src/components/dropdown/use-dropdown.ts +6 -5
- package/src/components/empty-state/empty-state.vue +6 -5
- package/src/components/empty-state/use-empty-state.ts +8 -6
- package/src/components/input/input.ts +6 -1
- package/src/components/input/input.vue +7 -4
- package/src/components/input/use-input.ts +49 -47
- package/src/components/lozenge/lozenge.vue +7 -5
- package/src/components/lozenge/use-lozenge.ts +23 -15
- package/src/components/modal/modal.vue +8 -8
- package/src/components/modal/use-modal.ts +8 -8
- package/src/components/radio/radio.vue +1 -1
- package/src/components/radio/use-radio.ts +15 -13
- package/src/components/sidenav/sidenav.vue +158 -138
- package/src/components/sidepanel/sidepanel.vue +29 -21
- package/src/components/sidepanel/use-sidepanel.ts +17 -15
- package/src/components/snackbar/snack/snack.vue +13 -40
- package/src/components/snackbar/snack/use-snack.ts +12 -11
- package/src/components/snackbar/snackbar.vue +11 -13
- package/src/components/switch/switch.vue +14 -8
- package/src/components/switch/use-switch.ts +16 -15
- package/src/components/table/table.ts +5 -0
- package/src/components/table/table.vue +51 -24
- package/src/components/table/use-table.ts +1 -0
- package/src/components/tabs/tabs.vue +23 -19
- package/src/components/tabs/use-tabs.ts +5 -4
- package/src/components/timePicker/timePicker.vue +10 -9
- package/src/components/timePicker/use-timePicker.ts +31 -45
- package/src/components/tooltip/tooltip.vue +1 -1
- package/src/main.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative flex">
|
|
2
|
+
<div class="spr-relative spr-flex">
|
|
3
3
|
<div
|
|
4
4
|
v-for="(tab, index) in list"
|
|
5
5
|
:key="index"
|
|
@@ -8,28 +8,32 @@
|
|
|
8
8
|
tabsClasses,
|
|
9
9
|
{
|
|
10
10
|
// Regular Tab
|
|
11
|
-
'rounded-l-md': !underlined && index === 0,
|
|
12
|
-
'rounded-r-md': !underlined && index === tabElements.length - 1,
|
|
11
|
+
'spr-rounded-l-md': !underlined && index === 0,
|
|
12
|
+
'spr-rounded-r-md': !underlined && index === tabElements.length - 1,
|
|
13
13
|
|
|
14
14
|
// Regular Tab - Active
|
|
15
|
-
'border-color-success-base cursor-pointer !border !border-solid':
|
|
15
|
+
'spr-border-color-success-base spr-cursor-pointer !spr-border !spr-border-solid':
|
|
16
|
+
!underlined && activeTab.index === index,
|
|
16
17
|
|
|
17
18
|
// Regular Tab - Inactive
|
|
18
|
-
'border-color-weak hover:background-color-hover cursor-pointer !border-x-[0.5px] !border-y !border-solid':
|
|
19
|
+
'spr-border-color-weak hover:spr-background-color-hover spr-cursor-pointer !spr-border-x-[0.5px] !spr-border-y !spr-border-solid':
|
|
19
20
|
!underlined && activeTab.index !== index,
|
|
20
21
|
|
|
21
22
|
// Regular Tab - Disabled
|
|
22
|
-
'background-color-disabled !cursor-not-allowed
|
|
23
|
+
'spr-background-color-disabled !spr-cursor-not-allowed !spr-text-color-on-fill-disabled':
|
|
24
|
+
!underlined && tab.disabled,
|
|
23
25
|
|
|
24
26
|
// Underlined Tab - Active
|
|
25
|
-
'cursor-pointer': underlined && activeTab.index === index,
|
|
27
|
+
'spr-cursor-pointer': underlined && activeTab.index === index,
|
|
26
28
|
|
|
27
29
|
// Underlined Tab - Inactive
|
|
28
|
-
'border-color-base cursor-pointer !border-b !border-solid':
|
|
29
|
-
|
|
30
|
+
'spr-border-color-base spr-cursor-pointer !spr-border-b !spr-border-solid':
|
|
31
|
+
underlined && activeTab.index !== index,
|
|
32
|
+
'hover:spr-background-color-hover spr-cursor-pointer':
|
|
33
|
+
underlined && activeTab.index !== index && !tab.disabled,
|
|
30
34
|
|
|
31
35
|
// Underlined Tab - Disabled
|
|
32
|
-
'border-color-disabled text-color-on-fill-disabled
|
|
36
|
+
'spr-border-color-disabled spr-text-color-on-fill-disabled !spr-cursor-not-allowed spr-border-b':
|
|
33
37
|
underlined && tab.disabled,
|
|
34
38
|
},
|
|
35
39
|
]"
|
|
@@ -39,25 +43,25 @@
|
|
|
39
43
|
<div
|
|
40
44
|
v-if="!underlined && activeTab.index === index"
|
|
41
45
|
:class="[
|
|
42
|
-
'background-color-single-active tw-w-full absolute bottom-0 left-0 z-[5] block h-full w-full',
|
|
46
|
+
'spr-background-color-single-active spr-tw-w-full spr-absolute spr-bottom-0 spr-left-0 spr-z-[5] spr-block spr-h-full spr-w-full',
|
|
43
47
|
{
|
|
44
|
-
'rounded-l-md': activeTab.index === 0,
|
|
45
|
-
'rounded-r-md': activeTab.index === tabElements.length - 1,
|
|
48
|
+
'spr-rounded-l-md': activeTab.index === 0,
|
|
49
|
+
'spr-rounded-r-md': activeTab.index === tabElements.length - 1,
|
|
46
50
|
},
|
|
47
51
|
]"
|
|
48
52
|
/>
|
|
49
53
|
|
|
50
54
|
<div
|
|
51
55
|
:class="{
|
|
52
|
-
'relative z-[10] flex items-center gap-size-spacing-5xs leading-none': true,
|
|
53
|
-
'cursor-not-allowed': tab.disabled,
|
|
56
|
+
'spr-relative spr-z-[10] spr-flex spr-items-center spr-gap-size-spacing-5xs spr-leading-none': true,
|
|
57
|
+
'spr-cursor-not-allowed': tab.disabled,
|
|
54
58
|
}"
|
|
55
59
|
>
|
|
56
60
|
<div v-if="!!tab.icon">
|
|
57
61
|
<Icon
|
|
58
62
|
:class="{
|
|
59
|
-
'body-sm-regular': true,
|
|
60
|
-
'text-color-brand-base': activeTab.index === index,
|
|
63
|
+
'spr-body-sm-regular': true,
|
|
64
|
+
'spr-text-color-brand-base': activeTab.index === index,
|
|
61
65
|
}"
|
|
62
66
|
:icon="activeTab.index === index && typeof tab.iconFill === 'string' ? tab.iconFill : tab.icon"
|
|
63
67
|
/>
|
|
@@ -72,8 +76,8 @@
|
|
|
72
76
|
<div
|
|
73
77
|
v-if="underlined"
|
|
74
78
|
:class="[
|
|
75
|
-
'background-color-success-base absolute bottom-0 left-0 z-10 block h-0.5 rounded-full',
|
|
76
|
-
'transition-left duration-150 ease-in-out',
|
|
79
|
+
'spr-background-color-success-base spr-absolute spr-bottom-0 spr-left-0 spr-z-10 spr-block spr-h-0.5 spr-rounded-full',
|
|
80
|
+
'spr-transition-left spr-duration-150 spr-ease-in-out',
|
|
77
81
|
]"
|
|
78
82
|
:style="{
|
|
79
83
|
width: `${activeTab.width}px`,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ref, computed, onMounted, SetupContext } from 'vue';
|
|
2
|
-
import type { TabsPropTypes, TabsEmitTypes } from './tabs';
|
|
3
2
|
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
|
|
5
|
+
import type { TabsPropTypes, TabsEmitTypes } from './tabs';
|
|
6
|
+
|
|
6
7
|
export const useTabs = (props: TabsPropTypes, emit: SetupContext<TabsEmitTypes>['emit']) => {
|
|
7
8
|
const tabsClasses = computed(() => {
|
|
8
9
|
return classNames({
|
|
9
|
-
'relative px-size-spacing-xs py-size-spacing-3xs body-sm text-color-strong group': true,
|
|
10
|
-
'transition-left duration-150 ease-in-out': true,
|
|
10
|
+
'spr-relative spr-px-size-spacing-xs spr-py-size-spacing-3xs spr-body-sm spr-text-color-strong spr-group': true,
|
|
11
|
+
'spr-transition-left spr-duration-150 spr-ease-in-out': true,
|
|
11
12
|
capitalize: !props.underlined,
|
|
12
|
-
'uppercase border-x-0 border-t-0': props.underlined,
|
|
13
|
+
'spr-uppercase spr-border-x-0 spr-border-t-0': props.underlined,
|
|
13
14
|
});
|
|
14
15
|
});
|
|
15
16
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{{ label }}
|
|
5
5
|
</label>
|
|
6
6
|
|
|
7
|
-
<div class="relative flex items-center">
|
|
7
|
+
<div class="spr-relative spr-flex spr-items-center">
|
|
8
8
|
<input
|
|
9
9
|
v-model="selectedValue"
|
|
10
10
|
type="text"
|
|
@@ -31,13 +31,10 @@
|
|
|
31
31
|
v-for="option in filteredOptions"
|
|
32
32
|
:key="option"
|
|
33
33
|
:class="[
|
|
34
|
-
'flex justify-between',
|
|
35
|
-
'
|
|
36
|
-
'hover:background-color-hover',
|
|
37
|
-
'rounded-border-radius-md',
|
|
38
|
-
'cursor-pointer',
|
|
34
|
+
'spr-flex spr-justify-between spr-body-xs-regular spr-p-size-spacing-3xs spr-rounded-border-radius-md spr-cursor-pointer',
|
|
35
|
+
'hover:spr-background-color-hover',
|
|
39
36
|
{
|
|
40
|
-
'background-color-single-active rounded-border-radius-md':
|
|
37
|
+
'spr-background-color-single-active spr-rounded-border-radius-md':
|
|
41
38
|
option.toUpperCase() === selectedValue?.toUpperCase(),
|
|
42
39
|
},
|
|
43
40
|
]"
|
|
@@ -45,18 +42,22 @@
|
|
|
45
42
|
>
|
|
46
43
|
{{ option }}
|
|
47
44
|
|
|
48
|
-
<span
|
|
45
|
+
<span
|
|
46
|
+
v-if="option.toUpperCase() === selectedValue?.toUpperCase()"
|
|
47
|
+
class="spr-text-color-brand-base spr-font-bold"
|
|
48
|
+
>
|
|
49
49
|
<Icon icon="ph:check" />
|
|
50
50
|
</span>
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
53
|
-
<div v-else class="px-3 py-2 text-gray-500">No matching options found</div>
|
|
53
|
+
<div v-else class="spr-px-3 spr-py-2 spr-text-gray-500">No matching options found</div>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
58
|
<script setup lang="ts">
|
|
59
59
|
import { Icon } from '@iconify/vue';
|
|
60
|
+
|
|
60
61
|
import { timePickerPropTypes, timePickerEmitTypes } from './timePicker';
|
|
61
62
|
import { useTimePicker } from './use-timePicker';
|
|
62
63
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { computed, ref, ComputedRef, toRefs } from 'vue';
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import type { TimePickerPropTypes, TimePickerEmitTypes } from './timePicker';
|
|
4
|
-
import type { SetupContext } from 'vue';
|
|
5
2
|
import { useVModel } from '@vueuse/core';
|
|
6
3
|
|
|
7
4
|
import classNames from 'classnames';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
|
|
7
|
+
import type { TimePickerPropTypes, TimePickerEmitTypes } from './timePicker';
|
|
8
|
+
import type { SetupContext } from 'vue';
|
|
8
9
|
|
|
9
10
|
export const useTimePicker = (props: TimePickerPropTypes, emit: SetupContext<TimePickerEmitTypes>['emit']) => {
|
|
10
11
|
const { error, disabled, format, interval, disableTyping, fullWidth } = toRefs(props);
|
|
@@ -14,68 +15,50 @@ export const useTimePicker = (props: TimePickerPropTypes, emit: SetupContext<Tim
|
|
|
14
15
|
|
|
15
16
|
const timepickerClasses: ComputedRef<string> = computed(() => {
|
|
16
17
|
return classNames(
|
|
17
|
-
'block',
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'placeholder:text-mushroom-300',
|
|
23
|
-
'text-color-strong',
|
|
24
|
-
'font-size-200',
|
|
25
|
-
'border border-solid border-mushroom-200',
|
|
26
|
-
'focus:!border-kangkong-700',
|
|
27
|
-
'focus:text-color-strong',
|
|
28
|
-
'focus:!border-[1.5px]',
|
|
29
|
-
'outline-none',
|
|
30
|
-
'ring-0',
|
|
18
|
+
'spr-block spr-w-full spr-px-size-spacing-2xs spr-py-size-spacing-4xs spr-rounded-border-radius-md spr-outline-none spr-ring-0',
|
|
19
|
+
'spr-text-color-strong spr-font-size-200',
|
|
20
|
+
'spr-border spr-border-solid spr-border-mushroom-200',
|
|
21
|
+
'placeholder:spr-text-mushroom-300',
|
|
22
|
+
'focus:!spr-border-kangkong-700 focus:spr-text-color-strong focus:!spr-border-[1.5px]',
|
|
31
23
|
{
|
|
32
|
-
'!border-[1.5px]': error.value,
|
|
33
|
-
'!border-tomato-600': error.value,
|
|
34
|
-
'focus:!border-tomato-600': error.value,
|
|
35
|
-
'!border-white-100': disabled.value,
|
|
36
|
-
'background-color-disabled': disabled.value,
|
|
37
|
-
'cursor-not-allowed': disabled.value,
|
|
38
|
-
'text-color-on-fill-disabled': disabled.value,
|
|
39
|
-
'cursor-pointer': disableTyping.value,
|
|
24
|
+
'!spr-border-[1.5px]': error.value,
|
|
25
|
+
'!spr-border-tomato-600': error.value,
|
|
26
|
+
'focus:!spr-border-tomato-600': error.value,
|
|
27
|
+
'!spr-border-white-100': disabled.value,
|
|
28
|
+
'spr-background-color-disabled': disabled.value,
|
|
29
|
+
'spr-cursor-not-allowed': disabled.value,
|
|
30
|
+
'spr-text-color-on-fill-disabled': disabled.value,
|
|
31
|
+
'spr-cursor-pointer': disableTyping.value,
|
|
40
32
|
},
|
|
41
33
|
);
|
|
42
34
|
});
|
|
43
35
|
|
|
44
36
|
const optionClasses: ComputedRef<string> = computed(() => {
|
|
45
37
|
return classNames(
|
|
46
|
-
'absolute',
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'w-[240px]',
|
|
51
|
-
'overflow-y-auto',
|
|
52
|
-
'background-color ',
|
|
53
|
-
'text-mushroom-950',
|
|
54
|
-
'border border-solid',
|
|
55
|
-
'rounded-border-radius-md',
|
|
56
|
-
'border-color-weak',
|
|
57
|
-
'shadow-[0_2px_8px_-2px_rgba(38, 43, 43, 0.20)]',
|
|
58
|
-
'p-size-spacing-3xs',
|
|
38
|
+
'spr-absolute spr-z-50',
|
|
39
|
+
'spr-mt-1 spr-max-h-[300px] spr-w-[240px] spr-overflow-y-auto spr-background-color spr-rounded-border-radius-md spr-shadow-[0_2px_8px_-2px_rgba(38, 43, 43, 0.20)] spr-p-size-spacing-3xs',
|
|
40
|
+
'spr-text-mushroom-950',
|
|
41
|
+
'spr-border spr-border-solid spr-border-color-weak',
|
|
59
42
|
{
|
|
60
|
-
'w-full': fullWidth.value,
|
|
43
|
+
'spr-w-full': fullWidth.value,
|
|
61
44
|
},
|
|
62
45
|
);
|
|
63
46
|
});
|
|
64
47
|
|
|
65
48
|
const iconClasses: ComputedRef<string> = computed(() => {
|
|
66
|
-
return classNames('absolute right-3 text-color-supporting', {
|
|
67
|
-
'!text-tomato-600': error.value,
|
|
49
|
+
return classNames('spr-absolute spr-right-3 spr-text-color-supporting', {
|
|
50
|
+
'!spr-text-tomato-600': error.value,
|
|
68
51
|
});
|
|
69
52
|
});
|
|
70
53
|
|
|
71
54
|
const labelClasses: ComputedRef<string> = computed(() => {
|
|
72
|
-
return classNames('body-sm-regular text-color-strong block
|
|
73
|
-
'text-color-on-fill-disabled': disabled.value,
|
|
55
|
+
return classNames('spr-body-sm-regular spr-text-color-strong spr-block spr-mb-size-spacing-4xs', {
|
|
56
|
+
'spr-text-color-on-fill-disabled': disabled.value,
|
|
74
57
|
});
|
|
75
58
|
});
|
|
76
59
|
|
|
77
60
|
const wrapperClasses: ComputedRef<string> = computed(() => {
|
|
78
|
-
return 'relative w-full';
|
|
61
|
+
return 'spr-relative spr-w-full';
|
|
79
62
|
});
|
|
80
63
|
|
|
81
64
|
const filterInput = (event: Event) => {
|
|
@@ -99,6 +82,7 @@ export const useTimePicker = (props: TimePickerPropTypes, emit: SetupContext<Tim
|
|
|
99
82
|
const end = dayjs().endOf('day');
|
|
100
83
|
|
|
101
84
|
let current = start;
|
|
85
|
+
|
|
102
86
|
while (current.isBefore(end) || current.isSame(end)) {
|
|
103
87
|
options.push(formatTime(current));
|
|
104
88
|
current = current.add(interval.value, 'minute');
|
|
@@ -109,12 +93,15 @@ export const useTimePicker = (props: TimePickerPropTypes, emit: SetupContext<Tim
|
|
|
109
93
|
|
|
110
94
|
const formatTime = (date: dayjs.Dayjs): string => {
|
|
111
95
|
let hours = date.hour();
|
|
96
|
+
|
|
112
97
|
const minutes = date.minute().toString().padStart(2, '0');
|
|
98
|
+
|
|
113
99
|
if (props.format === '12') {
|
|
114
100
|
const period = hours >= 12 ? 'PM' : 'AM';
|
|
115
101
|
hours = hours % 12 || 12; // Convert 0 to 12 for 12-hour format
|
|
116
102
|
return `${hours.toString().padStart(2, '0')}:${minutes} ${period}`;
|
|
117
103
|
}
|
|
104
|
+
|
|
118
105
|
return `${hours.toString().padStart(2, '0')}:${minutes}`;
|
|
119
106
|
};
|
|
120
107
|
|
|
@@ -151,7 +138,6 @@ export const useTimePicker = (props: TimePickerPropTypes, emit: SetupContext<Tim
|
|
|
151
138
|
selectedValue,
|
|
152
139
|
isOpen,
|
|
153
140
|
getPlaceHolder,
|
|
154
|
-
|
|
155
141
|
filterInput,
|
|
156
142
|
selectOption,
|
|
157
143
|
handleClick,
|
package/src/main.ts
CHANGED