@sbc-connect/nuxt-forms 0.8.0 → 0.8.1

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
@@ -1,5 +1,11 @@
1
1
  # @sbc-connect/nuxt-forms
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#204](https://github.com/bcgov/connect-nuxt/pull/204) [`a6c655c`](https://github.com/bcgov/connect-nuxt/commit/a6c655c177798565b04ffc0fe76b308d4841c9e5) Thanks [@eve-git](https://github.com/eve-git)! - Country dropdown: keep Canada and United States pinned at the top and also list them in their alphabetical position; search results show each only once.
8
+
3
9
  ## 0.8.0
4
10
 
5
11
  ### Minor Changes
@@ -43,11 +43,13 @@ function matchesWordStart(text: string, search: string): boolean {
43
43
  // anything at runtime - the separator object itself stays `{ type: 'separator' }`.
44
44
  type CountryOption = Iso3166_1Country | (Partial<Iso3166_1Country> & { type: 'separator' })
45
45
 
46
+ // CA and US are pinned to the top for convenience, but also stay in their
47
+ // alphabetical position in the full list below the separator.
46
48
  const options: Array<CountryOption> = [
47
49
  countries.find(c => c.alpha_2 === 'CA')!,
48
50
  countries.find(c => c.alpha_2 === 'US')!,
49
51
  { type: 'separator' },
50
- ...countries.filter(c => c.alpha_2 !== 'CA' && c.alpha_2 !== 'US')
52
+ ...countries
51
53
  ]
52
54
 
53
55
  const searchTerm = ref('')
@@ -56,12 +58,8 @@ const filteredItems = computed(() => {
56
58
  if (!searchTerm.value.trim()) {
57
59
  return options
58
60
  }
59
- return options.filter((item) => {
60
- if ('type' in item) {
61
- return false
62
- }
63
- return matchesWordStart(item.name, searchTerm.value)
64
- })
61
+ // Search the full list (not `options`) so pinned countries only appear once
62
+ return countries.filter(item => matchesWordStart(item.name, searchTerm.value))
65
63
  })
66
64
  </script>
67
65
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-forms",
3
3
  "type": "module",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "github:bcgov/connect-nuxt"