-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notifications): add entity dialog
See: BEDS-565
- Loading branch information
1 parent
76a3f00
commit d55ea52
Showing
11 changed files
with
833 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<script setup lang="ts" generic="T"> | ||
import { faCopy } from '@fortawesome/pro-solid-svg-icons' | ||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' | ||
const props = defineProps<{ | ||
infoCopy?: string, | ||
items?: T[], | ||
open?: boolean, | ||
}>() | ||
const isOpen = ref(props.open ?? false) | ||
const { | ||
copy, | ||
isSupported, | ||
} = useClipboard() | ||
const idList = useId() | ||
const textToCopy = ref<string>('') | ||
const detailElement = ref<HTMLElement>() | ||
onMounted(() => { | ||
if (!detailElement.value) return | ||
const ulElement = detailElement.value.querySelector(`#${idList}`) | ||
const liElements = ulElement?.querySelectorAll('li') | ||
if (liElements) { | ||
const liTexts = [ ...liElements ].map(liElement => liElement.textContent?.trim()) | ||
textToCopy.value = liTexts.join(', ') | ||
} | ||
}) | ||
const toast = useBcToast() | ||
const { t: $t } = useTranslation() | ||
const copyText = async () => { | ||
await copy(textToCopy.value).then(() => { | ||
toast.showInfo({ | ||
detail: $t('clipboard.copied_to_clipboard'), | ||
summary: props.infoCopy ?? '', | ||
}) | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<details | ||
ref="detailElement" | ||
class="bc-accordion" | ||
:open | ||
> | ||
<summary | ||
@click="isOpen = !isOpen" | ||
> | ||
<span class="bc-accordion__heading"> | ||
<IconChevron | ||
:direction="isOpen ? 'bottom' : 'right'" | ||
/> | ||
<slot name="headingIcon" /> | ||
<slot name="heading" /> | ||
</span> | ||
</summary> | ||
<BcCard class="bc-accordion__content"> | ||
<ul | ||
:id="idList" | ||
class="bc-accordion-list" | ||
> | ||
<li | ||
v-for="(item, index) in items" | ||
:key="`${index}-${item}`" | ||
class="bc-accordion-list__item" | ||
> | ||
<slot name="item" :item /> | ||
</li> | ||
</ul> | ||
<template #floating-action-button> | ||
<BcButtonIcon | ||
v-if="isSupported" | ||
screenreader-text="Copy list to clipboard" | ||
class="bc-accordion__button" | ||
@click="copyText" | ||
> | ||
<FontAwesomeIcon | ||
:icon="faCopy" | ||
class="bc-accordion__button-icon" | ||
/> | ||
</BcButtonIcon> | ||
</template> | ||
</BcCard> | ||
</details> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
@use '~/assets/css/breakpoints' as *; | ||
.bc-accordion { | ||
position: relative; | ||
summary { | ||
list-style: none; | ||
} | ||
summary::-webkit-details-marker{ | ||
display: none; | ||
} | ||
} | ||
.bc-accordion__heading { | ||
display: inline-flex; | ||
align-items: center; | ||
gap: 0.625rem; | ||
} | ||
.bc-accordion__content { | ||
margin-top: 0.625rem; | ||
min-height: 2.563rem; | ||
max-height: 9.375rem; | ||
overflow: auto; | ||
width: 100%; | ||
@media (min-width: $breakpoint-md) { | ||
width: 41.75rem; | ||
} | ||
} | ||
.bc-accordion-list { | ||
list-style: none; | ||
padding-inline-start: 0; | ||
display: inline; | ||
} | ||
.bc-accordion-list__item { | ||
display: inline; | ||
} | ||
.bc-accordion-list__item:not(:last-child)::after { | ||
content: ', '; | ||
} | ||
.bc-accordion__button { | ||
--border-width: .0625rem; | ||
background-color: var(--input-background); | ||
border-radius: var(--corner-radius, 4px); | ||
padding: calc(0.3125rem - var(--border-width)); | ||
border: var(--border-width) solid var(--input-border-color); | ||
color: inherit; | ||
height: 1.875rem; | ||
width: 1.875rem; | ||
position: absolute; | ||
bottom: 6px; | ||
right: 11px; | ||
} | ||
.bc-accordion__button-icon { | ||
width: .9375rem; | ||
font-size: .9375rem; | ||
line-height: 100%; | ||
} | ||
</style> |
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,17 @@ | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<div class="bc-card"> | ||
<slot /> | ||
<slot name="floating-action-button" /> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.bc-card { | ||
background-color: var(--input-background); | ||
border-radius: var(--corner-radius, 4px); | ||
padding: 0.625rem; | ||
border: 1px solid var(--input-border-color); | ||
} | ||
</style> |
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
Oops, something went wrong.