@mtes-mct/monitor-ui 24.17.1 → 24.18.1

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 CHANGED
@@ -1,3 +1,33 @@
1
+ ## [24.18.0](https://github.com/MTES-MCT/monitor-ui/compare/v24.17.1...v24.18.0) (2025-05-06)
2
+
3
+ ### Features
4
+
5
+ * **components:** add option display props. refacto to use override value, label and children key ([266d620](https://github.com/MTES-MCT/monitor-ui/commit/266d6201f61cdd70cf0c6fefef2b9fa4e6f9d28f))
6
+ * **components:** add option display props. refacto to use override value, label and children key ([728ec63](https://github.com/MTES-MCT/monitor-ui/commit/728ec63e106ad5d164be5f74b316a1efc51a7625))
7
+
8
+ ### Bug Fixes
9
+
10
+ * **components:** move checkpicker css ([ce6c3f9](https://github.com/MTES-MCT/monitor-ui/commit/ce6c3f9b692b2a75f092049aa36177af4e00e686))
11
+ * **components:** move computing disabled values on value setting instead of onChange. Fix formik story ([5e3cf81](https://github.com/MTES-MCT/monitor-ui/commit/5e3cf813299a038165f3cca6627678ce31353db1))
12
+ * **fields:** fix checktreepicker style ([2706b3d](https://github.com/MTES-MCT/monitor-ui/commit/2706b3d08a5af32e9dc7b802955672700e1ebd02))
13
+ * **fields:** fix style with isLight and isTransparent props ([ee4d1db](https://github.com/MTES-MCT/monitor-ui/commit/ee4d1dbee3f9520f9e8f706c55354c1038f1c5b6))
14
+
15
+ ### Buid System & Dependencies
16
+
17
+ * **deps:** bump @babel/runtime in the non-major-dependencies group ([5828afa](https://github.com/MTES-MCT/monitor-ui/commit/5828afae412d302a136c07767568e1c04437e279))
18
+ * **dev-deps:** bump the all-non-major-dependencies group ([651d1e6](https://github.com/MTES-MCT/monitor-ui/commit/651d1e60730c0685c9e84454ae411c2aed740a8c))
19
+
20
+ ## [24.17.1](https://github.com/MTES-MCT/monitor-ui/compare/v24.17.0...v24.17.1) (2025-05-02)
21
+
22
+ ### Buid System & Dependencies
23
+
24
+ * **deps:** bump @tanstack/react-table ([652fa3c](https://github.com/MTES-MCT/monitor-ui/commit/652fa3cf4dd1b9bd67168f088aff1cb00b6f307b))
25
+ * **dev-deps:** bump the all-non-major-dependencies group ([44922f2](https://github.com/MTES-MCT/monitor-ui/commit/44922f2e4127eb1eac1e3060eedd6cc45e6731c9))
26
+ * **dev-deps:** bump the all-non-major-dependencies group ([b31336b](https://github.com/MTES-MCT/monitor-ui/commit/b31336b8dabfe48747548aa5198a559ac6dc77b6))
27
+ * **dev-deps:** bump the non-major-dev-dependencies group across 1 directory with 17 updates ([c2ae567](https://github.com/MTES-MCT/monitor-ui/commit/c2ae567788228b0b67a738823a6a1c892bf8979f))
28
+ * **dev-deps:** bump vite ([04cc7d4](https://github.com/MTES-MCT/monitor-ui/commit/04cc7d4b90f0f317fe481da26890c86c8412d9b4))
29
+ * **dev-deps:** bump vite in the npm_and_yarn group ([3aef1de](https://github.com/MTES-MCT/monitor-ui/commit/3aef1de215e81c39cf2880c3e486ee2a4537b098))
30
+
1
31
  ## [24.16.0](https://github.com/MTES-MCT/monitor-ui/compare/v24.15.1...v24.16.0) (2025-04-02)
2
32
 
3
33
  ### Features
@@ -0,0 +1,21 @@
1
+ interface CheckPickerBoxProps {
2
+ boxRef: React.RefObject<HTMLDivElement> | undefined;
3
+ children?: React.ReactNode;
4
+ className: string | undefined;
5
+ disabled: boolean;
6
+ error: string | undefined;
7
+ hasError: boolean;
8
+ isErrorMessageHidden: boolean;
9
+ isLabelHidden?: boolean;
10
+ isLight: boolean;
11
+ isRequired?: boolean;
12
+ isTransparent: boolean;
13
+ label: string;
14
+ name: string;
15
+ popupWidth: number | undefined;
16
+ readOnly: boolean;
17
+ style: React.CSSProperties | undefined;
18
+ }
19
+ export declare function CheckTreePickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }: CheckPickerBoxProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=CheckTreePickerBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckTreePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/CheckTreePickerBox.tsx"],"names":[],"mappings":"AAMA,UAAU,mBAAmB;IAC3B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;CACvC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,OAAO,EACP,UAAU,EACV,aAAa,EACb,KAAK,EACL,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,KAAK,EACN,EAAE,mBAAmB,2CAqBrB"}
@@ -0,0 +1,3 @@
1
+ import type { CommonPickerFieldStyleProps } from '@fields/shared/types';
2
+ export declare const RsuiteCheckTreePickerBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, CommonPickerFieldStyleProps>> & string;
3
+ //# sourceMappingURL=RsuiteCheckTreePickerBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RsuiteCheckTreePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/RsuiteCheckTreePickerBox.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAEvE,eAAO,MAAM,wBAAwB,gQAkRpC,CAAA"}
@@ -2,7 +2,6 @@ import { type CheckTreePickerProps as RsuiteCheckTreePickerProps } from 'rsuite'
2
2
  import type { TreeOption } from './types';
3
3
  import type { Promisable } from 'type-fest';
4
4
  export type CheckTreePickerProps = Omit<RsuiteCheckTreePickerProps, 'as' | 'container' | 'data' | 'defaultValue' | 'id' | 'onChange' | 'renderMenuItem' | 'value'> & {
5
- childrenKey?: string;
6
5
  error?: string | undefined;
7
6
  isErrorMessageHidden?: boolean | undefined;
8
7
  isLabelHidden?: boolean | undefined;
@@ -13,12 +12,13 @@ export type CheckTreePickerProps = Omit<RsuiteCheckTreePickerProps, 'as' | 'cont
13
12
  isUndefinedWhenDisabled?: boolean | undefined;
14
13
  label: string;
15
14
  name: string;
16
- onChange?: (nextValue: TreeOption[] | undefined) => Promisable<void>;
15
+ onChange?: (nextValue: any[] | undefined) => Promisable<void>;
17
16
  options: TreeOption[];
18
17
  popupWidth?: number | undefined;
19
18
  renderedChildrenValue?: string;
20
19
  renderedValue?: string;
20
+ shouldShowLabels?: boolean;
21
21
  value?: TreeOption[] | undefined;
22
22
  };
23
- export declare function CheckTreePicker({ childrenKey, className, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isMultiSelect, isRequired, isTransparent, isUndefinedWhenDisabled, label, onChange, options, popupWidth, readOnly, renderedChildrenValue, renderedValue, style, value, ...originalProps }: CheckTreePickerProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function CheckTreePicker({ childrenKey, className, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isMultiSelect, isRequired, isTransparent, isUndefinedWhenDisabled, label, labelKey, onChange, options, popupWidth, readOnly, renderedChildrenValue, renderedValue, shouldShowLabels, style, value, valueKey, ...originalProps }: CheckTreePickerProps): import("react/jsx-runtime").JSX.Element;
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,oBAAoB,IAAI,0BAA0B,EACxD,MAAM,QAAQ,CAAA;AAQf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,0BAA0B,EAC1B,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAC9F,GAAG;IACF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1C,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,KAAK,UAAU,CAAC,IAAI,CAAC,CAAA;IACpE,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CACjC,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAwB,EACxB,SAAS,EACT,QAAgB,EAChB,KAAK,EACL,oBAA4B,EAC5B,aAAqB,EACrB,OAAe,EACf,aAAoB,EACpB,UAAkB,EAClB,aAAqB,EACrB,uBAA+B,EAC/B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,QAAgB,EAChB,qBAAyC,EACzC,aAA4B,EAC5B,KAAK,EACL,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,oBAAoB,2CAwGtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,oBAAoB,IAAI,0BAA0B,EACxD,MAAM,QAAQ,CAAA;AAYf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,0BAA0B,EAC1B,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAC9F,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1C,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,SAAS,KAAK,UAAU,CAAC,IAAI,CAAC,CAAA;IAC7D,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CACjC,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAwB,EACxB,SAAS,EACT,QAAgB,EAChB,KAAK,EACL,oBAA4B,EAC5B,aAAqB,EACrB,OAAe,EACf,aAAoB,EACpB,UAAkB,EAClB,aAAqB,EACrB,uBAA+B,EAC/B,KAAK,EACL,QAAkB,EAClB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,QAAgB,EAChB,qBAAyC,EACzC,aAA4B,EAC5B,gBAAuB,EACvB,KAAK,EACL,KAAK,EACL,QAAkB,EAClB,GAAG,aAAa,EACjB,EAAE,oBAAoB,2CA+JtB"}
@@ -1,8 +1,4 @@
1
- export type TreeOption = ({
2
- label: string;
3
- value: string | number;
4
- } & Record<string, TreeOption[] | undefined>) | {
5
- label: string;
6
- value: string | number;
1
+ export type TreeOption = {
2
+ [key: string]: string | number | TreeOption[] | undefined;
7
3
  };
8
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,CAAC;IACC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,CAAC,GAC7C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,EAAE,GAAG,SAAS,CAAA;CAC1D,CAAA"}
@@ -1,7 +1,8 @@
1
1
  import type { TreeOption } from './types';
2
2
  import type { ValueType } from 'rsuite/esm/CheckTreePicker';
3
- export declare function fromRsuiteValue(selectedValues: ValueType, allOptions: TreeOption[], childrenKey?: string): TreeOption[] | undefined;
4
- export declare function getTreeOptionsBySelectedValues(selectedValues: ValueType | undefined, options: TreeOption[], childrenKey?: string): TreeOption[];
5
- export declare function toRsuiteValue(uiValues: TreeOption[] | undefined, childrenKey?: string): ValueType | undefined;
6
- export declare function computeDisabledValues(isMultiSelect: boolean, value: ValueType | undefined, options: TreeOption[], childrenKey?: string): (string | number)[];
3
+ export declare function fromRsuiteValue(selectedValues: ValueType, allOptions: TreeOption[], childrenKey?: string, valueKey?: string | number, labelKey?: string): TreeOption[] | undefined;
4
+ export declare function getTreeOptionsBySelectedValues(selectedValues: ValueType | undefined, options: TreeOption[], childrenKey?: string, valueKey?: string | number, labelKey?: string): TreeOption[];
5
+ export declare function toRsuiteValue(uiValues: TreeOption[] | undefined, childrenKey?: string, valueKey?: string): ValueType | undefined;
6
+ export declare function computeDisabledValues(isMultiSelect: boolean, value: ValueType | undefined, options: TreeOption[], childrenKey?: string, valueKey?: string, labelKey?: string): (string | number)[];
7
+ export declare function getOptionsToDisplay(allOptions: TreeOption[], selectedOptions: TreeOption[], childrenKey?: string, valueKey?: string): TreeOption[];
7
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,wBAAgB,eAAe,CAC7B,cAAc,EAAE,SAAS,EACzB,UAAU,EAAE,UAAU,EAAE,EACxB,WAAW,GAAE,MAAmB,GAC/B,UAAU,EAAE,GAAG,SAAS,CAI1B;AAED,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,SAAS,GAAG,SAAS,EACrC,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,GAAE,MAAmB,GAC/B,UAAU,EAAE,CAiCd;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,UAAU,EAAE,GAAG,SAAS,EAClC,WAAW,GAAE,MAAmB,GAC/B,SAAS,GAAG,SAAS,CAUvB;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,GAAE,MAAmB,uBAmBjC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,wBAAgB,eAAe,CAC7B,cAAc,EAAE,SAAS,EACzB,UAAU,EAAE,UAAU,EAAE,EACxB,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAM,GAAG,MAAgB,EACnC,QAAQ,GAAE,MAAgB,GACzB,UAAU,EAAE,GAAG,SAAS,CAI1B;AAED,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,SAAS,GAAG,SAAS,EACrC,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAM,GAAG,MAAgB,EACnC,QAAQ,GAAE,MAAgB,GACzB,UAAU,EAAE,CAgCd;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,UAAU,EAAE,GAAG,SAAS,EAClC,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAgB,GACzB,SAAS,GAAG,SAAS,CAcvB;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAgB,EAC1B,QAAQ,GAAE,MAAgB,uBAmB3B;AACD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EAAE,EACxB,eAAe,EAAE,UAAU,EAAE,EAC7B,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAgB,GACzB,UAAU,EAAE,CA0Bd"}
@@ -1,3 +1,5 @@
1
1
  import type { CommonPickerFieldStyleProps } from './types';
2
+ export declare const getCheckPickerInputCss: (p: CommonPickerFieldStyleProps) => import("styled-components").RuleSet<object>;
3
+ export declare const getCheckPickerMenuCss: (p: CommonPickerFieldStyleProps) => import("styled-components").RuleSet<object>;
2
4
  export declare const StyledRsuitePickerBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, CommonPickerFieldStyleProps>> & string;
3
5
  //# sourceMappingURL=StyledRsuitePickerBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StyledRsuitePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/StyledRsuitePickerBox.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,eAAO,MAAM,qBAAqB,gQAofjC,CAAA"}
1
+ {"version":3,"file":"StyledRsuitePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/StyledRsuitePickerBox.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,eAAO,MAAM,sBAAsB,GAAI,GAAG,2BAA2B,gDAyHpE,CAAA;AACD,eAAO,MAAM,qBAAqB,GAAI,GAAG,2BAA2B,gDA4LnE,CAAA;AACD,eAAO,MAAM,qBAAqB,gQAajC,CAAA"}
@@ -1,7 +1,16 @@
1
- import type { CommonChoiceFieldStyleProps, CommonFieldStyleProps, PseudoState } from './types';
1
+ import type { CommonChoiceFieldStyleProps, PseudoState } from './types';
2
2
  export declare function getChoiceFieldBackgroundColorFactoryForState(pseudoState: PseudoState): (props: CommonChoiceFieldStyleProps) => string;
3
3
  export declare function getChoiceFieldBorderColorFactoryForState(pseudoState: PseudoState): (props: CommonChoiceFieldStyleProps) => string;
4
- export declare function getFieldBackgroundColorFactory(): (props: CommonFieldStyleProps) => string;
5
- export declare function getFieldBorderColorFactoryForState(pseudoState: PseudoState): (props: CommonFieldStyleProps) => string;
6
- export declare function getFieldPlaceholderColorFactoryForState(pseudoState: PseudoState): (props: CommonFieldStyleProps) => string;
4
+ export declare function getFieldBackgroundColorFactory(): (props: {
5
+ [key: string]: any;
6
+ theme: any;
7
+ }) => any;
8
+ export declare function getFieldBorderColorFactoryForState(pseudoState: PseudoState): (props: {
9
+ [key: string]: any;
10
+ theme: any;
11
+ }) => any;
12
+ export declare function getFieldPlaceholderColorFactoryForState(pseudoState: PseudoState): (props: {
13
+ [key: string]: any;
14
+ theme: any;
15
+ }) => any;
7
16
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE9F,wBAAgB,4CAA4C,CAAC,WAAW,EAAE,WAAW,IAC3E,OAAO,2BAA2B,YAsC3C;AAED,wBAAgB,wCAAwC,CAAC,WAAW,EAAE,WAAW,IACvE,OAAO,2BAA2B,YAoC3C;AAED,wBAAgB,8BAA8B,KACpC,OAAO,qBAAqB,YAqBrC;AAED,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,WAAW,IACjE,OAAO,qBAAqB,YAiCrC;AAED,wBAAgB,uCAAuC,CAAC,WAAW,EAAE,WAAW,IACtE,OAAO,qBAAqB,YAoBrC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEvE,wBAAgB,4CAA4C,CAAC,WAAW,EAAE,WAAW,IAC3E,OAAO,2BAA2B,YAsC3C;AAED,wBAAgB,wCAAwC,CAAC,WAAW,EAAE,WAAW,IACvE,OAAO,2BAA2B,YAoC3C;AAED,wBAAgB,8BAA8B,KACpC,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,SAqBlD;AAED,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,WAAW,IACjE,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,SAiClD;AAED,wBAAgB,uCAAuC,CAAC,WAAW,EAAE,WAAW,IACtE,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,SAoBlD"}
package/index.js CHANGED
@@ -53937,7 +53937,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
53937
53937
  return /*#__PURE__*/ jsx(Fragment, {
53938
53938
  children: badgeNumber === undefined ? /*#__PURE__*/ jsx(SecondaryButton$1, {
53939
53939
  ...buttonProps
53940
- }) : /*#__PURE__*/ jsxs(Wrapper$2, {
53940
+ }) : /*#__PURE__*/ jsxs(Wrapper$3, {
53941
53941
  className: className,
53942
53942
  style: style,
53943
53943
  children: [
@@ -53957,7 +53957,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
53957
53957
  return /*#__PURE__*/ jsx(Fragment, {
53958
53958
  children: badgeNumber === undefined ? /*#__PURE__*/ jsx(TertiaryButton$1, {
53959
53959
  ...buttonProps
53960
- }) : /*#__PURE__*/ jsxs(Wrapper$2, {
53960
+ }) : /*#__PURE__*/ jsxs(Wrapper$3, {
53961
53961
  className: className,
53962
53962
  style: style,
53963
53963
  children: [
@@ -53977,7 +53977,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
53977
53977
  return /*#__PURE__*/ jsx(Fragment, {
53978
53978
  children: badgeNumber === undefined ? /*#__PURE__*/ jsx(PrimaryButton$1, {
53979
53979
  ...buttonProps
53980
- }) : /*#__PURE__*/ jsxs(Wrapper$2, {
53980
+ }) : /*#__PURE__*/ jsxs(Wrapper$3, {
53981
53981
  className: className,
53982
53982
  style: style,
53983
53983
  children: [
@@ -53995,7 +53995,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
53995
53995
  });
53996
53996
  }
53997
53997
  }
53998
- const Wrapper$2 = styled.div`
53998
+ const Wrapper$3 = styled.div`
53999
53999
  position: relative;
54000
54000
  `;
54001
54001
  const LEFT_MARGIN = {
@@ -54084,12 +54084,12 @@ const MenuButton = styled(IconButton)`
54084
54084
  `;
54085
54085
 
54086
54086
  function Menu({ children }) {
54087
- return /*#__PURE__*/ jsx(Wrapper$1, {
54087
+ return /*#__PURE__*/ jsx(Wrapper$2, {
54088
54088
  role: "menu",
54089
54089
  children: children
54090
54090
  });
54091
54091
  }
54092
- const Wrapper$1 = styled.div`
54092
+ const Wrapper$2 = styled.div`
54093
54093
  background-color: ${(p)=>p.theme.color.charcoal};
54094
54094
  box-sizing: border-box;
54095
54095
  display: flex;
@@ -54521,7 +54521,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
54521
54521
  onAutoClose,
54522
54522
  withAutomaticClosing
54523
54523
  ]);
54524
- return /*#__PURE__*/ jsx(Wrapper, {
54524
+ return /*#__PURE__*/ jsx(Wrapper$1, {
54525
54525
  $isCollapsed: isCollapsed,
54526
54526
  $isCollapsible: isCollapsible,
54527
54527
  $isFixed: isFixed,
@@ -54565,7 +54565,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
54565
54565
  })
54566
54566
  });
54567
54567
  }
54568
- const Wrapper = styled.div`
54568
+ const Wrapper$1 = styled.div`
54569
54569
  align-items: center;
54570
54570
  background-color: ${(p)=>getBannerPalette(p.$level).backgroundColor};
54571
54571
  border-bottom: ${(p)=>p.$isCollapsible ? `4px solid ${getBannerPalette(p.$level).borderColor}` : 'none'};
@@ -55465,16 +55465,7 @@ const StyledRsuiteCheckbox = styled(Checkbox$1)`
55465
55465
  return optionValues.map((optionValue)=>getRsuiteDataItemValueFromOptionValue(optionValue, optionValueKey));
55466
55466
  }
55467
55467
 
55468
- const StyledRsuitePickerBox = styled.div`
55469
- font-size: 13px !important;
55470
- position: relative;
55471
- user-select: none;
55472
- width: 100%;
55473
-
55474
- * {
55475
- ${(p)=>p.$isReadOnly && `cursor: default !important;`}
55476
- }
55477
-
55468
+ const getCheckPickerInputCss = (p)=>css`
55478
55469
  > .rs-picker-toggle-wrapper,
55479
55470
  > .rs-auto-complete {
55480
55471
  background-color: transparent;
@@ -55494,9 +55485,9 @@ const StyledRsuitePickerBox = styled.div`
55494
55485
  /* Remove focus ring (Select) */
55495
55486
  box-shadow: none;
55496
55487
  font-size: 13px;
55497
- height: 30px;
55488
+ min-height: 30px;
55498
55489
  line-height: 1.3846;
55499
- padding: 3.5px 40px 0 8px !important;
55490
+ padding: 3.5px 40px 3.5px 8px !important;
55500
55491
 
55501
55492
  &:hover,
55502
55493
  &._hover {
@@ -55548,7 +55539,7 @@ const StyledRsuitePickerBox = styled.div`
55548
55539
 
55549
55540
  /* Selected value(s) */
55550
55541
  > .rs-picker-toggle-value {
55551
- color: ${(p)=>p.theme.color.gunMetal};
55542
+ color: ${p.theme.color.gunMetal};
55552
55543
  font-weight: 500;
55553
55544
 
55554
55545
  > .rs-picker-value-list {
@@ -55560,7 +55551,7 @@ const StyledRsuitePickerBox = styled.div`
55560
55551
  /* Counter badge, if any */
55561
55552
  > .rs-picker-value-count {
55562
55553
  align-items: center;
55563
- background-color: ${(p)=>p.theme.color.charcoal};
55554
+ background-color: ${p.theme.color.charcoal};
55564
55555
  border-radius: 50%;
55565
55556
  display: flex;
55566
55557
  font-family: 'Open Sans', sans-serif !important;
@@ -55595,13 +55586,14 @@ const StyledRsuitePickerBox = styled.div`
55595
55586
  }
55596
55587
  }
55597
55588
  }
55598
-
55589
+ `;
55590
+ const getCheckPickerMenuCss = (p)=>css`
55599
55591
  > .rs-picker-popup {
55600
- border: solid 1px ${(p)=>p.theme.color.gainsboro};
55592
+ border: solid 1px ${p.theme.color.gainsboro};
55601
55593
  border-radius: 0;
55602
55594
  padding: 0;
55603
55595
 
55604
- ${(p)=>p.$popupWidth ? `
55596
+ ${p.$popupWidth ? `
55605
55597
  max-width: ${p.$popupWidth}px;
55606
55598
  min-width: ${p.$popupWidth}px !important;
55607
55599
  width: ${p.$popupWidth}px;
@@ -55613,13 +55605,13 @@ const StyledRsuitePickerBox = styled.div`
55613
55605
  padding: 8px;
55614
55606
 
55615
55607
  > .rs-input-group {
55616
- background-color: ${(p)=>p.theme.color.white};
55617
- border: solid 1px ${(p)=>p.theme.color.lightGray};
55608
+ background-color: ${p.theme.color.white};
55609
+ border: solid 1px ${p.theme.color.lightGray};
55618
55610
  border-radius: 0;
55619
55611
 
55620
55612
  > [role='searchbox'] {
55621
- color: ${(p)=>p.theme.color.gunMetal};
55622
- caret-color: ${(p)=>p.theme.color.gunMetal};
55613
+ color: ${p.theme.color.gunMetal};
55614
+ caret-color: ${p.theme.color.gunMetal};
55623
55615
  font-size: 13px;
55624
55616
  line-height: 1;
55625
55617
  padding: 1px 8px 5px 8px;
@@ -55634,7 +55626,7 @@ const StyledRsuitePickerBox = styled.div`
55634
55626
  padding: 4px 8px 4px 4px;
55635
55627
 
55636
55628
  > svg {
55637
- color: ${(p)=>p.theme.color.lightGray};
55629
+ color: ${p.theme.color.lightGray};
55638
55630
  }
55639
55631
  }
55640
55632
  }
@@ -55649,7 +55641,7 @@ const StyledRsuitePickerBox = styled.div`
55649
55641
  [role='option'],
55650
55642
  [role='treeitem'] {
55651
55643
  > .rs-picker-select-menu-item {
55652
- color: ${(p)=>p.theme.color.gunMetal};
55644
+ color: ${p.theme.color.gunMetal};
55653
55645
  line-height: 1;
55654
55646
  overflow: hidden;
55655
55647
  padding: 8px 8px 11px 8px;
@@ -55657,8 +55649,8 @@ const StyledRsuitePickerBox = styled.div`
55657
55649
  white-space: nowrap;
55658
55650
 
55659
55651
  &:hover {
55660
- background-color: ${(p)=>p.theme.color.blueYonder25};
55661
- color: ${(p)=>p.theme.color.blueYonder};
55652
+ background-color: ${p.theme.color.blueYonder25};
55653
+ color: ${p.theme.color.blueYonder};
55662
55654
  }
55663
55655
 
55664
55656
  &.rs-picker-select-menu-item-active {
@@ -55666,13 +55658,13 @@ const StyledRsuitePickerBox = styled.div`
55666
55658
  font-weight: 500;
55667
55659
 
55668
55660
  &:hover {
55669
- background-color: ${(p)=>p.theme.color.blueYonder25};
55661
+ background-color: ${p.theme.color.blueYonder25};
55670
55662
  }
55671
55663
  }
55672
55664
 
55673
55665
  &.rs-picker-select-menu-item-disabled {
55674
55666
  background-color: transparent;
55675
- color: ${(p)=>p.theme.color.lightGray};
55667
+ color: ${p.theme.color.lightGray};
55676
55668
  }
55677
55669
  }
55678
55670
 
@@ -55681,7 +55673,7 @@ const StyledRsuitePickerBox = styled.div`
55681
55673
  min-height: auto;
55682
55674
 
55683
55675
  > label {
55684
- color: ${(p)=>p.theme.color.gunMetal};
55676
+ color: ${p.theme.color.gunMetal};
55685
55677
  font-size: 13px !important;
55686
55678
  line-height: 1;
55687
55679
  overflow: hidden;
@@ -55696,8 +55688,8 @@ const StyledRsuitePickerBox = styled.div`
55696
55688
 
55697
55689
  > .rs-checkbox-inner {
55698
55690
  &:before {
55699
- background-color: ${(p)=>p.theme.color.gainsboro};
55700
- border: solid 2px ${(p)=>p.theme.color.lightGray};
55691
+ background-color: ${p.theme.color.gainsboro};
55692
+ border: solid 2px ${p.theme.color.lightGray};
55701
55693
  border-radius: 0;
55702
55694
  }
55703
55695
  }
@@ -55706,17 +55698,17 @@ const StyledRsuitePickerBox = styled.div`
55706
55698
  }
55707
55699
 
55708
55700
  &:hover {
55709
- background-color: ${(p)=>p.theme.color.blueYonder25};
55701
+ background-color: ${p.theme.color.blueYonder25};
55710
55702
 
55711
55703
  > .rs-checkbox-checker {
55712
55704
  > label {
55713
- color: ${(p)=>p.theme.color.blueYonder};
55705
+ color: ${p.theme.color.blueYonder};
55714
55706
 
55715
55707
  > .rs-checkbox-wrapper {
55716
55708
  > .rs-checkbox-inner {
55717
55709
  &:before {
55718
- background-color: ${(p)=>p.theme.color.blueYonder25};
55719
- border: solid 2px ${(p)=>p.theme.color.blueYonder};
55710
+ background-color: ${p.theme.color.blueYonder25};
55711
+ border: solid 2px ${p.theme.color.blueYonder};
55720
55712
  }
55721
55713
  }
55722
55714
  }
@@ -55725,7 +55717,7 @@ const StyledRsuitePickerBox = styled.div`
55725
55717
  }
55726
55718
 
55727
55719
  &.rs-check-item-focus {
55728
- background-color: ${(p)=>p.theme.color.blueYonder25};
55720
+ background-color: ${p.theme.color.blueYonder25};
55729
55721
 
55730
55722
  > .rs-checkbox-checker {
55731
55723
  > label {
@@ -55738,19 +55730,19 @@ const StyledRsuitePickerBox = styled.div`
55738
55730
  background-color: transparent;
55739
55731
 
55740
55732
  &.rs-check-item-focus {
55741
- background-color: ${(p)=>p.theme.color.blueYonder25};
55733
+ background-color: ${p.theme.color.blueYonder25};
55742
55734
  }
55743
55735
 
55744
55736
  > .rs-checkbox-checker {
55745
55737
  > label {
55746
- color: ${(p)=>p.theme.color.gunMetal};
55738
+ color: ${p.theme.color.gunMetal};
55747
55739
  font-weight: 500;
55748
55740
 
55749
55741
  > .rs-checkbox-wrapper {
55750
55742
  > .rs-checkbox-inner {
55751
55743
  &:before {
55752
- background-color: ${(p)=>p.theme.color.charcoal};
55753
- border: solid 2px ${(p)=>p.theme.color.charcoal};
55744
+ background-color: ${p.theme.color.charcoal};
55745
+ border: solid 2px ${p.theme.color.charcoal};
55754
55746
  }
55755
55747
  }
55756
55748
  }
@@ -55759,17 +55751,17 @@ const StyledRsuitePickerBox = styled.div`
55759
55751
 
55760
55752
  &:hover,
55761
55753
  &._hover {
55762
- background-color: ${(p)=>p.theme.color.blueYonder25};
55754
+ background-color: ${p.theme.color.blueYonder25};
55763
55755
 
55764
55756
  > .rs-checkbox-checker {
55765
55757
  > label {
55766
- color: ${(p)=>p.theme.color.blueYonder};
55758
+ color: ${p.theme.color.blueYonder};
55767
55759
 
55768
55760
  > .rs-checkbox-wrapper {
55769
55761
  > .rs-checkbox-inner {
55770
55762
  &:before {
55771
- background-color: ${(p)=>p.theme.color.blueYonder};
55772
- border: solid 2px ${(p)=>p.theme.color.blueYonder};
55763
+ background-color: ${p.theme.color.blueYonder};
55764
+ border: solid 2px ${p.theme.color.blueYonder};
55773
55765
  }
55774
55766
  }
55775
55767
  }
@@ -55780,11 +55772,209 @@ const StyledRsuitePickerBox = styled.div`
55780
55772
  }
55781
55773
  }
55782
55774
  }
55783
- /** CheckTreePicker **/
55775
+ }
55776
+ `;
55777
+ const StyledRsuitePickerBox = styled.div`
55778
+ font-size: 13px !important;
55779
+ position: relative;
55780
+ user-select: none;
55781
+ width: 100%;
55782
+
55783
+ * {
55784
+ ${(p)=>p.$isReadOnly && `cursor: default !important;`}
55785
+ }
55786
+
55787
+ ${(p)=>getCheckPickerInputCss(p)}
55788
+
55789
+ ${(p)=>getCheckPickerMenuCss(p)}
55790
+ `;
55791
+
55792
+ function CheckPickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }) {
55793
+ return /*#__PURE__*/ jsxs(Field$2, {
55794
+ className: className,
55795
+ style: style,
55796
+ children: [
55797
+ /*#__PURE__*/ jsx(Label, {
55798
+ $isDisabled: disabled,
55799
+ $isHidden: isLabelHidden,
55800
+ $isRequired: isRequired,
55801
+ htmlFor: name,
55802
+ children: label
55803
+ }),
55804
+ /*#__PURE__*/ jsx(StyledRsuitePickerBox, {
55805
+ ref: boxRef,
55806
+ $hasError: hasError,
55807
+ $isDisabled: disabled,
55808
+ $isLight: isLight,
55809
+ $isReadOnly: readOnly,
55810
+ $isTransparent: isTransparent,
55811
+ $popupWidth: popupWidth,
55812
+ children: children
55813
+ }),
55814
+ !isErrorMessageHidden && hasError && /*#__PURE__*/ jsx(FieldError, {
55815
+ children: error
55816
+ })
55817
+ ]
55818
+ });
55819
+ }
55820
+
55821
+ function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, popupWidth, readOnly = false, searchable = false, style, value, ...originalProps }) {
55822
+ // eslint-disable-next-line no-null/no-null
55823
+ const boxRef = useRef(null);
55824
+ /** Instance of `CustomSearch` */ const customSearchRef = useRef(customSearch);
55825
+ const controlledClassName = useMemo(()=>classnames('Field-CheckPicker', className), [
55826
+ className
55827
+ ]);
55828
+ const controlledError = useMemo(()=>normalizeString(error), [
55829
+ error
55830
+ ]);
55831
+ const hasError = Boolean(controlledError);
55832
+ const selectedRsuiteValue = useMemo(()=>getRsuiteDataItemValuesFromOptionValues(value, optionValueKey), [
55833
+ optionValueKey,
55834
+ value
55835
+ ]);
55836
+ const rsuiteData = useMemo(()=>getRsuiteDataItemsFromOptions(options, optionValueKey), [
55837
+ options,
55838
+ optionValueKey
55839
+ ]);
55840
+ const { forceUpdate } = useForceUpdate();
55841
+ // Only used when `customSearch` prop is set
55842
+ const [controlledRsuiteData, setControlledRsuiteData] = useState(customSearch ? rsuiteData : undefined);
55843
+ const handleChange = useCallback((nextOptionRsuiteValues)=>{
55844
+ if (!onChange) {
55845
+ return;
55846
+ }
55847
+ const nextValue = nextOptionRsuiteValues ? getSelectedOptionValuesFromSelectedRsuiteDataItemValues(rsuiteData, nextOptionRsuiteValues) : [];
55848
+ const normalizedNextValue = nextValue.length > 0 ? nextValue : undefined;
55849
+ setControlledRsuiteData(rsuiteData);
55850
+ onChange(normalizedNextValue);
55851
+ }, [
55852
+ onChange,
55853
+ rsuiteData
55854
+ ]);
55855
+ const handleSearch = useCallback((nextQuery)=>{
55856
+ if (!customSearchRef.current || nextQuery.trim().length < customSearchMinQueryLength) {
55857
+ setControlledRsuiteData(rsuiteData);
55858
+ return;
55859
+ }
55860
+ const nextControlledRsuiteData = nextQuery.trim().length >= customSearchMinQueryLength ? getRsuiteDataItemsFromOptions(customSearchRef.current.find(nextQuery), optionValueKey) : rsuiteData;
55861
+ setControlledRsuiteData(nextControlledRsuiteData);
55862
+ }, [
55863
+ customSearchMinQueryLength,
55864
+ optionValueKey,
55865
+ rsuiteData
55866
+ ]);
55867
+ const renderMenuItem = useCallback((node)=>/*#__PURE__*/ jsx("span", {
55868
+ title: String(node),
55869
+ children: String(node)
55870
+ }), []);
55871
+ useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
55872
+ useEffect(()=>{
55873
+ forceUpdate();
55874
+ }, [
55875
+ forceUpdate
55876
+ ]);
55877
+ return /*#__PURE__*/ jsx(CheckPickerBox, {
55878
+ boxRef: boxRef,
55879
+ className: controlledClassName,
55880
+ disabled: disabled,
55881
+ error: controlledError,
55882
+ hasError: hasError,
55883
+ isErrorMessageHidden: isErrorMessageHidden,
55884
+ isLabelHidden: isLabelHidden,
55885
+ isLight: isLight,
55886
+ isRequired: isRequired,
55887
+ isTransparent: isTransparent,
55888
+ label: label,
55889
+ name: originalProps.name,
55890
+ popupWidth: popupWidth,
55891
+ readOnly: readOnly,
55892
+ style: style,
55893
+ children: boxRef.current && /*#__PURE__*/ jsx(CheckPicker$1, {
55894
+ container: boxRef.current,
55895
+ // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
55896
+ // when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
55897
+ data: controlledRsuiteData ?? rsuiteData,
55898
+ disabled: disabled,
55899
+ id: originalProps.name,
55900
+ onChange: handleChange,
55901
+ onSearch: handleSearch,
55902
+ readOnly: readOnly,
55903
+ renderMenuItem: renderMenuItem,
55904
+ searchable: !!customSearch || searchable,
55905
+ // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
55906
+ // that's why we send this "always true" filter to disable Rsuite CheckPicker internal search filtering
55907
+ searchBy: customSearch ? ()=>true : undefined,
55908
+ size: originalProps.size ?? 'sm',
55909
+ value: selectedRsuiteValue,
55910
+ ...originalProps
55911
+ })
55912
+ });
55913
+ }
55914
+
55915
+ const RsuiteCheckTreePickerBox = styled.div`
55916
+ font-size: 13px !important;
55917
+ position: relative;
55918
+ user-select: none;
55919
+ width: 100%;
55920
+
55921
+ * {
55922
+ ${(p)=>p.$isReadOnly && `cursor: default !important;`}
55923
+ }
55924
+
55925
+ ${(p)=>getCheckPickerInputCss(p)}
55926
+
55927
+ > .rs-picker-popup {
55928
+ border: solid 1px ${(p)=>p.theme.color.gainsboro};
55929
+ border-radius: 0;
55930
+ padding: 0;
55931
+
55932
+ ${(p)=>p.$popupWidth ? `
55933
+ max-width: ${p.$popupWidth}px;
55934
+ min-width: ${p.$popupWidth}px !important;
55935
+ width: ${p.$popupWidth}px;
55936
+ ` : `
55937
+ width: 100%;
55938
+ `};
55939
+
55940
+ > .rs-search-box {
55941
+ padding: 8px;
55942
+
55943
+ > .rs-input-group {
55944
+ background-color: ${(p)=>p.theme.color.white};
55945
+ border: solid 1px ${(p)=>p.theme.color.lightGray};
55946
+ border-radius: 0;
55947
+
55948
+ > [role='searchbox'] {
55949
+ color: ${(p)=>p.theme.color.gunMetal};
55950
+ caret-color: ${(p)=>p.theme.color.gunMetal};
55951
+ font-size: 13px;
55952
+ line-height: 1;
55953
+ padding: 1px 8px 5px 8px;
55954
+
55955
+ &::placeholder {
55956
+ color: transparent;
55957
+ }
55958
+ }
55959
+
55960
+ > .rs-input-group-addon {
55961
+ line-height: 1;
55962
+ padding: 4px 8px 4px 4px;
55963
+
55964
+ > svg {
55965
+ color: ${(p)=>p.theme.color.lightGray};
55966
+ }
55967
+ }
55968
+ }
55969
+ }
55784
55970
  > .rs-check-tree {
55785
55971
  padding: 0;
55786
55972
  margin: 0;
55787
55973
 
55974
+ .rs-check-tree-node {
55975
+ padding: 0 !important;
55976
+ }
55977
+
55788
55978
  .rs-check-tree-node-custom-icon {
55789
55979
  margin-top: -2px;
55790
55980
  }
@@ -55792,6 +55982,7 @@ const StyledRsuitePickerBox = styled.div`
55792
55982
  [role='treeitem'] {
55793
55983
  display: flex;
55794
55984
  align-items: center;
55985
+
55795
55986
  .rs-check-item {
55796
55987
  width: 100%;
55797
55988
  color: ${(p)=>p.theme.color.gunMetal};
@@ -55800,7 +55991,7 @@ const StyledRsuitePickerBox = styled.div`
55800
55991
  text-overflow: ellipsis;
55801
55992
  white-space: nowrap;
55802
55993
  .rs-check-item-focus {
55803
- background-color: none;
55994
+ background-color: transparent;
55804
55995
  }
55805
55996
 
55806
55997
  &.rs-picker-select-menu-item-active {
@@ -55834,6 +56025,9 @@ const StyledRsuitePickerBox = styled.div`
55834
56025
  background-color: ${(p)=>p.theme.color.charcoal} !important;
55835
56026
  border: solid 2px ${(p)=>p.theme.color.charcoal} !important;
55836
56027
  }
56028
+ &:after {
56029
+ margin-left: 11px !important;
56030
+ }
55837
56031
  }
55838
56032
  }
55839
56033
  &.rs-checkbox-disabled {
@@ -55858,21 +56052,21 @@ const StyledRsuitePickerBox = styled.div`
55858
56052
  > label {
55859
56053
  color: ${(p)=>p.theme.color.gunMetal};
55860
56054
  font-size: 13px !important;
55861
- line-height: 1;
55862
56055
  overflow: hidden;
55863
56056
  text-overflow: ellipsis;
55864
56057
  white-space: nowrap;
55865
56058
  padding: 1px 0;
55866
56059
 
55867
56060
  > .rs-check-tree-node-label-content {
55868
- margin-left: 38px;
55869
56061
  background-color: initial;
55870
56062
  color: initial;
56063
+ padding: 3px 8px 6px 44px;
56064
+ width: 100%;
55871
56065
  }
55872
56066
 
55873
56067
  > .rs-checkbox-wrapper {
55874
56068
  height: auto;
55875
- left: 8px;
56069
+ left: 0px;
55876
56070
  top: 7px !important;
55877
56071
  margin-left: 14px;
55878
56072
 
@@ -55881,7 +56075,10 @@ const StyledRsuitePickerBox = styled.div`
55881
56075
  background-color: ${(p)=>p.theme.color.gainsboro};
55882
56076
  border: solid 2px ${(p)=>p.theme.color.lightGray};
55883
56077
  border-radius: 0;
55884
- margin-right: 8px;
56078
+ margin-left: 8px;
56079
+ }
56080
+ &:after {
56081
+ margin-left: 13px;
55885
56082
  }
55886
56083
  }
55887
56084
  }
@@ -55959,12 +56156,36 @@ const StyledRsuitePickerBox = styled.div`
55959
56156
  }
55960
56157
  }
55961
56158
  }
56159
+
56160
+ /* childrens */
56161
+ &[aria-level='2'] {
56162
+ > .rs-check-item {
56163
+ > .rs-checkbox-checker {
56164
+ > label {
56165
+ > .rs-check-tree-node-label-content {
56166
+ padding-left: 60px;
56167
+ }
56168
+
56169
+ > .rs-checkbox-wrapper {
56170
+ > .rs-checkbox-inner {
56171
+ &:before {
56172
+ margin-left: 24px;
56173
+ }
56174
+ &:after {
56175
+ margin-left: 29px;
56176
+ }
56177
+ }
56178
+ }
56179
+ }
56180
+ }
56181
+ }
56182
+ }
55962
56183
  }
55963
56184
  }
55964
56185
  }
55965
56186
  `;
55966
56187
 
55967
- function CheckPickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }) {
56188
+ function CheckTreePickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }) {
55968
56189
  return /*#__PURE__*/ jsxs(Field$2, {
55969
56190
  className: className,
55970
56191
  style: style,
@@ -55976,7 +56197,7 @@ function CheckPickerBox({ boxRef, children, className, disabled, error, hasError
55976
56197
  htmlFor: name,
55977
56198
  children: label
55978
56199
  }),
55979
- /*#__PURE__*/ jsx(StyledRsuitePickerBox, {
56200
+ /*#__PURE__*/ jsx(RsuiteCheckTreePickerBox, {
55980
56201
  ref: boxRef,
55981
56202
  $hasError: hasError,
55982
56203
  $isDisabled: disabled,
@@ -55993,105 +56214,11 @@ function CheckPickerBox({ boxRef, children, className, disabled, error, hasError
55993
56214
  });
55994
56215
  }
55995
56216
 
55996
- function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, popupWidth, readOnly = false, searchable = false, style, value, ...originalProps }) {
55997
- // eslint-disable-next-line no-null/no-null
55998
- const boxRef = useRef(null);
55999
- /** Instance of `CustomSearch` */ const customSearchRef = useRef(customSearch);
56000
- const controlledClassName = useMemo(()=>classnames('Field-CheckPicker', className), [
56001
- className
56002
- ]);
56003
- const controlledError = useMemo(()=>normalizeString(error), [
56004
- error
56005
- ]);
56006
- const hasError = Boolean(controlledError);
56007
- const selectedRsuiteValue = useMemo(()=>getRsuiteDataItemValuesFromOptionValues(value, optionValueKey), [
56008
- optionValueKey,
56009
- value
56010
- ]);
56011
- const rsuiteData = useMemo(()=>getRsuiteDataItemsFromOptions(options, optionValueKey), [
56012
- options,
56013
- optionValueKey
56014
- ]);
56015
- const { forceUpdate } = useForceUpdate();
56016
- // Only used when `customSearch` prop is set
56017
- const [controlledRsuiteData, setControlledRsuiteData] = useState(customSearch ? rsuiteData : undefined);
56018
- const handleChange = useCallback((nextOptionRsuiteValues)=>{
56019
- if (!onChange) {
56020
- return;
56021
- }
56022
- const nextValue = nextOptionRsuiteValues ? getSelectedOptionValuesFromSelectedRsuiteDataItemValues(rsuiteData, nextOptionRsuiteValues) : [];
56023
- const normalizedNextValue = nextValue.length > 0 ? nextValue : undefined;
56024
- setControlledRsuiteData(rsuiteData);
56025
- onChange(normalizedNextValue);
56026
- }, [
56027
- onChange,
56028
- rsuiteData
56029
- ]);
56030
- const handleSearch = useCallback((nextQuery)=>{
56031
- if (!customSearchRef.current || nextQuery.trim().length < customSearchMinQueryLength) {
56032
- setControlledRsuiteData(rsuiteData);
56033
- return;
56034
- }
56035
- const nextControlledRsuiteData = nextQuery.trim().length >= customSearchMinQueryLength ? getRsuiteDataItemsFromOptions(customSearchRef.current.find(nextQuery), optionValueKey) : rsuiteData;
56036
- setControlledRsuiteData(nextControlledRsuiteData);
56037
- }, [
56038
- customSearchMinQueryLength,
56039
- optionValueKey,
56040
- rsuiteData
56041
- ]);
56042
- const renderMenuItem = useCallback((node)=>/*#__PURE__*/ jsx("span", {
56043
- title: String(node),
56044
- children: String(node)
56045
- }), []);
56046
- useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
56047
- useEffect(()=>{
56048
- forceUpdate();
56049
- }, [
56050
- forceUpdate
56051
- ]);
56052
- return /*#__PURE__*/ jsx(CheckPickerBox, {
56053
- boxRef: boxRef,
56054
- className: controlledClassName,
56055
- disabled: disabled,
56056
- error: controlledError,
56057
- hasError: hasError,
56058
- isErrorMessageHidden: isErrorMessageHidden,
56059
- isLabelHidden: isLabelHidden,
56060
- isLight: isLight,
56061
- isRequired: isRequired,
56062
- isTransparent: isTransparent,
56063
- label: label,
56064
- name: originalProps.name,
56065
- popupWidth: popupWidth,
56066
- readOnly: readOnly,
56067
- style: style,
56068
- children: boxRef.current && /*#__PURE__*/ jsx(CheckPicker$1, {
56069
- container: boxRef.current,
56070
- // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
56071
- // when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
56072
- data: controlledRsuiteData ?? rsuiteData,
56073
- disabled: disabled,
56074
- id: originalProps.name,
56075
- onChange: handleChange,
56076
- onSearch: handleSearch,
56077
- readOnly: readOnly,
56078
- renderMenuItem: renderMenuItem,
56079
- searchable: !!customSearch || searchable,
56080
- // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
56081
- // that's why we send this "always true" filter to disable Rsuite CheckPicker internal search filtering
56082
- searchBy: customSearch ? ()=>true : undefined,
56083
- size: originalProps.size ?? 'sm',
56084
- value: selectedRsuiteValue,
56085
- ...originalProps
56086
- })
56087
- });
56088
- }
56089
-
56090
- function fromRsuiteValue(selectedValues, allOptions, childrenKey = 'children') {
56091
- const formattedTree = getTreeOptionsBySelectedValues(selectedValues, allOptions, childrenKey);
56217
+ function fromRsuiteValue(selectedValues, allOptions, childrenKey = 'children', valueKey = 'value', labelKey = 'label') {
56218
+ const formattedTree = getTreeOptionsBySelectedValues(selectedValues, allOptions, childrenKey, valueKey, labelKey);
56092
56219
  return formattedTree.length > 0 ? formattedTree : undefined;
56093
56220
  }
56094
- function getTreeOptionsBySelectedValues(selectedValues, options, childrenKey = 'children') {
56221
+ function getTreeOptionsBySelectedValues(selectedValues, options, childrenKey = 'children', valueKey = 'value', labelKey = 'label') {
56095
56222
  function getOption(option) {
56096
56223
  const children = option[childrenKey];
56097
56224
  if (children && Array.isArray(children)) {
@@ -56099,55 +56226,81 @@ function getTreeOptionsBySelectedValues(selectedValues, options, childrenKey = '
56099
56226
  if (filteredChildren.length > 0) {
56100
56227
  return {
56101
56228
  [childrenKey]: filteredChildren.map((child)=>({
56102
- label: child.label,
56103
- value: child.value
56229
+ [labelKey]: child[labelKey],
56230
+ [valueKey]: child[valueKey]
56104
56231
  })),
56105
- label: option.label,
56106
- value: option.value
56232
+ [labelKey]: option[labelKey],
56233
+ [valueKey]: option[valueKey]
56107
56234
  };
56108
56235
  }
56109
56236
  }
56110
- if (selectedValues?.includes(option.value)) {
56237
+ if (selectedValues?.includes(option[valueKey])) {
56111
56238
  return {
56112
56239
  [childrenKey]: (option[childrenKey] ?? []).map((child)=>({
56113
- label: child.label,
56114
- value: child.value
56240
+ [labelKey]: child[labelKey],
56241
+ [valueKey]: child[valueKey]
56115
56242
  })),
56116
- label: option.label,
56117
- value: option.value
56243
+ [labelKey]: option[labelKey],
56244
+ [valueKey]: option[valueKey]
56118
56245
  };
56119
56246
  }
56120
56247
  return undefined;
56121
56248
  }
56122
- // Appliquer la fonction filterOption à chaque option de départ
56123
56249
  return options.map(getOption).filter((option)=>option !== undefined);
56124
56250
  }
56125
- function toRsuiteValue(uiValues, childrenKey = 'children') {
56251
+ function toRsuiteValue(uiValues, childrenKey = 'children', valueKey = 'value') {
56126
56252
  if (!uiValues) {
56127
56253
  return undefined;
56128
56254
  }
56129
56255
  // set only childless and children values
56130
- const rsuiteValues = uiValues.filter((uiValue)=>uiValue[childrenKey] === undefined).flatMap(({ value })=>value);
56131
- const rsuiteChildrenValues = uiValues.flatMap((uiValue)=>(uiValue[childrenKey] ?? []).flatMap(({ value })=>value));
56256
+ const rsuiteValues = uiValues.filter((uiValue)=>uiValue[childrenKey] === undefined || uiValue[childrenKey].length === 0).flatMap((option)=>option[valueKey]);
56257
+ const rsuiteChildrenValues = uiValues.flatMap((uiValue)=>(uiValue[childrenKey] ?? []).flatMap((child)=>child[valueKey]));
56132
56258
  return [
56133
56259
  ...rsuiteValues,
56134
56260
  ...rsuiteChildrenValues
56135
56261
  ];
56136
56262
  }
56137
- function computeDisabledValues(isMultiSelect, value, options, childrenKey = 'children') {
56263
+ function computeDisabledValues(isMultiSelect, value, options, childrenKey = 'children', valueKey = 'value', labelKey = 'label') {
56138
56264
  if (isMultiSelect) {
56139
56265
  return [];
56140
56266
  }
56141
- const selectedOptions = getTreeOptionsBySelectedValues(value, options, childrenKey);
56142
- const valuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption.value !== option.value)).map((option)=>option.value);
56143
- const subValuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption.value !== option.value)).flatMap((option)=>option[childrenKey]).filter(Boolean).flatMap((option)=>option.value);
56267
+ const selectedOptions = getTreeOptionsBySelectedValues(value, options, childrenKey, valueKey, labelKey);
56268
+ const valuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption[valueKey] !== option[valueKey])).map((option)=>option[valueKey]);
56269
+ const subValuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption[valueKey] !== option[valueKey])).flatMap((option)=>option[childrenKey]).filter(Boolean).flatMap((option)=>option[valueKey]);
56144
56270
  return [
56145
56271
  ...valuesToDisabled,
56146
56272
  ...subValuesToDisabled
56147
56273
  ];
56148
56274
  }
56275
+ function getOptionsToDisplay(allOptions, selectedOptions, childrenKey = 'children', valueKey = 'value') {
56276
+ const selectedMap = new Map(selectedOptions.map((opt)=>[
56277
+ opt[valueKey],
56278
+ opt
56279
+ ]));
56280
+ const result = [];
56281
+ function findChildren(option) {
56282
+ const children = option[childrenKey];
56283
+ const value = option[valueKey];
56284
+ if (children && children.length > 0) {
56285
+ const hasAllChildrenSelected = children.every((child)=>selectedMap.has(child[valueKey]));
56286
+ if (hasAllChildrenSelected) {
56287
+ result.push(option) // on garde le parent seulement
56288
+ ;
56289
+ children.forEach((child)=>selectedMap.delete(child[valueKey]));
56290
+ } else {
56291
+ children.forEach(findChildren) // on descend chercher les enfants partiellement sélectionnés
56292
+ ;
56293
+ }
56294
+ } else if (selectedMap.has(value)) {
56295
+ result.push(option) // enfant orphelin sélectionné
56296
+ ;
56297
+ }
56298
+ }
56299
+ allOptions.forEach(findChildren);
56300
+ return result;
56301
+ }
56149
56302
 
56150
- function CheckTreePicker({ childrenKey = 'children', className, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isMultiSelect = true, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, onChange, options, popupWidth, readOnly = false, renderedChildrenValue = 'Sous-thématique', renderedValue = 'Thématique', style, value, ...originalProps }) {
56303
+ function CheckTreePicker({ childrenKey = 'children', className, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isMultiSelect = true, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, labelKey = 'label', onChange, options, popupWidth, readOnly = false, renderedChildrenValue = 'Sous-thématique', renderedValue = 'Thématique', shouldShowLabels = true, style, value, valueKey = 'value', ...originalProps }) {
56151
56304
  // eslint-disable-next-line no-null/no-null
56152
56305
  const boxRef = useRef(null);
56153
56306
  const controlledClassName = useMemo(()=>classnames('Field-CheckTreePicker', className), [
@@ -56164,29 +56317,42 @@ function CheckTreePicker({ childrenKey = 'children', className, disabled = false
56164
56317
  }, [
56165
56318
  forceUpdate
56166
56319
  ]);
56167
- const rsuiteValue = useMemo(()=>toRsuiteValue(value, childrenKey), [
56320
+ const [disabledValues, setDisabledValues] = useState([]);
56321
+ const rsuiteValue = useMemo(()=>{
56322
+ const nextRsuiteValue = toRsuiteValue(value, childrenKey, valueKey);
56323
+ if (!isMultiSelect && nextRsuiteValue) {
56324
+ setDisabledValues(computeDisabledValues(isMultiSelect, nextRsuiteValue, options, childrenKey, valueKey, labelKey));
56325
+ } else {
56326
+ setDisabledValues([]);
56327
+ }
56328
+ return nextRsuiteValue;
56329
+ }, [
56168
56330
  childrenKey,
56169
- value
56331
+ isMultiSelect,
56332
+ labelKey,
56333
+ options,
56334
+ value,
56335
+ valueKey
56170
56336
  ]);
56171
- const [disabledValues, setDisabledValues] = useState(computeDisabledValues(isMultiSelect, rsuiteValue, options, childrenKey));
56172
56337
  const handleChange = useCallback((nextValue)=>{
56173
56338
  if (!onChange) {
56174
56339
  return;
56175
56340
  }
56176
- const formattedValues = fromRsuiteValue(nextValue, options, childrenKey);
56177
- if (!isMultiSelect && formattedValues) {
56178
- setDisabledValues(computeDisabledValues(isMultiSelect, nextValue, options, childrenKey));
56179
- } else {
56180
- setDisabledValues([]);
56181
- }
56341
+ const formattedValues = fromRsuiteValue(nextValue, options, childrenKey, valueKey, labelKey);
56182
56342
  onChange(formattedValues);
56183
56343
  }, [
56184
56344
  childrenKey,
56185
- isMultiSelect,
56345
+ labelKey,
56186
56346
  onChange,
56187
- options
56347
+ options,
56348
+ valueKey
56188
56349
  ]);
56189
- return /*#__PURE__*/ jsx(CheckPickerBox, {
56350
+ const removeOptions = (valuesToRemove, e)=>{
56351
+ e.stopPropagation();
56352
+ const valueToUpdate = rsuiteValue?.filter((rvalue)=>!valuesToRemove.includes(rvalue));
56353
+ handleChange(valueToUpdate ?? []);
56354
+ };
56355
+ return /*#__PURE__*/ jsx(CheckTreePickerBox, {
56190
56356
  boxRef: boxRef,
56191
56357
  className: controlledClassName,
56192
56358
  disabled: disabled,
@@ -56210,6 +56376,7 @@ function CheckTreePicker({ childrenKey = 'children', className, disabled = false
56210
56376
  disabled: disabled,
56211
56377
  disabledItemValues: disabledValues,
56212
56378
  id: originalProps.name,
56379
+ labelKey: labelKey,
56213
56380
  onChange: handleChange,
56214
56381
  readOnly: readOnly,
56215
56382
  renderTreeIcon: ({ expand })=>/*#__PURE__*/ jsx(IconButton, {
@@ -56221,45 +56388,84 @@ function CheckTreePicker({ childrenKey = 'children', className, disabled = false
56221
56388
  }
56222
56389
  }),
56223
56390
  renderValue: ()=>{
56224
- const childrenCount = getTreeOptionsBySelectedValues(rsuiteValue, options, childrenKey).flatMap((treeOption)=>treeOption[childrenKey]).length;
56225
- const parentCount = getTreeOptionsBySelectedValues(rsuiteValue, options, childrenKey).length;
56226
- return /*#__PURE__*/ jsxs(Fragment, {
56227
- children: [
56228
- /*#__PURE__*/ jsxs("span", {
56229
- className: "rs-picker-value-list",
56230
- title: renderedValue,
56231
- children: [
56232
- renderedValue,
56233
- " ",
56234
- /*#__PURE__*/ jsxs(Bold, {
56235
- children: [
56236
- "(",
56237
- parentCount,
56238
- ")"
56239
- ]
56240
- })
56241
- ]
56242
- }),
56243
- childrenCount > 0 && /*#__PURE__*/ jsxs("span", {
56244
- className: "rs-picker-value-list",
56245
- title: renderedChildrenValue,
56246
- children: [
56247
- renderedChildrenValue,
56248
- " ",
56249
- /*#__PURE__*/ jsxs(Bold, {
56250
- children: [
56251
- "(",
56252
- childrenCount,
56253
- ")"
56254
- ]
56255
- })
56256
- ]
56391
+ const children = getTreeOptionsBySelectedValues(rsuiteValue, options, childrenKey, valueKey, labelKey).flatMap((treeOption)=>treeOption[childrenKey]);
56392
+ const parents = getTreeOptionsBySelectedValues(rsuiteValue, options, childrenKey, valueKey, labelKey);
56393
+ if (!shouldShowLabels) {
56394
+ return /*#__PURE__*/ jsxs(Fragment, {
56395
+ children: [
56396
+ /*#__PURE__*/ jsxs("span", {
56397
+ className: "rs-picker-value-list",
56398
+ title: renderedValue,
56399
+ children: [
56400
+ renderedValue,
56401
+ " ",
56402
+ /*#__PURE__*/ jsxs(Bold, {
56403
+ children: [
56404
+ "(",
56405
+ parents.length,
56406
+ ")"
56407
+ ]
56408
+ })
56409
+ ]
56410
+ }),
56411
+ children.length > 0 && /*#__PURE__*/ jsxs("span", {
56412
+ className: "rs-picker-value-list",
56413
+ title: renderedChildrenValue,
56414
+ children: [
56415
+ renderedChildrenValue,
56416
+ " ",
56417
+ /*#__PURE__*/ jsxs(Bold, {
56418
+ children: [
56419
+ "(",
56420
+ children.length,
56421
+ ")"
56422
+ ]
56423
+ })
56424
+ ]
56425
+ })
56426
+ ]
56427
+ });
56428
+ }
56429
+ const optionsToDisplay = getOptionsToDisplay(options, [
56430
+ ...parents,
56431
+ ...children
56432
+ ], childrenKey, valueKey);
56433
+ return /*#__PURE__*/ jsx(Wrapper, {
56434
+ children: /*#__PURE__*/ jsx(SubWrapper, {
56435
+ children: optionsToDisplay.map((option)=>{
56436
+ const isParent = option[childrenKey] !== undefined && option[childrenKey].length > 0;
56437
+ return /*#__PURE__*/ jsxs(SelectedOptionContainer, {
56438
+ children: [
56439
+ /*#__PURE__*/ jsxs(SelectedOptionLabel, {
56440
+ $isLight: isLight || isTransparent,
56441
+ title: option[labelKey],
56442
+ children: [
56443
+ option[labelKey],
56444
+ isParent && ' (Tout)'
56445
+ ]
56446
+ }),
56447
+ /*#__PURE__*/ jsx(StyledButton, {
56448
+ $isLight: isLight || isTransparent,
56449
+ accent: Accent.TERTIARY,
56450
+ Icon: Close,
56451
+ onClick: (e)=>{
56452
+ removeOptions(isParent ? option[childrenKey].flatMap((child)=>child[valueKey]) : [
56453
+ option[valueKey]
56454
+ ], e);
56455
+ },
56456
+ size: Size.SMALL,
56457
+ tabIndex: 0,
56458
+ title: `Retirer ${option[labelKey]}`
56459
+ })
56460
+ ]
56461
+ }, option[valueKey]);
56257
56462
  })
56258
- ]
56463
+ })
56259
56464
  });
56260
56465
  },
56261
56466
  size: originalProps.size ?? 'sm',
56262
56467
  value: rsuiteValue ?? [],
56468
+ valueKey: valueKey,
56263
56469
  ...originalProps
56264
56470
  })
56265
56471
  });
@@ -56268,6 +56474,56 @@ const Bold = styled.span`
56268
56474
  font-weight: bold;
56269
56475
  margin-right: 4px;
56270
56476
  `;
56477
+ const StyledButton = styled(Button)`
56478
+ padding: 0 3px;
56479
+ background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
56480
+
56481
+ &:hover,
56482
+ &._hover {
56483
+ background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
56484
+ border: 1px solid ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
56485
+ color: ${(p)=>p.theme.color.maximumRed};
56486
+ }
56487
+
56488
+ &:active,
56489
+ &._active {
56490
+ background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
56491
+ border: 1px solid ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
56492
+ color: ${(p)=>p.theme.color.maximumRed};
56493
+ }
56494
+
56495
+ > .Element-IconBox {
56496
+ margin-right: 0px;
56497
+ > svg {
56498
+ height: 10px;
56499
+ width: 10px;
56500
+ }
56501
+ }
56502
+ `;
56503
+ const Wrapper = styled.div`
56504
+ display: contents;
56505
+ `;
56506
+ const SubWrapper = styled.div`
56507
+ display: flex;
56508
+ flex-wrap: wrap;
56509
+ gap: 4px;
56510
+ max-width: calc(100% - 6px);
56511
+ `;
56512
+ const SelectedOptionContainer = styled.div`
56513
+ display: flex;
56514
+ gap: 1px;
56515
+ padding-top: 1px;
56516
+ max-width: calc(100% - 6px);
56517
+ `;
56518
+ const SelectedOptionLabel = styled.span`
56519
+ background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
56520
+ font-size: 11px;
56521
+ padding: 2px 8px 1px 8px;
56522
+ overflow: hidden;
56523
+ text-overflow: ellipsis;
56524
+ vertical-align: top;
56525
+ white-space: nowrap;
56526
+ `;
56271
56527
 
56272
56528
  function isNumeric(val) {
56273
56529
  // parseFloat NaNs numeric-cast false positives (null|true|false|"")
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@mtes-mct/monitor-ui",
3
3
  "description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
4
- "version": "24.17.1",
4
+ "version": "24.18.1",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {
8
8
  "node": ">=20"
9
9
  },
10
10
  "dependencies": {
11
- "@babel/runtime": "7.27.0",
11
+ "@babel/runtime": "7.27.1",
12
12
  "@tanstack/react-table": "8.21.3",
13
13
  "@tanstack/react-virtual": "3.13.6",
14
14
  "prop-types": "15.8.1",