@dataloop-ai/components 0.18.112 → 0.18.114
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/components/basic/DlButton/DlButton.vue +16 -19
- package/src/components/basic/DlButton/utils.ts +21 -20
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +5 -0
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +17 -3
- package/src/components/essential/DlIcon/DlIcon.vue +2 -2
- package/src/demos/DlButtonDemo.vue +26 -8
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +13 -0
- package/src/utils/getColor.ts +1 -0
package/package.json
CHANGED
|
@@ -214,10 +214,24 @@ export default defineComponent({
|
|
|
214
214
|
},
|
|
215
215
|
getIconColor(): string {
|
|
216
216
|
if (this.disabled) {
|
|
217
|
-
return
|
|
217
|
+
return setTextColor({
|
|
218
|
+
disabled: this.disabled,
|
|
219
|
+
outlined: this.outlined,
|
|
220
|
+
flat: this.flat,
|
|
221
|
+
color: this.color,
|
|
222
|
+
filled: this.filled,
|
|
223
|
+
shaded: this.shaded,
|
|
224
|
+
textColor: this.iconColor ?? this.textColor
|
|
225
|
+
})
|
|
218
226
|
}
|
|
219
227
|
if (this.mouseOver) {
|
|
220
|
-
return
|
|
228
|
+
return setColorOnHover({
|
|
229
|
+
disabled: this.disabled,
|
|
230
|
+
outlined: this.outlined,
|
|
231
|
+
shaded: this.shaded,
|
|
232
|
+
flat: this.flat,
|
|
233
|
+
color: this.iconColor ?? this.textColor
|
|
234
|
+
})
|
|
221
235
|
}
|
|
222
236
|
|
|
223
237
|
if (this.iconColor) {
|
|
@@ -333,20 +347,6 @@ export default defineComponent({
|
|
|
333
347
|
flat: this.flat,
|
|
334
348
|
color: this.textColor
|
|
335
349
|
}),
|
|
336
|
-
'--dl-button-icon-color-hover': setColorOnHover({
|
|
337
|
-
disabled: this.disabled,
|
|
338
|
-
outlined: this.outlined,
|
|
339
|
-
shaded: this.shaded,
|
|
340
|
-
flat: this.flat,
|
|
341
|
-
color: this.getIconColor
|
|
342
|
-
}),
|
|
343
|
-
'--dl-icon-color': setColorOnHover({
|
|
344
|
-
disabled: this.disabled,
|
|
345
|
-
outlined: this.outlined,
|
|
346
|
-
shaded: this.shaded,
|
|
347
|
-
flat: this.flat,
|
|
348
|
-
color: this.getIconColor
|
|
349
|
-
}),
|
|
350
350
|
'--dl-button-border-hover': setBorderOnHover({
|
|
351
351
|
disabled: this.disabled,
|
|
352
352
|
flat: this.flat,
|
|
@@ -519,9 +519,6 @@ export default defineComponent({
|
|
|
519
519
|
|
|
520
520
|
.dl-button-icon {
|
|
521
521
|
transition: var(--dl-button-text-transition-duration);
|
|
522
|
-
&:hover:enabled:not(:active) {
|
|
523
|
-
color: var(--dl-button-icon-color-hover);
|
|
524
|
-
}
|
|
525
522
|
}
|
|
526
523
|
|
|
527
524
|
.dl-button-container {
|
|
@@ -163,12 +163,13 @@ export const setColorOnHover = ({
|
|
|
163
163
|
export const setBorderOnHover = ({
|
|
164
164
|
disabled,
|
|
165
165
|
flat,
|
|
166
|
-
color
|
|
166
|
+
color,
|
|
167
|
+
shaded
|
|
167
168
|
}: Partial<DlButtonProps>) => {
|
|
168
169
|
if (disabled) {
|
|
169
170
|
return 'var(--dl-color-separator)'
|
|
170
171
|
}
|
|
171
|
-
if (flat) {
|
|
172
|
+
if (flat || shaded) {
|
|
172
173
|
return 'var(--dl-color-transparent)'
|
|
173
174
|
}
|
|
174
175
|
if (color) {
|
|
@@ -180,15 +181,21 @@ export const setBorderOnHover = ({
|
|
|
180
181
|
export const setBgOnHover = ({
|
|
181
182
|
disabled,
|
|
182
183
|
flat,
|
|
184
|
+
shaded,
|
|
183
185
|
outlined,
|
|
184
186
|
filled,
|
|
185
187
|
color
|
|
186
188
|
}: Partial<DlButtonProps>) => {
|
|
187
|
-
if (
|
|
189
|
+
if (shaded) {
|
|
190
|
+
return 'var(--dl-color-fill)'
|
|
191
|
+
}
|
|
188
192
|
|
|
189
193
|
if (disabled || flat || outlined) {
|
|
190
194
|
return 'var(--dl-color-transparent)'
|
|
191
195
|
}
|
|
196
|
+
|
|
197
|
+
if (color) return getLighterGradient(color)
|
|
198
|
+
|
|
192
199
|
if (filled) {
|
|
193
200
|
return 'var(--dl-color-hover)'
|
|
194
201
|
}
|
|
@@ -196,15 +203,9 @@ export const setBgOnHover = ({
|
|
|
196
203
|
return 'var(--dl-color-panel-background)'
|
|
197
204
|
}
|
|
198
205
|
|
|
199
|
-
export const setBgOnPressed = ({
|
|
200
|
-
shaded,
|
|
201
|
-
outlined
|
|
202
|
-
}: Partial<DlButtonProps>) => {
|
|
203
|
-
if (shaded && outlined) {
|
|
204
|
-
return 'var(--dl-color-text-buttons)'
|
|
205
|
-
}
|
|
206
|
+
export const setBgOnPressed = ({ shaded }: Partial<DlButtonProps>) => {
|
|
206
207
|
if (shaded) {
|
|
207
|
-
return 'var(--dl-color-
|
|
208
|
+
return 'var(--dl-color-fill-hover)'
|
|
208
209
|
}
|
|
209
210
|
return 'var(--dl-button-bg)'
|
|
210
211
|
}
|
|
@@ -213,21 +214,21 @@ export const setTextOnPressed = ({
|
|
|
213
214
|
shaded,
|
|
214
215
|
outlined
|
|
215
216
|
}: Partial<DlButtonProps>) => {
|
|
216
|
-
if (shaded && outlined) {
|
|
217
|
-
return 'var(--dl-color-secondary)'
|
|
218
|
-
}
|
|
219
|
-
if (shaded) {
|
|
220
|
-
return 'var(--dl-color-text-buttons)'
|
|
221
|
-
}
|
|
222
217
|
return 'var(--dl-button-text-color)'
|
|
223
218
|
}
|
|
224
219
|
|
|
225
220
|
export const setBorderOnPressed = ({
|
|
226
221
|
shaded,
|
|
227
|
-
|
|
222
|
+
disabled,
|
|
223
|
+
flat,
|
|
224
|
+
color
|
|
228
225
|
}: Partial<DlButtonProps>) => {
|
|
229
|
-
if (
|
|
230
|
-
return 'var(--dl-color-
|
|
226
|
+
if (disabled) {
|
|
227
|
+
return 'var(--dl-color-separator)'
|
|
231
228
|
}
|
|
229
|
+
if (flat || shaded) {
|
|
230
|
+
return 'var(--dl-color-transparent)'
|
|
231
|
+
}
|
|
232
|
+
if (color) return getLighterGradient(color)
|
|
232
233
|
return 'var(--dl-button-border)'
|
|
233
234
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
:schema="schema"
|
|
18
18
|
:color-schema="colorSchema"
|
|
19
19
|
:strict="strict"
|
|
20
|
+
:placeholder="placeholder"
|
|
20
21
|
@focus="isFocused = true"
|
|
21
22
|
@blur="isFocused = false"
|
|
22
23
|
/>
|
|
@@ -130,6 +131,10 @@ export default defineComponent({
|
|
|
130
131
|
strict: {
|
|
131
132
|
type: Boolean,
|
|
132
133
|
default: false
|
|
134
|
+
},
|
|
135
|
+
placeholder: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: ''
|
|
133
138
|
}
|
|
134
139
|
},
|
|
135
140
|
emits: ['save-query', 'remove-query', 'search-query', 'update:model-value'],
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
ref="input"
|
|
25
25
|
:class="inputClass"
|
|
26
26
|
:style="textareaStyles"
|
|
27
|
-
:placeholder="
|
|
27
|
+
:placeholder="inputPlaceholder"
|
|
28
28
|
:contenteditable="!disabled"
|
|
29
29
|
@keypress="onKeyPress"
|
|
30
30
|
@input="onInput"
|
|
@@ -431,6 +431,10 @@ export default defineComponent({
|
|
|
431
431
|
if (e.key === 'Enter') {
|
|
432
432
|
e.preventDefault()
|
|
433
433
|
}
|
|
434
|
+
|
|
435
|
+
if (!focused.value) {
|
|
436
|
+
focus()
|
|
437
|
+
}
|
|
434
438
|
}
|
|
435
439
|
|
|
436
440
|
const onInput = (e: Event) => {
|
|
@@ -612,6 +616,13 @@ export default defineComponent({
|
|
|
612
616
|
message: error.value
|
|
613
617
|
}
|
|
614
618
|
})
|
|
619
|
+
|
|
620
|
+
const inputPlaceholder = computed(() => {
|
|
621
|
+
return focused.value || searchQuery.value.length
|
|
622
|
+
? ''
|
|
623
|
+
: props.placeholder
|
|
624
|
+
})
|
|
625
|
+
|
|
615
626
|
//#endregion
|
|
616
627
|
|
|
617
628
|
//#region watcher
|
|
@@ -715,7 +726,8 @@ export default defineComponent({
|
|
|
715
726
|
onInput,
|
|
716
727
|
onDateSelection,
|
|
717
728
|
computedStatus,
|
|
718
|
-
setInputFromSuggestion
|
|
729
|
+
setInputFromSuggestion,
|
|
730
|
+
inputPlaceholder
|
|
719
731
|
}
|
|
720
732
|
}
|
|
721
733
|
})
|
|
@@ -831,8 +843,10 @@ export default defineComponent({
|
|
|
831
843
|
color: var(--dl-color-darker);
|
|
832
844
|
background-color: var(--dl-color-panel-background);
|
|
833
845
|
|
|
834
|
-
|
|
846
|
+
&::before {
|
|
835
847
|
color: var(--dl-color-lighter);
|
|
848
|
+
/* In case this causes render shadowing move to use html/injection approach */
|
|
849
|
+
content: attr(placeholder);
|
|
836
850
|
}
|
|
837
851
|
& > * {
|
|
838
852
|
display: flex;
|
|
@@ -89,7 +89,7 @@ export default defineComponent({
|
|
|
89
89
|
cssIconVars(): Record<string, string> {
|
|
90
90
|
return {
|
|
91
91
|
'--dl-icon-font-size': `${this.size}`,
|
|
92
|
-
'--icon-color': this.color
|
|
92
|
+
'--dl-icon-color': this.color
|
|
93
93
|
? // todo: remove this. this is needed for now until the swap of DLBTN in OA
|
|
94
94
|
getColor(
|
|
95
95
|
this.color === 'secondary'
|
|
@@ -157,7 +157,7 @@ export default defineComponent({
|
|
|
157
157
|
<style scoped lang="scss">
|
|
158
158
|
.dl-icon {
|
|
159
159
|
display: inline-flex;
|
|
160
|
-
color: var(--dl-icon-color
|
|
160
|
+
color: var(--dl-icon-color);
|
|
161
161
|
font-size: var(--dl-icon-font-size);
|
|
162
162
|
}
|
|
163
163
|
</style>
|
|
@@ -293,26 +293,44 @@
|
|
|
293
293
|
outlined
|
|
294
294
|
/>
|
|
295
295
|
</div>
|
|
296
|
-
<div>
|
|
297
|
-
<h3>
|
|
296
|
+
<div style="display: flex; flex-direction: column">
|
|
297
|
+
<h3>button with icon color</h3>
|
|
298
298
|
<dl-button
|
|
299
299
|
icon="icon-dl-search"
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
:icon-color="'red'"
|
|
301
|
+
:text-color="'blue'"
|
|
302
|
+
color="green"
|
|
302
303
|
label="test me"
|
|
303
|
-
|
|
304
|
+
size="s"
|
|
305
|
+
flat
|
|
304
306
|
/>
|
|
305
|
-
</div>
|
|
306
|
-
<div>
|
|
307
|
-
<h3>button with icon color</h3>
|
|
308
307
|
<dl-button
|
|
309
308
|
icon="icon-dl-search"
|
|
310
309
|
:icon-color="'red'"
|
|
310
|
+
:text-color="'blue'"
|
|
311
|
+
color="green"
|
|
311
312
|
label="test me"
|
|
312
313
|
size="s"
|
|
313
314
|
shaded
|
|
315
|
+
/>
|
|
316
|
+
<dl-button
|
|
317
|
+
icon="icon-dl-search"
|
|
318
|
+
:icon-color="'red'"
|
|
319
|
+
:text-color="'blue'"
|
|
320
|
+
color="green"
|
|
321
|
+
label="test me"
|
|
322
|
+
size="s"
|
|
314
323
|
outlined
|
|
315
324
|
/>
|
|
325
|
+
<dl-button
|
|
326
|
+
icon="icon-dl-search"
|
|
327
|
+
:icon-color="'red'"
|
|
328
|
+
:text-color="'blue'"
|
|
329
|
+
color="green"
|
|
330
|
+
label="test me"
|
|
331
|
+
size="s"
|
|
332
|
+
filled
|
|
333
|
+
/>
|
|
316
334
|
</div>
|
|
317
335
|
</div>
|
|
318
336
|
</template>
|
|
@@ -70,6 +70,19 @@
|
|
|
70
70
|
/>
|
|
71
71
|
{{ queryObject }}
|
|
72
72
|
{{ queryObject2 }}
|
|
73
|
+
|
|
74
|
+
<br>
|
|
75
|
+
<br>
|
|
76
|
+
With placeholder
|
|
77
|
+
<dl-smart-search-input
|
|
78
|
+
v-model="queryObject"
|
|
79
|
+
:aliases="aliases"
|
|
80
|
+
:schema="schema"
|
|
81
|
+
:color-schema="colorSchema"
|
|
82
|
+
:strict="strictState"
|
|
83
|
+
:disabled="switchState"
|
|
84
|
+
placeholder="I am a placeholder"
|
|
85
|
+
/>
|
|
73
86
|
</div>
|
|
74
87
|
</template>
|
|
75
88
|
|
package/src/utils/getColor.ts
CHANGED