@sbc-connect/nuxt-forms 0.1.30 → 0.1.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.
- package/CHANGELOG.md +13 -0
- package/app/components/Connect/Fieldset.vue +47 -21
- package/app/types/connect-fieldset.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @sbc-connect/nuxt-forms
|
|
2
2
|
|
|
3
|
+
## 0.1.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`a0724ac`](https://github.com/bcgov/connect-nuxt/commit/a0724ac5fdf44296e822942b0eea6be3bb313fcb)]:
|
|
8
|
+
- @sbc-connect/nuxt-base@0.1.29
|
|
9
|
+
|
|
10
|
+
## 0.1.31
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#92](https://github.com/bcgov/connect-nuxt/pull/92) [`c80a32a`](https://github.com/bcgov/connect-nuxt/commit/c80a32a8781894ee29ade5dc8c47f9e26d52b8b4) Thanks [@deetz99](https://github.com/deetz99)! - feat: ConnectFieldset - Add description and body variant props. Add label and description slots.
|
|
15
|
+
|
|
3
16
|
## 0.1.30
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -2,44 +2,70 @@
|
|
|
2
2
|
import type { FormError } from '@nuxt/ui'
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
|
-
orientation = 'vertical'
|
|
5
|
+
orientation = 'vertical',
|
|
6
|
+
bodyVariant = 'none'
|
|
6
7
|
} = defineProps<{
|
|
7
|
-
label
|
|
8
|
+
label?: string
|
|
9
|
+
description?: string
|
|
8
10
|
error?: FormError
|
|
9
11
|
showErrorMsg?: boolean
|
|
10
12
|
orientation?: 'vertical' | 'horizontal'
|
|
13
|
+
bodyVariant?: FieldsetBodyVariant
|
|
11
14
|
}>()
|
|
12
15
|
// TODO: figure out why text-error doesnt work on the legend text
|
|
13
16
|
|
|
14
|
-
const
|
|
17
|
+
const id = useId()
|
|
18
|
+
const legendId = id + '-legend'
|
|
19
|
+
const descriptionId = id + '-description'
|
|
20
|
+
|
|
21
|
+
const bodyClassMap: Record<FieldsetBodyVariant, string> = {
|
|
22
|
+
none: '',
|
|
23
|
+
card: 'p-4 sm:p-6 bg-white rounded shadow-xs'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const bodyClass = bodyClassMap[bodyVariant]
|
|
15
27
|
</script>
|
|
16
28
|
|
|
17
29
|
<template>
|
|
18
|
-
<fieldset :aria-labelledby="legendId">
|
|
30
|
+
<fieldset :aria-labelledby="legendId" :aria-describedby="descriptionId">
|
|
19
31
|
<div
|
|
20
32
|
class="flex"
|
|
21
33
|
:class="[orientation === 'horizontal' ? 'flex-col gap-6 sm:flex-row sm:gap-4' : 'flex-col gap-6']"
|
|
22
34
|
>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
class="
|
|
26
|
-
:class="[
|
|
27
|
-
{ 'text-red-600': !!error },
|
|
28
|
-
{ 'w-full sm:w-1/4 pb-0': orientation === 'horizontal' },
|
|
29
|
-
]"
|
|
35
|
+
<div
|
|
36
|
+
class="flex flex-col gap-1"
|
|
37
|
+
:class="{ 'w-full sm:w-1/4 pb-0': orientation === 'horizontal' }"
|
|
30
38
|
>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
<legend
|
|
40
|
+
:id="legendId"
|
|
41
|
+
class="text-base text-neutral-highlighted font-bold"
|
|
42
|
+
:class="[{ 'text-red-600': !!error }]"
|
|
43
|
+
>
|
|
44
|
+
<slot name="label">
|
|
45
|
+
<div class="flex flex-wrap gap-4">
|
|
46
|
+
<span>{{ label }}</span>
|
|
47
|
+
<span
|
|
48
|
+
v-if="!!error && showErrorMsg"
|
|
49
|
+
class="font-normal"
|
|
50
|
+
>
|
|
51
|
+
{{ error.message }}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
</slot>
|
|
55
|
+
</legend>
|
|
56
|
+
<div v-if="description || $slots.description" id="descriptionId">
|
|
57
|
+
<slot name="description">
|
|
58
|
+
<p>
|
|
59
|
+
{{ description }}
|
|
60
|
+
</p>
|
|
61
|
+
</slot>
|
|
39
62
|
</div>
|
|
40
|
-
</
|
|
63
|
+
</div>
|
|
41
64
|
|
|
42
|
-
<div
|
|
65
|
+
<div
|
|
66
|
+
class="flex-1"
|
|
67
|
+
:class="bodyClass"
|
|
68
|
+
>
|
|
43
69
|
<slot />
|
|
44
70
|
</div>
|
|
45
71
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FieldsetBodyVariant = 'card' | 'none'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbc-connect/nuxt-forms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.32",
|
|
5
5
|
"repository": "github:bcgov/connect-nuxt",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@sbc-connect/vitest-config": "0.0.6"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@sbc-connect/nuxt-base": "0.1.
|
|
20
|
+
"@sbc-connect/nuxt-base": "0.1.29"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"preinstall": "npx only-allow pnpm",
|