@keenmate/web-daterangepicker 1.11.0 → 1.12.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/package.json CHANGED
@@ -1,79 +1,79 @@
1
- {
2
- "name": "@keenmate/web-daterangepicker",
3
- "version": "1.11.0",
4
- "description": "Lightweight date picker web component with excellent keyboard navigation and range selection",
5
- "type": "module",
6
- "main": "./dist/web-daterangepicker.umd.js",
7
- "module": "./dist/web-daterangepicker.js",
8
- "types": "./dist/index.d.ts",
9
- "style": "./dist/style.css",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/web-daterangepicker.js",
14
- "require": "./dist/web-daterangepicker.umd.js",
15
- "default": "./dist/web-daterangepicker.js"
16
- },
17
- "./style.css": "./dist/style.css",
18
- "./css": "./src/css/main.css",
19
- "./css/variables": "./src/css/_variables.css",
20
- "./css/base": "./src/css/_base.css",
21
- "./dist/*": "./dist/*",
22
- "./src/css/*": "./src/css/*",
23
- "./package.json": "./package.json",
24
- "./component-variables.manifest.json": "./component-variables.manifest.json"
25
- },
26
- "sideEffects": [
27
- "./dist/web-daterangepicker.js",
28
- "./dist/web-daterangepicker.umd.js",
29
- "*.css"
30
- ],
31
- "files": [
32
- "dist",
33
- "src/css",
34
- "component-variables.manifest.json"
35
- ],
36
- "scripts": {
37
- "dev": "vite",
38
- "build": "npm run clean:dist && tsc && vite build",
39
- "build:types": "tsc",
40
- "build:full": "tsc && vite build",
41
- "preview": "vite preview",
42
- "package": "npm run build && npm pack",
43
- "publish:dry": "npm run build && npm publish --dry-run",
44
- "clean": "rimraf dist *.tgz",
45
- "clean:dist": "rimraf dist"
46
- },
47
- "keywords": [
48
- "datepicker",
49
- "web-daterangepicker",
50
- "daterangepicker",
51
- "date-picker",
52
- "web-component",
53
- "custom-element",
54
- "calendar",
55
- "date-input",
56
- "date-selector",
57
- "keenmate"
58
- ],
59
- "author": "Keenmate",
60
- "license": "MIT",
61
- "repository": {
62
- "type": "git",
63
- "url": "git+https://github.com/keenmate/web-daterangepicker.git"
64
- },
65
- "homepage": "https://github.com/keenmate/web-daterangepicker#readme",
66
- "bugs": {
67
- "url": "https://github.com/keenmate/web-daterangepicker/issues"
68
- },
69
- "devDependencies": {
70
- "rimraf": "^5.0.5",
71
- "typescript": "^5.3.3",
72
- "vite": "^5.0.8"
73
- },
74
- "dependencies": {
75
- "@floating-ui/dom": "^1.5.3",
76
- "loglevel": "^1.9.2",
77
- "loglevel-plugin-prefix": "^0.8.4"
78
- }
79
- }
1
+ {
2
+ "name": "@keenmate/web-daterangepicker",
3
+ "version": "1.12.0",
4
+ "description": "Lightweight date picker web component with excellent keyboard navigation and range selection",
5
+ "type": "module",
6
+ "main": "./dist/web-daterangepicker.umd.js",
7
+ "module": "./dist/web-daterangepicker.js",
8
+ "types": "./dist/index.d.ts",
9
+ "style": "./dist/style.css",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/web-daterangepicker.js",
14
+ "require": "./dist/web-daterangepicker.umd.js",
15
+ "default": "./dist/web-daterangepicker.js"
16
+ },
17
+ "./style.css": "./dist/style.css",
18
+ "./css": "./src/css/main.css",
19
+ "./css/variables": "./src/css/_variables.css",
20
+ "./css/base": "./src/css/_base.css",
21
+ "./dist/*": "./dist/*",
22
+ "./src/css/*": "./src/css/*",
23
+ "./package.json": "./package.json",
24
+ "./component-variables.manifest.json": "./component-variables.manifest.json"
25
+ },
26
+ "sideEffects": [
27
+ "./dist/web-daterangepicker.js",
28
+ "./dist/web-daterangepicker.umd.js",
29
+ "*.css"
30
+ ],
31
+ "files": [
32
+ "dist",
33
+ "src/css",
34
+ "component-variables.manifest.json"
35
+ ],
36
+ "scripts": {
37
+ "dev": "vite",
38
+ "build": "npm run clean:dist && tsc && vite build",
39
+ "build:types": "tsc",
40
+ "build:full": "tsc && vite build",
41
+ "preview": "vite preview",
42
+ "package": "npm run build && npm pack",
43
+ "publish:dry": "npm run build && npm publish --dry-run",
44
+ "clean": "rimraf dist *.tgz",
45
+ "clean:dist": "rimraf dist"
46
+ },
47
+ "keywords": [
48
+ "datepicker",
49
+ "web-daterangepicker",
50
+ "daterangepicker",
51
+ "date-picker",
52
+ "web-component",
53
+ "custom-element",
54
+ "calendar",
55
+ "date-input",
56
+ "date-selector",
57
+ "keenmate"
58
+ ],
59
+ "author": "Keenmate",
60
+ "license": "MIT",
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/keenmate/web-daterangepicker.git"
64
+ },
65
+ "homepage": "https://github.com/keenmate/web-daterangepicker#readme",
66
+ "bugs": {
67
+ "url": "https://github.com/keenmate/web-daterangepicker/issues"
68
+ },
69
+ "devDependencies": {
70
+ "rimraf": "^5.0.5",
71
+ "typescript": "^5.3.3",
72
+ "vite": "^5.0.8"
73
+ },
74
+ "dependencies": {
75
+ "@floating-ui/dom": "^1.5.3",
76
+ "loglevel": "^1.9.2",
77
+ "loglevel-plugin-prefix": "^0.8.4"
78
+ }
79
+ }
package/src/css/_base.css CHANGED
@@ -138,6 +138,49 @@
138
138
  user-select: none;
139
139
  }
140
140
 
141
+ /* Non-inline pickers (floating + modal) use a flex column layout so that
142
+ the months area is the only scrollable region — header, summary, and
143
+ action bar stay anchored at the top/bottom regardless of how tall the
144
+ multi-month content is. Without this, when the calendar is taller than
145
+ its constrained height (modal max-height, or Floating UI's size
146
+ middleware in floating mode), the action buttons scroll out of view.
147
+ `min-height: 0` on the months area is required so it can shrink below
148
+ its intrinsic content size — flex defaults to `min-height: auto` which
149
+ prevents shrinking and breaks the inner scroll. */
150
+ .drp-date-picker:not(.drp-date-picker--inline) {
151
+ display: flex;
152
+ flex-direction: column;
153
+ overflow: hidden;
154
+ }
155
+
156
+ .drp-date-picker:not(.drp-date-picker--inline) > .drp-date-picker__months,
157
+ .drp-date-picker:not(.drp-date-picker--inline) > .drp-date-picker__months--grid {
158
+ flex: 1 1 auto;
159
+ min-height: 0;
160
+ overflow-y: auto;
161
+ }
162
+
163
+ .drp-date-picker:not(.drp-date-picker--inline) > .drp-date-picker__unified-header,
164
+ .drp-date-picker:not(.drp-date-picker--inline) > .drp-date-picker__summary,
165
+ .drp-date-picker:not(.drp-date-picker--inline) > .drp-date-picker__actions {
166
+ flex-shrink: 0;
167
+ }
168
+
169
+ /* Per-month headers (month name + prev/next nav, or static text in unified
170
+ mode) stick to the top of the scrolling months area so they stay visible
171
+ as the user scrolls through days. For multi-month layouts in a single row,
172
+ all headers stick simultaneously and look like a continuous header bar.
173
+ For grid layouts, each row's headers stick when that row is being scrolled
174
+ through, then unstick once the row is fully past. */
175
+ .drp-date-picker:not(.drp-date-picker--inline) .drp-date-picker__month .drp-date-picker__header {
176
+ position: sticky;
177
+ top: 0;
178
+ background: var(--drp-dropdown-bg);
179
+ /* Above day cells (z-index: auto = 0) so the days scroll behind the header
180
+ instead of bleeding through it. */
181
+ z-index: 2;
182
+ }
183
+
141
184
  /* Hide by default */
142
185
  .drp-date-picker:not(.drp-date-picker--visible) {
143
186
  display: none;
@@ -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
+ }
@@ -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
  ========================================================================== */
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';