@keenmate/web-daterangepicker 1.11.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/dist/style.css +1 -1
- package/dist/web-daterangepicker.js +1460 -1262
- package/dist/web-daterangepicker.umd.js +5 -5
- package/package.json +84 -79
- package/src/css/_base.css +285 -232
- package/src/css/_calendar-grid.css +14 -0
- package/src/css/_header-navigation.css +7 -0
- package/src/css/_modal.css +191 -0
- package/src/css/_summary-actions.css +12 -0
- package/src/css/_tooltips.css +37 -37
- package/src/css/_variables.css +25 -0
- package/src/css/main.css +2 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/* ==============================================================================
|
|
2
|
+
DATE RANGE PICKER - MODAL MODE
|
|
3
|
+
==============================================================================
|
|
4
|
+
Activated when the host element has `positioning-mode="modal"`.
|
|
5
|
+
Calendar centers in the viewport with a backdrop scrim — useful on small
|
|
6
|
+
screens where multi-month horizontal layouts overflow. */
|
|
7
|
+
|
|
8
|
+
/* Modal-mode calendar — overrides the absolute popover positioning. */
|
|
9
|
+
.drp-date-picker--modal {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 50%;
|
|
12
|
+
left: 50%;
|
|
13
|
+
transform: translate(-50%, -50%);
|
|
14
|
+
max-width: calc(100vw - 2 * var(--drp-modal-gap));
|
|
15
|
+
max-height: calc(100vh - 2 * var(--drp-modal-gap));
|
|
16
|
+
/* width: auto so the calendar sizes to its content (multi-month grid),
|
|
17
|
+
capped by max-width. On narrow viewports, the @media block below forces
|
|
18
|
+
a generous explicit width so the modal doesn't collapse to its intrinsic
|
|
19
|
+
min-content (which looks tiny — see --drp-modal-narrow-width). */
|
|
20
|
+
width: auto;
|
|
21
|
+
/* Flex-column scroll layout (header pinned top, months scroll, actions
|
|
22
|
+
pinned bottom) is shared with floating mode and lives in `_base.css`
|
|
23
|
+
under `.drp-date-picker:not(.drp-date-picker--inline)`. */
|
|
24
|
+
z-index: var(--drp-z-index-modal);
|
|
25
|
+
/* Make this a query container so the inner multi-month layout can collapse
|
|
26
|
+
to a single vertical column when the modal itself is narrower than the
|
|
27
|
+
side-by-side configuration would need. */
|
|
28
|
+
container-type: inline-size;
|
|
29
|
+
container-name: drp-modal;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/* Make the grid layout work inside an auto-sized modal.
|
|
34
|
+
The base CSS sets `width: 100%` on `.drp-date-picker__months--grid`. When
|
|
35
|
+
the parent modal is `width: auto` (or `max-content` / `fit-content`), that
|
|
36
|
+
100% has nothing to resolve against — and the grid's own `minmax(0, 1fr)`
|
|
37
|
+
columns let it collapse to 0. Result: the modal's max-content evaluates to
|
|
38
|
+
~0 and the modal snaps to its `min-width: 280px` floor regardless of how
|
|
39
|
+
many columns you configured.
|
|
40
|
+
|
|
41
|
+
Two overrides fix this for modal mode:
|
|
42
|
+
1. `width: auto` so the grid sizes to its own content rather than fighting
|
|
43
|
+
the parent's auto width.
|
|
44
|
+
2. `minmax(var(--drp-month-min-width), 1fr)` so each column has a real
|
|
45
|
+
pixel floor — items can't squeeze below the configured month min-width,
|
|
46
|
+
which forces the grid (and therefore the modal) to expand to fit them.
|
|
47
|
+
|
|
48
|
+
The narrow-tier `@container` rule below uses `!important` to override
|
|
49
|
+
these back to single-column behavior on small viewports. */
|
|
50
|
+
.drp-date-picker--modal .drp-date-picker__months--grid {
|
|
51
|
+
width: auto;
|
|
52
|
+
grid-template-columns: repeat(var(--drp-grid-columns, 3), minmax(var(--drp-month-min-width, 280px), 1fr));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Per-breakpoint modal width.
|
|
56
|
+
Without an explicit width, `width: auto` collapses the modal to whatever
|
|
57
|
+
min-content width the day grid needs — much narrower than viewport on
|
|
58
|
+
phones, which looks awkward and wastes space. We pin the width per
|
|
59
|
+
breakpoint via CSS variables (which can be overridden by the consumer),
|
|
60
|
+
while the breakpoints themselves are hardcoded since media queries can't
|
|
61
|
+
read CSS variables.
|
|
62
|
+
|
|
63
|
+
Aligned with the 480 / 768 / 1200 breakpoints already used by `_base.css`
|
|
64
|
+
(grid columns) and the Responsive Sizing demo (`--drp-rem` scaling).
|
|
65
|
+
See `_variables.css` for the default widths and a description of each
|
|
66
|
+
tier. */
|
|
67
|
+
|
|
68
|
+
/* xs — small phones (≤ 480px) */
|
|
69
|
+
@media (max-width: 480px) {
|
|
70
|
+
.drp-date-picker--modal {
|
|
71
|
+
width: var(--drp-modal-width-xs);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* sm — large phones / small tablets (481–768px) */
|
|
76
|
+
@media (min-width: 481px) and (max-width: 768px) {
|
|
77
|
+
.drp-date-picker--modal {
|
|
78
|
+
width: var(--drp-modal-width-sm);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* md — tablets / small desktops (769–1200px) */
|
|
83
|
+
@media (min-width: 769px) and (max-width: 1200px) {
|
|
84
|
+
.drp-date-picker--modal {
|
|
85
|
+
width: var(--drp-modal-width-md);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* lg — desktops (≥ 1201px) */
|
|
90
|
+
@media (min-width: 1201px) {
|
|
91
|
+
.drp-date-picker--modal {
|
|
92
|
+
width: var(--drp-modal-width-lg);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Progressive responsive layout — different behavior for flex vs grid:
|
|
97
|
+
- Flex layout (`.drp-date-picker__months` without `--grid`): the visible
|
|
98
|
+
month count is reduced to what fits in a single row at each tier;
|
|
99
|
+
hidden columns still update in lockstep via collision-resolve.
|
|
100
|
+
- Grid layout (`.drp-date-picker__months--grid`): all configured months
|
|
101
|
+
stay visible — we just reduce the column count so they wrap into more
|
|
102
|
+
rows. Hiding wouldn't make sense for grids since the user explicitly
|
|
103
|
+
configured a 2×3 / 3×2 / etc. layout.
|
|
104
|
+
- Both layouts collapse to a single visible month at ≤ 600px (phone
|
|
105
|
+
viewports), since stacking 6 months vertically is too tall.
|
|
106
|
+
|
|
107
|
+
Thresholds are roughly N × `--drp-month-min-width` (280px default) + gaps.
|
|
108
|
+
Container queries can't read CSS variables, so adjust here if your
|
|
109
|
+
`--drp-month-min-width` differs significantly. */
|
|
110
|
+
|
|
111
|
+
/* ≤ 600px → single visible month for BOTH layouts (phone screens) */
|
|
112
|
+
@container drp-modal (max-width: 600px) {
|
|
113
|
+
.drp-date-picker--modal .drp-date-picker__month {
|
|
114
|
+
min-width: 0;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
.drp-date-picker--modal .drp-date-picker__month:nth-child(n+2) {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
.drp-date-picker--modal .drp-date-picker__months--grid {
|
|
121
|
+
grid-template-columns: minmax(0, 1fr) !important;
|
|
122
|
+
grid-template-rows: auto !important;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* 601–900px → 2 columns (flex hides extras, grid wraps into more rows) */
|
|
127
|
+
@container drp-modal (min-width: 601px) and (max-width: 900px) {
|
|
128
|
+
/* Flex layout: hide months beyond column 2 so we don't horizontal-overflow.
|
|
129
|
+
`:not(--grid)` scoping is what keeps the rule from also hiding items in
|
|
130
|
+
grid layouts (where we want all 6 of a 2×3 to remain visible, just
|
|
131
|
+
re-flowed into more rows). */
|
|
132
|
+
.drp-date-picker--modal .drp-date-picker__months:not(.drp-date-picker__months--grid) > .drp-date-picker__month:nth-child(n+3) {
|
|
133
|
+
display: none;
|
|
134
|
+
}
|
|
135
|
+
/* Grid layout: cap columns at 2 so 6 items become 3 rows of 2 (etc). */
|
|
136
|
+
.drp-date-picker--modal .drp-date-picker__months--grid {
|
|
137
|
+
grid-template-columns: repeat(2, minmax(var(--drp-month-min-width, 280px), 1fr)) !important;
|
|
138
|
+
grid-template-rows: auto !important;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* 901–1200px → 3 columns (flex hides extras, grid uses configured cols up to 3) */
|
|
143
|
+
@container drp-modal (min-width: 901px) and (max-width: 1200px) {
|
|
144
|
+
.drp-date-picker--modal .drp-date-picker__months:not(.drp-date-picker__months--grid) > .drp-date-picker__month:nth-child(n+4) {
|
|
145
|
+
display: none;
|
|
146
|
+
}
|
|
147
|
+
/* Grid layout: respect configured grid-columns (capped at 3 for safety in
|
|
148
|
+
case configured is higher; users configuring >3 columns probably want
|
|
149
|
+
them at >1200px tier anyway). */
|
|
150
|
+
.drp-date-picker--modal .drp-date-picker__months--grid {
|
|
151
|
+
grid-template-columns: repeat(min(var(--drp-grid-columns, 3), 3), minmax(var(--drp-month-min-width, 280px), 1fr)) !important;
|
|
152
|
+
grid-template-rows: auto !important;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* > 1200px → respect configured layout (no override needed; the base
|
|
157
|
+
`.drp-date-picker--modal .drp-date-picker__months--grid` rule above
|
|
158
|
+
handles N × `minmax(--drp-month-min-width, 1fr)`) */
|
|
159
|
+
|
|
160
|
+
/* Note: the unified-navigation header stays visible — its prev/next buttons
|
|
161
|
+
are the only way to navigate when per-month headers are static (unified
|
|
162
|
+
mode). Its range display ("May 2026 - October 2026") will look slightly
|
|
163
|
+
off when only some of the configured months are visible, but navigation
|
|
164
|
+
works. */
|
|
165
|
+
|
|
166
|
+
/* Backdrop scrim — full-viewport, click-to-dismiss. */
|
|
167
|
+
.drp-date-picker__backdrop {
|
|
168
|
+
position: fixed;
|
|
169
|
+
inset: 0;
|
|
170
|
+
background: var(--drp-modal-backdrop-bg);
|
|
171
|
+
z-index: var(--drp-z-index-modal-backdrop);
|
|
172
|
+
opacity: 0;
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
transition: opacity var(--drp-modal-transition);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.drp-date-picker__backdrop--visible {
|
|
178
|
+
opacity: 1;
|
|
179
|
+
pointer-events: auto;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Optional fade-in for the calendar itself when transitions are enabled.
|
|
183
|
+
When .drp-transitions-enabled is set on the calendar, modal mode also
|
|
184
|
+
fades the calendar in/out alongside the backdrop. */
|
|
185
|
+
.drp-date-picker--modal.drp-transitions-enabled {
|
|
186
|
+
transition: opacity var(--drp-modal-transition);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.drp-date-picker--modal.drp-transitions-enabled:not(.drp-date-picker--visible) {
|
|
190
|
+
opacity: 0;
|
|
191
|
+
}
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
.drp-date-picker__summary--visible {
|
|
21
21
|
display: block;
|
|
22
|
+
/* Push the summary border away from the months area above so the rolling
|
|
23
|
+
selector overlay (which fills the months container via inset: 0) doesn't
|
|
24
|
+
visually touch the summary's border-top when opened. */
|
|
25
|
+
margin-top: var(--drp-spacing-sm);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
.drp-date-picker__summary--hidden {
|
|
@@ -40,6 +44,14 @@
|
|
|
40
44
|
gap: var(--drp-spacing-sm);
|
|
41
45
|
justify-content: space-between;
|
|
42
46
|
padding-top: var(--drp-spacing-sm);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* The border-top is a "separator from the visible summary above". Only draw it
|
|
50
|
+
when a visible summary actually precedes the actions — single mode never
|
|
51
|
+
appends a summary, range mode marks it --hidden until a range is selected,
|
|
52
|
+
and the always-present .drp-date-picker__message sits between the summary
|
|
53
|
+
and actions, so an adjacent-sibling selector wouldn't reach back. */
|
|
54
|
+
.drp-date-picker:has(.drp-date-picker__summary--visible) .drp-date-picker__actions {
|
|
43
55
|
border-top: var(--drp-summary-border);
|
|
44
56
|
}
|
|
45
57
|
|
package/src/css/_tooltips.css
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/* ==============================================================================
|
|
2
|
-
DATE RANGE PICKER - TOOLTIPS
|
|
3
|
-
==============================================================================
|
|
4
|
-
Floating UI tooltips for badge hover information */
|
|
5
|
-
|
|
6
|
-
/* ==============================================================================
|
|
7
|
-
FLOATING UI TOOLTIPS
|
|
8
|
-
============================================================================== */
|
|
9
|
-
|
|
10
|
-
.drp-date-picker__tooltip {
|
|
11
|
-
position:
|
|
12
|
-
z-index: var(--drp-z-index-tooltip);
|
|
13
|
-
background-color: var(--drp-tooltip-bg);
|
|
14
|
-
color: var(--drp-tooltip-text-color);
|
|
15
|
-
padding: var(--drp-spacing-xs) var(--drp-spacing-sm);
|
|
16
|
-
border-radius: var(--drp-border-radius-sm);
|
|
17
|
-
font-size: var(--drp-font-size-xs);
|
|
18
|
-
line-height: var(--drp-tooltip-line-height);
|
|
19
|
-
max-width: var(--drp-tooltip-max-width);
|
|
20
|
-
word-wrap: break-word;
|
|
21
|
-
pointer-events: none;
|
|
22
|
-
opacity: 0;
|
|
23
|
-
transition: opacity var(--drp-transition-fast) var(--drp-easing-snappy);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.drp-date-picker__tooltip--visible {
|
|
27
|
-
opacity: 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* Tooltip arrow */
|
|
31
|
-
.drp-date-picker__tooltip-arrow {
|
|
32
|
-
position: absolute;
|
|
33
|
-
background-color: var(--drp-tooltip-bg);
|
|
34
|
-
width: var(--drp-tooltip-arrow-size);
|
|
35
|
-
height: var(--drp-tooltip-arrow-size);
|
|
36
|
-
transform: rotate(45deg);
|
|
37
|
-
}
|
|
1
|
+
/* ==============================================================================
|
|
2
|
+
DATE RANGE PICKER - TOOLTIPS
|
|
3
|
+
==============================================================================
|
|
4
|
+
Floating UI tooltips for badge hover information */
|
|
5
|
+
|
|
6
|
+
/* ==============================================================================
|
|
7
|
+
FLOATING UI TOOLTIPS
|
|
8
|
+
============================================================================== */
|
|
9
|
+
|
|
10
|
+
.drp-date-picker__tooltip {
|
|
11
|
+
position: fixed;
|
|
12
|
+
z-index: var(--drp-z-index-tooltip);
|
|
13
|
+
background-color: var(--drp-tooltip-bg);
|
|
14
|
+
color: var(--drp-tooltip-text-color);
|
|
15
|
+
padding: var(--drp-spacing-xs) var(--drp-spacing-sm);
|
|
16
|
+
border-radius: var(--drp-border-radius-sm);
|
|
17
|
+
font-size: var(--drp-font-size-xs);
|
|
18
|
+
line-height: var(--drp-tooltip-line-height);
|
|
19
|
+
max-width: var(--drp-tooltip-max-width);
|
|
20
|
+
word-wrap: break-word;
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
opacity: 0;
|
|
23
|
+
transition: opacity var(--drp-transition-fast) var(--drp-easing-snappy);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.drp-date-picker__tooltip--visible {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Tooltip arrow */
|
|
31
|
+
.drp-date-picker__tooltip-arrow {
|
|
32
|
+
position: absolute;
|
|
33
|
+
background-color: var(--drp-tooltip-bg);
|
|
34
|
+
width: var(--drp-tooltip-arrow-size);
|
|
35
|
+
height: var(--drp-tooltip-arrow-size);
|
|
36
|
+
transform: rotate(45deg);
|
|
37
|
+
}
|
package/src/css/_variables.css
CHANGED
|
@@ -127,8 +127,31 @@
|
|
|
127
127
|
Z-INDEX LAYERS
|
|
128
128
|
========================================================================== */
|
|
129
129
|
--drp-z-index-dropdown: 9500;
|
|
130
|
+
--drp-z-index-modal-backdrop: 9700;
|
|
131
|
+
--drp-z-index-modal: 9800;
|
|
130
132
|
--drp-z-index-tooltip: 9999;
|
|
131
133
|
|
|
134
|
+
/* Modal mode (positioning-mode="modal") */
|
|
135
|
+
--drp-modal-gap: 16px; /* gap between calendar and viewport edges */
|
|
136
|
+
--drp-modal-backdrop-bg: rgba(0, 0, 0, 0.45); /* scrim color */
|
|
137
|
+
--drp-modal-transition: 150ms ease-out; /* fade-in/out timing for backdrop + calendar */
|
|
138
|
+
|
|
139
|
+
/* Modal widths per breakpoint. Aligned with the same 480/768/1200 viewport
|
|
140
|
+
breakpoints already used in `_base.css` (grid columns) and in the
|
|
141
|
+
Responsive Sizing demo (`--drp-rem` scaling). Override any of these to
|
|
142
|
+
retheme; see `_modal.css` for the breakpoint @media rules.
|
|
143
|
+
Note: media queries can't read CSS variables in CSS, so the breakpoints
|
|
144
|
+
themselves are hardcoded — to shift them, edit `_modal.css` directly.
|
|
145
|
+
Tiers:
|
|
146
|
+
xs: viewport ≤ 480px (small phones)
|
|
147
|
+
sm: 481px ≤ viewport ≤ 768px (large phones / small tablets)
|
|
148
|
+
md: 769px ≤ viewport ≤ 1200px (tablets / small desktops)
|
|
149
|
+
lg: viewport ≥ 1201px (desktops) */
|
|
150
|
+
--drp-modal-width-xs: calc(100vw - 2 * var(--drp-modal-gap)); /* fill the viewport minus gap */
|
|
151
|
+
--drp-modal-width-sm: calc(100vw - 2 * var(--drp-modal-gap)); /* same — small screens want the room */
|
|
152
|
+
--drp-modal-width-md: 900px; /* desktop-ish: 2 columns comfortably, grid wraps to 2-col */
|
|
153
|
+
--drp-modal-width-lg: 1100px; /* wide desktop: 3 month columns, 2×3 grid renders as configured */
|
|
154
|
+
|
|
132
155
|
/* ==========================================================================
|
|
133
156
|
LAYOUT & DIMENSIONS
|
|
134
157
|
========================================================================== */
|
|
@@ -267,6 +290,8 @@
|
|
|
267
290
|
--drp-day-in-range-hover-bg-opacity: 0.25;
|
|
268
291
|
--drp-day-drag-preview-bg-opacity: 0.30;
|
|
269
292
|
--drp-day-drag-preview-edge-bg-opacity: 0.60;
|
|
293
|
+
--drp-day-hover-preview-bg-opacity: 0.18;
|
|
294
|
+
--drp-day-hover-preview-invalid-bg-opacity: 0.18;
|
|
270
295
|
|
|
271
296
|
/* Invalid Range (showInvalidRange callback) */
|
|
272
297
|
--drp-day-invalid-range-bg: var(--drp-message-error-border);
|
package/src/css/main.css
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
├── _tooltips.css - Floating UI tooltips
|
|
13
13
|
├── _loading.css - Loading overlay and spinner for async validation
|
|
14
14
|
├── _message.css - Message area for validation feedback
|
|
15
|
+
├── _modal.css - Modal positioning mode (centered overlay + backdrop)
|
|
15
16
|
├── _modifiers.css - Transitions, inline mode
|
|
16
17
|
└── main.css - This file (imports all partials)
|
|
17
18
|
|
|
@@ -28,4 +29,5 @@
|
|
|
28
29
|
@import './_tooltips.css';
|
|
29
30
|
@import './_loading.css';
|
|
30
31
|
@import './_message.css';
|
|
32
|
+
@import './_modal.css';
|
|
31
33
|
@import './_modifiers.css';
|