@sbc-connect/nuxt-base 0.1.24 → 0.1.26

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,21 @@
1
1
  # @sbc-connect/nuxt-base
2
2
 
3
+ ## 0.1.26
4
+
5
+ ### Patch Changes
6
+
7
+ - [#86](https://github.com/bcgov/connect-nuxt/pull/86) [`c1fb4f2`](https://github.com/bcgov/connect-nuxt/commit/c1fb4f2a217b3d57e7ea7aed8b9773e215a21978) Thanks [@deetz99](https://github.com/deetz99)! - feat: v-sanitize directive.
8
+
9
+ ## 0.1.25
10
+
11
+ ### Patch Changes
12
+
13
+ - [#84](https://github.com/bcgov/connect-nuxt/pull/84) [`f37700a`](https://github.com/bcgov/connect-nuxt/commit/f37700ab568335df724a5e9472a5e0b4198704b5) Thanks [@deetz99](https://github.com/deetz99)! - Add generic Select component with floating label. Update textarea v-model type.
14
+
15
+ - [#85](https://github.com/bcgov/connect-nuxt/pull/85) [`6b0f70a`](https://github.com/bcgov/connect-nuxt/commit/6b0f70ab895a26c0b049dce84b130d6a04fd911e) Thanks [@kialj876](https://github.com/kialj876)! - Common layout updates, default state key for tombstone, fee store - waive fees, add prioirty, expose cached fees
16
+
17
+ - [#82](https://github.com/bcgov/connect-nuxt/pull/82) [`ba04c84`](https://github.com/bcgov/connect-nuxt/commit/ba04c8424353b32af0811534d9c3edd31e15d39e) Thanks [@deetz99](https://github.com/deetz99)! - feat: Create floating label wrapper component.
18
+
3
19
  ## 0.1.24
4
20
 
5
21
  ### Patch Changes
package/app/app.config.ts CHANGED
@@ -277,7 +277,34 @@ export default defineAppConfig({
277
277
  input: {
278
278
  variants: {
279
279
  size: {
280
- bcGovLg: {
280
+ bcGov: {
281
+ base: 'px-2.5 pb-2 pt-6 text-base gap-1.5',
282
+ leading: 'ps-2.5',
283
+ trailing: 'pe-2.5',
284
+ leadingIcon: 'size-5',
285
+ leadingAvatarSize: '2xs',
286
+ trailingIcon: 'size-5'
287
+ }
288
+ },
289
+ variant: {
290
+ bcGov: 'ring-0 ring-transparent peer rounded-t-sm rounded-b-none bg-shade shadow-input focus:ring-0 focus:outline-none focus:shadow-input-focus text-neutral-highlighted aria-invalid:shadow-input-error aria-invalid:focus:shadow-input-error aria-invalid:ring-0'
291
+ }
292
+ },
293
+ defaultVariants: {
294
+ size: 'bcGov',
295
+ color: 'primary',
296
+ variant: 'bcGov'
297
+ }
298
+ },
299
+ inputMenu: {
300
+ slots: {
301
+ group: 'p-0',
302
+ item: 'py-3 px-4 data-highlighted:not-data-disabled:text-primary data-highlighted:not-data-disabled:before:bg-shade my-0.75 before:rounded-none',
303
+ trailingIcon: 'delay-50 group-data-[state=open]:rotate-180 transition-transform duration-200 text-(--ui-text) group-focus-visible:text-primary group-data-[state=open]:text-primary group-has-[[aria-invalid=true]]:text-error!'
304
+ },
305
+ variants: {
306
+ size: {
307
+ bcGov: {
281
308
  base: 'px-2.5 pb-2 pt-6 text-base gap-1.5',
282
309
  leading: 'ps-2.5',
283
310
  trailing: 'pe-2.5',
@@ -291,7 +318,7 @@ export default defineAppConfig({
291
318
  }
292
319
  },
293
320
  defaultVariants: {
294
- size: 'bcGovLg',
321
+ size: 'bcGov',
295
322
  color: 'primary',
296
323
  variant: 'bcGov'
297
324
  }
@@ -300,17 +327,55 @@ export default defineAppConfig({
300
327
  base: 'bg-gray-200'
301
328
  },
302
329
  select: {
330
+ slots: {
331
+ base: 'ring-0',
332
+ content: 'rounded-sm',
333
+ group: 'px-0 py-2',
334
+ trailingIcon: 'delay-50 group-data-[state=open]:rotate-180 transition-transform duration-200 text-(--ui-text) group-focus-visible:text-primary group-data-[state=open]:text-primary group-has-[[aria-invalid=true]]:text-error!',
335
+ item: 'my-0.75 text-neutral-highlighted before:rounded-none data-highlighted:not-data-disabled:text-primary data-highlighted:not-data-disabled:before:bg-shade data-[state=checked]:text-primary data-[state=checked]:bg-blue-50',
336
+ itemLeadingIcon: 'group-data-[state=checked]:text-primary group-data-highlighted:not-data-disabled:text-primary text-neutral-highlighted',
337
+ itemTrailingIcon: 'hidden'
338
+ },
339
+ variants: {
340
+ size: {
341
+ bcGov: {
342
+ base: 'px-2.5 pb-2 pt-6 text-base gap-1.5',
343
+ leading: 'ps-2.5',
344
+ trailing: 'pe-2.5',
345
+ leadingIcon: 'size-5',
346
+ leadingAvatarSize: '2xs',
347
+ trailingIcon: 'size-5',
348
+ label: 'p-1.5 text-xs gap-1.5',
349
+ item: 'py-3 px-4 text-sm gap-3',
350
+ itemLeadingIcon: 'size-5',
351
+ itemLeadingAvatarSize: '2xs',
352
+ itemLeadingChip: 'size-5',
353
+ itemLeadingChipSize: 'md',
354
+ itemTrailingIcon: 'size-5'
355
+ }
356
+ },
357
+ variant: {
358
+ bcGov: 'peer ring-0! rounded-t-sm rounded-b-none bg-shade focus:ring-0 focus:outline-none shadow-input shadow-input focus-visible:shadow-input-focus data-[state=open]:shadow-input-focus text-neutral-highlighted aria-[invalid=true]:shadow-input-error! delay-50'
359
+ }
360
+ },
361
+ defaultVariants: {
362
+ size: 'bcGov',
363
+ color: 'primary',
364
+ variant: 'bcGov'
365
+ }
366
+ },
367
+ selectMenu: {
303
368
  slots: {
304
369
  content: 'rounded-sm',
305
370
  group: 'px-0 py-2',
306
- trailingIcon: 'group-data-[state=open]:rotate-180 transition-transform duration-200 text-(--ui-text) group-data-[state=open]:text-primary group-focus:text-primary',
371
+ trailingIcon: 'delay-50 group-data-[state=open]:rotate-180 transition-transform duration-200 text-(--ui-text) group-focus-visible:text-primary group-data-[state=open]:text-primary group-has-[[aria-invalid=true]]:text-error!',
307
372
  item: 'my-0.75 text-neutral-highlighted before:rounded-none data-highlighted:not-data-disabled:text-primary data-highlighted:not-data-disabled:before:bg-shade data-[state=checked]:text-primary data-[state=checked]:bg-blue-50',
308
373
  itemLeadingIcon: 'group-data-[state=checked]:text-primary group-data-highlighted:not-data-disabled:text-primary text-neutral-highlighted'
309
374
  },
310
375
  variants: {
311
376
  size: {
312
377
  bcGov: {
313
- base: 'px-0 py-0 text-base gap-1.5',
378
+ base: 'px-2.5 pb-2 pt-6 text-base gap-1.5',
314
379
  leading: 'ps-2.5',
315
380
  trailing: 'pe-2.5',
316
381
  leadingIcon: 'size-5',
@@ -326,7 +391,7 @@ export default defineAppConfig({
326
391
  }
327
392
  },
328
393
  variant: {
329
- bcGov: 'peer rounded-t-sm rounded-b-none bg-shade focus:ring-0 focus:outline-none shadow-input data-[state=open]:shadow-input-focus focus:shadow-input-focus text-neutral-highlighted'
394
+ bcGov: 'peer ring-0! rounded-t-sm rounded-b-none bg-shade focus:ring-0 focus:outline-none shadow-input shadow-input focus-visible:shadow-input-focus data-[state=open]:shadow-input-focus text-neutral-highlighted aria-[invalid=true]:shadow-input-error! delay-50'
330
395
  }
331
396
  },
332
397
  defaultVariants: {
@@ -338,7 +403,7 @@ export default defineAppConfig({
338
403
  textarea: {
339
404
  variants: {
340
405
  size: {
341
- bcGovLg: {
406
+ bcGov: {
342
407
  base: 'px-2.5 pb-1.5 pt-5 text-base gap-1.5 resize-none',
343
408
  leading: 'ps-2.5',
344
409
  trailing: 'pe-2.5',
@@ -352,7 +417,7 @@ export default defineAppConfig({
352
417
  }
353
418
  },
354
419
  defaultVariants: {
355
- size: 'bcGovLg',
420
+ size: 'bcGov',
356
421
  color: 'primary',
357
422
  variant: 'bcGov'
358
423
  }
@@ -0,0 +1,67 @@
1
+ <script setup lang="ts">
2
+ type VariantOption = 'input' | 'textarea' | 'select' | 'selectmenu'
3
+
4
+ const {
5
+ variant = 'input'
6
+ } = defineProps<{
7
+ label: string
8
+ variant?: VariantOption
9
+ id: string
10
+ }>()
11
+
12
+ const variantClass: Record<VariantOption, string[]> = {
13
+ input: [
14
+ '-translate-y-1/2 top-1/2 group-focus-within:top-3 delay-50',
15
+ 'group-has-[div>input:not(:placeholder-shown)]:top-3',
16
+ 'group-has-[div>input:not(:placeholder-shown)]:text-xs',
17
+ 'group-has-[div>input[aria-invalid=true]]:text-error'
18
+ ],
19
+ textarea: [
20
+ 'top-1 group-focus-within:top-1 delay-50',
21
+ 'group-has-[div>textarea:not(:placeholder-shown)]:top-1',
22
+ 'group-has-[div>textarea:not(:placeholder-shown)]:text-xs',
23
+ 'group-has-[div>textarea[aria-invalid=true]]:text-error'
24
+ ],
25
+ select: [
26
+ 'delay-100',
27
+ '-translate-y-1/2 top-1/2 group-focus-within:top-3',
28
+ 'group-has-[button[aria-invalid=true]]:text-error',
29
+ 'group-has-[button[data-state=open]]:top-3',
30
+ 'group-has-[button[data-state=open]]:text-xs',
31
+ 'group-has-[button:not([data-placeholder])]:top-3',
32
+ 'group-has-[button:not([data-placeholder])]:text-xs',
33
+ 'group-has-[button[data-state=open]:not([aria-invalid=true])]:text-primary'
34
+ ],
35
+ selectmenu: [
36
+ 'delay-100',
37
+ '-translate-y-1/2 top-1/2 group-focus-within:top-3',
38
+ 'group-has-[button[aria-invalid=true]]:text-error',
39
+ 'group-has-[button[data-state=open]]:top-3',
40
+ 'group-has-[button[data-state=open]]:text-xs',
41
+ 'group-has-[button[data-placeholder=false]]:top-3',
42
+ 'group-has-[button[data-placeholder=false]]:text-xs',
43
+ 'group-has-[button[data-state=open]:not([aria-invalid=true])]:text-primary'
44
+ ]
45
+ }
46
+ </script>
47
+
48
+ <template>
49
+ <div class="relative group">
50
+ <span
51
+ :id
52
+ :class="[
53
+ variantClass[variant],
54
+ 'line-clamp-1 px-2.5',
55
+ 'absolute z-10 group-focus-within:text-primary',
56
+ 'pointer-events-none text-neutral transition-all',
57
+ 'motion-reduce:transition-none duration-200',
58
+ 'group-focus-within:text-xs',
59
+ 'group-focus-within:text-primary',
60
+ 'w-fit',
61
+ ]"
62
+ >
63
+ {{ label }}
64
+ </span>
65
+ <slot />
66
+ </div>
67
+ </template>
@@ -1,7 +1,4 @@
1
1
  <script setup lang="ts">
2
- /* eslint-disable vue/no-v-html */
3
- /* eslint-disable vue/no-v-text-v-html-on-component */
4
-
5
2
  const {
6
3
  translationPath,
7
4
  as = 'span'
@@ -39,5 +36,5 @@ const textToDisplay = computed(() => {
39
36
  </script>
40
37
 
41
38
  <template>
42
- <component :is="as" v-html="$sanitize(textToDisplay)" />
39
+ <component :is="as" v-sanitize="textToDisplay" />
43
40
  </template>
@@ -9,6 +9,7 @@
9
9
  <slot name="breadcrumb">
10
10
  <ConnectBreadcrumb />
11
11
  </slot>
12
+ <slot name="bottomHeaders" />
12
13
  <main class="app-body px-2 sm:px-4">
13
14
  <slot name="body">
14
15
  <div class="app-inner-container grow flex flex-col overflow-hidden">
@@ -16,6 +17,7 @@
16
17
  </div>
17
18
  </slot>
18
19
  </main>
20
+ <slot name="topFooters" />
19
21
  <slot name="footer">
20
22
  <ConnectFooter />
21
23
  </slot>
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ const props = defineProps<{
3
+ id: string
4
+ label: string
5
+ }>()
6
+
7
+ defineEmits<{
8
+ change: []
9
+ }>()
10
+
11
+ const labelId = props.id + '-label'
12
+ </script>
13
+
14
+ <template>
15
+ <ConnectFloatingLabel
16
+ :id="labelId"
17
+ :label
18
+ variant="select"
19
+ >
20
+ <USelect
21
+ :id
22
+ :data-testid="id"
23
+ :aria-labelledby="labelId"
24
+ v-bind="$attrs"
25
+ @change="$emit('change')"
26
+ />
27
+ </ConnectFloatingLabel>
28
+ </template>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- const model = defineModel<string>({ required: true })
2
+ const model = defineModel<null | string | number | undefined>({ required: true })
3
3
 
4
4
  defineProps<{
5
5
  id: string
@@ -1,4 +1,7 @@
1
- export const useConnectTombstone = (stateKey: string, initialState?: Partial<ConnectTombstoneState>) => {
1
+ export const useConnectTombstone = (
2
+ stateKey: string = 'default-tombstone',
3
+ initialState?: Partial<ConnectTombstoneState>
4
+ ) => {
2
5
  function createInitialState(): ConnectTombstoneState {
3
6
  const baseState: ConnectTombstoneState = {
4
7
  loading: false,
@@ -3,7 +3,16 @@ import DOMPurify from 'dompurify'
3
3
  export default defineNuxtPlugin({
4
4
  name: 'connect-sanitize-plugin',
5
5
  parallel: true,
6
- setup() {
6
+ setup(nuxtApp) {
7
+ nuxtApp.vueApp.directive('sanitize', {
8
+ beforeMount(el, binding) {
9
+ el.innerHTML = DOMPurify.sanitize(binding.value)
10
+ },
11
+ updated(el, binding) {
12
+ el.innerHTML = DOMPurify.sanitize(binding.value)
13
+ }
14
+ })
15
+
7
16
  return {
8
17
  provide: {
9
18
  sanitize: DOMPurify.sanitize
@@ -0,0 +1,7 @@
1
+ declare module 'vue' {
2
+ interface GlobalDirectives {
3
+ vSanitize: Directive<HTMLElement, string>
4
+ }
5
+ }
6
+
7
+ export {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-base",
3
3
  "type": "module",
4
- "version": "0.1.24",
4
+ "version": "0.1.26",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",
@@ -25,7 +25,7 @@
25
25
  "typescript": "5.9.3",
26
26
  "vue-tsc": "3.1.2",
27
27
  "@sbc-connect/eslint-config": "0.0.8",
28
- "@sbc-connect/playwright-config": "0.0.7",
28
+ "@sbc-connect/playwright-config": "0.0.8",
29
29
  "@sbc-connect/vitest-config": "0.0.6"
30
30
  },
31
31
  "scripts": {