@dataloop-ai/components 0.19.10 → 0.19.11

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.19.10",
3
+ "version": "0.19.11",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -54,7 +54,10 @@
54
54
  class="legend-avatar"
55
55
  :src="labelImages[index]"
56
56
  >
57
- <span v-else>
57
+ <span
58
+ v-else
59
+ class="label"
60
+ >
58
61
  {{ label }}
59
62
  </span>
60
63
  <dl-tooltip :offset="[0, 0]">
@@ -121,10 +124,7 @@
121
124
  </div>
122
125
  </div>
123
126
  </div>
124
- <div
125
- class="x-axis"
126
- style="margin-top: 10px"
127
- >
127
+ <div class="x-axis">
128
128
  <div
129
129
  v-for="(label, index) in visibleLabels"
130
130
  :key="index"
@@ -133,6 +133,7 @@
133
133
  flex-grow: 100;
134
134
  width: 100%;
135
135
  justify-content: center;
136
+ overflow: hidden;
136
137
  "
137
138
  >
138
139
  <span
@@ -156,16 +157,20 @@
156
157
  class="legend-avatar"
157
158
  :src="labelImages[index]"
158
159
  >
159
- <span v-else>
160
+ <span
161
+ v-else
162
+ class="label"
163
+ >
160
164
  {{ label }}
161
165
  </span>
162
166
  </span>
163
- <dl-tooltip
164
- self="top middle"
165
- :offset="debouncedCalculateXAxisElOffset(index)"
166
- >
167
- {{ labelStrings[index] }}</dl-tooltip>
168
167
  </span>
168
+ <dl-tooltip
169
+ self="top middle"
170
+ :offset="debouncedCalculateXAxisElOffset(index)"
171
+ >
172
+ {{ labelStrings[index] }}
173
+ </dl-tooltip>
169
174
  </div>
170
175
  </div>
171
176
  <dl-brush
@@ -292,7 +297,7 @@ export default defineComponent({
292
297
  },
293
298
  setup(props) {
294
299
  const vm = getCurrentInstance()
295
- const { variables } = useThemeVariables()
300
+ const { variables, isDark = { value: false } } = useThemeVariables()
296
301
  const currentBrushState = ref<{ min: number; max: number }>({
297
302
  min: 0,
298
303
  max: Math.min(props.matrix.length, props.cellDisplayLimit)
@@ -312,13 +317,22 @@ export default defineComponent({
312
317
  }
313
318
 
314
319
  const getCellTextColor = (value: number) => {
315
- const isDark =
316
- document.documentElement.getAttribute('data-theme') ===
317
- 'dark-mode'
318
- if (isDark) return 'var(--dl-color-text-buttons)'
320
+ if (isDark.value) return 'var(--dl-color-text-buttons)'
319
321
  return `var(--dl-color-text${value < 0.5 ? '-darker' : ''}-buttons)`
320
322
  }
321
323
 
324
+ const gradationDarkColor = computed(() => {
325
+ return isDark.value
326
+ ? getCellBackground()
327
+ : 'var(--dl-color-secondary)'
328
+ })
329
+
330
+ const gradationLightColor = computed(() => {
331
+ return isDark.value
332
+ ? 'var(--dl-color-text-darker-buttons)'
333
+ : 'var(--dl-color-text-buttons)'
334
+ })
335
+
322
336
  const calculateXAxisElOffset = (index: number): number[] => {
323
337
  let el = vm.refs[`xAxis-${index}`] as HTMLElement
324
338
  if (!el) return null
@@ -330,7 +344,7 @@ export default defineComponent({
330
344
  }
331
345
  const height = el.clientHeight
332
346
  const offsetHeight = -1 * (height / 2)
333
- return [0, offsetHeight]
347
+ return [0, offsetHeight + 30]
334
348
  }
335
349
 
336
350
  const debouncedCalculateXAxisElOffset = computed(() => {
@@ -350,7 +364,9 @@ export default defineComponent({
350
364
  rotateXLabels,
351
365
  calculateXAxisElOffset,
352
366
  debouncedCalculateXAxisElOffset,
353
- isDisposed
367
+ isDisposed,
368
+ gradationDarkColor,
369
+ gradationLightColor
354
370
  }
355
371
  },
356
372
  computed: {
@@ -384,7 +400,8 @@ export default defineComponent({
384
400
  return {
385
401
  '--matrix-rows': this.matrix.length,
386
402
  '--cell-dimensions': `${this.cellWidth}px`,
387
- '--general-color': this.getCellBackground()
403
+ '--gradation-dark': this.gradationDarkColor,
404
+ '--gradation-light': this.gradationLightColor
388
405
  }
389
406
  },
390
407
  gradationValues(): number[] {
@@ -524,6 +541,12 @@ export default defineComponent({
524
541
  align-items: center;
525
542
  }
526
543
 
544
+ .label {
545
+ transform: translateX(40%);
546
+ display: block;
547
+ text-align: start;
548
+ }
549
+
527
550
  .label-tag {
528
551
  font-size: 0.8em;
529
552
  color: var(--dl-color-medium);
@@ -541,7 +564,7 @@ export default defineComponent({
541
564
  width: 100%;
542
565
  display: flex;
543
566
  justify-content: space-evenly;
544
- margin-top: 10px;
567
+ margin: 10px 0px 15px 0px;
545
568
  min-height: 100px;
546
569
  max-height: 100px;
547
570
  &__element {
@@ -568,6 +591,7 @@ export default defineComponent({
568
591
  }
569
592
  .y-axis-outer {
570
593
  overflow: hidden;
594
+ margin-right: 10px;
571
595
  width: 200px;
572
596
  }
573
597
  .y-axis,
@@ -615,8 +639,8 @@ export default defineComponent({
615
639
  &__gradient {
616
640
  width: 40%;
617
641
  background-image: linear-gradient(
618
- var(--general-color),
619
- var(--dl-color-text-buttons)
642
+ var(--gradation-dark),
643
+ var(--gradation-light)
620
644
  );
621
645
  }
622
646
  &__gradation {
@@ -61,7 +61,13 @@ const getMatrix = (size: number) => {
61
61
  }
62
62
 
63
63
  const getLabels = (size: number) => {
64
- const items = ['Van', 'Truck', 'Motorcycle', 'Car', 'Bus']
64
+ const items = [
65
+ 'Van',
66
+ 'Truck',
67
+ 'MotorcycleLooooooooooooooooooooooooooong',
68
+ 'Car',
69
+ 'Bus'
70
+ ]
65
71
 
66
72
  // const items = [
67
73
  // { title: 'Van', image: 'https://picsum.photos/200/200' },
@@ -1,8 +1,8 @@
1
1
  import { getRootStyles } from '../utils/getRootStyles'
2
- import { inject, watch, reactive } from 'vue-demi'
2
+ import { inject, watch, reactive, Ref } from 'vue-demi'
3
3
 
4
4
  export const useThemeVariables = () => {
5
- const isDark = inject('theme')
5
+ const isDark = inject('theme') as Ref
6
6
 
7
7
  const variables = reactive(getRootStyles())
8
8
 
@@ -14,6 +14,6 @@ export const useThemeVariables = () => {
14
14
  { deep: true }
15
15
  )
16
16
 
17
- if (variables) return { variables }
17
+ if (variables) return { variables, isDark }
18
18
  return
19
19
  }