@siemens/ix-react 1.1.0 → 1.2.0-beta.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.
package/dist/index.esm.js CHANGED
@@ -286,22 +286,25 @@ const IxValidationTooltip = /*@__PURE__*/ createReactComponent('ix-validation-to
286
286
  const IxWorkflowStep = /*@__PURE__*/ createReactComponent('ix-workflow-step');
287
287
  const IxWorkflowSteps = /*@__PURE__*/ createReactComponent('ix-workflow-steps');
288
288
 
289
- /*
290
- * SPDX-FileCopyrightText: 2022 Siemens AG
291
- *
292
- * SPDX-License-Identifier: MIT
293
- *
294
- * This source code is licensed under the MIT license found in the
295
- * LICENSE file in the root directory of this source tree.
296
- */
289
+ /* eslint-disable @typescript-eslint/no-explicit-any */
297
290
  const Modal = React.forwardRef((props, ref) => {
298
291
  const modalRef = useRef(null);
299
292
  useImperativeHandle(ref, () => ({
300
293
  close: (result) => {
301
- closeModal(modalRef.current, result);
294
+ const modalElement = modalRef.current;
295
+ if (!modalElement) {
296
+ console.error('Modal cannot find modal reference');
297
+ return;
298
+ }
299
+ closeModal(modalElement, result);
302
300
  },
303
301
  dismiss: (result) => {
304
- dismissModal(modalRef.current, result);
302
+ const modalElement = modalRef.current;
303
+ if (!modalElement) {
304
+ console.error('Modal cannot find modal reference');
305
+ return;
306
+ }
307
+ dismissModal(modalElement, result);
305
308
  },
306
309
  }));
307
310
  return React.createElement("div", { ref: modalRef }, props.children);
@@ -356,14 +359,8 @@ async function showToast(config) {
356
359
  return toastInstance;
357
360
  }
358
361
 
359
- /*
360
- * SPDX-FileCopyrightText: 2022 Siemens AG
361
- *
362
- * SPDX-License-Identifier: MIT
363
- *
364
- * This source code is licensed under the MIT license found in the
365
- * LICENSE file in the root directory of this source tree.
366
- */
362
+ /* eslint-disable @typescript-eslint/no-explicit-any */
363
+ // eslint-disable-next-line no-inline-comments
367
364
  const InternalIxTree = /*@__PURE__*/ createReactComponent('ix-tree');
368
365
  const IxTree = (props) => {
369
366
  const cachedRootNodes = useRef(new Map());
package/dist/index.js CHANGED
@@ -295,22 +295,25 @@ const IxValidationTooltip = /*@__PURE__*/ createReactComponent('ix-validation-to
295
295
  const IxWorkflowStep = /*@__PURE__*/ createReactComponent('ix-workflow-step');
296
296
  const IxWorkflowSteps = /*@__PURE__*/ createReactComponent('ix-workflow-steps');
297
297
 
298
- /*
299
- * SPDX-FileCopyrightText: 2022 Siemens AG
300
- *
301
- * SPDX-License-Identifier: MIT
302
- *
303
- * This source code is licensed under the MIT license found in the
304
- * LICENSE file in the root directory of this source tree.
305
- */
298
+ /* eslint-disable @typescript-eslint/no-explicit-any */
306
299
  const Modal = React__default["default"].forwardRef((props, ref) => {
307
300
  const modalRef = React.useRef(null);
308
301
  React.useImperativeHandle(ref, () => ({
309
302
  close: (result) => {
310
- ix.closeModal(modalRef.current, result);
303
+ const modalElement = modalRef.current;
304
+ if (!modalElement) {
305
+ console.error('Modal cannot find modal reference');
306
+ return;
307
+ }
308
+ ix.closeModal(modalElement, result);
311
309
  },
312
310
  dismiss: (result) => {
313
- ix.dismissModal(modalRef.current, result);
311
+ const modalElement = modalRef.current;
312
+ if (!modalElement) {
313
+ console.error('Modal cannot find modal reference');
314
+ return;
315
+ }
316
+ ix.dismissModal(modalElement, result);
314
317
  },
315
318
  }));
316
319
  return React__default["default"].createElement("div", { ref: modalRef }, props.children);
@@ -365,14 +368,8 @@ async function showToast(config) {
365
368
  return toastInstance;
366
369
  }
367
370
 
368
- /*
369
- * SPDX-FileCopyrightText: 2022 Siemens AG
370
- *
371
- * SPDX-License-Identifier: MIT
372
- *
373
- * This source code is licensed under the MIT license found in the
374
- * LICENSE file in the root directory of this source tree.
375
- */
371
+ /* eslint-disable @typescript-eslint/no-explicit-any */
372
+ // eslint-disable-next-line no-inline-comments
376
373
  const InternalIxTree = /*@__PURE__*/ createReactComponent('ix-tree');
377
374
  const IxTree = (props) => {
378
375
  const cachedRootNodes = React.useRef(new Map());
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  export interface ModalRef {
3
- close: (result: any) => void;
4
- dismiss: (result?: any) => void;
3
+ close: <T = any>(result: T) => void;
4
+ dismiss: <T = any>(result?: T) => void;
5
5
  }
6
6
  export declare const Modal: React.ForwardRefExoticComponent<{
7
- onClose?: ((result: any) => void) | undefined;
8
- onDismiss?: ((result?: any) => void) | undefined;
7
+ onClose?: (<T = any>(result: T) => void) | undefined;
8
+ onDismiss?: (<T_1 = any>(result?: T_1 | undefined) => void) | undefined;
9
9
  } & {
10
10
  children?: React.ReactNode;
11
11
  } & React.RefAttributes<ModalRef>>;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/siemens/ix",
8
8
  "directory": "packages/react"
9
9
  },
10
- "version": "1.1.0",
10
+ "version": "1.2.0-beta.0",
11
11
  "description": "Siemens iX for React",
12
12
  "main": "dist/index.js",
13
13
  "module": "dist/index.esm.js",
@@ -21,16 +21,21 @@
21
21
  "build": "npm run clean && npm run compile",
22
22
  "clean": "rimraf dist && rimraf dist-transpiled",
23
23
  "compile": "rollup -c",
24
- "tsc": "tsc -p ."
24
+ "tsc": "tsc -p .",
25
+ "lint": "eslint src"
25
26
  },
26
27
  "author": "",
27
28
  "license": "MIT",
28
29
  "devDependencies": {
29
30
  "@rollup/plugin-typescript": "^8.4.0",
30
- "@siemens/ix": "~1.1.0",
31
+ "@siemens/ix": "~1.2.0-beta.0",
31
32
  "@types/estree": "~0.0.51",
32
33
  "@types/react": "~18.0.15",
33
34
  "@types/react-dom": "~18.0.6",
35
+ "@typescript-eslint/eslint-plugin": "^5.45.0",
36
+ "@typescript-eslint/parser": "^5.45.0",
37
+ "eslint-config-ix": "*",
38
+ "eslint-plugin-react": "^7.31.11",
34
39
  "react": "^18.2.0",
35
40
  "react-dom": "^18.2.0",
36
41
  "rimraf": "^3.0.2",
@@ -46,7 +51,7 @@
46
51
  "react-dom": ">=17.0.2"
47
52
  },
48
53
  "dependencies": {
49
- "@siemens/ix-icons": "~1.0.0",
50
- "@siemens/ix": "~1.1.0"
54
+ "@siemens/ix": "~1.2.0-beta.0",
55
+ "@siemens/ix-icons": "~1.0.0"
51
56
  }
52
57
  }