@xylabs/react-button 3.1.0-rc.6 → 3.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.
- package/README.md +20 -49
- package/dist/browser/components/ButtonEx.d.cts +5 -0
- package/dist/browser/components/ButtonEx.d.cts.map +1 -0
- package/dist/browser/components/ButtonEx.d.mts.map +1 -1
- package/dist/browser/components/ButtonEx.d.ts.map +1 -1
- package/dist/browser/components/ButtonExBase.d.cts +5 -0
- package/dist/browser/components/ButtonExBase.d.cts.map +1 -0
- package/dist/browser/components/ButtonExBase.d.mts.map +1 -1
- package/dist/browser/components/ButtonExBase.d.ts.map +1 -1
- package/dist/browser/components/ButtonExProps.d.cts +10 -0
- package/dist/browser/components/ButtonExProps.d.cts.map +1 -0
- package/dist/browser/components/ButtonExProps.d.mts +1 -1
- package/dist/browser/components/ButtonExProps.d.mts.map +1 -1
- package/dist/browser/components/ButtonExProps.d.ts +1 -1
- package/dist/browser/components/ButtonExProps.d.ts.map +1 -1
- package/dist/browser/components/ButtonExTo.d.cts +5 -0
- package/dist/browser/components/ButtonExTo.d.cts.map +1 -0
- package/dist/browser/components/ButtonExTo.d.mts +3 -3
- package/dist/browser/components/ButtonExTo.d.mts.map +1 -1
- package/dist/browser/components/ButtonExTo.d.ts +3 -3
- package/dist/browser/components/ButtonExTo.d.ts.map +1 -1
- package/dist/browser/components/index.d.cts +3 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/{node/components/ButtonExBase.js → browser/index.cjs} +36 -10
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +2 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/browser/index.js +49 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/components/ButtonEx.d.cts +5 -0
- package/dist/node/components/ButtonEx.d.cts.map +1 -0
- package/dist/node/components/ButtonEx.d.mts.map +1 -1
- package/dist/node/components/ButtonEx.d.ts.map +1 -1
- package/dist/node/components/ButtonExBase.d.cts +5 -0
- package/dist/node/components/ButtonExBase.d.cts.map +1 -0
- package/dist/node/components/ButtonExBase.d.mts.map +1 -1
- package/dist/node/components/ButtonExBase.d.ts.map +1 -1
- package/dist/node/components/ButtonExProps.d.cts +10 -0
- package/dist/node/components/ButtonExProps.d.cts.map +1 -0
- package/dist/node/components/ButtonExProps.d.mts +1 -1
- package/dist/node/components/ButtonExProps.d.mts.map +1 -1
- package/dist/node/components/ButtonExProps.d.ts +1 -1
- package/dist/node/components/ButtonExProps.d.ts.map +1 -1
- package/dist/node/components/ButtonExTo.d.cts +5 -0
- package/dist/node/components/ButtonExTo.d.cts.map +1 -0
- package/dist/node/components/ButtonExTo.d.mts +3 -3
- package/dist/node/components/ButtonExTo.d.mts.map +1 -1
- package/dist/node/components/ButtonExTo.d.ts +3 -3
- package/dist/node/components/ButtonExTo.d.ts.map +1 -1
- package/dist/node/components/index.d.cts +3 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/index.cjs +77 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +2 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +48 -21
- package/dist/node/index.js.map +1 -1
- package/package.json +24 -22
- package/src/components/ButtonEx.tsx +2 -6
- package/src/components/ButtonExBase.tsx +6 -2
- package/src/components/ButtonExProps.tsx +1 -1
- package/src/components/ButtonExTo.tsx +4 -4
- package/dist/browser/components/ButtonEx.js +0 -16
- package/dist/browser/components/ButtonEx.js.map +0 -1
- package/dist/browser/components/ButtonEx.stories.js +0 -32
- package/dist/browser/components/ButtonEx.stories.js.map +0 -1
- package/dist/browser/components/ButtonExBase.js +0 -23
- package/dist/browser/components/ButtonExBase.js.map +0 -1
- package/dist/browser/components/ButtonExProps.js +0 -1
- package/dist/browser/components/ButtonExProps.js.map +0 -1
- package/dist/browser/components/ButtonExTo.js +0 -19
- package/dist/browser/components/ButtonExTo.js.map +0 -1
- package/dist/browser/components/index.js +0 -3
- package/dist/browser/components/index.js.map +0 -1
- package/dist/node/components/ButtonEx.js +0 -40
- package/dist/node/components/ButtonEx.js.map +0 -1
- package/dist/node/components/ButtonEx.mjs +0 -16
- package/dist/node/components/ButtonEx.mjs.map +0 -1
- package/dist/node/components/ButtonEx.stories.js +0 -58
- package/dist/node/components/ButtonEx.stories.js.map +0 -1
- package/dist/node/components/ButtonEx.stories.mjs +0 -32
- package/dist/node/components/ButtonEx.stories.mjs.map +0 -1
- package/dist/node/components/ButtonExBase.js.map +0 -1
- package/dist/node/components/ButtonExBase.mjs +0 -23
- package/dist/node/components/ButtonExBase.mjs.map +0 -1
- package/dist/node/components/ButtonExProps.js +0 -17
- package/dist/node/components/ButtonExProps.js.map +0 -1
- package/dist/node/components/ButtonExProps.mjs +0 -1
- package/dist/node/components/ButtonExProps.mjs.map +0 -1
- package/dist/node/components/ButtonExTo.js +0 -43
- package/dist/node/components/ButtonExTo.js.map +0 -1
- package/dist/node/components/ButtonExTo.mjs +0 -19
- package/dist/node/components/ButtonExTo.mjs.map +0 -1
- package/dist/node/components/index.js +0 -25
- package/dist/node/components/index.js.map +0 -1
- package/dist/node/components/index.mjs +0 -3
- package/dist/node/components/index.mjs.map +0 -1
- package/dist/node/index.mjs +0 -2
- package/dist/node/index.mjs.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
ButtonEx: () => ButtonEx
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/ButtonEx.tsx
|
|
28
|
+
var import_react3 = require("react");
|
|
29
|
+
|
|
30
|
+
// src/components/ButtonExBase.tsx
|
|
31
|
+
var import_material = require("@mui/material");
|
|
32
|
+
var import_react_shared = require("@xylabs/react-shared");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var ButtonExBase = (0, import_react.forwardRef)((props, ref) => {
|
|
36
|
+
const theme = (0, import_material.useTheme)();
|
|
37
|
+
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = (0, import_react_shared.mergeBoxlikeStyles)(theme, props);
|
|
38
|
+
const localOnClick = (event) => {
|
|
39
|
+
if (!busy) {
|
|
40
|
+
onClick == null ? void 0 : onClick(event);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Button, { ref, onClick: localOnClick, ...rootProps, children: [
|
|
44
|
+
busy && busyVariant === "linear" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_shared.BusyLinearProgress, { rounded: true, opacity: busyOpacity ?? 0 }) : null,
|
|
45
|
+
busy && busyVariant === "circular" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_shared.BusyCircularProgress, { rounded: true, size: 24, opacity: busyOpacity ?? 0.5 }) : null,
|
|
46
|
+
children
|
|
47
|
+
] });
|
|
48
|
+
});
|
|
49
|
+
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
50
|
+
|
|
51
|
+
// src/components/ButtonExTo.tsx
|
|
52
|
+
var import_react2 = require("react");
|
|
53
|
+
var import_react_router_dom = require("react-router-dom");
|
|
54
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
55
|
+
var ButtonToEx = (0, import_react2.forwardRef)(({ to, toOptions, onClick, ...props }, ref) => {
|
|
56
|
+
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
57
|
+
const localOnClick = (event) => {
|
|
58
|
+
onClick == null ? void 0 : onClick(event);
|
|
59
|
+
if (to) {
|
|
60
|
+
navigate(to, toOptions);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ButtonExBase, { ref, onClick: localOnClick, ...props });
|
|
64
|
+
});
|
|
65
|
+
ButtonToEx.displayName = "ButtonToExXYLabs";
|
|
66
|
+
|
|
67
|
+
// src/components/ButtonEx.tsx
|
|
68
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
69
|
+
var ButtonEx = (0, import_react3.forwardRef)(({ to, ...props }, ref) => {
|
|
70
|
+
return to ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ButtonToEx, { to, ref, ...props }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ButtonExBase, { ...props });
|
|
71
|
+
});
|
|
72
|
+
ButtonEx.displayName = "ButtonExXYLabs";
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
ButtonEx
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["export * from './components'\n","import { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\nimport { ButtonToEx } from './ButtonExTo'\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 { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps'\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 { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\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;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA2B;;;ACA3B,sBAAiC;AACjC,0BAA6E;AAC7E,mBAAuC;AAenC;AAXJ,IAAM,mBAAe,yBAA6C,CAAC,OAAO,QAAQ;AAChF,QAAM,YAAQ,0BAAS;AACvB,QAAM,EAAE,MAAM,cAAc,UAAU,aAAa,SAAS,UAAU,GAAG,UAAU,QAAI,wCAAkC,OAAO,KAAK;AAErI,QAAM,eAAe,CAAC,UAAyC;AAC7D,QAAI,CAAC,MAAM;AACT,yCAAU;AAAA,IACZ;AAAA,EACF;AAEA,SACE,6CAAC,0BAAO,KAAU,SAAS,cAAe,GAAG,WAC1C;AAAA,YAAQ,gBAAgB,WACvB,4CAAC,0CAAmB,SAAO,MAAC,SAAS,eAAe,GAAG,IACvD;AAAA,IACD,QAAQ,gBAAgB,aACvB,4CAAC,4CAAqB,SAAO,MAAC,MAAM,IAAI,SAAS,eAAe,KAAK,IACrE;AAAA,IACD;AAAA,KACH;AAEJ,CAAC;AAED,aAAa,cAAc;;;AC7B3B,IAAAC,gBAAuC;AACvC,8BAA4B;AAcnB,IAAAC,sBAAA;AATT,IAAM,iBAAa,0BAA6C,CAAC,EAAE,IAAI,WAAW,SAAS,GAAG,MAAM,GAAG,QAAQ;AAC7G,QAAM,eAAW,qCAAY;AAC7B,QAAM,eAAe,CAAC,UAAyC;AAC7D,uCAAU;AACV,QAAI,IAAI;AACN,eAAS,IAAI,SAAS;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,6CAAC,gBAAa,KAAU,SAAS,cAAe,GAAG,OAAO;AACnE,CAAC;AAED,WAAW,cAAc;;;AFXX,IAAAC,sBAAA;AADd,IAAM,eAAW,0BAA6C,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ;AACvF,SAAO,KAAK,6CAAC,cAAW,IAAQ,KAAW,GAAG,OAAO,IAAK,6CAAC,gBAAc,GAAG,OAAO;AACrF,CAAC;AAED,SAAS,cAAc;","names":["import_react","import_react","import_jsx_runtime","import_jsx_runtime"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
package/dist/node/index.js
CHANGED
|
@@ -1,23 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
// src/components/ButtonEx.tsx
|
|
2
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
3
|
+
|
|
4
|
+
// src/components/ButtonExBase.tsx
|
|
5
|
+
import { Button, useTheme } from "@mui/material";
|
|
6
|
+
import { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from "@xylabs/react-shared";
|
|
7
|
+
import { forwardRef } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var ButtonExBase = forwardRef((props, ref) => {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles(theme, props);
|
|
12
|
+
const localOnClick = (event) => {
|
|
13
|
+
if (!busy) {
|
|
14
|
+
onClick == null ? void 0 : onClick(event);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs(Button, { ref, onClick: localOnClick, ...rootProps, children: [
|
|
18
|
+
busy && busyVariant === "linear" ? /* @__PURE__ */ jsx(BusyLinearProgress, { rounded: true, opacity: busyOpacity ?? 0 }) : null,
|
|
19
|
+
busy && busyVariant === "circular" ? /* @__PURE__ */ jsx(BusyCircularProgress, { rounded: true, size: 24, opacity: busyOpacity ?? 0.5 }) : null,
|
|
20
|
+
children
|
|
21
|
+
] });
|
|
22
|
+
});
|
|
23
|
+
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
24
|
+
|
|
25
|
+
// src/components/ButtonExTo.tsx
|
|
26
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
27
|
+
import { useNavigate } from "react-router-dom";
|
|
28
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
29
|
+
var ButtonToEx = forwardRef2(({ to, toOptions, onClick, ...props }, ref) => {
|
|
30
|
+
const navigate = useNavigate();
|
|
31
|
+
const localOnClick = (event) => {
|
|
32
|
+
onClick == null ? void 0 : onClick(event);
|
|
33
|
+
if (to) {
|
|
34
|
+
navigate(to, toOptions);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ jsx2(ButtonExBase, { ref, onClick: localOnClick, ...props });
|
|
22
38
|
});
|
|
39
|
+
ButtonToEx.displayName = "ButtonToExXYLabs";
|
|
40
|
+
|
|
41
|
+
// src/components/ButtonEx.tsx
|
|
42
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
43
|
+
var ButtonEx = forwardRef3(({ to, ...props }, ref) => {
|
|
44
|
+
return to ? /* @__PURE__ */ jsx3(ButtonToEx, { to, ref, ...props }) : /* @__PURE__ */ jsx3(ButtonExBase, { ...props });
|
|
45
|
+
});
|
|
46
|
+
ButtonEx.displayName = "ButtonExXYLabs";
|
|
47
|
+
export {
|
|
48
|
+
ButtonEx
|
|
49
|
+
};
|
|
23
50
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\nimport { ButtonToEx } from './ButtonExTo'\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 { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps'\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 { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\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,SAAS,cAAAA,mBAAkB;;;ACA3B,SAAS,QAAQ,gBAAgB;AACjC,SAAS,sBAAsB,oBAAoB,0BAA0B;AAC7E,SAAS,kBAA8B;AAenC,SAEI,KAFJ;AAXJ,IAAM,eAAe,WAA6C,CAAC,OAAO,QAAQ;AAChF,QAAM,QAAQ,SAAS;AACvB,QAAM,EAAE,MAAM,cAAc,UAAU,aAAa,SAAS,UAAU,GAAG,UAAU,IAAI,mBAAkC,OAAO,KAAK;AAErI,QAAM,eAAe,CAAC,UAAyC;AAC7D,QAAI,CAAC,MAAM;AACT,yCAAU;AAAA,IACZ;AAAA,EACF;AAEA,SACE,qBAAC,UAAO,KAAU,SAAS,cAAe,GAAG,WAC1C;AAAA,YAAQ,gBAAgB,WACvB,oBAAC,sBAAmB,SAAO,MAAC,SAAS,eAAe,GAAG,IACvD;AAAA,IACD,QAAQ,gBAAgB,aACvB,oBAAC,wBAAqB,SAAO,MAAC,MAAM,IAAI,SAAS,eAAe,KAAK,IACrE;AAAA,IACD;AAAA,KACH;AAEJ,CAAC;AAED,aAAa,cAAc;;;AC7B3B,SAAS,cAAAC,mBAA8B;AACvC,SAAS,mBAAmB;AAcnB,gBAAAC,YAAA;AATT,IAAM,aAAaC,YAA6C,CAAC,EAAE,IAAI,WAAW,SAAS,GAAG,MAAM,GAAG,QAAQ;AAC7G,QAAM,WAAW,YAAY;AAC7B,QAAM,eAAe,CAAC,UAAyC;AAC7D,uCAAU;AACV,QAAI,IAAI;AACN,eAAS,IAAI,SAAS;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,gBAAAD,KAAC,gBAAa,KAAU,SAAS,cAAe,GAAG,OAAO;AACnE,CAAC;AAED,WAAW,cAAc;;;AFXX,gBAAAE,YAAA;AADd,IAAM,WAAWC,YAA6C,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ;AACvF,SAAO,KAAK,gBAAAD,KAAC,cAAW,IAAQ,KAAW,GAAG,OAAO,IAAK,gBAAAA,KAAC,gBAAc,GAAG,OAAO;AACrF,CAAC;AAED,SAAS,cAAc;","names":["forwardRef","forwardRef","jsx","forwardRef","jsx","forwardRef"]}
|
package/package.json
CHANGED
|
@@ -13,51 +13,53 @@
|
|
|
13
13
|
"packages/*"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xylabs/react-shared": "~3.1.0
|
|
16
|
+
"@xylabs/react-shared": "~3.1.0",
|
|
17
|
+
"react-router-dom": "^6.22.1"
|
|
17
18
|
},
|
|
18
19
|
"description": "Common React library for all XY Labs projects that use React",
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@mui/material": "^5.
|
|
21
|
-
"@storybook/react": "^7.
|
|
22
|
-
"@xylabs/react-flexbox": "~3.1.0
|
|
23
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
24
|
-
"@xylabs/tsconfig-react": "^3.
|
|
21
|
+
"@mui/material": "^5.15.10",
|
|
22
|
+
"@storybook/react": "^7.6.16",
|
|
23
|
+
"@xylabs/react-flexbox": "~3.1.0",
|
|
24
|
+
"@xylabs/ts-scripts-yarn3": "^3.4.1",
|
|
25
|
+
"@xylabs/tsconfig-react": "^3.4.1",
|
|
25
26
|
"react": "^18.2.0",
|
|
26
27
|
"react-dom": "^18.2.0",
|
|
27
|
-
"
|
|
28
|
-
"typescript": "^5.2.2"
|
|
28
|
+
"typescript": "^5.3.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@mui/material": "^5",
|
|
32
32
|
"react": "^18",
|
|
33
|
-
"react-dom": "^18"
|
|
34
|
-
"react-router-dom": "^6"
|
|
33
|
+
"react-dom": "^18"
|
|
35
34
|
},
|
|
36
35
|
"exports": {
|
|
37
36
|
".": {
|
|
38
37
|
"node": {
|
|
39
38
|
"import": {
|
|
40
39
|
"types": "./dist/node/index.d.mts",
|
|
41
|
-
"default": "./dist/node/index.
|
|
40
|
+
"default": "./dist/node/index.js"
|
|
42
41
|
},
|
|
43
42
|
"require": {
|
|
44
|
-
"types": "./dist/node/index.d.
|
|
45
|
-
"default": "./dist/node/index.
|
|
43
|
+
"types": "./dist/node/index.d.cts",
|
|
44
|
+
"default": "./dist/node/index.cjs"
|
|
46
45
|
}
|
|
47
46
|
},
|
|
48
47
|
"browser": {
|
|
49
|
-
"
|
|
50
|
-
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./dist/browser/index.d.mts",
|
|
50
|
+
"default": "./dist/browser/index.js"
|
|
51
|
+
},
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./dist/browser/index.d.cts",
|
|
54
|
+
"default": "./dist/browser/index.cjs"
|
|
55
|
+
}
|
|
51
56
|
},
|
|
52
57
|
"default": "./dist/browser/index.js"
|
|
53
58
|
},
|
|
54
|
-
"./dist/docs.json": {
|
|
55
|
-
"default": "./dist/docs.json"
|
|
56
|
-
},
|
|
57
59
|
"./package.json": "./package.json"
|
|
58
60
|
},
|
|
59
61
|
"types": "dist/browser/index.d.ts",
|
|
60
|
-
"main": "./dist/
|
|
62
|
+
"main": "./dist/browser/index.cjs",
|
|
61
63
|
"module": "./dist/browser/index.js",
|
|
62
64
|
"homepage": "https://xylabs.com",
|
|
63
65
|
"keywords": [
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
"typescript",
|
|
66
68
|
"react"
|
|
67
69
|
],
|
|
68
|
-
"license": "LGPL-3.0",
|
|
70
|
+
"license": "LGPL-3.0-only",
|
|
69
71
|
"publishConfig": {
|
|
70
72
|
"access": "public"
|
|
71
73
|
},
|
|
@@ -74,6 +76,6 @@
|
|
|
74
76
|
"url": "https://github.com/xylabs/sdk-react.git"
|
|
75
77
|
},
|
|
76
78
|
"sideEffects": false,
|
|
77
|
-
"version": "3.1.0
|
|
78
|
-
"
|
|
79
|
+
"version": "3.1.0",
|
|
80
|
+
"type": "module"
|
|
79
81
|
}
|
|
@@ -2,14 +2,10 @@ import { forwardRef } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { ButtonExBase } from './ButtonExBase'
|
|
4
4
|
import { ButtonExProps } from './ButtonExProps'
|
|
5
|
-
import {
|
|
5
|
+
import { ButtonToEx } from './ButtonExTo'
|
|
6
6
|
|
|
7
7
|
const ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {
|
|
8
|
-
|
|
9
|
-
return <ButtonExTo to={to} ref={ref} {...props} />
|
|
10
|
-
} else {
|
|
11
|
-
return <ButtonExBase {...props} />
|
|
12
|
-
}
|
|
8
|
+
return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />
|
|
13
9
|
})
|
|
14
10
|
|
|
15
11
|
ButtonEx.displayName = 'ButtonExXYLabs'
|
|
@@ -16,8 +16,12 @@ const ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) =
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<Button ref={ref} onClick={localOnClick} {...rootProps}>
|
|
19
|
-
{busy && busyVariant === 'linear' ?
|
|
20
|
-
|
|
19
|
+
{busy && busyVariant === 'linear' ?
|
|
20
|
+
<BusyLinearProgress rounded opacity={busyOpacity ?? 0} />
|
|
21
|
+
: null}
|
|
22
|
+
{busy && busyVariant === 'circular' ?
|
|
23
|
+
<BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />
|
|
24
|
+
: null}
|
|
21
25
|
{children}
|
|
22
26
|
</Button>
|
|
23
27
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonProps } from '@mui/material'
|
|
2
2
|
import { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared'
|
|
3
|
-
import { NavigateOptions, To } from 'react-router-dom'
|
|
3
|
+
import type { NavigateOptions, To } from 'react-router-dom'
|
|
4
4
|
|
|
5
5
|
interface ButtonExProps extends Omit<ButtonProps, 'ref'>, BoxlikeComponentProps, BusyProps {
|
|
6
6
|
target?: string
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { forwardRef, MouseEvent } from 'react'
|
|
2
2
|
import { useNavigate } from 'react-router-dom'
|
|
3
3
|
|
|
4
4
|
import { ButtonExBase } from './ButtonExBase'
|
|
5
5
|
import { ButtonExProps } from './ButtonExProps'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {
|
|
8
8
|
const navigate = useNavigate()
|
|
9
9
|
const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {
|
|
10
10
|
onClick?.(event)
|
|
@@ -16,6 +16,6 @@ const ButtonExTo = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions
|
|
|
16
16
|
return <ButtonExBase ref={ref} onClick={localOnClick} {...props} />
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
ButtonToEx.displayName = 'ButtonToExXYLabs'
|
|
20
20
|
|
|
21
|
-
export {
|
|
21
|
+
export { ButtonToEx }
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { ButtonExBase } from "./ButtonExBase";
|
|
4
|
-
import { ButtonExTo } from "./ButtonExTo";
|
|
5
|
-
const ButtonEx = forwardRef(({ to, ...props }, ref) => {
|
|
6
|
-
if (to) {
|
|
7
|
-
return /* @__PURE__ */ jsx(ButtonExTo, { to, ref, ...props });
|
|
8
|
-
} else {
|
|
9
|
-
return /* @__PURE__ */ jsx(ButtonExBase, { ...props });
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
ButtonEx.displayName = "ButtonExXYLabs";
|
|
13
|
-
export {
|
|
14
|
-
ButtonEx
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=ButtonEx.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonEx.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\nimport { ButtonExTo } from './ButtonExTo'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n if (to) {\n return <ButtonExTo to={to} ref={ref} {...props} />\n } else {\n return <ButtonExBase {...props} />\n }\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n"],"mappings":"AAQW;AARX,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAE7B,SAAS,kBAAkB;AAE3B,MAAM,WAAW,WAA6C,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ;AACvF,MAAI,IAAI;AACN,WAAO,oBAAC,cAAW,IAAQ,KAAW,GAAG,OAAO;AAAA,EAClD,OAAO;AACL,WAAO,oBAAC,gBAAc,GAAG,OAAO;AAAA,EAClC;AACF,CAAC;AAED,SAAS,cAAc;","names":[]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FlexCol, FlexRow } from "@xylabs/react-flexbox";
|
|
3
|
-
import { ButtonEx } from "./ButtonEx";
|
|
4
|
-
const StorybookEntry = {
|
|
5
|
-
argTypes: {},
|
|
6
|
-
component: ButtonEx,
|
|
7
|
-
parameters: {
|
|
8
|
-
docs: {
|
|
9
|
-
page: null
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
title: "button/ButtonEx"
|
|
13
|
-
};
|
|
14
|
-
const DefaultTemplate = (args) => /* @__PURE__ */ jsxs(FlexRow, { justifyContent: "flex-start", children: [
|
|
15
|
-
/* @__PURE__ */ jsx(FlexCol, { marginX: 1, children: /* @__PURE__ */ jsx(ButtonEx, { ...args, children: "Default" }) }),
|
|
16
|
-
/* @__PURE__ */ jsx(FlexCol, { marginX: 1, children: /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", ...args, children: "Outlined" }) }),
|
|
17
|
-
/* @__PURE__ */ jsx(FlexCol, { marginX: 1, children: /* @__PURE__ */ jsx(ButtonEx, { variant: "contained", ...args, children: "Contained" }) })
|
|
18
|
-
] });
|
|
19
|
-
const Default = DefaultTemplate.bind({});
|
|
20
|
-
Default.args = {};
|
|
21
|
-
const BusyCircular = DefaultTemplate.bind({});
|
|
22
|
-
BusyCircular.args = { busy: true, busyVariant: "circular" };
|
|
23
|
-
const BusyLinear = DefaultTemplate.bind({});
|
|
24
|
-
BusyLinear.args = { busy: true, busyVariant: "linear" };
|
|
25
|
-
var ButtonEx_stories_default = StorybookEntry;
|
|
26
|
-
export {
|
|
27
|
-
BusyCircular,
|
|
28
|
-
BusyLinear,
|
|
29
|
-
Default,
|
|
30
|
-
ButtonEx_stories_default as default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=ButtonEx.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonEx.stories.tsx"],"sourcesContent":["import { Meta, StoryFn } from '@storybook/react'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\n\nimport { ButtonEx } from './ButtonEx'\n\nconst StorybookEntry = {\n argTypes: {},\n component: ButtonEx,\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'button/ButtonEx',\n} as Meta<typeof ButtonEx>\n\nconst DefaultTemplate: StoryFn<typeof ButtonEx> = (args) => (\n <FlexRow justifyContent=\"flex-start\">\n <FlexCol marginX={1}>\n <ButtonEx {...args}>Default</ButtonEx>\n </FlexCol>\n <FlexCol marginX={1}>\n <ButtonEx variant=\"outlined\" {...args}>\n Outlined\n </ButtonEx>\n </FlexCol>\n <FlexCol marginX={1}>\n <ButtonEx variant=\"contained\" {...args}>\n Contained\n </ButtonEx>\n </FlexCol>\n </FlexRow>\n)\n\nconst Default = DefaultTemplate.bind({})\nDefault.args = {}\n\nconst BusyCircular = DefaultTemplate.bind({})\nBusyCircular.args = { busy: true, busyVariant: 'circular' }\n\nconst BusyLinear = DefaultTemplate.bind({})\nBusyLinear.args = { busy: true, busyVariant: 'linear' }\n\nexport { BusyCircular, BusyLinear, Default }\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":"AAiBE,SAEI,KAFJ;AAhBF,SAAS,SAAS,eAAe;AAEjC,SAAS,gBAAgB;AAEzB,MAAM,iBAAiB;AAAA,EACrB,UAAU,CAAC;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,kBAA4C,CAAC,SACjD,qBAAC,WAAQ,gBAAe,cACtB;AAAA,sBAAC,WAAQ,SAAS,GAChB,8BAAC,YAAU,GAAG,MAAM,qBAAO,GAC7B;AAAA,EACA,oBAAC,WAAQ,SAAS,GAChB,8BAAC,YAAS,SAAQ,YAAY,GAAG,MAAM,sBAEvC,GACF;AAAA,EACA,oBAAC,WAAQ,SAAS,GAChB,8BAAC,YAAS,SAAQ,aAAa,GAAG,MAAM,uBAExC,GACF;AAAA,GACF;AAGF,MAAM,UAAU,gBAAgB,KAAK,CAAC,CAAC;AACvC,QAAQ,OAAO,CAAC;AAEhB,MAAM,eAAe,gBAAgB,KAAK,CAAC,CAAC;AAC5C,aAAa,OAAO,EAAE,MAAM,MAAM,aAAa,WAAW;AAE1D,MAAM,aAAa,gBAAgB,KAAK,CAAC,CAAC;AAC1C,WAAW,OAAO,EAAE,MAAM,MAAM,aAAa,SAAS;AAItD,IAAO,2BAAQ;","names":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, useTheme } from "@mui/material";
|
|
3
|
-
import { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from "@xylabs/react-shared";
|
|
4
|
-
import { forwardRef } from "react";
|
|
5
|
-
const ButtonExBase = forwardRef((props, ref) => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
const { busy, busyVariant = "linear", busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles(theme, props);
|
|
8
|
-
const localOnClick = (event) => {
|
|
9
|
-
if (!busy) {
|
|
10
|
-
onClick?.(event);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
return /* @__PURE__ */ jsxs(Button, { ref, onClick: localOnClick, ...rootProps, children: [
|
|
14
|
-
busy && busyVariant === "linear" ? /* @__PURE__ */ jsx(BusyLinearProgress, { rounded: true, opacity: busyOpacity ?? 0 }) : null,
|
|
15
|
-
busy && busyVariant === "circular" ? /* @__PURE__ */ jsx(BusyCircularProgress, { rounded: true, size: 24, opacity: busyOpacity ?? 0.5 }) : null,
|
|
16
|
-
children
|
|
17
|
-
] });
|
|
18
|
-
});
|
|
19
|
-
ButtonExBase.displayName = "ButtonExBaseXYLabs";
|
|
20
|
-
export {
|
|
21
|
-
ButtonExBase
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=ButtonExBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonExBase.tsx"],"sourcesContent":["import { Button, useTheme } from '@mui/material'\nimport { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'\nimport { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps'\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' ? <BusyLinearProgress rounded opacity={busyOpacity ?? 0} /> : null}\n {busy && busyVariant === 'circular' ? <BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} /> : null}\n {children}\n </Button>\n )\n})\n\nButtonExBase.displayName = 'ButtonExBaseXYLabs'\n\nexport { ButtonExBase }\n"],"mappings":"AAiBI,SACsC,KADtC;AAjBJ,SAAS,QAAQ,gBAAgB;AACjC,SAAS,sBAAsB,oBAAoB,0BAA0B;AAC7E,SAAS,kBAA8B;AAIvC,MAAM,eAAe,WAA6C,CAAC,OAAO,QAAQ;AAChF,QAAM,QAAQ,SAAS;AACvB,QAAM,EAAE,MAAM,cAAc,UAAU,aAAa,SAAS,UAAU,GAAG,UAAU,IAAI,mBAAkC,OAAO,KAAK;AAErI,QAAM,eAAe,CAAC,UAAyC;AAC7D,QAAI,CAAC,MAAM;AACT,gBAAU,KAAK;AAAA,IACjB;AAAA,EACF;AAEA,SACE,qBAAC,UAAO,KAAU,SAAS,cAAe,GAAG,WAC1C;AAAA,YAAQ,gBAAgB,WAAW,oBAAC,sBAAmB,SAAO,MAAC,SAAS,eAAe,GAAG,IAAK;AAAA,IAC/F,QAAQ,gBAAgB,aAAa,oBAAC,wBAAqB,SAAO,MAAC,MAAM,IAAI,SAAS,eAAe,KAAK,IAAK;AAAA,IAC/G;AAAA,KACH;AAEJ,CAAC;AAED,aAAa,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=ButtonExProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { useNavigate } from "react-router-dom";
|
|
4
|
-
import { ButtonExBase } from "./ButtonExBase";
|
|
5
|
-
const ButtonExTo = forwardRef(({ to, toOptions, onClick, ...props }, ref) => {
|
|
6
|
-
const navigate = useNavigate();
|
|
7
|
-
const localOnClick = (event) => {
|
|
8
|
-
onClick?.(event);
|
|
9
|
-
if (to) {
|
|
10
|
-
navigate(to, toOptions);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
return /* @__PURE__ */ jsx(ButtonExBase, { ref, onClick: localOnClick, ...props });
|
|
14
|
-
});
|
|
15
|
-
ButtonExTo.displayName = "ButtonExToXYLabs";
|
|
16
|
-
export {
|
|
17
|
-
ButtonExTo
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=ButtonExTo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonExTo.tsx"],"sourcesContent":["import React, { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\n\nconst ButtonExTo = 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\nButtonExTo.displayName = 'ButtonExToXYLabs'\n\nexport { ButtonExTo }\n"],"mappings":"AAeS;AAfT,SAAgB,kBAA8B;AAC9C,SAAS,mBAAmB;AAE5B,SAAS,oBAAoB;AAG7B,MAAM,aAAa,WAA6C,CAAC,EAAE,IAAI,WAAW,SAAS,GAAG,MAAM,GAAG,QAAQ;AAC7G,QAAM,WAAW,YAAY;AAC7B,QAAM,eAAe,CAAC,UAAyC;AAC7D,cAAU,KAAK;AACf,QAAI,IAAI;AACN,eAAS,IAAI,SAAS;AAAA,IACxB;AAAA,EACF;AAEA,SAAO,oBAAC,gBAAa,KAAU,SAAS,cAAe,GAAG,OAAO;AACnE,CAAC;AAED,WAAW,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './ButtonEx'\nexport * from './ButtonExProps'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var ButtonEx_exports = {};
|
|
20
|
-
__export(ButtonEx_exports, {
|
|
21
|
-
ButtonEx: () => ButtonEx
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(ButtonEx_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var import_ButtonExBase = require("./ButtonExBase");
|
|
27
|
-
var import_ButtonExTo = require("./ButtonExTo");
|
|
28
|
-
const ButtonEx = (0, import_react.forwardRef)(({ to, ...props }, ref) => {
|
|
29
|
-
if (to) {
|
|
30
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ButtonExTo.ButtonExTo, { to, ref, ...props });
|
|
31
|
-
} else {
|
|
32
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ButtonExBase.ButtonExBase, { ...props });
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
ButtonEx.displayName = "ButtonExXYLabs";
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
ButtonEx
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=ButtonEx.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonEx.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\nimport { ButtonExTo } from './ButtonExTo'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n if (to) {\n return <ButtonExTo to={to} ref={ref} {...props} />\n } else {\n return <ButtonExBase {...props} />\n }\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQW;AARX,mBAA2B;AAE3B,0BAA6B;AAE7B,wBAA2B;AAE3B,MAAM,eAAW,yBAA6C,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ;AACvF,MAAI,IAAI;AACN,WAAO,4CAAC,gCAAW,IAAQ,KAAW,GAAG,OAAO;AAAA,EAClD,OAAO;AACL,WAAO,4CAAC,oCAAc,GAAG,OAAO;AAAA,EAClC;AACF,CAAC;AAED,SAAS,cAAc;","names":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { ButtonExBase } from "./ButtonExBase";
|
|
4
|
-
import { ButtonExTo } from "./ButtonExTo";
|
|
5
|
-
const ButtonEx = forwardRef(({ to, ...props }, ref) => {
|
|
6
|
-
if (to) {
|
|
7
|
-
return /* @__PURE__ */ jsx(ButtonExTo, { to, ref, ...props });
|
|
8
|
-
} else {
|
|
9
|
-
return /* @__PURE__ */ jsx(ButtonExBase, { ...props });
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
ButtonEx.displayName = "ButtonExXYLabs";
|
|
13
|
-
export {
|
|
14
|
-
ButtonEx
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=ButtonEx.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonEx.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase'\nimport { ButtonExProps } from './ButtonExProps'\nimport { ButtonExTo } from './ButtonExTo'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n if (to) {\n return <ButtonExTo to={to} ref={ref} {...props} />\n } else {\n return <ButtonExBase {...props} />\n }\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n"],"mappings":"AAQW;AARX,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAE7B,SAAS,kBAAkB;AAE3B,MAAM,WAAW,WAA6C,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ;AACvF,MAAI,IAAI;AACN,WAAO,oBAAC,cAAW,IAAQ,KAAW,GAAG,OAAO;AAAA,EAClD,OAAO;AACL,WAAO,oBAAC,gBAAc,GAAG,OAAO;AAAA,EAClC;AACF,CAAC;AAED,SAAS,cAAc;","names":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var ButtonEx_stories_exports = {};
|
|
20
|
-
__export(ButtonEx_stories_exports, {
|
|
21
|
-
BusyCircular: () => BusyCircular,
|
|
22
|
-
BusyLinear: () => BusyLinear,
|
|
23
|
-
Default: () => Default,
|
|
24
|
-
default: () => ButtonEx_stories_default
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(ButtonEx_stories_exports);
|
|
27
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
29
|
-
var import_ButtonEx = require("./ButtonEx");
|
|
30
|
-
const StorybookEntry = {
|
|
31
|
-
argTypes: {},
|
|
32
|
-
component: import_ButtonEx.ButtonEx,
|
|
33
|
-
parameters: {
|
|
34
|
-
docs: {
|
|
35
|
-
page: null
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
title: "button/ButtonEx"
|
|
39
|
-
};
|
|
40
|
-
const DefaultTemplate = (args) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { justifyContent: "flex-start", children: [
|
|
41
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexCol, { marginX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ButtonEx.ButtonEx, { ...args, children: "Default" }) }),
|
|
42
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexCol, { marginX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ButtonEx.ButtonEx, { variant: "outlined", ...args, children: "Outlined" }) }),
|
|
43
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexCol, { marginX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ButtonEx.ButtonEx, { variant: "contained", ...args, children: "Contained" }) })
|
|
44
|
-
] });
|
|
45
|
-
const Default = DefaultTemplate.bind({});
|
|
46
|
-
Default.args = {};
|
|
47
|
-
const BusyCircular = DefaultTemplate.bind({});
|
|
48
|
-
BusyCircular.args = { busy: true, busyVariant: "circular" };
|
|
49
|
-
const BusyLinear = DefaultTemplate.bind({});
|
|
50
|
-
BusyLinear.args = { busy: true, busyVariant: "linear" };
|
|
51
|
-
var ButtonEx_stories_default = StorybookEntry;
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
BusyCircular,
|
|
55
|
-
BusyLinear,
|
|
56
|
-
Default
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=ButtonEx.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ButtonEx.stories.tsx"],"sourcesContent":["import { Meta, StoryFn } from '@storybook/react'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\n\nimport { ButtonEx } from './ButtonEx'\n\nconst StorybookEntry = {\n argTypes: {},\n component: ButtonEx,\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'button/ButtonEx',\n} as Meta<typeof ButtonEx>\n\nconst DefaultTemplate: StoryFn<typeof ButtonEx> = (args) => (\n <FlexRow justifyContent=\"flex-start\">\n <FlexCol marginX={1}>\n <ButtonEx {...args}>Default</ButtonEx>\n </FlexCol>\n <FlexCol marginX={1}>\n <ButtonEx variant=\"outlined\" {...args}>\n Outlined\n </ButtonEx>\n </FlexCol>\n <FlexCol marginX={1}>\n <ButtonEx variant=\"contained\" {...args}>\n Contained\n </ButtonEx>\n </FlexCol>\n </FlexRow>\n)\n\nconst Default = DefaultTemplate.bind({})\nDefault.args = {}\n\nconst BusyCircular = DefaultTemplate.bind({})\nBusyCircular.args = { busy: true, busyVariant: 'circular' }\n\nconst BusyLinear = DefaultTemplate.bind({})\nBusyLinear.args = { busy: true, busyVariant: 'linear' }\n\nexport { BusyCircular, BusyLinear, Default }\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBE;AAhBF,2BAAiC;AAEjC,sBAAyB;AAEzB,MAAM,iBAAiB;AAAA,EACrB,UAAU,CAAC;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,kBAA4C,CAAC,SACjD,6CAAC,gCAAQ,gBAAe,cACtB;AAAA,8CAAC,gCAAQ,SAAS,GAChB,sDAAC,4BAAU,GAAG,MAAM,qBAAO,GAC7B;AAAA,EACA,4CAAC,gCAAQ,SAAS,GAChB,sDAAC,4BAAS,SAAQ,YAAY,GAAG,MAAM,sBAEvC,GACF;AAAA,EACA,4CAAC,gCAAQ,SAAS,GAChB,sDAAC,4BAAS,SAAQ,aAAa,GAAG,MAAM,uBAExC,GACF;AAAA,GACF;AAGF,MAAM,UAAU,gBAAgB,KAAK,CAAC,CAAC;AACvC,QAAQ,OAAO,CAAC;AAEhB,MAAM,eAAe,gBAAgB,KAAK,CAAC,CAAC;AAC5C,aAAa,OAAO,EAAE,MAAM,MAAM,aAAa,WAAW;AAE1D,MAAM,aAAa,gBAAgB,KAAK,CAAC,CAAC;AAC1C,WAAW,OAAO,EAAE,MAAM,MAAM,aAAa,SAAS;AAItD,IAAO,2BAAQ;","names":[]}
|