@pocketprep/ui-kit 3.0.17 → 3.0.19

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.
@@ -75,6 +75,8 @@
75
75
  <Icon type="review-flag" title="review-flag" />
76
76
  <Icon type="levelup" title="levelup" />
77
77
  <Icon type="lightbulb" title="lightbulb" />
78
+ <Icon type="chat" title="chat" />
79
+ <Icon type="preview" title="preview" />
78
80
  </div>
79
81
  </div>
80
82
  </template>
@@ -64,6 +64,8 @@
64
64
  <IconLaunch v-else-if="type === 'launch'" :title="title" />
65
65
  <IconLevelUp v-else-if="type === 'levelup'" :title="title" />
66
66
  <IconLightbulb v-else-if="type === 'lightbulb'" :title="title" />
67
+ <IconChat v-else-if="type === 'chat'" :title="title" />
68
+ <IconPreview v-else-if="type === 'preview'" :title="title" />
67
69
  </template>
68
70
 
69
71
  <script lang="ts">
@@ -125,6 +127,8 @@ import IconList from './IconList.vue'
125
127
  import IconLaunch from './IconLaunch.vue'
126
128
  import IconLevelUp from './IconLevelUp.vue'
127
129
  import IconLightbulb from './IconLightbulb.vue'
130
+ import IconChat from './IconChat.vue'
131
+ import IconPreview from './IconPreview.vue'
128
132
  import type { TIconType } from './icon'
129
133
 
130
134
  @Component({
@@ -186,6 +190,8 @@ import type { TIconType } from './icon'
186
190
  IconLaunch,
187
191
  IconLevelUp,
188
192
  IconLightbulb,
193
+ IconChat,
194
+ IconPreview,
189
195
  },
190
196
  })
191
197
  export default class Icon extends Vue {
@@ -0,0 +1,7 @@
1
+ ```vue
2
+ <template>
3
+ <div>
4
+ <Icon type="chat" />
5
+ </div>
6
+ </template>
7
+ ```
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <!-- eslint-disable -->
3
+ <svg width="26" height="24" viewBox="0 0 26 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4
+ <title>{{ title }}</title>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M1.75001 8.5C1.75001 7.27755 2.42412 6.10753 3.64023 5.21572C4.85589 4.32423 6.57164 3.75 8.50001 3.75C10.4284 3.75 12.1441 4.32423 13.3598 5.21572C14.4185 5.99209 15.0664 6.97931 15.2164 8.02842C15.4742 8.00962 15.7356 8 16 8C16.245 8 16.4874 8.00826 16.7268 8.02443C16.5685 6.40937 15.6128 5.00779 14.2468 4.00611C12.748 2.90699 10.7138 2.25 8.50001 2.25C6.28624 2.25 4.25198 2.90699 2.75318 4.00611C1.25483 5.1049 0.250006 6.68489 0.250006 8.5C0.250006 9.86533 0.819982 11.1006 1.74075 12.0955C1.53032 12.3132 1.28822 12.5421 1.00995 12.7823L0.0957642 13.5716L1.20857 14.041C2.75827 14.6948 4.19221 14.6652 5.38996 14.2938C6.2229 14.5491 7.12207 14.7043 8.06046 14.7413C8.02055 14.4984 8 14.251 8 14C8 13.7426 8.02161 13.489 8.06355 13.2401C7.19311 13.2006 6.37011 13.0439 5.6237 12.7937L5.37696 12.7109L5.132 12.7988C4.50107 13.0252 3.76711 13.1309 2.95171 12.9983C3.09984 12.8391 3.23614 12.6822 3.36133 12.5274L3.81754 11.9631L3.26858 11.4885C2.28708 10.64 1.75001 9.5932 1.75001 8.5Z" fill="currentColor"/>
6
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M21.9687 19.6781C21.3237 19.6332 20.7087 19.4233 20.1491 19.131C18.9393 19.6824 17.5191 20 16 20C11.5817 20 8 17.3137 8 14C8 10.6863 11.5817 8 16 8C20.4183 8 24 10.6863 24 14C24 15.3328 23.4206 16.5641 22.4403 17.56C22.5258 17.7312 22.6279 17.9166 22.7487 18.1186C22.9696 18.4877 23.253 18.912 23.6119 19.4057C23.0532 19.6398 22.5008 19.7151 21.9687 19.6781ZM24.2661 17.7161C25.0337 16.6469 25.5 15.3821 25.5 14C25.5 11.7652 24.2887 9.85625 22.5569 8.55736C20.8255 7.25882 18.5023 6.5 16 6.5C13.4977 6.5 11.1745 7.25882 9.44315 8.55736C7.71129 9.85625 6.5 11.7652 6.5 14C6.5 16.2348 7.71129 18.1438 9.44315 19.4426C11.1745 20.7412 13.4977 21.5 16 21.5C17.4667 21.5 18.8667 21.2397 20.121 20.7663C21.286 21.2276 22.7063 21.4114 24.1915 20.7892L25.9395 20.0568L24.8252 18.5238C24.6046 18.2203 24.4201 17.9526 24.2661 17.7161Z" fill="currentColor"/>
7
+ </svg>
8
+ <!-- eslint-enable -->
9
+ </template>
10
+
11
+ <script lang="ts">
12
+ import { Component, Vue, Prop } from 'vue-facing-decorator'
13
+
14
+ @Component
15
+ export default class IconChat extends Vue {
16
+ @Prop() title!: string
17
+ }
18
+ </script>
@@ -0,0 +1,7 @@
1
+ ```vue
2
+ <template>
3
+ <div>
4
+ <Icon type="preview" />
5
+ </div>
6
+ </template>
7
+ ```
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <!-- eslint-disable -->
3
+ <svg width="26" height="24" viewBox="0 0 26 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4
+ <title>{{ title }}</title>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M23 4.5H3C2.72386 4.5 2.5 4.72386 2.5 5V19C2.5 19.2761 2.72386 19.5 3 19.5H23C23.2761 19.5 23.5 19.2761 23.5 19V5C23.5 4.72386 23.2761 4.5 23 4.5ZM3 3C1.89543 3 1 3.89543 1 5V19C1 20.1046 1.89543 21 3 21H23C24.1046 21 25 20.1046 25 19V5C25 3.89543 24.1046 3 23 3H3Z" fill="currentColor"/>
6
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.26099 14.75C7.26099 14.3358 7.59677 14 8.01099 14H17.9892C18.4035 14 18.7392 14.3358 18.7392 14.75C18.7392 15.1642 18.4035 15.5 17.9892 15.5H8.01099C7.59677 15.5 7.26099 15.1642 7.26099 14.75ZM7.26099 17.25C7.26099 16.8358 7.59677 16.5 8.01099 16.5H17.9892C18.4035 16.5 18.7392 16.8358 18.7392 17.25C18.7392 17.6642 18.4035 18 17.9892 18H8.01099C7.59677 18 7.26099 17.6642 7.26099 17.25ZM8.01099 19C7.59677 19 7.26099 19.3358 7.26099 19.75C7.26099 20.1642 7.59677 20.5 8.01099 20.5H17.9892C18.4035 20.5 18.7392 20.1642 18.7392 19.75C18.7392 19.3358 18.4035 19 17.9892 19H8.01099Z" fill="currentColor"/>
7
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6.67383 8.5V10.5H19.326V8.5H6.67383ZM5.67383 7C5.39769 7 5.17383 7.22386 5.17383 7.5V11.5C5.17383 11.7761 5.39769 12 5.67383 12H20.326C20.6021 12 20.826 11.7761 20.826 11.5V7.5C20.826 7.22386 20.6021 7 20.326 7H5.67383Z" fill="currentColor"/>
8
+ </svg>
9
+ <!-- eslint-enable -->
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ import { Vue, Component, Prop } from 'vue-facing-decorator'
14
+
15
+ @Component
16
+ export default class IconPreview extends Vue {
17
+ @Prop() title!: string
18
+ }
19
+ </script>
@@ -55,4 +55,6 @@ export type TIconType =
55
55
  | 'review-flag'
56
56
  | 'launch'
57
57
  | 'levelup'
58
- | 'lightbulb'
58
+ | 'lightbulb'
59
+ | 'chat'
60
+ | 'preview'
@@ -12,7 +12,8 @@
12
12
  'uikit-email-auth__magic-code-entry--error': errorMessage,
13
13
  }"
14
14
  :error="errorMessage"
15
- @update:modelValue="magicCodeChange"
15
+ :modelValue="modelValue"
16
+ @update:modelValue="emitUpdateModelValue"
16
17
  @error="(err: string) => errorMessage = err"
17
18
  @submit="submitSignIn"
18
19
  />
@@ -25,8 +26,8 @@
25
26
  :class="{
26
27
  'uikit-email-auth__sign-in-btn--error': errorMessage,
27
28
  }"
28
- :disabled="code.length !== 6 || isLoading"
29
- :autofocus="code.length === 6"
29
+ :disabled="modelValue.length !== 6 || isLoading"
30
+ :autofocus="modelValue.length === 6"
30
31
  @click="submitSignIn"
31
32
  >
32
33
  Sign In
@@ -60,8 +61,8 @@ import MagicCodeEntry from '../Onboarding/MagicCodeEntry.vue'
60
61
  export default class EmailAuth extends Vue {
61
62
  @Prop({ default: '' }) parentError!: string
62
63
  @Prop() email!: string
64
+ @Prop({ default: '' }) modelValue!: string
63
65
 
64
- code = ''
65
66
  errorMessage = ''
66
67
  isLoading = false
67
68
  isResending = false
@@ -78,11 +79,11 @@ export default class EmailAuth extends Vue {
78
79
  this.isLoading = true
79
80
  this.errorMessage = ''
80
81
 
81
- if (this.email && this.code) {
82
- if (this.code.trim().length !== 6) {
82
+ if (this.email && this.modelValue) {
83
+ if (this.modelValue.trim().length !== 6) {
83
84
  this.errorMessage = 'Code must be six digits'
84
85
  } else {
85
- this.emitSubmit({ email: this.email, code: this.code })
86
+ this.emitSubmit({ email: this.email, code: this.modelValue })
86
87
  }
87
88
  }
88
89
 
@@ -96,11 +97,6 @@ export default class EmailAuth extends Vue {
96
97
  this.isResending = false
97
98
  }
98
99
 
99
- magicCodeChange (code: string) {
100
- this.code = code
101
- this.emitUpdateModelValue(code)
102
- }
103
-
104
100
  @Emit('submit')
105
101
  emitSubmit (results: { email: string; code: string}) {
106
102
  return results
@@ -10,12 +10,16 @@
10
10
  }"
11
11
  />
12
12
  <input
13
- v-model="code"
13
+ :value="modelValue"
14
+ @input="event => event.target
15
+ && 'value' in event.target
16
+ && emitUpdateModelValue(event.target.value as string)
17
+ "
14
18
  aria-label="Magic code input field"
15
19
  class="uikit-magic-code__code-input"
16
20
  type="text"
17
21
  maxlength="6"
18
- :autofocus="code.length !== 6"
22
+ :autofocus="modelValue.length !== 6"
19
23
  @focus="highlightInput = true"
20
24
  @blur="highlightInput = false"
21
25
  @click="handleClick"
@@ -25,15 +29,15 @@
25
29
  </template>
26
30
 
27
31
  <script lang="ts">
28
- import { Vue, Component, Watch, Prop, Emit } from 'vue-facing-decorator'
32
+ import { Vue, Component, Prop, Emit } from 'vue-facing-decorator'
29
33
 
30
34
  @Component
31
35
  export default class MagicCodeEntry extends Vue {
32
36
  @Prop({ default: false }) error!: boolean
37
+ @Prop({ default: '' }) modelValue!: string
33
38
 
34
39
  highlightInput = false
35
40
  cursorIndex = 0
36
- code = ''
37
41
 
38
42
  mounted () {
39
43
  // Ensure proper letter spacing for magic code in case of a11y browser extension overrides
@@ -65,18 +69,22 @@ export default class MagicCodeEntry extends Vue {
65
69
  }
66
70
 
67
71
  if (event.key.match(/[0-9]/)) {
68
- this.code = this.code.slice(0, this.cursorIndex) + event.key + this.code.slice(this.cursorIndex + 1)
72
+ const code = this.modelValue.slice(0, this.cursorIndex)
73
+ + event.key + this.modelValue.slice(this.cursorIndex + 1)
74
+ this.emitUpdateModelValue(code)
69
75
  this.cursorIndex = Math.min(this.cursorIndex + 1, 5)
70
76
  } else if (event.key === 'ArrowLeft') {
71
77
  this.cursorIndex = Math.max(this.cursorIndex - 1, 0)
72
78
  } else if (event.key === 'ArrowRight') {
73
79
  this.cursorIndex = Math.min(this.cursorIndex + 1, 5)
74
80
  } else if (event.key === 'Backspace') {
75
- if (this.code[this.cursorIndex]) {
76
- this.code = (this.code.slice(0, this.cursorIndex) + ' ' + this.code.slice(this.cursorIndex + 1))
77
- .trimRight()
81
+ if (this.modelValue[this.cursorIndex]) {
82
+ const code = (
83
+ this.modelValue.slice(0, this.cursorIndex) + ' ' + this.modelValue.slice(this.cursorIndex + 1)
84
+ ).trimEnd()
85
+ this.emitUpdateModelValue(code)
78
86
  }
79
- this.cursorIndex = Math.min(Math.max(this.cursorIndex - 1, 0), this.code.length)
87
+ this.cursorIndex = Math.min(Math.max(this.cursorIndex - 1, 0), this.modelValue.length)
80
88
  } else if (event.key === 'Enter') {
81
89
  this.emitSubmit()
82
90
  }
@@ -93,7 +101,7 @@ export default class MagicCodeEntry extends Vue {
93
101
  this.emitError('')
94
102
  const pasteValue = event.clipboardData?.getData('text')
95
103
  if (pasteValue && typeof Number(pasteValue) === 'number' && pasteValue.length === 6) {
96
- this.code = ''
104
+ this.emitUpdateModelValue('')
97
105
  this.cursorIndex = Math.min(pasteValue.length, 5)
98
106
  } else if (pasteValue) {
99
107
  this.emitError(`Invalid code: ${pasteValue}. Code must be six digits`)
@@ -101,11 +109,6 @@ export default class MagicCodeEntry extends Vue {
101
109
  }
102
110
  }
103
111
 
104
- @Watch('code')
105
- codeChanged (newVal: string) {
106
- this.emitUpdateModelValue(newVal)
107
- }
108
-
109
112
  @Emit('submit')
110
113
  emitSubmit () {
111
114
  return true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.0.17",
3
+ "version": "3.0.19",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {