@stenajs-webui/calendar 15.0.0-alpha.5 → 15.0.0-alpha.6
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.
|
@@ -3,8 +3,9 @@ import { TextInputProps } from "@stenajs-webui/forms";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { SingleDateCalendarProps } from "../../calendar-types/single-date-calendar/SingleDateCalendar";
|
|
5
5
|
import { CalendarTheme } from "../../calendar/CalendarTheme";
|
|
6
|
+
import { OptionalMinMaxDatesAsString } from "../../../types/CalendarTypes";
|
|
6
7
|
export declare type DateTextInputCalendarProps<T> = Omit<SingleDateCalendarProps<T>, "value" | "onChange" | "theme">;
|
|
7
|
-
export interface DateTextInputProps<T> extends Omit<TextInputProps, "onChange" | "theme"
|
|
8
|
+
export interface DateTextInputProps<T> extends Omit<TextInputProps, "onChange" | "theme" | "min" | "max">, OptionalMinMaxDatesAsString {
|
|
8
9
|
/** Props to be passed to Calendar, see SingleDateCalendar. */
|
|
9
10
|
calendarProps?: DateTextInputCalendarProps<T>;
|
|
10
11
|
/** Close calendar when date is selected, @default true */
|
package/dist/index.es.js
CHANGED
|
@@ -1248,9 +1248,9 @@ var DateRangeInput = function (_a) {
|
|
|
1248
1248
|
};
|
|
1249
1249
|
|
|
1250
1250
|
var DateTextInput = function (_a) {
|
|
1251
|
-
var calendarProps = _a.calendarProps, _b = _a.closeOnCalendarSelectDate, closeOnCalendarSelectDate = _b === void 0 ? true : _b, _c = _a.dateFormat, dateFormat = _c === void 0 ? DateFormats.fullDate : _c; _a.disableCalender; var onValueChange = _a.onValueChange, _e = _a.placeholder, placeholder = _e === void 0 ? "yyyy-mm-dd" : _e, portalTarget = _a.portalTarget, value = _a.value, _f = _a.width, width = _f === void 0 ? "130px" : _f, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.calendarTheme, calendarTheme = _h === void 0 ? defaultCalendarTheme : _h, _j = _a.hideCalenderIcon, hideCalenderIcon = _j === void 0 ? false : _j, props = __rest(_a, ["calendarProps", "closeOnCalendarSelectDate", "dateFormat", "disableCalender", "onValueChange", "placeholder", "portalTarget", "value", "width", "zIndex", "calendarTheme", "hideCalenderIcon"]);
|
|
1252
|
-
var
|
|
1253
|
-
var
|
|
1251
|
+
var calendarProps = _a.calendarProps, _b = _a.closeOnCalendarSelectDate, closeOnCalendarSelectDate = _b === void 0 ? true : _b, _c = _a.dateFormat, dateFormat = _c === void 0 ? DateFormats.fullDate : _c; _a.disableCalender; var onValueChange = _a.onValueChange, _e = _a.placeholder, placeholder = _e === void 0 ? "yyyy-mm-dd" : _e, portalTarget = _a.portalTarget, value = _a.value, _f = _a.width, width = _f === void 0 ? "130px" : _f, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.calendarTheme, calendarTheme = _h === void 0 ? defaultCalendarTheme : _h, _j = _a.hideCalenderIcon, hideCalenderIcon = _j === void 0 ? false : _j, minDate = _a.minDate, _k = _a.maxDate, maxDate = _k === void 0 ? defaultMaxDate : _k, props = __rest(_a, ["calendarProps", "closeOnCalendarSelectDate", "dateFormat", "disableCalender", "onValueChange", "placeholder", "portalTarget", "value", "width", "zIndex", "calendarTheme", "hideCalenderIcon", "minDate", "maxDate"]);
|
|
1252
|
+
var _l = useState(false), open = _l[0], setOpen = _l[1];
|
|
1253
|
+
var _m = useCalendarPopoverUpdater(), tippyRef = _m.tippyRef, onChangePanel = _m.onChangePanel;
|
|
1254
1254
|
var toggleCalendar = useCallback(function () {
|
|
1255
1255
|
setOpen(!open);
|
|
1256
1256
|
}, [setOpen, open]);
|
|
@@ -1277,9 +1277,9 @@ var DateTextInput = function (_a) {
|
|
|
1277
1277
|
return (React.createElement(Box, { width: width },
|
|
1278
1278
|
React.createElement(Popover, { arrow: false, lazy: true, visible: open, zIndex: zIndex, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", placement: defaultPopoverPlacement, onClickOutside: hideCalendar, tippyRef: tippyRef, content: React.createElement(SingleDateCalendar, __assign({}, calendarProps, { onChange: onCalendarSelectDate, onChangePanel: onChangePanel, value: value && dateIsValid
|
|
1279
1279
|
? parse(value, dateFormat, new Date())
|
|
1280
|
-
: undefined, theme: calendarTheme })) },
|
|
1280
|
+
: undefined, minDate: minDate, maxDate: maxDate, theme: calendarTheme })) },
|
|
1281
1281
|
React.createElement(TextInput, __assign({}, props, { variant: invalid ? "error" : "standard", disableContentPaddingRight: true, contentRight: !hideCalenderIcon ? (React.createElement(Row, { alignItems: "center", indent: 0.5 },
|
|
1282
|
-
React.createElement(FlatButton, { size: "small", leftIcon: faCalendarAlt$1, onClick: toggleCalendar }))) : undefined, onValueChange: onValueChangeHandler, placeholder: placeholder, value: value || "", size: 10 })))));
|
|
1282
|
+
React.createElement(FlatButton, { size: "small", leftIcon: faCalendarAlt$1, onClick: toggleCalendar }))) : undefined, onValueChange: onValueChangeHandler, placeholder: placeholder, value: value || "", min: minDate, max: maxDate, size: 10 })))));
|
|
1283
1283
|
};
|
|
1284
1284
|
|
|
1285
1285
|
var formatHours = function (hours) {
|