Files
heroui-vue/packages/styles/components/date-range-picker.css
T
maoyingjie 2e3fdd4800 fix(demos): inherit ConfigProvider locale and restore the format-options popover width
HD-03 scope, all against heroui ce90ea3 cn sources:

- calendar-disabled/read-only: restore the today() default value and the
  baseline description lines (日历已禁用 / 日历为只读) inside the
  flex flex-col items-center wrapper
- calendar-controlled: restore the second button row (设为今天/设为圣诞节/
  清空) and the baseline feedback wording (已选日期:…(未选))
- locale inheritance: add a public useLocale() accessor (the components'
  ConfigProvider → en-US/ltr chain) and use it for startOfWeek in
  calendar-controlled, isWeekend in booking-calendar/unavailable-dates and
  the DateFormatter in date-range-picker-format-options instead of the
  hardcoded 'en-US' / 'zh-CN' literals
- date-range-picker-format-options: restore the pinned w-full popover class;
  the pinned source positions the popover against the initial containing
  block (full viewport width — verified on the reference docs at desktop and
  narrow), while Reka's shrink-to-fit positioning wrapper collapses the same
  class. A scoped adapter rule (.hv-date-range-picker__popover.w-full →
  100vw, layering-safe like the dropdown static-wrapper adapter) restores
  the baseline effect: viewport-wide popover, 252px calendar, stretched
  time rows, identical boundary clamping

- tests: locale dynamic-switching regressions covering zh-CN/en-US for week
  start, weekend rules (with ar-EG flipping the weekend for a observable
  rule change) and range formatting; full suite 110 files / 1627 tests,
  typecheck, build:docs and the date-range-picker / api-root-aliases /
  calendar tarball contracts pass
2026-10-28 16:35:26 +08:00

106 lines
3.1 KiB
CSS

/* Adapted from HeroUI ce90ea3 date-range-picker.css. Copyright 2025 NextUI Inc.
* Apache-2.0; see third-party/HEROUI-LICENSE. hv- namespace, Vue/Reka states. */
.hv-date-range-picker {
@apply inline-flex flex-col gap-1;
.hv-date-input-group__suffix,
.hv-date-input-group__prefix {
@apply pointer-events-auto;
}
}
.hv-date-range-picker__trigger {
@apply inline-flex w-full items-center rounded-field p-1 text-sm no-highlight;
cursor: var(--cursor-interactive);
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition: box-shadow 150ms var(--ease-out);
@apply motion-reduce:transition-none;
&:focus-visible:not([data-focused]),
&[data-focus-visible="true"] {
@apply status-focused;
}
&:disabled,
&[data-disabled="true"],
&[aria-disabled="true"] {
@apply status-disabled;
}
}
.hv-date-range-picker__trigger-indicator {
@apply inline-flex size-4 items-center justify-center text-field-placeholder;
}
.hv-date-range-picker__range-separator {
@apply px-1 text-field-placeholder select-none;
}
.hv-date-range-picker__popover {
@apply w-fit origin-(--reka-popper-transform-origin) scrollbar-none overflow-y-auto overscroll-contain bg-overlay p-3;
@apply motion-reduce:transition-none;
box-shadow: var(--overlay-shadow);
border-radius: min(32px, calc(var(--radius) * 2.5));
&:focus-visible:not([data-focused]),
&[data-focus-visible="true"] {
@apply outline-none;
}
&[data-entering="true"] {
@apply animate-in duration-150 ease-smooth fade-in-0 zoom-in-95;
&[data-side^="top"] {
@apply slide-in-from-bottom-1;
}
&[data-side^="bottom"] {
@apply slide-in-from-top-1;
}
&[data-side^="left"] {
@apply slide-in-from-right-1;
}
&[data-side^="right"] {
@apply slide-in-from-left-1;
}
}
&[data-exiting="true"] {
@apply animate-out duration-100 ease-smooth zoom-out-95 fade-out;
/* Stays non-interactive while closing, even if the exit animation is interrupted. */
@apply pointer-events-none;
}
&[data-exiting="true"],
&[data-entering="true"] {
@apply transition-[opacity,transform] will-change-[opacity,transform];
@apply motion-reduce:animate-none motion-reduce:transition-none;
}
}
.hv-date-range-picker__popover .hv-range-calendar__nav-button-icon,
.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;
}