webcake-ui-kit 1.1.12 → 1.1.14

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.12",
3
+ "version": "1.1.14",
4
4
  "description": "UI Kit for Vue 2 && 3 - Pure Options API",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -9,11 +9,15 @@
9
9
  $attrs.class
10
10
  ]"
11
11
  >
12
+ <span v-if="hasPrefix" class="ui-input-number__decoration ui-input-number__prefix" aria-hidden="true">
13
+ <slot name="prefix"></slot>
14
+ </span>
12
15
  <input
13
16
  ref="input"
14
17
  class="ui-input-number__field"
15
18
  type="text"
16
19
  inputmode="decimal"
20
+ :style="centered ? { textAlign: 'center' } : {}"
17
21
  :value="displayValue"
18
22
  :placeholder="placeholder"
19
23
  :disabled="disabled"
@@ -25,6 +29,9 @@
25
29
  @blur="onBlur"
26
30
  @keydown="onKeydown"
27
31
  />
32
+ <span v-if="hasSuffix" class="ui-input-number__decoration ui-input-number__suffix" aria-hidden="true">
33
+ <slot name="suffix"></slot>
34
+ </span>
28
35
  </span>
29
36
  </template>
30
37
 
@@ -53,7 +60,8 @@ export default {
53
60
  default: 'default',
54
61
  validator: v => ['default', 'round'].includes(v)
55
62
  },
56
- error: { type: Boolean, default: false }
63
+ error: { type: Boolean, default: false },
64
+ centered: { type: Boolean, default: false }
57
65
  },
58
66
  emits: ['input', 'update:modelValue', 'change', 'focus', 'blur', 'pressEnter'],
59
67
  data() {
@@ -66,6 +74,12 @@ export default {
66
74
  currentValue() {
67
75
  return this.modelValue !== undefined ? this.modelValue : this.value
68
76
  },
77
+ hasPrefix() {
78
+ return !!((this.$scopedSlots && this.$scopedSlots['prefix']) || this.$slots['prefix'])
79
+ },
80
+ hasSuffix() {
81
+ return !!((this.$scopedSlots && this.$scopedSlots['suffix']) || this.$slots['suffix'])
82
+ },
69
83
  effectivePrecision() {
70
84
  if (this.precision !== null) return this.precision
71
85
  const s = String(this.step)
@@ -128,3 +128,19 @@
128
128
  .ui-input-number__field:disabled {
129
129
  cursor: not-allowed;
130
130
  }
131
+
132
+ .ui-input-number__decoration {
133
+ display: inline-flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ flex-shrink: 0;
137
+ width: 20px;
138
+ height: 20px;
139
+ color: var(--muted-fg);
140
+ }
141
+
142
+ .ui-input-number--size-xs .ui-input-number__decoration,
143
+ .ui-input-number--size-tiny .ui-input-number__decoration {
144
+ width: 16px;
145
+ height: 16px;
146
+ }