namirasoft-site-react 1.4.389 → 1.4.390

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.
@@ -18,5 +18,6 @@ export interface NSButtonState {
18
18
  }
19
19
  export declare class NSButton extends React.Component<NSButtonProps, NSButtonState> {
20
20
  constructor(props: NSButtonProps);
21
+ performClick(): void;
21
22
  render(): React.ReactNode;
22
23
  }
@@ -6,24 +6,28 @@ export class NSButton extends React.Component {
6
6
  constructor(props) {
7
7
  super(props);
8
8
  this.state = { clicked: false };
9
+ this.performClick = this.performClick.bind(this);
10
+ }
11
+ performClick() {
12
+ var _a;
13
+ if (this.props.onClick.showLoading !== false)
14
+ this.setState({ clicked: true });
15
+ try {
16
+ this.props.onClick.action(() => {
17
+ this.setState({ clicked: false });
18
+ });
19
+ }
20
+ catch (error) {
21
+ this.setState({ clicked: false });
22
+ alert((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error);
23
+ }
9
24
  }
10
25
  render() {
11
26
  var _a, _b;
12
27
  if (this.state.clicked)
13
28
  return _jsx(NSLoading, Object.assign({ small: true, hideTitle: true, hideDesciption: true }, this.props.loading));
14
29
  return (_jsxs("button", { id: this.props.id, className: `${this.props.disabled ? Styles.ns_button_disabled : Styles.ns_button} ${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: this.props.style, onClick: () => {
15
- var _a;
16
- if (this.props.onClick.showLoading !== false)
17
- this.setState({ clicked: true });
18
- try {
19
- this.props.onClick.action(() => {
20
- this.setState({ clicked: false });
21
- });
22
- }
23
- catch (error) {
24
- this.setState({ clicked: false });
25
- alert((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error);
26
- }
30
+ this.performClick();
27
31
  }, disabled: this.props.disabled, children: [this.props.icon && _jsx("img", Object.assign({}, this.props.icon, { alt: "Icon", width: 24, height: 24 })), this.props.title] }));
28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J;AAAA,CAAC"}
@@ -1,2 +1,8 @@
1
+ import React from "react";
1
2
  import { NSButtonProps } from "./NSButton";
2
- export declare function NSButtonBlue(props: NSButtonProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare class NSButtonBlue extends React.Component<NSButtonProps> {
4
+ private NSButton_Base;
5
+ constructor(props: NSButtonProps);
6
+ performClick(): void;
7
+ render(): import("react/jsx-runtime").JSX.Element;
8
+ }
@@ -1,11 +1,23 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { createRef } from "react";
2
3
  import { NSButton } from "./NSButton";
3
4
  import Style from "./NSButtonBlue.module.css";
4
- export function NSButtonBlue(props) {
5
- let classList = [];
6
- if (props.classList)
7
- classList.push(...props.classList);
8
- classList.push(Style.ns_button_blue);
9
- return _jsx(NSButton, Object.assign({}, props, { classList: classList }));
5
+ export class NSButtonBlue extends React.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.NSButton_Base = createRef();
9
+ this.performClick = this.performClick.bind(this);
10
+ }
11
+ performClick() {
12
+ var _a;
13
+ (_a = this.NSButton_Base.current) === null || _a === void 0 ? void 0 : _a.performClick();
14
+ }
15
+ render() {
16
+ let classList = [];
17
+ if (this.props.classList)
18
+ classList.push(...this.props.classList);
19
+ classList.push(Style.ns_button_blue);
20
+ return _jsx(NSButton, Object.assign({ ref: this.NSButton_Base }, this.props, { classList: classList }));
21
+ }
10
22
  }
11
23
  //# sourceMappingURL=NSButtonBlue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSButtonBlue.js","sourceRoot":"","sources":["../../src/components/NSButtonBlue.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAE9C,MAAM,UAAU,YAAY,CAAC,KAAoB;IAEhD,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,IAAI,KAAK,CAAC,SAAS;QAClB,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACpC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAErC,OAAO,KAAC,QAAQ,oBACX,KAAK,IACT,SAAS,EAAE,SAAS,IACnB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"NSButtonBlue.js","sourceRoot":"","sources":["../../src/components/NSButtonBlue.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAE9C,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,SAAwB;IAG/D,YAAY,KAAoB;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,kBAAa,GAAG,SAAS,EAAY,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,YAAY;;QAEX,MAAA,IAAI,CAAC,aAAa,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAC;IAC5C,CAAC;IACQ,MAAM;QAEd,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAErC,OAAO,KAAC,QAAQ,kBACf,GAAG,EAAE,IAAI,CAAC,aAAa,IACnB,IAAI,CAAC,KAAK,IACd,SAAS,EAAE,SAAS,IACnB,CAAC;IACJ,CAAC;CACD"}
@@ -1,2 +1,8 @@
1
+ import React from "react";
1
2
  import { NSButtonProps } from "./NSButton";
2
- export declare function NSButtonGreen(props: NSButtonProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare class NSButtonGreen extends React.Component<NSButtonProps> {
4
+ private NSButton_Base;
5
+ constructor(props: NSButtonProps);
6
+ performClick(): void;
7
+ render(): import("react/jsx-runtime").JSX.Element;
8
+ }
@@ -1,11 +1,23 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { createRef } from "react";
2
3
  import { NSButton } from "./NSButton";
3
4
  import Style from "./NSButtonGreen.module.css";
4
- export function NSButtonGreen(props) {
5
- let classList = [];
6
- if (props.classList)
7
- classList.push(...props.classList);
8
- classList.push(Style.ns_button_green);
9
- return _jsx(NSButton, Object.assign({}, props, { classList: classList }));
5
+ export class NSButtonGreen extends React.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.NSButton_Base = createRef();
9
+ this.performClick = this.performClick.bind(this);
10
+ }
11
+ performClick() {
12
+ var _a;
13
+ (_a = this.NSButton_Base.current) === null || _a === void 0 ? void 0 : _a.performClick();
14
+ }
15
+ render() {
16
+ let classList = [];
17
+ if (this.props.classList)
18
+ classList.push(...this.props.classList);
19
+ classList.push(Style.ns_button_green);
20
+ return _jsx(NSButton, Object.assign({ ref: this.NSButton_Base }, this.props, { classList: classList }));
21
+ }
10
22
  }
11
23
  //# sourceMappingURL=NSButtonGreen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSButtonGreen.js","sourceRoot":"","sources":["../../src/components/NSButtonGreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAE/C,MAAM,UAAU,aAAa,CAAC,KAAoB;IAEjD,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,IAAI,KAAK,CAAC,SAAS;QAClB,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACpC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAEtC,OAAO,KAAC,QAAQ,oBACX,KAAK,IACT,SAAS,EAAE,SAAS,IACnB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"NSButtonGreen.js","sourceRoot":"","sources":["../../src/components/NSButtonGreen.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAE/C,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAwB;IAGhE,YAAY,KAAoB;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,kBAAa,GAAG,SAAS,EAAY,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,YAAY;;QAEX,MAAA,IAAI,CAAC,aAAa,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAC;IAC5C,CAAC;IACQ,MAAM;QAEd,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAEtC,OAAO,KAAC,QAAQ,kBACf,GAAG,EAAE,IAAI,CAAC,aAAa,IACnB,IAAI,CAAC,KAAK,IACd,SAAS,EAAE,SAAS,IACnB,CAAC;IACJ,CAAC;CACD"}
@@ -1,2 +1,8 @@
1
+ import React from "react";
1
2
  import { NSButtonProps } from "./NSButton";
2
- export declare function NSButtonRed(props: NSButtonProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare class NSButtonRed extends React.Component<NSButtonProps> {
4
+ private NSButton_Base;
5
+ constructor(props: NSButtonProps);
6
+ performClick(): void;
7
+ render(): import("react/jsx-runtime").JSX.Element;
8
+ }
@@ -1,11 +1,23 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { createRef } from "react";
2
3
  import { NSButton } from "./NSButton";
3
4
  import Style from "./NSButtonRed.module.css";
4
- export function NSButtonRed(props) {
5
- let classList = [];
6
- if (props.classList)
7
- classList.push(...props.classList);
8
- classList.push(Style.ns_button_red);
9
- return _jsx(NSButton, Object.assign({}, props, { classList: classList }));
5
+ export class NSButtonRed extends React.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.NSButton_Base = createRef();
9
+ this.performClick = this.performClick.bind(this);
10
+ }
11
+ performClick() {
12
+ var _a;
13
+ (_a = this.NSButton_Base.current) === null || _a === void 0 ? void 0 : _a.performClick();
14
+ }
15
+ render() {
16
+ let classList = [];
17
+ if (this.props.classList)
18
+ classList.push(...this.props.classList);
19
+ classList.push(Style.ns_button_red);
20
+ return _jsx(NSButton, Object.assign({ ref: this.NSButton_Base }, this.props, { classList: classList }));
21
+ }
10
22
  }
11
23
  //# sourceMappingURL=NSButtonRed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSButtonRed.js","sourceRoot":"","sources":["../../src/components/NSButtonRed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAE7C,MAAM,UAAU,WAAW,CAAC,KAAoB;IAE/C,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,IAAI,KAAK,CAAC,SAAS;QAClB,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACpC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAEpC,OAAO,KAAC,QAAQ,oBACX,KAAK,IACT,SAAS,EAAE,SAAS,IACnB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"NSButtonRed.js","sourceRoot":"","sources":["../../src/components/NSButtonRed.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAE7C,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAAwB;IAG9D,YAAY,KAAoB;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,kBAAa,GAAG,SAAS,EAAY,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,YAAY;;QAEX,MAAA,IAAI,CAAC,aAAa,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAC;IAC5C,CAAC;IACQ,MAAM;QAEd,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAEpC,OAAO,KAAC,QAAQ,kBACf,GAAG,EAAE,IAAI,CAAC,aAAa,IACnB,IAAI,CAAC,KAAK,IACd,SAAS,EAAE,SAAS,IACnB,CAAC;IACJ,CAAC;CACD"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.389",
11
+ "version": "1.4.390",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -30,6 +30,23 @@ export class NSButton extends React.Component<NSButtonProps, NSButtonState>
30
30
  {
31
31
  super(props);
32
32
  this.state = { clicked: false };
33
+ this.performClick = this.performClick.bind(this);
34
+ }
35
+ performClick()
36
+ {
37
+ if (this.props.onClick.showLoading !== false)
38
+ this.setState({ clicked: true });
39
+ try
40
+ {
41
+ this.props.onClick.action(() =>
42
+ {
43
+ this.setState({ clicked: false });
44
+ });
45
+ } catch (error: any)
46
+ {
47
+ this.setState({ clicked: false });
48
+ alert(error?.message ?? error);
49
+ }
33
50
  }
34
51
  override render(): React.ReactNode
35
52
  {
@@ -47,19 +64,7 @@ export class NSButton extends React.Component<NSButtonProps, NSButtonState>
47
64
  style={this.props.style}
48
65
  onClick={() =>
49
66
  {
50
- if (this.props.onClick.showLoading !== false)
51
- this.setState({ clicked: true });
52
- try
53
- {
54
- this.props.onClick.action(() =>
55
- {
56
- this.setState({ clicked: false });
57
- });
58
- } catch (error: any)
59
- {
60
- this.setState({ clicked: false });
61
- alert(error?.message ?? error);
62
- }
67
+ this.performClick();
63
68
  }}
64
69
  disabled={this.props.disabled}
65
70
  >
@@ -1,15 +1,30 @@
1
+ import React, { createRef } from "react";
1
2
  import { NSButton, NSButtonProps } from "./NSButton";
2
3
  import Style from "./NSButtonBlue.module.css";
3
4
 
4
- export function NSButtonBlue(props: NSButtonProps)
5
+ export class NSButtonBlue extends React.Component<NSButtonProps>
5
6
  {
6
- let classList = []
7
- if (props.classList)
8
- classList.push(...props.classList);
9
- classList.push(Style.ns_button_blue);
7
+ private NSButton_Base = createRef<NSButton>();
8
+ constructor(props: NSButtonProps)
9
+ {
10
+ super(props);
11
+ this.performClick = this.performClick.bind(this);
12
+ }
13
+ performClick()
14
+ {
15
+ this.NSButton_Base.current?.performClick();
16
+ }
17
+ override render()
18
+ {
19
+ let classList = []
20
+ if (this.props.classList)
21
+ classList.push(...this.props.classList);
22
+ classList.push(Style.ns_button_blue);
10
23
 
11
- return <NSButton
12
- {...props}
13
- classList={classList}
14
- />;
24
+ return <NSButton
25
+ ref={this.NSButton_Base}
26
+ {...this.props}
27
+ classList={classList}
28
+ />;
29
+ }
15
30
  }
@@ -1,15 +1,30 @@
1
+ import React, { createRef } from "react";
1
2
  import { NSButton, NSButtonProps } from "./NSButton";
2
3
  import Style from "./NSButtonGreen.module.css";
3
4
 
4
- export function NSButtonGreen(props: NSButtonProps)
5
+ export class NSButtonGreen extends React.Component<NSButtonProps>
5
6
  {
6
- let classList = []
7
- if (props.classList)
8
- classList.push(...props.classList);
9
- classList.push(Style.ns_button_green);
7
+ private NSButton_Base = createRef<NSButton>();
8
+ constructor(props: NSButtonProps)
9
+ {
10
+ super(props);
11
+ this.performClick = this.performClick.bind(this);
12
+ }
13
+ performClick()
14
+ {
15
+ this.NSButton_Base.current?.performClick();
16
+ }
17
+ override render()
18
+ {
19
+ let classList = []
20
+ if (this.props.classList)
21
+ classList.push(...this.props.classList);
22
+ classList.push(Style.ns_button_green);
10
23
 
11
- return <NSButton
12
- {...props}
13
- classList={classList}
14
- />;
24
+ return <NSButton
25
+ ref={this.NSButton_Base}
26
+ {...this.props}
27
+ classList={classList}
28
+ />;
29
+ }
15
30
  }
@@ -1,15 +1,30 @@
1
+ import React, { createRef } from "react";
1
2
  import { NSButton, NSButtonProps } from "./NSButton";
2
3
  import Style from "./NSButtonRed.module.css";
3
4
 
4
- export function NSButtonRed(props: NSButtonProps)
5
+ export class NSButtonRed extends React.Component<NSButtonProps>
5
6
  {
6
- let classList = []
7
- if (props.classList)
8
- classList.push(...props.classList);
9
- classList.push(Style.ns_button_red);
7
+ private NSButton_Base = createRef<NSButton>();
8
+ constructor(props: NSButtonProps)
9
+ {
10
+ super(props);
11
+ this.performClick = this.performClick.bind(this);
12
+ }
13
+ performClick()
14
+ {
15
+ this.NSButton_Base.current?.performClick();
16
+ }
17
+ override render()
18
+ {
19
+ let classList = []
20
+ if (this.props.classList)
21
+ classList.push(...this.props.classList);
22
+ classList.push(Style.ns_button_red);
10
23
 
11
- return <NSButton
12
- {...props}
13
- classList={classList}
14
- />;
24
+ return <NSButton
25
+ ref={this.NSButton_Base}
26
+ {...this.props}
27
+ classList={classList}
28
+ />;
29
+ }
15
30
  }