@dataloop-ai/components 0.18.111 → 0.18.113

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.18.111",
3
+ "version": "0.18.113",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -214,10 +214,24 @@ export default defineComponent({
214
214
  },
215
215
  getIconColor(): string {
216
216
  if (this.disabled) {
217
- return 'dl-color-disabled'
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 'dl-color-hover'
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 (color) return getLighterGradient(color)
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-secondary)'
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
- outlined
222
+ disabled,
223
+ flat,
224
+ color
228
225
  }: Partial<DlButtonProps>) => {
229
- if (shaded && outlined) {
230
- return 'var(--dl-color-secondary)'
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
  }
@@ -133,6 +133,14 @@
133
133
  }`
134
134
  ]"
135
135
  >
136
+ <dl-icon
137
+ v-if="clearable && hasSelection"
138
+ class=".dl-select__clear-button"
139
+ icon="icon-dl-close"
140
+ :size="withoutBorders ? '10px' : '12px'"
141
+ style="margin-right: 3px; cursor: pointer"
142
+ @click.prevent.stop="clearSelection"
143
+ />
136
144
  <dl-icon
137
145
  :icon="dropdownIcon"
138
146
  :color="chevronIconColor"
@@ -388,7 +396,7 @@ export default defineComponent({
388
396
  },
389
397
  capitalizedOptions: { type: Boolean, default: false },
390
398
  withoutDropdownIconPadding: { type: Boolean, default: false },
391
- clearButtonTooltip: { type: Boolean, default: false },
399
+ clearable: { type: Boolean, default: false },
392
400
  dropdownMaxHeight: { type: String, default: '30vh' },
393
401
  preserveSearch: { type: Boolean, default: false },
394
402
  disabledTooltip: { type: String, default: 'Disabled' },
@@ -455,6 +463,9 @@ export default defineComponent({
455
463
  }
456
464
  },
457
465
  computed: {
466
+ hasSelection(): boolean {
467
+ return !!this.modelValueLength || this.selectedIndex !== -1
468
+ },
458
469
  filteredOptions(): DlSelectOptionType[] {
459
470
  if (this.customFilter || this.searchTerm === '') {
460
471
  return this.options
@@ -778,6 +789,13 @@ export default defineComponent({
778
789
  this.$emit('change', toEmit)
779
790
  },
780
791
  clearSelection(): void {
792
+ let toEmit: any[] | string = []
793
+ if (this.isModelValuePrimitiveType) {
794
+ toEmit = ''
795
+ }
796
+
797
+ this.$emit('update:model-value', toEmit)
798
+ this.$emit('change', toEmit)
781
799
  this.selectedIndex = -1
782
800
  this.closeMenu()
783
801
  },
@@ -241,6 +241,7 @@
241
241
  />
242
242
  </slot>
243
243
  </td>
244
+ <!-- todo wrap this with dltd -->
244
245
  <slot
245
246
  v-for="col in computedCols"
246
247
  v-bind="
@@ -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, var(--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>hover color</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
- flat
301
- dense
300
+ :icon-color="'red'"
301
+ :text-color="'blue'"
302
+ color="green"
302
303
  label="test me"
303
- text-color="red"
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>
@@ -161,6 +161,13 @@
161
161
  multiselect
162
162
  searchable
163
163
  />
164
+ <dl-select
165
+ v-model="selectedWithChildrenSearch"
166
+ :options="treeOptions"
167
+ size="m"
168
+ multiselect
169
+ clearable
170
+ />
164
171
  Capitalized options
165
172
  <dl-select
166
173
  v-model="selectedWithChildrenCapitalized"
@@ -383,6 +390,42 @@
383
390
  </div>
384
391
  </template>
385
392
  </dl-select>
393
+
394
+ Select clearable
395
+ <dl-select
396
+ v-model="selectedOption"
397
+ :options="[
398
+ {
399
+ subLabel: 'not so high',
400
+ label: 'High',
401
+ value: 'high',
402
+ bgColor: 'dl-color-negative'
403
+ },
404
+ {
405
+ subLabel: 'not so medium',
406
+ label: 'Medium',
407
+ value: 'medium',
408
+ bgColor: 'dl-color-warning',
409
+ textColor: 'dl-color-darker'
410
+ },
411
+ {
412
+ subLabel: 'not so low',
413
+ label: 'Low',
414
+ value: 'low',
415
+ bgColor: 'dl-color-positive',
416
+ textColor: 'dl-color-darker'
417
+ }
418
+ ]"
419
+ clearable
420
+ style="margin-bottom: 150px"
421
+ >
422
+ <template #option="scope">
423
+ <div style="padding: 5px 0px">
424
+ <div>{{ scope.opt.label }}</div>
425
+ <div>{{ scope.opt.subLabel }}</div>
426
+ </div>
427
+ </template>
428
+ </dl-select>
386
429
  </div>
387
430
  </template>
388
431
 
@@ -10,6 +10,7 @@ const getColor = (color: string, fallback?: string) => {
10
10
  }
11
11
 
12
12
  if (!color) return `var(--${fallback || 'dl-color-darker'})`
13
+ if (color.includes('var(--')) return color
13
14
 
14
15
  return `var(--${color}, var(--${fallback || 'dl-color-darker'}))`
15
16
  }