@sbc-connect/nuxt-base 0.14.0 → 0.15.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,11 @@
1
1
  # @sbc-connect/nuxt-base
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#206](https://github.com/bcgov/connect-nuxt/pull/206) [`f19c40c`](https://github.com/bcgov/connect-nuxt/commit/f19c40c3702a53ef3a01a22b7068301f5d328122) Thanks [@deetz99](https://github.com/deetz99)! - Update Nuxt, Nuxt UI, JSDom and Pinia Colada to latest. Delete ConnectInputDate, replaced by ConnectInputDatePicker. Resolve theme issues after Nuxt UI update.
8
+
3
9
  ## 0.14.0
4
10
 
5
11
  ### Minor Changes
package/app/app.config.ts CHANGED
@@ -1,4 +1,13 @@
1
1
  /* eslint-disable max-len */
2
+ const colors = [
3
+ 'primary',
4
+ 'secondary',
5
+ 'success',
6
+ 'info',
7
+ 'warning',
8
+ 'error'
9
+ ]
10
+
2
11
  export default defineAppConfig({
3
12
  connect: {
4
13
  header: {
@@ -49,6 +58,11 @@ export default defineAppConfig({
49
58
  false: {
50
59
  link: 'text-secondary underline font-medium'
51
60
  }
61
+ },
62
+ color: {
63
+ secondary: {
64
+ link: 'outline-secondary/100 focus-visible:outline-2 outline-offset-2'
65
+ }
52
66
  }
53
67
  },
54
68
  compoundVariants: [
@@ -60,25 +74,32 @@ export default defineAppConfig({
60
74
  link: 'hover:text-secondary hover:underline transition-colors'
61
75
  }
62
76
  }
63
- ]
77
+ ],
78
+ defaultVariants: {
79
+ color: 'secondary'
80
+ }
64
81
  },
65
82
  button: {
66
83
  compoundVariants: [
67
84
  {
68
85
  color: 'primary',
69
86
  variant: 'solid',
70
- class: 'font-bold text-(--ui-bg) bg-(--ui-primary) hover:bg-(--ui-primary)/75 disabled:bg-(--ui-primary) aria-disabled:bg-(--ui-primary) focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-(--ui-primary)'
71
- },
72
- {
73
- color: 'primary',
74
- variant: 'ghost',
75
- class: 'text-(--ui-primary) hover:bg-(--ui-primary)/10 active:bg-(--ui-primary)/25 focus:outline-none focus-visible:bg-(--ui-primary)/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent'
87
+ class: 'font-bold hover:bg-(--ui-primary)/75 disabled:bg-(--ui-primary) aria-disabled:bg-(--ui-primary) outline-offset-2'
76
88
  },
77
- {
78
- color: 'primary',
89
+ ...colors.map(color => ({
90
+ color,
91
+ class: `outline-${color}/100`
92
+ })),
93
+ ...colors.map(color => ({
94
+ color,
95
+ variant: 'solid',
96
+ class: 'outline-offset-2'
97
+ })),
98
+ ...colors.map(color => ({
99
+ color,
79
100
  variant: 'outline',
80
- class: 'ring ring-inset ring-primary text-primary hover:bg-primary/10 active:bg-primary/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent focus:outline-none focus-visible:ring-2 focus-visible:ring-primary'
81
- }
101
+ class: `ring-${color}/100`
102
+ }))
82
103
  ],
83
104
  slots: {
84
105
  base: 'cursor-pointer'
@@ -232,6 +253,9 @@ export default defineAppConfig({
232
253
  },
233
254
  variants: {
234
255
  size: {
256
+ bcGov: {
257
+ root: 'text-sm'
258
+ },
235
259
  xs: {
236
260
  root: 'text-xs'
237
261
  },
@@ -255,7 +279,7 @@ export default defineAppConfig({
255
279
  }
256
280
  },
257
281
  defaultVariants: {
258
- size: 'md'
282
+ size: 'bcGov'
259
283
  }
260
284
  },
261
285
  icons: {
@@ -332,6 +356,9 @@ export default defineAppConfig({
332
356
  variant: 'bcGov'
333
357
  }
334
358
  },
359
+ link: {
360
+ base: 'outline-primary/100 focus-visible:outline-2 outline-offset-2'
361
+ },
335
362
  skeleton: {
336
363
  base: 'bg-gray-200'
337
364
  },
@@ -1,6 +1,10 @@
1
1
  @import "tailwindcss";
2
2
  @import "@nuxt/ui";
3
3
 
4
+ /* safelist so we can map across colors in the app config */
5
+ @source inline("outline-{primary,secondary,success,info,warning,error}/100");
6
+ @source inline("ring-{primary,secondary,success,info,warning,error}/100");
7
+
4
8
  /* Customize Nuxt UI default tokens */
5
9
  /* Follows https://sites.google.com/bcdevexchange.org/designsystem/foundation-styles/colours */
6
10
  :root {
@@ -23,7 +23,7 @@ const breadcrumbs = computed<ConnectBreadcrumb[]>(() => {
23
23
  }
24
24
  })
25
25
 
26
- function resolveBackHref() {
26
+ const backHref = computed(() => {
27
27
  const bcLength = breadcrumbs.value.length
28
28
 
29
29
  if (bcLength > 1) {
@@ -32,7 +32,7 @@ function resolveBackHref() {
32
32
  } else {
33
33
  return ''
34
34
  }
35
- }
35
+ })
36
36
  </script>
37
37
 
38
38
  <template>
@@ -46,14 +46,17 @@ function resolveBackHref() {
46
46
  class="app-inner-container flex items-center gap-3"
47
47
  >
48
48
  <UButton
49
- class="size-[28px] rounded-full px-1 bg-secondary hover:bg-secondary/75"
49
+ :class="[
50
+ 'size-[28px] rounded-full px-1 bg-secondary',
51
+ 'hover:bg-secondary/75 disabled:bg-secondary outline-secondary/100'
52
+ ]"
50
53
  :disabled="breadcrumbs.length < 2"
51
54
  color="secondary"
52
55
  icon="i-mdi-arrow-left"
53
56
  :aria-label="$t('connect.label.goBack')"
54
- :to="resolveBackHref()"
57
+ :to="backHref"
55
58
  :ui="{
56
- leadingIcon: 'text-primary',
59
+ leadingIcon: 'text-primary'
57
60
  }"
58
61
  />
59
62
  <div class="w-[1px] bg-shade h-[24px]" />
@@ -62,6 +65,7 @@ function resolveBackHref() {
62
65
  aria-label=""
63
66
  :items="breadcrumbs"
64
67
  separator-icon="i-mdi-chevron-right"
68
+ color="secondary"
65
69
  />
66
70
  </nav>
67
71
  </div>
@@ -57,7 +57,7 @@ const variantClass: Record<VariantOption, string[]> = {
57
57
  'motion-reduce:transition-none duration-200',
58
58
  'group-focus-within:text-xs',
59
59
  'group-focus-within:text-primary',
60
- 'w-fit',
60
+ 'w-fit'
61
61
  ]"
62
62
  >
63
63
  {{ label }}
@@ -61,7 +61,7 @@ const appVersions = computed<string[]>(() => {
61
61
  :class="[
62
62
  'flex-col gap-2 border-r-0 pr-2 last:mr-0',
63
63
  'last:border-r-0 sm:mr-2 sm:inline-block sm:flex-none',
64
- 'sm:border-r sm:first:ml-2 border-line-muted',
64
+ 'sm:border-r sm:first:ml-2 border-line-muted'
65
65
  ]"
66
66
  >
67
67
  <NuxtLink
@@ -70,7 +70,7 @@ const appVersions = computed<string[]>(() => {
70
70
  :class="[
71
71
  'rounded p-1 text-sm text-secondary',
72
72
  'hover:underline focus:outline-none',
73
- 'focus-visible:ring-2 focus-visible:ring-secondary',
73
+ 'focus-visible:ring-2 focus-visible:ring-secondary'
74
74
  ]"
75
75
  >
76
76
  {{ $t(link.label) }}
@@ -10,7 +10,7 @@ const localePath = useLocalePath()
10
10
  'flex items-center gap-4 rounded-md',
11
11
  'px-2 transition-colors duration-300',
12
12
  'ease-in-out hover:bg-secondary/[0.1]',
13
- 'focus:outline-none focus-visible:ring-2 focus-visible:ring-secondary',
13
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-secondary'
14
14
  ]"
15
15
  :aria-label="$t('connect.header.homeLink')"
16
16
  >
@@ -21,7 +21,7 @@ function open() {
21
21
  position="top-left"
22
22
  inset
23
23
  :ui="{
24
- base: 'ring-(--ui-error)',
24
+ base: 'ring-(--ui-error)'
25
25
  }"
26
26
  >
27
27
  <UButton
@@ -312,7 +312,7 @@ function clearDate() {
312
312
  :color="error ? 'error' : 'neutral'"
313
313
  variant="ghost"
314
314
  class="date-action-button"
315
- :aria-label="$t('label.clearDate')"
315
+ :aria-label="$t('connect.label.clearDate')"
316
316
  @keydown.enter.prevent.stop="clearDate"
317
317
  @click="clearDate"
318
318
  />
@@ -326,7 +326,7 @@ function clearDate() {
326
326
  onOpenAutoFocus,
327
327
  onCloseAutoFocus,
328
328
  onFocusOutside: ignoreInputInteraction,
329
- onInteractOutside: ignoreInputInteraction,
329
+ onInteractOutside: ignoreInputInteraction
330
330
  }"
331
331
  >
332
332
  <UButton
@@ -337,13 +337,13 @@ function clearDate() {
337
337
  :color="error && !dateInput ? 'error' : 'neutral'"
338
338
  variant="ghost"
339
339
  class="date-action-button"
340
- :aria-label="$t('label.openCalendar')"
340
+ :aria-label="$t('connect.label.openCalendar')"
341
341
  @keydown.enter.prevent.stop="isCalendarOpen = !isCalendarOpen"
342
342
  />
343
343
  <template #content>
344
344
  <div ref="calendarContentRef">
345
345
  <UCalendar
346
- :aria-label="$t('label.chooseDate')"
346
+ :aria-label="$t('connect.label.chooseDate')"
347
347
  :model-value="calendarValue"
348
348
  :min-value="calendarMinValue"
349
349
  :max-value="calendarMaxValue"
@@ -55,7 +55,7 @@ defineOptions({ inheritAttrs: false })
55
55
  'top-1/2 left-2.5 z-10 pointer-events-none -translate-y-1/2',
56
56
  'group-focus-within:translate-y-[-115%] group-focus-within:scale-75 group-focus-within:text-primary',
57
57
  'group-has-aria-invalid:text-error',
58
- hasValue ? 'translate-y-[-115%] scale-75' : '',
58
+ hasValue ? 'translate-y-[-115%] scale-75' : ''
59
59
  ]"
60
60
  >
61
61
  {{ label }}
@@ -40,7 +40,7 @@ defineExpose({ input: inputRef })
40
40
  id,
41
41
  disabled,
42
42
  autofocus: autoFocus,
43
- ...injectedProps, // injected props will default when provided
43
+ ...injectedProps // injected props will default when provided
44
44
  }"
45
45
  v-model.trim="model"
46
46
  v-maska="mask"
@@ -28,7 +28,7 @@ const showSideMenu = ref(true)
28
28
  label: 'text-base',
29
29
  link: 'cursor-pointer',
30
30
  linkLabel: 'text-neutral-highlighted',
31
- root: 'bg-white rounded p-3',
31
+ root: 'bg-white rounded p-3'
32
32
  }"
33
33
  />
34
34
  </div>
@@ -23,7 +23,7 @@ defineProps<{
23
23
  :ui="{
24
24
  header: heading?.ui ?? 'bg-shade-secondary px-4 py-4 sm:px-4 rounded-t-md',
25
25
  body: uiBody ?? 'p-0 sm:p-0',
26
- footer: 'p-0 sm:p-0',
26
+ footer: 'p-0 sm:p-0'
27
27
  }"
28
28
  >
29
29
  <template v-if="heading?.label || $slots.header" #header>
@@ -14,13 +14,13 @@ defineProps<{
14
14
  :close="{
15
15
  color: 'neutral',
16
16
  variant: 'ghost',
17
- class: 'cursor-pointer hover:bg-shade/50 focus-visible:bg-transparent focus-visible:ring-2 rounded-full',
17
+ class: 'cursor-pointer hover:bg-shade/50 focus-visible:bg-transparent focus-visible:ring-2 rounded-full'
18
18
  }"
19
19
  :ui="{
20
20
  header: 'bg-brand-inverted',
21
21
  title: 'text-brand',
22
22
  body: 'flex-1 overflow-y-auto p-0 sm:p-0',
23
- description: 'sr-only',
23
+ description: 'sr-only'
24
24
  }"
25
25
  >
26
26
  <template #body>
@@ -28,7 +28,7 @@ onMounted(async () => {
28
28
  :ui="{
29
29
  root: 'rounded-none bg-brand-inverted px-0 sm:px-0 app-inner-container',
30
30
  wrapper: 'bg-brand-inverted',
31
- close: 'mt-2 text-neutral-highlighted',
31
+ close: 'mt-2 text-neutral-highlighted'
32
32
  }"
33
33
  @update:open="close = true"
34
34
  >
@@ -96,7 +96,7 @@ async function handleButtonAction(button: ButtonProps, event: MouseEvent) {
96
96
  ...btn.button,
97
97
  onClick(event) {
98
98
  handleButtonAction(btn.button!, event)
99
- },
99
+ }
100
100
  }"
101
101
  />
102
102
  </template>
@@ -22,6 +22,8 @@ export default {
22
22
  bcApp: 'A BC Online Application',
23
23
  bcGovLogo: 'Government of British Columbia Logo',
24
24
  cancel: 'Cancel',
25
+ chooseDate: 'Choose Date',
26
+ clearDate: 'Clear Date',
25
27
  close: 'Close',
26
28
  contactInformation: 'Contact Information',
27
29
  copyright: 'Copyright',
@@ -32,6 +34,7 @@ export default {
32
34
  home: 'Home',
33
35
  hoursOfOperation: 'Hours of Operation',
34
36
  localeSelect: 'Select a Language, current language: English',
37
+ openCalendar: 'Open Calendar',
35
38
  privacy: 'Privacy',
36
39
  whatsNew: "What's New",
37
40
  whatsNewAria: "What's New, {count} unread",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-base",
3
3
  "type": "module",
4
- "version": "0.14.0",
4
+ "version": "0.15.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "github:bcgov/connect-nuxt"
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@iconify-json/mdi": "1.2.3",
13
13
  "@launchdarkly/js-client-sdk": "4.10.3",
14
- "@nuxt/ui": "4.7.1",
14
+ "@nuxt/ui": "4.11.3",
15
15
  "@nuxtjs/i18n": "10.6.0",
16
16
  "@vueuse/core": "15.0.0",
17
17
  "@vueuse/nuxt": "15.0.0",
@@ -23,13 +23,12 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@axe-core/playwright": "4.13.0",
26
- "@types/luxon": "3.7.5",
27
- "dotenv": "18.0.4",
28
- "nuxt": "4.5.2",
26
+ "@types/luxon": "3.7.6",
27
+ "dotenv": "18.0.7",
28
+ "nuxt": "4.6.1",
29
29
  "typescript": "6.0.3",
30
- "vue-router": "^5.3.1",
31
- "vue-tsc": "3.3.11",
32
- "@sbc-connect/eslint-config": "0.0.8",
30
+ "vue-router": "5.4.0",
31
+ "vue-tsc": "3.3.13",
33
32
  "@sbc-connect/vitest-config": "0.2.0",
34
33
  "@sbc-connect/playwright-config": "0.2.1"
35
34
  },
@@ -1,104 +0,0 @@
1
- <script setup lang="ts">
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- // https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/
4
- // https://whatsock.com/Templates/Datepickers/Basic,%20Auto%20Open/index.htm
5
- import type { ConnectInput, UCalendar } from '#components'
6
- import { CalendarDate } from '@internationalized/date'
7
- import { DateTime } from 'luxon'
8
-
9
- // FUTURE: update props as needed (min/max/disabled days)
10
- defineProps<{
11
- label: string
12
- id: string
13
- }>()
14
-
15
- const emit = defineEmits<{
16
- blur: []
17
- }>()
18
-
19
- const externalModel = defineModel<string | null | undefined>({ required: true })
20
-
21
- const localModel = computed({
22
- get() {
23
- if (externalModel.value) {
24
- const dt = DateTime.fromISO(externalModel.value, { zone: 'America/Vancouver' })
25
- if (dt.isValid) {
26
- return new CalendarDate(dt.year, dt.month, dt.day)
27
- }
28
- }
29
- return undefined
30
- },
31
- set(v) {
32
- if (v) {
33
- externalModel.value = DateTime.fromObject({
34
- year: v.year,
35
- month: v.month,
36
- day: v.day
37
- }).toISODate()
38
- } else {
39
- externalModel.value = null
40
- }
41
- }
42
- })
43
-
44
- const open = ref(false)
45
- const calendarRef = useTemplateRef('calendar-ref')
46
- const inputRef = useTemplateRef<InstanceType<typeof ConnectInput>>('input-ref')
47
-
48
- function focusCalendar() {
49
- const button = (calendarRef.value as any)?.$el?.querySelector('button')
50
- if (button) {
51
- (button as HTMLButtonElement).focus()
52
- }
53
- }
54
-
55
- function focusInput() {
56
- inputRef.value?.input?.inputRef?.focus()
57
- open.value = false
58
- emit('blur')
59
- }
60
- </script>
61
-
62
- <template>
63
- <UPopover
64
- v-model:open="open"
65
- :content="{
66
- onOpenAutoFocus: (e) => e.preventDefault(),
67
- onEscapeKeyDown: () => {
68
- focusInput()
69
- },
70
- side: 'bottom',
71
- align: 'start',
72
- }"
73
- @update:open="(v) => {
74
- if (!v) {
75
- $emit('blur')
76
- }
77
- }"
78
- >
79
- <template #default>
80
- <div class="w-full group">
81
- <ConnectInput
82
- :id
83
- ref="input-ref"
84
- v-model="externalModel"
85
- :label
86
- mask="####-##-##"
87
- trailing-icon="i-mdi-calendar"
88
- @focus="open = true"
89
- @click.stop="open = true"
90
- @keydown.down.prevent="focusCalendar"
91
- />
92
- </div>
93
- </template>
94
-
95
- <template #content>
96
- <UCalendar
97
- ref="calendar-ref"
98
- v-model="localModel"
99
- class="p-2"
100
- @update:model-value="focusInput"
101
- />
102
- </template>
103
- </UPopover>
104
- </template>