@indico-data/design-system 3.0.8 → 3.0.10

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 (36) 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 +7 -0
  4. package/lib/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.d.ts +5 -0
  5. package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +8 -0
  6. package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +10 -0
  7. package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.d.ts +10 -0
  8. package/lib/components/forms/input/Input.d.ts +1 -0
  9. package/lib/components/forms/textarea/Textarea.d.ts +1 -0
  10. package/lib/components/forms/timePicker/TimePicker.d.ts +7 -1
  11. package/lib/index.css +10 -0
  12. package/lib/index.d.ts +43 -2
  13. package/lib/index.esm.css +10 -0
  14. package/lib/index.esm.js +130 -124
  15. package/lib/index.esm.js.map +1 -1
  16. package/lib/index.js +130 -124
  17. package/lib/index.js.map +1 -1
  18. package/package.json +1 -1
  19. package/src/components/floatUI/FloatUI.tsx +2 -1
  20. package/src/components/floatUI/types.ts +1 -0
  21. package/src/components/forms/date/datePicker/DatePicker.tsx +11 -1
  22. package/src/components/forms/date/datePicker/styles/DatePicker.scss +10 -0
  23. package/src/components/forms/date/datePicker/types.ts +8 -0
  24. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.tsx +30 -0
  25. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.tsx +15 -1
  26. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +51 -0
  27. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +24 -2
  28. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +58 -0
  29. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +31 -2
  30. package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +59 -0
  31. package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +40 -5
  32. package/src/components/forms/input/Input.tsx +3 -0
  33. package/src/components/forms/textarea/Textarea.tsx +3 -0
  34. package/src/components/forms/timePicker/TimePicker.tsx +39 -1
  35. package/src/components/forms/timePicker/__tests__/TimePicker.test.tsx +4 -2
  36. 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
 
@@ -11861,116 +11861,6 @@ const getCommonProps = (props) => {
11861
11861
  });
11862
11862
  };
11863
11863
 
11864
- const formatTimeValue = (value) => {
11865
- if (!value || value.trim() === '') {
11866
- return '';
11867
- }
11868
- // Normalize the input
11869
- const normalizedValue = value.trim().toLowerCase();
11870
- // Extract time components using regex
11871
- const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
11872
- const matches = normalizedValue.match(timeRegex);
11873
- if (matches) {
11874
- const hours = parseInt(matches[1], 10);
11875
- const minutes = parseInt(matches[2], 10);
11876
- const period = matches[4].toUpperCase(); // Convert am/pm to AM/PM
11877
- // Format as hh:mm AM/PM
11878
- return `${hours}:${minutes < 10 ? '0' + minutes : minutes} ${period}`;
11879
- }
11880
- return value; // Return original if no match (shouldn't happen with valid inputs)
11881
- };
11882
- const validateInputValue = (value) => {
11883
- if (!value || value.trim() === '') {
11884
- return ''; // Empty input is allowed
11885
- }
11886
- // Normalize the input (remove extra spaces, convert to lowercase)
11887
- const normalizedValue = value.trim().toLowerCase();
11888
- // Regular expression for valid time formats: 1:10 pm, 01:10 pm, 1:10pm, 01:10pm
11889
- const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
11890
- if (!timeRegex.test(normalizedValue)) {
11891
- // Check if the issue might be a 24-hour format
11892
- const hour24Regex = /^([13-9]|1[3-9]|2[0-3]):/i;
11893
- if (hour24Regex.test(normalizedValue)) {
11894
- return 'Please enter time in 12-hour format (e.g., 1:10 pm)';
11895
- }
11896
- return 'Please enter a valid time format (e.g., 1:10 pm)';
11897
- }
11898
- // Extract hours and minutes for additional validation
11899
- const matches = normalizedValue.match(timeRegex);
11900
- if (matches) {
11901
- const hours = parseInt(matches[1], 10);
11902
- const minutes = parseInt(matches[2], 10);
11903
- if (hours < 1 || hours > 12) {
11904
- return 'Hours must be between 1 and 12';
11905
- }
11906
- if (minutes < 0 || minutes > 59) {
11907
- return 'Minutes must be between 0 and 59';
11908
- }
11909
- }
11910
- return ''; // Valid time format
11911
- };
11912
-
11913
- const TimePicker = ({ timeValue = '', label = 'Time Picker', name = 'time-picker', hasHiddenLabel = false, onTimeChange, }) => {
11914
- const [validationError, setValidationError] = React.useState('');
11915
- const [inputValue, setInputValue] = React.useState(timeValue);
11916
- const handleTimeChange = (e) => {
11917
- const newValue = e.target.value;
11918
- const error = validateInputValue(newValue);
11919
- setInputValue(newValue);
11920
- setValidationError(error);
11921
- // Only send valid values to parent component
11922
- if (!error || error === '') {
11923
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(newValue);
11924
- }
11925
- };
11926
- const handleBlur = (e) => {
11927
- const currentValue = e.target.value;
11928
- // Only format if there's no validation error
11929
- if (validationError === '' && currentValue.trim() !== '') {
11930
- const formattedValue = formatTimeValue(currentValue);
11931
- setInputValue(formattedValue);
11932
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
11933
- }
11934
- };
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
- };
11937
-
11938
- 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 futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
11941
- const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
11942
- const modeMap = {
11943
- single: {
11944
- mode: 'single',
11945
- numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
11946
- selected: selected,
11947
- onSelect: onSelect,
11948
- endMonth: endMonthDefault,
11949
- },
11950
- multiple: {
11951
- mode: 'multiple',
11952
- numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
11953
- selected: selected,
11954
- onSelect: onSelect,
11955
- endMonth: endMonthDefault,
11956
- },
11957
- range: {
11958
- mode: 'range',
11959
- numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
11960
- selected: selected,
11961
- onSelect: onSelect,
11962
- endMonth: endMonthDefault,
11963
- },
11964
- };
11965
- const modeProps = modeMap[mode];
11966
- const commonProps = getCommonProps(props);
11967
- const handleTimeChange = (time) => {
11968
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
11969
- };
11970
- 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
- };
11973
-
11974
11864
  function getNodeName$1(node) {
11975
11865
  if (isNode$1(node)) {
11976
11866
  return (node.nodeName || '').toLowerCase();
@@ -13644,7 +13534,7 @@ const defaultOptions$1 = {
13644
13534
  placement: 'bottom-start',
13645
13535
  middleware: [offset$2(5), flip$2(), shift$2()],
13646
13536
  };
13647
- function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, }) {
13537
+ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, }) {
13648
13538
  const [internalIsOpen, setInternalIsOpen] = React.useState(false);
13649
13539
  // Determine whether the component is controlled or uncontrolled
13650
13540
  const isControlled = controlledIsOpen !== undefined && controlledSetIsOpen !== undefined;
@@ -13666,13 +13556,129 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
13666
13556
  const click = useClick(context);
13667
13557
  const dismiss = useDismiss(context);
13668
13558
  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 }) })));
13559
+ 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
13560
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: trigger })), isOpen &&
13671
13561
  (isPortal ? (jsxRuntime.jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
13672
13562
  }
13673
13563
 
13564
+ const formatTimeValue = (value) => {
13565
+ if (!value || value.trim() === '') {
13566
+ return '';
13567
+ }
13568
+ // Normalize the input
13569
+ const normalizedValue = value.trim().toLowerCase();
13570
+ // Extract time components using regex
13571
+ const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
13572
+ const matches = normalizedValue.match(timeRegex);
13573
+ if (matches) {
13574
+ const hours = parseInt(matches[1], 10);
13575
+ const minutes = parseInt(matches[2], 10);
13576
+ const period = matches[4].toUpperCase(); // Convert am/pm to AM/PM
13577
+ // Format as hh:mm AM/PM
13578
+ return `${hours}:${minutes < 10 ? '0' + minutes : minutes} ${period}`;
13579
+ }
13580
+ return value; // Return original if no match (shouldn't happen with valid inputs)
13581
+ };
13582
+ const validateInputValue = (value) => {
13583
+ if (!value || value.trim() === '') {
13584
+ return ''; // Empty input is allowed
13585
+ }
13586
+ // Normalize the input (remove extra spaces, convert to lowercase)
13587
+ const normalizedValue = value.trim().toLowerCase();
13588
+ // Regular expression for valid time formats: 1:10 pm, 01:10 pm, 1:10pm, 01:10pm
13589
+ const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
13590
+ if (!timeRegex.test(normalizedValue)) {
13591
+ // Check if the issue might be a 24-hour format
13592
+ const hour24Regex = /^([13-9]|1[3-9]|2[0-3]):/i;
13593
+ if (hour24Regex.test(normalizedValue)) {
13594
+ return 'Please enter time in 12-hour format (e.g., 1:10 pm)';
13595
+ }
13596
+ return 'Please enter a valid time format (e.g., 1:10 pm)';
13597
+ }
13598
+ // Extract hours and minutes for additional validation
13599
+ const matches = normalizedValue.match(timeRegex);
13600
+ if (matches) {
13601
+ const hours = parseInt(matches[1], 10);
13602
+ const minutes = parseInt(matches[2], 10);
13603
+ if (hours < 1 || hours > 12) {
13604
+ return 'Hours must be between 1 and 12';
13605
+ }
13606
+ if (minutes < 0 || minutes > 59) {
13607
+ return 'Minutes must be between 0 and 59';
13608
+ }
13609
+ }
13610
+ return ''; // Valid time format
13611
+ };
13612
+
13613
+ const TimePicker = (_a) => {
13614
+ 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"]);
13615
+ const [validationError, setValidationError] = React.useState('');
13616
+ const [inputValue, setInputValue] = React.useState(timeValue);
13617
+ const handleTimeChange = (e) => {
13618
+ const newValue = e.target.value;
13619
+ const error = validateInputValue(newValue);
13620
+ setInputValue(newValue);
13621
+ setValidationError(error);
13622
+ // Only send valid values to parent component
13623
+ if (!error || error === '') {
13624
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(newValue);
13625
+ }
13626
+ };
13627
+ const handleBlur = (e) => {
13628
+ const currentValue = e.target.value;
13629
+ // Only format if there's no validation error
13630
+ if (validationError === '' && currentValue.trim() !== '') {
13631
+ const formattedValue = formatTimeValue(currentValue);
13632
+ setInputValue(formattedValue);
13633
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
13634
+ }
13635
+ };
13636
+ return (jsxRuntime.jsxs("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, readonly: isReadOnly, isDisabled: isDisabled }, rest)), jsxRuntime.jsxs(FloatUI, { ariaLabel: "Time validation error", isOpen: !!validationError, setIsOpen: () => { }, isPortal: true, portalOptions: {
13637
+ rootId: 'theme-root' ,
13638
+ }, floatingOptions: {
13639
+ placement: 'bottom-start',
13640
+ middleware: [offset$2(5), flip$2(), shift$2()],
13641
+ }, children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", { className: "time-validation-error", children: validationError && jsxRuntime.jsx("div", { className: "error-message", children: validationError }) })] })] }));
13642
+ };
13643
+
13644
+ const DatePicker = (props) => {
13645
+ 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"]);
13646
+ const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
13647
+ const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
13648
+ const modeMap = {
13649
+ single: {
13650
+ mode: 'single',
13651
+ numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
13652
+ selected: selected,
13653
+ onSelect: onSelect,
13654
+ endMonth: endMonthDefault,
13655
+ },
13656
+ multiple: {
13657
+ mode: 'multiple',
13658
+ numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
13659
+ selected: selected,
13660
+ onSelect: onSelect,
13661
+ endMonth: endMonthDefault,
13662
+ },
13663
+ range: {
13664
+ mode: 'range',
13665
+ numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
13666
+ selected: selected,
13667
+ onSelect: onSelect,
13668
+ endMonth: endMonthDefault,
13669
+ },
13670
+ };
13671
+ const modeProps = modeMap[mode];
13672
+ const commonProps = getCommonProps(props);
13673
+ const handleTimeChange = (time) => {
13674
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
13675
+ };
13676
+ const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
13677
+ 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))] }));
13678
+ };
13679
+
13674
13680
  const IconTriggerDatePicker = (props) => {
13675
- const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, id, label, onSelect, selected, triggerIcon, triggerIconSize, mode, isOpen, clearOnClose, initialMonth } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "id", "label", "onSelect", "selected", "triggerIcon", "triggerIconSize", "mode", "isOpen", "clearOnClose", "initialMonth"]);
13681
+ const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, id, label, onSelect, selected, triggerIcon, triggerIconSize, mode, isOpen, clearOnClose, initialMonth, portalOptions, floatingOptions, isPortal } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "id", "label", "onSelect", "selected", "triggerIcon", "triggerIconSize", "mode", "isOpen", "clearOnClose", "initialMonth", "portalOptions", "floatingOptions", "isPortal"]);
13676
13682
  const [localMonth, setLocalMonth] = React.useState(initialMonth !== null && initialMonth !== void 0 ? initialMonth : new Date());
13677
13683
  const handleSelect = (date) => {
13678
13684
  if (!date) {
@@ -13688,7 +13694,7 @@ const IconTriggerDatePicker = (props) => {
13688
13694
  onSelect && onSelect(undefined);
13689
13695
  }
13690
13696
  }, [isOpen, clearOnClose]);
13691
- return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [jsxRuntime.jsx(Icon, { "aria-label": "Open date picker", name: triggerIcon, size: triggerIconSize, className: "date__picker__trigger", "data-testid": `datepicker-trigger-for-${id}` }), jsxRuntime.jsx(DatePicker, Object.assign({ isDisabled: isDisabled, mode: mode, selected: selected, onSelect: handleSelect, month: localMonth, startMonth: disableBeforeDate, endMonth: disableAfterDate, onMonthChange: setLocalMonth }, rest))] }));
13697
+ return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, isPortal: isPortal, portalOptions: portalOptions, floatingOptions: floatingOptions, children: [jsxRuntime.jsx(Icon, { "aria-label": "Open date picker", name: triggerIcon, size: triggerIconSize, className: "date__picker__trigger", "data-testid": `datepicker-trigger-for-${id}` }), jsxRuntime.jsx(DatePicker, Object.assign({ isDisabled: isDisabled, mode: mode, selected: selected, onSelect: handleSelect, month: localMonth, startMonth: disableBeforeDate, endMonth: disableAfterDate, onMonthChange: setLocalMonth }, rest))] }));
13692
13698
  };
13693
13699
 
13694
13700
  /**
@@ -19081,7 +19087,7 @@ const formatDateAsString$1 = (date) => format(date, 'MM/dd/yyyy');
19081
19087
 
19082
19088
  function SingleInputDatePicker(props) {
19083
19089
  var _a;
19084
- const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, initialMonth, id, label, selected, isOpen, inputPlaceholder, clearOnClose, inputIconName, isClearable, errorMessage, onSelect, hasHiddenLabel } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "initialMonth", "id", "label", "selected", "isOpen", "inputPlaceholder", "clearOnClose", "inputIconName", "isClearable", "errorMessage", "onSelect", "hasHiddenLabel"]);
19090
+ const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, initialMonth, id, label, selected, isOpen, inputPlaceholder, clearOnClose, inputIconName, isClearable, errorMessage, onSelect, hasHiddenLabel, ref, isReadOnly, tabIndex, portalOptions, floatingOptions, isPortal } = 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", "portalOptions", "floatingOptions", "isPortal"]);
19085
19091
  const inputId = React.useId();
19086
19092
  // The text value is assumed to be unneeded by the consumer.
19087
19093
  const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString$1(selected) : '');
@@ -19115,11 +19121,11 @@ function SingleInputDatePicker(props) {
19115
19121
  setLocalTextValue('');
19116
19122
  }
19117
19123
  }, [isOpen, clearOnClose]);
19118
- 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', name: 'Date Picker' }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
19124
+ return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, isPortal: isPortal, portalOptions: portalOptions, floatingOptions: floatingOptions, 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
19125
  }
19120
19126
 
19121
19127
  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, hasHiddenLabel } = 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"]);
19128
+ 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, portalOptions, floatingOptions, isPortal } = 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", "portalOptions", "floatingOptions", "isPortal"]);
19123
19129
  const inputId = React.useId();
19124
19130
  // Hold the input values in state
19125
19131
  const [localTextValueFrom, setLocalTextValueFrom] = React.useState((selected === null || selected === void 0 ? void 0 : selected.from) ? formatDateAsString$1(selected.from) : '');
@@ -19178,14 +19184,14 @@ function InputDateRangePicker(props) {
19178
19184
  setLocalTextValueTo('');
19179
19185
  }
19180
19186
  }, [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", hasHiddenLabel: hasHiddenLabel }) }), 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 }) })] }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, month: localMonth, onMonthChange: (date) => setLocalMonth(date), mode: "range", selected: selected, onSelect: handleDayPickerSelect }, rest))] }));
19187
+ return (jsxRuntime.jsxs(FloatUI, { isOpen: isOpen, setIsOpen: setIsOpen, ariaLabel: ariaLabel, portalOptions: portalOptions, floatingOptions: floatingOptions, 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))] }));
19182
19188
  }
19183
19189
 
19184
19190
  const formatDateAsString = (date) => format(date, 'MM/dd/yyyy');
19185
19191
 
19186
19192
  function SingleInputDateTimePicker(props) {
19187
19193
  var _a;
19188
- const { ariaLabel, className, isDisabled, disableBeforeDate, disableAfterDate, captionLayout, initialMonth, id, label, selected, isOpen, inputPlaceholder, clearOnClose, inputIconName, isClearable, errorMessage, onSelect, timeValue, onTimeChange, hasHiddenLabel } = props, rest = __rest(props, ["ariaLabel", "className", "isDisabled", "disableBeforeDate", "disableAfterDate", "captionLayout", "initialMonth", "id", "label", "selected", "isOpen", "inputPlaceholder", "clearOnClose", "inputIconName", "isClearable", "errorMessage", "onSelect", "timeValue", "onTimeChange", "hasHiddenLabel"]);
19194
+ 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, portalOptions, floatingOptions, isPortal } = 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", "portalOptions", "floatingOptions", "isPortal"]);
19189
19195
  const inputId = React.useId();
19190
19196
  // The text value is assumed to be unneeded by the consumer.
19191
19197
  const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString(selected) : '');
@@ -19222,7 +19228,7 @@ function SingleInputDateTimePicker(props) {
19222
19228
  const handleTimeChange = (time) => {
19223
19229
  onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
19224
19230
  };
19225
- return (jsxRuntime.jsxs(Row, { children: [jsxRuntime.jsx(Col, { children: 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, hasHiddenLabel: hasHiddenLabel, label: 'Single Date Picker', name: `${id}-date-picker` }), jsxRuntime.jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }) }), jsxRuntime.jsx(Col, { xs: "content", children: jsxRuntime.jsx(TimePicker, { timeValue: timeValue, name: `${id}-time-picker`, hasHiddenLabel: true, onTimeChange: handleTimeChange }) })] }));
19231
+ 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, isPortal: isPortal, portalOptions: portalOptions, floatingOptions: floatingOptions, 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 }) })] }));
19226
19232
  }
19227
19233
 
19228
19234
  const Form = (_a) => {