Skip to content

Commit 81aa680

Browse files
authored
Merge pull request #1111 from dnum-mi/refactor/slots-types-and-conditions
Refactor/slots types and conditions
2 parents 0952081 + a061d07 commit 81aa680

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

src/components/DsfrFieldset/DsfrFieldset.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ withDefaults(defineProps<DsfrFieldsetProps>(), {
1212
})
1313
1414
defineSlots<{
15-
default: () => any
16-
legend: () => any
17-
hint: () => any
15+
default?: () => any
16+
legend?: () => any
17+
hint?: () => any
1818
}>()
1919
</script>
2020

2121
<template>
2222
<fieldset class="fr-fieldset">
2323
<legend
24-
v-if="legend || $slots.legend?.()"
24+
v-if="legend || $slots.legend"
2525
:id="legendId"
2626
class="fr-fieldset__legend"
2727
:class="legendClass"
@@ -31,7 +31,7 @@ defineSlots<{
3131
<slot name="legend" />
3232
</legend>
3333
<div
34-
v-if="hint || $slots.hint?.()"
34+
v-if="hint || $slots.hint"
3535
class="fr-fieldset__element"
3636
>
3737
<span

src/components/DsfrMultiselect/DsfrMultiselect.types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export type DsfrMultiSelectProps<T> = {
2626
}
2727

2828
export type DsfrMultiSelectSlots<T> = {
29-
label: () => VNode
30-
'required-tip': () => VNode
31-
hint: () => VNode
32-
'button-label': () => VNode
33-
legend: () => VNode
34-
'checkbox-label': (props: { option: T }) => VNode
35-
'no-results': () => VNode
29+
label?: () => VNode
30+
'required-tip'?: () => VNode
31+
hint?: () => VNode
32+
'button-label'?: () => VNode
33+
legend?: () => VNode
34+
'checkbox-label'?: (props: { option: T }) => VNode
35+
'no-results'?: () => VNode
3636
}

src/components/DsfrMultiselect/DsfrMultiselect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ const finalLabelClass = computed(() => [
321321
</slot>
322322

323323
<span
324-
v-if="props.hint || $slots.hint?.()"
324+
v-if="props.hint || $slots.hint"
325325
class="fr-hint-text"
326326
>
327327
<slot name="hint">{{ props.hint }}</slot>

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default {
1111
install: (app: App, { components }: VueDsfrPluginOptions = {}) => {
1212
Object.entries(vueDsfrComponents).forEach(([componentName, component]) => {
1313
if (components === undefined || components === 'all' || components.map(({ name }) => name).includes(componentName)) {
14-
// @ts-expect-error TS2345
1514
app.component(componentName, component)
1615
}
1716
})

0 commit comments

Comments
 (0)