@awes-io/ui 2.108.0 → 2.108.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.108.2](https://github.com/awes-io/client/compare/@awes-io/ui@2.108.1...@awes-io/ui@2.108.2) (2024-08-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * viewport check infinity loop removed ([5db5844](https://github.com/awes-io/client/commit/5db5844cb383dec764af89da7e6766972ecd26e0))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.108.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.108.0...@awes-io/ui@2.108.1) (2024-08-07)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **aw-code:** auto suggestion pastes all digits ([0032b66](https://github.com/awes-io/client/commit/0032b6643f4075839132e2c7c9847520ba8611fe))
23
+
24
+
25
+
26
+
27
+
6
28
  # [2.108.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.107.0...@awes-io/ui@2.108.0) (2024-07-30)
7
29
 
8
30
 
@@ -1,9 +1,10 @@
1
1
  .aw-refresh-wrapper {
2
2
  &__loader {
3
- display: flex;
4
- justify-content: center;
5
- align-items: center;
6
- width: 100%;
7
- z-index: 9999;
8
- }
3
+ fill: currentColor;
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
7
+ width: 100%;
8
+ z-index: 9999;
9
+ }
9
10
  }
@@ -31,7 +31,6 @@
31
31
  type="tel"
32
32
  inputmode="numeric"
33
33
  pattern="[0-9]*"
34
- maxlength="1"
35
34
  autocomplete="off"
36
35
  :value="codeValue[i]"
37
36
  :class="[elClasses.element, 'text-center p-3']"
@@ -49,6 +48,7 @@
49
48
  </template>
50
49
 
51
50
  <script>
51
+ import { clamp } from 'rambdax'
52
52
  import { conf } from '@AwUtils/component'
53
53
  import { getBemClasses } from '@AwUtils/css'
54
54
  import { AwCode as _config } from '@AwConfig'
@@ -57,6 +57,8 @@ import fieldMixin from '@AwMixins/field'
57
57
 
58
58
  const SPACER_RE = /-/g
59
59
 
60
+ const MAX_LENGTH = 1
61
+
60
62
  export default {
61
63
  name: 'AwCode',
62
64
 
@@ -159,15 +161,20 @@ export default {
159
161
  methods: {
160
162
  _onInput($event, index) {
161
163
  const field = $event.target
162
- const parsed = field.value.replace(/\D/g, '')
163
-
164
- // immedate update to prevent blinking
165
- field.value = parsed
166
- this.$set(this.codeValue, index, parsed)
167
-
168
- // go to next field if current is not empty
169
- if (parsed.length === field.maxLength) {
170
- this._focus(field)
164
+ const parsed = this._parseValue($event.data)
165
+
166
+ // virtual keyboard auto-suggestion clicked
167
+ if (parsed.length > MAX_LENGTH) {
168
+ this._pasteValue(parsed)
169
+ } else {
170
+ // immedate update to prevent blinking
171
+ field.value = parsed
172
+ this.$set(this.codeValue, index, parsed)
173
+
174
+ // go to next field if current is not empty
175
+ if (parsed.length === MAX_LENGTH) {
176
+ this._focus(field)
177
+ }
171
178
  }
172
179
 
173
180
  // reset error if exists
@@ -189,9 +196,28 @@ export default {
189
196
  }
190
197
  },
191
198
 
199
+ _parseValue(str) {
200
+ return (str || '').replace(/\D/g, '')
201
+ },
202
+
192
203
  _onPaste($event) {
193
204
  // if (this.error && this.error.length) this.resetError()
194
- this.inputValue = $event.clipboardData.getData('text')
205
+ const value = this._parseValue($event.clipboardData.getData('text'))
206
+
207
+ this._pasteValue(value)
208
+ },
209
+
210
+ _pasteValue(value) {
211
+ this.inputValue = value
212
+
213
+ setTimeout(() => {
214
+ const field = this.$refs.fields[
215
+ clamp(0, this.length, value.length)
216
+ ]
217
+
218
+ field.focus()
219
+ field.setSelectionRange(MAX_LENGTH, MAX_LENGTH)
220
+ }, 10)
195
221
  }
196
222
  }
197
223
  }
@@ -8,6 +8,7 @@
8
8
  color="mono"
9
9
  icon="awesio/edit"
10
10
  :href="profileUrl"
11
+ back
11
12
  />
12
13
  </div>
13
14
 
@@ -62,8 +62,10 @@ if (typeof window !== 'undefined' && 'visualViewport' in window) {
62
62
  viewport.offsetLeft + 'px'
63
63
  )
64
64
 
65
+ if (event.isCheck) return
66
+
65
67
  // double check!
66
- setTimeout(viewportHandler, 60, { target: window.visualViewport })
68
+ setTimeout(viewportHandler, 60, { target: window.visualViewport, isCheck: true })
67
69
  })
68
70
  }
69
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.108.0",
3
+ "version": "2.108.2",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -114,5 +114,5 @@
114
114
  "rollup-plugin-visualizer": "^2.6.0",
115
115
  "rollup-plugin-vue": "^5.0.1"
116
116
  },
117
- "gitHead": "23930faef5cd5d91e72b8753a2968f3d5ab4510b"
117
+ "gitHead": "8237265ef90c03b278f2456a4779c2e8a332db35"
118
118
  }