fix(demos): bound format popover width and keep mobile trigger reachable

This commit is contained in:
maoyingjie
2026-10-28 17:49:49 +08:00
parent 1029444a98
commit 462044c3b8
4 changed files with 7 additions and 20 deletions
@@ -107,7 +107,7 @@ const hourCycleOptions: { label: string; value: HourCycle }[] = [
];
</script>
<template>
<div class="flex w-full flex-col gap-4">
<div class="flex w-full min-w-0 flex-col gap-4 overflow-x-auto">
<DateRangePicker
:key="granularity"
class="w-max min-w-80"
@@ -137,11 +137,11 @@ const hourCycleOptions: { label: string; value: HourCycle }[] = [
</DateRangePickerTrigger>
</DateFieldSuffix>
</DateFieldGroup>
<!-- Portaled content keeps an auto-sized wrapper; the pinned example's
w-full fills the popover's positioning container — see the
.hv-date-range-picker__popover.w-full adapter in date-range-picker.css,
which maps it to the same viewport width as the upstream chain. -->
<DateRangePickerPopover class="flex w-full flex-col gap-3">
<!-- The baseline fills the viewport; reserve the popover's 12px
collision padding on both sides so its contents stay reachable. -->
<DateRangePickerPopover
class="flex w-[calc(100vw-24px)] flex-col gap-3"
>
<RangeCalendar aria-label="出行日期" class="w-full">
<RangeCalendarHeader>
<CalendarYearPickerTrigger>
+1 -1
View File
@@ -279,7 +279,7 @@ ComboBox/Autocomplete的正式组合、原30项返修和本轮定位/ref/ARIA/lo
公开 DateRangePicker/Root、Trigger、TriggerIndicator、RangeSeparator、Popover、dateRangePickerVariants 及 Props/RenderProps/state/time 类型;起止输入复用 DateFieldGroup/Input/InputContainer/Segment/Suffix,端点为可类型检查的 `endpoint` prop;日历复用 RangeCalendar 与 CalendarYearPicker 具名部件。固定源中文 10 个预览、API/插槽/状态表与导航已接入;Picker 拥有唯一完整范围接受值、双端点字段校验、两个命名提交值和 reset,未显式绑定的内嵌 RangeCalendar 继承范围、上下界、不可用、禁用/只读/无效、locale/dir 与非连续策略。
不完整范围、第一下日历点击和空值时间草稿都不提交;清空两端提交 null,清空一端在关闭/外部替换/reset 时回到接受状态。受控拒绝后可重试,日历修改保留两端各自的日期类、时间、时区与历法,字段编辑保留不可显示精度。固定源 `slot="start"/"end"` 映射为 `endpoint` prop;格式选项弹层沿用基线 `w-full`:上游把弹层自身以 `position: absolute` 定位到初始包含块,`w-full` 即视口宽(官方文档桌面/窄屏实测),Vue/Reka 的定位包裹层按内容收缩,`date-range-picker.css` 的 `.hv-date-range-picker__popover.w-full` 适配规则把该类映射到同一视口宽,锚点贴靠、边界钳制与内容布局(252px 日历 + 拉伸的时间行)随之一致。真实浏览器、定向回归和最终 tarball 验证见 [任务结果](tasks/results/DATE-RANGE-PICKER.md)。
不完整范围、第一下日历点击和空值时间草稿都不提交;清空两端提交 null,清空一端在关闭/外部替换/reset 时回到接受状态。受控拒绝后可重试,日历修改保留两端各自的日期类、时间、时区与历法,字段编辑保留不可显示精度。固定源 `slot="start"/"end"` 映射为 `endpoint` prop;格式选项沿用基线的宽弹层布局,但在示例内显式预留两侧各 12px 碰撞边距,避免视口溢出;字段超宽时由该示例的横向滚动容器承接,保持触发器可达。不改写库级 `w-full` 百分比含义。真实浏览器、定向回归和最终 tarball 验证见 [任务结果](tasks/results/DATE-RANGE-PICKER.md)。
## FORM 正式迁移(2026-10-27)
@@ -91,15 +91,3 @@
.hv-date-range-picker__popover .hv-calendar__nav-button-icon {
@apply rotate-0;
}
/* Vue/Reka adapter: the pinned source positions the popover itself with
* `position: absolute` against the initial containing block, where a consumer's
* `w-full` (e.g. the cn format-options demo) resolves to the viewport width.
* Reka sizes its positioning wrapper to the content instead, so the same class
* would collapse; map it to the identical viewport width so the anchor
* placement, boundary clamping and content layout match the baseline.
* `!important` is required to out-rank the `w-full` utility layer (same
* layering constraint as the dropdown static-wrapper adapter). */
.hv-date-range-picker__popover.w-full {
width: 100vw !important;
}
-1
View File
@@ -481,7 +481,6 @@
".hv-date-range-picker__trigger-indicator",
".hv-date-range-picker__range-separator",
".hv-date-range-picker__popover",
".hv-date-range-picker__popover.w-full",
"--reka-popper-transform-origin",
"data-exiting",
"data-endpoint"