@indico-data/design-system 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/floatUI/FloatUI.d.ts +1 -1
- package/lib/components/floatUI/types.d.ts +1 -0
- package/lib/components/forms/date/datePicker/types.d.ts +4 -0
- package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +3 -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/components/forms/input/Input.d.ts +1 -0
- package/lib/components/forms/textarea/Textarea.d.ts +1 -0
- package/lib/components/forms/timePicker/TimePicker.d.ts +7 -1
- package/lib/index.d.ts +28 -2
- package/lib/index.esm.js +17 -16
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +17 -16
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/floatUI/FloatUI.tsx +2 -1
- package/src/components/floatUI/types.ts +1 -0
- package/src/components/forms/date/datePicker/DatePicker.tsx +11 -1
- package/src/components/forms/date/datePicker/types.ts +4 -0
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +21 -0
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +9 -0
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +35 -0
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +16 -0
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +36 -0
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +25 -5
- package/src/components/forms/input/Input.tsx +3 -0
- package/src/components/forms/textarea/Textarea.tsx +3 -0
- package/src/components/forms/timePicker/TimePicker.tsx +18 -0
- package/src/storybook/formArgTypes.ts +14 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FloatUIProps } from './types';
|
|
2
|
-
export declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, }: FloatUIProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, className, }: FloatUIProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CustomComponents, DateRange, DayEventHandler, Formatters, Matcher, Mode, MonthChangeEventHandler, OnSelectHandler } from 'react-day-picker';
|
|
2
2
|
export interface DatePickerProps {
|
|
3
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
3
4
|
selected?: Date | DateRange | undefined;
|
|
4
5
|
onSelect?: OnSelectHandler<Date> | OnSelectHandler<DateRange>;
|
|
5
6
|
mode?: Mode;
|
|
@@ -27,6 +28,9 @@ export interface DatePickerProps {
|
|
|
27
28
|
onNextClick?: MonthChangeEventHandler;
|
|
28
29
|
onPrevClick?: MonthChangeEventHandler;
|
|
29
30
|
onDayClick?: DayEventHandler<React.MouseEvent>;
|
|
31
|
+
isReadOnly?: boolean;
|
|
32
|
+
timeTabIndex?: number;
|
|
33
|
+
dateTabIndex?: number;
|
|
30
34
|
}
|
|
31
35
|
export interface CommonProps {
|
|
32
36
|
className?: string;
|
|
@@ -19,5 +19,8 @@ export interface SingleInputDatePickerProps {
|
|
|
19
19
|
errorMessage?: string | undefined;
|
|
20
20
|
hasHiddenLabel?: boolean;
|
|
21
21
|
'data-testid'?: string;
|
|
22
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
23
|
+
isReadOnly?: boolean;
|
|
24
|
+
tabIndex?: number;
|
|
22
25
|
}
|
|
23
26
|
export declare function SingleInputDatePicker(props: SingleInputDatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -24,6 +24,11 @@ interface InputDateRangePickerProps {
|
|
|
24
24
|
closeOnSelect?: boolean;
|
|
25
25
|
clearOnClose?: boolean;
|
|
26
26
|
hasHiddenLabel?: boolean;
|
|
27
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
28
|
+
isFromReadOnly?: boolean;
|
|
29
|
+
isToReadOnly?: boolean;
|
|
30
|
+
toTabIndex?: number;
|
|
31
|
+
fromTabIndex?: number;
|
|
27
32
|
}
|
|
28
33
|
export declare function InputDateRangePicker(props: InputDateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
29
34
|
export {};
|
|
@@ -21,5 +21,10 @@ export interface SingleInputDateTimePickerProps {
|
|
|
21
21
|
hasHiddenLabel?: boolean;
|
|
22
22
|
timeValue?: string;
|
|
23
23
|
onTimeChange?: (time: string) => void;
|
|
24
|
+
isReadOnly?: boolean;
|
|
25
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
26
|
+
timePickerRef?: React.LegacyRef<HTMLInputElement>;
|
|
27
|
+
dateTabIndex?: number;
|
|
28
|
+
timeTabIndex?: number;
|
|
24
29
|
}
|
|
25
30
|
export declare function SingleInputDateTimePicker(props: SingleInputDateTimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,6 +17,7 @@ export interface TextareaProps extends LabelProps {
|
|
|
17
17
|
maxLength?: number;
|
|
18
18
|
autofocus?: boolean;
|
|
19
19
|
defaultValue?: string;
|
|
20
|
+
tabIndex?: number;
|
|
20
21
|
}
|
|
21
22
|
declare const LabeledTextarea: React.ForwardRefExoticComponent<Omit<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement> & LabelProps, "ref"> & React.RefAttributes<any>>;
|
|
22
23
|
export { LabeledTextarea as Textarea };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
interface TimePickerProps {
|
|
2
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
2
3
|
timeValue?: string;
|
|
3
4
|
label?: string;
|
|
4
5
|
name?: string;
|
|
5
6
|
hasHiddenLabel?: boolean;
|
|
6
7
|
onTimeChange?: (time: string) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
isReadOnly?: boolean;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
[key: string]: unknown;
|
|
7
13
|
}
|
|
8
|
-
export declare const TimePicker: ({ timeValue, label, name, hasHiddenLabel, onTimeChange, }: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const TimePicker: ({ ref, timeValue, label, name, hasHiddenLabel, onTimeChange, className, isDisabled, isReadOnly, tabIndex, ...rest }: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
15
|
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -284,6 +284,7 @@ interface BaseInputProps {
|
|
|
284
284
|
isClearable?: boolean;
|
|
285
285
|
className?: string;
|
|
286
286
|
defaultValue?: string;
|
|
287
|
+
tabIndex?: number;
|
|
287
288
|
}
|
|
288
289
|
interface InputProps extends BaseInputProps, LabelProps {
|
|
289
290
|
}
|
|
@@ -345,6 +346,7 @@ interface TextareaProps extends LabelProps {
|
|
|
345
346
|
maxLength?: number;
|
|
346
347
|
autofocus?: boolean;
|
|
347
348
|
defaultValue?: string;
|
|
349
|
+
tabIndex?: number;
|
|
348
350
|
}
|
|
349
351
|
declare const LabeledTextarea: React$1.ForwardRefExoticComponent<Omit<Omit<TextareaProps, "ref"> & React$1.RefAttributes<HTMLTextAreaElement> & LabelProps, "ref"> & React$1.RefAttributes<any>>;
|
|
350
352
|
|
|
@@ -372,6 +374,7 @@ interface SelectProps<OptionType extends SelectOption> extends Props$4<OptionTyp
|
|
|
372
374
|
declare const LabeledSelect: React$1.ForwardRefExoticComponent<SelectProps<SelectOption> & LabelProps & React$1.RefAttributes<any>>;
|
|
373
375
|
|
|
374
376
|
interface DatePickerProps {
|
|
377
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
375
378
|
selected?: Date | DateRange | undefined;
|
|
376
379
|
onSelect?: OnSelectHandler<Date> | OnSelectHandler<DateRange>;
|
|
377
380
|
mode?: Mode;
|
|
@@ -399,18 +402,27 @@ interface DatePickerProps {
|
|
|
399
402
|
onNextClick?: MonthChangeEventHandler;
|
|
400
403
|
onPrevClick?: MonthChangeEventHandler;
|
|
401
404
|
onDayClick?: DayEventHandler<React.MouseEvent>;
|
|
405
|
+
isReadOnly?: boolean;
|
|
406
|
+
timeTabIndex?: number;
|
|
407
|
+
dateTabIndex?: number;
|
|
402
408
|
}
|
|
403
409
|
|
|
404
410
|
declare const DatePicker: (props: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
405
411
|
|
|
406
412
|
interface TimePickerProps {
|
|
413
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
407
414
|
timeValue?: string;
|
|
408
415
|
label?: string;
|
|
409
416
|
name?: string;
|
|
410
417
|
hasHiddenLabel?: boolean;
|
|
411
418
|
onTimeChange?: (time: string) => void;
|
|
419
|
+
className?: string;
|
|
420
|
+
isReadOnly?: boolean;
|
|
421
|
+
isDisabled?: boolean;
|
|
422
|
+
tabIndex?: number;
|
|
423
|
+
[key: string]: unknown;
|
|
412
424
|
}
|
|
413
|
-
declare const TimePicker: ({ timeValue, label, name, hasHiddenLabel, onTimeChange, }: TimePickerProps) => react_jsx_runtime.JSX.Element;
|
|
425
|
+
declare const TimePicker: ({ ref, timeValue, label, name, hasHiddenLabel, onTimeChange, className, isDisabled, isReadOnly, tabIndex, ...rest }: TimePickerProps) => react_jsx_runtime.JSX.Element;
|
|
414
426
|
|
|
415
427
|
interface Props$3 {
|
|
416
428
|
mode?: Mode;
|
|
@@ -452,6 +464,9 @@ interface SingleInputDatePickerProps {
|
|
|
452
464
|
errorMessage?: string | undefined;
|
|
453
465
|
hasHiddenLabel?: boolean;
|
|
454
466
|
'data-testid'?: string;
|
|
467
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
468
|
+
isReadOnly?: boolean;
|
|
469
|
+
tabIndex?: number;
|
|
455
470
|
}
|
|
456
471
|
declare function SingleInputDatePicker(props: SingleInputDatePickerProps): react_jsx_runtime.JSX.Element;
|
|
457
472
|
|
|
@@ -479,6 +494,11 @@ interface InputDateRangePickerProps {
|
|
|
479
494
|
closeOnSelect?: boolean;
|
|
480
495
|
clearOnClose?: boolean;
|
|
481
496
|
hasHiddenLabel?: boolean;
|
|
497
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
498
|
+
isFromReadOnly?: boolean;
|
|
499
|
+
isToReadOnly?: boolean;
|
|
500
|
+
toTabIndex?: number;
|
|
501
|
+
fromTabIndex?: number;
|
|
482
502
|
}
|
|
483
503
|
declare function InputDateRangePicker(props: InputDateRangePickerProps): react_jsx_runtime.JSX.Element;
|
|
484
504
|
|
|
@@ -504,6 +524,11 @@ interface SingleInputDateTimePickerProps {
|
|
|
504
524
|
hasHiddenLabel?: boolean;
|
|
505
525
|
timeValue?: string;
|
|
506
526
|
onTimeChange?: (time: string) => void;
|
|
527
|
+
isReadOnly?: boolean;
|
|
528
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
529
|
+
timePickerRef?: React.LegacyRef<HTMLInputElement>;
|
|
530
|
+
dateTabIndex?: number;
|
|
531
|
+
timeTabIndex?: number;
|
|
507
532
|
}
|
|
508
533
|
declare function SingleInputDateTimePicker(props: SingleInputDateTimePickerProps): react_jsx_runtime.JSX.Element;
|
|
509
534
|
|
|
@@ -544,6 +569,7 @@ type FloatUIProps = {
|
|
|
544
569
|
ariaLabel: string;
|
|
545
570
|
floatingOptions?: UseFloatingOptions;
|
|
546
571
|
isOpen?: boolean;
|
|
572
|
+
className?: string;
|
|
547
573
|
isPortal?: boolean;
|
|
548
574
|
portalOptions?: {
|
|
549
575
|
rootId?: string;
|
|
@@ -551,7 +577,7 @@ type FloatUIProps = {
|
|
|
551
577
|
setIsOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
552
578
|
};
|
|
553
579
|
|
|
554
|
-
declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, }: FloatUIProps): react_jsx_runtime.JSX.Element;
|
|
580
|
+
declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, className, }: FloatUIProps): react_jsx_runtime.JSX.Element;
|
|
555
581
|
|
|
556
582
|
type MenuProps = {
|
|
557
583
|
children: React$1.ReactNode;
|
package/lib/index.esm.js
CHANGED
|
@@ -5467,7 +5467,7 @@ const DisplayFormError = (_a) => {
|
|
|
5467
5467
|
};
|
|
5468
5468
|
|
|
5469
5469
|
const Input = React__default.forwardRef((_a, ref) => {
|
|
5470
|
-
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"]);
|
|
5470
|
+
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"]);
|
|
5471
5471
|
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
5472
5472
|
const handleClear = () => {
|
|
5473
5473
|
onChange === null || onChange === void 0 ? void 0 : onChange({ target: { value: '' } });
|
|
@@ -5477,7 +5477,7 @@ const Input = React__default.forwardRef((_a, ref) => {
|
|
|
5477
5477
|
error: hasErrors,
|
|
5478
5478
|
'input--has-icon': iconName,
|
|
5479
5479
|
}, className);
|
|
5480
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), 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 && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { "data-testid": `${name}-error`, message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
5480
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), 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 && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { "data-testid": `${name}-error`, message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
5481
5481
|
});
|
|
5482
5482
|
const LabeledInput = withLabel(Input);
|
|
5483
5483
|
|
|
@@ -5790,10 +5790,10 @@ const Toggle = React__default.forwardRef((_a, ref) => {
|
|
|
5790
5790
|
});
|
|
5791
5791
|
|
|
5792
5792
|
const Textarea = React__default.forwardRef((_a, ref) => {
|
|
5793
|
-
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"]);
|
|
5793
|
+
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"]);
|
|
5794
5794
|
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
5795
5795
|
const textareaClasses = classNames('textarea', { error: hasErrors });
|
|
5796
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: "textarea-wrapper", children: 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 && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
5796
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: "textarea-wrapper", children: 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 && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
5797
5797
|
});
|
|
5798
5798
|
const LabeledTextarea = withLabel(Textarea);
|
|
5799
5799
|
|
|
@@ -11885,7 +11885,8 @@ const validateInputValue = (value) => {
|
|
|
11885
11885
|
return ''; // Valid time format
|
|
11886
11886
|
};
|
|
11887
11887
|
|
|
11888
|
-
const TimePicker = (
|
|
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"]);
|
|
11889
11890
|
const [validationError, setValidationError] = useState('');
|
|
11890
11891
|
const [inputValue, setInputValue] = useState(timeValue);
|
|
11891
11892
|
const handleTimeChange = (e) => {
|
|
@@ -11907,11 +11908,11 @@ const TimePicker = ({ timeValue = '', label = 'Time Picker', name = 'time-picker
|
|
|
11907
11908
|
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(formattedValue);
|
|
11908
11909
|
}
|
|
11909
11910
|
};
|
|
11910
|
-
return (jsx("div", { className: "time-input-wrapper", children: jsx(LabeledInput, { "data-testid": `${name}-input`, label: label, hasHiddenLabel: hasHiddenLabel, value: inputValue, maxLength: 8, onChange: handleTimeChange, onBlur: handleBlur, name: name, errorMessage: validationError }) }));
|
|
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)) }));
|
|
11911
11912
|
};
|
|
11912
11913
|
|
|
11913
11914
|
const DatePicker = (props) => {
|
|
11914
|
-
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"]);
|
|
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"]);
|
|
11915
11916
|
const futureDateByYear = (year) => new Date(new Date().getFullYear() + year, 11, 31);
|
|
11916
11917
|
const endMonthDefault = endMonth !== null && endMonth !== void 0 ? endMonth : futureDateByYear(5);
|
|
11917
11918
|
const modeMap = {
|
|
@@ -11943,7 +11944,7 @@ const DatePicker = (props) => {
|
|
|
11943
11944
|
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
11944
11945
|
};
|
|
11945
11946
|
const finalProps = Object.assign(Object.assign(Object.assign({}, commonProps), rest), modeProps);
|
|
11946
|
-
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, { timeValue: timeValue !== null && timeValue !== void 0 ? timeValue : '', onTimeChange: handleTimeChange }) })] }) })), jsx(DayPicker, Object.assign({}, finalProps))] }));
|
|
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))] }));
|
|
11947
11948
|
};
|
|
11948
11949
|
|
|
11949
11950
|
function getNodeName$1(node) {
|
|
@@ -13619,7 +13620,7 @@ const defaultOptions$1 = {
|
|
|
13619
13620
|
placement: 'bottom-start',
|
|
13620
13621
|
middleware: [offset$2(5), flip$2(), shift$2()],
|
|
13621
13622
|
};
|
|
13622
|
-
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, }) {
|
|
13623
|
+
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, }) {
|
|
13623
13624
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
13624
13625
|
// Determine whether the component is controlled or uncontrolled
|
|
13625
13626
|
const isControlled = controlledIsOpen !== undefined && controlledSetIsOpen !== undefined;
|
|
@@ -13641,7 +13642,7 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
13641
13642
|
const click = useClick(context);
|
|
13642
13643
|
const dismiss = useDismiss(context);
|
|
13643
13644
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
|
|
13644
|
-
const tooltipContent = (jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className:
|
|
13645
|
+
const tooltipContent = (jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className: `floatui-container ${className}`, children: jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) })));
|
|
13645
13646
|
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: trigger })), isOpen &&
|
|
13646
13647
|
(isPortal ? (jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
|
|
13647
13648
|
}
|
|
@@ -19056,7 +19057,7 @@ const formatDateAsString$1 = (date) => format(date, 'MM/dd/yyyy');
|
|
|
19056
19057
|
|
|
19057
19058
|
function SingleInputDatePicker(props) {
|
|
19058
19059
|
var _a;
|
|
19059
|
-
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"]);
|
|
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"]);
|
|
19060
19061
|
const inputId = useId$1();
|
|
19061
19062
|
// The text value is assumed to be unneeded by the consumer.
|
|
19062
19063
|
const [localTextValue, setLocalTextValue] = useState(selected ? formatDateAsString$1(selected) : '');
|
|
@@ -19090,11 +19091,11 @@ function SingleInputDatePicker(props) {
|
|
|
19090
19091
|
setLocalTextValue('');
|
|
19091
19092
|
}
|
|
19092
19093
|
}, [isOpen, clearOnClose]);
|
|
19093
|
-
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', name: 'Date Picker' }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, mode: "single", selected: selected, onSelect: handleDayPickerSelect, month: localMonth, onMonthChange: setLocalMonth }, rest))] }));
|
|
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))] }));
|
|
19094
19095
|
}
|
|
19095
19096
|
|
|
19096
19097
|
function InputDateRangePicker(props) {
|
|
19097
|
-
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"]);
|
|
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"]);
|
|
19098
19099
|
const inputId = useId$1();
|
|
19099
19100
|
// Hold the input values in state
|
|
19100
19101
|
const [localTextValueFrom, setLocalTextValueFrom] = useState((selected === null || selected === void 0 ? void 0 : selected.from) ? formatDateAsString$1(selected.from) : '');
|
|
@@ -19153,14 +19154,14 @@ function InputDateRangePicker(props) {
|
|
|
19153
19154
|
setLocalTextValueTo('');
|
|
19154
19155
|
}
|
|
19155
19156
|
}, [isOpen, clearOnClose]);
|
|
19156
|
-
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 }) }), 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 }) })] }), jsx(DatePicker, Object.assign({ captionLayout: captionLayout, month: localMonth, onMonthChange: (date) => setLocalMonth(date), mode: "range", selected: selected, onSelect: handleDayPickerSelect }, rest))] }));
|
|
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))] }));
|
|
19157
19158
|
}
|
|
19158
19159
|
|
|
19159
19160
|
const formatDateAsString = (date) => format(date, 'MM/dd/yyyy');
|
|
19160
19161
|
|
|
19161
19162
|
function SingleInputDateTimePicker(props) {
|
|
19162
19163
|
var _a;
|
|
19163
|
-
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"]);
|
|
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"]);
|
|
19164
19165
|
const inputId = useId$1();
|
|
19165
19166
|
// The text value is assumed to be unneeded by the consumer.
|
|
19166
19167
|
const [localTextValue, setLocalTextValue] = useState(selected ? formatDateAsString(selected) : '');
|
|
@@ -19197,7 +19198,7 @@ function SingleInputDateTimePicker(props) {
|
|
|
19197
19198
|
const handleTimeChange = (time) => {
|
|
19198
19199
|
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(time);
|
|
19199
19200
|
};
|
|
19200
|
-
return (jsxs(Row, { children: [jsx(Col, { children: jsxs(FloatUI, { isOpen: isOpen, ariaLabel: ariaLabel, children: [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
|
|
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 }) })] }));
|
|
19201
19202
|
}
|
|
19202
19203
|
|
|
19203
19204
|
const Form = (_a) => {
|