@js-smart/react-kit 5.5.1 → 5.7.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.
@@ -13,5 +13,5 @@ type DismissibleAlertProps = {
13
13
  dismissOnTimeOut?: boolean;
14
14
  dismissTimeOut?: number;
15
15
  };
16
- export declare function DismissibleAlert(props: DismissibleAlertProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function DismissibleAlert(props: Readonly<DismissibleAlertProps>): import("react/jsx-runtime").JSX.Element;
17
17
  export {};
@@ -1,13 +1,36 @@
1
- import { default as React } from 'react';
1
+ import { default as React, ReactNode } from 'react';
2
+ type ReactIfProps = {
3
+ /**
4
+ * The condition that determines whether children should be rendered
5
+ */
6
+ condition: boolean | null | undefined;
7
+ /**
8
+ * Content to render when condition is true.
9
+ * Can be either a ReactNode or a function returning a ReactNode
10
+ */
11
+ children: ReactNode | (() => ReactNode);
12
+ /**
13
+ * Optional content to render when condition is false
14
+ */
15
+ else?: ReactNode | (() => ReactNode);
16
+ };
2
17
  /**
3
18
  * Reusable If component, that renders content if the condition is true. Similar to *ngIf from Angular
4
19
  *
5
- * @param props Properties of the React Node
20
+ * @param props Properties of the component
6
21
  *
22
+ * @example
23
+ * ```tsx
24
+ * <ReactIf condition={isVisible}>
25
+ * <div>Visible content</div>
26
+ * </ReactIf>
27
+ *
28
+ * <ReactIf condition={isVisible} else={<div>Alternative content</div>}>
29
+ * <div>Main content</div>
30
+ * </ReactIf>
31
+ *```
7
32
  * @author Pavan Kumar Jadda
8
33
  * @since 0.1.0
9
34
  */
10
- export declare function ReactIf(props: {
11
- condition: boolean | undefined;
12
- children: React.ReactNode;
13
- }): React.ReactNode;
35
+ export declare function ReactIf(props: ReactIfProps): React.ReactNode;
36
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@js-smart/react-kit",
3
3
  "private": false,
4
- "version": "5.5.1",
4
+ "version": "5.7.0",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
7
7
  "publishConfig": {