@indico-data/design-system 3.0.9 → 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 (25) hide show
  1. package/lib/components/forms/date/datePicker/types.d.ts +3 -0
  2. package/lib/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.d.ts +5 -0
  3. package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +5 -0
  4. package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +5 -0
  5. package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.d.ts +5 -0
  6. package/lib/index.css +10 -0
  7. package/lib/index.d.ts +15 -0
  8. package/lib/index.esm.css +10 -0
  9. package/lib/index.esm.js +124 -119
  10. package/lib/index.esm.js.map +1 -1
  11. package/lib/index.js +124 -119
  12. package/lib/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/components/forms/date/datePicker/styles/DatePicker.scss +10 -0
  15. package/src/components/forms/date/datePicker/types.ts +4 -0
  16. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.tsx +30 -0
  17. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.tsx +15 -1
  18. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +30 -0
  19. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +15 -2
  20. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +26 -3
  21. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +15 -2
  22. package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +26 -3
  23. package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +16 -1
  24. package/src/components/forms/timePicker/TimePicker.tsx +21 -1
  25. package/src/components/forms/timePicker/__tests__/TimePicker.test.tsx +4 -2
@@ -53,3 +53,6 @@ export interface CommonProps {
53
53
  onPrevClick?: MonthChangeEventHandler;
54
54
  onDayClick?: DayEventHandler<React.MouseEvent>;
55
55
  }
56
+ export interface PortalOptions {
57
+ rootId?: string;
58
+ }
@@ -1,5 +1,7 @@
1
1
  import { DateRange, Mode } from 'react-day-picker';
2
2
  import { IconName, IconSizes } from '../../../icons/types';
3
+ import { UseFloatingOptions } from '@floating-ui/react-dom';
4
+ import { PortalOptions } from '../datePicker/types';
3
5
  interface Props {
4
6
  mode?: Mode;
5
7
  ariaLabel: string;
@@ -17,6 +19,9 @@ interface Props {
17
19
  className?: string;
18
20
  initialMonth?: Date;
19
21
  'data-testid'?: string;
22
+ portalOptions?: PortalOptions;
23
+ isPortal?: boolean;
24
+ floatingOptions?: UseFloatingOptions;
20
25
  }
21
26
  export declare const IconTriggerDatePicker: (props: Props) => import("react/jsx-runtime").JSX.Element;
22
27
  export {};
@@ -1,4 +1,6 @@
1
1
  import type { IconName } from '../../../icons/types';
2
+ import { UseFloatingOptions } from '@floating-ui/react-dom';
3
+ import { PortalOptions } from '../datePicker/types';
2
4
  export interface SingleInputDatePickerProps {
3
5
  ariaLabel: string;
4
6
  disableBeforeDate?: Date;
@@ -22,5 +24,8 @@ export interface SingleInputDatePickerProps {
22
24
  ref?: React.LegacyRef<HTMLInputElement>;
23
25
  isReadOnly?: boolean;
24
26
  tabIndex?: number;
27
+ portalOptions?: PortalOptions;
28
+ floatingOptions?: UseFloatingOptions;
29
+ isPortal?: boolean;
25
30
  }
26
31
  export declare function SingleInputDatePicker(props: SingleInputDatePickerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,7 @@
1
1
  import { IconName } from '../../../icons/types';
2
2
  import { DateRange } from 'react-day-picker';
3
+ import { UseFloatingOptions } from '@floating-ui/react-dom';
4
+ import { PortalOptions } from '../datePicker/types';
3
5
  interface InputDateRangePickerProps {
4
6
  ariaLabel: string;
5
7
  disableBeforeDate?: Date;
@@ -29,6 +31,9 @@ interface InputDateRangePickerProps {
29
31
  isToReadOnly?: boolean;
30
32
  toTabIndex?: number;
31
33
  fromTabIndex?: number;
34
+ portalOptions?: PortalOptions;
35
+ floatingOptions?: UseFloatingOptions;
36
+ isPortal?: boolean;
32
37
  }
33
38
  export declare function InputDateRangePicker(props: InputDateRangePickerProps): import("react/jsx-runtime").JSX.Element;
34
39
  export {};
@@ -1,4 +1,6 @@
1
1
  import type { IconName } from '../../../icons/types';
2
+ import { UseFloatingOptions } from '@floating-ui/react-dom';
3
+ import { PortalOptions } from '../datePicker/types';
2
4
  export interface SingleInputDateTimePickerProps {
3
5
  ariaLabel: string;
4
6
  disableBeforeDate?: Date;
@@ -26,5 +28,8 @@ export interface SingleInputDateTimePickerProps {
26
28
  timePickerRef?: React.LegacyRef<HTMLInputElement>;
27
29
  dateTabIndex?: number;
28
30
  timeTabIndex?: number;
31
+ portalOptions?: PortalOptions;
32
+ floatingOptions?: UseFloatingOptions;
33
+ isPortal?: boolean;
29
34
  }
30
35
  export declare function SingleInputDateTimePicker(props: SingleInputDateTimePickerProps): import("react/jsx-runtime").JSX.Element;
package/lib/index.css CHANGED
@@ -2235,6 +2235,16 @@ body div[class*=select__single-value] {
2235
2235
  width: 348px;
2236
2236
  }
2237
2237
 
2238
+ .time-validation-error {
2239
+ background-color: var(--pf-tooltip-background-color);
2240
+ color: var(--pf-tooltip-font-color);
2241
+ padding: var(--pf-padding-2);
2242
+ border-radius: var(--pf-rounded);
2243
+ width: 200px;
2244
+ box-shadow: var(--pf-dropshadow);
2245
+ font-size: var(--pf-font-size-overline);
2246
+ }
2247
+
2238
2248
  :root [data-theme=light] {
2239
2249
  --pf-badge-background-color: var(--pf-page-background-color);
2240
2250
  --pf-badge-font-color: var(--pf-font-color);
package/lib/index.d.ts CHANGED
@@ -406,6 +406,9 @@ interface DatePickerProps {
406
406
  timeTabIndex?: number;
407
407
  dateTabIndex?: number;
408
408
  }
409
+ interface PortalOptions {
410
+ rootId?: string;
411
+ }
409
412
 
410
413
  declare const DatePicker: (props: DatePickerProps) => react_jsx_runtime.JSX.Element;
411
414
 
@@ -441,6 +444,9 @@ interface Props$3 {
441
444
  className?: string;
442
445
  initialMonth?: Date;
443
446
  'data-testid'?: string;
447
+ portalOptions?: PortalOptions;
448
+ isPortal?: boolean;
449
+ floatingOptions?: UseFloatingOptions;
444
450
  }
445
451
  declare const IconTriggerDatePicker: (props: Props$3) => react_jsx_runtime.JSX.Element;
446
452
 
@@ -467,6 +473,9 @@ interface SingleInputDatePickerProps {
467
473
  ref?: React.LegacyRef<HTMLInputElement>;
468
474
  isReadOnly?: boolean;
469
475
  tabIndex?: number;
476
+ portalOptions?: PortalOptions;
477
+ floatingOptions?: UseFloatingOptions;
478
+ isPortal?: boolean;
470
479
  }
471
480
  declare function SingleInputDatePicker(props: SingleInputDatePickerProps): react_jsx_runtime.JSX.Element;
472
481
 
@@ -499,6 +508,9 @@ interface InputDateRangePickerProps {
499
508
  isToReadOnly?: boolean;
500
509
  toTabIndex?: number;
501
510
  fromTabIndex?: number;
511
+ portalOptions?: PortalOptions;
512
+ floatingOptions?: UseFloatingOptions;
513
+ isPortal?: boolean;
502
514
  }
503
515
  declare function InputDateRangePicker(props: InputDateRangePickerProps): react_jsx_runtime.JSX.Element;
504
516
 
@@ -529,6 +541,9 @@ interface SingleInputDateTimePickerProps {
529
541
  timePickerRef?: React.LegacyRef<HTMLInputElement>;
530
542
  dateTabIndex?: number;
531
543
  timeTabIndex?: number;
544
+ portalOptions?: PortalOptions;
545
+ floatingOptions?: UseFloatingOptions;
546
+ isPortal?: boolean;
532
547
  }
533
548
  declare function SingleInputDateTimePicker(props: SingleInputDateTimePickerProps): react_jsx_runtime.JSX.Element;
534
549
 
package/lib/index.esm.css CHANGED
@@ -2235,6 +2235,16 @@ body div[class*=select__single-value] {
2235
2235
  width: 348px;
2236
2236
  }
2237
2237
 
2238
+ .time-validation-error {
2239
+ background-color: var(--pf-tooltip-background-color);
2240
+ color: var(--pf-tooltip-font-color);
2241
+ padding: var(--pf-padding-2);
2242
+ border-radius: var(--pf-rounded);
2243
+ width: 200px;
2244
+ box-shadow: var(--pf-dropshadow);
2245
+ font-size: var(--pf-font-size-overline);
2246
+ }
2247
+
2238
2248
  :root [data-theme=light] {
2239
2249
  --pf-badge-background-color: var(--pf-page-background-color);
2240
2250
  --pf-badge-font-color: var(--pf-font-color);
package/lib/index.esm.js CHANGED
@@ -11836,117 +11836,6 @@ const getCommonProps = (props) => {
11836
11836
  });
11837
11837
  };
11838
11838
 
11839
- const formatTimeValue = (value) => {
11840
- if (!value || value.trim() === '') {
11841
- return '';
11842
- }
11843
- // Normalize the input
11844
- const normalizedValue = value.trim().toLowerCase();
11845
- // Extract time components using regex
11846
- const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
11847
- const matches = normalizedValue.match(timeRegex);
11848
- if (matches) {
11849
- const hours = parseInt(matches[1], 10);
11850
- const minutes = parseInt(matches[2], 10);
11851
- const period = matches[4].toUpperCase(); // Convert am/pm to AM/PM
11852
- // Format as hh:mm AM/PM
11853
- return `${hours}:${minutes < 10 ? '0' + minutes : minutes} ${period}`;
11854
- }
11855
- return value; // Return original if no match (shouldn't happen with valid inputs)
11856
- };
11857
- const validateInputValue = (value) => {
11858
- if (!value || value.trim() === '') {
11859
- return ''; // Empty input is allowed
11860
- }
11861
- // Normalize the input (remove extra spaces, convert to lowercase)
11862
- const normalizedValue = value.trim().toLowerCase();
11863
- // Regular expression for valid time formats: 1:10 pm, 01:10 pm, 1:10pm, 01:10pm
11864
- const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
11865
- if (!timeRegex.test(normalizedValue)) {
11866
- // Check if the issue might be a 24-hour format
11867
- const hour24Regex = /^([13-9]|1[3-9]|2[0-3]):/i;
11868
- if (hour24Regex.test(normalizedValue)) {
11869
- return 'Please enter time in 12-hour format (e.g., 1:10 pm)';
11870
- }
11871
- return 'Please enter a valid time format (e.g., 1:10 pm)';
11872
- }
11873
- // Extract hours and minutes for additional validation
11874
- const matches = normalizedValue.match(timeRegex);
11875
- if (matches) {
11876
- const hours = parseInt(matches[1], 10);
11877
- const minutes = parseInt(matches[2], 10);
11878
- if (hours < 1 || hours > 12) {
11879
- return 'Hours must be between 1 and 12';
11880
- }
11881
- if (minutes < 0 || minutes > 59) {
11882
- return 'Minutes must be between 0 and 59';
11883
- }
11884
- }
11885
- return ''; // Valid time format
11886
- };
11887
-
11888
- const TimePicker = (_a) => {
11889
- 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"]);
11890
- const [validationError, setValidationError] = useState('');
11891
- const [inputValue, setInputValue] = useState(timeValue);
11892
- const handleTimeChange = (e) => {
11893
- const newValue = e.target.value;
11894
- const error = validateInputValue(newValue);
11895
- setInputValue(newValue);
11896
- setValidationError(error);
11897
- // Only send valid values to parent component
11898
- if (!error || error === '') {
11899
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(newValue);
11900
- }
11901
- };
11902
- const handleBlur = (e) => {
11903
- const currentValue = e.target.value;
11904
- // Only format if there's no validation error
11905
- if (validationError === '' && currentValue.trim() !== '') {
11906
- const formattedValue = formatTimeValue(currentValue);
11907
- setInputValue(formattedValue);
11908
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
11909
- }
11910
- };
11911
- return (jsx("div", { className: "time-input-wrapper", children: 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)) }));
11912
- };
11913
-
11914
- const DatePicker = (props) => {
11915
- 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"]);
11916
- const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
11917
- const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
11918
- const modeMap = {
11919
- single: {
11920
- mode: 'single',
11921
- numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
11922
- selected: selected,
11923
- onSelect: onSelect,
11924
- endMonth: endMonthDefault,
11925
- },
11926
- multiple: {
11927
- mode: 'multiple',
11928
- numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
11929
- selected: selected,
11930
- onSelect: onSelect,
11931
- endMonth: endMonthDefault,
11932
- },
11933
- range: {
11934
- mode: 'range',
11935
- numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
11936
- selected: selected,
11937
- onSelect: onSelect,
11938
- endMonth: endMonthDefault,
11939
- },
11940
- };
11941
- const modeProps = modeMap[mode];
11942
- const commonProps = getCommonProps(props);
11943
- const handleTimeChange = (time) => {
11944
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
11945
- };
11946
- const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
11947
- return (jsxs("div", { className: "date-picker-wrapper", children: [hasTimePicker && (jsx("div", { className: "time-picker-wrapper", children: jsxs(Row, { align: "center", children: [jsx(Col, { xs: "content", children: jsx("p", { className: "ma-0", children: "Select Time" }) }), jsx(Col, { children: jsx(TimePicker, { ref: ref, timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange, readonly: isReadOnly, tabIndex: timeTabIndex }) })] }) })), jsx(DayPicker, Object.assign({}, finalProps))] }));
11948
- };
11949
-
11950
11839
  function getNodeName$1(node) {
11951
11840
  if (isNode$1(node)) {
11952
11841
  return (node.nodeName || '').toLowerCase();
@@ -13647,8 +13536,124 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
13647
13536
  (isPortal ? (jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
13648
13537
  }
13649
13538
 
13539
+ const formatTimeValue = (value) => {
13540
+ if (!value || value.trim() === '') {
13541
+ return '';
13542
+ }
13543
+ // Normalize the input
13544
+ const normalizedValue = value.trim().toLowerCase();
13545
+ // Extract time components using regex
13546
+ const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
13547
+ const matches = normalizedValue.match(timeRegex);
13548
+ if (matches) {
13549
+ const hours = parseInt(matches[1], 10);
13550
+ const minutes = parseInt(matches[2], 10);
13551
+ const period = matches[4].toUpperCase(); // Convert am/pm to AM/PM
13552
+ // Format as hh:mm AM/PM
13553
+ return `${hours}:${minutes < 10 ? '0' + minutes : minutes} ${period}`;
13554
+ }
13555
+ return value; // Return original if no match (shouldn't happen with valid inputs)
13556
+ };
13557
+ const validateInputValue = (value) => {
13558
+ if (!value || value.trim() === '') {
13559
+ return ''; // Empty input is allowed
13560
+ }
13561
+ // Normalize the input (remove extra spaces, convert to lowercase)
13562
+ const normalizedValue = value.trim().toLowerCase();
13563
+ // Regular expression for valid time formats: 1:10 pm, 01:10 pm, 1:10pm, 01:10pm
13564
+ const timeRegex = /^(0?[1-9]|1[0-2]):([0-5][0-9])(\s*)([ap]m)$/i;
13565
+ if (!timeRegex.test(normalizedValue)) {
13566
+ // Check if the issue might be a 24-hour format
13567
+ const hour24Regex = /^([13-9]|1[3-9]|2[0-3]):/i;
13568
+ if (hour24Regex.test(normalizedValue)) {
13569
+ return 'Please enter time in 12-hour format (e.g., 1:10 pm)';
13570
+ }
13571
+ return 'Please enter a valid time format (e.g., 1:10 pm)';
13572
+ }
13573
+ // Extract hours and minutes for additional validation
13574
+ const matches = normalizedValue.match(timeRegex);
13575
+ if (matches) {
13576
+ const hours = parseInt(matches[1], 10);
13577
+ const minutes = parseInt(matches[2], 10);
13578
+ if (hours < 1 || hours > 12) {
13579
+ return 'Hours must be between 1 and 12';
13580
+ }
13581
+ if (minutes < 0 || minutes > 59) {
13582
+ return 'Minutes must be between 0 and 59';
13583
+ }
13584
+ }
13585
+ return ''; // Valid time format
13586
+ };
13587
+
13588
+ const TimePicker = (_a) => {
13589
+ 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"]);
13590
+ const [validationError, setValidationError] = useState('');
13591
+ const [inputValue, setInputValue] = useState(timeValue);
13592
+ const handleTimeChange = (e) => {
13593
+ const newValue = e.target.value;
13594
+ const error = validateInputValue(newValue);
13595
+ setInputValue(newValue);
13596
+ setValidationError(error);
13597
+ // Only send valid values to parent component
13598
+ if (!error || error === '') {
13599
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(newValue);
13600
+ }
13601
+ };
13602
+ const handleBlur = (e) => {
13603
+ const currentValue = e.target.value;
13604
+ // Only format if there's no validation error
13605
+ if (validationError === '' && currentValue.trim() !== '') {
13606
+ const formattedValue = formatTimeValue(currentValue);
13607
+ setInputValue(formattedValue);
13608
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
13609
+ }
13610
+ };
13611
+ return (jsxs("div", { className: "time-input-wrapper", children: [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)), jsxs(FloatUI, { ariaLabel: "Time validation error", isOpen: !!validationError, setIsOpen: () => { }, isPortal: true, portalOptions: {
13612
+ rootId: 'theme-root' ,
13613
+ }, floatingOptions: {
13614
+ placement: 'bottom-start',
13615
+ middleware: [offset$2(5), flip$2(), shift$2()],
13616
+ }, children: [jsx("div", {}), jsx("div", { className: "time-validation-error", children: validationError && jsx("div", { className: "error-message", children: validationError }) })] })] }));
13617
+ };
13618
+
13619
+ const DatePicker = (props) => {
13620
+ 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"]);
13621
+ const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
13622
+ const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
13623
+ const modeMap = {
13624
+ single: {
13625
+ mode: 'single',
13626
+ numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
13627
+ selected: selected,
13628
+ onSelect: onSelect,
13629
+ endMonth: endMonthDefault,
13630
+ },
13631
+ multiple: {
13632
+ mode: 'multiple',
13633
+ numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
13634
+ selected: selected,
13635
+ onSelect: onSelect,
13636
+ endMonth: endMonthDefault,
13637
+ },
13638
+ range: {
13639
+ mode: 'range',
13640
+ numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
13641
+ selected: selected,
13642
+ onSelect: onSelect,
13643
+ endMonth: endMonthDefault,
13644
+ },
13645
+ };
13646
+ const modeProps = modeMap[mode];
13647
+ const commonProps = getCommonProps(props);
13648
+ const handleTimeChange = (time) => {
13649
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
13650
+ };
13651
+ const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
13652
+ return (jsxs("div", { className: "date-picker-wrapper", children: [hasTimePicker && (jsx("div", { className: "time-picker-wrapper", children: jsxs(Row, { align: "center", children: [jsx(Col, { xs: "content", children: jsx("p", { className: "ma-0", children: "Select Time" }) }), jsx(Col, { children: jsx(TimePicker, { ref: ref, timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange, readonly: isReadOnly, tabIndex: timeTabIndex }) })] }) })), jsx(DayPicker, Object.assign({}, finalProps))] }));
13653
+ };
13654
+
13650
13655
  const IconTriggerDatePicker = (props) => {
13651
- 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"]);
13656
+ 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"]);
13652
13657
  const [localMonth, setLocalMonth] = useState(initialMonth !== null && initialMonth !== void 0 ? initialMonth : new Date());
13653
13658
  const handleSelect = (date) => {
13654
13659
  if (!date) {
@@ -13664,7 +13669,7 @@ const IconTriggerDatePicker = (props) => {
13664
13669
  onSelect && onSelect(undefined);
13665
13670
  }
13666
13671
  }, [isOpen, clearOnClose]);
13667
- return (jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [jsx(Icon, { "aria-label": "Open date picker", name: triggerIcon, size: triggerIconSize, className: "date__picker__trigger", "data-testid": `datepicker-trigger-for-${id}` }), jsx(DatePicker, Object.assign({ isDisabled: isDisabled, mode: mode, selected: selected, onSelect: handleSelect, month: localMonth, startMonth: disableBeforeDate, endMonth: disableAfterDate, onMonthChange: setLocalMonth }, rest))] }));
13672
+ return (jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, isPortal: isPortal, portalOptions: portalOptions, floatingOptions: floatingOptions, children: [jsx(Icon, { "aria-label": "Open date picker", name: triggerIcon, size: triggerIconSize, className: "date__picker__trigger", "data-testid": `datepicker-trigger-for-${id}` }), jsx(DatePicker, Object.assign({ isDisabled: isDisabled, mode: mode, selected: selected, onSelect: handleSelect, month: localMonth, startMonth: disableBeforeDate, endMonth: disableAfterDate, onMonthChange: setLocalMonth }, rest))] }));
13668
13673
  };
13669
13674
 
13670
13675
  /**
@@ -19057,7 +19062,7 @@ const formatDateAsString$1 = (date) => format(date, 'MM/dd/yyyy');
19057
19062
 
19058
19063
  function SingleInputDatePicker(props) {
19059
19064
  var _a;
19060
- 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"]);
19065
+ 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"]);
19061
19066
  const inputId = useId$1();
19062
19067
  // The text value is assumed to be unneeded by the consumer.
19063
19068
  const [localTextValue, setLocalTextValue] = useState(selected ? formatDateAsString$1(selected) : '');
@@ -19091,11 +19096,11 @@ function SingleInputDatePicker(props) {
19091
19096
  setLocalTextValue('');
19092
19097
  }
19093
19098
  }, [isOpen, clearOnClose]);
19094
- return (jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [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 }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
19099
+ return (jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, isPortal: isPortal, portalOptions: portalOptions, floatingOptions: floatingOptions, children: [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 }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
19095
19100
  }
19096
19101
 
19097
19102
  function InputDateRangePicker(props) {
19098
- 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"]);
19103
+ 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"]);
19099
19104
  const inputId = useId$1();
19100
19105
  // Hold the input values in state
19101
19106
  const [localTextValueFrom, setLocalTextValueFrom] = useState((selected === null || selected === void 0 ? void 0 : selected.from) ? formatDateAsString$1(selected.from) : '');
@@ -19154,14 +19159,14 @@ function InputDateRangePicker(props) {
19154
19159
  setLocalTextValueTo('');
19155
19160
  }
19156
19161
  }, [isOpen, clearOnClose]);
19157
- return (jsxs(FloatUI, { isOpen: isOpen, setIsOpen: setIsOpen, ariaLabel: ariaLabel, children: [jsxs(Row, { gutterWidth: gutterWidth, children: [jsx(Col, { children: 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 }) }), jsx(Col, { children: 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 }) })] }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, month: localMonth, onMonthChange: (date) => setLocalMonth(date), mode: "range", selected: selected, onSelect: handleDayPickerSelect }, rest))] }));
19162
+ return (jsxs(FloatUI, { isOpen: isOpen, setIsOpen: setIsOpen, ariaLabel: ariaLabel, portalOptions: portalOptions, floatingOptions: floatingOptions, children: [jsxs(Row, { gutterWidth: gutterWidth, children: [jsx(Col, { children: 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 }) }), jsx(Col, { children: 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 }) })] }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, month: localMonth, onMonthChange: (date) => setLocalMonth(date), mode: "range", selected: selected, onSelect: handleDayPickerSelect }, rest))] }));
19158
19163
  }
19159
19164
 
19160
19165
  const formatDateAsString = (date) => format(date, 'MM/dd/yyyy');
19161
19166
 
19162
19167
  function SingleInputDateTimePicker(props) {
19163
19168
  var _a;
19164
- 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"]);
19169
+ 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"]);
19165
19170
  const inputId = useId$1();
19166
19171
  // The text value is assumed to be unneeded by the consumer.
19167
19172
  const [localTextValue, setLocalTextValue] = useState(selected ? formatDateAsString(selected) : '');
@@ -19198,7 +19203,7 @@ function SingleInputDateTimePicker(props) {
19198
19203
  const handleTimeChange = (time) => {
19199
19204
  onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
19200
19205
  };
19201
- return (jsxs(Row, { className: "date-time-picker-row", children: [jsx(Col, { className: "date-picker-col", children: jsxs(FloatUI, { className: "date-picker-float-ui", isOpen: isOpen, ariaLabel: ariaLabel, children: [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 }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth, isReadOnly: isReadOnly }, rest))] }) }), jsx(Col, { xs: "content", className: "time-picker-col", children: jsx(TimePicker, { ref: timePickerRef, className: `time-picker-input`, timeValue: timeValue, name: `${id}-time-picker`, hasHiddenLabel: true, onTimeChange: handleTimeChange, isReadOnly: isReadOnly, isDisabled: isDisabled, tabIndex: timeTabIndex }) })] }));
19206
+ return (jsxs(Row, { className: "date-time-picker-row", children: [jsx(Col, { className: "date-picker-col", children: jsxs(FloatUI, { className: "date-picker-float-ui", isOpen: isOpen, ariaLabel: ariaLabel, isPortal: isPortal, portalOptions: portalOptions, floatingOptions: floatingOptions, children: [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 }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth, isReadOnly: isReadOnly }, rest))] }) }), jsx(Col, { xs: "content", className: "time-picker-col", children: jsx(TimePicker, { ref: timePickerRef, className: `time-picker-input`, timeValue: timeValue, name: `${id}-time-picker`, hasHiddenLabel: true, onTimeChange: handleTimeChange, isReadOnly: isReadOnly, isDisabled: isDisabled, tabIndex: timeTabIndex }) })] }));
19202
19207
  }
19203
19208
 
19204
19209
  const Form = (_a) => {