@sbc-connect/nuxt-forms 0.4.1 → 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,24 @@
|
|
|
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
|
+
|
|
16
|
+
## 0.5.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [#129](https://github.com/bcgov/connect-nuxt/pull/129) [`93c5650`](https://github.com/bcgov/connect-nuxt/commit/93c5650be9a6b48e51d876d522f168d885d006c4) Thanks [@deetz99](https://github.com/deetz99)! - ConnectFieldset and ConnectFormFieldWrapper: Update error styling to be border only, remove title error styling, add padding to body, make orientation horizontal by default.
|
|
21
|
+
|
|
3
22
|
## 0.4.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
import type { FormError } from '@nuxt/ui'
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
|
-
orientation = '
|
|
6
|
-
bodyVariant = 'none'
|
|
5
|
+
orientation = 'horizontal',
|
|
6
|
+
bodyVariant = 'none',
|
|
7
|
+
paddingClass = 'x-default'
|
|
7
8
|
} = defineProps<{
|
|
8
9
|
label?: string
|
|
9
10
|
description?: string
|
|
10
|
-
error?: FormError
|
|
11
|
+
error?: FormError | boolean
|
|
11
12
|
showErrorMsg?: boolean
|
|
12
13
|
orientation?: 'vertical' | 'horizontal'
|
|
13
14
|
bodyVariant?: FieldsetBodyVariant
|
|
15
|
+
paddingClass?: 'x-default' | 'xy-default' | string
|
|
14
16
|
}>()
|
|
15
|
-
// TODO: figure out why text-error doesnt work on the legend text
|
|
16
17
|
|
|
17
18
|
const id = useId()
|
|
18
19
|
const legendId = id + '-legend'
|
|
@@ -20,17 +21,27 @@ const descriptionId = id + '-description'
|
|
|
20
21
|
|
|
21
22
|
const bodyClassMap: Record<FieldsetBodyVariant, string> = {
|
|
22
23
|
none: '',
|
|
23
|
-
card: '
|
|
24
|
+
card: 'bg-white rounded shadow-xs'
|
|
24
25
|
}
|
|
25
26
|
|
|
26
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
|
|
27
34
|
</script>
|
|
28
35
|
|
|
29
36
|
<template>
|
|
30
37
|
<fieldset :aria-labelledby="legendId" :aria-describedby="descriptionId">
|
|
31
38
|
<div
|
|
32
|
-
class="
|
|
33
|
-
|
|
39
|
+
:class="[
|
|
40
|
+
'flex gap-4 sm:gap-6',
|
|
41
|
+
bodyVariant === 'none' ? padding : '',
|
|
42
|
+
orientation === 'horizontal' ? 'flex-col sm:flex-row' : 'flex-col',
|
|
43
|
+
(error && bodyVariant === 'none') ? 'border-error border-l-3' : 'border-transparent border-l-3',
|
|
44
|
+
]"
|
|
34
45
|
>
|
|
35
46
|
<div
|
|
36
47
|
class="flex flex-col gap-1"
|
|
@@ -41,14 +52,11 @@ const bodyClass = bodyClassMap[bodyVariant]
|
|
|
41
52
|
class="text-base text-neutral-highlighted font-bold"
|
|
42
53
|
>
|
|
43
54
|
<slot name="label">
|
|
44
|
-
<div
|
|
45
|
-
class="flex flex-wrap gap-4"
|
|
46
|
-
:class="[{ 'text-red-600': !!error }]"
|
|
47
|
-
>
|
|
55
|
+
<div class="flex flex-wrap gap-4">
|
|
48
56
|
<span>{{ label }}</span>
|
|
49
57
|
<span
|
|
50
|
-
v-if="
|
|
51
|
-
class="font-normal"
|
|
58
|
+
v-if="error && typeof error === 'object' && 'message' in error && showErrorMsg"
|
|
59
|
+
class="font-normal text-error"
|
|
52
60
|
>
|
|
53
61
|
{{ error.message }}
|
|
54
62
|
</span>
|
|
@@ -2,34 +2,42 @@
|
|
|
2
2
|
import type { FormError } from '@nuxt/ui'
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
|
-
orientation = '
|
|
5
|
+
orientation = 'horizontal',
|
|
6
|
+
paddingClass = 'x-default'
|
|
6
7
|
} = defineProps<{
|
|
7
8
|
label: string
|
|
8
|
-
error?: FormError
|
|
9
|
+
error?: FormError | boolean
|
|
9
10
|
showErrorMsg?: boolean
|
|
10
11
|
orientation?: 'vertical' | 'horizontal'
|
|
12
|
+
paddingClass?: 'x-default' | 'xy-default' | string
|
|
11
13
|
}>()
|
|
12
|
-
|
|
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
|
|
13
20
|
</script>
|
|
14
21
|
|
|
15
22
|
<template>
|
|
16
23
|
<div
|
|
17
|
-
class="
|
|
18
|
-
|
|
24
|
+
:class="[
|
|
25
|
+
'flex gap-4 sm:gap-6',
|
|
26
|
+
padding,
|
|
27
|
+
orientation === 'horizontal' ? 'flex-col sm:flex-row' : 'flex-col',
|
|
28
|
+
error ? 'border-error border-l-3' : 'border-transparent border-l-3',
|
|
29
|
+
]"
|
|
19
30
|
>
|
|
20
31
|
<span
|
|
21
32
|
aria-hidden="true"
|
|
22
33
|
class="text-base text-neutral-highlighted font-bold"
|
|
23
34
|
:class="{ 'w-full sm:basis-1/4': orientation === 'horizontal' }"
|
|
24
35
|
>
|
|
25
|
-
<div
|
|
26
|
-
class="flex flex-wrap gap-4"
|
|
27
|
-
:class="{ 'text-red-600': !!error }"
|
|
28
|
-
>
|
|
36
|
+
<div class="flex gap-2.5" :class="orientation === 'horizontal' ? 'flex-col' : 'flex-wrap'">
|
|
29
37
|
<span>{{ label }}</span>
|
|
30
38
|
<span
|
|
31
|
-
v-if="
|
|
32
|
-
class="font-normal"
|
|
39
|
+
v-if="error && typeof error === 'object' && 'message' in error && showErrorMsg"
|
|
40
|
+
class="font-normal text-error"
|
|
33
41
|
>
|
|
34
42
|
{{ error.message }}
|
|
35
43
|
</span>
|
|
@@ -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",
|