@xylabs/react-button 3.4.1 → 3.4.2
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/browser/components/ButtonEx.d.cts +3 -2
- package/dist/browser/components/ButtonEx.d.cts.map +1 -1
- package/dist/browser/components/ButtonEx.d.mts +3 -2
- package/dist/browser/components/ButtonEx.d.mts.map +1 -1
- package/dist/browser/components/ButtonEx.d.ts +3 -2
- package/dist/browser/components/ButtonEx.d.ts.map +1 -1
- package/dist/browser/components/ButtonExBase.d.cts +3 -2
- package/dist/browser/components/ButtonExBase.d.cts.map +1 -1
- package/dist/browser/components/ButtonExBase.d.mts +3 -2
- package/dist/browser/components/ButtonExBase.d.mts.map +1 -1
- package/dist/browser/components/ButtonExBase.d.ts +3 -2
- package/dist/browser/components/ButtonExBase.d.ts.map +1 -1
- package/dist/browser/components/ButtonExTo.d.cts +3 -2
- package/dist/browser/components/ButtonExTo.d.cts.map +1 -1
- package/dist/browser/components/ButtonExTo.d.mts +3 -2
- package/dist/browser/components/ButtonExTo.d.mts.map +1 -1
- package/dist/browser/components/ButtonExTo.d.ts +3 -2
- package/dist/browser/components/ButtonExTo.d.ts.map +1 -1
- package/dist/browser/components/index.d.cts +2 -2
- package/dist/browser/components/index.d.mts +2 -2
- package/dist/browser/components/index.d.ts +2 -2
- package/dist/browser/index.cjs +43 -20
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.mts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.mjs +65 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/neutral/components/ButtonEx.d.cts +3 -2
- package/dist/neutral/components/ButtonEx.d.cts.map +1 -1
- package/dist/neutral/components/ButtonEx.d.mts +3 -2
- package/dist/neutral/components/ButtonEx.d.mts.map +1 -1
- package/dist/neutral/components/ButtonEx.d.ts +3 -2
- package/dist/neutral/components/ButtonEx.d.ts.map +1 -1
- package/dist/neutral/components/ButtonExBase.d.cts +3 -2
- package/dist/neutral/components/ButtonExBase.d.cts.map +1 -1
- package/dist/neutral/components/ButtonExBase.d.mts +3 -2
- package/dist/neutral/components/ButtonExBase.d.mts.map +1 -1
- package/dist/neutral/components/ButtonExBase.d.ts +3 -2
- package/dist/neutral/components/ButtonExBase.d.ts.map +1 -1
- package/dist/neutral/components/ButtonExTo.d.cts +3 -2
- package/dist/neutral/components/ButtonExTo.d.cts.map +1 -1
- package/dist/neutral/components/ButtonExTo.d.mts +3 -2
- package/dist/neutral/components/ButtonExTo.d.mts.map +1 -1
- package/dist/neutral/components/ButtonExTo.d.ts +3 -2
- package/dist/neutral/components/ButtonExTo.d.ts.map +1 -1
- package/dist/neutral/components/index.d.cts +2 -2
- package/dist/neutral/components/index.d.mts +2 -2
- package/dist/neutral/components/index.d.ts +2 -2
- package/dist/neutral/index.cjs +43 -20
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +1 -1
- package/dist/neutral/index.d.mts +1 -1
- package/dist/neutral/index.d.ts +1 -1
- package/dist/neutral/index.mjs +65 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/node/components/ButtonEx.d.cts +3 -2
- package/dist/node/components/ButtonEx.d.cts.map +1 -1
- package/dist/node/components/ButtonEx.d.mts +3 -2
- package/dist/node/components/ButtonEx.d.mts.map +1 -1
- package/dist/node/components/ButtonEx.d.ts +3 -2
- package/dist/node/components/ButtonEx.d.ts.map +1 -1
- package/dist/node/components/ButtonExBase.d.cts +3 -2
- package/dist/node/components/ButtonExBase.d.cts.map +1 -1
- package/dist/node/components/ButtonExBase.d.mts +3 -2
- package/dist/node/components/ButtonExBase.d.mts.map +1 -1
- package/dist/node/components/ButtonExBase.d.ts +3 -2
- package/dist/node/components/ButtonExBase.d.ts.map +1 -1
- package/dist/node/components/ButtonExTo.d.cts +3 -2
- package/dist/node/components/ButtonExTo.d.cts.map +1 -1
- package/dist/node/components/ButtonExTo.d.mts +3 -2
- package/dist/node/components/ButtonExTo.d.mts.map +1 -1
- package/dist/node/components/ButtonExTo.d.ts +3 -2
- package/dist/node/components/ButtonExTo.d.ts.map +1 -1
- package/dist/node/components/index.d.cts +2 -2
- package/dist/node/components/index.d.mts +2 -2
- package/dist/node/components/index.d.ts +2 -2
- package/dist/node/index.cjs +43 -20
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.mjs +65 -0
- package/dist/node/index.mjs.map +1 -0
- package/package.json +12 -12
- package/src/components/ButtonEx.stories.tsx +5 -3
- package/src/components/ButtonEx.tsx +4 -4
- package/src/components/ButtonExBase.tsx +8 -8
- package/src/components/ButtonExTo.tsx +3 -3
- package/src/components/index.ts +2 -2
- package/src/index.ts +1 -1
- package/dist/browser/index.js +0 -50
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/index.js +0 -50
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/index.js +0 -50
- package/dist/node/index.js.map +0 -1
package/dist/neutral/index.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
9
|
var __export = (target, all) => {
|
|
7
10
|
for (var name in all)
|
|
8
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
18
|
}
|
|
16
19
|
return to;
|
|
17
20
|
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
18
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
30
|
|
|
20
31
|
// src/index.ts
|
|
@@ -25,49 +36,61 @@ __export(src_exports, {
|
|
|
25
36
|
module.exports = __toCommonJS(src_exports);
|
|
26
37
|
|
|
27
38
|
// src/components/ButtonEx.tsx
|
|
28
|
-
var import_react3 = require("react");
|
|
39
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
29
40
|
|
|
30
41
|
// src/components/ButtonExBase.tsx
|
|
31
42
|
var import_material = require("@mui/material");
|
|
32
43
|
var import_react_shared = require("@xylabs/react-shared");
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var
|
|
35
|
-
var ButtonExBase = (0, import_react.forwardRef)((props, ref) => {
|
|
44
|
+
var import_react = __toESM(require("react"), 1);
|
|
45
|
+
var ButtonExBase = /* @__PURE__ */ (0, import_react.forwardRef)((props, ref) => {
|
|
36
46
|
const theme = (0, import_material.useTheme)();
|
|
37
47
|
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = (0, import_react_shared.mergeBoxlikeStyles)(theme, props);
|
|
38
|
-
const localOnClick = (event) => {
|
|
48
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
39
49
|
if (!busy) {
|
|
40
50
|
onClick?.(event);
|
|
41
51
|
}
|
|
42
|
-
};
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
}, "localOnClick");
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_material.Button, {
|
|
54
|
+
ref,
|
|
55
|
+
onClick: localOnClick,
|
|
56
|
+
...rootProps
|
|
57
|
+
}, busy && busyVariant === "linear" ? /* @__PURE__ */ import_react.default.createElement(import_react_shared.BusyLinearProgress, {
|
|
58
|
+
rounded: true,
|
|
59
|
+
opacity: busyOpacity ?? 0
|
|
60
|
+
}) : null, busy && busyVariant === "circular" ? /* @__PURE__ */ import_react.default.createElement(import_react_shared.BusyCircularProgress, {
|
|
61
|
+
rounded: true,
|
|
62
|
+
size: 24,
|
|
63
|
+
opacity: busyOpacity ?? 0.5
|
|
64
|
+
}) : null, children);
|
|
48
65
|
});
|
|
49
66
|
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
50
67
|
|
|
51
68
|
// src/components/ButtonExTo.tsx
|
|
52
|
-
var import_react2 = require("react");
|
|
69
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
53
70
|
var import_react_router_dom = require("react-router-dom");
|
|
54
|
-
var
|
|
55
|
-
var ButtonToEx = (0, import_react2.forwardRef)(({ to, toOptions, onClick, ...props }, ref) => {
|
|
71
|
+
var ButtonToEx = /* @__PURE__ */ (0, import_react2.forwardRef)(({ to, toOptions, onClick, ...props }, ref) => {
|
|
56
72
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
57
|
-
const localOnClick = (event) => {
|
|
73
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
58
74
|
onClick?.(event);
|
|
59
75
|
if (to) {
|
|
60
76
|
navigate(to, toOptions);
|
|
61
77
|
}
|
|
62
|
-
};
|
|
63
|
-
return /* @__PURE__ */
|
|
78
|
+
}, "localOnClick");
|
|
79
|
+
return /* @__PURE__ */ import_react2.default.createElement(ButtonExBase, {
|
|
80
|
+
ref,
|
|
81
|
+
onClick: localOnClick,
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
64
84
|
});
|
|
65
85
|
ButtonToEx.displayName = "ButtonToExXYLabs";
|
|
66
86
|
|
|
67
87
|
// src/components/ButtonEx.tsx
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
var ButtonEx = /* @__PURE__ */ (0, import_react3.forwardRef)(({ to, ...props }, ref) => {
|
|
89
|
+
return to ? /* @__PURE__ */ import_react3.default.createElement(ButtonToEx, {
|
|
90
|
+
to,
|
|
91
|
+
ref,
|
|
92
|
+
...props
|
|
93
|
+
}) : /* @__PURE__ */ import_react3.default.createElement(ButtonExBase, props);
|
|
71
94
|
});
|
|
72
95
|
ButtonEx.displayName = "ButtonExXYLabs";
|
|
73
96
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["export * from './components/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["export * from './components/index.ts'\n","import React, { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\nimport { ButtonToEx } from './ButtonExTo.tsx'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n","import { Button, useTheme } from '@mui/material'\nimport { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'\nimport React, { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {\n const theme = useTheme()\n const { busy, busyVariant = 'linear', busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles<ButtonExProps>(theme, props)\n\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (!busy) {\n onClick?.(event)\n }\n }\n\n return (\n <Button ref={ref} onClick={localOnClick} {...rootProps}>\n {busy && busyVariant === 'linear'\n ? <BusyLinearProgress rounded opacity={busyOpacity ?? 0} />\n : null}\n {busy && busyVariant === 'circular'\n ? <BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />\n : null}\n {children}\n </Button>\n )\n})\n\nButtonExBase.displayName = 'ButtonExBaseXYLabs'\n\nexport { ButtonExBase }\n","import React, { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {\n const navigate = useNavigate()\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (to) {\n navigate(to, toOptions)\n }\n }\n\n return <ButtonExBase ref={ref} onClick={localOnClick} {...props} />\n})\n\nButtonToEx.displayName = 'ButtonToExXYLabs'\n\nexport { ButtonToEx }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,IAAAA,gBAAkC;;;ACAlC,sBAAiC;AACjC,0BAA6E;AAC7E,mBAA8C;AAI9C,IAAMC,eAAeC,6CAA6C,CAACC,OAAOC,QAAAA;AACxE,QAAMC,YAAQC,0BAAAA;AACd,QAAM,EAAEC,MAAMC,cAAc,UAAUC,aAAaC,SAASC,UAAU,GAAGC,UAAAA,QAAcC,wCAAkCR,OAAOF,KAAAA;AAEhI,QAAMW,eAAe,wBAACC,UAAAA;AACpB,QAAI,CAACR,MAAM;AACTG,gBAAUK,KAAAA;IACZ;EACF,GAJqB;AAMrB,SACE,6BAAAC,QAAA,cAACC,wBAAAA;IAAOb;IAAUM,SAASI;IAAe,GAAGF;KAC1CL,QAAQC,gBAAgB,WACrB,6BAAAQ,QAAA,cAACE,wCAAAA;IAAmBC,SAAAA;IAAQC,SAASX,eAAe;OACpD,MACHF,QAAQC,gBAAgB,aACrB,6BAAAQ,QAAA,cAACK,0CAAAA;IAAqBF,SAAAA;IAAQG,MAAM;IAAIF,SAASX,eAAe;OAChE,MACHE,QAAAA;AAGP,CAAA;AAEAV,aAAasB,cAAc;;;AC7B3B,IAAAC,gBAA8C;AAC9C,8BAA4B;AAK5B,IAAMC,aAAaC,8CAA6C,CAAC,EAAEC,IAAIC,WAAWC,SAAS,GAAGC,MAAAA,GAASC,QAAAA;AACrG,QAAMC,eAAWC,qCAAAA;AACjB,QAAMC,eAAe,wBAACC,UAAAA;AACpBN,cAAUM,KAAAA;AACV,QAAIR,IAAI;AACNK,eAASL,IAAIC,SAAAA;IACf;EACF,GALqB;AAOrB,SAAO,8BAAAQ,QAAA,cAACC,cAAAA;IAAaN;IAAUF,SAASK;IAAe,GAAGJ;;AAC5D,CAAA;AAEAL,WAAWa,cAAc;;;AFZzB,IAAMC,WAAWC,8CAA6C,CAAC,EAAEC,IAAI,GAAGC,MAAAA,GAASC,QAAAA;AAC/E,SAAOF,KAAK,8BAAAG,QAAA,cAACC,YAAAA;IAAWJ;IAAQE;IAAW,GAAGD;OAAY,8BAAAE,QAAA,cAACE,cAAiBJ,KAAAA;AAC9E,CAAA;AAEAH,SAASQ,cAAc;","names":["import_react","ButtonExBase","forwardRef","props","ref","theme","useTheme","busy","busyVariant","busyOpacity","onClick","children","rootProps","mergeBoxlikeStyles","localOnClick","event","React","Button","BusyLinearProgress","rounded","opacity","BusyCircularProgress","size","displayName","import_react","ButtonToEx","forwardRef","to","toOptions","onClick","props","ref","navigate","useNavigate","localOnClick","event","React","ButtonExBase","displayName","ButtonEx","forwardRef","to","props","ref","React","ButtonToEx","ButtonExBase","displayName"]}
|
package/dist/neutral/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/components/ButtonEx.tsx
|
|
5
|
+
import React3, { forwardRef as forwardRef3 } from "react";
|
|
6
|
+
|
|
7
|
+
// src/components/ButtonExBase.tsx
|
|
8
|
+
import { Button, useTheme } from "@mui/material";
|
|
9
|
+
import { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from "@xylabs/react-shared";
|
|
10
|
+
import React, { forwardRef } from "react";
|
|
11
|
+
var ButtonExBase = /* @__PURE__ */ forwardRef((props, ref) => {
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles(theme, props);
|
|
14
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
15
|
+
if (!busy) {
|
|
16
|
+
onClick?.(event);
|
|
17
|
+
}
|
|
18
|
+
}, "localOnClick");
|
|
19
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
20
|
+
ref,
|
|
21
|
+
onClick: localOnClick,
|
|
22
|
+
...rootProps
|
|
23
|
+
}, busy && busyVariant === "linear" ? /* @__PURE__ */ React.createElement(BusyLinearProgress, {
|
|
24
|
+
rounded: true,
|
|
25
|
+
opacity: busyOpacity ?? 0
|
|
26
|
+
}) : null, busy && busyVariant === "circular" ? /* @__PURE__ */ React.createElement(BusyCircularProgress, {
|
|
27
|
+
rounded: true,
|
|
28
|
+
size: 24,
|
|
29
|
+
opacity: busyOpacity ?? 0.5
|
|
30
|
+
}) : null, children);
|
|
31
|
+
});
|
|
32
|
+
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
33
|
+
|
|
34
|
+
// src/components/ButtonExTo.tsx
|
|
35
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
|
36
|
+
import { useNavigate } from "react-router-dom";
|
|
37
|
+
var ButtonToEx = /* @__PURE__ */ forwardRef2(({ to, toOptions, onClick, ...props }, ref) => {
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
40
|
+
onClick?.(event);
|
|
41
|
+
if (to) {
|
|
42
|
+
navigate(to, toOptions);
|
|
43
|
+
}
|
|
44
|
+
}, "localOnClick");
|
|
45
|
+
return /* @__PURE__ */ React2.createElement(ButtonExBase, {
|
|
46
|
+
ref,
|
|
47
|
+
onClick: localOnClick,
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
ButtonToEx.displayName = "ButtonToExXYLabs";
|
|
52
|
+
|
|
53
|
+
// src/components/ButtonEx.tsx
|
|
54
|
+
var ButtonEx = /* @__PURE__ */ forwardRef3(({ to, ...props }, ref) => {
|
|
55
|
+
return to ? /* @__PURE__ */ React3.createElement(ButtonToEx, {
|
|
56
|
+
to,
|
|
57
|
+
ref,
|
|
58
|
+
...props
|
|
59
|
+
}) : /* @__PURE__ */ React3.createElement(ButtonExBase, props);
|
|
60
|
+
});
|
|
61
|
+
ButtonEx.displayName = "ButtonExXYLabs";
|
|
62
|
+
export {
|
|
63
|
+
ButtonEx
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\nimport { ButtonToEx } from './ButtonExTo.tsx'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n","import { Button, useTheme } from '@mui/material'\nimport { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'\nimport React, { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {\n const theme = useTheme()\n const { busy, busyVariant = 'linear', busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles<ButtonExProps>(theme, props)\n\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (!busy) {\n onClick?.(event)\n }\n }\n\n return (\n <Button ref={ref} onClick={localOnClick} {...rootProps}>\n {busy && busyVariant === 'linear'\n ? <BusyLinearProgress rounded opacity={busyOpacity ?? 0} />\n : null}\n {busy && busyVariant === 'circular'\n ? <BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />\n : null}\n {children}\n </Button>\n )\n})\n\nButtonExBase.displayName = 'ButtonExBaseXYLabs'\n\nexport { ButtonExBase }\n","import React, { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {\n const navigate = useNavigate()\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (to) {\n navigate(to, toOptions)\n }\n }\n\n return <ButtonExBase ref={ref} onClick={localOnClick} {...props} />\n})\n\nButtonToEx.displayName = 'ButtonToExXYLabs'\n\nexport { ButtonToEx }\n"],"mappings":";;;;AAAA,OAAOA,UAASC,cAAAA,mBAAkB;;;ACAlC,SAASC,QAAQC,gBAAgB;AACjC,SAASC,sBAAsBC,oBAAoBC,0BAA0B;AAC7E,OAAOC,SAASC,kBAA8B;AAI9C,IAAMC,eAAeC,2BAA6C,CAACC,OAAOC,QAAAA;AACxE,QAAMC,QAAQC,SAAAA;AACd,QAAM,EAAEC,MAAMC,cAAc,UAAUC,aAAaC,SAASC,UAAU,GAAGC,UAAAA,IAAcC,mBAAkCR,OAAOF,KAAAA;AAEhI,QAAMW,eAAe,wBAACC,UAAAA;AACpB,QAAI,CAACR,MAAM;AACTG,gBAAUK,KAAAA;IACZ;EACF,GAJqB;AAMrB,SACE,sBAAA,cAACC,QAAAA;IAAOZ;IAAUM,SAASI;IAAe,GAAGF;KAC1CL,QAAQC,gBAAgB,WACrB,sBAAA,cAACS,oBAAAA;IAAmBC,SAAAA;IAAQC,SAASV,eAAe;OACpD,MACHF,QAAQC,gBAAgB,aACrB,sBAAA,cAACY,sBAAAA;IAAqBF,SAAAA;IAAQG,MAAM;IAAIF,SAASV,eAAe;OAChE,MACHE,QAAAA;AAGP,CAAA;AAEAV,aAAaqB,cAAc;;;AC7B3B,OAAOC,UAASC,cAAAA,mBAA8B;AAC9C,SAASC,mBAAmB;AAK5B,IAAMC,aAAaC,gBAAAA,YAA6C,CAAC,EAAEC,IAAIC,WAAWC,SAAS,GAAGC,MAAAA,GAASC,QAAAA;AACrG,QAAMC,WAAWC,YAAAA;AACjB,QAAMC,eAAe,wBAACC,UAAAA;AACpBN,cAAUM,KAAAA;AACV,QAAIR,IAAI;AACNK,eAASL,IAAIC,SAAAA;IACf;EACF,GALqB;AAOrB,SAAO,gBAAAQ,OAAA,cAACC,cAAAA;IAAaN;IAAUF,SAASK;IAAe,GAAGJ;;AAC5D,CAAA;AAEAL,WAAWa,cAAc;;;AFZzB,IAAMC,WAAWC,gBAAAA,YAA6C,CAAC,EAAEC,IAAI,GAAGC,MAAAA,GAASC,QAAAA;AAC/E,SAAOF,KAAK,gBAAAG,OAAA,cAACC,YAAAA;IAAWJ;IAAQE;IAAW,GAAGD;OAAY,gBAAAE,OAAA,cAACE,cAAiBJ,KAAAA;AAC9E,CAAA;AAEAH,SAASQ,cAAc;","names":["React","forwardRef","Button","useTheme","BusyCircularProgress","BusyLinearProgress","mergeBoxlikeStyles","React","forwardRef","ButtonExBase","forwardRef","props","ref","theme","useTheme","busy","busyVariant","busyOpacity","onClick","children","rootProps","mergeBoxlikeStyles","localOnClick","event","Button","BusyLinearProgress","rounded","opacity","BusyCircularProgress","size","displayName","React","forwardRef","useNavigate","ButtonToEx","forwardRef","to","toOptions","onClick","props","ref","navigate","useNavigate","localOnClick","event","React","ButtonExBase","displayName","ButtonEx","forwardRef","to","props","ref","React","ButtonToEx","ButtonExBase","displayName"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonEx };
|
|
4
5
|
//# sourceMappingURL=ButtonEx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,yFAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonEx };
|
|
4
5
|
//# sourceMappingURL=ButtonEx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,yFAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonEx };
|
|
4
5
|
//# sourceMappingURL=ButtonEx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,yFAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonExBase: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonExBase };
|
|
4
5
|
//# sourceMappingURL=ButtonExBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,YAAY,yFAqBhB,CAAA;AAIF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonExBase: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonExBase };
|
|
4
5
|
//# sourceMappingURL=ButtonExBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,YAAY,yFAqBhB,CAAA;AAIF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonExBase: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonExBase };
|
|
4
5
|
//# sourceMappingURL=ButtonExBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,YAAY,yFAqBhB,CAAA;AAIF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonToEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonToEx };
|
|
4
5
|
//# sourceMappingURL=ButtonExTo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,UAAU,yFAUd,CAAA;AAIF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonToEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonToEx };
|
|
4
5
|
//# sourceMappingURL=ButtonExTo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,UAAU,yFAUd,CAAA;AAIF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonExProps } from './ButtonExProps.tsx';
|
|
3
|
+
declare const ButtonToEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
4
|
export { ButtonToEx };
|
|
4
5
|
//# sourceMappingURL=ButtonExTo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,UAAU,yFAUd,CAAA;AAIF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ButtonEx.
|
|
2
|
-
export * from './ButtonExProps.
|
|
1
|
+
export * from './ButtonEx.tsx';
|
|
2
|
+
export * from './ButtonExProps.tsx';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ButtonEx.
|
|
2
|
-
export * from './ButtonExProps.
|
|
1
|
+
export * from './ButtonEx.tsx';
|
|
2
|
+
export * from './ButtonExProps.tsx';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ButtonEx.
|
|
2
|
-
export * from './ButtonExProps.
|
|
1
|
+
export * from './ButtonEx.tsx';
|
|
2
|
+
export * from './ButtonExProps.tsx';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
9
|
var __export = (target, all) => {
|
|
7
10
|
for (var name in all)
|
|
8
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
18
|
}
|
|
16
19
|
return to;
|
|
17
20
|
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
18
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
30
|
|
|
20
31
|
// src/index.ts
|
|
@@ -25,49 +36,61 @@ __export(src_exports, {
|
|
|
25
36
|
module.exports = __toCommonJS(src_exports);
|
|
26
37
|
|
|
27
38
|
// src/components/ButtonEx.tsx
|
|
28
|
-
var import_react3 = require("react");
|
|
39
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
29
40
|
|
|
30
41
|
// src/components/ButtonExBase.tsx
|
|
31
42
|
var import_material = require("@mui/material");
|
|
32
43
|
var import_react_shared = require("@xylabs/react-shared");
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var
|
|
35
|
-
var ButtonExBase = (0, import_react.forwardRef)((props, ref) => {
|
|
44
|
+
var import_react = __toESM(require("react"), 1);
|
|
45
|
+
var ButtonExBase = /* @__PURE__ */ (0, import_react.forwardRef)((props, ref) => {
|
|
36
46
|
const theme = (0, import_material.useTheme)();
|
|
37
47
|
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = (0, import_react_shared.mergeBoxlikeStyles)(theme, props);
|
|
38
|
-
const localOnClick = (event) => {
|
|
48
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
39
49
|
if (!busy) {
|
|
40
50
|
onClick == null ? void 0 : onClick(event);
|
|
41
51
|
}
|
|
42
|
-
};
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
}, "localOnClick");
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_material.Button, {
|
|
54
|
+
ref,
|
|
55
|
+
onClick: localOnClick,
|
|
56
|
+
...rootProps
|
|
57
|
+
}, busy && busyVariant === "linear" ? /* @__PURE__ */ import_react.default.createElement(import_react_shared.BusyLinearProgress, {
|
|
58
|
+
rounded: true,
|
|
59
|
+
opacity: busyOpacity ?? 0
|
|
60
|
+
}) : null, busy && busyVariant === "circular" ? /* @__PURE__ */ import_react.default.createElement(import_react_shared.BusyCircularProgress, {
|
|
61
|
+
rounded: true,
|
|
62
|
+
size: 24,
|
|
63
|
+
opacity: busyOpacity ?? 0.5
|
|
64
|
+
}) : null, children);
|
|
48
65
|
});
|
|
49
66
|
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
50
67
|
|
|
51
68
|
// src/components/ButtonExTo.tsx
|
|
52
|
-
var import_react2 = require("react");
|
|
69
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
53
70
|
var import_react_router_dom = require("react-router-dom");
|
|
54
|
-
var
|
|
55
|
-
var ButtonToEx = (0, import_react2.forwardRef)(({ to, toOptions, onClick, ...props }, ref) => {
|
|
71
|
+
var ButtonToEx = /* @__PURE__ */ (0, import_react2.forwardRef)(({ to, toOptions, onClick, ...props }, ref) => {
|
|
56
72
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
57
|
-
const localOnClick = (event) => {
|
|
73
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
58
74
|
onClick == null ? void 0 : onClick(event);
|
|
59
75
|
if (to) {
|
|
60
76
|
navigate(to, toOptions);
|
|
61
77
|
}
|
|
62
|
-
};
|
|
63
|
-
return /* @__PURE__ */
|
|
78
|
+
}, "localOnClick");
|
|
79
|
+
return /* @__PURE__ */ import_react2.default.createElement(ButtonExBase, {
|
|
80
|
+
ref,
|
|
81
|
+
onClick: localOnClick,
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
64
84
|
});
|
|
65
85
|
ButtonToEx.displayName = "ButtonToExXYLabs";
|
|
66
86
|
|
|
67
87
|
// src/components/ButtonEx.tsx
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
var ButtonEx = /* @__PURE__ */ (0, import_react3.forwardRef)(({ to, ...props }, ref) => {
|
|
89
|
+
return to ? /* @__PURE__ */ import_react3.default.createElement(ButtonToEx, {
|
|
90
|
+
to,
|
|
91
|
+
ref,
|
|
92
|
+
...props
|
|
93
|
+
}) : /* @__PURE__ */ import_react3.default.createElement(ButtonExBase, props);
|
|
71
94
|
});
|
|
72
95
|
ButtonEx.displayName = "ButtonExXYLabs";
|
|
73
96
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["export * from './components/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["export * from './components/index.ts'\n","import React, { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\nimport { ButtonToEx } from './ButtonExTo.tsx'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n","import { Button, useTheme } from '@mui/material'\nimport { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'\nimport React, { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {\n const theme = useTheme()\n const { busy, busyVariant = 'linear', busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles<ButtonExProps>(theme, props)\n\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (!busy) {\n onClick?.(event)\n }\n }\n\n return (\n <Button ref={ref} onClick={localOnClick} {...rootProps}>\n {busy && busyVariant === 'linear'\n ? <BusyLinearProgress rounded opacity={busyOpacity ?? 0} />\n : null}\n {busy && busyVariant === 'circular'\n ? <BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />\n : null}\n {children}\n </Button>\n )\n})\n\nButtonExBase.displayName = 'ButtonExBaseXYLabs'\n\nexport { ButtonExBase }\n","import React, { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {\n const navigate = useNavigate()\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (to) {\n navigate(to, toOptions)\n }\n }\n\n return <ButtonExBase ref={ref} onClick={localOnClick} {...props} />\n})\n\nButtonToEx.displayName = 'ButtonToExXYLabs'\n\nexport { ButtonToEx }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,IAAAA,gBAAkC;;;ACAlC,sBAAiC;AACjC,0BAA6E;AAC7E,mBAA8C;AAI9C,IAAMC,eAAeC,6CAA6C,CAACC,OAAOC,QAAAA;AACxE,QAAMC,YAAQC,0BAAAA;AACd,QAAM,EAAEC,MAAMC,cAAc,UAAUC,aAAaC,SAASC,UAAU,GAAGC,UAAAA,QAAcC,wCAAkCR,OAAOF,KAAAA;AAEhI,QAAMW,eAAe,wBAACC,UAAAA;AACpB,QAAI,CAACR,MAAM;AACTG,yCAAUK;IACZ;EACF,GAJqB;AAMrB,SACE,6BAAAC,QAAA,cAACC,wBAAAA;IAAOb;IAAUM,SAASI;IAAe,GAAGF;KAC1CL,QAAQC,gBAAgB,WACrB,6BAAAQ,QAAA,cAACE,wCAAAA;IAAmBC,SAAAA;IAAQC,SAASX,eAAe;OACpD,MACHF,QAAQC,gBAAgB,aACrB,6BAAAQ,QAAA,cAACK,0CAAAA;IAAqBF,SAAAA;IAAQG,MAAM;IAAIF,SAASX,eAAe;OAChE,MACHE,QAAAA;AAGP,CAAA;AAEAV,aAAasB,cAAc;;;AC7B3B,IAAAC,gBAA8C;AAC9C,8BAA4B;AAK5B,IAAMC,aAAaC,8CAA6C,CAAC,EAAEC,IAAIC,WAAWC,SAAS,GAAGC,MAAAA,GAASC,QAAAA;AACrG,QAAMC,eAAWC,qCAAAA;AACjB,QAAMC,eAAe,wBAACC,UAAAA;AACpBN,uCAAUM;AACV,QAAIR,IAAI;AACNK,eAASL,IAAIC,SAAAA;IACf;EACF,GALqB;AAOrB,SAAO,8BAAAQ,QAAA,cAACC,cAAAA;IAAaN;IAAUF,SAASK;IAAe,GAAGJ;;AAC5D,CAAA;AAEAL,WAAWa,cAAc;;;AFZzB,IAAMC,WAAWC,8CAA6C,CAAC,EAAEC,IAAI,GAAGC,MAAAA,GAASC,QAAAA;AAC/E,SAAOF,KAAK,8BAAAG,QAAA,cAACC,YAAAA;IAAWJ;IAAQE;IAAW,GAAGD;OAAY,8BAAAE,QAAA,cAACE,cAAiBJ,KAAAA;AAC9E,CAAA;AAEAH,SAASQ,cAAc;","names":["import_react","ButtonExBase","forwardRef","props","ref","theme","useTheme","busy","busyVariant","busyOpacity","onClick","children","rootProps","mergeBoxlikeStyles","localOnClick","event","React","Button","BusyLinearProgress","rounded","opacity","BusyCircularProgress","size","displayName","import_react","ButtonToEx","forwardRef","to","toOptions","onClick","props","ref","navigate","useNavigate","localOnClick","event","React","ButtonExBase","displayName","ButtonEx","forwardRef","to","props","ref","React","ButtonToEx","ButtonExBase","displayName"]}
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/components/ButtonEx.tsx
|
|
5
|
+
import React3, { forwardRef as forwardRef3 } from "react";
|
|
6
|
+
|
|
7
|
+
// src/components/ButtonExBase.tsx
|
|
8
|
+
import { Button, useTheme } from "@mui/material";
|
|
9
|
+
import { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from "@xylabs/react-shared";
|
|
10
|
+
import React, { forwardRef } from "react";
|
|
11
|
+
var ButtonExBase = /* @__PURE__ */ forwardRef((props, ref) => {
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles(theme, props);
|
|
14
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
15
|
+
if (!busy) {
|
|
16
|
+
onClick == null ? void 0 : onClick(event);
|
|
17
|
+
}
|
|
18
|
+
}, "localOnClick");
|
|
19
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
20
|
+
ref,
|
|
21
|
+
onClick: localOnClick,
|
|
22
|
+
...rootProps
|
|
23
|
+
}, busy && busyVariant === "linear" ? /* @__PURE__ */ React.createElement(BusyLinearProgress, {
|
|
24
|
+
rounded: true,
|
|
25
|
+
opacity: busyOpacity ?? 0
|
|
26
|
+
}) : null, busy && busyVariant === "circular" ? /* @__PURE__ */ React.createElement(BusyCircularProgress, {
|
|
27
|
+
rounded: true,
|
|
28
|
+
size: 24,
|
|
29
|
+
opacity: busyOpacity ?? 0.5
|
|
30
|
+
}) : null, children);
|
|
31
|
+
});
|
|
32
|
+
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
33
|
+
|
|
34
|
+
// src/components/ButtonExTo.tsx
|
|
35
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
|
36
|
+
import { useNavigate } from "react-router-dom";
|
|
37
|
+
var ButtonToEx = /* @__PURE__ */ forwardRef2(({ to, toOptions, onClick, ...props }, ref) => {
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
const localOnClick = /* @__PURE__ */ __name((event) => {
|
|
40
|
+
onClick == null ? void 0 : onClick(event);
|
|
41
|
+
if (to) {
|
|
42
|
+
navigate(to, toOptions);
|
|
43
|
+
}
|
|
44
|
+
}, "localOnClick");
|
|
45
|
+
return /* @__PURE__ */ React2.createElement(ButtonExBase, {
|
|
46
|
+
ref,
|
|
47
|
+
onClick: localOnClick,
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
ButtonToEx.displayName = "ButtonToExXYLabs";
|
|
52
|
+
|
|
53
|
+
// src/components/ButtonEx.tsx
|
|
54
|
+
var ButtonEx = /* @__PURE__ */ forwardRef3(({ to, ...props }, ref) => {
|
|
55
|
+
return to ? /* @__PURE__ */ React3.createElement(ButtonToEx, {
|
|
56
|
+
to,
|
|
57
|
+
ref,
|
|
58
|
+
...props
|
|
59
|
+
}) : /* @__PURE__ */ React3.createElement(ButtonExBase, props);
|
|
60
|
+
});
|
|
61
|
+
ButtonEx.displayName = "ButtonExXYLabs";
|
|
62
|
+
export {
|
|
63
|
+
ButtonEx
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.mjs.map
|