Skip to content

Commit b4f4223

Browse files
feat(DatePicker): Add portal prop (#1852)
* #1847 add portal prop to date picker * fix(DatePicker): review feedback * docs(DatePicker): add docs for portal prop
1 parent 3e563b6 commit b4f4223

File tree

9 files changed

+45
-13
lines changed

9 files changed

+45
-13
lines changed

docs/content/meta/DatePickerContent.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@
7474
'type': 'boolean',
7575
'required': false
7676
},
77+
{
78+
'name': 'portal',
79+
'description': '<p>Props to control the portal wrapped around the content.</p>\n',
80+
'type': 'PopoverPortalProps',
81+
'required': false
82+
},
7783
{
7884
'name': 'positionStrategy',
7985
'description': '<p>The type of CSS position property to use.</p>\n',

docs/content/meta/DatePickerRoot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
{
177177
'name': 'weekdayFormat',
178178
'description': '<p>The format to use for the weekday strings provided via the weekdays slot prop</p>\n',
179-
'type': '\'long\' | \'short\' | \'narrow\'',
179+
'type': '\'narrow\' | \'short\' | \'long\'',
180180
'required': false,
181181
'default': '\'narrow\''
182182
},

docs/content/meta/DateRangePickerContent.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@
7474
'type': 'boolean',
7575
'required': false
7676
},
77+
{
78+
'name': 'portal',
79+
'description': '<p>Props to control the portal wrapped around the content.</p>\n',
80+
'type': 'PopoverPortalProps',
81+
'required': false
82+
},
7783
{
7884
'name': 'positionStrategy',
7985
'description': '<p>The type of CSS position property to use.</p>\n',

docs/content/meta/DateRangePickerRoot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
{
197197
'name': 'weekdayFormat',
198198
'description': '<p>The format to use for the weekday strings provided via the weekdays slot prop</p>\n',
199-
'type': '\'long\' | \'short\' | \'narrow\'',
199+
'type': '\'narrow\' | \'short\' | \'long\'',
200200
'required': false,
201201
'default': '\'narrow\''
202202
},

docs/content/meta/RangeCalendarRoot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
{
165165
'name': 'weekdayFormat',
166166
'description': '<p>The format to use for the weekday strings provided via the weekdays slot prop</p>\n',
167-
'type': '\'long\' | \'short\' | \'narrow\'',
167+
'type': '\'narrow\' | \'short\' | \'long\'',
168168
'required': false,
169169
'default': '\'narrow\''
170170
},

docs/content/meta/StepperItem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
{
4141
'name': 'state',
4242
'description': '<p>The current state of the stepper item</p>\n',
43-
'type': '\'active\' | \'completed\' | \'inactive\''
43+
'type': '\'active\' | \'inactive\' | \'completed\''
4444
}
4545
]" />

docs/content/meta/VisuallyHidden.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
'name': 'feature',
1919
'description': '',
20-
'type': '\'focusable\' | \'fully-hidden\'',
20+
'type': '\'fully-hidden\' | \'focusable\'',
2121
'required': false,
2222
'default': '\'focusable\''
2323
}

packages/core/src/DatePicker/DatePickerContent.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
<script lang="ts">
2-
import type { PopoverContentEmits, PopoverContentProps } from '..'
2+
import type { PopoverContentEmits, PopoverContentProps, PopoverPortalProps } from '..'
3+
import { computed } from 'vue'
34
import { PopoverContent, PopoverPortal, useForwardPropsEmits } from '..'
45
5-
export interface DatePickerContentProps extends PopoverContentProps {}
6+
export interface DatePickerContentProps extends PopoverContentProps {
7+
/**
8+
* Props to control the portal wrapped around the content.
9+
*/
10+
portal?: PopoverPortalProps
11+
}
612
export interface DatePickerContentEmits extends PopoverContentEmits {}
713
</script>
814

915
<script setup lang="ts">
1016
const props = defineProps<DatePickerContentProps>()
1117
const emits = defineEmits<DatePickerContentEmits>()
1218
13-
const forwarded = useForwardPropsEmits(props, emits)
19+
const propsToForward = computed(() => ({
20+
...props,
21+
portal: undefined,
22+
}))
23+
const forwarded = useForwardPropsEmits(propsToForward, emits)
1424
</script>
1525

1626
<template>
17-
<PopoverPortal>
27+
<PopoverPortal v-bind="portal">
1828
<PopoverContent
1929
v-bind="{ ...forwarded, ...$attrs }"
2030
>

packages/core/src/DateRangePicker/DateRangePickerContent.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
<script lang="ts">
2-
import type { PopoverContentEmits, PopoverContentProps } from '..'
2+
import type { PopoverContentEmits, PopoverContentProps, PopoverPortalProps } from '..'
3+
import { computed } from 'vue'
34
import { PopoverContent, PopoverPortal, useForwardPropsEmits } from '..'
45
5-
export interface DateRangePickerContentProps extends PopoverContentProps {}
6+
export interface DateRangePickerContentProps extends PopoverContentProps {
7+
/**
8+
* Props to control the portal wrapped around the content.
9+
*/
10+
portal?: PopoverPortalProps
11+
}
612
export interface DateRangePickerContentEmits extends PopoverContentEmits {}
713
</script>
814

915
<script setup lang="ts">
1016
const props = defineProps<DateRangePickerContentProps>()
1117
const emits = defineEmits<DateRangePickerContentEmits>()
1218
13-
const forwarded = useForwardPropsEmits(props, emits)
19+
const propsToForward = computed(() => ({
20+
...props,
21+
portal: undefined,
22+
}))
23+
const forwarded = useForwardPropsEmits(propsToForward, emits)
1424
</script>
1525

1626
<template>
17-
<PopoverPortal>
27+
<PopoverPortal v-bind="portal">
1828
<PopoverContent
1929
v-bind="{ ...forwarded, ...$attrs }"
2030
>

0 commit comments

Comments
 (0)