@sbc-connect/nuxt-forms 0.1.29 → 0.1.31

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,20 @@
1
1
  # @sbc-connect/nuxt-forms
2
2
 
3
+ ## 0.1.31
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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.
8
+
9
+ ## 0.1.30
10
+
11
+ ### Patch Changes
12
+
13
+ - [#90](https://github.com/bcgov/connect-nuxt/pull/90) [`b66923e`](https://github.com/bcgov/connect-nuxt/commit/b66923e94a2c8a7aa936b7e371e727be73d90ea7) Thanks [@kialj876](https://github.com/kialj876)! - Base tombstone - bug fix
14
+
15
+ - Updated dependencies [[`b66923e`](https://github.com/bcgov/connect-nuxt/commit/b66923e94a2c8a7aa936b7e371e727be73d90ea7)]:
16
+ - @sbc-connect/nuxt-base@0.1.28
17
+
3
18
  ## 0.1.29
4
19
 
5
20
  ### 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: string
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 legendId = useId()
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
- <legend
24
- :id="legendId"
25
- class="text-base text-neutral-highlighted font-bold"
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
- <div class="flex flex-wrap gap-4">
32
- <span>{{ label }}</span>
33
- <span
34
- v-if="!!error && showErrorMsg"
35
- class="font-normal"
36
- >
37
- {{ error.message }}
38
- </span>
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
- </legend>
63
+ </div>
41
64
 
42
- <div class="flex-1">
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.29",
4
+ "version": "0.1.31",
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/eslint-config": "0.0.8"
18
18
  },
19
19
  "dependencies": {
20
- "@sbc-connect/nuxt-base": "0.1.27"
20
+ "@sbc-connect/nuxt-base": "0.1.28"
21
21
  },
22
22
  "scripts": {
23
23
  "preinstall": "npx only-allow pnpm",