cortex-react-ui 0.2.16 → 0.2.18

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.
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Utility type pour créer des props avec ref pour la compatibilité React 18/19
4
+ * En React 19, ref est passé directement dans les props
5
+ * En React 18, ref est passé séparément via forwardRef
6
+ */
7
+ export type ForwardRefProps<T, P = object> = P & {
8
+ ref?: React.Ref<T>;
9
+ };
10
+ /**
11
+ * Type pour la fonction de rendu compatible React 18/19
12
+ */
13
+ export type ForwardRefRenderFunction<T, P> = (props: P, ref: React.ForwardedRef<T>) => React.ReactElement | null;
14
+ /**
15
+ * Composant wrapper compatible React 18 et React 19
16
+ *
17
+ * Utilise la signature standard de React.forwardRef qui est compatible
18
+ * avec les deux versions de React.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * interface MyComponentProps {
23
+ * className?: string;
24
+ * children?: React.ReactNode;
25
+ * }
26
+ *
27
+ * const MyComponent = forwardRef<HTMLDivElement, MyComponentProps>(
28
+ * (props, ref) => (
29
+ * <div ref={ref} className={props.className}>{props.children}</div>
30
+ * )
31
+ * );
32
+ * ```
33
+ */
34
+ export declare function forwardRef<T, P>(render: ForwardRefRenderFunction<T, P>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
35
+ export default forwardRef;
@@ -1,2 +1,9 @@
1
- /// <reference types="react" />
2
- export default function setRef<T>(ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined, value: T | null): void;
1
+ import * as React from 'react';
2
+ /**
3
+ * Helper pour assigner une valeur à une ref React
4
+ * Compatible avec React 18 et React 19
5
+ *
6
+ * @param ref - La ref React (callback ref, MutableRefObject, ou RefObject)
7
+ * @param value - La valeur à assigner
8
+ */
9
+ export default function setRef<T>(ref: React.Ref<T> | null | undefined, value: T | null): void;
@@ -1,2 +1,10 @@
1
1
  import * as React from 'react';
2
- export default function useForkRef<Instance>(refA: React.Ref<Instance> | null | undefined, refB: React.Ref<Instance> | null | undefined): React.Ref<Instance> | null;
2
+ /**
3
+ * Hook pour combiner plusieurs refs en une seule
4
+ * Compatible avec React 18 et React 19
5
+ *
6
+ * @param refA - Première ref
7
+ * @param refB - Seconde ref
8
+ * @returns Une ref qui met à jour les deux refs
9
+ */
10
+ export default function useForkRef<Instance>(refA: React.Ref<Instance> | null | undefined, refB: React.Ref<Instance> | null | undefined): React.RefCallback<Instance> | null;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- export interface DialogContentProps {
2
+ export interface DialogActionsProps {
3
3
  className?: string;
4
4
  children?: React.ReactNode;
5
5
  }
6
- declare const DialogActions: React.FC<DialogContentProps>;
6
+ declare const DialogActions: React.FC<DialogActionsProps>;
7
7
  export default DialogActions;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- export interface DialogContentProps {
2
+ export interface DialogTitleProps {
3
3
  className?: string;
4
4
  children?: React.ReactNode;
5
5
  closeDisable?: boolean;
6
6
  onClose?: (() => void);
7
7
  }
8
- declare const DialogContent: React.FC<DialogContentProps>;
9
- export default DialogContent;
8
+ declare const DialogTitle: React.FC<DialogTitleProps>;
9
+ export default DialogTitle;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface InputProps {
3
3
  className?: string;
4
- inputComponent?: React.ReactElement<any>;
4
+ inputComponent?: React.ReactElement;
5
5
  }
6
6
  declare const Input: React.FC<InputProps>;
7
7
  export default Input;
@@ -2,13 +2,13 @@ import React from 'react';
2
2
  export interface AuthDownloadLinkProps {
3
3
  url: string;
4
4
  queryParams?: {
5
- [key: string]: any;
5
+ [key: string]: string | number | boolean;
6
6
  };
7
7
  token: string;
8
8
  label?: string;
9
9
  onStart?: (event: React.MouseEvent<HTMLButtonElement> | undefined) => void;
10
10
  onCompleted?: () => void;
11
- onError?: (error: any) => void;
11
+ onError?: (error: Error) => void;
12
12
  }
13
13
  declare const AuthDownloadLink: React.FC<AuthDownloadLinkProps>;
14
14
  export default AuthDownloadLink;
@@ -4,7 +4,7 @@ export interface TextFieldInputProps {
4
4
  value?: string;
5
5
  onFocus?: () => void;
6
6
  onBlur?: () => void;
7
- onChange?: (value: any) => void;
7
+ onChange?: (value: string) => void;
8
8
  }
9
9
  declare const TextFieldInput: React.FC<TextFieldInputProps>;
10
10
  export default TextFieldInput;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface TooltipProps {
3
- children?: React.ReactElement<any>;
3
+ children?: React.ReactElement;
4
4
  anchorEl?: string | HTMLElement | React.RefObject<HTMLElement>;
5
5
  title: React.ReactNode;
6
6
  enterDelay?: number;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  type Props = {
3
3
  trigger: boolean;
4
4
  mode: 'appear' | 'disappear';
5
- children?: React.ReactElement<any>;
5
+ children?: React.ReactElement;
6
6
  enterTimeout?: number;
7
7
  exitTimeout?: number;
8
8
  className?: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
3
  trigger: boolean;
4
- children?: React.ReactElement<any>;
4
+ children?: React.ReactElement;
5
5
  onEnter?: () => void;
6
6
  onEntering?: () => void;
7
7
  onEntered?: () => void;
@@ -19,3 +19,5 @@ export { default as MenuGroup } from './Menu/MenuGroup';
19
19
  export { default as AuthDownloadLink } from './Menu/AuthDownloadLink';
20
20
  export { default as Dialog, DialogContent, DialogHeader, DialogFooter, ConfirmDialog, ErrorDialog, WarningDialog, DialogActions, DialogTitle } from './Dialog';
21
21
  export { ChevronDownIcon, ChevronRightIcon, ChevronLeftIcon, CrossIcon } from './Icons';
22
+ export { forwardRef } from './utils/forwardRef';
23
+ export type { ForwardRefProps, ForwardRefRenderFunction } from './utils/forwardRef';