@tedi-design-system/react 18.2.0-rc.2 → 18.2.0-rc.4
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/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/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/content/calendar/calendar.cjs.js +1 -1
- package/src/tedi/components/content/calendar/calendar.d.ts +39 -3
- package/src/tedi/components/content/calendar/calendar.es.js +121 -101
- package/src/tedi/components/content/calendar/calendar.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/calendar/calendar.module.scss.es.js +5 -2
- 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.d.ts +4 -2
- package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.es.js +42 -42
- 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 +1 -0
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +10 -1
- package/src/tedi/components/form/date-field/date-field.es.js +221 -218
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.d.ts +3 -0
- package/src/tedi/components/form/date-field/date-picker-modal/date-picker-modal.es.js +41 -39
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("../../../../../external/classnames/index.cjs.js"),a=require("./calendar.module.scss.cjs.js"),I=require("./components/calendar-header/calendar-header.cjs.js"),L=require("./components/calendar-month-grid/calendar-month-grid.cjs.js"),T=require("./components/calendar-year-grid/calendar-year-grid.cjs.js"),V=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),z=require("../../../../../external/react-day-picker/dist/esm/locale/et.cjs.js"),R=require("../../../../../external/react-day-picker/dist/esm/DayPicker.cjs.js"),k=require("../../../../../external/react-day-picker/dist/esm/components/DayButton.cjs.js"),U=require("../../tags/status-indicator/status-indicator.cjs.js"),x=_=>{const{getCurrentBreakpointProps:C}=V.useBreakpointProps(_.defaultServerBreakpoint),{view:c="days",selectionLevel:y="days",currentMonth:u,setCurrentMonth:s,setView:i=()=>"days",mode:q="single",value:d,locale:M=z.et,localeCode:m="et-EE",showOutsideDays:A=!0,disabledMatchers:G,required:Y,availableDays:n,unavailableDays:l,footer:B,monthYearSelectType:P,dayStatus:h,handleSelect:O,applyValue:b,showNavigation:f=!0,className:v,bordered:W=!0,fullWidth:g=!1,...E}=C(_),p=W?void 0:a.default["tedi-calendar--borderless"],D=g?a.default["tedi-calendar--full-width"]:void 0,w=S.default(p,D,v),j=e=>n?Array.isArray(n)?n.some(r=>r.toDateString()===e.toDateString()):n(e):!0,N=e=>l?Array.isArray(l)?l.some(r=>r.toDateString()===e.toDateString()):l(e):!1,o=[...G??[],...n?[e=>!j(e)]:[],...l?[e=>N(e)]:[]],F=(()=>{switch(q){case"multiple":return{mode:"multiple",selected:Array.isArray(d)?d:void 0};case"range":return{mode:"range",selected:d&&!Array.isArray(d)&&!(d instanceof Date)?d:void 0};default:return{mode:"single",selected:d instanceof Date?d:void 0}}})();return t.jsxs("div",{className:a.default["tedi-calendar__wrapper"],children:[c==="years"&&t.jsx(T.YearGrid,{currentMonth:u,onNavigate:s,showNavigation:f,onSelectYear:e=>{s(e),y==="years"?b(new Date(e.getFullYear(),0,1)):i("months")},className:w}),c==="months"&&t.jsx(L.MonthGrid,{currentMonth:u,onNavigate:s,showNavigation:f,localeCode:m,onSelectMonth:e=>{s(e),y==="months"?b(e):i("days")},className:w}),c==="days"&&t.jsx(R.DayPicker,{...E,...F,locale:M,month:u,onMonthChange:s,showOutsideDays:A,disabled:o.length?o:void 0,required:Y,components:{MonthCaption:e=>t.jsx(I.CalendarHeader,{...e,monthYearSelectType:P,onOpenMonthGrid:()=>i("months"),onOpenYearGrid:()=>i("years"),showNavigation:f,localeCode:m,disabledMatchers:o.length?o:void 0}),Nav:()=>t.jsx(t.Fragment,{}),...h?{DayButton:e=>{const r=h(e.day.date);if(!r)return t.jsx(k.DayButton,{...e});const H=[e["aria-label"],r.label].filter(Boolean).join(", ");return t.jsxs(k.DayButton,{...e,"aria-label":H,children:[e.children,t.jsx(U.StatusIndicator,{type:r.type,size:"sm",className:a.default["tedi-calendar__day-status"]})]})}}:{},...g?{Weekday:({children:e,...r})=>t.jsx("th",{...r,children:t.jsx("span",{className:a.default["tedi-calendar__weekday-inner"],children:e})})}:{}},footer:B,classNames:{root:S.default(a.default["tedi-calendar"],p,D,v),month_caption:a.default["tedi-calendar__caption"],head:a.default["tedi-calendar__head"],row:a.default["tedi-calendar__row"],day:a.default["tedi-calendar__day"],selected:a.default["tedi-calendar__day--selected"],weekday:a.default["tedi-calendar__weekday"],outside:a.default["tedi-calendar__outside-days"],range_start:a.default["tedi-calendar__range-start"],range_middle:a.default["tedi-calendar__range-middle"],range_end:a.default["tedi-calendar__range-end"],today:a.default["tedi-calendar__today"],disabled:a.default["tedi-calendar__disabled"],month:a.default["tedi-calendar__month"],months:a.default["tedi-calendar__months-container"],footer:a.default["tedi-calendar__footer"],week_number:a.default["tedi-calendar__week-number"]},modifiers:{available:e=>n?j(e):!1,unavailable:e=>l?N(e):!1},modifiersClassNames:{available:a.default["tedi-calendar__available-day"],unavailable:a.default["tedi-calendar__unavailable-day"]},onSelect:O})]})};x.displayName="Calendar";exports.Calendar=x;
|
|
@@ -1,7 +1,25 @@
|
|
|
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
4
|
import { CalendarView, DateFieldMode } from '../../form/date-field/date-field';
|
|
4
|
-
|
|
5
|
+
import { StatusIndicatorType } from '../../tags/status-indicator';
|
|
6
|
+
export interface DayStatus {
|
|
7
|
+
/**
|
|
8
|
+
* Status type driving the indicator colour. Maps to `StatusIndicator`'s `type`.
|
|
9
|
+
*/
|
|
10
|
+
type: StatusIndicatorType;
|
|
11
|
+
/**
|
|
12
|
+
* Accessible label for the status. Appended to the day button's `aria-label`
|
|
13
|
+
* so screen readers announce the date together with its status — required
|
|
14
|
+
* because the indicator dot itself is decorative (`aria-hidden`).
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves a `DayStatus` for a given day, or `null`/`undefined` for no status.
|
|
20
|
+
*/
|
|
21
|
+
export type DayStatusFn = (date: Date) => DayStatus | null | undefined;
|
|
22
|
+
interface CalendarBreakpointProps extends Omit<DayPickerProps, 'mode' | 'selected' | 'onSelect'> {
|
|
5
23
|
/**
|
|
6
24
|
* Current view of the calendar. Can be `'days'`, `'months'`, or `'years'`.
|
|
7
25
|
* Controls which calendar grid is displayed.
|
|
@@ -87,9 +105,19 @@ export interface CalendarProps extends Omit<DayPickerProps, 'mode' | 'selected'
|
|
|
87
105
|
* Forwarded to the internal `CalendarHeader`.
|
|
88
106
|
* - `'dropdown'` (default) — each picker is a `<Select>` dropdown.
|
|
89
107
|
* - `'grid'` — each picker opens a full grid of options.
|
|
108
|
+
* - `'static'` — the month/year is a plain, non-clickable label; only the
|
|
109
|
+
* prev/next navigation buttons can change the month. Use to disable
|
|
110
|
+
* month/year selection.
|
|
90
111
|
* @default dropdown
|
|
91
112
|
*/
|
|
92
|
-
monthYearSelectType?: 'dropdown' | 'grid';
|
|
113
|
+
monthYearSelectType?: 'dropdown' | 'grid' | 'static';
|
|
114
|
+
/**
|
|
115
|
+
* Optional per-day status. Called for each rendered day; return a
|
|
116
|
+
* `{ type, label }` to overlay a `StatusIndicator` dot on that day (the
|
|
117
|
+
* `label` is folded into the day's `aria-label`), or `null` / `undefined` for
|
|
118
|
+
* no status.
|
|
119
|
+
*/
|
|
120
|
+
dayStatus?: DayStatusFn;
|
|
93
121
|
/**
|
|
94
122
|
* Callback fired when a date or date range is selected. Receives the selected value, day, modifiers, and event.
|
|
95
123
|
*/
|
|
@@ -116,8 +144,16 @@ export interface CalendarProps extends Omit<DayPickerProps, 'mode' | 'selected'
|
|
|
116
144
|
* @default true
|
|
117
145
|
*/
|
|
118
146
|
bordered?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Grow to fill the container's width instead of a fixed width; cells keep a
|
|
149
|
+
* square aspect ratio. Wrap in a sized container to control the scale.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
fullWidth?: boolean;
|
|
119
153
|
}
|
|
154
|
+
export type CalendarProps = BreakpointSupport<CalendarBreakpointProps>;
|
|
120
155
|
export declare const Calendar: {
|
|
121
|
-
(
|
|
156
|
+
(props: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
122
157
|
displayName: string;
|
|
123
158
|
};
|
|
159
|
+
export {};
|
|
@@ -1,138 +1,158 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { CalendarHeader as
|
|
5
|
-
import { MonthGrid as
|
|
6
|
-
import { YearGrid as
|
|
7
|
-
import {
|
|
8
|
-
import { et as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import { jsxs as S, jsx as t, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import k from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import a from "./calendar.module.scss.es.js";
|
|
4
|
+
import { CalendarHeader as z } from "./components/calendar-header/calendar-header.es.js";
|
|
5
|
+
import { MonthGrid as H } from "./components/calendar-month-grid/calendar-month-grid.es.js";
|
|
6
|
+
import { YearGrid as I } from "./components/calendar-year-grid/calendar-year-grid.es.js";
|
|
7
|
+
import { useBreakpointProps as T } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
8
|
+
import { et as U } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
|
|
9
|
+
import { DayPicker as J } from "../../../../../external/react-day-picker/dist/esm/DayPicker.es.js";
|
|
10
|
+
import { DayButton as A } from "../../../../../external/react-day-picker/dist/esm/components/DayButton.es.js";
|
|
11
|
+
import { StatusIndicator as K } from "../../tags/status-indicator/status-indicator.es.js";
|
|
12
|
+
const Q = (u) => {
|
|
13
|
+
const { getCurrentBreakpointProps: M } = T(u.defaultServerBreakpoint), {
|
|
14
|
+
view: c = "days",
|
|
15
|
+
selectionLevel: y = "days",
|
|
16
|
+
currentMonth: m,
|
|
17
|
+
setCurrentMonth: l,
|
|
18
|
+
setView: s = () => "days",
|
|
19
|
+
mode: Y = "single",
|
|
20
|
+
value: n,
|
|
21
|
+
locale: G = U,
|
|
22
|
+
localeCode: h = "et-EE",
|
|
23
|
+
showOutsideDays: j = !0,
|
|
24
|
+
disabledMatchers: x,
|
|
25
|
+
required: O,
|
|
26
|
+
availableDays: i,
|
|
27
|
+
unavailableDays: d,
|
|
28
|
+
footer: W,
|
|
29
|
+
monthYearSelectType: B,
|
|
30
|
+
dayStatus: f,
|
|
31
|
+
handleSelect: E,
|
|
32
|
+
applyValue: p,
|
|
33
|
+
showNavigation: _ = !0,
|
|
34
|
+
className: v,
|
|
35
|
+
bordered: F = !0,
|
|
36
|
+
fullWidth: b = !1,
|
|
37
|
+
...L
|
|
38
|
+
} = M(u), g = F ? void 0 : a["tedi-calendar--borderless"], w = b ? a["tedi-calendar--full-width"] : void 0, N = k(g, w, v), D = (e) => i ? Array.isArray(i) ? i.some((r) => r.toDateString() === e.toDateString()) : i(e) : !0, C = (e) => d ? Array.isArray(d) ? d.some((r) => r.toDateString() === e.toDateString()) : d(e) : !1, o = [
|
|
39
|
+
...x ?? [],
|
|
40
|
+
...i ? [(e) => !D(e)] : [],
|
|
41
|
+
...d ? [(e) => C(e)] : []
|
|
42
|
+
], P = (() => {
|
|
43
|
+
switch (Y) {
|
|
39
44
|
case "multiple":
|
|
40
|
-
return { mode: "multiple", selected: Array.isArray(
|
|
45
|
+
return { mode: "multiple", selected: Array.isArray(n) ? n : void 0 };
|
|
41
46
|
case "range":
|
|
42
47
|
return {
|
|
43
48
|
mode: "range",
|
|
44
|
-
selected:
|
|
49
|
+
selected: n && !Array.isArray(n) && !(n instanceof Date) ? n : void 0
|
|
45
50
|
};
|
|
46
51
|
default:
|
|
47
|
-
return { mode: "single", selected:
|
|
52
|
+
return { mode: "single", selected: n instanceof Date ? n : void 0 };
|
|
48
53
|
}
|
|
49
54
|
})();
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
c === "years" && /* @__PURE__ */
|
|
52
|
-
|
|
55
|
+
return /* @__PURE__ */ S("div", { className: a["tedi-calendar__wrapper"], children: [
|
|
56
|
+
c === "years" && /* @__PURE__ */ t(
|
|
57
|
+
I,
|
|
53
58
|
{
|
|
54
|
-
currentMonth:
|
|
55
|
-
onNavigate:
|
|
56
|
-
showNavigation:
|
|
59
|
+
currentMonth: m,
|
|
60
|
+
onNavigate: l,
|
|
61
|
+
showNavigation: _,
|
|
57
62
|
onSelectYear: (e) => {
|
|
58
|
-
|
|
63
|
+
l(e), y === "years" ? p(new Date(e.getFullYear(), 0, 1)) : s("months");
|
|
59
64
|
},
|
|
60
|
-
className:
|
|
65
|
+
className: N
|
|
61
66
|
}
|
|
62
67
|
),
|
|
63
|
-
c === "months" && /* @__PURE__ */
|
|
64
|
-
|
|
68
|
+
c === "months" && /* @__PURE__ */ t(
|
|
69
|
+
H,
|
|
65
70
|
{
|
|
66
|
-
currentMonth:
|
|
67
|
-
onNavigate:
|
|
68
|
-
showNavigation:
|
|
69
|
-
localeCode:
|
|
71
|
+
currentMonth: m,
|
|
72
|
+
onNavigate: l,
|
|
73
|
+
showNavigation: _,
|
|
74
|
+
localeCode: h,
|
|
70
75
|
onSelectMonth: (e) => {
|
|
71
|
-
|
|
76
|
+
l(e), y === "months" ? p(e) : s("days");
|
|
72
77
|
},
|
|
73
|
-
className:
|
|
78
|
+
className: N
|
|
74
79
|
}
|
|
75
80
|
),
|
|
76
|
-
c === "days" && /* @__PURE__ */
|
|
77
|
-
|
|
81
|
+
c === "days" && /* @__PURE__ */ t(
|
|
82
|
+
J,
|
|
78
83
|
{
|
|
79
|
-
...
|
|
80
|
-
...
|
|
81
|
-
locale:
|
|
82
|
-
month:
|
|
83
|
-
onMonthChange:
|
|
84
|
-
showOutsideDays:
|
|
85
|
-
disabled:
|
|
86
|
-
required:
|
|
84
|
+
...L,
|
|
85
|
+
...P,
|
|
86
|
+
locale: G,
|
|
87
|
+
month: m,
|
|
88
|
+
onMonthChange: l,
|
|
89
|
+
showOutsideDays: j,
|
|
90
|
+
disabled: o.length ? o : void 0,
|
|
91
|
+
required: O,
|
|
87
92
|
components: {
|
|
88
|
-
MonthCaption: (e) => /* @__PURE__ */
|
|
89
|
-
|
|
93
|
+
MonthCaption: (e) => /* @__PURE__ */ t(
|
|
94
|
+
z,
|
|
90
95
|
{
|
|
91
96
|
...e,
|
|
92
|
-
monthYearSelectType:
|
|
93
|
-
onOpenMonthGrid: () =>
|
|
94
|
-
onOpenYearGrid: () =>
|
|
95
|
-
showNavigation:
|
|
96
|
-
localeCode:
|
|
97
|
-
disabledMatchers:
|
|
97
|
+
monthYearSelectType: B,
|
|
98
|
+
onOpenMonthGrid: () => s("months"),
|
|
99
|
+
onOpenYearGrid: () => s("years"),
|
|
100
|
+
showNavigation: _,
|
|
101
|
+
localeCode: h,
|
|
102
|
+
disabledMatchers: o.length ? o : void 0
|
|
98
103
|
}
|
|
99
104
|
),
|
|
100
|
-
Nav: () => /* @__PURE__ */
|
|
105
|
+
Nav: () => /* @__PURE__ */ t(q, {}),
|
|
106
|
+
...f ? {
|
|
107
|
+
DayButton: (e) => {
|
|
108
|
+
const r = f(e.day.date);
|
|
109
|
+
if (!r)
|
|
110
|
+
return /* @__PURE__ */ t(A, { ...e });
|
|
111
|
+
const V = [e["aria-label"], r.label].filter(Boolean).join(", ");
|
|
112
|
+
return /* @__PURE__ */ S(A, { ...e, "aria-label": V, children: [
|
|
113
|
+
e.children,
|
|
114
|
+
/* @__PURE__ */ t(K, { type: r.type, size: "sm", className: a["tedi-calendar__day-status"] })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
} : {},
|
|
118
|
+
...b ? {
|
|
119
|
+
Weekday: ({ children: e, ...r }) => /* @__PURE__ */ t("th", { ...r, children: /* @__PURE__ */ t("span", { className: a["tedi-calendar__weekday-inner"], children: e }) })
|
|
120
|
+
} : {}
|
|
101
121
|
},
|
|
102
|
-
footer:
|
|
122
|
+
footer: W,
|
|
103
123
|
classNames: {
|
|
104
|
-
root:
|
|
105
|
-
month_caption:
|
|
106
|
-
head:
|
|
107
|
-
row:
|
|
108
|
-
day:
|
|
109
|
-
selected:
|
|
110
|
-
weekday:
|
|
111
|
-
outside:
|
|
112
|
-
range_start:
|
|
113
|
-
range_middle:
|
|
114
|
-
range_end:
|
|
115
|
-
today:
|
|
116
|
-
disabled:
|
|
117
|
-
month:
|
|
118
|
-
months:
|
|
119
|
-
footer:
|
|
120
|
-
week_number:
|
|
124
|
+
root: k(a["tedi-calendar"], g, w, v),
|
|
125
|
+
month_caption: a["tedi-calendar__caption"],
|
|
126
|
+
head: a["tedi-calendar__head"],
|
|
127
|
+
row: a["tedi-calendar__row"],
|
|
128
|
+
day: a["tedi-calendar__day"],
|
|
129
|
+
selected: a["tedi-calendar__day--selected"],
|
|
130
|
+
weekday: a["tedi-calendar__weekday"],
|
|
131
|
+
outside: a["tedi-calendar__outside-days"],
|
|
132
|
+
range_start: a["tedi-calendar__range-start"],
|
|
133
|
+
range_middle: a["tedi-calendar__range-middle"],
|
|
134
|
+
range_end: a["tedi-calendar__range-end"],
|
|
135
|
+
today: a["tedi-calendar__today"],
|
|
136
|
+
disabled: a["tedi-calendar__disabled"],
|
|
137
|
+
month: a["tedi-calendar__month"],
|
|
138
|
+
months: a["tedi-calendar__months-container"],
|
|
139
|
+
footer: a["tedi-calendar__footer"],
|
|
140
|
+
week_number: a["tedi-calendar__week-number"]
|
|
121
141
|
},
|
|
122
142
|
modifiers: {
|
|
123
|
-
available: (e) =>
|
|
124
|
-
unavailable: (e) =>
|
|
143
|
+
available: (e) => i ? D(e) : !1,
|
|
144
|
+
unavailable: (e) => d ? C(e) : !1
|
|
125
145
|
},
|
|
126
146
|
modifiersClassNames: {
|
|
127
|
-
available:
|
|
128
|
-
unavailable:
|
|
147
|
+
available: a["tedi-calendar__available-day"],
|
|
148
|
+
unavailable: a["tedi-calendar__unavailable-day"]
|
|
129
149
|
},
|
|
130
|
-
onSelect:
|
|
150
|
+
onSelect: E
|
|
131
151
|
}
|
|
132
152
|
)
|
|
133
153
|
] });
|
|
134
154
|
};
|
|
135
|
-
|
|
155
|
+
Q.displayName = "Calendar";
|
|
136
156
|
export {
|
|
137
|
-
|
|
157
|
+
Q as Calendar
|
|
138
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-calendar__picker-grid-container":"tedi-calendar__picker-grid-container-1b2bfc55","tedi-calendar__week-number":"tedi-calendar__week-number-c1a67f28","tedi-calendar__day":"tedi-calendar__day-baa13412","tedi-calendar__weekday":"tedi-calendar__weekday-9dce46ba","tedi-calendar":"tedi-calendar-a8c2a0a4","tedi-calendar--borderless":"tedi-calendar--borderless-22d5d627","tedi-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-calendar__picker-grid-container":"tedi-calendar__picker-grid-container-1b2bfc55","tedi-calendar__week-number":"tedi-calendar__week-number-c1a67f28","tedi-calendar__day":"tedi-calendar__day-baa13412","tedi-calendar__weekday":"tedi-calendar__weekday-9dce46ba","tedi-calendar":"tedi-calendar-a8c2a0a4","tedi-calendar--borderless":"tedi-calendar--borderless-22d5d627","tedi-calendar--full-width":"tedi-calendar--full-width-afc9e29f","tedi-calendar__month":"tedi-calendar__month-b0e4d350","tedi-calendar__weekday-inner":"tedi-calendar__weekday-inner-1e76dfb4","tedi-calendar__today":"tedi-calendar__today-fa050850","tedi-calendar__months-container":"tedi-calendar__months-container-793f3f7b","tedi-calendar__footer":"tedi-calendar__footer-bb297fb5","tedi-calendar__head":"tedi-calendar__head-bbd962e1","tedi-calendar__disabled":"tedi-calendar__disabled-30620859","tedi-calendar__day--selected":"tedi-calendar__day--selected-9f3dc090","tedi-calendar__day-status":"tedi-calendar__day-status-20d8d064","tedi-calendar__available-day":"tedi-calendar__available-day-a0b09cf3","tedi-calendar__unavailable-day":"tedi-calendar__unavailable-day-05d8742d","tedi-calendar__range-middle":"tedi-calendar__range-middle-fa3459d1","tedi-calendar__range-start":"tedi-calendar__range-start-aaf20ea3","tedi-calendar__range-end":"tedi-calendar__range-end-097f2a3b","tedi-calendar__outside-days":"tedi-calendar__outside-days-703857de","tedi-calendar__picker-grid":"tedi-calendar__picker-grid-9b167adf","tedi-calendar__picker-grid-header":"tedi-calendar__picker-grid-header-30f8748f","tedi-calendar__picker--no-navigation":"tedi-calendar__picker--no-navigation-695a34ca","tedi-calendar__grid-button":"tedi-calendar__grid-button-889a2a85","tedi-calendar__grid-button--selected":"tedi-calendar__grid-button--selected-2019301b"};exports.default=e;
|
|
@@ -5,13 +5,16 @@ const e = {
|
|
|
5
5
|
"tedi-calendar__weekday": "tedi-calendar__weekday-9dce46ba",
|
|
6
6
|
"tedi-calendar": "tedi-calendar-a8c2a0a4",
|
|
7
7
|
"tedi-calendar--borderless": "tedi-calendar--borderless-22d5d627",
|
|
8
|
-
"tedi-
|
|
8
|
+
"tedi-calendar--full-width": "tedi-calendar--full-width-afc9e29f",
|
|
9
9
|
"tedi-calendar__month": "tedi-calendar__month-b0e4d350",
|
|
10
|
+
"tedi-calendar__weekday-inner": "tedi-calendar__weekday-inner-1e76dfb4",
|
|
11
|
+
"tedi-calendar__today": "tedi-calendar__today-fa050850",
|
|
12
|
+
"tedi-calendar__months-container": "tedi-calendar__months-container-793f3f7b",
|
|
10
13
|
"tedi-calendar__footer": "tedi-calendar__footer-bb297fb5",
|
|
11
14
|
"tedi-calendar__head": "tedi-calendar__head-bbd962e1",
|
|
12
15
|
"tedi-calendar__disabled": "tedi-calendar__disabled-30620859",
|
|
13
16
|
"tedi-calendar__day--selected": "tedi-calendar__day--selected-9f3dc090",
|
|
14
|
-
"tedi-
|
|
17
|
+
"tedi-calendar__day-status": "tedi-calendar__day-status-20d8d064",
|
|
15
18
|
"tedi-calendar__available-day": "tedi-calendar__available-day-a0b09cf3",
|
|
16
19
|
"tedi-calendar__unavailable-day": "tedi-calendar__unavailable-day-05d8742d",
|
|
17
20
|
"tedi-calendar__range-middle": "tedi-calendar__range-middle-fa3459d1",
|
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"),p=require("../../../../base/icon/icon.cjs.js"),
|
|
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"),v=require("../../../../base/typography/text/text.cjs.js"),c=require("../../../../buttons/button/button.cjs.js"),r=require("./calendar-header.module.scss.cjs.js"),F=require("../../../../../providers/label-provider/use-labels.cjs.js"),A=require("../../../../../../../external/react-day-picker/dist/esm/types/deprecated.cjs.js"),H=require("../../../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.cjs.js"),l=require("../../../../overlays/dropdown/dropdown.cjs.js");function O({calendarMonth:N,monthYearSelectType:D="dropdown",onOpenMonthGrid:q,onOpenYearGrid:C,showNavigation:u=!0,localeCode:_,disabledMatchers:o}){const x=D==="grid",I=D==="static"||!u,{getLabel:f}=F.useLabels(),{goToMonth:m,nextMonth:S,previousMonth:k}=A.useNavigation(),i=N.date,a=i.getFullYear(),h=i.getMonth(),L=Array.from({length:12},(n,t)=>new Date(a,t,1).toLocaleString(_,{month:"long"})),T=new Date().getFullYear(),s=Array.from({length:21},(n,t)=>T-10+t),w=j.useCallback((n,t)=>{if(!(o!=null&&o.length))return!1;const d=new Date(n);for(;d<=t;){if(!H.dateMatchModifiers(d,o))return!1;d.setDate(d.getDate()+1)}return!0},[o]),B=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);w(d,g)&&n.add(t)}return n},[o,a,w]),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);w(d,g)&&n.add(t)}return n},[o,s,w]);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:()=>k&&m(k),"aria-label":f("pickers.previousMonth"),icon:"arrow_back",visualType:"neutral",children:f("pickers.previousMonth")}),I?e.jsxs("div",{className:r.default["tedi-calendar__month-year-label"],children:[e.jsx(v.Text,{children:i.toLocaleString(_,{month:"long"})}),e.jsx(v.Text,{children:a})]}):x?e.jsxs("div",{className:r.default["tedi-calendar__title"],children:[e.jsxs(c.Button,{noStyle:!0,className:r.default["tedi-calendar__month-year-selector"],onClick:q,"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("div",{className:r.default["tedi-calendar__title"],children:[e.jsxs(l.Dropdown,{className:y.default(r.default["tedi-calendar__month-year-dropdown"],{[r.default["tedi-calendar__picker-grid-dropdown"]]:x}),width:"auto",defaultActiveIndex:h,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:L.map((n,t)=>e.jsx(l.Dropdown.Item,{index:t,active:h===t,disabled:B.has(t),onClick:()=>m(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"]]:x}),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:()=>m(new Date(n,h)),children:n},n))})]})]}),u&&e.jsx(c.Button,{type:"button",onClick:()=>S&&m(S),visualType:"neutral","aria-label":f("pickers.nextMonth"),icon:"arrow_forward",children:f("pickers.nextMonth")})]})}exports.CalendarHeader=O;
|
package/src/tedi/components/content/calendar/components/calendar-header/calendar-header.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ export interface CalendarHeaderProps extends Pick<MonthCaptionProps, 'calendarMo
|
|
|
4
4
|
* How the month/year selector in the calendar header is rendered.
|
|
5
5
|
* - `'dropdown'` (default) — each picker is a `<Select>` dropdown.
|
|
6
6
|
* - `'grid'` — each picker opens a full grid of options.
|
|
7
|
-
*
|
|
7
|
+
* - `'static'` — the month/year is a plain, non-clickable label; the user can
|
|
8
|
+
* only change the month via the prev/next navigation buttons.
|
|
9
|
+
* @default dropdown
|
|
8
10
|
*/
|
|
9
|
-
monthYearSelectType?: 'dropdown' | 'grid';
|
|
11
|
+
monthYearSelectType?: 'dropdown' | 'grid' | 'static';
|
|
10
12
|
onOpenMonthGrid?: () => void;
|
|
11
13
|
onOpenYearGrid?: () => void;
|
|
12
14
|
/**
|