@paygreen/pgui 2.13.5 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,5 +12,7 @@ export type InputDayPickerProps = {
12
12
  minDate?: Date | null | undefined;
13
13
  maxDate?: Date | null | undefined;
14
14
  isDisabled?: boolean;
15
+ inputProps?: any;
16
+ dayPickerProps?: any;
15
17
  };
16
- export declare const InputDayPicker: ({ value, onChange, placeholder, name, isDisabled, withTime, locale, minDate, maxDate, dateFormat, variant, }: InputDayPickerProps) => React.JSX.Element;
18
+ export declare const InputDayPicker: ({ value, onChange, placeholder, name, isDisabled, withTime, locale, minDate, maxDate, dateFormat, variant, inputProps, dayPickerProps, }: InputDayPickerProps) => React.JSX.Element;
package/dist/esm/index.js CHANGED
@@ -7970,7 +7970,7 @@ function v4(options, buf, offset) {
7970
7970
  dayjs.extend(customParseFormat);
7971
7971
  dayjs.extend(utc);
7972
7972
  var InputDayPicker = function (_a) {
7973
- var value = _a.value, onChange = _a.onChange, placeholder = _a.placeholder, name = _a.name, isDisabled = _a.isDisabled, withTime = _a.withTime, _b = _a.locale, locale = _b === void 0 ? 'en' : _b, minDate = _a.minDate, maxDate = _a.maxDate, dateFormat = _a.dateFormat, _c = _a.variant, variant = _c === void 0 ? 'filled' : _c;
7973
+ var value = _a.value, onChange = _a.onChange, placeholder = _a.placeholder, name = _a.name, isDisabled = _a.isDisabled, withTime = _a.withTime, _b = _a.locale, locale = _b === void 0 ? 'en' : _b, minDate = _a.minDate, maxDate = _a.maxDate, dateFormat = _a.dateFormat, _c = _a.variant, variant = _c === void 0 ? 'filled' : _c, inputProps = _a.inputProps, dayPickerProps = _a.dayPickerProps;
7974
7974
  var _d = useDisclosure(), isOpen = _d.isOpen, onOpen = _d.onOpen, onClose = _d.onClose;
7975
7975
  var inputLeftElementColor = useColorModeValue('gray.400', 'gray.600');
7976
7976
  var inputLeftElementDisabledColor = useColorModeValue('gray.600', 'gray.400');
@@ -8021,12 +8021,12 @@ var InputDayPicker = function (_a) {
8021
8021
  handleDateSelection(dayjs(dateValue, defaultDateFormat).toDate());
8022
8022
  }, [hours, minutes]);
8023
8023
  return (React__default.createElement(Box, null,
8024
- React__default.createElement(InputGroup, { maxWidth: '15rem' },
8024
+ React__default.createElement(InputGroup, null,
8025
8025
  React__default.createElement(InputLeftElement, { role: "group", color: isDisabled ? inputLeftElementColor : inputLeftElementDisabledColor, _hover: {
8026
8026
  cursor: isDisabled ? 'not-allowed' : 'pointer'
8027
8027
  }, onClick: function () { return !isDisabled && (isOpen ? onClose() : onOpen()); } },
8028
8028
  React__default.createElement(Icon, { as: MdCalendarToday })),
8029
- React__default.createElement(Input$4, { disabled: isDisabled, name: name || 'date-input', type: "text", variant: variant, placeholder: placeholder || defaultDateFormat, value: dateValue, onChange: function (e) {
8029
+ React__default.createElement(Input$4, __assign$2({ width: "full", disabled: isDisabled, name: name || 'date-input', type: "text", variant: variant, placeholder: placeholder || defaultDateFormat, value: dateValue, onChange: function (e) {
8030
8030
  var newValue = e.currentTarget.value
8031
8031
  .replace(/[^0-9 /:]/g, '')
8032
8032
  .slice(0, withTime ? 16 : 10); // Sanitize the input
@@ -8035,15 +8035,15 @@ var InputDayPicker = function (_a) {
8035
8035
  }, onFocus: function () {
8036
8036
  if (isOpen)
8037
8037
  onClose();
8038
- } }),
8038
+ } }, inputProps)),
8039
8039
  dateValue && !isDisabled && (React__default.createElement(InputRightElement, { role: "group", _hover: {
8040
8040
  cursor: 'pointer'
8041
8041
  }, onClick: function () {
8042
8042
  handleInputChange(null);
8043
8043
  } },
8044
8044
  React__default.createElement(Icon, { as: MdClose })))),
8045
- isOpen && (React__default.createElement(Box, { key: v4(), position: 'absolute', border: '1px solid', borderColor: 'gray.400', bg: dialogSheetBg, borderRadius: 'md', tabIndex: -1, zIndex: 1000, className: "dialog-sheet", role: "dialog", "aria-label": "DayPicker calendar", mt: 2 },
8046
- React__default.createElement(DayPicker, { locale: locale === 'en' ? enUS : fr$1, fromDate: minDate || new Date('1900-01-01'), toDate: maxDate || new Date('2100-12-31'), initialFocus: isOpen, mode: "single", disabled: isDisabled,
8045
+ isOpen && (React__default.createElement(Box, { key: v4(), position: 'absolute', border: '1px solid', borderColor: 'gray.400', bg: dialogSheetBg, borderRadius: 'md', tabIndex: -1, zIndex: 9999, className: "dialog-sheet", role: "dialog", "aria-label": "DayPicker calendar", mt: 2 },
8046
+ React__default.createElement(DayPicker, __assign$2({ locale: locale === 'en' ? enUS : fr$1, fromDate: minDate || new Date('1900-01-01'), toDate: maxDate || new Date('2100-12-31'), initialFocus: isOpen, mode: "single", disabled: isDisabled,
8047
8047
  // Put the default date or today's date if the value is empty
8048
8048
  selected: dayjs(dateValue, defaultDateFormat, true).isValid()
8049
8049
  ? dayjs(dateValue, defaultDateFormat, true).toDate()
@@ -8055,7 +8055,7 @@ var InputDayPicker = function (_a) {
8055
8055
  handleDateSelection(date);
8056
8056
  if (!withTime)
8057
8057
  onClose(); // Close the dialog only when you dont need to select the time
8058
- }, captionLayout: "dropdown-buttons" }),
8058
+ }, captionLayout: "dropdown-buttons" }, dayPickerProps)),
8059
8059
  withTime && (React__default.createElement(React__default.Fragment, null,
8060
8060
  React__default.createElement(VStack, { align: "center" },
8061
8061
  React__default.createElement(Divider, { mb: 2, w: '90%' })),
@@ -19083,8 +19083,8 @@ var InputPhone = function (_a) {
19083
19083
 
19084
19084
  var InputRangePicker = function (_a) {
19085
19085
  var value = _a.value, onChange = _a.onChange, placeholder = _a.placeholder, name = _a.name, isDisabled = _a.isDisabled, withTime = _a.withTime, _b = _a.locale, locale = _b === void 0 ? 'en' : _b, minDate = _a.minDate, maxDate = _a.maxDate, dateFormat = _a.dateFormat, _c = _a.variant, variant = _c === void 0 ? 'filled' : _c;
19086
- var _d = useState((value === null || value === void 0 ? void 0 : value.from) || new Date()), fromValue = _d[0], setFromValue = _d[1];
19087
- var _e = useState((value === null || value === void 0 ? void 0 : value.to) || new Date()), toValue = _e[0], setToValue = _e[1];
19086
+ var _d = useState((value === null || value === void 0 ? void 0 : value.from) || null), fromValue = _d[0], setFromValue = _d[1];
19087
+ var _e = useState((value === null || value === void 0 ? void 0 : value.to) || null), toValue = _e[0], setToValue = _e[1];
19088
19088
  useEffect(function () {
19089
19089
  onChange({ from: fromValue, to: toValue });
19090
19090
  }, [fromValue, toValue]);