@tedi-design-system/react 18.0.0-rc.8 → 18.0.0-rc.9
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.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +2 -4
- package/_virtual/index.es5.js +4 -2
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.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/community/components/form/pickers/calendar/calendar.d.ts +6 -0
- package/src/community/components/form/pickers/datepicker/datepicker.d.ts +6 -0
- package/src/community/components/form/pickers/datetimepicker/datetimepicker.d.ts +6 -0
- package/src/community/components/form/pickers/timepicker/timepicker.d.ts +6 -0
- package/src/tedi/components/content/calendar/calendar-grid.cjs.js +1 -1
- package/src/tedi/components/content/calendar/calendar-grid.es.js +7 -6
- 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 +99 -79
- package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -0
- package/src/tedi/components/form/date-field/date-field-helpers.d.ts +66 -0
- package/src/tedi/components/form/date-field/date-field-helpers.es.js +28 -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 +22 -0
- package/src/tedi/components/form/date-field/date-field.es.js +248 -212
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -0
- package/src/tedi/components/form/date-time-field/date-time-field.d.ts +207 -0
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +376 -0
- package/src/tedi/components/form/date-time-field/date-time-field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/date-time-field/date-time-field.module.scss.es.js +30 -0
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +9 -0
- package/src/tedi/components/form/time-field/time-field.es.js +81 -79
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +0 -3
- package/src/tedi/index.d.ts +1 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +28 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +93 -65
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +217 -215
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Locale, Matcher } from 'react-day-picker';
|
|
3
|
+
import { BreakpointSupport } from '../../../helpers';
|
|
4
|
+
import { CalendarView } from '../date-field/date-field';
|
|
5
|
+
import { TextFieldForwardRef, TextFieldProps } from '../textfield/textfield';
|
|
6
|
+
export type DateTimeFieldStep = 'date' | 'time';
|
|
7
|
+
export type DateTimeFieldLayout = 'side-by-side' | 'multi-step';
|
|
8
|
+
export type DateTimeFieldMode = 'single' | 'range';
|
|
9
|
+
export interface DateTimeRange {
|
|
10
|
+
from?: Date;
|
|
11
|
+
to?: Date;
|
|
12
|
+
}
|
|
13
|
+
export type DateTimeFieldValue = Date | DateTimeRange;
|
|
14
|
+
type DateTimeFieldBreakpointProps = {
|
|
15
|
+
/**
|
|
16
|
+
* When `true`, renders an `<input type="datetime-local">` and skips the
|
|
17
|
+
* custom popover entirely — the browser's built-in date/time picker is
|
|
18
|
+
* shown when the calendar icon is clicked. Has no effect when
|
|
19
|
+
* `mode='range'` (native datetime-local has no range counterpart).
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
useNativePicker?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Layout of the date-and-time popover. `mode='range'` always uses
|
|
25
|
+
* `'side-by-side'` regardless of this value — the range UI needs the
|
|
26
|
+
* calendar and both `from` / `to` time pickers visible at once.
|
|
27
|
+
* @default side-by-side
|
|
28
|
+
*/
|
|
29
|
+
layout?: DateTimeFieldLayout;
|
|
30
|
+
/**
|
|
31
|
+
* Predefined time slots, each in `"HH:mm"` format. When provided, the
|
|
32
|
+
* time step renders a grid of slots instead of the scroll-wheel picker.
|
|
33
|
+
*
|
|
34
|
+
* Accepts either:
|
|
35
|
+
* - a static array — the same slot list for every date,
|
|
36
|
+
* - or a function `(date: Date) => string[]` evaluated per render with the
|
|
37
|
+
* currently-selected date. Use the function form when slots depend on
|
|
38
|
+
* the picked date (e.g. clinic appointments where Tuesdays differ from
|
|
39
|
+
* Wednesdays). In `mode='range'` the function is called twice: once
|
|
40
|
+
* with `rangeValue.from` for the `from` time picker, once with
|
|
41
|
+
* `rangeValue.to` for the `to` time picker. When no date is picked yet
|
|
42
|
+
* the function is called with today's date as a fallback.
|
|
43
|
+
*
|
|
44
|
+
* Returning an empty array currently falls back to the wheel picker —
|
|
45
|
+
* if you need a dedicated "no times available" UX, render it from the
|
|
46
|
+
* consumer side via `onChange` / `value` state for now.
|
|
47
|
+
*/
|
|
48
|
+
availableTimes?: string[] | ((date: Date) => string[]);
|
|
49
|
+
/**
|
|
50
|
+
* Layout variant for the time grid when `availableTimes` is set.
|
|
51
|
+
* Defaults differ per layout: `'button'` for `side-by-side`, `'radio'`
|
|
52
|
+
* for `multi-step`.
|
|
53
|
+
*/
|
|
54
|
+
timeGridVariant?: 'button' | 'radio';
|
|
55
|
+
/**
|
|
56
|
+
* How the month/year selector in the calendar header is rendered.
|
|
57
|
+
* @default dropdown
|
|
58
|
+
*/
|
|
59
|
+
monthYearSelectType?: 'dropdown' | 'grid';
|
|
60
|
+
/**
|
|
61
|
+
* Show days from adjacent months in the calendar grid.
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
showOutsideDays?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Heading rendered above the time picker in the side-by-side layout.
|
|
67
|
+
* Falls back to the localised `dateTimeField.timeHeading` label.
|
|
68
|
+
*/
|
|
69
|
+
timeHeading?: React.ReactNode;
|
|
70
|
+
};
|
|
71
|
+
export interface DateTimeFieldProps extends BreakpointSupport<DateTimeFieldBreakpointProps> {
|
|
72
|
+
/**
|
|
73
|
+
* Unique identifier for the input field.
|
|
74
|
+
*/
|
|
75
|
+
id: string;
|
|
76
|
+
/**
|
|
77
|
+
* Field label. Required for accessibility.
|
|
78
|
+
*/
|
|
79
|
+
label: string;
|
|
80
|
+
/**
|
|
81
|
+
* Placeholder shown in the input when no value is selected.
|
|
82
|
+
*/
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Additional class on the container.
|
|
86
|
+
*/
|
|
87
|
+
className?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Selection mode.
|
|
90
|
+
* - `'single'` (default) — one combined `Date` value.
|
|
91
|
+
* - `'range'` — pair of `from` / `to` `Date` values, each carrying their
|
|
92
|
+
* own time. Renders a 2-month calendar and two time pickers (one for
|
|
93
|
+
* `from`, one for `to`) stacked underneath.
|
|
94
|
+
* @default single
|
|
95
|
+
*/
|
|
96
|
+
mode?: DateTimeFieldMode;
|
|
97
|
+
/**
|
|
98
|
+
* Controlled value. Type depends on `mode`:
|
|
99
|
+
* - `mode='single'` → `Date | undefined`
|
|
100
|
+
* - `mode='range'` → `DateTimeRange | undefined` (`{ from, to }`)
|
|
101
|
+
*/
|
|
102
|
+
value?: DateTimeFieldValue;
|
|
103
|
+
/**
|
|
104
|
+
* Initial value for uncontrolled usage. Ignored when `value` is provided.
|
|
105
|
+
*/
|
|
106
|
+
defaultValue?: DateTimeFieldValue;
|
|
107
|
+
/**
|
|
108
|
+
* Fires whenever the user picks a date or a time. The argument shape
|
|
109
|
+
* matches `mode`: `Date | undefined` for `'single'`,
|
|
110
|
+
* `DateTimeRange | undefined` for `'range'`.
|
|
111
|
+
*/
|
|
112
|
+
onChange?: (value: DateTimeFieldValue | undefined) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Marks the field as required.
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
required?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* When `true`, the input is read-only — typing is disabled, but the
|
|
120
|
+
* picker can still be opened.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
readOnly?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Disables the input and the picker.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
disabled?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Minimum selectable date. Dates before this are disabled in the calendar.
|
|
131
|
+
*/
|
|
132
|
+
minDate?: Date;
|
|
133
|
+
/**
|
|
134
|
+
* Maximum selectable date. Dates after this are disabled in the calendar.
|
|
135
|
+
*/
|
|
136
|
+
maxDate?: Date;
|
|
137
|
+
/**
|
|
138
|
+
* Disables every date strictly before today.
|
|
139
|
+
*/
|
|
140
|
+
disablePast?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Disables every date strictly after today.
|
|
143
|
+
*/
|
|
144
|
+
disableFuture?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Disable specific dates via react-day-picker matchers. Layered on top of
|
|
147
|
+
* the `minDate` / `maxDate` / `disablePast` / `disableFuture` shortcuts —
|
|
148
|
+
* use this for free-form matchers like "every Sunday" or "specific
|
|
149
|
+
* blacklisted dates". Mirrors the `disabledMatchers` prop on `DateField`.
|
|
150
|
+
*/
|
|
151
|
+
disabledMatchers?: Matcher | Matcher[];
|
|
152
|
+
/**
|
|
153
|
+
* Step interval (minutes) for the time-wheel picker. Ignored when
|
|
154
|
+
* `availableTimes` is set.
|
|
155
|
+
* @default 15
|
|
156
|
+
*/
|
|
157
|
+
stepMinutes?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Initial month displayed when the calendar opens. Defaults to the
|
|
160
|
+
* month of the current value, or the current month if no value.
|
|
161
|
+
*/
|
|
162
|
+
initialMonth?: Date;
|
|
163
|
+
/**
|
|
164
|
+
* Locale object used by react-day-picker for the calendar grid.
|
|
165
|
+
* @default et
|
|
166
|
+
*/
|
|
167
|
+
locale?: Locale;
|
|
168
|
+
/**
|
|
169
|
+
* Locale code used for the displayed date format.
|
|
170
|
+
* @default et-EE
|
|
171
|
+
*/
|
|
172
|
+
localeCode?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Label of the "Select time" footer button under the calendar in the
|
|
175
|
+
* multi-step layout. Falls back to the localised
|
|
176
|
+
* `dateTimeField.selectTime` label.
|
|
177
|
+
*/
|
|
178
|
+
selectTimeLabel?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Label of the "Back" link shown above the time picker in the
|
|
181
|
+
* multi-step layout. Falls back to the localised `dateTimeField.back`
|
|
182
|
+
* label.
|
|
183
|
+
*/
|
|
184
|
+
backLabel?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Lowest calendar drill-down level the user can pick from before the value
|
|
187
|
+
* commits. `'days'` (default) requires drilling all the way down to a day;
|
|
188
|
+
* `'months'` commits as soon as a month is picked; `'years'` commits on
|
|
189
|
+
* year selection. Only meaningful when `monthYearSelectType='grid'`.
|
|
190
|
+
* @default days
|
|
191
|
+
*/
|
|
192
|
+
selectionLevel?: CalendarView;
|
|
193
|
+
/**
|
|
194
|
+
* Forwarded to the underlying `TextField`. `id`, `label`, `value`, and
|
|
195
|
+
* `onChange` are owned by `DateTimeField`.
|
|
196
|
+
*/
|
|
197
|
+
inputProps?: Omit<TextFieldProps, 'id' | 'label' | 'value' | 'onChange'>;
|
|
198
|
+
/**
|
|
199
|
+
* Error message rendered below the input when the user types a date that
|
|
200
|
+
* fails the disable matchers (`disablePast`, `disableFuture`, `minDate`,
|
|
201
|
+
* `maxDate`, `disabledMatchers`). Falls back to the localised
|
|
202
|
+
* `dateField.disabledDateError` label.
|
|
203
|
+
*/
|
|
204
|
+
disabledDateErrorMessage?: string;
|
|
205
|
+
}
|
|
206
|
+
export declare const DateTimeField: React.ForwardRefExoticComponent<DateTimeFieldProps & React.RefAttributes<TextFieldForwardRef>>;
|
|
207
|
+
export default DateTimeField;
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { jsx as r, jsxs as f, Fragment as Nt } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as yt, useInteractions as Dt, useDismiss as Ft, useRole as Tt, FloatingPortal as kt, FloatingFocusManager as Mt } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import C from "../../../../../external/classnames/index.es.js";
|
|
4
|
+
import Me, { useState as g, useRef as wt, useEffect as se, useMemo as W, useCallback as F } from "react";
|
|
5
|
+
import { Button as we } from "../../buttons/button/button.es.js";
|
|
6
|
+
import { Calendar as xt } from "../../content/calendar/calendar.es.js";
|
|
7
|
+
import { getLocaleDateParts as Rt, buildDateRegexSource as Vt, buildDisabledMatchers as Ct, CALENDAR_POPOVER_OFFSET as Et, CALENDAR_POPOVER_PADDING as xe } from "../date-field/date-field-helpers.es.js";
|
|
8
|
+
import { TextField as St } from "../textfield/textfield.es.js";
|
|
9
|
+
import { TimePicker as Re } from "../time-picker/time-picker.es.js";
|
|
10
|
+
import i from "./date-time-field.module.scss.es.js";
|
|
11
|
+
import { et as Pt } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
|
|
12
|
+
import { autoUpdate as $t } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
13
|
+
import { offset as At, flip as Ot, shift as Lt, size as Ht } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
14
|
+
import { useBreakpointProps as It } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
15
|
+
import { useLabels as Bt } from "../../../providers/label-provider/use-labels.es.js";
|
|
16
|
+
import { useBreakpoint as zt, isBreakpointBelow as Gt } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
17
|
+
import { dateMatchModifiers as Wt } from "../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
|
|
18
|
+
const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:${p(a.getMinutes())}` : "00:00", v = (a, o) => {
|
|
19
|
+
const [Y, b] = o.split(":"), E = Number(Y), S = Number(b), P = new Date(a);
|
|
20
|
+
return P.setHours(Number.isFinite(E) ? E : 0, Number.isFinite(S) ? S : 0, 0, 0), P;
|
|
21
|
+
}, le = (a) => a instanceof Date, Yt = (a) => a ? `${a.getFullYear()}-${p(a.getMonth() + 1)}-${p(a.getDate())}T${p(a.getHours())}:${p(a.getMinutes())}` : "", jt = (a) => {
|
|
22
|
+
if (!a) return;
|
|
23
|
+
const o = new Date(a);
|
|
24
|
+
return isNaN(o.getTime()) ? void 0 : o;
|
|
25
|
+
}, qt = (a) => !a || le(a) ? {} : a, Ut = (a) => le(a) ? a : void 0, Jt = Me.forwardRef((a, o) => {
|
|
26
|
+
const { getCurrentBreakpointProps: Y } = It(a.defaultServerBreakpoint), { getLabel: b } = Bt(), E = zt(a.defaultServerBreakpoint), S = Gt(E, "md"), {
|
|
27
|
+
layout: P = "side-by-side",
|
|
28
|
+
useNativePicker: Ve = !1,
|
|
29
|
+
monthYearSelectType: Ce = "dropdown",
|
|
30
|
+
timeGridVariant: Ee,
|
|
31
|
+
showOutsideDays: Se = !0,
|
|
32
|
+
availableTimes: N,
|
|
33
|
+
timeHeading: j = b("dateTimeField.timeHeading")
|
|
34
|
+
} = Y(a), {
|
|
35
|
+
id: Pe,
|
|
36
|
+
label: $e,
|
|
37
|
+
placeholder: Ae,
|
|
38
|
+
className: Oe,
|
|
39
|
+
value: de,
|
|
40
|
+
defaultValue: Le,
|
|
41
|
+
onChange: q,
|
|
42
|
+
required: oe,
|
|
43
|
+
readOnly: He,
|
|
44
|
+
disabled: $,
|
|
45
|
+
minDate: ce,
|
|
46
|
+
maxDate: me,
|
|
47
|
+
disablePast: fe,
|
|
48
|
+
disableFuture: ue,
|
|
49
|
+
disabledMatchers: T,
|
|
50
|
+
stepMinutes: pe = 15,
|
|
51
|
+
initialMonth: U,
|
|
52
|
+
locale: Ie = Pt,
|
|
53
|
+
localeCode: k = "et-EE",
|
|
54
|
+
selectTimeLabel: Be = b("dateTimeField.selectTime"),
|
|
55
|
+
backLabel: ze = b("dateTimeField.back"),
|
|
56
|
+
mode: Ge = "single",
|
|
57
|
+
selectionLevel: We = "days",
|
|
58
|
+
inputProps: s,
|
|
59
|
+
disabledDateErrorMessage: Ye = b("dateField.disabledDateError")
|
|
60
|
+
} = a, l = Ge === "range", u = Ve && !l, M = l ? "side-by-side" : P, he = Ee ?? (M === "multi-step" ? "radio" : "button"), ge = de !== void 0, [je, qe] = g(Le), y = ge ? de : je, c = l ? qt(y) : {}, m = l ? void 0 : Ut(y), [D, J] = g(!1), [Ue, K] = g("date"), [Je, _e] = g("days"), Q = l ? c.from : m, [Ke, A] = g(() => Q ?? U ?? /* @__PURE__ */ new Date()), ve = wt(Q);
|
|
61
|
+
ve.current = Q, se(() => {
|
|
62
|
+
D || (K("date"), _e("days"), A(ve.current ?? U ?? /* @__PURE__ */ new Date()));
|
|
63
|
+
}, [D, U]);
|
|
64
|
+
const O = W(
|
|
65
|
+
() => new Intl.DateTimeFormat(k, {
|
|
66
|
+
day: "2-digit",
|
|
67
|
+
month: "2-digit",
|
|
68
|
+
year: "numeric"
|
|
69
|
+
}),
|
|
70
|
+
[k]
|
|
71
|
+
), Qe = W(
|
|
72
|
+
() => new Intl.DateTimeFormat(k, {
|
|
73
|
+
day: "2-digit",
|
|
74
|
+
month: "2-digit",
|
|
75
|
+
year: "2-digit"
|
|
76
|
+
}),
|
|
77
|
+
[k]
|
|
78
|
+
), L = F(
|
|
79
|
+
(e) => e ? `${O.format(e)} ${p(e.getHours())}:${p(e.getMinutes())}` : "",
|
|
80
|
+
[O]
|
|
81
|
+
), H = F(
|
|
82
|
+
(e) => {
|
|
83
|
+
if (!e) return "";
|
|
84
|
+
if (le(e)) return L(e);
|
|
85
|
+
const t = L(e.from), n = L(e.to);
|
|
86
|
+
return !t && !n ? "" : n ? t ? `${t} – ${n}` : n : t;
|
|
87
|
+
},
|
|
88
|
+
[L]
|
|
89
|
+
), Xe = W(() => {
|
|
90
|
+
const e = Rt(O), { fieldOrder: t } = e, n = new RegExp(`^${Vt(e)}\\s+(\\d{2}):(\\d{2})$`);
|
|
91
|
+
return (_t) => {
|
|
92
|
+
const G = _t.trim().match(n);
|
|
93
|
+
if (!G) return;
|
|
94
|
+
const Fe = {};
|
|
95
|
+
t.forEach((vt, bt) => {
|
|
96
|
+
Fe[vt] = Number(G[bt + 1]);
|
|
97
|
+
});
|
|
98
|
+
const Te = Number(G[t.length + 1]), ke = Number(G[t.length + 2]), { day: ae, month: re, year: ne } = Fe;
|
|
99
|
+
if (ae === void 0 || re === void 0 || ne === void 0 || Te > 23 || ke > 59) return;
|
|
100
|
+
const V = new Date(ne, re - 1, ae, Te, ke, 0, 0);
|
|
101
|
+
if (!(isNaN(V.getTime()) || V.getFullYear() !== ne || V.getMonth() !== re - 1 || V.getDate() !== ae))
|
|
102
|
+
return V;
|
|
103
|
+
};
|
|
104
|
+
}, [O]), [Ze, X] = g(() => H(y)), [be, h] = g(!1);
|
|
105
|
+
se(() => {
|
|
106
|
+
X(H(y));
|
|
107
|
+
}, [y, H]);
|
|
108
|
+
const et = yt({
|
|
109
|
+
open: D,
|
|
110
|
+
onOpenChange: J,
|
|
111
|
+
placement: "bottom-end",
|
|
112
|
+
middleware: [
|
|
113
|
+
At(Et),
|
|
114
|
+
Ot(),
|
|
115
|
+
Lt({ padding: xe }),
|
|
116
|
+
Ht({
|
|
117
|
+
padding: xe,
|
|
118
|
+
apply({ availableWidth: e, elements: t }) {
|
|
119
|
+
t.floating.style.maxWidth = `${e}px`;
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
],
|
|
123
|
+
whileElementsMounted: $t
|
|
124
|
+
}), { refs: Z, context: ee, x: tt, y: it, strategy: at } = et, rt = Dt([
|
|
125
|
+
Ft(ee, {
|
|
126
|
+
outsidePress: (e) => {
|
|
127
|
+
const t = e.target;
|
|
128
|
+
return !(t != null && t.closest('[role="menu"], [role="listbox"]'));
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
Tt(ee, { role: "dialog" })
|
|
132
|
+
]), I = Me.useRef(null), nt = F(
|
|
133
|
+
(e) => {
|
|
134
|
+
I.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
|
|
135
|
+
},
|
|
136
|
+
[o]
|
|
137
|
+
);
|
|
138
|
+
se(() => {
|
|
139
|
+
var e;
|
|
140
|
+
(e = I.current) != null && e.inner && Z.setReference(I.current.inner);
|
|
141
|
+
}, [Z]);
|
|
142
|
+
const d = (e) => {
|
|
143
|
+
ge || qe(e), q == null || q(e), X(H(e));
|
|
144
|
+
}, w = F(
|
|
145
|
+
(e) => {
|
|
146
|
+
if (N)
|
|
147
|
+
return typeof N == "function" ? N(e ?? /* @__PURE__ */ new Date()) : N;
|
|
148
|
+
},
|
|
149
|
+
[N]
|
|
150
|
+
), x = F(
|
|
151
|
+
(e, t) => {
|
|
152
|
+
const n = w(e);
|
|
153
|
+
return !n || n.length === 0 || n.includes(t) ? t : n[0];
|
|
154
|
+
},
|
|
155
|
+
[w]
|
|
156
|
+
), st = (e) => {
|
|
157
|
+
if (l) {
|
|
158
|
+
const t = e;
|
|
159
|
+
if (!t || !t.from && !t.to) {
|
|
160
|
+
d(void 0);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const n = {};
|
|
164
|
+
t.from && (n.from = v(t.from, x(t.from, _(c.from)))), t.to && (n.to = v(t.to, x(t.to, _(c.to)))), d(n);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
e instanceof Date ? d(v(e, x(e, _(m)))) : e === void 0 && d(void 0);
|
|
168
|
+
}, lt = (e) => {
|
|
169
|
+
if (l) {
|
|
170
|
+
d({ from: v(e, x(e, _(c.from))) });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
d(v(e, x(e, _(m))));
|
|
174
|
+
}, dt = (e) => {
|
|
175
|
+
const t = m ?? /* @__PURE__ */ new Date();
|
|
176
|
+
d(v(t, e)), M === "multi-step" && w(t) && J(!1);
|
|
177
|
+
}, ot = (e) => (t) => {
|
|
178
|
+
const n = c[e] ?? c.from ?? /* @__PURE__ */ new Date();
|
|
179
|
+
d({ ...c, [e]: v(n, t) });
|
|
180
|
+
}, B = W(
|
|
181
|
+
() => [
|
|
182
|
+
...Ct({
|
|
183
|
+
minDate: ce,
|
|
184
|
+
maxDate: me,
|
|
185
|
+
disablePast: fe,
|
|
186
|
+
disableFuture: ue
|
|
187
|
+
}),
|
|
188
|
+
...T ? Array.isArray(T) ? T : [T] : []
|
|
189
|
+
],
|
|
190
|
+
[ce, me, fe, ue, T]
|
|
191
|
+
), Ne = F(
|
|
192
|
+
(e) => Wt(e, B),
|
|
193
|
+
[B]
|
|
194
|
+
), ct = (e) => {
|
|
195
|
+
if (X(e), e === "") {
|
|
196
|
+
h(!1), d(void 0);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (u) {
|
|
200
|
+
const n = jt(e);
|
|
201
|
+
if (!n) {
|
|
202
|
+
h(!1);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (Ne(n)) {
|
|
206
|
+
h(!0);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
h(!1), d(n), A(n);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (l) return;
|
|
213
|
+
const t = Xe(e);
|
|
214
|
+
if (!t) {
|
|
215
|
+
h(!1);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (Ne(t)) {
|
|
219
|
+
h(!0);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
h(!1), d(t), A(t);
|
|
223
|
+
}, mt = () => {
|
|
224
|
+
var t;
|
|
225
|
+
const e = (t = I.current) == null ? void 0 : t.input;
|
|
226
|
+
if (e) {
|
|
227
|
+
if (typeof e.showPicker == "function") {
|
|
228
|
+
e.showPicker();
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
e.focus();
|
|
232
|
+
}
|
|
233
|
+
}, ft = () => {
|
|
234
|
+
if (!$) {
|
|
235
|
+
if (u) {
|
|
236
|
+
mt();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
J((e) => !e);
|
|
240
|
+
}
|
|
241
|
+
}, ut = M === "multi-step" ? /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__select-time-wrapper"], children: /* @__PURE__ */ r(we, { type: "button", visualType: "link", size: "small", iconLeft: "schedule", onClick: () => K("time"), children: Be }) }) : void 0, te = /* @__PURE__ */ r(
|
|
242
|
+
xt,
|
|
243
|
+
{
|
|
244
|
+
view: Je,
|
|
245
|
+
setView: _e,
|
|
246
|
+
selectionLevel: We,
|
|
247
|
+
currentMonth: Ke,
|
|
248
|
+
setCurrentMonth: A,
|
|
249
|
+
mode: l ? "range" : "single",
|
|
250
|
+
value: l ? c : m,
|
|
251
|
+
numberOfMonths: l && !S ? 2 : 1,
|
|
252
|
+
locale: Ie,
|
|
253
|
+
localeCode: k,
|
|
254
|
+
showOutsideDays: Se,
|
|
255
|
+
monthYearSelectType: Ce,
|
|
256
|
+
disabledMatchers: B.length ? B : void 0,
|
|
257
|
+
required: oe,
|
|
258
|
+
handleSelect: st,
|
|
259
|
+
applyValue: lt,
|
|
260
|
+
footer: ut,
|
|
261
|
+
className: C(
|
|
262
|
+
i["tedi-date-time-field__calendar"],
|
|
263
|
+
M === "side-by-side" && i["tedi-date-time-field__calendar--split"]
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
), ie = w(m), pt = !ie || ie.length === 0, ye = /* @__PURE__ */ r(
|
|
267
|
+
Re,
|
|
268
|
+
{
|
|
269
|
+
value: _(m),
|
|
270
|
+
stepMinutes: pe,
|
|
271
|
+
availableTimes: ie,
|
|
272
|
+
gridVariant: he,
|
|
273
|
+
onChange: dt,
|
|
274
|
+
className: C(i["tedi-date-time-field__time-picker"], {
|
|
275
|
+
[i["tedi-date-time-field__time-picker--wheel"]]: pt
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
), De = (e) => {
|
|
279
|
+
const t = w(c[e]), n = !t || t.length === 0;
|
|
280
|
+
return /* @__PURE__ */ r(
|
|
281
|
+
Re,
|
|
282
|
+
{
|
|
283
|
+
value: _(c[e]),
|
|
284
|
+
stepMinutes: pe,
|
|
285
|
+
availableTimes: t,
|
|
286
|
+
gridVariant: he,
|
|
287
|
+
onChange: ot(e),
|
|
288
|
+
className: C(i["tedi-date-time-field__time-picker"], {
|
|
289
|
+
[i["tedi-date-time-field__time-picker--wheel"]]: n
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}, R = s == null ? void 0 : s.helper, z = be ? { text: Ye, type: "error" } : null, ht = z ? R ? Array.isArray(R) ? [...R, z] : [R, z] : z : R, gt = {
|
|
294
|
+
...s,
|
|
295
|
+
id: Pe,
|
|
296
|
+
label: $e,
|
|
297
|
+
value: u ? Yt(m) : Ze,
|
|
298
|
+
placeholder: Ae,
|
|
299
|
+
readOnly: He || !u && !!N && !!y,
|
|
300
|
+
icon: "calendar_today",
|
|
301
|
+
isClearable: !0,
|
|
302
|
+
required: oe,
|
|
303
|
+
disabled: $,
|
|
304
|
+
invalid: be || (s == null ? void 0 : s.invalid),
|
|
305
|
+
helper: ht,
|
|
306
|
+
onIconClick: ft,
|
|
307
|
+
onChange: ct,
|
|
308
|
+
className: C(i["tedi-date-time-field__textfield"], s == null ? void 0 : s.className, {
|
|
309
|
+
[i["tedi-date-time-field__icon--disabled"]]: $
|
|
310
|
+
}),
|
|
311
|
+
input: {
|
|
312
|
+
...s == null ? void 0 : s.input,
|
|
313
|
+
type: u ? "datetime-local" : "text",
|
|
314
|
+
"aria-expanded": u ? void 0 : D
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
return /* @__PURE__ */ f(Nt, { children: [
|
|
318
|
+
/* @__PURE__ */ r("div", { className: C(i["tedi-date-time-field__container"], Oe), "aria-haspopup": "dialog", children: /* @__PURE__ */ r(St, { ref: nt, "aria-expanded": u ? void 0 : D, ...gt }) }),
|
|
319
|
+
!u && /* @__PURE__ */ r(kt, { children: D && !$ && /* @__PURE__ */ r(Mt, { context: ee, modal: !1, initialFocus: -1, children: /* @__PURE__ */ r(
|
|
320
|
+
"div",
|
|
321
|
+
{
|
|
322
|
+
ref: Z.setFloating,
|
|
323
|
+
className: i["tedi-date-time-field__popup"],
|
|
324
|
+
...rt.getFloatingProps({
|
|
325
|
+
style: {
|
|
326
|
+
position: at,
|
|
327
|
+
top: it ?? 0,
|
|
328
|
+
left: tt ?? 0
|
|
329
|
+
}
|
|
330
|
+
}),
|
|
331
|
+
children: l ? /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range"], children: [
|
|
332
|
+
te,
|
|
333
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__range-separator"], "aria-hidden": "true", children: /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__range-separator-line"] }) }),
|
|
334
|
+
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range-times"], children: [
|
|
335
|
+
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range-time"], children: [
|
|
336
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-header"], children: /* @__PURE__ */ r("span", { className: i["tedi-date-time-field__split-heading"], children: j }) }),
|
|
337
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: De("from") })
|
|
338
|
+
] }),
|
|
339
|
+
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range-time"], children: [
|
|
340
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-header"], children: /* @__PURE__ */ r("span", { className: i["tedi-date-time-field__split-heading"], children: j }) }),
|
|
341
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: De("to") })
|
|
342
|
+
] })
|
|
343
|
+
] })
|
|
344
|
+
] }) : M === "side-by-side" ? /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__split"], children: [
|
|
345
|
+
te,
|
|
346
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-separator"], "aria-hidden": "true", children: /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-separator-line"] }) }),
|
|
347
|
+
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__split-time"], children: [
|
|
348
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-header"], children: /* @__PURE__ */ r("span", { className: i["tedi-date-time-field__split-heading"], children: j }) }),
|
|
349
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: ye })
|
|
350
|
+
] })
|
|
351
|
+
] }) : Ue === "date" ? te : /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__time-step"], children: [
|
|
352
|
+
/* @__PURE__ */ f("header", { className: i["tedi-date-time-field__time-header"], children: [
|
|
353
|
+
/* @__PURE__ */ r(
|
|
354
|
+
we,
|
|
355
|
+
{
|
|
356
|
+
type: "button",
|
|
357
|
+
visualType: "link",
|
|
358
|
+
size: "small",
|
|
359
|
+
iconLeft: "arrow_back",
|
|
360
|
+
onClick: () => K("date"),
|
|
361
|
+
children: ze
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
/* @__PURE__ */ r("span", { className: i["tedi-date-time-field__time-date"], children: Qe.format(m ?? /* @__PURE__ */ new Date()) })
|
|
365
|
+
] }),
|
|
366
|
+
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__time-body"], children: ye })
|
|
367
|
+
] })
|
|
368
|
+
}
|
|
369
|
+
) }) })
|
|
370
|
+
] });
|
|
371
|
+
});
|
|
372
|
+
Jt.displayName = "DateTimeField";
|
|
373
|
+
export {
|
|
374
|
+
Jt as DateTimeField,
|
|
375
|
+
Jt as default
|
|
376
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-date-time-field__container":"tedi-date-time-field__container-27fb2d35","tedi-date-time-field__textfield":"tedi-date-time-field__textfield-74c7a842","tedi-date-time-field__icon--disabled":"tedi-date-time-field__icon--disabled-82069c63","tedi-date-time-field__popup":"tedi-date-time-field__popup-9c353957","tedi-date-time-field__calendar":"tedi-date-time-field__calendar-44cf1ff8","tedi-date-time-field__split":"tedi-date-time-field__split-7c921802","tedi-date-time-field__calendar--split":"tedi-date-time-field__calendar--split-758ff612","tedi-date-time-field__time-picker":"tedi-date-time-field__time-picker-4d9e2eb6","tedi-date-time-field__time-picker--wheel":"tedi-date-time-field__time-picker--wheel-4bd09564","tedi-date-time-field__split-separator":"tedi-date-time-field__split-separator-b37f315f","tedi-date-time-field__split-separator-line":"tedi-date-time-field__split-separator-line-d4cb6bfe","tedi-date-time-field__split-time":"tedi-date-time-field__split-time-d898edf8","tedi-date-time-field__split-time-header":"tedi-date-time-field__split-time-header-7a646313","tedi-date-time-field__split-heading":"tedi-date-time-field__split-heading-8a3194a5","tedi-date-time-field__split-time-body":"tedi-date-time-field__split-time-body-ce0c1335","tedi-date-time-field__range":"tedi-date-time-field__range-17507b68","tedi-date-time-field__range-separator":"tedi-date-time-field__range-separator-8159580a","tedi-date-time-field__range-separator-line":"tedi-date-time-field__range-separator-line-993e312a","tedi-date-time-field__range-times":"tedi-date-time-field__range-times-a55a5598","tedi-date-time-field__range-time":"tedi-date-time-field__range-time-f46bcb80","tedi-date-time-field__select-time-wrapper":"tedi-date-time-field__select-time-wrapper-5c969c55","tedi-date-time-field__time-step":"tedi-date-time-field__time-step-c25362e0","tedi-date-time-field__time-header":"tedi-date-time-field__time-header-e72d431f","tedi-date-time-field__time-date":"tedi-date-time-field__time-date-e5eb5da7","tedi-date-time-field__time-body":"tedi-date-time-field__time-body-b8c484e0"};exports.default=e;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"tedi-date-time-field__container": "tedi-date-time-field__container-27fb2d35",
|
|
3
|
+
"tedi-date-time-field__textfield": "tedi-date-time-field__textfield-74c7a842",
|
|
4
|
+
"tedi-date-time-field__icon--disabled": "tedi-date-time-field__icon--disabled-82069c63",
|
|
5
|
+
"tedi-date-time-field__popup": "tedi-date-time-field__popup-9c353957",
|
|
6
|
+
"tedi-date-time-field__calendar": "tedi-date-time-field__calendar-44cf1ff8",
|
|
7
|
+
"tedi-date-time-field__split": "tedi-date-time-field__split-7c921802",
|
|
8
|
+
"tedi-date-time-field__calendar--split": "tedi-date-time-field__calendar--split-758ff612",
|
|
9
|
+
"tedi-date-time-field__time-picker": "tedi-date-time-field__time-picker-4d9e2eb6",
|
|
10
|
+
"tedi-date-time-field__time-picker--wheel": "tedi-date-time-field__time-picker--wheel-4bd09564",
|
|
11
|
+
"tedi-date-time-field__split-separator": "tedi-date-time-field__split-separator-b37f315f",
|
|
12
|
+
"tedi-date-time-field__split-separator-line": "tedi-date-time-field__split-separator-line-d4cb6bfe",
|
|
13
|
+
"tedi-date-time-field__split-time": "tedi-date-time-field__split-time-d898edf8",
|
|
14
|
+
"tedi-date-time-field__split-time-header": "tedi-date-time-field__split-time-header-7a646313",
|
|
15
|
+
"tedi-date-time-field__split-heading": "tedi-date-time-field__split-heading-8a3194a5",
|
|
16
|
+
"tedi-date-time-field__split-time-body": "tedi-date-time-field__split-time-body-ce0c1335",
|
|
17
|
+
"tedi-date-time-field__range": "tedi-date-time-field__range-17507b68",
|
|
18
|
+
"tedi-date-time-field__range-separator": "tedi-date-time-field__range-separator-8159580a",
|
|
19
|
+
"tedi-date-time-field__range-separator-line": "tedi-date-time-field__range-separator-line-993e312a",
|
|
20
|
+
"tedi-date-time-field__range-times": "tedi-date-time-field__range-times-a55a5598",
|
|
21
|
+
"tedi-date-time-field__range-time": "tedi-date-time-field__range-time-f46bcb80",
|
|
22
|
+
"tedi-date-time-field__select-time-wrapper": "tedi-date-time-field__select-time-wrapper-5c969c55",
|
|
23
|
+
"tedi-date-time-field__time-step": "tedi-date-time-field__time-step-c25362e0",
|
|
24
|
+
"tedi-date-time-field__time-header": "tedi-date-time-field__time-header-e72d431f",
|
|
25
|
+
"tedi-date-time-field__time-date": "tedi-date-time-field__time-date-e5eb5da7",
|
|
26
|
+
"tedi-date-time-field__time-body": "tedi-date-time-field__time-body-b8c484e0"
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
e as default
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),T=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),O=require("../textfield/textfield.cjs.js"),se=require("../time-picker/time-picker.cjs.js"),o=require("./time-field.module.scss.cjs.js"),E=require("./time-field-helpers.cjs.js"),oe=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),q=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),le=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),k=require("../../overlays/dropdown/dropdown.cjs.js"),S=b=>{const{getCurrentBreakpointProps:V}=le.useBreakpointProps(b.defaultServerBreakpoint),{id:M,label:z,value:u,defaultValue:A,onChange:v,readOnly:C=!1,disabled:l=!1,required:H,placeholder:K,inputProps:t,stepMinutes:G=1,className:I,availableTimes:d}=b,{useNativePicker:J=!1,timePickerTrigger:P="button",showPicker:a=!0,availableTimesVariant:y="grid-buttons"}=V(b),N=u!==void 0,[L,D]=m.useState(u??A??""),g=N?u:L,[F,_]=m.useState(!1),w=P==="input",r=J,Q=c.useFloating({open:F,onOpenChange:_,placement:w?"bottom-start":"bottom-end",middleware:[q.offset(E.TIMEPICKER_OFFSET),q.flip(),q.shift()],whileElementsMounted:oe.autoUpdate}),{refs:j,context:x,x:W,y:X,strategy:Y}=Q,Z=c.useClick(x),$=c.useDismiss(x),ee=c.useRole(x,{role:"listbox"}),R=a&&w&&!C&&!l&&!r,U=c.useInteractions([...R?[Z]:[],$,ee]),p=e=>{const n=e.trim();N||D(n),v==null||v(n)},te=e=>{var h;const n=e.target.value??"";(h=t==null?void 0:t.onBlur)==null||h.call(t,e);const s=E.normalizeTime(n);s!==null&&s!==n&&p(s)};m.useEffect(()=>{u!==void 0&&D(u)},[u]);const f=m.useRef(null);m.useEffect(()=>{var e;(e=f.current)!=null&&e.inner&&j.setReference(f.current.inner)},[j]);const ie=()=>{var n;const e=(n=f.current)==null?void 0:n.input;if(e){if(typeof e.showPicker=="function"){e.showPicker();return}e.focus()}},ne=()=>_(e=>!e),re=()=>{!a||l||(r?ie():P==="button"&&ne())},B={...t,id:M,label:z,value:g,placeholder:K,readOnly:C||!r&&w,disabled:l||(t==null?void 0:t.disabled),icon:"schedule",isClearable:!0,required:H,onIconClick:re,onChange:p,onBlur:te,className:T.default(o.default["tedi-time-field__textfield"],{[o.default["tedi-time-field__icon--disabled"]]:!a||l},{[o.default["tedi-time-field__textfield--disabled"]]:l||(t==null?void 0:t.disabled)},{[o.default["tedi-time-field--native"]]:r}),input:{...t==null?void 0:t.input,...r&&{type:"time"}}};if(!r&&a&&!l&&y==="dropdown"&&!!(d!=null&&d.length)){const e=d.indexOf(g),n=e>=0?e:0;return i.jsxs(k.Dropdown,{width:"trigger",defaultActiveIndex:n,children:[i.jsx(k.Dropdown.Trigger,{children:i.jsx("div",{className:T.default(o.default["tedi-time-field__container"],I,{[o.default["tedi-time-field__container--native"]]:r}),children:i.jsx(O.TextField,{ref:f,...B})})}),i.jsx(k.Dropdown.Content,{children:d.map((s,h)=>i.jsx(k.Dropdown.Item,{index:h,active:s===g,onClick:()=>p(s),children:s},s))})]})}return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:T.default(o.default["tedi-time-field__container"],I),...R?U.getReferenceProps():{},"aria-haspopup":a?"listbox":void 0,tabIndex:-1,children:i.jsx(O.TextField,{ref:f,"aria-expanded":a?F:void 0,...B})}),!r&&a&&!l&&i.jsx(c.FloatingPortal,{children:F&&i.jsx(c.FloatingFocusManager,{context:x,modal:!1,initialFocus:-1,children:i.jsx("div",{ref:j.setFloating,...U.getFloatingProps({style:{position:Y,top:X??0,left:W??0}}),children:i.jsx(se.TimePicker,{value:g,stepMinutes:G,availableTimes:d,onChange:e=>{p(e),d&&_(!1)},gridVariant:y==="grid-radio"?"radio":"button",className:o.default["tedi-time-field__picker-wrapper"]})})})})]})};S.displayName="TimeField";exports.TimeField=S;
|
|
@@ -56,6 +56,15 @@ export interface TimeFieldProps extends BreakpointSupport<TimeFieldBreakpointPro
|
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
58
|
readOnly?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Disables the input and the picker. Equivalent of `<DateTimeField disabled>`
|
|
61
|
+
* — added so all three field siblings (`DateField`, `TimeField`,
|
|
62
|
+
* `DateTimeField`) share the same form-control idiom for "this field is
|
|
63
|
+
* fully unavailable". Forwards to the underlying `TextField`'s `disabled`
|
|
64
|
+
* attribute and short-circuits the picker open path.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
disabled?: boolean;
|
|
59
68
|
/**
|
|
60
69
|
* Marks the input as required.
|
|
61
70
|
*/
|