@tedi-design-system/react 18.0.0-rc.26 → 18.0.0-rc.28
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/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/content/calendar/calendar.d.ts +4 -3
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.cjs.js +1 -1
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.es.js +68 -64
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.module.scss.es.js +2 -1
- package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field-helpers.d.ts +16 -0
- package/src/tedi/components/form/date-field/date-field-helpers.es.js +15 -14
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +51 -4
- package/src/tedi/components/form/date-field/date-field.es.js +288 -238
- package/src/tedi/components/form/date-field/date-field.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.module.scss.es.js +2 -0
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.cjs.js +1 -0
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.d.ts +51 -0
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.es.js +108 -0
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.module.scss.es.js +10 -0
- package/src/tedi/components/misc/attachment/attachment.module.scss.cjs.js +1 -1
- package/src/tedi/components/misc/attachment/attachment.module.scss.es.js +2 -2
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +35 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +37 -2
package/package.json
CHANGED
|
@@ -109,9 +109,10 @@ export interface CalendarProps extends Omit<DayPickerProps, 'mode' | 'selected'
|
|
|
109
109
|
className?: string;
|
|
110
110
|
/**
|
|
111
111
|
* Whether to render the surrounding card (border, background, radius).
|
|
112
|
-
* Set to `false` when embedding inside a parent that already provides
|
|
113
|
-
*
|
|
114
|
-
* The inner gradient masks and column separators are
|
|
112
|
+
* Set to `false` when embedding inside a parent that already provides its
|
|
113
|
+
* own surface — e.g. inside `DatePickerModal`, or alongside a calendar in
|
|
114
|
+
* `DateTimeField`. The inner gradient masks and column separators are
|
|
115
|
+
* preserved either way.
|
|
115
116
|
* @default true
|
|
116
117
|
*/
|
|
117
118
|
bordered?: boolean;
|
package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("../../../../../../../external/classnames/index.cjs.js"),j=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("../../../../../../../external/classnames/index.cjs.js"),j=require("react"),p=require("../../../../base/icon/icon.cjs.js"),k=require("../../../../base/typography/text/text.cjs.js"),c=require("../../../../buttons/button/button.cjs.js"),r=require("./calendar-header.module.scss.cjs.js"),B=require("../../../../../providers/label-provider/use-labels.cjs.js"),L=require("../../../../../../../external/react-day-picker/dist/esm/types/deprecated.cjs.js"),A=require("../../../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.cjs.js"),l=require("../../../../overlays/dropdown/dropdown.cjs.js");function H({calendarMonth:v,monthYearSelectType:q="dropdown",onOpenMonthGrid:N,onOpenYearGrid:C,showNavigation:u=!0,localeCode:_,disabledMatchers:o}){const h=q==="grid",{getLabel:m}=B.useLabels(),{goToMonth:w,nextMonth:D,previousMonth:S}=L.useNavigation(),i=v.date,a=i.getFullYear(),x=i.getMonth(),T=Array.from({length:12},(n,t)=>new Date(a,t,1).toLocaleString(_,{month:"long"})),F=new Date().getFullYear(),s=Array.from({length:21},(n,t)=>F-10+t),f=j.useCallback((n,t)=>{if(!(o!=null&&o.length))return!1;const d=new Date(n);for(;d<=t;){if(!A.dateMatchModifiers(d,o))return!1;d.setDate(d.getDate()+1)}return!0},[o]),I=j.useMemo(()=>{if(!(o!=null&&o.length))return new Set;const n=new Set;for(let t=0;t<12;t++){const d=new Date(a,t,1),g=new Date(a,t+1,0);f(d,g)&&n.add(t)}return n},[o,a,f]),Y=j.useMemo(()=>{if(!(o!=null&&o.length))return new Set;const n=new Set;for(const t of s){const d=new Date(t,0,1),g=new Date(t,11,31);f(d,g)&&n.add(t)}return n},[o,s,f]);return e.jsxs("div",{className:y.default(r.default["tedi-calendar__header"],{[r.default["tedi-calendar__no-navigation"]]:!u}),children:[u&&e.jsx(c.Button,{type:"button",onClick:()=>S&&w(S),"aria-label":m("pickers.previousMonth"),icon:"arrow_back",visualType:"neutral",children:m("pickers.previousMonth")}),u?h?e.jsxs(e.Fragment,{children:[e.jsxs(c.Button,{noStyle:!0,className:r.default["tedi-calendar__month-year-selector"],onClick:N,"data-testid":"tedi-calendar-month-trigger",children:[i.toLocaleString(_,{month:"long"}),e.jsx(p.Icon,{name:"arrow_drop_down",color:"tertiary",className:r.default["tedi-calendar__month-year-caret"]})]}),e.jsxs(c.Button,{noStyle:!0,className:r.default["tedi-calendar__month-year-selector"],onClick:C,"data-testid":"tedi-calendar-year-trigger",children:[i.getFullYear(),e.jsx(p.Icon,{name:"arrow_drop_down",color:"tertiary",className:r.default["tedi-calendar__month-year-caret"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(l.Dropdown,{className:y.default(r.default["tedi-calendar__month-year-dropdown"],{[r.default["tedi-calendar__picker-grid-dropdown"]]:h}),width:"auto",defaultActiveIndex:x,children:[e.jsx(l.Dropdown.Trigger,{children:e.jsxs(c.Button,{noStyle:!0,className:r.default["tedi-calendar__month-year-selector"],children:[i.toLocaleString(_,{month:"long"}),e.jsx(p.Icon,{name:"arrow_drop_down",color:"tertiary",className:r.default["tedi-calendar__month-year-caret"],"data-testid":"tedi-icon-arrow_drop_down"})]})}),e.jsx(l.Dropdown.Content,{children:T.map((n,t)=>e.jsx(l.Dropdown.Item,{index:t,active:x===t,disabled:I.has(t),onClick:()=>w(new Date(a,t)),children:n},n))})]}),e.jsxs(l.Dropdown,{className:y.default(r.default["tedi-calendar__month-year-dropdown"],{[r.default["tedi-calendar__picker-grid-dropdown"]]:h}),width:"auto",defaultActiveIndex:s.indexOf(a)===-1?void 0:s.indexOf(a),children:[e.jsx(l.Dropdown.Trigger,{children:e.jsxs(c.Button,{noStyle:!0,className:r.default["tedi-calendar__month-year-selector"],children:[i.getFullYear(),e.jsx(p.Icon,{name:"arrow_drop_down",color:"tertiary",className:r.default["tedi-calendar__month-year-caret"],"data-testid":"tedi-icon-arrow_drop_down"})]})}),e.jsx(l.Dropdown.Content,{children:s.map((n,t)=>e.jsx(l.Dropdown.Item,{index:t,active:a===n,disabled:Y.has(n),onClick:()=>w(new Date(n,x)),children:n},n))})]})]}):e.jsxs("div",{className:r.default["tedi-calendar__month-year-label"],children:[e.jsx(k.Text,{children:i.toLocaleString(_,{month:"long"})}),e.jsx(k.Text,{children:a})]}),u&&e.jsx(c.Button,{type:"button",onClick:()=>D&&w(D),visualType:"neutral","aria-label":m("pickers.nextMonth"),icon:"arrow_forward",children:m("pickers.nextMonth")})]})}exports.CalendarHeader=H;
|
package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.es.js
CHANGED
|
@@ -1,99 +1,100 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
1
|
+
import { jsxs as a, jsx as n, Fragment as v } from "react/jsx-runtime";
|
|
2
2
|
import D from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import {
|
|
3
|
+
import { useCallback as B, useMemo as N } from "react";
|
|
4
|
+
import { Icon as g } from "../../../../base/icon/icon.es.js";
|
|
5
|
+
import { Text as C } from "../../../../base/typography/text/text.es.js";
|
|
6
|
+
import { Button as m } from "../../../../buttons/button/button.es.js";
|
|
6
7
|
import r from "./calendar-header.module.scss.es.js";
|
|
7
|
-
import { useLabels as
|
|
8
|
-
import { useNavigation as
|
|
9
|
-
import { dateMatchModifiers as
|
|
8
|
+
import { useLabels as G } from "../../../../../providers/label-provider/use-labels.es.js";
|
|
9
|
+
import { useNavigation as H } from "../../../../../../../external/react-day-picker/dist/esm/types/deprecated.es.js";
|
|
10
|
+
import { dateMatchModifiers as R } from "../../../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
|
|
10
11
|
import { Dropdown as c } from "../../../../overlays/dropdown/dropdown.es.js";
|
|
11
|
-
function
|
|
12
|
-
calendarMonth:
|
|
13
|
-
monthYearSelectType:
|
|
14
|
-
onOpenMonthGrid:
|
|
15
|
-
onOpenYearGrid:
|
|
16
|
-
showNavigation:
|
|
17
|
-
localeCode:
|
|
18
|
-
disabledMatchers:
|
|
12
|
+
function Z({
|
|
13
|
+
calendarMonth: Y,
|
|
14
|
+
monthYearSelectType: F = "dropdown",
|
|
15
|
+
onOpenMonthGrid: T,
|
|
16
|
+
onOpenYearGrid: L,
|
|
17
|
+
showNavigation: _ = !0,
|
|
18
|
+
localeCode: p,
|
|
19
|
+
disabledMatchers: o
|
|
19
20
|
}) {
|
|
20
|
-
const f =
|
|
21
|
+
const f = F === "grid", { getLabel: u } = G(), { goToMonth: h, nextMonth: S, previousMonth: x } = H(), d = Y.date, i = d.getFullYear(), y = d.getMonth(), A = Array.from(
|
|
21
22
|
{ length: 12 },
|
|
22
|
-
(t, e) => new Date(i, e, 1).toLocaleString(
|
|
23
|
-
), I = (/* @__PURE__ */ new Date()).getFullYear(),
|
|
23
|
+
(t, e) => new Date(i, e, 1).toLocaleString(p, { month: "long" })
|
|
24
|
+
), I = (/* @__PURE__ */ new Date()).getFullYear(), s = Array.from({ length: 21 }, (t, e) => I - 10 + e), w = B(
|
|
24
25
|
(t, e) => {
|
|
25
|
-
if (!(
|
|
26
|
+
if (!(o != null && o.length)) return !1;
|
|
26
27
|
const l = new Date(t);
|
|
27
28
|
for (; l <= e; ) {
|
|
28
|
-
if (!
|
|
29
|
+
if (!R(l, o)) return !1;
|
|
29
30
|
l.setDate(l.getDate() + 1);
|
|
30
31
|
}
|
|
31
32
|
return !0;
|
|
32
33
|
},
|
|
33
|
-
[
|
|
34
|
-
),
|
|
35
|
-
if (!(
|
|
34
|
+
[o]
|
|
35
|
+
), j = N(() => {
|
|
36
|
+
if (!(o != null && o.length)) return /* @__PURE__ */ new Set();
|
|
36
37
|
const t = /* @__PURE__ */ new Set();
|
|
37
38
|
for (let e = 0; e < 12; e++) {
|
|
38
39
|
const l = new Date(i, e, 1), k = new Date(i, e + 1, 0);
|
|
39
|
-
|
|
40
|
+
w(l, k) && t.add(e);
|
|
40
41
|
}
|
|
41
42
|
return t;
|
|
42
|
-
}, [
|
|
43
|
-
if (!(
|
|
43
|
+
}, [o, i, w]), O = N(() => {
|
|
44
|
+
if (!(o != null && o.length)) return /* @__PURE__ */ new Set();
|
|
44
45
|
const t = /* @__PURE__ */ new Set();
|
|
45
|
-
for (const e of
|
|
46
|
+
for (const e of s) {
|
|
46
47
|
const l = new Date(e, 0, 1), k = new Date(e, 11, 31);
|
|
47
|
-
|
|
48
|
+
w(l, k) && t.add(e);
|
|
48
49
|
}
|
|
49
50
|
return t;
|
|
50
|
-
}, [
|
|
51
|
+
}, [o, s, w]);
|
|
51
52
|
return /* @__PURE__ */ a(
|
|
52
53
|
"div",
|
|
53
54
|
{
|
|
54
55
|
className: D(r["tedi-calendar__header"], {
|
|
55
|
-
[r["tedi-calendar__no-navigation"]]: !
|
|
56
|
+
[r["tedi-calendar__no-navigation"]]: !_
|
|
56
57
|
}),
|
|
57
58
|
children: [
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
_ && /* @__PURE__ */ n(
|
|
60
|
+
m,
|
|
60
61
|
{
|
|
61
62
|
type: "button",
|
|
62
|
-
onClick: () =>
|
|
63
|
-
"aria-label":
|
|
63
|
+
onClick: () => x && h(x),
|
|
64
|
+
"aria-label": u("pickers.previousMonth"),
|
|
64
65
|
icon: "arrow_back",
|
|
65
66
|
visualType: "neutral",
|
|
66
|
-
children:
|
|
67
|
+
children: u("pickers.previousMonth")
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
f ? /* @__PURE__ */ a(
|
|
70
|
+
_ ? f ? /* @__PURE__ */ a(v, { children: [
|
|
70
71
|
/* @__PURE__ */ a(
|
|
71
|
-
|
|
72
|
+
m,
|
|
72
73
|
{
|
|
73
74
|
noStyle: !0,
|
|
74
75
|
className: r["tedi-calendar__month-year-selector"],
|
|
75
|
-
onClick:
|
|
76
|
+
onClick: T,
|
|
76
77
|
"data-testid": "tedi-calendar-month-trigger",
|
|
77
78
|
children: [
|
|
78
|
-
d.toLocaleString(
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
d.toLocaleString(p, { month: "long" }),
|
|
80
|
+
/* @__PURE__ */ n(g, { name: "arrow_drop_down", color: "tertiary", className: r["tedi-calendar__month-year-caret"] })
|
|
80
81
|
]
|
|
81
82
|
}
|
|
82
83
|
),
|
|
83
84
|
/* @__PURE__ */ a(
|
|
84
|
-
|
|
85
|
+
m,
|
|
85
86
|
{
|
|
86
87
|
noStyle: !0,
|
|
87
88
|
className: r["tedi-calendar__month-year-selector"],
|
|
88
|
-
onClick:
|
|
89
|
+
onClick: L,
|
|
89
90
|
"data-testid": "tedi-calendar-year-trigger",
|
|
90
91
|
children: [
|
|
91
92
|
d.getFullYear(),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ n(g, { name: "arrow_drop_down", color: "tertiary", className: r["tedi-calendar__month-year-caret"] })
|
|
93
94
|
]
|
|
94
95
|
}
|
|
95
96
|
)
|
|
96
|
-
] }) : /* @__PURE__ */ a(
|
|
97
|
+
] }) : /* @__PURE__ */ a(v, { children: [
|
|
97
98
|
/* @__PURE__ */ a(
|
|
98
99
|
c,
|
|
99
100
|
{
|
|
@@ -103,10 +104,10 @@ function W({
|
|
|
103
104
|
width: "auto",
|
|
104
105
|
defaultActiveIndex: y,
|
|
105
106
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
d.toLocaleString(
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
107
|
+
/* @__PURE__ */ n(c.Trigger, { children: /* @__PURE__ */ a(m, { noStyle: !0, className: r["tedi-calendar__month-year-selector"], children: [
|
|
108
|
+
d.toLocaleString(p, { month: "long" }),
|
|
109
|
+
/* @__PURE__ */ n(
|
|
110
|
+
g,
|
|
110
111
|
{
|
|
111
112
|
name: "arrow_drop_down",
|
|
112
113
|
color: "tertiary",
|
|
@@ -115,13 +116,13 @@ function W({
|
|
|
115
116
|
}
|
|
116
117
|
)
|
|
117
118
|
] }) }),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ n(c.Content, { children: A.map((t, e) => /* @__PURE__ */ n(
|
|
119
120
|
c.Item,
|
|
120
121
|
{
|
|
121
122
|
index: e,
|
|
122
123
|
active: y === e,
|
|
123
|
-
disabled:
|
|
124
|
-
onClick: () =>
|
|
124
|
+
disabled: j.has(e),
|
|
125
|
+
onClick: () => h(new Date(i, e)),
|
|
125
126
|
children: t
|
|
126
127
|
},
|
|
127
128
|
t
|
|
@@ -136,12 +137,12 @@ function W({
|
|
|
136
137
|
[r["tedi-calendar__picker-grid-dropdown"]]: f
|
|
137
138
|
}),
|
|
138
139
|
width: "auto",
|
|
139
|
-
defaultActiveIndex:
|
|
140
|
+
defaultActiveIndex: s.indexOf(i) === -1 ? void 0 : s.indexOf(i),
|
|
140
141
|
children: [
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ n(c.Trigger, { children: /* @__PURE__ */ a(m, { noStyle: !0, className: r["tedi-calendar__month-year-selector"], children: [
|
|
142
143
|
d.getFullYear(),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
144
|
+
/* @__PURE__ */ n(
|
|
145
|
+
g,
|
|
145
146
|
{
|
|
146
147
|
name: "arrow_drop_down",
|
|
147
148
|
color: "tertiary",
|
|
@@ -150,13 +151,13 @@ function W({
|
|
|
150
151
|
}
|
|
151
152
|
)
|
|
152
153
|
] }) }),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ n(c.Content, { children: s.map((t, e) => /* @__PURE__ */ n(
|
|
154
155
|
c.Item,
|
|
155
156
|
{
|
|
156
157
|
index: e,
|
|
157
158
|
active: i === t,
|
|
158
|
-
disabled:
|
|
159
|
-
onClick: () =>
|
|
159
|
+
disabled: O.has(t),
|
|
160
|
+
onClick: () => h(new Date(t, y)),
|
|
160
161
|
children: t
|
|
161
162
|
},
|
|
162
163
|
t
|
|
@@ -164,16 +165,19 @@ function W({
|
|
|
164
165
|
]
|
|
165
166
|
}
|
|
166
167
|
)
|
|
168
|
+
] }) : /* @__PURE__ */ a("div", { className: r["tedi-calendar__month-year-label"], children: [
|
|
169
|
+
/* @__PURE__ */ n(C, { children: d.toLocaleString(p, { month: "long" }) }),
|
|
170
|
+
/* @__PURE__ */ n(C, { children: i })
|
|
167
171
|
] }),
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
_ && /* @__PURE__ */ n(
|
|
173
|
+
m,
|
|
170
174
|
{
|
|
171
175
|
type: "button",
|
|
172
|
-
onClick: () => S &&
|
|
176
|
+
onClick: () => S && h(S),
|
|
173
177
|
visualType: "neutral",
|
|
174
|
-
"aria-label":
|
|
178
|
+
"aria-label": u("pickers.nextMonth"),
|
|
175
179
|
icon: "arrow_forward",
|
|
176
|
-
children:
|
|
180
|
+
children: u("pickers.nextMonth")
|
|
177
181
|
}
|
|
178
182
|
)
|
|
179
183
|
]
|
|
@@ -181,5 +185,5 @@ function W({
|
|
|
181
185
|
);
|
|
182
186
|
}
|
|
183
187
|
export {
|
|
184
|
-
|
|
188
|
+
Z as CalendarHeader
|
|
185
189
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-calendar__header":"tedi-calendar__header-b917e6c6","tedi-calendar__no-navigation":"tedi-calendar__no-navigation-6ed593b5","tedi-calendar__month-year-dropdown":"tedi-calendar__month-year-dropdown-87f6e081","tedi-calendar__month-year-selector":"tedi-calendar__month-year-selector-8fbb2727","tedi-calendar__month-year-caret":"tedi-calendar__month-year-caret-a08a1e16"};exports.default=e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-calendar__header":"tedi-calendar__header-b917e6c6","tedi-calendar__no-navigation":"tedi-calendar__no-navigation-6ed593b5","tedi-calendar__month-year-dropdown":"tedi-calendar__month-year-dropdown-87f6e081","tedi-calendar__month-year-selector":"tedi-calendar__month-year-selector-8fbb2727","tedi-calendar__month-year-caret":"tedi-calendar__month-year-caret-a08a1e16","tedi-calendar__month-year-label":"tedi-calendar__month-year-label-d3cf51de"};exports.default=e;
|
|
@@ -3,7 +3,8 @@ const e = {
|
|
|
3
3
|
"tedi-calendar__no-navigation": "tedi-calendar__no-navigation-6ed593b5",
|
|
4
4
|
"tedi-calendar__month-year-dropdown": "tedi-calendar__month-year-dropdown-87f6e081",
|
|
5
5
|
"tedi-calendar__month-year-selector": "tedi-calendar__month-year-selector-8fbb2727",
|
|
6
|
-
"tedi-calendar__month-year-caret": "tedi-calendar__month-year-caret-a08a1e16"
|
|
6
|
+
"tedi-calendar__month-year-caret": "tedi-calendar__month-year-caret-a08a1e16",
|
|
7
|
+
"tedi-calendar__month-year-label": "tedi-calendar__month-year-label-d3cf51de"
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
10
|
e as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=4,c=8,l=e=>!!e&&!Array.isArray(e)&&!(e instanceof Date)&&"from"in e,f=(e,a,t)=>t&&l(a)&&a.from&&a.to?{from:t,to:void 0}:l(e)?e:void 0,D=e=>{const a=[];return e.disabled&&(Array.isArray(e.disabled)?a.push(...e.disabled):a.push(e.disabled)),e.minDate&&a.push({before:e.minDate}),e.maxDate&&a.push({after:e.maxDate}),e.disablePast&&a.push({before:new Date}),e.disableFuture&&a.push({after:new Date}),e.shouldDisableMonth&&a.push(t=>{var r;return((r=e.shouldDisableMonth)==null?void 0:r.call(e,t))??!1}),e.shouldDisableYear&&a.push(t=>{var r;return((r=e.shouldDisableYear)==null?void 0:r.call(e,t))??!1}),a},h=e=>{const a=new Date(2099,11,31),t=e.formatToParts(a),r=[],s=[];for(const o of t)o.type==="day"||o.type==="month"||o.type==="year"?r.push(o.type):o.type==="literal"&&r.length>0&&s.length<2&&s.push(o.value);return{fieldOrder:r,separators:s}},n=({fieldOrder:e,separators:a})=>{const t=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return e.map((r,s)=>{const o=r==="year"?"\\d{4}":"\\d{2}";return`${s>0?t(a[s-1]??""):""}(${o})`}).join("")};exports.CALENDAR_POPOVER_OFFSET=d;exports.CALENDAR_POPOVER_PADDING=c;exports.buildDateRegexSource=n;exports.buildDisabledMatchers=D;exports.getLocaleDateParts=h;exports.resolveRangeSelection=f;
|
|
@@ -12,6 +12,22 @@ export declare const CALENDAR_POPOVER_OFFSET = 4;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const CALENDAR_POPOVER_PADDING = 8;
|
|
14
14
|
export type SelectedValueLike = Date | Date[] | DateRange | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Range-selection click resolver. react-day-picker's default `addToRange`
|
|
17
|
+
* keeps a completed `{ from, to }` range and only moves one of its ends when
|
|
18
|
+
* the user clicks again — so after picking a start and an end, clicking a new
|
|
19
|
+
* start instead drags the existing end. That surprises users who expect a
|
|
20
|
+
* fresh click to begin a new range.
|
|
21
|
+
*
|
|
22
|
+
* This normalises that: once a range is complete, the next click starts over
|
|
23
|
+
* with `from` set to the clicked day and `to` cleared. While the range is
|
|
24
|
+
* still being built (or empty), DayPicker's own result is passed through.
|
|
25
|
+
*
|
|
26
|
+
* @param computed - the range react-day-picker derived from the click
|
|
27
|
+
* @param previous - the range that was selected before this click
|
|
28
|
+
* @param clickedDay - the day the user just clicked
|
|
29
|
+
*/
|
|
30
|
+
export declare const resolveRangeSelection: (computed: SelectedValueLike, previous: SelectedValueLike, clickedDay: Date | undefined) => DateRange | undefined;
|
|
15
31
|
/**
|
|
16
32
|
* Resolves the month the calendar should start on for any selection
|
|
17
33
|
* shape. Used by both `DateField` (single / multiple / range Date(s)) and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const d = 4,
|
|
1
|
+
const d = 4, c = 8, l = (e) => !!e && !Array.isArray(e) && !(e instanceof Date) && "from" in e, h = (e, a, o) => o && l(a) && a.from && a.to ? { from: o, to: void 0 } : l(e) ? e : void 0, D = (e) => {
|
|
2
2
|
const a = [];
|
|
3
3
|
return e.disabled && (Array.isArray(e.disabled) ? a.push(...e.disabled) : a.push(e.disabled)), e.minDate && a.push({ before: e.minDate }), e.maxDate && a.push({ after: e.maxDate }), e.disablePast && a.push({ before: /* @__PURE__ */ new Date() }), e.disableFuture && a.push({ after: /* @__PURE__ */ new Date() }), e.shouldDisableMonth && a.push((o) => {
|
|
4
4
|
var r;
|
|
@@ -7,22 +7,23 @@ const d = 4, f = 8, h = (e) => {
|
|
|
7
7
|
var r;
|
|
8
8
|
return ((r = e.shouldDisableYear) == null ? void 0 : r.call(e, o)) ?? !1;
|
|
9
9
|
}), a;
|
|
10
|
-
},
|
|
11
|
-
const a = new Date(2099, 11, 31), o = e.formatToParts(a), r = [],
|
|
12
|
-
for (const
|
|
13
|
-
|
|
14
|
-
return { fieldOrder: r, separators:
|
|
15
|
-
},
|
|
10
|
+
}, n = (e) => {
|
|
11
|
+
const a = new Date(2099, 11, 31), o = e.formatToParts(a), r = [], s = [];
|
|
12
|
+
for (const t of o)
|
|
13
|
+
t.type === "day" || t.type === "month" || t.type === "year" ? r.push(t.type) : t.type === "literal" && r.length > 0 && s.length < 2 && s.push(t.value);
|
|
14
|
+
return { fieldOrder: r, separators: s };
|
|
15
|
+
}, b = ({ fieldOrder: e, separators: a }) => {
|
|
16
16
|
const o = (r) => r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17
|
-
return e.map((r,
|
|
18
|
-
const
|
|
19
|
-
return `${
|
|
17
|
+
return e.map((r, s) => {
|
|
18
|
+
const t = r === "year" ? "\\d{4}" : "\\d{2}";
|
|
19
|
+
return `${s > 0 ? o(a[s - 1] ?? "") : ""}(${t})`;
|
|
20
20
|
}).join("");
|
|
21
21
|
};
|
|
22
22
|
export {
|
|
23
23
|
d as CALENDAR_POPOVER_OFFSET,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
c as CALENDAR_POPOVER_PADDING,
|
|
25
|
+
b as buildDateRegexSource,
|
|
26
|
+
D as buildDisabledMatchers,
|
|
27
|
+
n as getLocaleDateParts,
|
|
28
|
+
h as resolveRangeSelection
|
|
28
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),A=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),j=require("../../../../../external/classnames/index.cjs.js"),i=require("react"),nt=require("../../content/calendar/calendar.cjs.js"),ot=require("../multi-value-field/multi-value-field.cjs.js"),lt=require("../textfield/textfield.cjs.js"),y=require("./date-field.module.scss.cjs.js"),P=require("./date-field-helpers.cjs.js"),dt=require("./date-picker-modal/date-picker-modal.cjs.js"),ut=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),ft=require("../../../providers/label-provider/use-labels.cjs.js"),ct=require("../../../../../external/react-day-picker/dist/esm/locale/et.cjs.js"),oe=require("../../../helpers/hooks/use-breakpoint.cjs.js"),mt=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),G=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),pt=require("../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.cjs.js"),we=i.forwardRef((T,w)=>{const{getCurrentBreakpointProps:Ne}=ut.useBreakpointProps(T.defaultServerBreakpoint),{getLabel:ve}=ft.useLabels(),{useNativePicker:Oe=!1,enableCalendar:m=!0,calendarTrigger:I="button",numberOfMonths:z}=Ne(T),{id:le,mode:l="single",label:de,selected:N,onSelect:r,disabled:v,disabledMatchers:O,placeholder:Ee,className:Re,formatDate:d,required:S,showOutsideDays:ue=!0,parseDate:qe,monthYearSelectType:fe,showNavigation:ce=!0,selectionLevel:E="days",initialView:L,locale:me=ct.et,localeCode:$="et-EE",initialMonth:U,closeOnSelect:Ve,footer:pe,defaultValue:H,minDate:X,maxDate:J,disablePast:he,disableFuture:ge,shouldDisableMonth:K,shouldDisableYear:Q,readOnly:R,availableDays:ye,inputProps:o,modal:Z=!1,modalProps:Be,modalTitle:je,disabledDateErrorMessage:Te=ve("dateField.disabledDateError"),useNativePicker:ht,enableCalendar:gt,calendarTrigger:yt,numberOfMonths:bt,defaultServerBreakpoint:Dt,sm:_t,md:xt,lg:Mt,xl:At,xxl:Ct,...be}=T,c=Oe&&l==="single",De=oe.default(T.defaultServerBreakpoint),C=oe.isBreakpointBelow(De,"md"),[Ie,b]=i.useState(N??H),[p,q]=i.useState(!1),[ee,_e]=i.useState(!1),[Se,xe]=i.useState(L??E),[Le,D]=i.useState(""),[Me,h]=i.useState(!1),_=m&&!c&&!R&&(Z===!0||typeof Z=="string"&&oe.isBreakpointBelow(De,Z)),Ae=C&&!_&&typeof z=="number"&&z>1?1:z,u=N!==void 0,n=u?N:Ie,Ce=i.useRef(null),$e=i.useCallback(e=>{Ce.current=e,typeof w=="function"?w(e):w&&(w.current=e)},[w]),Ue=e=>{if(!e)return"";const t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),f=String(e.getDate()).padStart(2,"0");return`${t}-${a}-${f}`},He=c&&n instanceof Date?Ue(n):"",te=i.useCallback((e,t)=>e instanceof Date?e:Array.isArray(e)&&e.length>0?[...e].sort((a,f)=>a.getTime()-f.getTime())[0]:e&&typeof e=="object"&&"from"in e&&e.from instanceof Date?e.from:e&&typeof e=="object"&&"to"in e&&e.to instanceof Date?e.to:t??new Date,[]),[We,ae]=i.useState(()=>te(n,U));i.useEffect(()=>{p||ae(te(n,U))},[n,U,p,te]),i.useEffect(()=>{p&&xe(L??E)},[p,E,L]),i.useEffect(()=>{u&&b(N)},[N,u]);const x=i.useMemo(()=>new Intl.DateTimeFormat($,{day:"2-digit",month:"2-digit",year:"numeric"}),[$]),M=i.useCallback(e=>{if(!e)return"";if(e instanceof Date)return x.format(e);if(Array.isArray(e))return e.map(t=>x.format(t)).join(", ");if(e.from){const t=x.format(e.from);return e.to?`${t} – ${x.format(e.to)}`:t}return""},[x]),re=Ve??l==="single",ke=l==="multiple"&&Array.isArray(n)?n.map((e,t)=>({id:t,label:d?d(e):M(e),date:e})):[],W=i.useMemo(()=>{const e=[];return v&&(Array.isArray(v)?e.push(...v):e.push(v)),O&&(Array.isArray(O)?e.push(...O):e.push(O)),X&&e.push({before:X}),J&&e.push({after:J}),he&&e.push({before:new Date}),ge&&e.push({after:new Date}),K&&e.push(t=>K(t)),Q&&e.push(t=>Q(t)),e},[v,O,X,J,he,ge,K,Q]),k=i.useCallback(e=>pt.dateMatchModifiers(e,W),[W]),Ye=(e,t,a,f)=>{const s=l==="range"?P.resolveRangeSelection(e,n,t):e;if(h(!1),u||b(s),r==null||r(s,t,a,f),s){const V=d?d(s):M(s);D(V)}else D("");re&&q(!1)},Ge=e=>{if(k(e))return;const t=l==="range"?{from:e,to:void 0}:l==="multiple"?[...Array.isArray(n)?n:[],e]:e;h(!1),u||b(t),r==null||r(t,e,{},{});const a=d?d(t):M(t);D(a),re&&q(!1)},ze=i.useMemo(()=>{const e=P.getLocaleDateParts(x),t=new RegExp(`^${P.buildDateRegexSource(e)}$`),{fieldOrder:a}=e;return f=>{const s=f.match(t);if(!s)return;const V={};a.forEach((it,st)=>{V[it]=Number(s[st+1])});const{day:F,month:se,year:ne}=V;if(F===void 0||se===void 0||ne===void 0)return;const B=new Date(ne,se-1,F);if(!(isNaN(B.getTime())||B.getFullYear()!==ne||B.getMonth()!==se-1||B.getDate()!==F))return B}},[x]),Xe=e=>{if(D(e),e.trim()===""){h(!1);return}const a=(qe??(l==="single"?ze:()=>{}))(e);if(!(l==="single"&&a instanceof Date||l==="multiple"&&Array.isArray(a)||l==="range"&&!!a&&!Array.isArray(a)&&"from"in a)){h(!1);return}const s=a&&!Array.isArray(a)&&"from"in a?a:null;if(a instanceof Date&&k(a)||Array.isArray(a)&&a.some(F=>F instanceof Date&&k(F))||!!s&&(s.from&&k(s.from)||s.to&&k(s.to))){h(!0);return}h(!1),u||b(a),r==null||r(a,a,{},{}),a instanceof Date&&ae(a),re&&q(!1)};i.useEffect(()=>{if(u){const e=d?d(n):M(n);D(e)}},[n,u,d,M]),i.useEffect(()=>{if(!u&&H){const e=d?d(H):M(H);D(e)}},[]);const Je=A.useFloating({open:p,onOpenChange:q,placement:I==="input"?"bottom-start":"bottom-end",middleware:[G.offset(P.CALENDAR_POPOVER_OFFSET),G.flip(),G.shift({padding:P.CALENDAR_POPOVER_PADDING}),G.size({padding:P.CALENDAR_POPOVER_PADDING,apply({availableWidth:e,elements:t}){const a=t.floating;if(a.style.width="",a.style.maxWidth="",a.style.overflowX="",C)return;a.style.width="max-content",a.getBoundingClientRect().width>e&&(a.style.width="min-content",a.style.maxWidth=`${e}px`)}})],whileElementsMounted:mt.autoUpdate}),{refs:Fe,context:Y,x:Ke,y:Qe,strategy:Ze}=Je,et=A.useClick(Y),Pe=A.useInteractions([...m&&!c&&I==="input"&&!_?[et]:[],A.useDismiss(Y,{outsidePress:e=>{const t=e.target;return!(t!=null&&t.closest('[role="menu"], [role="listbox"]'))}}),A.useRole(Y,{role:"dialog"})]),tt=()=>{var t;const e=(t=Ce.current)==null?void 0:t.input;if(e){if(typeof e.showPicker=="function")try{e.showPicker();return}catch{}e.focus()}},ie=()=>{!m||R||(c?tt():_?_e(!0):q(e=>!e))},at=e=>{if(h(!1),u||b(e),r==null||r(e,e,{},{}),e){const t=d?d(e):M(e);D(t)}else D("")},rt=e=>{if(!e){h(!1),u||b(void 0),r==null||r(void 0,void 0,{},{});return}const[t,a,f]=e.split("-").map(Number);if(!t||!a||!f)return;const s=new Date(t,a-1,f);if(!Number.isNaN(s.getTime())){if(k(s)){h(!0);return}h(!1),u||b(s),r==null||r(s,s,{},{})}};return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:j.default(y.default["tedi-date-field__container"],Re),...Pe.getReferenceProps(_&&I==="input"?{onClick:()=>ie()}:void 0),ref:Fe.setReference,children:l==="multiple"?g.jsx(ot.MultiValueField,{...o,id:le,label:de,values:ke.map(e=>e.label),icon:"calendar_today",onIconClick:ie,iconButtonProps:m?{"aria-expanded":_?ee:p,"aria-haspopup":"dialog"}:void 0,isClearable:!0,required:S,onChange:e=>{if(!Array.isArray(n))return;const t=ke.filter(a=>e.includes(a.label)).map(a=>a.date);u||b(t),r==null||r(t,{},{},{})},className:j.default(y.default["tedi-date-field__textfield"],{[y.default["tedi-date-field__icon--disabled"]]:!m||R})}):g.jsx(lt.TextField,{...o,ref:$e,id:le,label:de,readOnly:R,value:c?He:Le,placeholder:Ee,icon:"calendar_today","aria-expanded":m&&!c?p:void 0,isClearable:!0,onIconClick:ie,iconButtonProps:m&&!c?{"aria-expanded":_?ee:p,"aria-haspopup":"dialog"}:void 0,onChange:e=>c?rt(e):Xe(e),required:S,invalid:Me||(o==null?void 0:o.invalid),helper:(()=>{const e=o==null?void 0:o.helper,t=Me?{text:Te,type:"error"}:null;return t?e?Array.isArray(e)?[...e,t]:[e,t]:t:e})(),className:j.default(y.default["tedi-date-field__textfield"],{[y.default["tedi-date-field__textfield--disabled"]]:o==null?void 0:o.disabled,[y.default["tedi-date-field__icon--disabled"]]:!m||R}),input:{...o==null?void 0:o.input,...c&&{type:"date"},...m&&!c&&I==="input"?{"aria-haspopup":"dialog","aria-expanded":p}:{}}})}),_&&g.jsx(dt.DatePickerModal,{open:ee,onOpenChange:_e,value:n,onConfirm:at,mode:l,numberOfMonths:Ae,locale:me,localeCode:$,showOutsideDays:ue,disabledMatchers:W,required:S,availableDays:ye,footer:pe,monthYearSelectType:fe,showNavigation:ce,selectionLevel:E,initialView:L,initialMonth:U,modalProps:Be,...be,title:je}),m&&!c&&!_&&g.jsx(A.FloatingPortal,{children:p&&g.jsx(A.FloatingFocusManager,{context:Y,modal:!1,initialFocus:-1,children:g.jsx("div",{ref:Fe.setFloating,className:j.default({[y.default["tedi-date-field__calendar-popover--fullwidth"]]:C}),...Pe.getFloatingProps({style:{position:Ze,top:Qe??0,left:C?0:Ke??0,right:C?0:void 0}}),children:g.jsx(nt.Calendar,{...be,numberOfMonths:Ae,view:Se,selectionLevel:E,currentMonth:We,setCurrentMonth:ae,setView:xe,mode:l,value:n,locale:me,localeCode:$,showOutsideDays:ue,disabledMatchers:W,required:S,availableDays:ye,footer:pe,monthYearSelectType:fe,showNavigation:ce,handleSelect:Ye,applyValue:Ge,className:j.default(y.default["tedi-date-field__calendar"],{[y.default["tedi-date-field__calendar--fullwidth"]]:C})})})})})]})});we.displayName="DateField";exports.DateField=we;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DateRange, DayPickerProps, Locale, Matcher, OnSelectHandler } from 'react-day-picker';
|
|
3
|
-
import { BreakpointSupport } from '../../../helpers';
|
|
3
|
+
import { Breakpoint, BreakpointSupport } from '../../../helpers';
|
|
4
|
+
import { ModalContentProps } from '../../overlays/modal/modal-content/modal-content';
|
|
4
5
|
import { MultiValueFieldProps } from '../multi-value-field/multi-value-field';
|
|
5
6
|
import { TextFieldForwardRef, TextFieldProps } from '../textfield/textfield';
|
|
7
|
+
export type DateFieldModal = boolean | Exclude<Breakpoint, 'xs'>;
|
|
6
8
|
export type DateFieldMode = 'single' | 'multiple' | 'range';
|
|
7
9
|
export type CalendarView = 'days' | 'months' | 'years';
|
|
8
10
|
export type DateFieldCalendarTrigger = 'input' | 'button';
|
|
@@ -30,9 +32,9 @@ type DateFieldBreakpointProps = {
|
|
|
30
32
|
*/
|
|
31
33
|
useNativePicker?: boolean;
|
|
32
34
|
/**
|
|
33
|
-
* Number of months shown side-by-side.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
35
|
+
* Number of months shown side-by-side. In the **popover** on mobile (`< md`) values > 1 are
|
|
36
|
+
* clamped to 1 — a multi-month popover gets unscrollable on a phone viewport. In a **modal** the
|
|
37
|
+
* count is kept: the months wrap to a vertical stack and the modal body scrolls.
|
|
36
38
|
*/
|
|
37
39
|
numberOfMonths?: number;
|
|
38
40
|
};
|
|
@@ -128,6 +130,13 @@ export interface DateFieldProps extends BreakpointSupport<DateFieldBreakpointPro
|
|
|
128
130
|
* @default dropdown
|
|
129
131
|
*/
|
|
130
132
|
monthYearSelectType?: 'dropdown' | 'grid';
|
|
133
|
+
/**
|
|
134
|
+
* Show or hide the calendar header's previous/next navigation. When hidden, the month/year header
|
|
135
|
+
* also becomes a static, non-interactive label (no dropdown / grid jumping) — so the calendar is
|
|
136
|
+
* locked to the visible month(s): a clean "pick from these" view for a fixed month or range.
|
|
137
|
+
* @default true
|
|
138
|
+
*/
|
|
139
|
+
showNavigation?: boolean;
|
|
131
140
|
/**
|
|
132
141
|
* **Selection granularity** — controls the level at which a click finalises
|
|
133
142
|
* the date selection rather than drilling further into days. Use a coarser
|
|
@@ -145,6 +154,16 @@ export interface DateFieldProps extends BreakpointSupport<DateFieldBreakpointPro
|
|
|
145
154
|
* @default 'days'
|
|
146
155
|
*/
|
|
147
156
|
selectionLevel?: CalendarView;
|
|
157
|
+
/**
|
|
158
|
+
* **Initial grid** the calendar opens on, independent of `selectionLevel`.
|
|
159
|
+
* Use it to start the user on the year / month grid for fast year-first
|
|
160
|
+
* navigation while still letting them drill down and commit at the
|
|
161
|
+
* `selectionLevel` (e.g. `initialView="years"` with the default
|
|
162
|
+
* `selectionLevel="days"` opens the year grid → month grid → day grid).
|
|
163
|
+
* Pair with `monthYearSelectType="grid"` so the navigation stays grid-based.
|
|
164
|
+
* @default selectionLevel
|
|
165
|
+
*/
|
|
166
|
+
initialView?: CalendarView;
|
|
148
167
|
/**
|
|
149
168
|
* The locale object for the calendar, used by React DayPicker. Defaults to Estonian locale.
|
|
150
169
|
*/
|
|
@@ -211,6 +230,34 @@ export interface DateFieldProps extends BreakpointSupport<DateFieldBreakpointPro
|
|
|
211
230
|
* Props to pass down to the underlying TextField (in 'single' mode) or MultiValueField (in 'multiple' mode). This allows for additional customization of the input field, such as adding custom styles, attributes, or event handlers.
|
|
212
231
|
*/
|
|
213
232
|
inputProps?: DateTextFieldProps | DateMultiValueFieldProps;
|
|
233
|
+
/**
|
|
234
|
+
* Open the calendar inside a modal instead of a floating popover. Useful
|
|
235
|
+
* on narrow viewports where a popover overlaps the input itself. Mirrors
|
|
236
|
+
* `TimeField`'s `modal` prop.
|
|
237
|
+
*
|
|
238
|
+
* - `true` always opens in a modal
|
|
239
|
+
* - `false` (default) always uses the popover
|
|
240
|
+
* - A breakpoint name (e.g. `'md'`) opens in a modal *below* that breakpoint
|
|
241
|
+
* and falls back to the popover from that breakpoint up
|
|
242
|
+
*
|
|
243
|
+
* Ignored when `useNativePicker` resolves to `true` (the native picker is
|
|
244
|
+
* already handled by the OS).
|
|
245
|
+
* @default false
|
|
246
|
+
*/
|
|
247
|
+
modal?: DateFieldModal;
|
|
248
|
+
/**
|
|
249
|
+
* Extra props forwarded to the calendar modal's `Modal.Content` — e.g. `size`, `width`, `maxWidth`,
|
|
250
|
+
* `position`, `fullscreen`, and per-breakpoint overrides. Lets the consumer tune the modal beyond
|
|
251
|
+
* its responsive-width defaults. `className` is merged with the component's own (so the internal
|
|
252
|
+
* layout is preserved). Only applies when the calendar opens as a modal.
|
|
253
|
+
*/
|
|
254
|
+
modalProps?: Omit<ModalContentProps, 'children'>;
|
|
255
|
+
/**
|
|
256
|
+
* Heading shown at the top of the calendar modal. Falls back to the `date-field.modal-title`
|
|
257
|
+
* label. Handy for month/year-only pickers (e.g. `"Vali kuu"` / `"Vali aasta"`). Only applies when
|
|
258
|
+
* the calendar opens as a modal.
|
|
259
|
+
*/
|
|
260
|
+
modalTitle?: string;
|
|
214
261
|
/**
|
|
215
262
|
* Error message rendered below the input when the user types a date that
|
|
216
263
|
* matches one of the disable matchers (`disablePast`, `disableFuture`,
|