@indico-data/design-system 3.0.7 → 3.0.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.
Files changed (30) hide show
  1. package/lib/components/floatUI/FloatUI.d.ts +1 -1
  2. package/lib/components/floatUI/types.d.ts +1 -0
  3. package/lib/components/forms/date/datePicker/types.d.ts +4 -0
  4. package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +4 -0
  5. package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +6 -0
  6. package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.d.ts +6 -0
  7. package/lib/components/forms/input/Input.d.ts +1 -0
  8. package/lib/components/forms/textarea/Textarea.d.ts +1 -0
  9. package/lib/components/forms/timePicker/TimePicker.d.ts +7 -1
  10. package/lib/index.d.ts +56 -3
  11. package/lib/index.esm.js +67 -22
  12. package/lib/index.esm.js.map +1 -1
  13. package/lib/index.js +67 -21
  14. package/lib/index.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/floatUI/FloatUI.tsx +2 -1
  17. package/src/components/floatUI/types.ts +1 -0
  18. package/src/components/forms/date/datePicker/DatePicker.tsx +11 -1
  19. package/src/components/forms/date/datePicker/types.ts +4 -0
  20. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +28 -0
  21. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +12 -0
  22. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +56 -0
  23. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +20 -0
  24. package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +44 -0
  25. package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +28 -6
  26. package/src/components/forms/input/Input.tsx +3 -0
  27. package/src/components/forms/textarea/Textarea.tsx +3 -0
  28. package/src/components/forms/timePicker/TimePicker.tsx +18 -0
  29. package/src/index.ts +1 -0
  30. package/src/storybook/formArgTypes.ts +14 -0
package/lib/index.js CHANGED
@@ -5492,7 +5492,7 @@ const DisplayFormError = (_a) => {
5492
5492
  };
5493
5493
 
5494
5494
  const Input = React__namespace.default.forwardRef((_a, ref) => {
5495
- var { id, name, placeholder, isRequired, isDisabled, readonly, isClearable, errorMessage, helpText, maxLength, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest(_a, ["id", "name", "placeholder", "isRequired", "isDisabled", "readonly", "isClearable", "errorMessage", "helpText", "maxLength", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
5495
+ var { id, name, placeholder, isRequired, isDisabled, readonly, isClearable, errorMessage, helpText, maxLength, iconName, tabIndex, onChange, onBlur, onKeyDown, className } = _a, rest = __rest(_a, ["id", "name", "placeholder", "isRequired", "isDisabled", "readonly", "isClearable", "errorMessage", "helpText", "maxLength", "iconName", "tabIndex", "onChange", "onBlur", "onKeyDown", "className"]);
5496
5496
  const hasErrors = errorMessage && errorMessage.length > 0;
5497
5497
  const handleClear = () => {
5498
5498
  onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: '' } });
@@ -5502,7 +5502,7 @@ const Input = React__namespace.default.forwardRef((_a, ref) => {
5502
5502
  error: hasErrors,
5503
5503
  'input--has-icon': iconName,
5504
5504
  }, className);
5505
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.jsx("input", Object.assign({ ref: ref, id: id, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, readOnly: readonly, onChange: onChange, onBlur: onBlur, maxLength: maxLength, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { "data-testid": `${name}-error`, message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
5505
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.jsx("input", Object.assign({ ref: ref, tabIndex: tabIndex, id: id, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, readOnly: readonly, onChange: onChange, onBlur: onBlur, maxLength: maxLength, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { "data-testid": `${name}-error`, message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
5506
5506
  });
5507
5507
  const LabeledInput = withLabel(Input);
5508
5508
 
@@ -5815,10 +5815,10 @@ const Toggle = React__namespace.default.forwardRef((_a, ref) => {
5815
5815
  });
5816
5816
 
5817
5817
  const Textarea = React__namespace.default.forwardRef((_a, ref) => {
5818
- var { label, name, placeholder, value, onChange, onKeyDown, isRequired, isDisabled, errorMessage, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus, defaultValue } = _a, rest = __rest(_a, ["label", "name", "placeholder", "value", "onChange", "onKeyDown", "isRequired", "isDisabled", "errorMessage", "helpText", "hasHiddenLabel", "rows", "cols", "readonly", "wrap", "form", "maxLength", "autofocus", "defaultValue"]);
5818
+ var { label, name, placeholder, value, onChange, onKeyDown, isRequired, isDisabled, errorMessage, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus, defaultValue, tabIndex } = _a, rest = __rest(_a, ["label", "name", "placeholder", "value", "onChange", "onKeyDown", "isRequired", "isDisabled", "errorMessage", "helpText", "hasHiddenLabel", "rows", "cols", "readonly", "wrap", "form", "maxLength", "autofocus", "defaultValue", "tabIndex"]);
5819
5819
  const hasErrors = errorMessage && errorMessage.length > 0;
5820
5820
  const textareaClasses = classNames('textarea', { error: hasErrors });
5821
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "textarea-wrapper", children: jsxRuntime.jsx("textarea", Object.assign({ ref: ref, rows: rows, cols: cols, autoFocus: autofocus, wrap: wrap, form: form, maxLength: maxLength, readOnly: readonly, "data-testid": `form-textarea-${name}`, name: name, disabled: isDisabled, placeholder: placeholder, onChange: onChange, onKeyDown: onKeyDown, className: textareaClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, value: value, defaultValue: defaultValue }, rest)) }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
5821
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "textarea-wrapper", children: jsxRuntime.jsx("textarea", Object.assign({ ref: ref, rows: rows, cols: cols, autoFocus: autofocus, wrap: wrap, form: form, maxLength: maxLength, readOnly: readonly, "data-testid": `form-textarea-${name}`, name: name, disabled: isDisabled, placeholder: placeholder, onChange: onChange, onKeyDown: onKeyDown, className: textareaClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, value: value, defaultValue: defaultValue, tabIndex: tabIndex }, rest)) }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
5822
5822
  });
5823
5823
  const LabeledTextarea = withLabel(Textarea);
5824
5824
 
@@ -11910,7 +11910,8 @@ const validateInputValue = (value) => {
11910
11910
  return ''; // Valid time format
11911
11911
  };
11912
11912
 
11913
- const TimePicker = ({ timeValue = '', label = 'Time Picker', name = 'time-picker', hasHiddenLabel = false, onTimeChange, }) => {
11913
+ const TimePicker = (_a) => {
11914
+ var { ref, timeValue = '', label = 'Time Picker', name = 'time-picker', hasHiddenLabel = false, onTimeChange, className, isDisabled, isReadOnly, tabIndex } = _a, rest = __rest(_a, ["ref", "timeValue", "label", "name", "hasHiddenLabel", "onTimeChange", "className", "isDisabled", "isReadOnly", "tabIndex"]);
11914
11915
  const [validationError, setValidationError] = React.useState('');
11915
11916
  const [inputValue, setInputValue] = React.useState(timeValue);
11916
11917
  const handleTimeChange = (e) => {
@@ -11932,11 +11933,11 @@ const TimePicker = ({ timeValue = '', label = 'Time Picker', name = 'time-picker
11932
11933
  onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
11933
11934
  }
11934
11935
  };
11935
- return (jsxRuntime.jsx("div", { className: "time-input-wrapper", children: jsxRuntime.jsx(LabeledInput, { "data-testid": `${name}-input`, label: label, hasHiddenLabel: hasHiddenLabel, value: inputValue, maxLength: 8, onChange: handleTimeChange, onBlur: handleBlur, name: name, errorMessage: validationError }) }));
11936
+ return (jsxRuntime.jsx("div", { className: "time-input-wrapper", children: jsxRuntime.jsx(LabeledInput, Object.assign({ ref: ref, tabIndex: tabIndex, className: className, "data-testid": `${name}-input`, label: label, hasHiddenLabel: hasHiddenLabel, value: inputValue, maxLength: 8, onChange: handleTimeChange, onBlur: handleBlur, name: name, errorMessage: validationError, readonly: isReadOnly, isDisabled: isDisabled }, rest)) }));
11936
11937
  };
11937
11938
 
11938
11939
  const DatePicker = (props) => {
11939
- const { mode = 'single', className, captionLayout = 'dropdown', selected, hasTimePicker = false, id, month, defaultMonth, startMonth, endMonth, components, numberOfMonths, isDisabled, formatters, weekStartsOn, firstWeekContainsDate, today, timeValue, isRequired, min, max, onTimeChange, onSelect, onMonthChange, onNextClick, onPrevClick, onDayClick } = props, rest = __rest(props, ["mode", "className", "captionLayout", "selected", "hasTimePicker", "id", "month", "defaultMonth", "startMonth", "endMonth", "components", "numberOfMonths", "isDisabled", "formatters", "weekStartsOn", "firstWeekContainsDate", "today", "timeValue", "isRequired", "min", "max", "onTimeChange", "onSelect", "onMonthChange", "onNextClick", "onPrevClick", "onDayClick"]);
11940
+ const { mode = 'single', className, captionLayout = 'dropdown', selected, hasTimePicker = false, id, month, defaultMonth, startMonth, endMonth, components, numberOfMonths, isDisabled, formatters, weekStartsOn, firstWeekContainsDate, today, timeValue, isRequired, min, max, onTimeChange, onSelect, onMonthChange, onNextClick, onPrevClick, onDayClick, isReadOnly, ref, timeTabIndex, dateTabIndex } = props, rest = __rest(props, ["mode", "className", "captionLayout", "selected", "hasTimePicker", "id", "month", "defaultMonth", "startMonth", "endMonth", "components", "numberOfMonths", "isDisabled", "formatters", "weekStartsOn", "firstWeekContainsDate", "today", "timeValue", "isRequired", "min", "max", "onTimeChange", "onSelect", "onMonthChange", "onNextClick", "onPrevClick", "onDayClick", "isReadOnly", "ref", "timeTabIndex", "dateTabIndex"]);
11940
11941
  const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
11941
11942
  const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
11942
11943
  const modeMap = {
@@ -11968,7 +11969,7 @@ const DatePicker = (props) => {
11968
11969
  onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
11969
11970
  };
11970
11971
  const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
11971
- return (jsxRuntime.jsxs("div", { className: "date-picker-wrapper", children: [hasTimePicker && (jsxRuntime.jsx("div", { className: "time-picker-wrapper", children: jsxRuntime.jsxs(Row, { align: "center", children: [jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx("p", { className: "ma-0", children: "Select Time" }) }), jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(TimePicker, { timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange }) })] }) })), jsxRuntime.jsx(DayPicker, Object.assign({}, finalProps))] }));
11972
+ return (jsxRuntime.jsxs("div", { className: "date-picker-wrapper", children: [hasTimePicker && (jsxRuntime.jsx("div", { className: "time-picker-wrapper", children: jsxRuntime.jsxs(Row, { align: "center", children: [jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx("p", { className: "ma-0", children: "Select Time" }) }), jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(TimePicker, { ref: ref, timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange, readonly: isReadOnly, tabIndex: timeTabIndex }) })] }) })), jsxRuntime.jsx(DayPicker, Object.assign({}, finalProps))] }));
11972
11973
  };
11973
11974
 
11974
11975
  function getNodeName$1(node) {
@@ -13644,7 +13645,7 @@ const defaultOptions$1 = {
13644
13645
  placement: 'bottom-start',
13645
13646
  middleware: [offset$2(5), flip$2(), shift$2()],
13646
13647
  };
13647
- function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, }) {
13648
+ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, }) {
13648
13649
  const [internalIsOpen, setInternalIsOpen] = React.useState(false);
13649
13650
  // Determine whether the component is controlled or uncontrolled
13650
13651
  const isControlled = controlledIsOpen !== undefined && controlledSetIsOpen !== undefined;
@@ -13666,7 +13667,7 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
13666
13667
  const click = useClick(context);
13667
13668
  const dismiss = useDismiss(context);
13668
13669
  const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
13669
- const tooltipContent = (jsxRuntime.jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className: "floatui-container", children: jsxRuntime.jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) })));
13670
+ const tooltipContent = (jsxRuntime.jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className: `floatui-container ${className}`, children: jsxRuntime.jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) })));
13670
13671
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: trigger })), isOpen &&
13671
13672
  (isPortal ? (jsxRuntime.jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
13672
13673
  }
@@ -19077,14 +19078,14 @@ function cleanEscapedString(input) {
19077
19078
  return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
19078
19079
  }
19079
19080
 
19080
- const formatDateAsString = (date) => format(date, 'MM/dd/yyyy');
19081
+ const formatDateAsString$1 = (date) => format(date, 'MM/dd/yyyy');
19081
19082
 
19082
19083
  function SingleInputDatePicker(props) {
19083
19084
  var _a;
19084
- const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, initialMonth, id, label, selected, isOpen, inputPlaceholder, clearOnClose, inputIconName, isClearable, errorMessage, onSelect } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "initialMonth", "id", "label", "selected", "isOpen", "inputPlaceholder", "clearOnClose", "inputIconName", "isClearable", "errorMessage", "onSelect"]);
19085
+ const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, initialMonth, id, label, selected, isOpen, inputPlaceholder, clearOnClose, inputIconName, isClearable, errorMessage, onSelect, hasHiddenLabel, ref, isReadOnly, tabIndex } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "initialMonth", "id", "label", "selected", "isOpen", "inputPlaceholder", "clearOnClose", "inputIconName", "isClearable", "errorMessage", "onSelect", "hasHiddenLabel", "ref", "isReadOnly", "tabIndex"]);
19085
19086
  const inputId = React.useId();
19086
19087
  // The text value is assumed to be unneeded by the consumer.
19087
- const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString(selected) : '');
19088
+ const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString$1(selected) : '');
19088
19089
  const [localMonth, setLocalMonth] = React.useState((_a = initialMonth !== null && initialMonth !== void 0 ? initialMonth : selected) !== null && _a !== void 0 ? _a : new Date());
19089
19090
  // When the day picker is selected, update the text value.
19090
19091
  const handleDayPickerSelect = (date) => {
@@ -19093,7 +19094,7 @@ function SingleInputDatePicker(props) {
19093
19094
  onSelect(undefined);
19094
19095
  }
19095
19096
  else {
19096
- setLocalTextValue(formatDateAsString(date));
19097
+ setLocalTextValue(formatDateAsString$1(date));
19097
19098
  onSelect(date);
19098
19099
  }
19099
19100
  };
@@ -19115,15 +19116,15 @@ function SingleInputDatePicker(props) {
19115
19116
  setLocalTextValue('');
19116
19117
  }
19117
19118
  }, [isOpen, clearOnClose]);
19118
- return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [jsxRuntime.jsx(LabeledInput, { id: inputId, value: localTextValue, placeholder: inputPlaceholder, isDisabled: isDisabled, iconName: inputIconName, isClearable: isClearable, onChange: handleInputChange, errorMessage: errorMessage, label: 'Single Date Picker', name: 'Date Picker' }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
19119
+ return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [jsxRuntime.jsx(LabeledInput, { id: inputId, value: localTextValue, placeholder: inputPlaceholder, isDisabled: isDisabled, hasHiddenLabel: hasHiddenLabel, iconName: inputIconName, isClearable: isClearable, onChange: handleInputChange, errorMessage: errorMessage, label: 'Single Date Picker', tabIndex: tabIndex, name: 'Date Picker', ref: ref, readonly: isReadOnly }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
19119
19120
  }
19120
19121
 
19121
19122
  function InputDateRangePicker(props) {
19122
- const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, month, id, onSelect, selected, isOpen, setIsOpen, inputPlaceholder, inputIconName, toErrorMessage, fromErrorMessage, gutterWidth, fromLabel, toLabel, closeOnSelect, clearOnClose } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "month", "id", "onSelect", "selected", "isOpen", "setIsOpen", "inputPlaceholder", "inputIconName", "toErrorMessage", "fromErrorMessage", "gutterWidth", "fromLabel", "toLabel", "closeOnSelect", "clearOnClose"]);
19123
+ const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, month, id, onSelect, selected, isOpen, setIsOpen, inputPlaceholder, inputIconName, toErrorMessage, fromErrorMessage, gutterWidth, fromLabel, toLabel, closeOnSelect, clearOnClose, hasHiddenLabel, ref, isFromReadOnly, isToReadOnly, toTabIndex, fromTabIndex } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "month", "id", "onSelect", "selected", "isOpen", "setIsOpen", "inputPlaceholder", "inputIconName", "toErrorMessage", "fromErrorMessage", "gutterWidth", "fromLabel", "toLabel", "closeOnSelect", "clearOnClose", "hasHiddenLabel", "ref", "isFromReadOnly", "isToReadOnly", "toTabIndex", "fromTabIndex"]);
19123
19124
  const inputId = React.useId();
19124
19125
  // Hold the input values in state
19125
- const [localTextValueFrom, setLocalTextValueFrom] = React.useState((selected === null || selected === void 0 ? void 0 : selected.from) ? formatDateAsString(selected.from) : '');
19126
- const [localTextValueTo, setLocalTextValueTo] = React.useState((selected === null || selected === void 0 ? void 0 : selected.to) ? formatDateAsString(selected.to) : '');
19126
+ const [localTextValueFrom, setLocalTextValueFrom] = React.useState((selected === null || selected === void 0 ? void 0 : selected.from) ? formatDateAsString$1(selected.from) : '');
19127
+ const [localTextValueTo, setLocalTextValueTo] = React.useState((selected === null || selected === void 0 ? void 0 : selected.to) ? formatDateAsString$1(selected.to) : '');
19127
19128
  const [localMonth, setLocalMonth] = React.useState((selected === null || selected === void 0 ? void 0 : selected.from) || new Date());
19128
19129
  // When the day picker is selected, update the text values.
19129
19130
  const handleDayPickerSelect = (date) => {
@@ -19133,8 +19134,8 @@ function InputDateRangePicker(props) {
19133
19134
  onSelect(undefined);
19134
19135
  }
19135
19136
  else {
19136
- setLocalTextValueFrom(date.from ? formatDateAsString(date.from) : '');
19137
- setLocalTextValueTo(date.to ? formatDateAsString(date.to) : '');
19137
+ setLocalTextValueFrom(date.from ? formatDateAsString$1(date.from) : '');
19138
+ setLocalTextValueTo(date.to ? formatDateAsString$1(date.to) : '');
19138
19139
  onSelect(date);
19139
19140
  // Close the picker ONLY when a complete range is selected (from and to are different dates)
19140
19141
  if (closeOnSelect &&
@@ -19178,7 +19179,51 @@ function InputDateRangePicker(props) {
19178
19179
  setLocalTextValueTo('');
19179
19180
  }
19180
19181
  }, [isOpen, clearOnClose]);
19181
- return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, setIsOpen: setIsOpen, ariaLabel: ariaLabel, children: [jsxRuntime.jsxs(Row, { gutterWidth: gutterWidth, children: [jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(LabeledInput, { id: `${inputId}-from`, value: localTextValueFrom, placeholder: inputPlaceholder, isDisabled: isDisabled, iconName: inputIconName, onChange: (e) => handleInputChange(e, 'from'), errorMessage: fromErrorMessage, label: fromLabel, name: 'From Date', "data-testid": "date-picker-from" }) }), jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(LabeledInput, { id: `${inputId}-to`, value: localTextValueTo, placeholder: inputPlaceholder, isDisabled: isDisabled, iconName: inputIconName, onChange: (e) => handleInputChange(e, 'to'), errorMessage: toErrorMessage, label: toLabel, name: 'To Date', "data-testid": "date-picker-to" }) })] }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, month: localMonth, onMonthChange: (date) => setLocalMonth(date), mode: "range", selected: selected, onSelect: handleDayPickerSelect }, rest))] }));
19182
+ return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, setIsOpen: setIsOpen, ariaLabel: ariaLabel, children: [jsxRuntime.jsxs(Row, { gutterWidth: gutterWidth, children: [jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(LabeledInput, { id: `${inputId}-from`, value: localTextValueFrom, placeholder: inputPlaceholder, isDisabled: isDisabled, iconName: inputIconName, onChange: (e) => handleInputChange(e, 'from'), errorMessage: fromErrorMessage, label: fromLabel, name: 'From Date', "data-testid": "date-picker-from", hasHiddenLabel: hasHiddenLabel, ref: ref, readonly: isFromReadOnly, tabIndex: fromTabIndex }) }), jsxRuntime.jsx(Col, { children: jsxRuntime.jsx(LabeledInput, { id: `${inputId}-to`, value: localTextValueTo, placeholder: inputPlaceholder, isDisabled: isDisabled, iconName: inputIconName, onChange: (e) => handleInputChange(e, 'to'), errorMessage: toErrorMessage, label: toLabel, name: 'To Date', "data-testid": "date-picker-to", hasHiddenLabel: hasHiddenLabel, ref: ref, readonly: isToReadOnly, tabIndex: toTabIndex }) })] }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, month: localMonth, onMonthChange: (date) => setLocalMonth(date), mode: "range", selected: selected, onSelect: handleDayPickerSelect }, rest))] }));
19183
+ }
19184
+
19185
+ const formatDateAsString = (date) => format(date, 'MM/dd/yyyy');
19186
+
19187
+ function SingleInputDateTimePicker(props) {
19188
+ var _a;
19189
+ const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, initialMonth, id, label, selected, isOpen, inputPlaceholder, clearOnClose, inputIconName, isClearable, errorMessage, onSelect, timeValue, onTimeChange, hasHiddenLabel, isReadOnly, timePickerRef, dateTabIndex, timeTabIndex, ref } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "initialMonth", "id", "label", "selected", "isOpen", "inputPlaceholder", "clearOnClose", "inputIconName", "isClearable", "errorMessage", "onSelect", "timeValue", "onTimeChange", "hasHiddenLabel", "isReadOnly", "timePickerRef", "dateTabIndex", "timeTabIndex", "ref"]);
19190
+ const inputId = React.useId();
19191
+ // The text value is assumed to be unneeded by the consumer.
19192
+ const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString(selected) : '');
19193
+ const [localMonth, setLocalMonth] = React.useState((_a = initialMonth !== null && initialMonth !== void 0 ? initialMonth : selected) !== null && _a !== void 0 ? _a : new Date());
19194
+ // When the day picker is selected, update the text value.
19195
+ const handleDayPickerSelect = (date) => {
19196
+ if (!date) {
19197
+ setLocalTextValue('');
19198
+ onSelect(undefined);
19199
+ }
19200
+ else {
19201
+ setLocalTextValue(formatDateAsString(date));
19202
+ onSelect(date);
19203
+ }
19204
+ };
19205
+ // When the text input is changed, update the selected date.
19206
+ const handleInputChange = (e) => {
19207
+ setLocalTextValue(e.target.value); // keep the input value in sync
19208
+ const parsedDate = parse(e.target.value, 'MM/dd/yyyy', new Date());
19209
+ if (isValid(parsedDate)) {
19210
+ onSelect(parsedDate);
19211
+ }
19212
+ else {
19213
+ onSelect(undefined);
19214
+ }
19215
+ };
19216
+ // clear selection if clear on close is true
19217
+ React.useEffect(() => {
19218
+ if (!isOpen && clearOnClose) {
19219
+ onSelect(undefined);
19220
+ setLocalTextValue('');
19221
+ }
19222
+ }, [isOpen, clearOnClose]);
19223
+ const handleTimeChange = (time) => {
19224
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
19225
+ };
19226
+ return (jsxRuntime.jsxs(Row, { className: "date-time-picker-row", children: [jsxRuntime.jsx(Col, { className: "date-picker-col", children: jsxRuntime.jsxs(FloatUI, { className: "date-picker-float-ui", isOpen: isOpen, ariaLabel: ariaLabel, children: [jsxRuntime.jsx(LabeledInput, { ref: ref, className: `date-picker-input`, id: inputId, value: localTextValue, placeholder: inputPlaceholder, isDisabled: isReadOnly || isDisabled, readonly: isReadOnly, iconName: inputIconName, isClearable: isClearable, onChange: handleInputChange, errorMessage: errorMessage, hasHiddenLabel: hasHiddenLabel, label: 'Single Date Picker', name: `${id}-date-picker`, tabIndex: dateTabIndex }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth, isReadOnly: isReadOnly }, rest))] }) }), jsxRuntime.jsx(Col, { xs: "content", className: "time-picker-col", children: jsxRuntime.jsx(TimePicker, { ref: timePickerRef, className: `time-picker-input`, timeValue: timeValue, name: `${id}-time-picker`, hasHiddenLabel: true, onTimeChange: handleTimeChange, isReadOnly: isReadOnly, isDisabled: isDisabled, tabIndex: timeTabIndex }) })] }));
19182
19227
  }
19183
19228
 
19184
19229
  const Form = (_a) => {
@@ -43262,6 +43307,7 @@ exports.RadioInput = Radio;
43262
43307
  exports.Row = Row;
43263
43308
  exports.SelectInput = LabeledSelect;
43264
43309
  exports.SingleInputDatePicker = SingleInputDatePicker;
43310
+ exports.SingleInputDateTimePicker = SingleInputDateTimePicker;
43265
43311
  exports.Skeleton = Skeleton;
43266
43312
  exports.Stepper = Stepper;
43267
43313
  exports.Table = Table;