design-system-next 2.17.8 → 2.19.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.
- package/dist/design-system-next.es.js +7252 -7106
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +12 -13
- 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 +1 -51
- package/src/assets/styles/tailwind.css +105 -44
- package/src/components/attribute-filter/attribute-filter.vue +1 -1
- package/src/components/audit-trail/audit-trail.ts +28 -0
- package/src/components/audit-trail/audit-trail.vue +104 -0
- package/src/components/audit-trail/use-audit-trail.ts +82 -0
- package/src/components/chips/chips.vue +4 -1
- package/src/components/date-picker/{reusable-calendar/reusable-calendar.ts → date-calendar-picker/date-calendar-picker.ts} +4 -4
- package/src/components/date-picker/{reusable-calendar/reusable-calendar.vue → date-calendar-picker/date-calendar-picker.vue} +10 -10
- package/src/components/date-picker/{reusable-calendar/use-reusable-calendar.ts → date-calendar-picker/use-date-calendar-picker.ts} +4 -4
- package/src/components/list/ladderized-list/use-ladderized-list.ts +19 -8
- package/src/components/lozenge/use-lozenge.ts +55 -23
- package/src/components/select/select-ladderized/select-ladderized.ts +5 -1
- package/src/components/select/select-ladderized/select-ladderized.vue +3 -1
- package/src/components/select/select-ladderized/use-select-ladderized.ts +17 -4
- package/src/components/table/table.vue +3 -4
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { onBeforeMount, ref, toRefs, watch } from 'vue';
|
|
2
|
-
import { useVModel } from '@vueuse/core';
|
|
3
|
-
|
|
2
|
+
import { useVModel, watchDeep } from '@vueuse/core';
|
|
4
3
|
import { LadderizedListPropTypes, LadderizedListEmitTypes } from './ladderized-list';
|
|
5
|
-
|
|
6
4
|
import type { SetupContext } from 'vue';
|
|
7
5
|
import type { MenuListType } from '../list';
|
|
8
6
|
|
|
@@ -21,6 +19,8 @@ export const useLadderizedList = (
|
|
|
21
19
|
const activeList = ref<MenuListType[]>(menuList.value); // List of items to display in the active level
|
|
22
20
|
const searchText = ref('');
|
|
23
21
|
|
|
22
|
+
const modelValueIsCustom = ref(false);
|
|
23
|
+
|
|
24
24
|
// Recursive filter function for ladderized options
|
|
25
25
|
const filterOptionsRecursive = (items: MenuListType[], search: string): MenuListType[] => {
|
|
26
26
|
if (!search) return items;
|
|
@@ -86,6 +86,12 @@ export const useLadderizedList = (
|
|
|
86
86
|
const handleSelectedListItem = (item: MenuListType) => {
|
|
87
87
|
transitionName.value = 'slide-left';
|
|
88
88
|
|
|
89
|
+
if (modelValueIsCustom.value) {
|
|
90
|
+
console.log("Custom");
|
|
91
|
+
ladderizedListOutput.value.shift();
|
|
92
|
+
modelValueIsCustom.value = false;
|
|
93
|
+
};
|
|
94
|
+
|
|
89
95
|
// If searching, reconstruct full path as array of option objects
|
|
90
96
|
if (searchText.value) {
|
|
91
97
|
const path = findOptionPath(menuList.value, String(item.value));
|
|
@@ -111,7 +117,7 @@ export const useLadderizedList = (
|
|
|
111
117
|
replaceItemInOutput(item);
|
|
112
118
|
}
|
|
113
119
|
|
|
114
|
-
if (item.sublevel && item.sublevel.length > 0) updateLevel(item);
|
|
120
|
+
if (item.sublevel && item.sublevel.length > 0) updateLevel(item); // FIXME: This causes activeLevel one less than expected. Currently not critical since most forms are 2 levels deep.
|
|
115
121
|
emit('update:modelValue', ladderizedListOutput.value);
|
|
116
122
|
};
|
|
117
123
|
|
|
@@ -224,9 +230,14 @@ export const useLadderizedList = (
|
|
|
224
230
|
|
|
225
231
|
prevList.value = activeList.value;
|
|
226
232
|
activeList.value = item.sublevel ?? prevList.value;
|
|
227
|
-
activeLevel.value += item.sublevel ? 1 : 0;
|
|
233
|
+
activeLevel.value += item.sublevel ? 1 : 0; // FIXME: This causes activeLevel one less than expected. Currently not critical since most forms are 2 levels deep.
|
|
228
234
|
} else {
|
|
229
|
-
// If no item found,
|
|
235
|
+
// If no item found, rest the values to initial state
|
|
236
|
+
selectedListItem.value = [];
|
|
237
|
+
prevList.value = [];
|
|
238
|
+
activeList.value = menuList.value;
|
|
239
|
+
activeLevel.value = 0;
|
|
240
|
+
modelValueIsCustom.value = true;
|
|
230
241
|
return;
|
|
231
242
|
}
|
|
232
243
|
});
|
|
@@ -241,8 +252,8 @@ export const useLadderizedList = (
|
|
|
241
252
|
};
|
|
242
253
|
|
|
243
254
|
// Watch for modelValue changes and reset selectedListItem if cleared
|
|
244
|
-
|
|
245
|
-
|
|
255
|
+
watchDeep(
|
|
256
|
+
ladderizedListOutput,
|
|
246
257
|
(newVal) => {
|
|
247
258
|
if (!newVal || (Array.isArray(newVal) && newVal.length === 0)) {
|
|
248
259
|
selectedListItem.value = [];
|
|
@@ -32,54 +32,86 @@ export const useLozenge = (props: LozengePropTypes) => {
|
|
|
32
32
|
'spr-border': !fill.value,
|
|
33
33
|
'spr-cursor-pointer': isInteractive.value,
|
|
34
34
|
// #region - Styles for hollow lozenge
|
|
35
|
+
|
|
35
36
|
// Pending
|
|
36
|
-
'spr-text-
|
|
37
|
-
|
|
37
|
+
'spr-text-color-pending-base spr-background-color-pending-weak spr-border-color-pending-base':
|
|
38
|
+
tone.value === 'pending' && !fill.value,
|
|
39
|
+
'hover:spr-background-color-pending-weak-hover active:spr-background-color-pending-weak-pressed':
|
|
40
|
+
tone.value === 'pending' && !fill.value && isInteractive.value,
|
|
41
|
+
|
|
38
42
|
// Information
|
|
39
|
-
'spr-text-
|
|
40
|
-
|
|
43
|
+
'spr-text-color-information-base spr-background-color-information-weak spr-border-color-information-base':
|
|
44
|
+
tone.value === 'information' && !fill.value,
|
|
45
|
+
'hover:spr-background-color-information-weak-hover active:spr-background-color-information-weak-pressed':
|
|
46
|
+
tone.value === 'information' && !fill.value && isInteractive.value,
|
|
47
|
+
|
|
41
48
|
// Success
|
|
42
|
-
'spr-text-
|
|
43
|
-
|
|
49
|
+
'spr-text-color-success-base spr-background-color-success-weak spr-border-color-success-base':
|
|
50
|
+
tone.value === 'success' && !fill.value,
|
|
51
|
+
'hover:spr-background-color-success-weak-hover active:spr-background-color-success-weak-pressed':
|
|
52
|
+
tone.value === 'success' && !fill.value && isInteractive.value,
|
|
53
|
+
|
|
44
54
|
// Neutral
|
|
45
|
-
'spr-text-
|
|
46
|
-
|
|
55
|
+
'spr-text-color-base spr-background-color-surface-adaptive spr-border-color-base':
|
|
56
|
+
tone.value === 'neutral' && !fill.value,
|
|
57
|
+
|
|
47
58
|
// Danger
|
|
48
|
-
'spr-text-
|
|
49
|
-
|
|
59
|
+
'spr-text-color-danger-base spr-background-color-danger-weak spr-border-color-danger-base':
|
|
60
|
+
tone.value === 'danger' && !fill.value,
|
|
61
|
+
'hover:spr-background-color-danger-weak-hover active:spr-background-color-danger-weak-pressed':
|
|
62
|
+
tone.value === 'danger' && !fill.value && isInteractive.value,
|
|
63
|
+
|
|
50
64
|
// Caution
|
|
51
|
-
'spr-text-
|
|
52
|
-
|
|
65
|
+
'spr-text-color-caution-base spr-background-color-caution-weak spr-border-color-caution-base':
|
|
66
|
+
tone.value === 'caution' && !fill.value,
|
|
67
|
+
'hover:spr-background-color-caution-weak-hover active:spr-background-color-caution-weak-pressed':
|
|
68
|
+
tone.value === 'caution' && !fill.value && isInteractive.value,
|
|
69
|
+
|
|
53
70
|
// Plain
|
|
54
71
|
'spr-text-color-strong spr-border-color-base spr-background-color': tone.value === 'plain' && !fill.value,
|
|
55
|
-
|
|
72
|
+
|
|
73
|
+
// Shared hover/active for neutral and plain
|
|
74
|
+
'hover:spr-background-color-hover active:spr-background-color-pressed':
|
|
75
|
+
(tone.value === 'neutral' || tone.value === 'plain') && !fill.value && isInteractive.value,
|
|
76
|
+
|
|
56
77
|
// #endregion - Styles for hollow (!fill) lozenge
|
|
57
78
|
|
|
58
79
|
// #region - Styles for filled lozenge
|
|
59
80
|
'spr-border-0': fill.value,
|
|
60
|
-
'spr-text-color-strong':
|
|
61
|
-
|
|
81
|
+
'spr-text-color-strong':
|
|
82
|
+
fill.value &&
|
|
83
|
+
(tone.value === 'pending' || tone.value === 'neutral' || tone.value === 'caution' || tone.value === 'plain'),
|
|
84
|
+
'spr-text-color-inverted-strong':
|
|
85
|
+
fill.value && (tone.value === 'information' || tone.value === 'success' || tone.value === 'danger'),
|
|
62
86
|
// Pending
|
|
63
87
|
'spr-background-color-pending-base': tone.value === 'pending' && fill.value,
|
|
64
|
-
'hover:spr-background-color-pending-hover active:spr-background-color-pending-pressed':
|
|
88
|
+
'hover:spr-background-color-pending-hover active:spr-background-color-pending-pressed':
|
|
89
|
+
tone.value === 'pending' && fill.value && isInteractive.value,
|
|
65
90
|
// Information
|
|
66
91
|
'spr-background-color-information-base': tone.value === 'information' && fill.value,
|
|
67
|
-
'hover:spr-background-color-information-hover active:spr-background-color-information-pressed':
|
|
92
|
+
'hover:spr-background-color-information-hover active:spr-background-color-information-pressed':
|
|
93
|
+
tone.value === 'information' && fill.value && isInteractive.value,
|
|
68
94
|
// Success
|
|
69
95
|
'spr-background-color-success-base': tone.value === 'success' && fill.value,
|
|
70
|
-
'hover:spr-background-color-success-hover active:spr-background-color-success-pressed':
|
|
96
|
+
'hover:spr-background-color-success-hover active:spr-background-color-success-pressed':
|
|
97
|
+
tone.value === 'success' && fill.value && isInteractive.value,
|
|
71
98
|
// Neutral
|
|
72
|
-
'spr-background-color-
|
|
73
|
-
'hover:spr-background-color-surface active:spr-background-color-pressed': tone.value === 'neutral' && fill.value && isInteractive.value,
|
|
99
|
+
'spr-background-color-surface-adaptive': tone.value === 'neutral' && fill.value,
|
|
74
100
|
// Danger
|
|
75
101
|
'spr-background-color-danger-base': tone.value === 'danger' && fill.value,
|
|
76
|
-
'hover:spr-background-color-danger-hover active:spr-background-color-danger-pressed':
|
|
102
|
+
'hover:spr-background-color-danger-hover active:spr-background-color-danger-pressed':
|
|
103
|
+
tone.value === 'danger' && fill.value && isInteractive.value,
|
|
77
104
|
// Caution
|
|
78
105
|
'spr-background-color-caution-base': tone.value === 'caution' && fill.value,
|
|
79
|
-
'hover:spr-background-color-caution-hover active:spr-background-color-caution-pressed':
|
|
106
|
+
'hover:spr-background-color-caution-hover active:spr-background-color-caution-pressed':
|
|
107
|
+
tone.value === 'caution' && fill.value && isInteractive.value,
|
|
108
|
+
|
|
80
109
|
// Plain
|
|
81
110
|
'spr-background-color': tone.value === 'plain' && fill.value,
|
|
82
|
-
|
|
111
|
+
|
|
112
|
+
// Shared hover/active for neutral and plain (filled)
|
|
113
|
+
'hover:spr-background-color-surface active:spr-background-color-pressed':
|
|
114
|
+
(tone.value === 'neutral' || tone.value === 'plain') && fill.value && isInteractive.value,
|
|
83
115
|
// #endregion - Styles for filled lozenge
|
|
84
116
|
},
|
|
85
117
|
);
|
|
@@ -144,12 +144,16 @@ export const selectLadderizedPropTypes = {
|
|
|
144
144
|
type: Boolean,
|
|
145
145
|
default: false,
|
|
146
146
|
},
|
|
147
|
+
writableInputText: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: false,
|
|
150
|
+
}
|
|
147
151
|
};
|
|
148
152
|
|
|
149
153
|
export const selectLadderizedEmitTypes = {
|
|
150
154
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
151
155
|
'update:modelValue': (_value: unknown) => true,
|
|
152
|
-
'popper-state':
|
|
156
|
+
'popper-state': () => true,
|
|
153
157
|
};
|
|
154
158
|
|
|
155
159
|
export type SelectLadderizedEmitFn = (event: string, ...args: unknown[]) => void;
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
:helper-text="props.helperText"
|
|
38
38
|
:helper-icon="props.helperIcon"
|
|
39
39
|
:display-helper="props.displayHelper"
|
|
40
|
-
readonly
|
|
40
|
+
:readonly="!props.writableInputText"
|
|
41
41
|
:active="props.active"
|
|
42
42
|
:disabled="props.disabled"
|
|
43
43
|
:error="props.error"
|
|
44
|
+
@blur="handleInputChange"
|
|
44
45
|
>
|
|
45
46
|
<template #icon>
|
|
46
47
|
<div
|
|
@@ -121,5 +122,6 @@ const {
|
|
|
121
122
|
inputText,
|
|
122
123
|
handleSelectedLadderizedItem,
|
|
123
124
|
handleClear,
|
|
125
|
+
handleInputChange,
|
|
124
126
|
} = useSelectLadderized(props, emit as SelectLadderizedEmitFn);
|
|
125
127
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, toRefs, computed, watch } from 'vue';
|
|
2
|
-
import { useVModel, onClickOutside } from '@vueuse/core';
|
|
2
|
+
import { useVModel, onClickOutside, watchDeep } from '@vueuse/core';
|
|
3
3
|
|
|
4
4
|
import type { SelectLadderizedPropTypes } from './select-ladderized';
|
|
5
5
|
|
|
@@ -17,6 +17,7 @@ export const useSelectLadderized = (
|
|
|
17
17
|
supportingLabelClasses: 'spr-body-sm-regular spr-text-color-supporting',
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
+
// Wrapper for input field
|
|
20
21
|
const ladderizedSelectState = ref<HTMLDivElement | null>(null);
|
|
21
22
|
|
|
22
23
|
// Popper Variables
|
|
@@ -31,6 +32,7 @@ export const useSelectLadderized = (
|
|
|
31
32
|
// Input Variables
|
|
32
33
|
const inputText = ref<string>('');
|
|
33
34
|
const wasCleared = ref<boolean>(false);
|
|
35
|
+
const isCustomInput = ref<boolean>(false);
|
|
34
36
|
|
|
35
37
|
const isLeafNode = (item: MenuListType): boolean => {
|
|
36
38
|
return !item.sublevel || item.sublevel.length === 0;
|
|
@@ -57,6 +59,7 @@ export const useSelectLadderized = (
|
|
|
57
59
|
|
|
58
60
|
const handleSelectedLadderizedItem = (selectedItems: string[], selectedItem?: MenuListType) => {
|
|
59
61
|
wasCleared.value = false;
|
|
62
|
+
isCustomInput.value = false;
|
|
60
63
|
|
|
61
64
|
// If the selectedItems is a single value (leaf from search), reconstruct the full path
|
|
62
65
|
let fullPath: string[] | null = null;
|
|
@@ -157,15 +160,17 @@ export const useSelectLadderized = (
|
|
|
157
160
|
};
|
|
158
161
|
|
|
159
162
|
// Watch for changes in modelValue to update inputText
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
watchDeep(
|
|
164
|
+
ladderizedSelectModel,
|
|
162
165
|
(newVal) => {
|
|
166
|
+
if (isCustomInput.value) return;
|
|
167
|
+
|
|
163
168
|
if (wasCleared.value) {
|
|
164
169
|
inputText.value = '';
|
|
165
170
|
wasCleared.value = false;
|
|
166
171
|
|
|
167
172
|
return;
|
|
168
|
-
}
|
|
173
|
+
};
|
|
169
174
|
|
|
170
175
|
if (Array.isArray(newVal) && newVal.length > 0) {
|
|
171
176
|
// Treat the array as a single path for ladderized select
|
|
@@ -194,6 +199,13 @@ export const useSelectLadderized = (
|
|
|
194
199
|
emit('popper-state', newState);
|
|
195
200
|
});
|
|
196
201
|
|
|
202
|
+
const handleInputChange = () => {
|
|
203
|
+
if (!props.writableInputText) return;
|
|
204
|
+
wasCleared.value = false;
|
|
205
|
+
isCustomInput.value = true;
|
|
206
|
+
ladderizedSelectModel.value = [inputText.value];
|
|
207
|
+
};
|
|
208
|
+
|
|
197
209
|
// Close only when clicking completely outside both the popper and the trigger wrapper.
|
|
198
210
|
onClickOutside(ladderizedSelectPopperRef, (event) => {
|
|
199
211
|
const triggerWrapper = ladderizedSelectState.value;
|
|
@@ -216,5 +228,6 @@ export const useSelectLadderized = (
|
|
|
216
228
|
inputText,
|
|
217
229
|
handleSelectedLadderizedItem,
|
|
218
230
|
handleClear,
|
|
231
|
+
handleInputChange,
|
|
219
232
|
};
|
|
220
233
|
};
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
<div :class="getTableClasses.tableBackgroundClasses">
|
|
20
20
|
<table
|
|
21
|
+
:key="tableKey"
|
|
21
22
|
aria-describedby="describe"
|
|
22
23
|
class="spr-h-full spr-w-full spr-table-fixed"
|
|
23
24
|
cellspacing="0"
|
|
24
25
|
cellpadding="0"
|
|
25
|
-
:key="tableKey"
|
|
26
26
|
>
|
|
27
27
|
<thead>
|
|
28
28
|
<tr v-if="!(props.removeHeaderOnEmpty && tableData.length <= 0)">
|
|
@@ -240,7 +240,6 @@ const {
|
|
|
240
240
|
dragOptions,
|
|
241
241
|
tableKey,
|
|
242
242
|
isDragging,
|
|
243
|
-
|
|
244
243
|
|
|
245
244
|
isRowSelected,
|
|
246
245
|
sortData,
|
|
@@ -251,13 +250,13 @@ const {
|
|
|
251
250
|
sortedDataItem,
|
|
252
251
|
getSortIcon,
|
|
253
252
|
getRowKey,
|
|
254
|
-
clearSelectedData
|
|
253
|
+
clearSelectedData,
|
|
255
254
|
} = useTable(props, emit, slots);
|
|
256
255
|
|
|
257
256
|
const { reinitializeSortable } = useDraggableTableRows(sortableTBody, dragOptions);
|
|
258
257
|
|
|
259
258
|
defineExpose({
|
|
260
|
-
clearSelectedData
|
|
259
|
+
clearSelectedData,
|
|
261
260
|
});
|
|
262
261
|
|
|
263
262
|
watch(tableKey, () => {
|