@pocketprep/ui-kit 3.4.31 → 3.4.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.
@@ -78,6 +78,7 @@
78
78
  @click="showDropdown = true"
79
79
  >
80
80
  <Icon
81
+ v-if="!dropdownOverride"
81
82
  v-dark="isDarkMode"
82
83
  type="accordionArrow"
83
84
  class="uikit-select__arrow"
@@ -88,6 +89,13 @@
88
89
  }"
89
90
  @click="showDropdown = true"
90
91
  />
92
+ <Icon
93
+ v-else
94
+ v-dark="isDarkMode"
95
+ type="close"
96
+ class="uikit-select__x"
97
+ @click="performCloseActions"
98
+ />
91
99
  <ul
92
100
  v-show="showDropdown && !disabled"
93
101
  ref="menu"
@@ -169,6 +177,8 @@ export default class Select extends Vue {
169
177
  @Prop() error?: boolean
170
178
  @Prop() openMenuAbove?: boolean
171
179
  @Prop({ default: false }) isDarkMode!: boolean
180
+ @Prop({ default: false }) dropdownOverride!: boolean
181
+ // Can override the icon to be an X instead
172
182
 
173
183
  hover = false
174
184
  focus = false
@@ -224,7 +234,7 @@ export default class Select extends Vue {
224
234
  if (this.typeahead && !this.searchText) {
225
235
  this.emitUpdateModelValue(null)
226
236
  }
227
- if (this.typeahead && this.searchText && this.filteredData.length < 1) {
237
+ if (this.typeahead && this.searchText && this.filteredData.length < 1 && !this.dropdownOverride) {
228
238
  this.emitUpdateModelValue(null)
229
239
  this.searchText = ''
230
240
  } else if (this.typeahead && this.searchText && this.filteredData[0]) {
@@ -371,6 +381,14 @@ export default class Select extends Vue {
371
381
  }
372
382
  }
373
383
 
384
+ performCloseActions () {
385
+ /**
386
+ * If the dropdown is showing an X, there is some logic we need...
387
+ * The first time, it should clear out search text -- the second time it should collapse dropdown
388
+ * */
389
+ this.searchText ? this.searchText = '' : this.showDropdown = false
390
+ }
391
+
374
392
  @Watch('showDropdown')
375
393
  showDropdownChanged (newVal: boolean) {
376
394
  this.emitOpenDropdown(newVal)
@@ -607,6 +625,23 @@ export default class Select extends Vue {
607
625
  }
608
626
  }
609
627
 
628
+ &__x {
629
+ position: absolute;
630
+ right: 13px;
631
+ top: 8px;
632
+ color: $steel;
633
+ z-index: 1;
634
+
635
+ &:hover {
636
+ color: $red-pegasus;
637
+ cursor: pointer;
638
+ }
639
+
640
+ &:focus {
641
+ color: $red-pegasus;
642
+ }
643
+ }
644
+
610
645
  &__list {
611
646
  box-shadow: 0 4px 12px 0 rgba($brand-black, 0.1);
612
647
  margin: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.31",
3
+ "version": "3.4.32",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {