@akinon/ui-tour 1.0.0 → 1.1.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.
@@ -14,6 +14,6 @@ import { ITourProps } from './types';
14
14
  * Built with flexibility and the Akinon design system in mind, the Tour component is suitable
15
15
  * for various use cases across web applications.
16
16
  */
17
- export declare const Tour: ({ ...props }: ITourProps) => React.JSX.Element;
17
+ export declare const Tour: ({ open, ...restProps }: ITourProps) => React.JSX.Element;
18
18
  export type * from './types';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,IAAI,iBAAkB,UAAU,sBAE5C,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,IAAI,2BAA4B,UAAU,sBAuBtD,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -29,7 +29,17 @@ const react_1 = require("react");
29
29
  * for various use cases across web applications.
30
30
  */
31
31
  const Tour = (_a) => {
32
- var props = __rest(_a, []);
33
- return react_1.default.createElement(antd_1.Tour, Object.assign({}, props));
32
+ var { open } = _a, restProps = __rest(_a, ["open"]);
33
+ const [visible, setVisible] = (0, react_1.useState)(open);
34
+ (0, react_1.useEffect)(() => {
35
+ setVisible(open);
36
+ }, [open]);
37
+ const handleClose = () => {
38
+ setVisible(false); // Automatically close the tour if no callback is provided
39
+ };
40
+ const handleFinish = () => {
41
+ setVisible(false); // Automatically close the tour if no callback is provided
42
+ };
43
+ return (react_1.default.createElement(antd_1.Tour, Object.assign({ open: visible, onClose: handleClose, onFinish: handleFinish }, restProps)));
34
44
  };
35
45
  exports.Tour = Tour;
@@ -14,6 +14,6 @@ import { ITourProps } from './types';
14
14
  * Built with flexibility and the Akinon design system in mind, the Tour component is suitable
15
15
  * for various use cases across web applications.
16
16
  */
17
- export declare const Tour: ({ ...props }: ITourProps) => React.JSX.Element;
17
+ export declare const Tour: ({ open, ...restProps }: ITourProps) => React.JSX.Element;
18
18
  export type * from './types';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,IAAI,iBAAkB,UAAU,sBAE5C,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,IAAI,2BAA4B,UAAU,sBAuBtD,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
package/dist/esm/index.js CHANGED
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { Tour as AntTour } from 'antd';
13
- import React from 'react';
13
+ import React, { useEffect, useState } from 'react';
14
14
  /**
15
15
  * Tour component for Akinon UI.
16
16
  *
@@ -26,6 +26,16 @@ import React from 'react';
26
26
  * for various use cases across web applications.
27
27
  */
28
28
  export const Tour = (_a) => {
29
- var props = __rest(_a, []);
30
- return React.createElement(AntTour, Object.assign({}, props));
29
+ var { open } = _a, restProps = __rest(_a, ["open"]);
30
+ const [visible, setVisible] = useState(open);
31
+ useEffect(() => {
32
+ setVisible(open);
33
+ }, [open]);
34
+ const handleClose = () => {
35
+ setVisible(false); // Automatically close the tour if no callback is provided
36
+ };
37
+ const handleFinish = () => {
38
+ setVisible(false); // Automatically close the tour if no callback is provided
39
+ };
40
+ return (React.createElement(AntTour, Object.assign({ open: visible, onClose: handleClose, onFinish: handleFinish }, restProps)));
31
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-tour",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -9,15 +9,15 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "antd": "5.22.6"
12
+ "antd": "5.22.6",
13
+ "@akinon/ui-theme": "1.0.1"
13
14
  },
14
15
  "devDependencies": {
15
16
  "clean-package": "2.2.0",
16
17
  "copyfiles": "^2.4.1",
17
18
  "rimraf": "^5.0.5",
18
19
  "typescript": "*",
19
- "@akinon/typescript-config": "1.0.0",
20
- "@akinon/ui-theme": "1.0.0"
20
+ "@akinon/typescript-config": "1.0.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18",