@pocketprep/ui-kit 3.4.49 → 3.4.51

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.
@@ -23,9 +23,13 @@
23
23
  :is-dark-mode="isDarkMode"
24
24
  :has-label="true"
25
25
  />
26
- <label :id="checkboxId" class="uikit-checkbox-option__label">
27
- {{ label }}
28
- </label>
26
+ <slot name="label">
27
+ <label :id="checkboxId" class="uikit-checkbox-option__label">
28
+ <slot name="labelContent">
29
+ {{ label }}
30
+ </slot>
31
+ </label>
32
+ </slot>
29
33
  </div>
30
34
  </template>
31
35
 
@@ -69,6 +69,7 @@
69
69
  'uikit-select__input--focus': focus,
70
70
  'uikit-select__input--disabled': disabled,
71
71
  'uikit-select__input--show-dropdown': showDropdown,
72
+ 'uikit-select__input--show-text-clear': showTypeaheadClear,
72
73
  }"
73
74
  :placeholder="placeholder"
74
75
  :aria-label="label"
@@ -77,6 +78,17 @@
77
78
  @keydown.stop="keyPressedContainer"
78
79
  @click="showDropdown = true"
79
80
  >
81
+ <Icon
82
+ v-if="dropdownOverride || (showTypeaheadClear && searchText)"
83
+ v-dark="isDarkMode"
84
+ type="close"
85
+ class="uikit-select__x"
86
+ :class="{
87
+ 'uikit-select__x--with-arrow': !dropdownOverride,
88
+ }"
89
+ @mousedown.prevent
90
+ @click="performCloseActions"
91
+ />
80
92
  <Icon
81
93
  v-if="!dropdownOverride"
82
94
  v-dark="isDarkMode"
@@ -87,14 +99,8 @@
87
99
  'uikit-select__arrow--focus': focus,
88
100
  'uikit-select__arrow--show-dropdown': showDropdown,
89
101
  }"
90
- @click="showDropdown = true"
91
- />
92
- <Icon
93
- v-else
94
- v-dark="isDarkMode"
95
- type="close"
96
- class="uikit-select__x"
97
- @click="performCloseActions"
102
+ @mousedown.prevent
103
+ @click="showDropdown = !showDropdown"
98
104
  />
99
105
  <ul
100
106
  v-show="showDropdown && !disabled"
@@ -106,6 +112,7 @@
106
112
  'uikit-select__list--subtext': subtext,
107
113
  }"
108
114
  >
115
+ <slot name="dropdownListHeader" />
109
116
  <slot name="dropdownList">
110
117
  <li
111
118
  v-for="item in filteredData"
@@ -177,8 +184,8 @@ export default class Select extends Vue {
177
184
  @Prop() error?: boolean
178
185
  @Prop() openMenuAbove?: boolean
179
186
  @Prop({ default: false }) isDarkMode!: boolean
180
- @Prop({ default: false }) dropdownOverride!: boolean
181
- // Can override the icon to be an X instead
187
+ @Prop({ default: false }) dropdownOverride!: boolean // Can override the icon to be an X instead
188
+ @Prop({ default: false }) showTypeaheadClear!: boolean
182
189
 
183
190
  hover = false
184
191
  focus = false
@@ -233,11 +240,10 @@ export default class Select extends Vue {
233
240
 
234
241
  if (this.typeahead && !this.searchText) {
235
242
  this.emitUpdateModelValue(null)
236
- }
237
- if (this.typeahead && this.searchText && this.filteredData.length < 1 && !this.dropdownOverride) {
243
+ } else if (this.typeahead && this.searchText && this.filteredData.length < 1 && !this.dropdownOverride) {
238
244
  this.emitUpdateModelValue(null)
239
245
  this.searchText = ''
240
- } else if (this.typeahead && this.searchText && this.filteredData[0]) {
246
+ } else if (this.typeahead && this.searchText && this.filteredData.length === 1 && this.filteredData[0]) {
241
247
  this.emitUpdateModelValue(this.filteredData[0])
242
248
  }
243
249
  }
@@ -386,7 +392,12 @@ export default class Select extends Vue {
386
392
  * If the dropdown is showing an X, there is some logic we need...
387
393
  * The first time, it should clear out search text -- the second time it should collapse dropdown
388
394
  * */
389
- this.searchText ? this.searchText = '' : this.showDropdown = false
395
+ if (this.searchText) {
396
+ this.emitUpdateModelValue(null)
397
+ this.searchText = ''
398
+ } else {
399
+ this.showDropdown = false
400
+ }
390
401
  }
391
402
 
392
403
  @Watch('showDropdown')
@@ -543,6 +554,10 @@ export default class Select extends Vue {
543
554
  cursor: text !important;
544
555
  padding-right: 32px;
545
556
 
557
+ &--show-text-clear {
558
+ padding-right: 60px;
559
+ }
560
+
546
561
  &--error {
547
562
  border: 1px solid $red-pegasus;
548
563
  }
@@ -632,6 +647,10 @@ export default class Select extends Vue {
632
647
  color: $steel;
633
648
  z-index: 1;
634
649
 
650
+ &--with-arrow {
651
+ right: 34px;
652
+ }
653
+
635
654
  &:hover {
636
655
  color: $brand-blue;
637
656
  cursor: pointer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.49",
3
+ "version": "3.4.51",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {