@sbc-connect/nuxt-forms 0.5.0 → 0.6.0
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,18 @@
|
|
|
1
1
|
# @sbc-connect/nuxt-forms
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#137](https://github.com/bcgov/connect-nuxt/pull/137) [`9c10812`](https://github.com/bcgov/connect-nuxt/commit/9c10812d8ecde646eb185310376cabd3319a414d) Thanks [@deetz99](https://github.com/deetz99)! - ConnectFieldset and ConnectFormFieldWrapper: update padding to be configurable
|
|
8
|
+
|
|
9
|
+
- [#136](https://github.com/bcgov/connect-nuxt/pull/136) [`7e3a970`](https://github.com/bcgov/connect-nuxt/commit/7e3a9701ddd5304851c8d55c9fc940b2da656cbf) Thanks [@cameron-eyds](https://github.com/cameron-eyds)! - Misc typing and e2e test fixes
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`7e3a970`](https://github.com/bcgov/connect-nuxt/commit/7e3a9701ddd5304851c8d55c9fc940b2da656cbf)]:
|
|
14
|
+
- @sbc-connect/nuxt-base@0.7.0
|
|
15
|
+
|
|
3
16
|
## 0.5.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -3,7 +3,8 @@ import type { FormError } from '@nuxt/ui'
|
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
5
|
orientation = 'horizontal',
|
|
6
|
-
bodyVariant = 'none'
|
|
6
|
+
bodyVariant = 'none',
|
|
7
|
+
paddingClass = 'x-default'
|
|
7
8
|
} = defineProps<{
|
|
8
9
|
label?: string
|
|
9
10
|
description?: string
|
|
@@ -11,6 +12,7 @@ const {
|
|
|
11
12
|
showErrorMsg?: boolean
|
|
12
13
|
orientation?: 'vertical' | 'horizontal'
|
|
13
14
|
bodyVariant?: FieldsetBodyVariant
|
|
15
|
+
paddingClass?: 'x-default' | 'xy-default' | string
|
|
14
16
|
}>()
|
|
15
17
|
|
|
16
18
|
const id = useId()
|
|
@@ -19,17 +21,24 @@ const descriptionId = id + '-description'
|
|
|
19
21
|
|
|
20
22
|
const bodyClassMap: Record<FieldsetBodyVariant, string> = {
|
|
21
23
|
none: '',
|
|
22
|
-
card: '
|
|
24
|
+
card: 'bg-white rounded shadow-xs'
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
const bodyClass = bodyClassMap[bodyVariant]
|
|
28
|
+
|
|
29
|
+
const padding = paddingClass === 'x-default'
|
|
30
|
+
? 'px-4 sm:px-8'
|
|
31
|
+
: paddingClass === 'xy-default'
|
|
32
|
+
? 'py-6 px-4 sm:py-10 sm:px-8'
|
|
33
|
+
: paddingClass
|
|
26
34
|
</script>
|
|
27
35
|
|
|
28
36
|
<template>
|
|
29
37
|
<fieldset :aria-labelledby="legendId" :aria-describedby="descriptionId">
|
|
30
38
|
<div
|
|
31
39
|
:class="[
|
|
32
|
-
'
|
|
40
|
+
'flex gap-4 sm:gap-6',
|
|
41
|
+
bodyVariant === 'none' ? padding : '',
|
|
33
42
|
orientation === 'horizontal' ? 'flex-col sm:flex-row' : 'flex-col',
|
|
34
43
|
(error && bodyVariant === 'none') ? 'border-error border-l-3' : 'border-transparent border-l-3',
|
|
35
44
|
]"
|
|
@@ -65,10 +74,7 @@ const bodyClass = bodyClassMap[bodyVariant]
|
|
|
65
74
|
|
|
66
75
|
<div
|
|
67
76
|
class="flex-1"
|
|
68
|
-
:class="
|
|
69
|
-
bodyClass,
|
|
70
|
-
(error && bodyVariant === 'card') ? 'border-error border-l-3' : 'border-transparent border-l-3',
|
|
71
|
-
]"
|
|
77
|
+
:class="bodyClass"
|
|
72
78
|
>
|
|
73
79
|
<slot />
|
|
74
80
|
</div>
|
|
@@ -2,19 +2,28 @@
|
|
|
2
2
|
import type { FormError } from '@nuxt/ui'
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
|
-
orientation = 'horizontal'
|
|
5
|
+
orientation = 'horizontal',
|
|
6
|
+
paddingClass = 'x-default'
|
|
6
7
|
} = defineProps<{
|
|
7
8
|
label: string
|
|
8
9
|
error?: FormError | boolean
|
|
9
10
|
showErrorMsg?: boolean
|
|
10
11
|
orientation?: 'vertical' | 'horizontal'
|
|
12
|
+
paddingClass?: 'x-default' | 'xy-default' | string
|
|
11
13
|
}>()
|
|
14
|
+
|
|
15
|
+
const padding = paddingClass === 'x-default'
|
|
16
|
+
? 'px-4 sm:px-8'
|
|
17
|
+
: paddingClass === 'xy-default'
|
|
18
|
+
? 'py-6 px-4 sm:py-10 sm:px-8'
|
|
19
|
+
: paddingClass
|
|
12
20
|
</script>
|
|
13
21
|
|
|
14
22
|
<template>
|
|
15
23
|
<div
|
|
16
24
|
:class="[
|
|
17
|
-
'
|
|
25
|
+
'flex gap-4 sm:gap-6',
|
|
26
|
+
padding,
|
|
18
27
|
orientation === 'horizontal' ? 'flex-col sm:flex-row' : 'flex-col',
|
|
19
28
|
error ? 'border-error border-l-3' : 'border-transparent border-l-3',
|
|
20
29
|
]"
|
|
@@ -40,13 +40,17 @@ const _countryListOptions = countryList.customList(
|
|
|
40
40
|
'countryCode', '{countryCallingCode},{countryNameEn},{countryNameLocal}')
|
|
41
41
|
|
|
42
42
|
const manualInput = (event: Event) => {
|
|
43
|
+
const target = event.target as HTMLInputElement
|
|
43
44
|
selectedCountry.value = {
|
|
44
|
-
callingCode:
|
|
45
|
+
callingCode: target.value
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
const countryListOptions: Array<PhoneCountry> = Object.keys(_countryListOptions).map((key) => {
|
|
49
|
-
const
|
|
50
|
+
const parts = (_countryListOptions[key] ?? '').split(',')
|
|
51
|
+
const callingCode = parts[0] ?? ''
|
|
52
|
+
const nameEn = parts[1]
|
|
53
|
+
const nameLocal = parts[2]
|
|
50
54
|
return {
|
|
51
55
|
iso2: key,
|
|
52
56
|
callingCode,
|
|
@@ -90,9 +94,9 @@ onMounted(() => {
|
|
|
90
94
|
<UInputMenu
|
|
91
95
|
v-model="selectedCountry"
|
|
92
96
|
:items="countryListOptions"
|
|
93
|
-
:color="selectedCountry?.callingCode ? 'primary' :
|
|
97
|
+
:color="selectedCountry?.callingCode ? 'primary' : undefined"
|
|
94
98
|
:search="search"
|
|
95
|
-
:label-key="
|
|
99
|
+
:label-key="undefined"
|
|
96
100
|
:trailing-icon="'i-mdi-chevron-down'"
|
|
97
101
|
class="cursor-pointer"
|
|
98
102
|
:aria-required="true"
|
|
@@ -106,18 +110,18 @@ onMounted(() => {
|
|
|
106
110
|
:tooltip-text="selectedCountry?.nameEn"
|
|
107
111
|
:country-code-iso2letter="selectedCountry?.iso2"
|
|
108
112
|
/>
|
|
109
|
-
<span class="ml-2 mt-2 truncate">{{ modelValue
|
|
113
|
+
<span class="ml-2 mt-2 truncate">{{ (modelValue as PhoneCountry)?.label }}</span>
|
|
110
114
|
</div>
|
|
111
115
|
</template>
|
|
112
116
|
|
|
113
117
|
<template #item="{ item }">
|
|
114
|
-
<div class="flex items-end cursor-pointer">
|
|
118
|
+
<div v-if="item" class="flex items-end cursor-pointer">
|
|
115
119
|
<CountryFlag
|
|
116
|
-
:tooltip-text="item.nameLocal"
|
|
117
|
-
:country-code-iso2letter="item.iso2"
|
|
120
|
+
:tooltip-text="(item as PhoneCountry).nameLocal"
|
|
121
|
+
:country-code-iso2letter="(item as PhoneCountry).iso2 ?? ''"
|
|
118
122
|
/>
|
|
119
|
-
<span class="ml-2 truncate">{{ item.label }}</span>
|
|
120
|
-
<span class="sr-only">{{ item.nameLocal }}</span>
|
|
123
|
+
<span class="ml-2 truncate">{{ (item as PhoneCountry).label }}</span>
|
|
124
|
+
<span class="sr-only">{{ (item as PhoneCountry).nameLocal }}</span>
|
|
121
125
|
</div>
|
|
122
126
|
</template>
|
|
123
127
|
</UInputMenu>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbc-connect/nuxt-forms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"repository": "github:bcgov/connect-nuxt",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"country-codes-list": "2.0.0",
|
|
20
20
|
"vue-country-flag-next": "2.3.2",
|
|
21
|
-
"@sbc-connect/nuxt-base": "0.
|
|
21
|
+
"@sbc-connect/nuxt-base": "0.7.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"preinstall": "npx only-allow pnpm",
|