webcake-ui-kit 1.1.30 → 1.1.32

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": "webcake-ui-kit",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "UI Kit for Vue 2 && 3 - Pure Options API",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -8,6 +8,8 @@
8
8
  disabled && 'ui-input-number--disabled',
9
9
  $attrs.class
10
10
  ]"
11
+ :style="draggable && !focused && !disabled ? { cursor: 'ew-resize' } : {}"
12
+ @mousedown="onDragStart"
11
13
  >
12
14
  <span v-if="hasPrefix" class="ui-input-number__decoration ui-input-number__prefix" aria-hidden="true">
13
15
  <slot name="prefix"></slot>
@@ -17,13 +19,17 @@
17
19
  class="ui-input-number__field"
18
20
  type="text"
19
21
  inputmode="decimal"
20
- :style="centered ? { textAlign: 'center' } : {}"
22
+ :style="{
23
+ ...(centered ? { textAlign: 'center' } : {}),
24
+ cursor: draggable && !focused && !disabled ? 'ew-resize' : ''
25
+ }"
21
26
  :value="displayValue"
22
27
  :placeholder="placeholder"
23
28
  :disabled="disabled"
24
29
  :readonly="readonly"
25
30
  :name="name"
26
31
  v-bind="{ ...$attrs, class: undefined }"
32
+ v-on="nativeListeners"
27
33
  @input="onInput"
28
34
  @focus="onFocus"
29
35
  @blur="onBlur"
@@ -61,13 +67,17 @@ export default {
61
67
  validator: v => ['default', 'round'].includes(v)
62
68
  },
63
69
  error: { type: Boolean, default: false },
64
- centered: { type: Boolean, default: false }
70
+ centered: { type: Boolean, default: false },
71
+ draggable: { type: Boolean, default: false }
65
72
  },
66
73
  emits: ['input', 'update:modelValue', 'change', 'focus', 'blur', 'pressEnter'],
67
74
  data() {
68
75
  return {
69
76
  focused: false,
70
- inputText: ''
77
+ inputText: '',
78
+ dragActive: false,
79
+ dragStartX: 0,
80
+ dragStartValue: 0
71
81
  }
72
82
  },
73
83
  computed: {
@@ -86,6 +96,11 @@ export default {
86
96
  const dot = s.indexOf('.')
87
97
  return dot >= 0 ? s.length - dot - 1 : 0
88
98
  },
99
+ nativeListeners() {
100
+ const excluded = new Set(['input', 'change', 'focus', 'blur', 'update:modelValue', 'pressEnter'])
101
+ const listeners = this.$listeners || {}
102
+ return Object.fromEntries(Object.entries(listeners).filter(([k]) => !excluded.has(k)))
103
+ },
89
104
  displayValue() {
90
105
  if (this.focused) return this.inputText
91
106
  const v = this.currentValue
@@ -174,6 +189,38 @@ export default {
174
189
  this.commitInput()
175
190
  this.$emit('blur', this.currentValue, e)
176
191
  },
192
+ onDragStart(e) {
193
+ if (!this.draggable || this.disabled || this.readonly) return
194
+ this.dragStartX = e.clientX
195
+ this.dragStartValue =
196
+ this.currentValue !== null && this.currentValue !== undefined ? Number(this.currentValue) : 0
197
+ this.dragActive = false
198
+ document.addEventListener('mousemove', this.onDragMove)
199
+ document.addEventListener('mouseup', this.onDragEnd)
200
+ },
201
+ onDragMove(e) {
202
+ const delta = e.clientX - this.dragStartX
203
+ if (!this.dragActive && Math.abs(delta) < 3) return
204
+ if (!this.dragActive) {
205
+ this.dragActive = true
206
+ document.body.style.cursor = 'ew-resize'
207
+ if (this.$refs.input) this.$refs.input.blur()
208
+ }
209
+ const newVal = this.clamp(this.toPrecision(this.dragStartValue + delta * this.step))
210
+ this.$emit('input', newVal)
211
+ this.$emit('update:modelValue', newVal)
212
+ },
213
+ onDragEnd(e) {
214
+ document.removeEventListener('mousemove', this.onDragMove)
215
+ document.removeEventListener('mouseup', this.onDragEnd)
216
+ if (this.dragActive) {
217
+ const delta = e.clientX - this.dragStartX
218
+ const newVal = this.clamp(this.toPrecision(this.dragStartValue + delta * this.step))
219
+ this.$emit('change', newVal)
220
+ document.body.style.cursor = ''
221
+ }
222
+ this.dragActive = false
223
+ },
177
224
  onKeydown(e) {
178
225
  if (e.key === 'ArrowUp') {
179
226
  e.preventDefault()
@@ -196,6 +243,11 @@ export default {
196
243
  this.$emit('pressEnter', this.currentValue, e)
197
244
  }
198
245
  }
246
+ },
247
+ beforeUnmount() {
248
+ document.removeEventListener('mousemove', this.onDragMove)
249
+ document.removeEventListener('mouseup', this.onDragEnd)
250
+ if (this.dragActive) document.body.style.cursor = ''
199
251
  }
200
252
  }
201
253
  </script>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <BaseIcon v-bind="$attrs" v-on="listeners">
3
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
4
+ <path
5
+ d="M5.82716 13.3562C6.05636 13.3562 6.27659 13.4467 6.43866 13.6085C6.60073 13.7704 6.69136 13.9903 6.69136 14.2192V16.3151H8.79012C9.01932 16.3151 9.23955 16.4056 9.40162 16.5674C9.56369 16.7293 9.65432 16.9492 9.65432 17.1781C9.65432 17.407 9.56369 17.6269 9.40162 17.7887C9.23955 17.9506 9.01932 18.0411 8.79012 18.0411H5.82716C5.59796 18.0411 5.37773 17.9506 5.21566 17.7887C5.0536 17.6269 4.96296 17.407 4.96296 17.1781V14.2192C4.96296 13.9903 5.0536 13.7704 5.21566 13.6085C5.37773 13.4467 5.59796 13.3562 5.82716 13.3562Z"
6
+ fill="currentColor"
7
+ />
8
+ <path
9
+ d="M18.1728 5.9589C18.402 5.9589 18.6223 6.04941 18.7843 6.21126C18.9464 6.37311 19.037 6.59303 19.037 6.82192V9.78082C19.037 10.0097 18.9464 10.2296 18.7843 10.3915C18.6223 10.5533 18.402 10.6438 18.1728 10.6438C17.9436 10.6438 17.7234 10.5533 17.5613 10.3915C17.3993 10.2296 17.3086 10.0097 17.3086 9.78082V7.68493H15.2099C14.9807 7.68493 14.7604 7.59442 14.5984 7.43258C14.4363 7.27073 14.3457 7.0508 14.3457 6.82192C14.3457 6.59303 14.4363 6.37311 14.5984 6.21126C14.7604 6.04941 14.9807 5.9589 15.2099 5.9589H18.1728Z"
10
+ fill="currentColor"
11
+ />
12
+ <path
13
+ fill-rule="evenodd"
14
+ clip-rule="evenodd"
15
+ d="M20.3951 3C20.8207 3 21.2293 3.1685 21.5303 3.46907C21.8313 3.76964 22 4.17767 22 4.60274V19.3973C22 19.8223 21.8313 20.2304 21.5303 20.5309C21.2293 20.8315 20.8207 21 20.3951 21H3.60494C3.17928 21 2.7707 20.8315 2.46971 20.5309C2.16873 20.2304 2 19.8223 2 19.3973V4.60274C2 4.17767 2.16873 3.76964 2.46971 3.46907C2.7707 3.1685 3.17928 3 3.60494 3H20.3951ZM3.7284 19.274H20.2716V4.72603H3.7284V19.274Z"
16
+ fill="currentColor"
17
+ />
18
+ </svg>
19
+ </BaseIcon>
20
+ </template>
21
+
22
+ <script>
23
+ import BaseIcon from './BaseIcon.vue'
24
+
25
+ export default {
26
+ name: 'FrameCorners',
27
+ components: { BaseIcon },
28
+ inheritAttrs: false,
29
+ emits: [],
30
+ computed: {
31
+ listeners() {
32
+ return this.$listeners || {}
33
+ }
34
+ }
35
+ }
36
+ </script>
@@ -1741,5 +1741,6 @@ export { default as WkiSlash2 } from './Slash2.vue'
1741
1741
  export { default as WkiSquareNumber } from './SquareNumber.vue'
1742
1742
  export { default as WkiRows3Add } from './Rows3Add.vue'
1743
1743
  export { default as WkiColumns3Add } from './Columns3Add.vue'
1744
+ export { default as WkiFrameCorners } from './FrameCorners.vue'
1744
1745
 
1745
1746
  // --- AUTO-GENERATED LUCIDE EXPORTS END ---