@dataloop-ai/components 0.20.212 → 0.20.214
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/package.json +1 -1
- package/src/assets/theme.css +1 -1
- package/src/components/basic/DlAccordion/DlAccordion.vue +3 -4
- package/src/components/basic/DlAccordion/components/AccordionHeader.vue +49 -16
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +12 -5
- package/src/utils/getLighterGradient.ts +37 -18
package/package.json
CHANGED
package/src/assets/theme.css
CHANGED
|
@@ -94,7 +94,7 @@ body {
|
|
|
94
94
|
--dl-color-chart-brush: #eef1ff; /* not in use */
|
|
95
95
|
|
|
96
96
|
--dl-date-picker-shadow: 0px 3px 6px #101e7326; /* not in use */
|
|
97
|
-
--dl-date-picker-selected-strip: #
|
|
97
|
+
--dl-date-picker-selected-strip: #ebf4fb; /* replace to --dell-blue-100: #ebf4fb */
|
|
98
98
|
--dl-date-picker-selected-date: #8fa0ff; /* not in use in OA, maybe in use in other repos*/
|
|
99
99
|
|
|
100
100
|
/* DlJsonEditor based on atom one themes */
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
:opened-icon="openedIcon"
|
|
19
19
|
data-test-id="accordion-header"
|
|
20
20
|
:background-color="backgroundColor"
|
|
21
|
-
|
|
21
|
+
with-background
|
|
22
22
|
@click="handleClick"
|
|
23
23
|
>
|
|
24
24
|
<template #header>
|
|
@@ -87,9 +87,8 @@ export default defineComponent({
|
|
|
87
87
|
separator: { type: Boolean, default: false },
|
|
88
88
|
closedIcon: { type: String, default: 'icon-dl-right-chevron' },
|
|
89
89
|
openedIcon: { type: String, default: 'icon-dl-down-chevron' },
|
|
90
|
-
backgroundColor: { type: String, default: '
|
|
91
|
-
withBackground: { type: Boolean, default: false }
|
|
92
|
-
iconHoverColor: { type: String, default: 'dl-color-primary' }
|
|
90
|
+
backgroundColor: { type: String, default: 'dell-blue-100' },
|
|
91
|
+
withBackground: { type: Boolean, default: false }
|
|
93
92
|
},
|
|
94
93
|
emits: ['update:model-value', 'hide', 'show'],
|
|
95
94
|
data() {
|
|
@@ -42,6 +42,7 @@ import { DlIcon } from '../../../essential'
|
|
|
42
42
|
import { defineComponent, ref } from 'vue-demi'
|
|
43
43
|
import { getColor } from '../../../../utils'
|
|
44
44
|
import { useSizeObserver } from '../../../../hooks/use-size-observer'
|
|
45
|
+
import { getDellColorNextShade } from '../../../../utils/getLighterGradient'
|
|
45
46
|
export default defineComponent({
|
|
46
47
|
name: 'AccordionHeader',
|
|
47
48
|
components: {
|
|
@@ -54,13 +55,13 @@ export default defineComponent({
|
|
|
54
55
|
fontSize: { type: String, default: '12px' },
|
|
55
56
|
fontWeight: { type: String, default: '400' },
|
|
56
57
|
title: { type: String, default: null },
|
|
57
|
-
titleColor: { type: String, default: '
|
|
58
|
+
titleColor: { type: String, default: 'dell-gray-800' },
|
|
58
59
|
isOpen: { type: Boolean, default: false },
|
|
59
60
|
rightSide: { type: Boolean, default: false },
|
|
60
61
|
closedIcon: { type: String, default: 'icon-dl-right-chevron' },
|
|
61
62
|
openedIcon: { type: String, default: 'icon-dl-down-chevron' },
|
|
62
|
-
backgroundColor: { type: String, default: '
|
|
63
|
-
withBackground: { type: Boolean, default:
|
|
63
|
+
backgroundColor: { type: String, default: 'dell-blue-100' },
|
|
64
|
+
withBackground: { type: Boolean, default: true }
|
|
64
65
|
},
|
|
65
66
|
emits: ['click'],
|
|
66
67
|
setup() {
|
|
@@ -74,6 +75,33 @@ export default defineComponent({
|
|
|
74
75
|
},
|
|
75
76
|
computed: {
|
|
76
77
|
accordionHeadStyles(): Record<string, string> {
|
|
78
|
+
let bgColor = ''
|
|
79
|
+
let hoverBgColor = ''
|
|
80
|
+
let activeBgColor = ''
|
|
81
|
+
if (this.withBackground) {
|
|
82
|
+
if (this.isOpen) {
|
|
83
|
+
bgColor = getColor(this.backgroundColor)
|
|
84
|
+
const nextShadeColor = getDellColorNextShade(
|
|
85
|
+
this.backgroundColor
|
|
86
|
+
)
|
|
87
|
+
if (nextShadeColor) {
|
|
88
|
+
hoverBgColor = getColor(nextShadeColor)
|
|
89
|
+
activeBgColor = hoverBgColor
|
|
90
|
+
} else {
|
|
91
|
+
hoverBgColor = bgColor
|
|
92
|
+
activeBgColor = bgColor
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
hoverBgColor = getColor(this.backgroundColor)
|
|
96
|
+
const nextShadeColor = getDellColorNextShade(
|
|
97
|
+
this.backgroundColor
|
|
98
|
+
)
|
|
99
|
+
activeBgColor = nextShadeColor
|
|
100
|
+
? getColor(nextShadeColor)
|
|
101
|
+
: hoverBgColor
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
77
105
|
return {
|
|
78
106
|
'--dl-title-color': getColor(this.titleColor, 'dell-gray-600'),
|
|
79
107
|
'--dl-expand-icon-color': `var(--${
|
|
@@ -84,18 +112,12 @@ export default defineComponent({
|
|
|
84
112
|
: 'row',
|
|
85
113
|
'--dl-accordion-header-fontsize': this.fontSize,
|
|
86
114
|
'--dl-accordion-header-fontweight': this.fontWeight,
|
|
87
|
-
'--dl-accordion-header-background-color':
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
'--dl-accordion-header-
|
|
92
|
-
|
|
93
|
-
'--dl-accordion-header-padding': this.withBackground
|
|
94
|
-
? '4px'
|
|
95
|
-
: '12px 16px',
|
|
96
|
-
'--dl-accordion-header-margin-bottom': this.withBackground
|
|
97
|
-
? '2px'
|
|
98
|
-
: '0px'
|
|
115
|
+
'--dl-accordion-header-background-color': bgColor,
|
|
116
|
+
'--dl-accordion-header-hover-background-color': hoverBgColor,
|
|
117
|
+
'--dl-accordion-header-active-background-color': activeBgColor,
|
|
118
|
+
'--dl-accordion-header-border-radius': '0px',
|
|
119
|
+
'--dl-accordion-header-padding': '12px 16px',
|
|
120
|
+
'--dl-accordion-header-margin-bottom': '0px'
|
|
99
121
|
}
|
|
100
122
|
},
|
|
101
123
|
hasSlot(): boolean {
|
|
@@ -125,13 +147,24 @@ export default defineComponent({
|
|
|
125
147
|
flex-direction: var(--dl-accordion-header-flex-direction);
|
|
126
148
|
color: var(--dl-title-color);
|
|
127
149
|
margin-bottom: var(--dl-accordion-header-margin-bottom);
|
|
150
|
+
background-color: var(--dl-accordion-header-background-color, transparent);
|
|
128
151
|
}
|
|
129
152
|
|
|
130
153
|
.accordion-header:hover {
|
|
131
|
-
background-color: var(
|
|
154
|
+
background-color: var(
|
|
155
|
+
--dl-accordion-header-hover-background-color,
|
|
156
|
+
transparent
|
|
157
|
+
);
|
|
132
158
|
border-radius: var(--dl-accordion-header-border-radius, 0px);
|
|
133
159
|
}
|
|
134
160
|
|
|
161
|
+
.accordion-header:active {
|
|
162
|
+
background-color: var(
|
|
163
|
+
--dl-accordion-header-active-background-color,
|
|
164
|
+
transparent
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
135
168
|
.accordion-title {
|
|
136
169
|
white-space: nowrap;
|
|
137
170
|
overflow: hidden;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="jsonEditorRef"
|
|
4
|
-
class="json-editor"
|
|
5
|
-
/>
|
|
2
|
+
<div ref="jsonEditorRef" class="json-editor" />
|
|
6
3
|
</template>
|
|
7
4
|
|
|
8
5
|
<script lang="ts">
|
|
@@ -58,7 +55,14 @@ export default defineComponent({
|
|
|
58
55
|
default: Mode.text
|
|
59
56
|
}
|
|
60
57
|
},
|
|
61
|
-
emits: [
|
|
58
|
+
emits: [
|
|
59
|
+
'update:model-value',
|
|
60
|
+
'align-text',
|
|
61
|
+
'change',
|
|
62
|
+
'content-error',
|
|
63
|
+
'focus',
|
|
64
|
+
'blur'
|
|
65
|
+
],
|
|
62
66
|
setup(props, { emit }) {
|
|
63
67
|
const { modelValue, indentation, readonly, mode } = toRefs(props)
|
|
64
68
|
|
|
@@ -228,6 +232,9 @@ export default defineComponent({
|
|
|
228
232
|
--jse-panel-background: var(--dl-json-editor-panel-background);
|
|
229
233
|
--jse-panel-border: var(--dl-color-separator);
|
|
230
234
|
--jse-main-border: 1px solid var(--dl-color-separator);
|
|
235
|
+
--jse-error-color: var(--dell-red-500, #af0000);
|
|
236
|
+
--jse-message-error-background: var(--jse-error-color);
|
|
237
|
+
--jse-message-error-color: var(--dell-white, #fff);
|
|
231
238
|
|
|
232
239
|
.jse-error {
|
|
233
240
|
display: none !important;
|
|
@@ -7,26 +7,45 @@ const allColorNames = {
|
|
|
7
7
|
...getRootStyles()
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
const getDellColorNextShade = (color: string): string | null => {
|
|
11
|
+
if (!color) {
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
if (!color.startsWith('dell-')) {
|
|
15
|
+
return color
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const colorMatch = color.match(/dell-(\w+)-(\d+)/)
|
|
19
|
+
if (!colorMatch) {
|
|
20
|
+
return color
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const colorName = colorMatch[1]
|
|
25
|
+
const colorValue = parseInt(colorMatch[2])
|
|
26
|
+
const nextColorValue = colorValue + 100
|
|
27
|
+
const nextColor = `--dell-${colorName}-${nextColorValue}`
|
|
28
|
+
|
|
29
|
+
if (nextColor in allColorNames) {
|
|
30
|
+
return `dell-${colorName}-${nextColorValue}`
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
// skip error
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return color
|
|
37
|
+
}
|
|
10
38
|
const getLighterGradient = (color: string, magnitude = MAGNITUDE) => {
|
|
11
|
-
if (color.startsWith('dl-')
|
|
39
|
+
if (color.startsWith('dl-')) {
|
|
12
40
|
color = `--${color}`
|
|
13
41
|
}
|
|
14
|
-
if (color.startsWith('
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const colorToReplace = `--dell-${colorName}-${nextColorValue}`
|
|
22
|
-
if (colorToReplace in allColorNames) {
|
|
23
|
-
return allColorNames[
|
|
24
|
-
colorToReplace as keyof typeof allColorNames
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
} catch (error) {
|
|
28
|
-
// skip error
|
|
29
|
-
}
|
|
42
|
+
if (color.startsWith('dell-')) {
|
|
43
|
+
const nextColor = getDellColorNextShade(color)
|
|
44
|
+
const nextColorName = `--${nextColor}`
|
|
45
|
+
if (nextColorName && nextColorName in allColorNames) {
|
|
46
|
+
return allColorNames[nextColorName as keyof typeof allColorNames]
|
|
47
|
+
} else {
|
|
48
|
+
color = nextColor
|
|
30
49
|
}
|
|
31
50
|
}
|
|
32
51
|
let newColor =
|
|
@@ -52,4 +71,4 @@ const getLighterGradient = (color: string, magnitude = MAGNITUDE) => {
|
|
|
52
71
|
}
|
|
53
72
|
}
|
|
54
73
|
|
|
55
|
-
export { getLighterGradient }
|
|
74
|
+
export { getLighterGradient, getDellColorNextShade }
|