@mtes-mct/monitor-ui 5.2.1 → 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/CHANGELOG.md +7 -0
- 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 +55 -62
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [5.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.2.0...v5.2.1) (2023-04-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **cypress:** include registerMonitorUiCustomCommands() typings in module ([81373dc](https://github.com/MTES-MCT/monitor-ui/commit/81373dca3f7b3a62770cb858ae601e984834f4c0))
|
|
7
|
+
|
|
1
8
|
# [5.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.1.1...v5.2.0) (2023-04-11)
|
|
2
9
|
|
|
3
10
|
|
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;
|
|
@@ -22676,6 +22667,8 @@ const Box$4 = styled.div `
|
|
|
22676
22667
|
}
|
|
22677
22668
|
|
|
22678
22669
|
> .rs-picker-menu {
|
|
22670
|
+
max-width: 100%;
|
|
22671
|
+
|
|
22679
22672
|
> .rs-picker-check-menu {
|
|
22680
22673
|
margin: 0;
|
|
22681
22674
|
|
|
@@ -22702,20 +22695,20 @@ const Box$4 = styled.div `
|
|
|
22702
22695
|
}
|
|
22703
22696
|
`;
|
|
22704
22697
|
|
|
22705
|
-
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 }) {
|
|
22706
22699
|
const { controlledOnChange, controlledValue } = useFieldControl(value, onChange, {
|
|
22707
22700
|
disabled,
|
|
22708
22701
|
isUndefinedWhenDisabled
|
|
22709
22702
|
});
|
|
22710
22703
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
22711
22704
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
22712
|
-
const key = useKey([disabled, name
|
|
22705
|
+
const key = useKey([controlledValue, disabled, name]);
|
|
22713
22706
|
const handleChange = useCallback((nextOptionValue, isChecked) => {
|
|
22714
22707
|
const nextCheckedOptionValue = isChecked ? nextOptionValue : undefined;
|
|
22715
22708
|
controlledOnChange(nextCheckedOptionValue);
|
|
22716
22709
|
}, [controlledOnChange]);
|
|
22717
22710
|
useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
|
|
22718
|
-
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 })] }));
|
|
22719
22712
|
}
|
|
22720
22713
|
const CheckboxesBox = styled.div `
|
|
22721
22714
|
color: ${p => p.theme.color.gunMetal};
|
|
@@ -22827,7 +22820,7 @@ const Link = styled.a `
|
|
|
22827
22820
|
}
|
|
22828
22821
|
`;
|
|
22829
22822
|
|
|
22830
|
-
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 }) {
|
|
22831
22824
|
const controlledValue = useMemo(() => (!isUndefinedWhenDisabled || !originalProps.disabled ? value : undefined), [isUndefinedWhenDisabled, originalProps.disabled, value]);
|
|
22832
22825
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
22833
22826
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
@@ -22842,7 +22835,7 @@ function NumberInput({ error, isLabelHidden = false, isLight = false, isUndefine
|
|
|
22842
22835
|
onChange(normalizedNextValue);
|
|
22843
22836
|
}, [onChange]);
|
|
22844
22837
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
22845
|
-
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 })] }));
|
|
22846
22839
|
}
|
|
22847
22840
|
const StyledInput$2 = styled(Input) `
|
|
22848
22841
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
@@ -32987,7 +32980,7 @@ const StyledFieldset = styled(Fieldset) `
|
|
|
32987
32980
|
}
|
|
32988
32981
|
`;
|
|
32989
32982
|
|
|
32990
|
-
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 }) {
|
|
32991
32984
|
// eslint-disable-next-line no-null/no-null
|
|
32992
32985
|
const boxRef = useRef(null);
|
|
32993
32986
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -33034,7 +33027,7 @@ function Select({ baseContainer, disabled = false, error, isLabelHidden = false,
|
|
|
33034
33027
|
}, [forceUpdate]);
|
|
33035
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,
|
|
33036
33029
|
// Since we customized `ItemDataType` type by adding `optionValue`, we have an optional vs required conflict
|
|
33037
|
-
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 })] }));
|
|
33038
33031
|
}
|
|
33039
33032
|
const StyledSelectPicker = styled(SelectPicker) `
|
|
33040
33033
|
> .rs-picker-toggle {
|
|
@@ -33117,7 +33110,7 @@ const Box = styled.div `
|
|
|
33117
33110
|
}
|
|
33118
33111
|
`;
|
|
33119
33112
|
|
|
33120
|
-
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 }) {
|
|
33121
33114
|
const inputRef = useRef();
|
|
33122
33115
|
const controlledValue = useMemo(() => (!isUndefinedWhenDisabled || !originalProps.disabled ? value : undefined), [isUndefinedWhenDisabled, originalProps.disabled, value]);
|
|
33123
33116
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
@@ -33132,7 +33125,7 @@ function Textarea({ error, isLabelHidden = false, isLight = false, isUndefinedWh
|
|
|
33132
33125
|
onChange(normalizedNextValue);
|
|
33133
33126
|
}, [onChange]);
|
|
33134
33127
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
33135
|
-
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 })] }));
|
|
33136
33129
|
}
|
|
33137
33130
|
const StyledInput$1 = styled(Input) `
|
|
33138
33131
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
@@ -33146,7 +33139,7 @@ const StyledInput$1 = styled(Input) `
|
|
|
33146
33139
|
}
|
|
33147
33140
|
`;
|
|
33148
33141
|
|
|
33149
|
-
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 }) {
|
|
33150
33143
|
const controlledValue = useMemo(() => (!isUndefinedWhenDisabled || !originalProps.disabled ? value : undefined), [isUndefinedWhenDisabled, originalProps.disabled, value]);
|
|
33151
33144
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
33152
33145
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
@@ -33159,7 +33152,7 @@ function TextInput({ error, isLabelHidden = false, isLight = false, isUndefinedW
|
|
|
33159
33152
|
onChange(normalizedNextValue);
|
|
33160
33153
|
}, [onChange]);
|
|
33161
33154
|
useFieldUndefineEffect(isUndefinedWhenDisabled && originalProps.disabled, onChange);
|
|
33162
|
-
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 })] }));
|
|
33163
33156
|
}
|
|
33164
33157
|
const StyledInput = styled(Input) `
|
|
33165
33158
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|