@mtes-mct/monitor-ui 5.2.2 → 5.3.0
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/fields/Checkbox.d.ts +2 -1
- package/fields/DatePicker/index.d.ts +1 -0
- package/fields/DateRangePicker/index.d.ts +1 -0
- package/fields/MultiCheckbox.d.ts +2 -1
- package/fields/MultiRadio.d.ts +2 -1
- package/fields/MultiSelect.d.ts +2 -1
- package/fields/NumberInput.d.ts +2 -1
- package/fields/Search.d.ts +2 -1
- package/fields/Select.d.ts +2 -1
- package/fields/TextInput.d.ts +2 -1
- package/fields/Textarea.d.ts +2 -1
- package/index.js +53 -62
- package/index.js.map +1 -1
- package/package.json +1 -1
package/fields/Checkbox.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
export type CheckboxProps = Omit<RsuiteCheckboxProps, 'as' | 'checked' | 'defaultChecked' | 'id' | 'onChange'> & {
|
|
4
4
|
checked?: boolean | undefined;
|
|
5
5
|
error?: string | undefined;
|
|
6
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
6
7
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
7
8
|
label: string;
|
|
8
9
|
name: string;
|
|
9
10
|
onChange?: ((isCheched: boolean) => Promisable<void>) | undefined;
|
|
10
11
|
};
|
|
11
|
-
export declare function Checkbox({ checked, error, isUndefinedWhenDisabled, label, onChange, ...originalProps }: CheckboxProps): JSX.Element;
|
|
12
|
+
export declare function Checkbox({ checked, error, isErrorMessageHidden, isUndefinedWhenDisabled, label, onChange, ...originalProps }: CheckboxProps): JSX.Element;
|
|
@@ -31,6 +31,7 @@ export interface DatePickerProps extends Omit<HTMLAttributes<HTMLFieldSetElement
|
|
|
31
31
|
isCompact?: boolean | undefined;
|
|
32
32
|
/** Set the default time to the end (instead of start) of the day when picking/entering a date. */
|
|
33
33
|
isEndDate?: boolean | undefined;
|
|
34
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
34
35
|
/** Only allow past dates until today. */
|
|
35
36
|
isHistorical?: boolean | undefined;
|
|
36
37
|
isLabelHidden?: boolean | undefined;
|
|
@@ -34,6 +34,7 @@ export interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLFieldSetEl
|
|
|
34
34
|
disabled?: boolean | undefined;
|
|
35
35
|
error?: string | undefined;
|
|
36
36
|
isCompact?: boolean | undefined;
|
|
37
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
37
38
|
/** Only allow past dates until today. */
|
|
38
39
|
isHistorical?: boolean | undefined;
|
|
39
40
|
isLabelHidden?: boolean | undefined;
|
|
@@ -3,6 +3,7 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
export type MultiCheckboxProps<OptionValue extends OptionValueType = string> = {
|
|
4
4
|
disabled?: boolean | undefined;
|
|
5
5
|
error?: string | undefined;
|
|
6
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
6
7
|
isInline?: boolean | undefined;
|
|
7
8
|
isLabelHidden?: boolean | undefined;
|
|
8
9
|
isLight?: boolean | undefined;
|
|
@@ -13,4 +14,4 @@ export type MultiCheckboxProps<OptionValue extends OptionValueType = string> = {
|
|
|
13
14
|
options: Option<OptionValue>[];
|
|
14
15
|
value?: OptionValue[] | undefined;
|
|
15
16
|
};
|
|
16
|
-
export declare function MultiCheckbox<OptionValue extends OptionValueType = string>({
|
|
17
|
+
export declare function MultiCheckbox<OptionValue extends OptionValueType = string>({ disabled, error, isErrorMessageHidden, isInline, isLabelHidden, isLight, isUndefinedWhenDisabled, label, name, onChange, options, value }: MultiCheckboxProps<OptionValue>): JSX.Element;
|
package/fields/MultiRadio.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
export type MultiRadioProps<OptionValue extends OptionValueType = string> = {
|
|
4
4
|
disabled?: boolean | undefined;
|
|
5
5
|
error?: string | undefined;
|
|
6
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
6
7
|
isInline?: boolean | undefined;
|
|
7
8
|
isLabelHidden?: boolean | undefined;
|
|
8
9
|
isLight?: boolean | undefined;
|
|
@@ -13,4 +14,4 @@ export type MultiRadioProps<OptionValue extends OptionValueType = string> = {
|
|
|
13
14
|
options: Option<OptionValue>[];
|
|
14
15
|
value?: OptionValue | undefined;
|
|
15
16
|
};
|
|
16
|
-
export declare function MultiRadio<OptionValue extends OptionValueType = string>({ disabled, error, isInline, isLabelHidden, isLight, isUndefinedWhenDisabled, label, name, onChange, options, value }: MultiRadioProps<OptionValue>): JSX.Element;
|
|
17
|
+
export declare function MultiRadio<OptionValue extends OptionValueType = string>({ disabled, error, isErrorMessageHidden, isInline, isLabelHidden, isLight, isUndefinedWhenDisabled, label, name, onChange, options, value }: MultiRadioProps<OptionValue>): JSX.Element;
|
package/fields/MultiSelect.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type MultiSelectProps<OptionValue extends OptionValueType = string> = Omi
|
|
|
5
5
|
/** Used to pass something else than `window.document` as a base container to attach global events listeners. */
|
|
6
6
|
baseContainer?: Document | HTMLDivElement | null | undefined;
|
|
7
7
|
error?: string | undefined;
|
|
8
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
8
9
|
isLabelHidden?: boolean | undefined;
|
|
9
10
|
isLight?: boolean | undefined;
|
|
10
11
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
@@ -15,4 +16,4 @@ export type MultiSelectProps<OptionValue extends OptionValueType = string> = Omi
|
|
|
15
16
|
options: Option<OptionValue>[];
|
|
16
17
|
value?: OptionValue[] | undefined;
|
|
17
18
|
};
|
|
18
|
-
export declare function MultiSelect<OptionValue extends OptionValueType = string>({ baseContainer, disabled, error, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, options, optionValueKey, searchable, value, ...originalProps }: MultiSelectProps<OptionValue>): JSX.Element;
|
|
19
|
+
export declare function MultiSelect<OptionValue extends OptionValueType = string>({ baseContainer, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, options, optionValueKey, searchable, value, ...originalProps }: MultiSelectProps<OptionValue>): JSX.Element;
|
package/fields/NumberInput.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { InputProps } from 'rsuite';
|
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
3
|
export type NumberInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'id' | 'onChange' | 'type' | 'value'> & {
|
|
4
4
|
error?: string | undefined;
|
|
5
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
5
6
|
isLabelHidden?: boolean | undefined;
|
|
6
7
|
isLight?: boolean | undefined;
|
|
7
8
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
@@ -10,4 +11,4 @@ export type NumberInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'id' | '
|
|
|
10
11
|
onChange?: ((nextValue: number | undefined) => Promisable<void>) | undefined;
|
|
11
12
|
value?: number | undefined;
|
|
12
13
|
};
|
|
13
|
-
export declare function NumberInput({ error, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, value, ...originalProps }: NumberInputProps): JSX.Element;
|
|
14
|
+
export declare function NumberInput({ error, isErrorMessageHidden, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, value, ...originalProps }: NumberInputProps): JSX.Element;
|
package/fields/Search.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type SearchProps<OptionValue extends OptionValueType = string> = Omit<Rsu
|
|
|
8
8
|
baseContainer?: Document | HTMLDivElement | null | undefined;
|
|
9
9
|
defaultValue?: OptionValue | undefined;
|
|
10
10
|
error?: string | undefined;
|
|
11
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
11
12
|
isLabelHidden?: boolean | undefined;
|
|
12
13
|
isLight?: boolean | undefined;
|
|
13
14
|
isSearchIconHidden?: boolean | undefined;
|
|
@@ -21,4 +22,4 @@ export type SearchProps<OptionValue extends OptionValueType = string> = Omit<Rsu
|
|
|
21
22
|
/** Duration in milliseconds */
|
|
22
23
|
throttleDuration?: number;
|
|
23
24
|
};
|
|
24
|
-
export declare function Search<OptionValue extends OptionValueType = string>({ baseContainer, defaultValue, error, isLabelHidden, isLight, isSearchIconHidden, label, MenuItem, onChange, onQuery, options, queryMap, queryUrl, throttleDuration, ...originalProps }: SearchProps<OptionValue>): JSX.Element;
|
|
25
|
+
export declare function Search<OptionValue extends OptionValueType = string>({ baseContainer, defaultValue, error, isErrorMessageHidden, isLabelHidden, isLight, isSearchIconHidden, label, MenuItem, onChange, onQuery, options, queryMap, queryUrl, throttleDuration, ...originalProps }: SearchProps<OptionValue>): JSX.Element;
|
package/fields/Select.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type SelectProps<OptionValue extends OptionValueType = string> = Omit<Sel
|
|
|
5
5
|
/** Used to pass something else than `window.document` as a base container to attach global events listeners. */
|
|
6
6
|
baseContainer?: Document | HTMLDivElement | null | undefined;
|
|
7
7
|
error?: string | undefined;
|
|
8
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
8
9
|
isLabelHidden?: boolean | undefined;
|
|
9
10
|
isLight?: boolean | undefined;
|
|
10
11
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
@@ -15,4 +16,4 @@ export type SelectProps<OptionValue extends OptionValueType = string> = Omit<Sel
|
|
|
15
16
|
options: Option<OptionValue>[];
|
|
16
17
|
value?: OptionValue | undefined;
|
|
17
18
|
};
|
|
18
|
-
export declare function Select<OptionValue extends OptionValueType = string>({ baseContainer, disabled, error, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, options, optionValueKey, searchable, value, ...originalProps }: SelectProps<OptionValue>): JSX.Element;
|
|
19
|
+
export declare function Select<OptionValue extends OptionValueType = string>({ baseContainer, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, options, optionValueKey, searchable, value, ...originalProps }: SelectProps<OptionValue>): JSX.Element;
|
package/fields/TextInput.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { InputProps } from 'rsuite';
|
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
3
|
export type TextInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'id' | 'onChange' | 'type' | 'value'> & {
|
|
4
4
|
error?: string | undefined;
|
|
5
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
5
6
|
isLabelHidden?: boolean | undefined;
|
|
6
7
|
isLight?: boolean | undefined;
|
|
7
8
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
@@ -10,4 +11,4 @@ export type TextInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'id' | 'on
|
|
|
10
11
|
onChange?: ((nextValue: string | undefined) => Promisable<void>) | undefined;
|
|
11
12
|
value?: string | undefined;
|
|
12
13
|
};
|
|
13
|
-
export declare function TextInput({ error, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, value, ...originalProps }: TextInputProps): JSX.Element;
|
|
14
|
+
export declare function TextInput({ error, isErrorMessageHidden, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, value, ...originalProps }: TextInputProps): JSX.Element;
|
package/fields/Textarea.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { TextareaHTMLAttributes } from 'react';
|
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
3
|
export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'defaultValue' | 'id' | 'onChange' | 'value'> & {
|
|
4
4
|
error?: string | undefined;
|
|
5
|
+
isErrorMessageHidden?: boolean | undefined;
|
|
5
6
|
isLabelHidden?: boolean | undefined;
|
|
6
7
|
isLight?: boolean | undefined;
|
|
7
8
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
@@ -10,4 +11,4 @@ export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'd
|
|
|
10
11
|
onChange?: ((nextValue: string | undefined) => Promisable<void>) | undefined;
|
|
11
12
|
value?: string | undefined;
|
|
12
13
|
};
|
|
13
|
-
export declare function Textarea({ error, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, rows, value, ...originalProps }: TextareaProps): JSX.Element;
|
|
14
|
+
export declare function Textarea({ error, isErrorMessageHidden, isLabelHidden, isLight, isUndefinedWhenDisabled, label, onChange, rows, value, ...originalProps }: TextareaProps): JSX.Element;
|
package/index.js
CHANGED
|
@@ -20842,7 +20842,7 @@ function normalizeString(text) {
|
|
|
20842
20842
|
return cleanText.length > 0 ? cleanText : undefined;
|
|
20843
20843
|
}
|
|
20844
20844
|
|
|
20845
|
-
function Search({ baseContainer, defaultValue, error, isLabelHidden, isLight = false, isSearchIconHidden = false, label, MenuItem, onChange, onQuery, options, queryMap, queryUrl, throttleDuration = 200, ...originalProps }) {
|
|
20845
|
+
function Search({ baseContainer, defaultValue, error, isErrorMessageHidden = false, isLabelHidden, isLight = false, isSearchIconHidden = false, label, MenuItem, onChange, onQuery, options, queryMap, queryUrl, throttleDuration = 200, ...originalProps }) {
|
|
20846
20846
|
// eslint-disable-next-line no-null/no-null
|
|
20847
20847
|
const boxRef = useRef(null);
|
|
20848
20848
|
const queryRef = useRef(undefined);
|
|
@@ -20916,7 +20916,7 @@ function Search({ baseContainer, defaultValue, error, isLabelHidden, isLight = f
|
|
|
20916
20916
|
useEffect(() => {
|
|
20917
20917
|
forceUpdate();
|
|
20918
20918
|
}, [forceUpdate]);
|
|
20919
|
-
return (jsxs(Field$2, { className: "Field-Search", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsxs(Box$c, { ref: boxRef, isLight: isLight, onClick: open, children: [boxRef.current && (jsx(StyledAutoComplete, { "$isLight": isLight, container: boxRef.current, data: controlledOptions, defaultValue: controlledValueAsLabel, id: originalProps.name, onChange: handleChange, onSelect: handleSelect, open: isOpen, renderMenuItem: (itemLabel, item) => MenuItem ? jsx(MenuItem, { item: item.value }) : itemLabel, value: inputValue, ...originalProps }, key)), inputValue && (jsxs(Fragment, { children: [jsx(StyledCloseButton, { accent: Accent.TERTIARY, color: THEME.color.slateGray, Icon: Close, isSearchIconHidden: isSearchIconHidden, onClick: clean, size: Size.SMALL }), !isSearchIconHidden && jsx(Separator, { children: "|" })] })), !isSearchIconHidden && (jsx(StyledSearchButton, { accent: Accent.TERTIARY, color: THEME.color.slateGray, Icon: Search$1, size: Size.NORMAL }))] }), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
20919
|
+
return (jsxs(Field$2, { className: "Field-Search", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsxs(Box$c, { ref: boxRef, isLight: isLight, onClick: open, children: [boxRef.current && (jsx(StyledAutoComplete, { "$isLight": isLight, container: boxRef.current, data: controlledOptions, defaultValue: controlledValueAsLabel, id: originalProps.name, onChange: handleChange, onSelect: handleSelect, open: isOpen, renderMenuItem: (itemLabel, item) => MenuItem ? jsx(MenuItem, { item: item.value }) : itemLabel, value: inputValue, ...originalProps }, key)), inputValue && (jsxs(Fragment, { children: [jsx(StyledCloseButton, { accent: Accent.TERTIARY, color: THEME.color.slateGray, Icon: Close, isSearchIconHidden: isSearchIconHidden, onClick: clean, size: Size.SMALL }), !isSearchIconHidden && jsx(Separator, { children: "|" })] })), !isSearchIconHidden && (jsx(StyledSearchButton, { accent: Accent.TERTIARY, color: THEME.color.slateGray, Icon: Search$1, size: Size.NORMAL }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
20920
20920
|
}
|
|
20921
20921
|
const StyledCloseButton = styled(IconButton) `
|
|
20922
20922
|
cursor: pointer;
|
|
@@ -20978,7 +20978,7 @@ const Box$c = styled.div `
|
|
|
20978
20978
|
}
|
|
20979
20979
|
`;
|
|
20980
20980
|
|
|
20981
|
-
function Checkbox({ checked = false, error, isUndefinedWhenDisabled = false, label, onChange, ...originalProps }) {
|
|
20981
|
+
function Checkbox({ checked = false, error, isErrorMessageHidden = false, isUndefinedWhenDisabled = false, label, onChange, ...originalProps }) {
|
|
20982
20982
|
const { forceUpdate } = useForceUpdate();
|
|
20983
20983
|
// This tracks the component internal value which allows us to react to value changes after the checkbox toggling
|
|
20984
20984
|
const [internalChecked, setInternalChecked] = useState(checked);
|
|
@@ -21006,7 +21006,7 @@ function Checkbox({ checked = false, error, isUndefinedWhenDisabled = false, lab
|
|
|
21006
21006
|
}
|
|
21007
21007
|
}, [forceUpdate, onChange]);
|
|
21008
21008
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
21009
|
-
return (jsxs(Field$2, { className: "Field-Checkbox", children: [jsx(StyledCheckbox, { checked: controlledChecked, id: originalProps.name, onChange: handleChange, ...originalProps, children: label }, key), hasError && jsx(FieldError, { children: controlledError })] }
|
|
21009
|
+
return (jsxs(Field$2, { className: "Field-Checkbox", children: [jsx(StyledCheckbox, { checked: controlledChecked, id: originalProps.name, onChange: handleChange, ...originalProps, children: label }, key), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
21010
21010
|
}
|
|
21011
21011
|
const StyledCheckbox = styled(Checkbox$1) `
|
|
21012
21012
|
> .rs-checkbox-checker {
|
|
@@ -21855,7 +21855,7 @@ const InputGroup = styled.div `
|
|
|
21855
21855
|
}
|
|
21856
21856
|
`;
|
|
21857
21857
|
|
|
21858
|
-
function DatePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isEndDate = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
|
|
21858
|
+
function DatePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isEndDate = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
|
|
21859
21859
|
/* eslint-disable no-null/no-null */
|
|
21860
21860
|
const boxRef = useRef(null);
|
|
21861
21861
|
const dateInputRef = useRef(null);
|
|
@@ -21975,7 +21975,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
|
|
|
21975
21975
|
}, [forceUpdate]);
|
|
21976
21976
|
useFieldUndefineEffect(disabled, onChange, handleDisable);
|
|
21977
21977
|
useClickOutsideEffect(boxRef, closeCalendarPicker, baseContainer);
|
|
21978
|
-
return (jsxs(Fieldset, { className: classNames('Field-DatePicker', className), disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$7, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedUtcDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: isEndDate, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleDateInputNext }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedUtcTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current?.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => dateInputRef.current?.focus(true) }, JSON.stringify(selectedUtcTimeTupleRef.current)) }))] }), hasError && jsx(FieldError, { children: controlledError }), jsx(CalendarPicker, { isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange, value: calendarPickerDefaultValue })] }));
|
|
21978
|
+
return (jsxs(Fieldset, { className: classNames('Field-DatePicker', className), disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$7, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedUtcDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: isEndDate, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleDateInputNext }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedUtcTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current?.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => dateInputRef.current?.focus(true) }, JSON.stringify(selectedUtcTimeTupleRef.current)) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(CalendarPicker, { isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange, value: calendarPickerDefaultValue })] }));
|
|
21979
21979
|
}
|
|
21980
21980
|
const Box$7 = styled.div `
|
|
21981
21981
|
* {
|
|
@@ -22205,7 +22205,7 @@ var DateRangePosition;
|
|
|
22205
22205
|
DateRangePosition["START"] = "START";
|
|
22206
22206
|
})(DateRangePosition || (DateRangePosition = {}));
|
|
22207
22207
|
|
|
22208
|
-
function DateRangePicker({ baseContainer, defaultValue, disabled = false, error, isCompact = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
|
|
22208
|
+
function DateRangePicker({ baseContainer, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
|
|
22209
22209
|
/* eslint-disable no-null/no-null */
|
|
22210
22210
|
const startDateInputRef = useRef(null);
|
|
22211
22211
|
const startTimeInputRef = useRef(null);
|
|
@@ -22403,7 +22403,7 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
|
|
|
22403
22403
|
}, [forceUpdate]);
|
|
22404
22404
|
useFieldUndefineEffect(disabled, onChange, handleDisable);
|
|
22405
22405
|
useClickOutsideEffect([endDateInputRef, startDateInputRef], closeRangeCalendarPicker, baseContainer);
|
|
22406
|
-
return (jsxs(Fieldset, { className: "Field-DateRangePicker", disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$5, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedStartDateTupleRef.current, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleStartDateInputNext }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedStartTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true) }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedEndDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedEndTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => endDateInputRef.current?.focus(true) }) }))] }), hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
|
|
22406
|
+
return (jsxs(Fieldset, { className: "Field-DateRangePicker", disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$5, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedStartDateTupleRef.current, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleStartDateInputNext }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedStartTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true) }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedEndDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, defaultValue: selectedEndTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => endDateInputRef.current?.focus(true) }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
|
|
22407
22407
|
}
|
|
22408
22408
|
const Box$5 = styled.div `
|
|
22409
22409
|
* {
|
|
@@ -22434,32 +22434,48 @@ const Field = styled.span `
|
|
|
22434
22434
|
}};
|
|
22435
22435
|
`;
|
|
22436
22436
|
|
|
22437
|
-
function
|
|
22438
|
-
|
|
22439
|
-
|
|
22437
|
+
function useFieldControl(value, onChange, props) {
|
|
22438
|
+
const { disabled, isUndefinedWhenDisabled } = props;
|
|
22439
|
+
// This tracks the component internal value which allows us to react to value changes after the checkbox toggling
|
|
22440
|
+
const internalValueRef = useRef(value);
|
|
22440
22441
|
// and compare it with an eventual external value change (via the `value` prop)
|
|
22441
22442
|
const previousValue = usePrevious(value);
|
|
22442
|
-
|
|
22443
|
-
const controlledValue =
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22448
|
-
|
|
22443
|
+
const { forceUpdate } = useForceUpdate();
|
|
22444
|
+
const controlledValue = isUndefinedWhenDisabled && disabled ? undefined : internalValueRef.current;
|
|
22445
|
+
const controlledOnChange = useCallback((nextValue) => {
|
|
22446
|
+
internalValueRef.current = nextValue;
|
|
22447
|
+
if (onChange) {
|
|
22448
|
+
onChange(nextValue);
|
|
22449
|
+
}
|
|
22450
|
+
}, [onChange]);
|
|
22451
|
+
// We update the `internalValue` each time the `value` prop is updated
|
|
22452
|
+
useEffect(() => {
|
|
22453
|
+
if (lodashExports.isEqual(value, previousValue)) {
|
|
22454
|
+
return;
|
|
22455
|
+
}
|
|
22456
|
+
internalValueRef.current = value;
|
|
22457
|
+
forceUpdate();
|
|
22458
|
+
}, [forceUpdate, previousValue, value]);
|
|
22459
|
+
return { controlledOnChange, controlledValue };
|
|
22460
|
+
}
|
|
22461
|
+
|
|
22462
|
+
function MultiCheckbox({ disabled = false, error, isErrorMessageHidden = false, isInline = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, name, onChange, options, value }) {
|
|
22463
|
+
const { controlledOnChange, controlledValue } = useFieldControl(value, onChange, {
|
|
22464
|
+
disabled,
|
|
22465
|
+
isUndefinedWhenDisabled
|
|
22466
|
+
});
|
|
22449
22467
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
22450
22468
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
22469
|
+
const key = useKey([controlledValue, disabled, name]);
|
|
22451
22470
|
const handleChange = useCallback((nextOptionValue, isChecked) => {
|
|
22452
22471
|
const nextCheckedOptionValues = isChecked
|
|
22453
22472
|
? [...(controlledValue || []), nextOptionValue]
|
|
22454
22473
|
: reject(equals(nextOptionValue))(controlledValue || []);
|
|
22455
22474
|
const normalizedNextValue = nextCheckedOptionValues.length ? nextCheckedOptionValues : undefined;
|
|
22456
|
-
|
|
22457
|
-
|
|
22458
|
-
onChange(normalizedNextValue);
|
|
22459
|
-
}
|
|
22460
|
-
}, [controlledValue, onChange]);
|
|
22475
|
+
controlledOnChange(normalizedNextValue);
|
|
22476
|
+
}, [controlledOnChange, controlledValue]);
|
|
22461
22477
|
useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
|
|
22462
|
-
return (jsxs(Fieldset, { className: "Field-MultiCheckbox", disabled: disabled, hasError: hasError, isLegendHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(ChecboxesBox, { "$hasError": hasError, "$isInline": isInline, children: options.map((option, index) => (jsx(Checkbox, { checked: includes(option.value, controlledValue || []), disabled: disabled, label: option.label, name: `${name}${index}`, onChange: (isChecked) => handleChange(option.value, isChecked) }, JSON.stringify(option.value)))) }), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22478
|
+
return (jsxs(Fieldset, { className: "Field-MultiCheckbox", disabled: disabled, hasError: hasError, isLegendHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(ChecboxesBox, { "$hasError": hasError, "$isInline": isInline, children: options.map((option, index) => (jsx(Checkbox, { checked: includes(option.value, controlledValue || []), disabled: disabled, label: option.label, name: `${name}${index}`, onChange: (isChecked) => handleChange(option.value, isChecked) }, JSON.stringify(option.value)))) }, key), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22463
22479
|
}
|
|
22464
22480
|
const ChecboxesBox = styled.div `
|
|
22465
22481
|
color: ${p => p.theme.color.gunMetal};
|
|
@@ -22497,31 +22513,6 @@ const ChecboxesBox = styled.div `
|
|
|
22497
22513
|
`}
|
|
22498
22514
|
`;
|
|
22499
22515
|
|
|
22500
|
-
function useFieldControl(value, onChange, props) {
|
|
22501
|
-
const { disabled, isUndefinedWhenDisabled } = props;
|
|
22502
|
-
// This tracks the component internal value which allows us to react to value changes after the checkbox toggling
|
|
22503
|
-
const internalValueRef = useRef(value);
|
|
22504
|
-
// and compare it with an eventual external value change (via the `value` prop)
|
|
22505
|
-
const previousValue = usePrevious(value);
|
|
22506
|
-
const { forceUpdate } = useForceUpdate();
|
|
22507
|
-
const controlledValue = isUndefinedWhenDisabled && disabled ? undefined : internalValueRef.current;
|
|
22508
|
-
const controlledOnChange = useCallback((nextValue) => {
|
|
22509
|
-
internalValueRef.current = nextValue;
|
|
22510
|
-
if (onChange) {
|
|
22511
|
-
onChange(nextValue);
|
|
22512
|
-
}
|
|
22513
|
-
}, [onChange]);
|
|
22514
|
-
// We update the `internalValue` each time the `value` prop is updated
|
|
22515
|
-
useEffect(() => {
|
|
22516
|
-
if (lodashExports.isEqual(value, previousValue)) {
|
|
22517
|
-
return;
|
|
22518
|
-
}
|
|
22519
|
-
internalValueRef.current = value;
|
|
22520
|
-
forceUpdate();
|
|
22521
|
-
}, [forceUpdate, previousValue, value]);
|
|
22522
|
-
return { controlledOnChange, controlledValue };
|
|
22523
|
-
}
|
|
22524
|
-
|
|
22525
22516
|
function getRsuiteValueFromOptionValue(optionValue, optionValueKey) {
|
|
22526
22517
|
return optionValue !== undefined ? String(optionValueKey ? optionValue[optionValueKey] : optionValue) : undefined;
|
|
22527
22518
|
}
|
|
@@ -22534,7 +22525,7 @@ function getRsuiteDataFromOptions(options, optionValueKey) {
|
|
|
22534
22525
|
}));
|
|
22535
22526
|
}
|
|
22536
22527
|
|
|
22537
|
-
function MultiSelect({ baseContainer, disabled = false, error, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, searchable = false, value, ...originalProps }) {
|
|
22528
|
+
function MultiSelect({ baseContainer, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, searchable = false, value, ...originalProps }) {
|
|
22538
22529
|
// eslint-disable-next-line no-null/no-null
|
|
22539
22530
|
const boxRef = useRef(null);
|
|
22540
22531
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -22581,7 +22572,7 @@ function MultiSelect({ baseContainer, disabled = false, error, isLabelHidden = f
|
|
|
22581
22572
|
}, [forceUpdate]);
|
|
22582
22573
|
return (jsxs(Field$2, { className: "Field-MultiSelect", children: [jsx(Label, { disabled: disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(Box$4, { ref: boxRef, "$hasError": hasError, "$isActive": isOpen, "$isLight": isLight, onClick: toggle, children: boxRef.current && (jsx(TagPicker, { container: boxRef.current, data: data, disabled: disabled, id: originalProps.name,
|
|
22583
22574
|
// Since we customized `ItemDataType` type by adding `optionValue`, we have an optional vs required conflict
|
|
22584
|
-
onChange: handleChange, onClick: toggle, open: isOpen, renderMenuItem: renderMenuItem, searchable: searchable, value: controlledRsuiteValue, ...originalProps }, key)) }), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22575
|
+
onChange: handleChange, onClick: toggle, open: isOpen, renderMenuItem: renderMenuItem, searchable: searchable, value: controlledRsuiteValue, ...originalProps }, key)) }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22585
22576
|
}
|
|
22586
22577
|
const Box$4 = styled.div `
|
|
22587
22578
|
position: relative;
|
|
@@ -22704,20 +22695,20 @@ const Box$4 = styled.div `
|
|
|
22704
22695
|
}
|
|
22705
22696
|
`;
|
|
22706
22697
|
|
|
22707
|
-
function MultiRadio({ disabled = false, error, isInline = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, name, onChange, options, value }) {
|
|
22698
|
+
function MultiRadio({ disabled = false, error, isErrorMessageHidden = false, isInline = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, name, onChange, options, value }) {
|
|
22708
22699
|
const { controlledOnChange, controlledValue } = useFieldControl(value, onChange, {
|
|
22709
22700
|
disabled,
|
|
22710
22701
|
isUndefinedWhenDisabled
|
|
22711
22702
|
});
|
|
22712
22703
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
22713
22704
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
22714
|
-
const key = useKey([disabled, name
|
|
22705
|
+
const key = useKey([controlledValue, disabled, name]);
|
|
22715
22706
|
const handleChange = useCallback((nextOptionValue, isChecked) => {
|
|
22716
22707
|
const nextCheckedOptionValue = isChecked ? nextOptionValue : undefined;
|
|
22717
22708
|
controlledOnChange(nextCheckedOptionValue);
|
|
22718
22709
|
}, [controlledOnChange]);
|
|
22719
22710
|
useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
|
|
22720
|
-
return (jsxs(Fieldset, { className: "Field-MultiRadio", disabled: disabled, hasError: hasError, isLegendHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(CheckboxesBox, { "$isInline": isInline, children: options.map(option => (jsx(Radio, { checked: equals(option.value, controlledValue), disabled: disabled, name: name, onChange: (_, isChecked) => handleChange(option.value, isChecked), children: option.label }, JSON.stringify(option.value)))) }), hasError && jsx(FieldError, { children: controlledError })] }
|
|
22711
|
+
return (jsxs(Fieldset, { className: "Field-MultiRadio", disabled: disabled, hasError: hasError, isLegendHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(CheckboxesBox, { "$isInline": isInline, children: options.map(option => (jsx(Radio, { checked: equals(option.value, controlledValue), disabled: disabled, name: name, onChange: (_, isChecked) => handleChange(option.value, isChecked), children: option.label }, JSON.stringify(option.value)))) }, key), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22721
22712
|
}
|
|
22722
22713
|
const CheckboxesBox = styled.div `
|
|
22723
22714
|
color: ${p => p.theme.color.gunMetal};
|
|
@@ -22829,7 +22820,7 @@ const Link = styled.a `
|
|
|
22829
22820
|
}
|
|
22830
22821
|
`;
|
|
22831
22822
|
|
|
22832
|
-
function NumberInput({ error, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, value, ...originalProps }) {
|
|
22823
|
+
function NumberInput({ error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, value, ...originalProps }) {
|
|
22833
22824
|
const controlledValue = useMemo(() => (!isUndefinedWhenDisabled || !originalProps.disabled ? value : undefined), [isUndefinedWhenDisabled, originalProps.disabled, value]);
|
|
22834
22825
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
22835
22826
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
@@ -22844,7 +22835,7 @@ function NumberInput({ error, isLabelHidden = false, isLight = false, isUndefine
|
|
|
22844
22835
|
onChange(normalizedNextValue);
|
|
22845
22836
|
}, [onChange]);
|
|
22846
22837
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
22847
|
-
return (jsxs(Field$2, { className: "Field-NumberInput", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput$2, { "$hasError": hasError, "$isLight": isLight, id: originalProps.name, onChange: handleChange, type: "number", value: controlledValue, ...originalProps }, key), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22838
|
+
return (jsxs(Field$2, { className: "Field-NumberInput", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput$2, { "$hasError": hasError, "$isLight": isLight, id: originalProps.name, onChange: handleChange, type: "number", value: controlledValue, ...originalProps }, key), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
22848
22839
|
}
|
|
22849
22840
|
const StyledInput$2 = styled(Input) `
|
|
22850
22841
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
@@ -32989,7 +32980,7 @@ const StyledFieldset = styled(Fieldset) `
|
|
|
32989
32980
|
}
|
|
32990
32981
|
`;
|
|
32991
32982
|
|
|
32992
|
-
function Select({ baseContainer, disabled = false, error, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, searchable = false, value, ...originalProps }) {
|
|
32983
|
+
function Select({ baseContainer, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, searchable = false, value, ...originalProps }) {
|
|
32993
32984
|
// eslint-disable-next-line no-null/no-null
|
|
32994
32985
|
const boxRef = useRef(null);
|
|
32995
32986
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -33036,7 +33027,7 @@ function Select({ baseContainer, disabled = false, error, isLabelHidden = false,
|
|
|
33036
33027
|
}, [forceUpdate]);
|
|
33037
33028
|
return (jsxs(Field$2, { className: "Field-Select", children: [jsx(Label, { disabled: disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(Box, { ref: boxRef, onClick: toggle, children: boxRef.current && (jsx(StyledSelectPicker, { "$isLight": isLight, container: boxRef.current, data: data, disabled: disabled, id: originalProps.name, onClean: handleClean,
|
|
33038
33029
|
// Since we customized `ItemDataType` type by adding `optionValue`, we have an optional vs required conflict
|
|
33039
|
-
onSelect: handleSelect, open: isOpen, renderMenuItem: renderMenuItem, searchable: searchable, value: controlledRsuiteValue, ...originalProps }, key)) }), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
33030
|
+
onSelect: handleSelect, open: isOpen, renderMenuItem: renderMenuItem, searchable: searchable, value: controlledRsuiteValue, ...originalProps }, key)) }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
33040
33031
|
}
|
|
33041
33032
|
const StyledSelectPicker = styled(SelectPicker) `
|
|
33042
33033
|
> .rs-picker-toggle {
|
|
@@ -33119,7 +33110,7 @@ const Box = styled.div `
|
|
|
33119
33110
|
}
|
|
33120
33111
|
`;
|
|
33121
33112
|
|
|
33122
|
-
function Textarea({ error, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, rows = 3, value, ...originalProps }) {
|
|
33113
|
+
function Textarea({ error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, rows = 3, value, ...originalProps }) {
|
|
33123
33114
|
const inputRef = useRef();
|
|
33124
33115
|
const controlledValue = useMemo(() => (!isUndefinedWhenDisabled || !originalProps.disabled ? value : undefined), [isUndefinedWhenDisabled, originalProps.disabled, value]);
|
|
33125
33116
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
@@ -33134,7 +33125,7 @@ function Textarea({ error, isLabelHidden = false, isLight = false, isUndefinedWh
|
|
|
33134
33125
|
onChange(normalizedNextValue);
|
|
33135
33126
|
}, [onChange]);
|
|
33136
33127
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
33137
|
-
return (jsxs(Field$2, { className: "Field-Textarea", children: [jsx(Label, { disabled: originalProps.disabled, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput$1, { ref: inputRef, "$isLight": isLight, as: "textarea", id: originalProps.name, onChange: handleChange, rows: rows, value: controlledValue, ...originalProps }, key), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
33128
|
+
return (jsxs(Field$2, { className: "Field-Textarea", children: [jsx(Label, { disabled: originalProps.disabled, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput$1, { ref: inputRef, "$isLight": isLight, as: "textarea", id: originalProps.name, onChange: handleChange, rows: rows, value: controlledValue, ...originalProps }, key), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
33138
33129
|
}
|
|
33139
33130
|
const StyledInput$1 = styled(Input) `
|
|
33140
33131
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
@@ -33148,7 +33139,7 @@ const StyledInput$1 = styled(Input) `
|
|
|
33148
33139
|
}
|
|
33149
33140
|
`;
|
|
33150
33141
|
|
|
33151
|
-
function TextInput({ error, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, value, ...originalProps }) {
|
|
33142
|
+
function TextInput({ error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, value, ...originalProps }) {
|
|
33152
33143
|
const controlledValue = useMemo(() => (!isUndefinedWhenDisabled || !originalProps.disabled ? value : undefined), [isUndefinedWhenDisabled, originalProps.disabled, value]);
|
|
33153
33144
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
33154
33145
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
@@ -33161,7 +33152,7 @@ function TextInput({ error, isLabelHidden = false, isLight = false, isUndefinedW
|
|
|
33161
33152
|
onChange(normalizedNextValue);
|
|
33162
33153
|
}, [onChange]);
|
|
33163
33154
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
33164
|
-
return (jsxs(Field$2, { className: "Field-TextInput", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput, { "$hasError": hasError, "$isLight": isLight, id: originalProps.name, onChange: handleChange, type: "text", value: controlledValue, ...originalProps }, key), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
33155
|
+
return (jsxs(Field$2, { className: "Field-TextInput", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput, { "$hasError": hasError, "$isLight": isLight, id: originalProps.name, onChange: handleChange, type: "text", value: controlledValue, ...originalProps }, key), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
33165
33156
|
}
|
|
33166
33157
|
const StyledInput = styled(Input) `
|
|
33167
33158
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|