-
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.
Strata - UI: Strata doc upload (#419)
* update button style file upload * add validation function to document store and stepper * add documents to payload and update types * add documents to review step * add docs to details view * reset docs on application start * bump version
- Loading branch information
Showing
22 changed files
with
546 additions
and
28 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 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
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,49 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
documents: UiDocument[] | ||
}>() | ||
defineEmits<{ | ||
remove: [UiDocument] | ||
}>() | ||
</script> | ||
<template> | ||
<li | ||
v-for="doc in documents" | ||
:key="doc.id" | ||
class="flex flex-col gap-1" | ||
> | ||
<div | ||
class="flex items-center justify-between rounded bg-gray-100 p-3" | ||
:class="{ | ||
'opacity-90': doc.loading | ||
}" | ||
> | ||
<div class="flex items-center justify-between"> | ||
<div class="flex items-center gap-2"> | ||
<UIcon | ||
:name="doc.loading | ||
? 'i-heroicons-arrow-path-20-solid' | ||
: 'i-mdi-check-circle' | ||
" | ||
class="size-6" | ||
:class="{ | ||
'animate-spin': doc.loading, | ||
'text-green-500': !doc.loading | ||
}" | ||
/> | ||
<div class="flex flex-col"> | ||
<span class="text-sm font-bold">{{ $t(`docType.${doc.type}`) }}</span> | ||
<span>{{ doc.name }}</span> | ||
</div> | ||
</div> | ||
</div> | ||
<UButton | ||
:label="$t('word.Remove')" | ||
variant="link" | ||
:disabled="doc.loading" | ||
@click="$emit('remove', doc)" | ||
/> | ||
</div> | ||
</li> | ||
</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,11 @@ | ||
<script setup lang="ts"> | ||
const docStore = useDocumentStore() | ||
</script> | ||
<template> | ||
<ul class="flex flex-col gap-1"> | ||
<DocumentListItem | ||
:documents="docStore.storedDocuments" | ||
@remove="docStore.removeStoredDocument" | ||
/> | ||
</ul> | ||
</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,62 @@ | ||
<script setup lang="ts"> | ||
defineProps({ | ||
id: { type: String, required: true }, | ||
isDisabled: { type: Boolean, default: false }, | ||
isRequired: { type: Boolean, default: false }, | ||
isInvalid: { type: Boolean, default: false }, | ||
label: { type: String, default: '' }, | ||
helpId: { type: String, default: undefined }, | ||
ariaLabel: { type: String, default: undefined }, | ||
accept: { type: String, default: undefined }, | ||
multiple: { type: Boolean, default: false }, | ||
directory: { type: Boolean, default: false } | ||
}) | ||
defineEmits<{ | ||
change: [files: FileList | null] | ||
cancel: [void] | ||
}>() | ||
</script> | ||
<template> | ||
<div | ||
:id | ||
class="flex w-full items-center gap-2" | ||
> | ||
<UIcon | ||
name="i-mdi-paperclip" | ||
class="size-6 shrink-0 text-blue-500" | ||
/> | ||
<div | ||
class="relative h-[56px] w-full rounded-t border-b border-gray-500 bg-gray-100 | ||
focus-within:border-b-2 focus-within:border-blue-500 hover:border-gray-600 hover:bg-gray-200" | ||
:class="{ | ||
'border-red-600 bg-red-100 focus-within:border-red-600 hover:border-red-600 hover:bg-red-100': isInvalid | ||
}" | ||
> | ||
<label | ||
for="file-input" | ||
class="absolute flex size-full items-center px-4 text-left text-bcGovGray-700" | ||
:class="{ | ||
'text-red-600': isInvalid | ||
}" | ||
> | ||
{{ label }} | ||
</label> | ||
<input | ||
id="file-input" | ||
type="file" | ||
class="absolute size-full cursor-pointer opacity-0 ring-0 focus:outline-none focus:ring-0" | ||
:accept | ||
:multiple | ||
:webkitdirectory="directory" | ||
:aria-required="isRequired" | ||
:aria-invalid="isInvalid" | ||
:aria-label="ariaLabel" | ||
:aria-describedby="helpId" | ||
:disabled="isDisabled" | ||
@cancel="$emit('cancel')" | ||
@change="(e) => $emit('change', (e.target as HTMLInputElement).files)" | ||
> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<script setup lang="ts"> | ||
const props = defineProps({ | ||
id: { type: String, required: true }, | ||
isDisabled: { type: Boolean, default: false }, | ||
isRequired: { type: Boolean, default: false }, | ||
isInvalid: { type: Boolean, default: false }, | ||
label: { type: String, default: '' }, | ||
size: { type: String, default: 'lg' }, | ||
helpId: { type: String, default: undefined }, | ||
ariaLabel: { type: String, default: undefined }, | ||
accept: { type: String, default: undefined }, | ||
error: { type: Boolean, default: false } | ||
}) | ||
const docStore = useDocumentStore() | ||
const emit = defineEmits<{ | ||
change: [any] | ||
cancel: [void] | ||
}>() | ||
const { open, onChange, onCancel, reset } = useFileDialog({ | ||
accept: props.accept, | ||
multiple: false, | ||
directory: false | ||
}) | ||
onCancel(() => { | ||
emit('cancel') | ||
}) | ||
onChange((files) => { | ||
const file = files?.[0] | ||
if (file) { | ||
emit('change', file) | ||
} | ||
reset() | ||
}) | ||
</script> | ||
<template> | ||
<div | ||
:id | ||
class="flex w-full items-center gap-2" | ||
> | ||
<UIcon | ||
name="i-mdi-paperclip" | ||
class="size-6 text-blue-500" | ||
/> | ||
<USelectMenu | ||
v-model="docStore.selectedDocType" | ||
size="lg" | ||
:color="'gray'" | ||
:options="docStore.docTypeOptions" | ||
:aria-label="label" | ||
:aria-required="isRequired" | ||
:aria-invalid="isInvalid" | ||
value-attribute="value" | ||
:aria-describedby="helpId" | ||
:ui-menu="{ | ||
label: true ? 'text-gray-900' : !!error? 'text-red-600': 'text-gray-700' | ||
}" | ||
class="w-full" | ||
@change="open()" | ||
> | ||
<template #label> | ||
<span>{{ label }}</span> | ||
</template> | ||
</USelectMenu> | ||
</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
Oops, something went wrong.