@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtes-mct/monitor-ui",
3
3
  "description": "Common React UI components and styles for Monitorfish and Monitorenv.",
4
- "version": "4.0.0",
4
+ "version": "4.0.2",
5
5
  "license": "AGPL-3.0",
6
6
  "engines": {
7
7
  "node": ">=18"
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<V extends number | string | Record<string, any> = string> = Omit<ItemDataType<string>, 'label' | 'value'> & {
11
+ export type Option<OptionValue extends OptionValueType = string> = Omit<ItemDataType<string>, 'label' | 'value'> & {
12
12
  label: string;
13
- value: V;
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<V extends number | string | Record<string, any>> extends ItemDataType<string> {
30
+ export interface OptionAsRsuiteItemDataType<OptionValue extends OptionValueType = string> extends ItemDataType<string> {
30
31
  label: string;
31
- optionValue: V;
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<T extends number | string | Record<string, any>>(options: Array<Option<T>>, optionValueKey?: keyof T | undefined): Array<OptionAsRsuiteItemDataType<T>>;
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>>;
@@ -0,0 +1,2 @@
1
+ import type { OptionValueType } from '../types';
2
+ export declare function getRsuiteValueFromOptionValue<OptionValue extends OptionValueType = string>(optionValue: OptionValue | undefined, optionValueKey?: keyof OptionValue | undefined): string | undefined;
@@ -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[];