@mtes-mct/monitor-ui 5.9.1 → 6.0.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 +14 -0
- package/elements/Button.d.ts +1 -1
- package/elements/IconButton.d.ts +1 -1
- package/fields/Search.d.ts +5 -4
- package/index.js +42 -189
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.9.2](https://github.com/MTES-MCT/monitor-ui/compare/v5.9.1...v5.9.2) (2023-05-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **elements:** delete stop click event propagation in Button & IconButton ([b2d70ad](https://github.com/MTES-MCT/monitor-ui/commit/b2d70adf14ce7780b6ef45ff9bbba0d026ac77ef))
|
|
7
|
+
|
|
8
|
+
## [5.9.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.9.0...v5.9.1) (2023-05-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **components:** add default class name to Dialog ([b74ea15](https://github.com/MTES-MCT/monitor-ui/commit/b74ea15a9ae9d629e99eb2917a2acc3b88936736))
|
|
14
|
+
|
|
1
15
|
# [5.9.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.8.1...v5.9.0) (2023-05-05)
|
|
2
16
|
|
|
3
17
|
|
package/elements/Button.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'childre
|
|
|
8
8
|
isFullWidth?: boolean | undefined;
|
|
9
9
|
size?: Size | undefined;
|
|
10
10
|
};
|
|
11
|
-
export declare function Button({ accent, children, Icon, isFullWidth,
|
|
11
|
+
export declare function Button({ accent, children, Icon, isFullWidth, size, type, ...nativeProps }: ButtonProps): JSX.Element;
|
|
12
12
|
export declare const PrimaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
13
13
|
export declare const SecondaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
14
14
|
export declare const TertiaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
package/elements/IconButton.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'chi
|
|
|
9
9
|
iconSize?: number | undefined;
|
|
10
10
|
size?: Size | undefined;
|
|
11
11
|
};
|
|
12
|
-
export declare function IconButton({ accent, color, Icon, iconSize,
|
|
12
|
+
export declare function IconButton({ accent, color, Icon, iconSize, size, type, ...nativeProps }: IconButtonProps): JSX.Element;
|
package/fields/Search.d.ts
CHANGED
|
@@ -6,20 +6,21 @@ export type SearchProps<OptionValue extends OptionValueType = string> = Omit<Rsu
|
|
|
6
6
|
MenuItem?: React.ElementType | undefined;
|
|
7
7
|
/** Used to pass something else than `window.document` as a base container to attach global events listeners. */
|
|
8
8
|
baseContainer?: Document | HTMLDivElement | null | undefined;
|
|
9
|
-
defaultValue?: OptionValue | undefined;
|
|
10
9
|
error?: string | undefined;
|
|
11
10
|
isErrorMessageHidden?: boolean | undefined;
|
|
12
11
|
isLabelHidden?: boolean | undefined;
|
|
13
12
|
isLight?: boolean | undefined;
|
|
14
|
-
|
|
13
|
+
isSearchIconVisible?: boolean | undefined;
|
|
15
14
|
label: string;
|
|
16
15
|
name: string;
|
|
17
16
|
onChange?: ((nextValue: OptionValue | undefined) => Promisable<void>) | undefined;
|
|
18
17
|
onQuery?: ((nextQuery: string | undefined) => Promisable<void>) | undefined;
|
|
19
|
-
|
|
18
|
+
optionValueKey?: keyof OptionValue | undefined;
|
|
19
|
+
options?: Option<OptionValue>[];
|
|
20
20
|
queryMap?: ((record: Record<string, any>) => Option<OptionValue>) | undefined;
|
|
21
21
|
queryUrl?: string | undefined;
|
|
22
22
|
/** Duration in milliseconds */
|
|
23
23
|
throttleDuration?: number;
|
|
24
|
+
value?: OptionValue | undefined;
|
|
24
25
|
};
|
|
25
|
-
export declare function Search<OptionValue extends OptionValueType = string>({ baseContainer,
|
|
26
|
+
export declare function Search<OptionValue extends OptionValueType = string>({ baseContainer, error, isErrorMessageHidden, isLabelHidden, isLight, isSearchIconVisible, label, MenuItem, onChange, onQuery, options, optionValueKey, queryMap, queryUrl, throttleDuration, value, ...originalProps }: SearchProps<OptionValue>): JSX.Element;
|
package/index.js
CHANGED
|
@@ -1014,84 +1014,6 @@ _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
|
|
|
1014
1014
|
|
|
1015
1015
|
var map$1 = map;
|
|
1016
1016
|
|
|
1017
|
-
/**
|
|
1018
|
-
* Determine if the passed argument is an integer.
|
|
1019
|
-
*
|
|
1020
|
-
* @private
|
|
1021
|
-
* @param {*} n
|
|
1022
|
-
* @category Type
|
|
1023
|
-
* @return {Boolean}
|
|
1024
|
-
*/
|
|
1025
|
-
var _isInteger = Number.isInteger || function _isInteger(n) {
|
|
1026
|
-
return n << 0 === n;
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Returns the nth element of the given list or string. If n is negative the
|
|
1031
|
-
* element at index length + n is returned.
|
|
1032
|
-
*
|
|
1033
|
-
* @func
|
|
1034
|
-
* @memberOf R
|
|
1035
|
-
* @since v0.1.0
|
|
1036
|
-
* @category List
|
|
1037
|
-
* @sig Number -> [a] -> a | Undefined
|
|
1038
|
-
* @sig Number -> String -> String
|
|
1039
|
-
* @param {Number} offset
|
|
1040
|
-
* @param {*} list
|
|
1041
|
-
* @return {*}
|
|
1042
|
-
* @example
|
|
1043
|
-
*
|
|
1044
|
-
* const list = ['foo', 'bar', 'baz', 'quux'];
|
|
1045
|
-
* R.nth(1, list); //=> 'bar'
|
|
1046
|
-
* R.nth(-1, list); //=> 'quux'
|
|
1047
|
-
* R.nth(-99, list); //=> undefined
|
|
1048
|
-
*
|
|
1049
|
-
* R.nth(2, 'abc'); //=> 'c'
|
|
1050
|
-
* R.nth(3, 'abc'); //=> ''
|
|
1051
|
-
* @symb R.nth(-1, [a, b, c]) = c
|
|
1052
|
-
* @symb R.nth(0, [a, b, c]) = a
|
|
1053
|
-
* @symb R.nth(1, [a, b, c]) = b
|
|
1054
|
-
*/
|
|
1055
|
-
|
|
1056
|
-
var nth =
|
|
1057
|
-
/*#__PURE__*/
|
|
1058
|
-
_curry2(function nth(offset, list) {
|
|
1059
|
-
var idx = offset < 0 ? list.length + offset : offset;
|
|
1060
|
-
return _isString(list) ? list.charAt(idx) : list[idx];
|
|
1061
|
-
});
|
|
1062
|
-
|
|
1063
|
-
/**
|
|
1064
|
-
* Returns a function that when supplied an object returns the indicated
|
|
1065
|
-
* property of that object, if it exists.
|
|
1066
|
-
*
|
|
1067
|
-
* @func
|
|
1068
|
-
* @memberOf R
|
|
1069
|
-
* @since v0.1.0
|
|
1070
|
-
* @category Object
|
|
1071
|
-
* @typedefn Idx = String | Int | Symbol
|
|
1072
|
-
* @sig Idx -> {s: a} -> a | Undefined
|
|
1073
|
-
* @param {String|Number} p The property name or array index
|
|
1074
|
-
* @param {Object} obj The object to query
|
|
1075
|
-
* @return {*} The value at `obj.p`.
|
|
1076
|
-
* @see R.path, R.props, R.pluck, R.project, R.nth
|
|
1077
|
-
* @example
|
|
1078
|
-
*
|
|
1079
|
-
* R.prop('x', {x: 100}); //=> 100
|
|
1080
|
-
* R.prop('x', {}); //=> undefined
|
|
1081
|
-
* R.prop(0, [100]); //=> 100
|
|
1082
|
-
* R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4
|
|
1083
|
-
*/
|
|
1084
|
-
|
|
1085
|
-
var prop =
|
|
1086
|
-
/*#__PURE__*/
|
|
1087
|
-
_curry2(function prop(p, obj) {
|
|
1088
|
-
if (obj == null) {
|
|
1089
|
-
return;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
return _isInteger(p) ? nth(p, obj) : obj[p];
|
|
1093
|
-
});
|
|
1094
|
-
|
|
1095
1017
|
/**
|
|
1096
1018
|
* Returns a single item by iterating through the list, successively calling
|
|
1097
1019
|
* the iterator function and passing it an accumulator value and the current
|
|
@@ -2123,40 +2045,6 @@ _curry2(function mergeDeepRight(lObj, rObj) {
|
|
|
2123
2045
|
|
|
2124
2046
|
var mergeDeepRight$1 = mergeDeepRight;
|
|
2125
2047
|
|
|
2126
|
-
/**
|
|
2127
|
-
* Returns `true` if the specified object property is equal, in
|
|
2128
|
-
* [`R.equals`](#equals) terms, to the given value; `false` otherwise.
|
|
2129
|
-
* You can test multiple properties with [`R.whereEq`](#whereEq).
|
|
2130
|
-
*
|
|
2131
|
-
* @func
|
|
2132
|
-
* @memberOf R
|
|
2133
|
-
* @since v0.1.0
|
|
2134
|
-
* @category Relation
|
|
2135
|
-
* @sig String -> a -> Object -> Boolean
|
|
2136
|
-
* @param {String} name
|
|
2137
|
-
* @param {*} val
|
|
2138
|
-
* @param {*} obj
|
|
2139
|
-
* @return {Boolean}
|
|
2140
|
-
* @see R.whereEq, R.propSatisfies, R.equals
|
|
2141
|
-
* @example
|
|
2142
|
-
*
|
|
2143
|
-
* const abby = {name: 'Abby', age: 7, hair: 'blond'};
|
|
2144
|
-
* const fred = {name: 'Fred', age: 12, hair: 'brown'};
|
|
2145
|
-
* const rusty = {name: 'Rusty', age: 10, hair: 'brown'};
|
|
2146
|
-
* const alois = {name: 'Alois', age: 15, disposition: 'surly'};
|
|
2147
|
-
* const kids = [abby, fred, rusty, alois];
|
|
2148
|
-
* const hasBrownHair = R.propEq('hair', 'brown');
|
|
2149
|
-
* R.filter(hasBrownHair, kids); //=> [fred, rusty]
|
|
2150
|
-
*/
|
|
2151
|
-
|
|
2152
|
-
var propEq =
|
|
2153
|
-
/*#__PURE__*/
|
|
2154
|
-
_curry3(function propEq(name, val, obj) {
|
|
2155
|
-
return equals$1(val, prop(name, obj));
|
|
2156
|
-
});
|
|
2157
|
-
|
|
2158
|
-
var propEq$1 = propEq;
|
|
2159
|
-
|
|
2160
2048
|
const UntypedStyledComponentsThemeProvider = ThemeProvider$1;
|
|
2161
2049
|
function ThemeProvider({ children, theme = {} }) {
|
|
2162
2050
|
const finalTheme = mergeDeepRight$1(THEME, theme);
|
|
@@ -2709,23 +2597,16 @@ const ICON_SIZE = {
|
|
|
2709
2597
|
[Size.NORMAL]: 20,
|
|
2710
2598
|
[Size.SMALL]: 12
|
|
2711
2599
|
};
|
|
2712
|
-
function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false,
|
|
2600
|
+
function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false, size = Size.NORMAL, type = 'button', ...nativeProps }) {
|
|
2713
2601
|
const commonChildren = useMemo(() => (jsxs(Fragment, { children: [Icon && jsx(Icon, { size: ICON_SIZE[size] }), children && jsx(ButtonLabel, { children: children })] })), [children, Icon, size]);
|
|
2714
|
-
const handleClick = useCallback((event) => {
|
|
2715
|
-
stopMouseEventPropagation(event);
|
|
2716
|
-
if (onClick) {
|
|
2717
|
-
onClick(event);
|
|
2718
|
-
}
|
|
2719
|
-
}, [onClick]);
|
|
2720
2602
|
const commonProps = useMemo(() => ({
|
|
2721
2603
|
as: StyledButton$1,
|
|
2722
2604
|
children: commonChildren,
|
|
2723
2605
|
isFullWidth,
|
|
2724
|
-
onClick: handleClick,
|
|
2725
2606
|
size,
|
|
2726
2607
|
type,
|
|
2727
2608
|
...nativeProps
|
|
2728
|
-
}), [commonChildren, isFullWidth,
|
|
2609
|
+
}), [commonChildren, isFullWidth, nativeProps, size, type]);
|
|
2729
2610
|
switch (accent) {
|
|
2730
2611
|
case Accent.SECONDARY:
|
|
2731
2612
|
return jsx(SecondaryButton, { ...commonProps });
|
|
@@ -2851,7 +2732,7 @@ const ICON_SIZE_IN_PX = {
|
|
|
2851
2732
|
[Size.NORMAL]: 20,
|
|
2852
2733
|
[Size.SMALL]: 14
|
|
2853
2734
|
};
|
|
2854
|
-
function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize,
|
|
2735
|
+
function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, size = Size.NORMAL, type = 'button', ...nativeProps }) {
|
|
2855
2736
|
const children = useMemo(() => jsx(Icon, { color: color, size: iconSize || ICON_SIZE_IN_PX[size] }), [color, Icon, iconSize, size]);
|
|
2856
2737
|
const commonProps = useMemo(() => ({
|
|
2857
2738
|
children,
|
|
@@ -2859,19 +2740,13 @@ function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, onClick, s
|
|
|
2859
2740
|
type,
|
|
2860
2741
|
...nativeProps
|
|
2861
2742
|
}), [children, nativeProps, size, type]);
|
|
2862
|
-
const handleClick = useCallback((event) => {
|
|
2863
|
-
stopMouseEventPropagation(event);
|
|
2864
|
-
if (onClick) {
|
|
2865
|
-
onClick(event);
|
|
2866
|
-
}
|
|
2867
|
-
}, [onClick]);
|
|
2868
2743
|
switch (accent) {
|
|
2869
2744
|
case Accent.SECONDARY:
|
|
2870
|
-
return jsx(SecondaryButton, { as: StyledButton,
|
|
2745
|
+
return jsx(SecondaryButton, { as: StyledButton, ...commonProps });
|
|
2871
2746
|
case Accent.TERTIARY:
|
|
2872
|
-
return jsx(TertiaryButton, { as: StyledButton,
|
|
2747
|
+
return jsx(TertiaryButton, { as: StyledButton, ...commonProps });
|
|
2873
2748
|
default:
|
|
2874
|
-
return jsx(PrimaryButton, { as: StyledButton,
|
|
2749
|
+
return jsx(PrimaryButton, { as: StyledButton, ...commonProps });
|
|
2875
2750
|
}
|
|
2876
2751
|
}
|
|
2877
2752
|
const PADDING = {
|
|
@@ -21301,6 +21176,18 @@ function useKey(deps) {
|
|
|
21301
21176
|
return keyRef.current;
|
|
21302
21177
|
}
|
|
21303
21178
|
|
|
21179
|
+
function getRsuiteValueFromOptionValue(optionValue, optionValueKey) {
|
|
21180
|
+
return optionValue !== undefined ? String(optionValueKey ? optionValue[optionValueKey] : optionValue) : undefined;
|
|
21181
|
+
}
|
|
21182
|
+
|
|
21183
|
+
function getRsuiteDataFromOptions(options, optionValueKey) {
|
|
21184
|
+
return options.map(({ value, ...rest }) => ({
|
|
21185
|
+
...rest,
|
|
21186
|
+
optionValue: value,
|
|
21187
|
+
value: getRsuiteValueFromOptionValue(value, optionValueKey)
|
|
21188
|
+
}));
|
|
21189
|
+
}
|
|
21190
|
+
|
|
21304
21191
|
/**
|
|
21305
21192
|
* Trim and single-space a string
|
|
21306
21193
|
*/
|
|
@@ -21319,27 +21206,19 @@ function normalizeString(text) {
|
|
|
21319
21206
|
return cleanText.length > 0 ? cleanText : undefined;
|
|
21320
21207
|
}
|
|
21321
21208
|
|
|
21322
|
-
function Search({ baseContainer,
|
|
21209
|
+
function Search({ baseContainer, error, isErrorMessageHidden = false, isLabelHidden, isLight = false, isSearchIconVisible = true, label, MenuItem, onChange, onQuery, options = [], optionValueKey, queryMap, queryUrl, throttleDuration = 200, value, ...originalProps }) {
|
|
21323
21210
|
// eslint-disable-next-line no-null/no-null
|
|
21324
21211
|
const boxRef = useRef(null);
|
|
21325
21212
|
const queryRef = useRef(undefined);
|
|
21326
|
-
const
|
|
21327
|
-
const [
|
|
21328
|
-
const [autoGeneratedOptions, setAutoGeneratedOptions] = useState([]);
|
|
21329
|
-
const [controlledDefaultValue, setDefaultControlledValue] = useState(defaultValue);
|
|
21213
|
+
const data = useMemo(() => getRsuiteDataFromOptions(options, optionValueKey), [options, optionValueKey]);
|
|
21214
|
+
const [formattedOptions, setFormattedOptions] = useState(data);
|
|
21330
21215
|
const [isOpen, setIsOpen] = useState(false);
|
|
21331
21216
|
const { forceUpdate } = useForceUpdate();
|
|
21332
21217
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
21333
|
-
const controlledOptions = useMemo(() => options ?? autoGeneratedOptions, [autoGeneratedOptions, options]);
|
|
21334
|
-
const controlledValueAsLabel = useMemo(() => {
|
|
21335
|
-
if (originalProps.disabled) {
|
|
21336
|
-
return undefined;
|
|
21337
|
-
}
|
|
21338
|
-
const foundOption = controlledOptions.find(propEq$1('value', controlledDefaultValue));
|
|
21339
|
-
return foundOption ? foundOption.label : undefined;
|
|
21340
|
-
}, [controlledDefaultValue, controlledOptions, originalProps.disabled]);
|
|
21341
21218
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
21342
|
-
const key = useKey([
|
|
21219
|
+
const key = useKey([value, originalProps.disabled, originalProps.name]);
|
|
21220
|
+
const rsuiteValue = useMemo(() => getRsuiteValueFromOptionValue(value, optionValueKey), [value, optionValueKey]);
|
|
21221
|
+
const [inputValue, setInputValue] = useState(rsuiteValue);
|
|
21343
21222
|
const close = useCallback(() => {
|
|
21344
21223
|
setIsOpen(false);
|
|
21345
21224
|
}, []);
|
|
@@ -21352,61 +21231,51 @@ function Search({ baseContainer, defaultValue, error, isErrorMessageHidden = fal
|
|
|
21352
21231
|
const rawData = await ky$1.get(url).json();
|
|
21353
21232
|
return rawData.map(_queryMap);
|
|
21354
21233
|
}, throttleDuration);
|
|
21355
|
-
const handleChange = useCallback(async (nextQuery) => {
|
|
21234
|
+
const handleChange = useCallback(async (nextQuery, event) => {
|
|
21356
21235
|
if (!(typeof nextQuery === 'string')) {
|
|
21357
21236
|
return;
|
|
21358
21237
|
}
|
|
21359
|
-
setInputValue(nextQuery);
|
|
21360
21238
|
queryRef.current = normalizeString(nextQuery);
|
|
21239
|
+
if (event.type === 'change') {
|
|
21240
|
+
setInputValue(nextQuery);
|
|
21241
|
+
setIsOpen(Boolean(queryRef.current));
|
|
21242
|
+
}
|
|
21243
|
+
else {
|
|
21244
|
+
setIsOpen(false);
|
|
21245
|
+
}
|
|
21361
21246
|
if (queryUrl && queryMap && queryRef.current) {
|
|
21362
21247
|
const nextData = (await fetchQueryResponse(queryRef.current, queryUrl, queryMap)) || [];
|
|
21363
|
-
|
|
21248
|
+
setFormattedOptions(getRsuiteDataFromOptions(nextData, optionValueKey));
|
|
21364
21249
|
}
|
|
21365
|
-
setIsOpen(Boolean(queryRef.current));
|
|
21366
21250
|
if (onChange && !queryRef.current) {
|
|
21367
21251
|
onChange(undefined);
|
|
21368
21252
|
}
|
|
21369
21253
|
if (onQuery) {
|
|
21370
21254
|
onQuery(queryRef.current);
|
|
21371
21255
|
}
|
|
21372
|
-
}, [onChange, onQuery, queryMap, queryUrl, fetchQueryResponse]);
|
|
21373
|
-
const handleSelect = useCallback((
|
|
21256
|
+
}, [onChange, onQuery, queryMap, queryUrl, fetchQueryResponse, optionValueKey]);
|
|
21257
|
+
const handleSelect = useCallback((_, item) => {
|
|
21374
21258
|
if (onChange) {
|
|
21375
|
-
onChange(
|
|
21259
|
+
onChange(item.optionValue);
|
|
21376
21260
|
}
|
|
21377
|
-
|
|
21261
|
+
setInputValue(item.label);
|
|
21378
21262
|
}, [onChange]);
|
|
21379
|
-
const open = useCallback(() => {
|
|
21380
|
-
if (!queryRef.current) {
|
|
21381
|
-
return;
|
|
21382
|
-
}
|
|
21383
|
-
setIsOpen(true);
|
|
21384
|
-
}, []);
|
|
21385
|
-
useEffect(() => {
|
|
21386
|
-
if (defaultValue === prevDefaultValuePropRef.current) {
|
|
21387
|
-
return;
|
|
21388
|
-
}
|
|
21389
|
-
setDefaultControlledValue(defaultValue);
|
|
21390
|
-
}, [defaultValue]);
|
|
21391
21263
|
useFieldUndefineEffect(originalProps.disabled, onChange);
|
|
21392
21264
|
useClickOutsideEffect(boxRef, close, baseContainer);
|
|
21393
21265
|
useEffect(() => {
|
|
21394
21266
|
forceUpdate();
|
|
21395
21267
|
}, [forceUpdate]);
|
|
21396
|
-
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,
|
|
21268
|
+
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, children: [boxRef.current && (jsx(StyledAutoComplete, { "$isLight": isLight, container: boxRef.current, data: formattedOptions, 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, isSearchIconVisible: isSearchIconVisible, onClick: clean, size: Size.SMALL }), isSearchIconVisible && jsx(Separator, { children: "|" })] })), isSearchIconVisible && jsx(StyledIconSearch, { color: THEME.color.slateGray, size: 20 })] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
|
|
21397
21269
|
}
|
|
21398
21270
|
const StyledCloseButton = styled(IconButton) `
|
|
21399
21271
|
cursor: pointer;
|
|
21400
21272
|
height: 30px;
|
|
21401
|
-
margin: 5px ${p => (p.
|
|
21273
|
+
margin: 5px ${p => (p.isSearchIconVisible ? 0 : 5)}px 5px 5px;
|
|
21402
21274
|
padding: 8px;
|
|
21403
21275
|
width: 30px;
|
|
21404
21276
|
`;
|
|
21405
|
-
const
|
|
21406
|
-
border: unset;
|
|
21407
|
-
cursor: pointer;
|
|
21277
|
+
const StyledIconSearch = styled(Search$1) `
|
|
21408
21278
|
margin: 10px 10px 10px 8px;
|
|
21409
|
-
padding: 0px;
|
|
21410
21279
|
`;
|
|
21411
21280
|
const Separator = styled.div `
|
|
21412
21281
|
height: 40px;
|
|
@@ -21423,6 +21292,7 @@ const StyledAutoComplete = styled(AutoComplete) `
|
|
|
21423
21292
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
21424
21293
|
border-width: 0 0 1px;
|
|
21425
21294
|
border-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
21295
|
+
|
|
21426
21296
|
font-size: 13px;
|
|
21427
21297
|
width: 100%;
|
|
21428
21298
|
height: 40px;
|
|
@@ -22984,18 +22854,6 @@ const ChecboxesBox = styled.div `
|
|
|
22984
22854
|
`}
|
|
22985
22855
|
`;
|
|
22986
22856
|
|
|
22987
|
-
function getRsuiteValueFromOptionValue(optionValue, optionValueKey) {
|
|
22988
|
-
return optionValue !== undefined ? String(optionValueKey ? optionValue[optionValueKey] : optionValue) : undefined;
|
|
22989
|
-
}
|
|
22990
|
-
|
|
22991
|
-
function getRsuiteDataFromOptions(options, optionValueKey) {
|
|
22992
|
-
return options.map(({ value, ...rest }) => ({
|
|
22993
|
-
...rest,
|
|
22994
|
-
optionValue: value,
|
|
22995
|
-
value: getRsuiteValueFromOptionValue(value, optionValueKey)
|
|
22996
|
-
}));
|
|
22997
|
-
}
|
|
22998
|
-
|
|
22999
22857
|
function MultiSelect({ baseContainer, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, searchable = false, value, ...originalProps }) {
|
|
23000
22858
|
// eslint-disable-next-line no-null/no-null
|
|
23001
22859
|
const boxRef = useRef(null);
|
|
@@ -32403,13 +32261,8 @@ const StyledInput = styled(Input) `
|
|
|
32403
32261
|
function FormikSearch({ name, ...originalProps }) {
|
|
32404
32262
|
const [field, meta, helpers] = useField(name);
|
|
32405
32263
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32406
|
-
const defaultValue = useMemo(() => field.value, []);
|
|
32407
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32408
32264
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
32409
|
-
|
|
32410
|
-
return jsx(Search, { name: name, onChange: helpers.setValue, ...originalProps });
|
|
32411
|
-
}
|
|
32412
|
-
return (jsx(Search, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
32265
|
+
return jsx(Search, { error: meta.error, name: name, onChange: handleChange, value: field.value, ...originalProps });
|
|
32413
32266
|
}
|
|
32414
32267
|
|
|
32415
32268
|
function FormikCheckbox({ name, ...originalProps }) {
|