@dataloop-ai/components 0.17.121 → 0.17.123

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.17.121",
3
+ "version": "0.17.123",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -1,7 +1,7 @@
1
1
  import { getColor } from '../../../utils'
2
2
  import { getLighterGradient } from '../../../utils/getLighterGradient'
3
3
 
4
- export type ButtonSizes = 's' | 'm' | 'l' | 'xl' | string
4
+ export type ButtonSizes = 's' | 'm' | 'l' | ('xl' & string)
5
5
 
6
6
  const paddings = {
7
7
  s: '7px 16px',
@@ -453,14 +453,15 @@ export default defineComponent({
453
453
  },
454
454
  suggestions(val) {
455
455
  if (this.isDatePickerVisible) return
456
+ nextTick(() => {
457
+ if (!val.length) {
458
+ this.suggestionModal = false
459
+ }
456
460
 
457
- if (!val.length) {
458
- this.suggestionModal = false
459
- }
460
-
461
- if (!this.suggestionModal && val.length > 0 && this.focused) {
462
- this.suggestionModal = true
463
- }
461
+ if (!this.suggestionModal && val.length > 0 && this.focused) {
462
+ this.suggestionModal = true
463
+ }
464
+ })
464
465
  },
465
466
  expanded(value) {
466
467
  this.$nextTick(() => {
@@ -1,19 +1,20 @@
1
1
  <template>
2
2
  <input
3
3
  ref="sliderInput"
4
- :value="sliderValue"
4
+ :value="modelRef"
5
5
  type="number"
6
6
  :min="min"
7
7
  :max="max"
8
8
  :readonly="readonly"
9
9
  :disabled="disabled"
10
- @input="sliderValue = $event"
10
+ @input="handleChange"
11
11
  @change="handleChange"
12
12
  >
13
13
  </template>
14
14
 
15
15
  <script lang="ts">
16
- import { defineComponent } from 'vue-demi'
16
+ import { debounce } from 'lodash'
17
+ import { defineComponent, toRef } from 'vue-demi'
17
18
  import { getInputValue } from '../utils'
18
19
 
19
20
  export default defineComponent({
@@ -45,34 +46,24 @@ export default defineComponent({
45
46
  }
46
47
  },
47
48
  emits: ['update:model-value', 'change'],
48
- computed: {
49
- sliderValue: {
50
- get(): number | undefined {
51
- return this.modelValue
52
- },
53
- set(evt: any): void {
54
- const val = evt.target.value
49
+ setup(props, { emit }) {
50
+ const modelRef = toRef(props, 'modelValue')
55
51
 
56
- if (val === '') return
57
-
58
- const { value } = getInputValue(val, this.min, this.max)
59
-
60
- ;(this.$refs.sliderInput as HTMLInputElement).value = value
61
-
62
- this.$emit('update:model-value', Number(value))
63
- }
64
- }
65
- },
66
- methods: {
67
- handleChange(evt: any) {
52
+ const handleChange = (evt: any) => {
68
53
  const val = evt.target.value
69
54
  if (val === '') return
70
55
 
71
- const { value } = getInputValue(val, this.min, this.max)
56
+ const { value } = getInputValue(val, props.min, props.max)
57
+
58
+ emit('change', Number(value))
59
+ emit('update:model-value', Number(value))
60
+ }
72
61
 
73
- ;(this.$refs.sliderInput as HTMLInputElement).value = value
62
+ const debouncedHandleChange = debounce(handleChange, 300)
74
63
 
75
- this.$emit('change', Number(value))
64
+ return {
65
+ modelRef,
66
+ handleChange: debouncedHandleChange
76
67
  }
77
68
  },
78
69
  template: 'dl-slider-input'
@@ -1,6 +1,6 @@
1
1
  export const getInputValue = (value: string, min: number, max: number) => {
2
- if (parseInt(value) > max || parseInt(value) < min) {
3
- return { value: (parseInt(value) > max ? max : min).toString() }
2
+ if (parseFloat(value) > max || parseFloat(value) < min) {
3
+ return { value: (parseFloat(value) > max ? max : min).toString() }
4
4
  }
5
5
 
6
6
  return { value }
@@ -22,7 +22,7 @@
22
22
  <div
23
23
  v-else
24
24
  :id="uuid"
25
- style="display: inline"
25
+ :style="[inlineStyles, computedStyles]"
26
26
  @click="$emit('click', $event)"
27
27
  @mousedown="$emit('mousedown', $event)"
28
28
  @mouseup="$emit('mouseup', $event)"
@@ -156,7 +156,7 @@ export default defineComponent({
156
156
 
157
157
  <style scoped lang="scss">
158
158
  .dl-icon {
159
- display: inline-block;
159
+ display: inline-flex;
160
160
  color: var(--dl-icon-color);
161
161
  font-size: var(--dl-icon-font-size);
162
162
  }
@@ -53,6 +53,7 @@ export default defineComponent({
53
53
 
54
54
  <style scoped lang="scss">
55
55
  .dl-item__section {
56
+ display: flex;
56
57
  padding-left: 0;
57
58
  padding-right: 0;
58
59
  font-size: var(--dl-font-size-body);