@mtes-mct/monitor-ui 4.0.0 → 4.0.2
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 +23 -0
- package/cypress/index.js +50 -53
- package/cypress/index.js.map +1 -1
- package/fields/MultiCheckbox.d.ts +3 -3
- package/fields/MultiRadio.d.ts +3 -3
- package/fields/MultiSelect.d.ts +3 -5
- package/fields/Search.d.ts +3 -3
- package/fields/Select.d.ts +3 -3
- package/formiks/FormikMultiCheckbox.d.ts +3 -2
- package/formiks/FormikMultiRadio.d.ts +3 -2
- package/formiks/FormikMultiSelect.d.ts +3 -2
- package/formiks/FormikSearch.d.ts +3 -2
- package/formiks/FormikSelect.d.ts +3 -2
- package/hooks/useFieldControl.d.ts +9 -0
- package/index.d.ts +1 -1
- package/index.js +78 -91
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +5 -4
- package/utils/getRsuiteDataFromOptions.d.ts +2 -2
- package/utils/getRsuiteValueFromOptionValue.d.ts +2 -0
- package/utils/toggleInCollection.d.ts +1 -1
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -8,10 +8,11 @@ export type IconProps = SVGProps<SVGSVGElement> & {
|
|
|
8
8
|
/** In pixels */
|
|
9
9
|
size?: number | undefined;
|
|
10
10
|
};
|
|
11
|
-
export type Option<
|
|
11
|
+
export type Option<OptionValue extends OptionValueType = string> = Omit<ItemDataType<string>, 'label' | 'value'> & {
|
|
12
12
|
label: string;
|
|
13
|
-
value:
|
|
13
|
+
value: OptionValue;
|
|
14
14
|
};
|
|
15
|
+
export type OptionValueType = boolean | number | string | Record<string, any>;
|
|
15
16
|
/**
|
|
16
17
|
* Mark all the props type of an interface/type as `| undefined`
|
|
17
18
|
*
|
|
@@ -26,8 +27,8 @@ export type Undefine<T> = {
|
|
|
26
27
|
* Since Rsuite restricts `value` to `string | number`, we use this proxy type,
|
|
27
28
|
* allowing us to use conventioned option values that can include objects
|
|
28
29
|
*/
|
|
29
|
-
export interface OptionAsRsuiteItemDataType<
|
|
30
|
+
export interface OptionAsRsuiteItemDataType<OptionValue extends OptionValueType = string> extends ItemDataType<string> {
|
|
30
31
|
label: string;
|
|
31
|
-
optionValue:
|
|
32
|
+
optionValue: OptionValue;
|
|
32
33
|
value: string;
|
|
33
34
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Option, OptionAsRsuiteItemDataType } from '../types';
|
|
2
|
-
export declare function getRsuiteDataFromOptions<
|
|
1
|
+
import type { Option, OptionAsRsuiteItemDataType, OptionValueType } from '../types';
|
|
2
|
+
export declare function getRsuiteDataFromOptions<OptionValue extends OptionValueType = string>(options: Array<Option<OptionValue>>, optionValueKey?: keyof OptionValue | undefined): Array<OptionAsRsuiteItemDataType<OptionValue>>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is useful with object collections and polymorphic types.
|
|
5
5
|
*/
|
|
6
|
-
export declare function toggleInCollection<Item extends number | string | Record<string, any>>(item: Item, collection: Item[]): Item[];
|
|
6
|
+
export declare function toggleInCollection<Item extends boolean | number | string | Record<string, any>>(item: Item, collection: Item[]): Item[];
|