-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from kialj876/platform-web-form-updates-2
UI - platform web, address previous pr comments and validation styling updates
- Loading branch information
Showing
22 changed files
with
337 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
<script setup lang="ts"> | ||
const { title, optional, divider, className } = defineProps<{ | ||
defineProps<{ | ||
title?: string | ||
optional?: boolean | ||
divider?: boolean | ||
className?: string | ||
error?: boolean | ||
}>() | ||
const { t } = useI18n() | ||
</script> | ||
<template> | ||
<div | ||
data-testid="form-section" | ||
:class="`${className} mt-[40px] mobile:mt-[20px] ml-[40px] mr-[20px] mobile:mx-[8px]`" | ||
class="px-4 md:px-10" | ||
:class="[className, error ? 'border-l-2 border-red-600' : '']" | ||
> | ||
<div class="flex flex-col sm:flex-row"> | ||
<div v-if="title" class="w-[200px]"> | ||
<p class="mb-[8px] sm:mb-0 sm:font-bold"> | ||
<p class="mb-2 sm:mb-0 sm:font-bold" :class="error ? 'text-red-600' : ''"> | ||
{{ title }} | ||
</p> | ||
<p v-if="optional"> | ||
{{ t('general.optional') }} | ||
{{ $t('general.optional') }} | ||
</p> | ||
</div> | ||
<div class="w-full sm:pl-5"> | ||
<slot /> | ||
</div> | ||
</div> | ||
<div v-if="divider" class="hidden h-px w-full bg-bcGovGray-300 sm:block" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script setup lang="ts"> | ||
import { type UseEventBusReturn } from '@vueuse/core' | ||
const formBus = inject<UseEventBusReturn<any, string> | undefined>('form-events', undefined) | ||
const model = defineModel({ type: String, default: '' }) | ||
watch(model, () => { | ||
formBus?.emit({ type: 'blur', path: props.name }) | ||
formBus?.emit({ type: 'change', path: props.name }) | ||
}, { deep: true }) | ||
const props = defineProps({ | ||
name: { type: String, default: 'name.fullName' }, | ||
help: { type: String, default: '' }, | ||
id: { type: String, required: true }, | ||
label: { type: String, default: '' }, | ||
placeholder: { type: String, default: '' }, | ||
isDisabled: { type: Boolean, default: false }, | ||
size: { type: String, default: 'lg' } | ||
}) | ||
</script> | ||
|
||
<template> | ||
<UFormGroup :label="label" :name="name" :help="help"> | ||
<ConnectField | ||
:id="id" | ||
v-model="model" | ||
:placeholder="placeholder" | ||
:disabled="isDisabled" | ||
size="lg" | ||
/> | ||
</UFormGroup> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script setup lang="ts"> | ||
import { normalizeInput } from '~/utils/connect-validation' | ||
const model = defineModel({ type: String, default: '' }) | ||
defineProps({ | ||
id: { type: String, required: true }, | ||
isDisabled: { type: Boolean, default: false }, | ||
label: { type: String, default: '' }, | ||
placeholder: { type: String, default: '' }, | ||
size: { type: String, default: 'lg' } | ||
}) | ||
const normalize = () => { | ||
model.value = normalizeInput(model.value) | ||
} | ||
</script> | ||
|
||
<template> | ||
<UInput | ||
:id="id" | ||
v-model="model" | ||
v-bind="$attrs" | ||
type="text" | ||
class="max-w-bcGovInput" | ||
:color="model ? 'primary' : 'gray'" | ||
:placeholder="placeholder" | ||
:disabled="isDisabled" | ||
:size="size" | ||
@blur="normalize" | ||
/> | ||
</template> |
Oops, something went wrong.