@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.
- package/lib/components/forms/date/datePicker/types.d.ts +3 -0
- package/lib/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.d.ts +5 -0
- package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +5 -0
- package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +5 -0
- package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.d.ts +5 -0
- package/lib/index.css +10 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.esm.css +10 -0
- package/lib/index.esm.js +124 -119
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +124 -119
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/forms/date/datePicker/styles/DatePicker.scss +10 -0
- package/src/components/forms/date/datePicker/types.ts +4 -0
- package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.tsx +30 -0
- package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.tsx +15 -1
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +30 -0
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +15 -2
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +26 -3
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +15 -2
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +26 -3
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +16 -1
- package/src/components/forms/timePicker/TimePicker.tsx +21 -1
- package/src/components/forms/timePicker/__tests__/TimePicker.test.tsx +4 -2
package/lib/index.js
CHANGED
|
@@ -11861,117 +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 = (_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"]);
|
|
11915
|
-
const [validationError, setValidationError] = React.useState('');
|
|
11916
|
-
const [inputValue, setInputValue] = React.useState(timeValue);
|
|
11917
|
-
const handleTimeChange = (e) => {
|
|
11918
|
-
const newValue = e.target.value;
|
|
11919
|
-
const error = validateInputValue(newValue);
|
|
11920
|
-
setInputValue(newValue);
|
|
11921
|
-
setValidationError(error);
|
|
11922
|
-
// Only send valid values to parent component
|
|
11923
|
-
if (!error || error === '') {
|
|
11924
|
-
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(newValue);
|
|
11925
|
-
}
|
|
11926
|
-
};
|
|
11927
|
-
const handleBlur = (e) => {
|
|
11928
|
-
const currentValue = e.target.value;
|
|
11929
|
-
// Only format if there's no validation error
|
|
11930
|
-
if (validationError === '' && currentValue.trim() !== '') {
|
|
11931
|
-
const formattedValue = formatTimeValue(currentValue);
|
|
11932
|
-
setInputValue(formattedValue);
|
|
11933
|
-
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
|
|
11934
|
-
}
|
|
11935
|
-
};
|
|
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)) }));
|
|
11937
|
-
};
|
|
11938
|
-
|
|
11939
|
-
const DatePicker = (props) => {
|
|
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"]);
|
|
11941
|
-
const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
|
|
11942
|
-
const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
|
|
11943
|
-
const modeMap = {
|
|
11944
|
-
single: {
|
|
11945
|
-
mode: 'single',
|
|
11946
|
-
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
|
|
11947
|
-
selected: selected,
|
|
11948
|
-
onSelect: onSelect,
|
|
11949
|
-
endMonth: endMonthDefault,
|
|
11950
|
-
},
|
|
11951
|
-
multiple: {
|
|
11952
|
-
mode: 'multiple',
|
|
11953
|
-
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 1,
|
|
11954
|
-
selected: selected,
|
|
11955
|
-
onSelect: onSelect,
|
|
11956
|
-
endMonth: endMonthDefault,
|
|
11957
|
-
},
|
|
11958
|
-
range: {
|
|
11959
|
-
mode: 'range',
|
|
11960
|
-
numberOfMonths: numberOfMonths !== null && numberOfMonths !== void 0 ? numberOfMonths : 2,
|
|
11961
|
-
selected: selected,
|
|
11962
|
-
onSelect: onSelect,
|
|
11963
|
-
endMonth: endMonthDefault,
|
|
11964
|
-
},
|
|
11965
|
-
};
|
|
11966
|
-
const modeProps = modeMap[mode];
|
|
11967
|
-
const commonProps = getCommonProps(props);
|
|
11968
|
-
const handleTimeChange = (time) => {
|
|
11969
|
-
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
11970
|
-
};
|
|
11971
|
-
const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
|
|
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))] }));
|
|
11973
|
-
};
|
|
11974
|
-
|
|
11975
11864
|
function getNodeName$1(node) {
|
|
11976
11865
|
if (isNode$1(node)) {
|
|
11977
11866
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -13672,8 +13561,124 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
13672
13561
|
(isPortal ? (jsxRuntime.jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
|
|
13673
13562
|
}
|
|
13674
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
|
+
|
|
13675
13680
|
const IconTriggerDatePicker = (props) => {
|
|
13676
|
-
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"]);
|
|
13677
13682
|
const [localMonth, setLocalMonth] = React.useState(initialMonth !== null && initialMonth !== void 0 ? initialMonth : new Date());
|
|
13678
13683
|
const handleSelect = (date) => {
|
|
13679
13684
|
if (!date) {
|
|
@@ -13689,7 +13694,7 @@ const IconTriggerDatePicker = (props) => {
|
|
|
13689
13694
|
onSelect && onSelect(undefined);
|
|
13690
13695
|
}
|
|
13691
13696
|
}, [isOpen, clearOnClose]);
|
|
13692
|
-
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))] }));
|
|
13693
13698
|
};
|
|
13694
13699
|
|
|
13695
13700
|
/**
|
|
@@ -19082,7 +19087,7 @@ const formatDateAsString$1 = (date) => format(date, 'MM/dd/yyyy');
|
|
|
19082
19087
|
|
|
19083
19088
|
function SingleInputDatePicker(props) {
|
|
19084
19089
|
var _a;
|
|
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"]);
|
|
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"]);
|
|
19086
19091
|
const inputId = React.useId();
|
|
19087
19092
|
// The text value is assumed to be unneeded by the consumer.
|
|
19088
19093
|
const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString$1(selected) : '');
|
|
@@ -19116,11 +19121,11 @@ function SingleInputDatePicker(props) {
|
|
|
19116
19121
|
setLocalTextValue('');
|
|
19117
19122
|
}
|
|
19118
19123
|
}, [isOpen, clearOnClose]);
|
|
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))] }));
|
|
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))] }));
|
|
19120
19125
|
}
|
|
19121
19126
|
|
|
19122
19127
|
function InputDateRangePicker(props) {
|
|
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"]);
|
|
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"]);
|
|
19124
19129
|
const inputId = React.useId();
|
|
19125
19130
|
// Hold the input values in state
|
|
19126
19131
|
const [localTextValueFrom, setLocalTextValueFrom] = React.useState((selected === null || selected === void 0 ? void 0 : selected.from) ? formatDateAsString$1(selected.from) : '');
|
|
@@ -19179,14 +19184,14 @@ function InputDateRangePicker(props) {
|
|
|
19179
19184
|
setLocalTextValueTo('');
|
|
19180
19185
|
}
|
|
19181
19186
|
}, [isOpen, clearOnClose]);
|
|
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))] }));
|
|
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))] }));
|
|
19183
19188
|
}
|
|
19184
19189
|
|
|
19185
19190
|
const formatDateAsString = (date) => format(date, 'MM/dd/yyyy');
|
|
19186
19191
|
|
|
19187
19192
|
function SingleInputDateTimePicker(props) {
|
|
19188
19193
|
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"]);
|
|
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"]);
|
|
19190
19195
|
const inputId = React.useId();
|
|
19191
19196
|
// The text value is assumed to be unneeded by the consumer.
|
|
19192
19197
|
const [localTextValue, setLocalTextValue] = React.useState(selected ? formatDateAsString(selected) : '');
|
|
@@ -19223,7 +19228,7 @@ function SingleInputDateTimePicker(props) {
|
|
|
19223
19228
|
const handleTimeChange = (time) => {
|
|
19224
19229
|
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
19225
19230
|
};
|
|
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 }) })] }));
|
|
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 }) })] }));
|
|
19227
19232
|
}
|
|
19228
19233
|
|
|
19229
19234
|
const Form = (_a) => {
|