mantine-calendar-rows 0.8.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/LICENSE +190 -0
- package/README.de.md +161 -0
- package/README.md +154 -0
- package/dist/index.d.mts +108 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.LEGAL.txt +12 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright © 2026 Quadux IT GmbH
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.de.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
[](https://quadux.it/)
|
|
2
|
+
|
|
3
|
+
# mantine-calendar-rows
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mantine-calendar-rows)
|
|
6
|
+
[](https://github.com/QuaduxIT/mantine-calendar-rows)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
[English](README.md) | **Deutsch**
|
|
10
|
+
|
|
11
|
+
Drop-in-Wrapper um die Kalender-Komponenten aus
|
|
12
|
+
[`@mantine/dates`](https://mantine.dev/dates/getting-started/), die eine
|
|
13
|
+
**`numberOfRows`**-Prop ergänzen und damit mehrzeilige Grid-Layouts
|
|
14
|
+
ermöglichen — zum Beispiel einen 4-Monats-Kalender als 2×2-Gitter statt
|
|
15
|
+
als 1×4-Zeile.
|
|
16
|
+
|
|
17
|
+
## Warum?
|
|
18
|
+
|
|
19
|
+
`@mantine/dates` unterstützt von Haus aus `numberOfColumns` und ordnet
|
|
20
|
+
Monate / Jahre / Jahrzehnte nebeneinander in einer einzelnen horizontalen
|
|
21
|
+
Reihe an. Für 2–3 Monate funktioniert das, für 6, 8 oder 12 Monate
|
|
22
|
+
wird es optisch und platztechnisch unhandlich. Die naheliegende Lösung
|
|
23
|
+
ist eine `numberOfRows`-Prop, die die vorhandenen Levels in ein Gitter
|
|
24
|
+
umordnet.
|
|
25
|
+
|
|
26
|
+
Es gibt dazu [einen Upstream-PR](https://github.com/mantinedev/mantine),
|
|
27
|
+
der aber nicht gemerged wurde. `mantine-calendar-rows` liefert
|
|
28
|
+
das Feature bereits heute — **ohne Mantine zu forken**. Das Paket hat
|
|
29
|
+
`@mantine/dates` als Peer-Dependency, du bleibst also immer auf der
|
|
30
|
+
aktuellsten offiziellen Version.
|
|
31
|
+
|
|
32
|
+
## Ansatz
|
|
33
|
+
|
|
34
|
+
Statt in Mantine-Interna einzugreifen nutzt der Wrapper die Public API:
|
|
35
|
+
|
|
36
|
+
1. Er lässt die Original-Komponente `numberOfColumns × numberOfRows`
|
|
37
|
+
Levels rendern, indem das Produkt als `numberOfColumns` weitergereicht
|
|
38
|
+
wird.
|
|
39
|
+
2. Über die Standard-StylesApi wird der innere `levelsGroup`-Slot von
|
|
40
|
+
`display: flex` auf `display: grid` mit `numberOfColumns` tatsächlichen
|
|
41
|
+
Spalten umgestellt.
|
|
42
|
+
|
|
43
|
+
Aus Mantines Sicht bleibt es bei genau einer logischen Reihe von `N`
|
|
44
|
+
Levels — die `withNext` / `withPrevious`-Logik und die Chevron-Navigation
|
|
45
|
+
funktionieren weiterhin korrekt. Nur das visuelle Layout wird
|
|
46
|
+
umsortiert.
|
|
47
|
+
|
|
48
|
+
**Kein DOM-Patching, kein Fork, keine Portal-Hacks, keine internen
|
|
49
|
+
Imports.**
|
|
50
|
+
|
|
51
|
+
Wenn `numberOfRows` gleich `1` (oder nicht gesetzt) ist, ist der Wrapper
|
|
52
|
+
ein reines Pass-Through ohne jeglichen Laufzeit-Overhead.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install mantine-calendar-rows
|
|
58
|
+
# oder
|
|
59
|
+
yarn add mantine-calendar-rows
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`@mantine/dates`, `@mantine/core` und `react` sind Peer-Dependencies —
|
|
63
|
+
sie müssen in der Host-Anwendung installiert sein.
|
|
64
|
+
|
|
65
|
+
## Verwendung
|
|
66
|
+
|
|
67
|
+
Einfach den Import von `@mantine/dates` auf `mantine-calendar-rows`
|
|
68
|
+
umstellen für die Komponenten, die die neue Prop unterstützen sollen:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
// Vorher
|
|
72
|
+
import { Calendar, DatePickerInput } from "@mantine/dates";
|
|
73
|
+
|
|
74
|
+
// Nachher
|
|
75
|
+
import { Calendar, DatePickerInput } from "mantine-calendar-rows";
|
|
76
|
+
|
|
77
|
+
export function Demo() {
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
{/* 4 Monate als 2x2-Gitter */}
|
|
81
|
+
<Calendar numberOfColumns={2} numberOfRows={2} />
|
|
82
|
+
|
|
83
|
+
{/* 6 Monate als 3x2-Gitter im Popover-Input */}
|
|
84
|
+
<DatePickerInput
|
|
85
|
+
type="range"
|
|
86
|
+
numberOfColumns={3}
|
|
87
|
+
numberOfRows={2}
|
|
88
|
+
placeholder="Zeitraum wählen"
|
|
89
|
+
/>
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Alle bestehenden Props aus `@mantine/dates` werden unverändert
|
|
96
|
+
weitergereicht — durch den Import-Wechsel verlierst du nichts.
|
|
97
|
+
|
|
98
|
+
## Exportierte Komponenten
|
|
99
|
+
|
|
100
|
+
Jeder Wrapper akzeptiert exakt dieselben Props wie das `@mantine/dates`-Original,
|
|
101
|
+
zusätzlich ein optionales `numberOfRows?: number`.
|
|
102
|
+
|
|
103
|
+
| Komponente | Hinweis |
|
|
104
|
+
| ------------------ | ------------------------------------------------- |
|
|
105
|
+
| `Calendar` | Inline-Kalender — Monats-/Jahres-/Jahrzehnt-Level |
|
|
106
|
+
| `DatePicker` | Inline Date Picker |
|
|
107
|
+
| `DatePickerInput` | Text-Eingabe mit Popover-Kalender |
|
|
108
|
+
| `DateInput` | Formatierte Text-Eingabe mit Popover-Kalender |
|
|
109
|
+
| `DateTimePicker` | Datums- + Zeit-Eingabe |
|
|
110
|
+
| `MonthPicker` | Inline Month Picker |
|
|
111
|
+
| `MonthPickerInput` | Month Picker mit Input + Popover |
|
|
112
|
+
| `YearPicker` | Inline Year Picker |
|
|
113
|
+
| `YearPickerInput` | Year Picker mit Input + Popover |
|
|
114
|
+
| `MonthLevelGroup` | Low-Level Level-Group |
|
|
115
|
+
| `YearLevelGroup` | Low-Level Level-Group |
|
|
116
|
+
| `DecadeLevelGroup` | Low-Level Level-Group |
|
|
117
|
+
|
|
118
|
+
### Eigene Komponenten wrappen
|
|
119
|
+
|
|
120
|
+
Für alles, was nicht in der Liste steht — etwa eine eigene Komponente,
|
|
121
|
+
die intern einen Mantine-Kalender rendert — gibt es die
|
|
122
|
+
`withNumberOfRows`-HOC:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { withNumberOfRows } from "mantine-calendar-rows";
|
|
126
|
+
import { SomeCalendarComponent } from "somewhere";
|
|
127
|
+
|
|
128
|
+
const SomeCalendarWithRows = withNumberOfRows(
|
|
129
|
+
SomeCalendarComponent,
|
|
130
|
+
"SomeCalendarComponent",
|
|
131
|
+
);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Die Ziel-Komponente muss `numberOfColumns` akzeptieren und `styles` im
|
|
135
|
+
Format der Mantine-StylesApi (also `styles.levelsGroup`).
|
|
136
|
+
|
|
137
|
+
## Voraussetzungen
|
|
138
|
+
|
|
139
|
+
- `@mantine/dates` >= 8 (getestet mit 9.x)
|
|
140
|
+
- `@mantine/core` >= 8
|
|
141
|
+
- `react` >= 18
|
|
142
|
+
|
|
143
|
+
## Links
|
|
144
|
+
|
|
145
|
+
- [GitHub-Repository](https://github.com/QuaduxIT/mantine-calendar-rows)
|
|
146
|
+
- [npm-Paket](https://www.npmjs.com/package/mantine-calendar-rows)
|
|
147
|
+
- [Issue-Tracker](https://github.com/QuaduxIT/mantine-calendar-rows/issues)
|
|
148
|
+
|
|
149
|
+
## Feedback & Mitwirken
|
|
150
|
+
|
|
151
|
+
Bug-Reports, Feature-Wünsche und Feedback sind herzlich willkommen. Am
|
|
152
|
+
besten direkt im
|
|
153
|
+
[Issue-Tracker](https://github.com/QuaduxIT/mantine-calendar-rows/issues)
|
|
154
|
+
— ohne festes Template, einfach beschreiben, worauf du gestoßen bist
|
|
155
|
+
oder was du dir wünschst. Pull Requests sind ebenfalls willkommen; bei
|
|
156
|
+
größeren Änderungen bitte vorher ein Issue eröffnen, damit wir uns zum
|
|
157
|
+
Ansatz abstimmen können.
|
|
158
|
+
|
|
159
|
+
## Lizenz
|
|
160
|
+
|
|
161
|
+
Apache 2.0 — siehe [LICENSE](LICENSE).
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
[](https://quadux.it/)
|
|
2
|
+
|
|
3
|
+
# mantine-calendar-rows
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mantine-calendar-rows)
|
|
6
|
+
[](https://github.com/QuaduxIT/mantine-calendar-rows)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
**English** | [Deutsch](README.de.md)
|
|
10
|
+
|
|
11
|
+
Drop-in wrappers around [`@mantine/dates`](https://mantine.dev/dates/getting-started/)
|
|
12
|
+
calendar components that add a **`numberOfRows`** prop, allowing multi-row
|
|
13
|
+
grid layouts — for example a 4-month calendar rendered as a 2×2 grid
|
|
14
|
+
instead of 1×4.
|
|
15
|
+
|
|
16
|
+
## Why?
|
|
17
|
+
|
|
18
|
+
`@mantine/dates` supports `numberOfColumns` out of the box, which lays
|
|
19
|
+
months / years / decades next to each other in a single horizontal row.
|
|
20
|
+
That works fine for 2–3 months, but falls apart visually and spatially
|
|
21
|
+
for 6, 8 or 12 months. The natural fix is a `numberOfRows` prop that
|
|
22
|
+
reshapes the existing levels into a grid.
|
|
23
|
+
|
|
24
|
+
There is [an upstream PR](https://github.com/mantinedev/mantine) for this
|
|
25
|
+
but it has not been merged. `mantine-calendar-rows` gives you the
|
|
26
|
+
feature today **without forking Mantine** — it depends on the unmodified
|
|
27
|
+
upstream `@mantine/dates` as a peer dependency, so you always stay on
|
|
28
|
+
the latest official release.
|
|
29
|
+
|
|
30
|
+
## Approach
|
|
31
|
+
|
|
32
|
+
Instead of patching Mantine internals, the wrapper uses Mantine's public
|
|
33
|
+
API:
|
|
34
|
+
|
|
35
|
+
1. It asks the original component to render `numberOfColumns × numberOfRows`
|
|
36
|
+
levels by passing the product as `numberOfColumns`.
|
|
37
|
+
2. It overrides the inner `levelsGroup` slot via the standard StylesApi,
|
|
38
|
+
switching its default `display: flex` to `display: grid` with
|
|
39
|
+
`numberOfColumns` actual columns.
|
|
40
|
+
|
|
41
|
+
From Mantine's perspective there is still exactly one logical row of `N`
|
|
42
|
+
levels, so its `withNext` / `withPrevious` / navigation-chevron logic
|
|
43
|
+
keeps working correctly. Only the visual layout is rearranged.
|
|
44
|
+
|
|
45
|
+
**No DOM patching, no forks, no portal hacks, no internal imports.**
|
|
46
|
+
|
|
47
|
+
When `numberOfRows` is `1` (or omitted), the wrapped component is a pure
|
|
48
|
+
pass-through and adds zero runtime overhead.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install mantine-calendar-rows
|
|
54
|
+
# or
|
|
55
|
+
yarn add mantine-calendar-rows
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`@mantine/dates`, `@mantine/core` and `react` are peer dependencies — they
|
|
59
|
+
are expected to be installed by the host application.
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
Just replace your `@mantine/dates` import with `mantine-calendar-rows`
|
|
64
|
+
for the components that should support the new prop:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
// Before
|
|
68
|
+
import { Calendar, DatePickerInput } from "@mantine/dates";
|
|
69
|
+
|
|
70
|
+
// After
|
|
71
|
+
import { Calendar, DatePickerInput } from "mantine-calendar-rows";
|
|
72
|
+
|
|
73
|
+
export function Demo() {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{/* 4 months as a 2x2 grid */}
|
|
77
|
+
<Calendar numberOfColumns={2} numberOfRows={2} />
|
|
78
|
+
|
|
79
|
+
{/* 6 months as a 3x2 grid inside a popover input */}
|
|
80
|
+
<DatePickerInput
|
|
81
|
+
type="range"
|
|
82
|
+
numberOfColumns={3}
|
|
83
|
+
numberOfRows={2}
|
|
84
|
+
placeholder="Pick range"
|
|
85
|
+
/>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
All existing `@mantine/dates` props are forwarded verbatim — you do not
|
|
92
|
+
lose anything by switching imports.
|
|
93
|
+
|
|
94
|
+
## Exported components
|
|
95
|
+
|
|
96
|
+
Each wrapper accepts the same props as its `@mantine/dates` counterpart
|
|
97
|
+
plus an optional `numberOfRows?: number`.
|
|
98
|
+
|
|
99
|
+
| Component | Notes |
|
|
100
|
+
| ------------------ | -------------------------------------------------- |
|
|
101
|
+
| `Calendar` | Inline calendar — month / year / decade levels |
|
|
102
|
+
| `DatePicker` | Inline date picker |
|
|
103
|
+
| `DatePickerInput` | Text input with popover calendar |
|
|
104
|
+
| `DateInput` | Formatted text input with popover calendar |
|
|
105
|
+
| `DateTimePicker` | Date + time input |
|
|
106
|
+
| `MonthPicker` | Inline month picker |
|
|
107
|
+
| `MonthPickerInput` | Month picker with input + popover |
|
|
108
|
+
| `YearPicker` | Inline year picker |
|
|
109
|
+
| `YearPickerInput` | Year picker with input + popover |
|
|
110
|
+
| `MonthLevelGroup` | Low-level level group |
|
|
111
|
+
| `YearLevelGroup` | Low-level level group |
|
|
112
|
+
| `DecadeLevelGroup` | Low-level level group |
|
|
113
|
+
|
|
114
|
+
### Wrap your own components
|
|
115
|
+
|
|
116
|
+
For anything not in the list above — a custom component that internally
|
|
117
|
+
renders a Mantine calendar, for example — use the `withNumberOfRows` HOC:
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { withNumberOfRows } from "mantine-calendar-rows";
|
|
121
|
+
import { SomeCalendarComponent } from "somewhere";
|
|
122
|
+
|
|
123
|
+
const SomeCalendarWithRows = withNumberOfRows(
|
|
124
|
+
SomeCalendarComponent,
|
|
125
|
+
"SomeCalendarComponent",
|
|
126
|
+
);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The target component needs to accept `numberOfColumns` and `styles` in the
|
|
130
|
+
shape of Mantine's StylesApi (i.e. `styles.levelsGroup`).
|
|
131
|
+
|
|
132
|
+
## Requirements
|
|
133
|
+
|
|
134
|
+
- `@mantine/dates` >= 8 (tested against 9.x)
|
|
135
|
+
- `@mantine/core` >= 8
|
|
136
|
+
- `react` >= 18
|
|
137
|
+
|
|
138
|
+
## Links
|
|
139
|
+
|
|
140
|
+
- [GitHub repository](https://github.com/QuaduxIT/mantine-calendar-rows)
|
|
141
|
+
- [npm package](https://www.npmjs.com/package/mantine-calendar-rows)
|
|
142
|
+
- [Issue tracker](https://github.com/QuaduxIT/mantine-calendar-rows/issues)
|
|
143
|
+
|
|
144
|
+
## Feedback & Contributing
|
|
145
|
+
|
|
146
|
+
Bug reports, feature requests and feedback are very welcome. The best
|
|
147
|
+
place is the [issue tracker](https://github.com/QuaduxIT/mantine-calendar-rows/issues)
|
|
148
|
+
— no template needed, just describe what you ran into or what you would
|
|
149
|
+
like to see. Pull requests are also welcome; for larger changes please
|
|
150
|
+
open an issue first so we can align on the approach.
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { CalendarProps as CalendarProps$1, DatePickerProps as DatePickerProps$1, DatePickerInputProps as DatePickerInputProps$1, DateInputProps as DateInputProps$1, DateTimePickerProps as DateTimePickerProps$1, MonthPickerProps as MonthPickerProps$1, MonthPickerInputProps as MonthPickerInputProps$1, YearPickerProps as YearPickerProps$1, YearPickerInputProps as YearPickerInputProps$1, DecadeLevelGroupProps as DecadeLevelGroupProps$1, MonthLevelGroupProps as MonthLevelGroupProps$1, YearLevelGroupProps as YearLevelGroupProps$1 } from '@mantine/dates';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props added by `withNumberOfRows`. The wrapped component still accepts
|
|
7
|
+
* the original `numberOfColumns` from `@mantine/dates`; we layer
|
|
8
|
+
* `numberOfRows` on top.
|
|
9
|
+
*/
|
|
10
|
+
interface WithNumberOfRowsProps {
|
|
11
|
+
/** Number of columns (months / years / decades) displayed next to each other @default 1 */
|
|
12
|
+
numberOfColumns?: number;
|
|
13
|
+
/** Number of rows of levels to display. When > 1, the inner LevelsGroup
|
|
14
|
+
* is switched from flex to a CSS grid with `numberOfColumns` columns
|
|
15
|
+
* and `numberOfRows` rows. @default 1 */
|
|
16
|
+
numberOfRows?: number;
|
|
17
|
+
/** Forwarded to the wrapped Mantine component. May be an object or a
|
|
18
|
+
* function (Mantine StylesApi). The wrapper merges its own
|
|
19
|
+
* `levelsGroup` style on top so that user-provided values still win. */
|
|
20
|
+
styles?: any;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Wraps a `@mantine/dates` calendar-like component (Calendar, DatePicker,
|
|
24
|
+
* DatePickerInput, DateTimePicker, MonthPicker, YearPicker, …) and adds a
|
|
25
|
+
* `numberOfRows` prop.
|
|
26
|
+
*
|
|
27
|
+
* Strategy: instead of forking Mantine internals, we ask the original
|
|
28
|
+
* component to render `numberOfColumns * numberOfRows` levels in a single
|
|
29
|
+
* row, then override the inner `levelsGroup` slot with a CSS grid that has
|
|
30
|
+
* `numberOfColumns` columns. The chevron / "withNext / withPrevious" logic
|
|
31
|
+
* of the upstream component continues to work correctly because — from
|
|
32
|
+
* Mantine's perspective — there is still exactly one row of N levels; only
|
|
33
|
+
* the visual layout is rearranged.
|
|
34
|
+
*/
|
|
35
|
+
declare function withNumberOfRows<P extends WithNumberOfRowsProps>(Component: ComponentType<P>, displayName?: string): ComponentType<P>;
|
|
36
|
+
|
|
37
|
+
type CalendarProps = CalendarProps$1 & WithNumberOfRowsProps;
|
|
38
|
+
/**
|
|
39
|
+
* Drop-in replacement for `Calendar` from `@mantine/dates` that additionally
|
|
40
|
+
* supports a `numberOfRows` prop. Display 4 months as a 2x2 grid by passing
|
|
41
|
+
* `numberOfColumns={2} numberOfRows={2}`.
|
|
42
|
+
*/
|
|
43
|
+
declare const Calendar: react.ComponentType<CalendarProps>;
|
|
44
|
+
|
|
45
|
+
type DatePickerProps<Type extends 'default' | 'multiple' | 'range' = 'default'> = DatePickerProps$1<Type> & WithNumberOfRowsProps;
|
|
46
|
+
/**
|
|
47
|
+
* Drop-in replacement for `DatePicker` from `@mantine/dates` that additionally
|
|
48
|
+
* supports a `numberOfRows` prop.
|
|
49
|
+
*/
|
|
50
|
+
declare const DatePicker: react.ComponentType<DatePickerProps<"default">>;
|
|
51
|
+
|
|
52
|
+
type DatePickerInputProps<Type extends 'default' | 'multiple' | 'range' = 'default'> = DatePickerInputProps$1<Type> & WithNumberOfRowsProps;
|
|
53
|
+
/**
|
|
54
|
+
* Drop-in replacement for `DatePickerInput` from `@mantine/dates` that
|
|
55
|
+
* additionally supports a `numberOfRows` prop. The grid layout is applied
|
|
56
|
+
* inside the popover dropdown via the standard Mantine StylesApi (no DOM
|
|
57
|
+
* patching, no portal hacks).
|
|
58
|
+
*/
|
|
59
|
+
declare const DatePickerInput: react.ComponentType<DatePickerInputProps<"default">>;
|
|
60
|
+
|
|
61
|
+
type DateInputProps = DateInputProps$1 & WithNumberOfRowsProps;
|
|
62
|
+
/**
|
|
63
|
+
* Drop-in replacement for `DateInput` from `@mantine/dates` that additionally
|
|
64
|
+
* supports a `numberOfRows` prop for its popover calendar. `numberOfColumns`
|
|
65
|
+
* is auto-routed through `pickCalendarProps` into the inner Calendar, so
|
|
66
|
+
* top-level usage works the same as for `Calendar`.
|
|
67
|
+
*/
|
|
68
|
+
declare const DateInput: react.ComponentType<DateInputProps>;
|
|
69
|
+
|
|
70
|
+
type DateTimePickerProps = DateTimePickerProps$1 & WithNumberOfRowsProps;
|
|
71
|
+
/**
|
|
72
|
+
* Drop-in replacement for `DateTimePicker` from `@mantine/dates` that
|
|
73
|
+
* additionally supports a `numberOfRows` prop.
|
|
74
|
+
*/
|
|
75
|
+
declare const DateTimePicker: react.ComponentType<DateTimePickerProps>;
|
|
76
|
+
|
|
77
|
+
type MonthPickerProps<Type extends 'default' | 'multiple' | 'range' = 'default'> = MonthPickerProps$1<Type> & WithNumberOfRowsProps;
|
|
78
|
+
type MonthPickerInputProps<Type extends 'default' | 'multiple' | 'range' = 'default'> = MonthPickerInputProps$1<Type> & WithNumberOfRowsProps;
|
|
79
|
+
/**
|
|
80
|
+
* Drop-in replacements for `MonthPicker` / `MonthPickerInput` from
|
|
81
|
+
* `@mantine/dates` that additionally support `numberOfRows`. Useful when
|
|
82
|
+
* you want to display, say, a full decade of years (10 years as 5x2).
|
|
83
|
+
*/
|
|
84
|
+
declare const MonthPicker: react.ComponentType<MonthPickerProps<"default">>;
|
|
85
|
+
declare const MonthPickerInput: react.ComponentType<MonthPickerInputProps<"default">>;
|
|
86
|
+
|
|
87
|
+
type YearPickerProps<Type extends 'default' | 'multiple' | 'range' = 'default'> = YearPickerProps$1<Type> & WithNumberOfRowsProps;
|
|
88
|
+
type YearPickerInputProps<Type extends 'default' | 'multiple' | 'range' = 'default'> = YearPickerInputProps$1<Type> & WithNumberOfRowsProps;
|
|
89
|
+
/**
|
|
90
|
+
* Drop-in replacements for `YearPicker` / `YearPickerInput` from
|
|
91
|
+
* `@mantine/dates` that additionally support `numberOfRows`.
|
|
92
|
+
*/
|
|
93
|
+
declare const YearPicker: react.ComponentType<YearPickerProps<"default">>;
|
|
94
|
+
declare const YearPickerInput: react.ComponentType<YearPickerInputProps<"default">>;
|
|
95
|
+
|
|
96
|
+
type MonthLevelGroupProps = MonthLevelGroupProps$1 & WithNumberOfRowsProps;
|
|
97
|
+
type YearLevelGroupProps = YearLevelGroupProps$1 & WithNumberOfRowsProps;
|
|
98
|
+
type DecadeLevelGroupProps = DecadeLevelGroupProps$1 & WithNumberOfRowsProps;
|
|
99
|
+
/**
|
|
100
|
+
* Drop-in replacements for the low-level `*LevelGroup` components from
|
|
101
|
+
* `@mantine/dates`. Most apps will use `Calendar` / `DatePicker` instead,
|
|
102
|
+
* but these are provided for feature parity with the Mantine surface.
|
|
103
|
+
*/
|
|
104
|
+
declare const MonthLevelGroup: react.ComponentType<MonthLevelGroupProps>;
|
|
105
|
+
declare const YearLevelGroup: react.ComponentType<YearLevelGroupProps>;
|
|
106
|
+
declare const DecadeLevelGroup: react.ComponentType<DecadeLevelGroupProps>;
|
|
107
|
+
|
|
108
|
+
export { Calendar, type CalendarProps, DateInput, type DateInputProps, DatePicker, DatePickerInput, type DatePickerInputProps, type DatePickerProps, DateTimePicker, type DateTimePickerProps, DecadeLevelGroup, type DecadeLevelGroupProps, MonthLevelGroup, type MonthLevelGroupProps, MonthPicker, MonthPickerInput, type MonthPickerInputProps, type MonthPickerProps, type WithNumberOfRowsProps, YearLevelGroup, type YearLevelGroupProps, YearPicker, YearPickerInput, type YearPickerInputProps, type YearPickerProps, withNumberOfRows };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
* Copyright © 2026 Quadux IT GmbH
|
|
4
|
+
* mantine-calendar-rows - numberOfRows prop for @mantine/dates calendars
|
|
5
|
+
* Author: Walter Hoffmann
|
|
6
|
+
*/
|
|
7
|
+
import{forwardRef as M}from"react";import{jsx as u}from"react/jsx-runtime";function e(t,m){let a=M((c,n)=>{let{numberOfColumns:o=1,numberOfRows:p=1,styles:r,...s}=c;if(!p||p<=1)return u(t,{ref:n,numberOfColumns:o,styles:r,...s});let l=o*p,i={display:"grid",gridTemplateColumns:`repeat(${o}, max-content)`,gap:"var(--mantine-spacing-md)"},y=typeof r=="function"?(f,k)=>{let P=r(f,k)||{};return{...P,levelsGroup:{...i,...P.levelsGroup||{}}}}:{...r||{},levelsGroup:{...i,...(r||{}).levelsGroup||{}}};return u(t,{ref:n,numberOfColumns:l,styles:y,...s})});return a.displayName=m||`withNumberOfRows(${t.displayName||t.name||"Component"})`,a}import{Calendar as h}from"@mantine/dates";var D=e(h,"Calendar");import{DatePicker as d}from"@mantine/dates";var w=e(d,"DatePicker");import{DatePickerInput as b}from"@mantine/dates";var I=e(b,"DatePickerInput");import{DateInput as x}from"@mantine/dates";var O=e(x,"DateInput");import{DateTimePicker as v}from"@mantine/dates";var R=e(v,"DateTimePicker");import{MonthPicker as G,MonthPickerInput as N}from"@mantine/dates";var L=e(G,"MonthPicker"),Y=e(N,"MonthPickerInput");import{YearPicker as T,YearPickerInput as W}from"@mantine/dates";var C=e(T,"YearPicker"),g=e(W,"YearPickerInput");import{MonthLevelGroup as $,YearLevelGroup as S,DecadeLevelGroup as q}from"@mantine/dates";var z=e($,"MonthLevelGroup"),A=e(S,"YearLevelGroup"),B=e(q,"DecadeLevelGroup");export{D as Calendar,O as DateInput,w as DatePicker,I as DatePickerInput,R as DateTimePicker,B as DecadeLevelGroup,z as MonthLevelGroup,L as MonthPicker,Y as MonthPickerInput,A as YearLevelGroup,C as YearPicker,g as YearPickerInput,e as withNumberOfRows};
|
|
8
|
+
/*! For license information please see index.mjs.LEGAL.txt */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
* Copyright © 2026 Quadux IT GmbH
|
|
4
|
+
* ____ __ __________ ______ __ __ __
|
|
5
|
+
* / __ \__ ______ _____/ /_ ___ __ / _/_ __/ / ____/___ ___ / /_ / / / /
|
|
6
|
+
* / / / / / / / __ `/ __ / / / / |/_/ / / / / / / __/ __ `__ \/ __ \/ /_/ /
|
|
7
|
+
* / /_/ / /_/ / /_/ / /_/ / /_/ /> < _/ / / / / /_/ / / / / / / /_/ / __ /
|
|
8
|
+
* \___\_\__,_/\__,_/\__,_/\__,_/_/|_| /___/ /_/ \____/_/ /_/ /_/_.___/_/ /_/
|
|
9
|
+
*
|
|
10
|
+
* mantine-calendar-rows - numberOfRows prop for @mantine/dates calendars
|
|
11
|
+
* Author: Walter Hoffmann
|
|
12
|
+
*/
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mantine-calendar-rows",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Drop-in wrappers around @mantine/dates Calendar / DatePicker components that add a numberOfRows prop, allowing multi-row grid layouts (e.g. 4 months as 2x2 instead of 1x4) without forking Mantine.",
|
|
5
|
+
"author": "Quadux IT GmbH",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.mjs",
|
|
9
|
+
"module": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.mts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"default": "./dist/index.mjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"README.de.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/QuaduxIT/mantine-calendar-rows.git"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/QuaduxIT/mantine-calendar-rows#readme",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/QuaduxIT/mantine-calendar-rows/issues"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@mantine/core": ">=8.0.0",
|
|
39
|
+
"@mantine/dates": ">=8.0.0",
|
|
40
|
+
"react": ">=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@mantine/core": "^9.0.1",
|
|
44
|
+
"@mantine/dates": "^9.0.1",
|
|
45
|
+
"@types/react": "^19.0.0",
|
|
46
|
+
"react": "^19.0.0",
|
|
47
|
+
"tsup": "^8.5.1",
|
|
48
|
+
"typescript": "^5.5.0"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"mantine",
|
|
52
|
+
"mantine-dates",
|
|
53
|
+
"calendar",
|
|
54
|
+
"datepicker",
|
|
55
|
+
"number-of-rows",
|
|
56
|
+
"multi-row",
|
|
57
|
+
"grid",
|
|
58
|
+
"react"
|
|
59
|
+
],
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
}
|
|
63
|
+
}
|