design-system-next 2.11.6 → 2.11.7
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 +5978 -5856
- 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/package.json.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.vue +1 -44
- package/src/components/calendar-cell/calendar-cell.ts +6 -0
- package/src/components/calendar-cell/calendar-cell.vue +17 -4
- package/src/components/calendar-cell/use-calendar-cell.ts +33 -19
|
Binary file
|
package/dist/package.json.d.ts
CHANGED
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,46 +1,3 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<spr-sidepanel :is-open="isSidepanelOpen" header-title="Sidepanel Example" @close="isSidepanelOpen = false">
|
|
4
|
-
<div class="p-4">Sidepanel Content</div>
|
|
5
|
-
<template #footer>
|
|
6
|
-
<div class="spr-flex spr-justify-end spr-gap-2 spr-px-2">
|
|
7
|
-
<spr-button>Cancel</spr-button>
|
|
8
|
-
<spr-button-dropdown
|
|
9
|
-
v-model="wew"
|
|
10
|
-
dropdown-id="example1"
|
|
11
|
-
:menu-list="menuList"
|
|
12
|
-
placement="top-end"
|
|
13
|
-
popper-inner-width="200px"
|
|
14
|
-
>
|
|
15
|
-
Button Dropdown
|
|
16
|
-
</spr-button-dropdown>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
</spr-sidepanel>
|
|
2
|
+
<div>Test Component Here</div>
|
|
20
3
|
</template>
|
|
21
|
-
<script setup>
|
|
22
|
-
import { ref } from 'vue';
|
|
23
|
-
|
|
24
|
-
import SprButton from './components/button/button.vue';
|
|
25
|
-
import SprButtonDropdown from './components/button/button-dropdown/button-dropdown.vue';
|
|
26
|
-
import SprSidepanel from './components/sidepanel/sidepanel.vue';
|
|
27
|
-
|
|
28
|
-
const isSidepanelOpen = ref(true);
|
|
29
|
-
|
|
30
|
-
const wew = ref();
|
|
31
|
-
|
|
32
|
-
const menuList = ref([
|
|
33
|
-
{
|
|
34
|
-
text: 'Option 1',
|
|
35
|
-
value: 'option1',
|
|
36
|
-
icon: 'ph:check',
|
|
37
|
-
iconColor: 'spr-text-color-brand-base',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
text: 'Option 2',
|
|
41
|
-
value: 'option2',
|
|
42
|
-
icon: 'ph:check',
|
|
43
|
-
iconColor: 'spr-text-color-brand-base',
|
|
44
|
-
},
|
|
45
|
-
]);
|
|
46
|
-
</script>
|
|
@@ -11,9 +11,11 @@ export const calendarCellPropTypes = {
|
|
|
11
11
|
},
|
|
12
12
|
title: {
|
|
13
13
|
type: String,
|
|
14
|
+
default: '',
|
|
14
15
|
},
|
|
15
16
|
description: {
|
|
16
17
|
type: String,
|
|
18
|
+
default: '',
|
|
17
19
|
},
|
|
18
20
|
status: {
|
|
19
21
|
type: String,
|
|
@@ -49,6 +51,10 @@ export const calendarCellPropTypes = {
|
|
|
49
51
|
type: Boolean,
|
|
50
52
|
default: false,
|
|
51
53
|
},
|
|
54
|
+
customColor: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
export type CalendarCellPropTypes = ExtractPropTypes<typeof calendarCellPropTypes>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
v-if="!props.loading"
|
|
4
|
+
:class="getCalendarCellClassess.getMainClasses"
|
|
5
|
+
:style="props.customColor ? getCustomColorStyles : {}"
|
|
6
|
+
@click="handleClick"
|
|
7
|
+
>
|
|
3
8
|
<slot name="prefix">
|
|
4
9
|
<Icon v-if="hasIconStatus" :icon="getCellIcon" />
|
|
5
10
|
</slot>
|
|
@@ -19,7 +24,7 @@
|
|
|
19
24
|
</slot>
|
|
20
25
|
</div>
|
|
21
26
|
|
|
22
|
-
<div v-else :class="getCalendarCellClassess.getMainClasses" />
|
|
27
|
+
<div v-else :class="getCalendarCellClassess.getMainClasses" :style="props.customColor ? getCustomColorStyles : {}" />
|
|
23
28
|
</template>
|
|
24
29
|
|
|
25
30
|
<script setup lang="ts">
|
|
@@ -33,6 +38,14 @@ import SprStatus from '@/components/status/status.vue';
|
|
|
33
38
|
const props = defineProps(calendarCellPropTypes);
|
|
34
39
|
const emit = defineEmits(calendarCellEmitTypes);
|
|
35
40
|
|
|
36
|
-
const {
|
|
37
|
-
|
|
41
|
+
const {
|
|
42
|
+
getCalendarCellClassess,
|
|
43
|
+
getShiftLabel,
|
|
44
|
+
getCellIcon,
|
|
45
|
+
hasIconStatus,
|
|
46
|
+
isError,
|
|
47
|
+
hasContent,
|
|
48
|
+
handleClick,
|
|
49
|
+
getCustomColorStyles,
|
|
50
|
+
} = useCalendarCell(props, emit);
|
|
38
51
|
</script>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { computed, SetupContext } from 'vue';
|
|
1
|
+
import { computed, SetupContext, toRefs } from 'vue';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
4
|
import type { CalendarCellPropTypes, CalendarCellEmitTypes } from './calendar-cell';
|
|
5
5
|
|
|
6
6
|
export const useCalendarCell = (props: CalendarCellPropTypes, emit: SetupContext<CalendarCellEmitTypes>['emit']) => {
|
|
7
|
+
const { title, description, type, status, subDescription, icon, fullwidth, viewOnly, loading, customColor } =
|
|
8
|
+
toRefs(props);
|
|
7
9
|
const offlineStatus = ['restday', 'vacation', 'holiday', 'exempt', 'sick', 'emergency'];
|
|
8
10
|
const shiftLabels: Record<string, string> = {
|
|
9
11
|
standard: 'Standard Day Shift',
|
|
@@ -48,50 +50,61 @@ export const useCalendarCell = (props: CalendarCellPropTypes, emit: SetupContext
|
|
|
48
50
|
'fixed-flexible': 'spr-border-[#C771A6] spr-bg-[#FFF2FA]',
|
|
49
51
|
};
|
|
50
52
|
|
|
51
|
-
const hasContent = computed(() =>
|
|
52
|
-
const hasIconStatus = computed(() => offlineStatus.includes(
|
|
53
|
-
const isError = computed(() =>
|
|
53
|
+
const hasContent = computed(() => title.value || description.value || getShiftLabel.value);
|
|
54
|
+
const hasIconStatus = computed(() => offlineStatus.includes(type.value) && status.value != 'error');
|
|
55
|
+
const isError = computed(() => status.value === 'error');
|
|
54
56
|
|
|
55
57
|
const getShiftLabel = computed((): string => {
|
|
56
|
-
return
|
|
58
|
+
return subDescription.value || shiftLabels[type.value];
|
|
57
59
|
});
|
|
58
60
|
|
|
59
61
|
const getCellIcon = computed((): string => {
|
|
60
|
-
return
|
|
62
|
+
return icon.value || iconMap[type.value];
|
|
61
63
|
});
|
|
62
64
|
|
|
63
65
|
const getCellClasses = computed((): string => {
|
|
64
|
-
return typeClasses[
|
|
66
|
+
return typeClasses[type.value] || 'spr-border-kangkong-700 spr-bg-kangkong-50';
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const getCustomColorStyles = computed(() => {
|
|
70
|
+
if (!customColor.value || !customColor.value.startsWith('#')) return {};
|
|
71
|
+
|
|
72
|
+
const opacity = '20'; // 20 in hex = 12.5% opacity
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
borderColor: customColor.value,
|
|
76
|
+
backgroundColor: customColor.value.startsWith('#') ? `${customColor.value}${opacity}` : customColor.value,
|
|
77
|
+
};
|
|
65
78
|
});
|
|
66
79
|
|
|
67
80
|
const getCalendarCellClassess = computed(() => {
|
|
68
81
|
const calendarCellWrapper = classNames(
|
|
69
82
|
'spr-flex spr-items-center spr-p-size-spacing-3xs spr-gap-size-spacing-3xs spr-relative spr-rounded-lg spr-border-2 spr-transition-all sm:spr-flex-col spr-overflow-hidden',
|
|
70
83
|
{
|
|
71
|
-
'spr-w-full':
|
|
72
|
-
'spr-max-w-[217px]': !
|
|
73
|
-
'hover:spr-drop-shadow-sm spr-cursor-pointer': !
|
|
74
|
-
'spr-h-[80px] spr-skeletal-loader':
|
|
84
|
+
'spr-w-full': fullwidth.value,
|
|
85
|
+
'spr-max-w-[217px]': !fullwidth.value,
|
|
86
|
+
'hover:spr-drop-shadow-sm spr-cursor-pointer': !viewOnly.value,
|
|
87
|
+
'spr-h-[80px] spr-skeletal-loader': loading.value,
|
|
75
88
|
},
|
|
76
89
|
);
|
|
77
90
|
|
|
78
91
|
const statusCellClasses = classNames({
|
|
79
|
-
'spr-border-dashed':
|
|
80
|
-
'spr-border-solid spr-border-color-danger-base':
|
|
81
|
-
'spr-border-solid': !
|
|
92
|
+
'spr-border-dashed': status.value === 'pending',
|
|
93
|
+
'spr-border-solid spr-border-color-danger-base': status.value === 'error',
|
|
94
|
+
'spr-border-solid': !status.value || (status.value !== 'pending' && status.value !== 'error'),
|
|
82
95
|
});
|
|
83
96
|
|
|
84
97
|
const titleClasses = classNames('spr-text-color-strong spr-body-sm-regular-medium', {
|
|
85
|
-
'spr-text-color-danger-base':
|
|
98
|
+
'spr-text-color-danger-base': status.value === 'error',
|
|
86
99
|
});
|
|
87
100
|
|
|
88
101
|
const descriptionClasses = classNames('spr-text-color-strong spr-body-sm-regular', {
|
|
89
|
-
'spr-text-color-danger-base':
|
|
102
|
+
'spr-text-color-danger-base': status.value === 'error',
|
|
90
103
|
});
|
|
91
104
|
|
|
92
105
|
const getTypeLabelClassess = classNames('spr-text-color-strong spr-body-sm-regular', {
|
|
93
|
-
'spr-text-color-danger-base':
|
|
94
|
-
'spr-text-color-strong spr-body-sm-regular-medium': offlineStatus.includes(
|
|
106
|
+
'spr-text-color-danger-base': status.value === 'error',
|
|
107
|
+
'spr-text-color-strong spr-body-sm-regular-medium': offlineStatus.includes(type.value),
|
|
95
108
|
});
|
|
96
109
|
|
|
97
110
|
const getMainClasses = classNames(calendarCellWrapper, getCellClasses.value, statusCellClasses);
|
|
@@ -106,7 +119,7 @@ export const useCalendarCell = (props: CalendarCellPropTypes, emit: SetupContext
|
|
|
106
119
|
});
|
|
107
120
|
|
|
108
121
|
const handleClick = (evt: MouseEvent) => {
|
|
109
|
-
if (
|
|
122
|
+
if (viewOnly.value) {
|
|
110
123
|
evt.stopPropagation();
|
|
111
124
|
|
|
112
125
|
return;
|
|
@@ -123,5 +136,6 @@ export const useCalendarCell = (props: CalendarCellPropTypes, emit: SetupContext
|
|
|
123
136
|
isError,
|
|
124
137
|
hasContent,
|
|
125
138
|
handleClick,
|
|
139
|
+
getCustomColorStyles,
|
|
126
140
|
};
|
|
127
141
|
};
|