@xylabs/react-button 3.4.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +14 -2
- package/dist/browser/index.mjs +65 -0
- package/dist/browser/index.mjs.map +1 -0
- package/package.json +11 -31
- 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/xy.config.ts +12 -0
- package/dist/browser/components/ButtonEx.d.cts +0 -4
- package/dist/browser/components/ButtonEx.d.cts.map +0 -1
- package/dist/browser/components/ButtonEx.d.mts +0 -4
- package/dist/browser/components/ButtonEx.d.mts.map +0 -1
- package/dist/browser/components/ButtonEx.d.ts +0 -4
- package/dist/browser/components/ButtonEx.d.ts.map +0 -1
- package/dist/browser/components/ButtonExBase.d.cts +0 -4
- package/dist/browser/components/ButtonExBase.d.cts.map +0 -1
- package/dist/browser/components/ButtonExBase.d.mts +0 -4
- package/dist/browser/components/ButtonExBase.d.mts.map +0 -1
- package/dist/browser/components/ButtonExBase.d.ts +0 -4
- package/dist/browser/components/ButtonExBase.d.ts.map +0 -1
- package/dist/browser/components/ButtonExProps.d.cts +0 -10
- package/dist/browser/components/ButtonExProps.d.cts.map +0 -1
- package/dist/browser/components/ButtonExProps.d.mts +0 -10
- package/dist/browser/components/ButtonExProps.d.mts.map +0 -1
- package/dist/browser/components/ButtonExProps.d.ts +0 -10
- package/dist/browser/components/ButtonExProps.d.ts.map +0 -1
- package/dist/browser/components/ButtonExTo.d.cts +0 -4
- package/dist/browser/components/ButtonExTo.d.cts.map +0 -1
- package/dist/browser/components/ButtonExTo.d.mts +0 -4
- package/dist/browser/components/ButtonExTo.d.mts.map +0 -1
- package/dist/browser/components/ButtonExTo.d.ts +0 -4
- package/dist/browser/components/ButtonExTo.d.ts.map +0 -1
- package/dist/browser/components/index.d.cts +0 -3
- package/dist/browser/components/index.d.cts.map +0 -1
- package/dist/browser/components/index.d.mts +0 -3
- package/dist/browser/components/index.d.mts.map +0 -1
- package/dist/browser/components/index.d.ts +0 -3
- package/dist/browser/components/index.d.ts.map +0 -1
- package/dist/browser/index.cjs +0 -73
- package/dist/browser/index.cjs.map +0 -1
- package/dist/browser/index.d.cts +0 -2
- package/dist/browser/index.d.cts.map +0 -1
- package/dist/browser/index.d.mts +0 -2
- package/dist/browser/index.d.mts.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -50
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/components/ButtonEx.d.cts +0 -4
- package/dist/neutral/components/ButtonEx.d.cts.map +0 -1
- package/dist/neutral/components/ButtonEx.d.mts +0 -4
- package/dist/neutral/components/ButtonEx.d.mts.map +0 -1
- package/dist/neutral/components/ButtonEx.d.ts +0 -4
- package/dist/neutral/components/ButtonEx.d.ts.map +0 -1
- package/dist/neutral/components/ButtonExBase.d.cts +0 -4
- package/dist/neutral/components/ButtonExBase.d.cts.map +0 -1
- package/dist/neutral/components/ButtonExBase.d.mts +0 -4
- package/dist/neutral/components/ButtonExBase.d.mts.map +0 -1
- package/dist/neutral/components/ButtonExBase.d.ts +0 -4
- package/dist/neutral/components/ButtonExBase.d.ts.map +0 -1
- package/dist/neutral/components/ButtonExProps.d.cts +0 -10
- package/dist/neutral/components/ButtonExProps.d.cts.map +0 -1
- package/dist/neutral/components/ButtonExProps.d.mts +0 -10
- package/dist/neutral/components/ButtonExProps.d.mts.map +0 -1
- package/dist/neutral/components/ButtonExProps.d.ts +0 -10
- package/dist/neutral/components/ButtonExProps.d.ts.map +0 -1
- package/dist/neutral/components/ButtonExTo.d.cts +0 -4
- package/dist/neutral/components/ButtonExTo.d.cts.map +0 -1
- package/dist/neutral/components/ButtonExTo.d.mts +0 -4
- package/dist/neutral/components/ButtonExTo.d.mts.map +0 -1
- package/dist/neutral/components/ButtonExTo.d.ts +0 -4
- package/dist/neutral/components/ButtonExTo.d.ts.map +0 -1
- package/dist/neutral/components/index.d.cts +0 -3
- package/dist/neutral/components/index.d.cts.map +0 -1
- package/dist/neutral/components/index.d.mts +0 -3
- package/dist/neutral/components/index.d.mts.map +0 -1
- package/dist/neutral/components/index.d.ts +0 -3
- package/dist/neutral/components/index.d.ts.map +0 -1
- package/dist/neutral/index.cjs +0 -73
- package/dist/neutral/index.cjs.map +0 -1
- package/dist/neutral/index.d.cts +0 -2
- package/dist/neutral/index.d.cts.map +0 -1
- package/dist/neutral/index.d.mts +0 -2
- package/dist/neutral/index.d.mts.map +0 -1
- package/dist/neutral/index.d.ts +0 -2
- package/dist/neutral/index.d.ts.map +0 -1
- package/dist/neutral/index.js +0 -50
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/components/ButtonEx.d.cts +0 -4
- package/dist/node/components/ButtonEx.d.cts.map +0 -1
- package/dist/node/components/ButtonEx.d.mts +0 -4
- package/dist/node/components/ButtonEx.d.mts.map +0 -1
- package/dist/node/components/ButtonEx.d.ts +0 -4
- package/dist/node/components/ButtonEx.d.ts.map +0 -1
- package/dist/node/components/ButtonExBase.d.cts +0 -4
- package/dist/node/components/ButtonExBase.d.cts.map +0 -1
- package/dist/node/components/ButtonExBase.d.mts +0 -4
- package/dist/node/components/ButtonExBase.d.mts.map +0 -1
- package/dist/node/components/ButtonExBase.d.ts +0 -4
- package/dist/node/components/ButtonExBase.d.ts.map +0 -1
- package/dist/node/components/ButtonExProps.d.cts +0 -10
- package/dist/node/components/ButtonExProps.d.cts.map +0 -1
- package/dist/node/components/ButtonExProps.d.mts +0 -10
- package/dist/node/components/ButtonExProps.d.mts.map +0 -1
- package/dist/node/components/ButtonExProps.d.ts +0 -10
- package/dist/node/components/ButtonExProps.d.ts.map +0 -1
- package/dist/node/components/ButtonExTo.d.cts +0 -4
- package/dist/node/components/ButtonExTo.d.cts.map +0 -1
- package/dist/node/components/ButtonExTo.d.mts +0 -4
- package/dist/node/components/ButtonExTo.d.mts.map +0 -1
- package/dist/node/components/ButtonExTo.d.ts +0 -4
- package/dist/node/components/ButtonExTo.d.ts.map +0 -1
- package/dist/node/components/index.d.cts +0 -3
- package/dist/node/components/index.d.cts.map +0 -1
- package/dist/node/components/index.d.mts +0 -3
- package/dist/node/components/index.d.mts.map +0 -1
- package/dist/node/components/index.d.ts +0 -3
- package/dist/node/components/index.d.ts.map +0 -1
- package/dist/node/index.cjs +0 -77
- package/dist/node/index.cjs.map +0 -1
- package/dist/node/index.d.cts +0 -2
- package/dist/node/index.d.cts.map +0 -1
- package/dist/node/index.d.mts +0 -2
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.js +0 -50
- package/dist/node/index.js.map +0 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
import { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared';
|
|
4
|
+
import { To, NavigateOptions } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
interface ButtonExProps extends Omit<ButtonProps, 'ref'>, BoxlikeComponentProps, BusyProps {
|
|
7
|
+
target?: string;
|
|
8
|
+
to?: To;
|
|
9
|
+
toOptions?: NavigateOptions;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const ButtonEx: React.ForwardRefExoticComponent<ButtonExProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
|
|
14
|
+
export { ButtonEx, type ButtonExProps };
|
|
@@ -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"]}
|
package/package.json
CHANGED
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
"packages/*"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xylabs/react-shared": "^
|
|
17
|
-
"react-router-dom": "^6.
|
|
16
|
+
"@xylabs/react-shared": "^4.0.0",
|
|
17
|
+
"react-router-dom": "^6.26.0"
|
|
18
18
|
},
|
|
19
19
|
"description": "Common React library for all XY Labs projects that use React",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@storybook/react": "^8.2.
|
|
21
|
+
"@storybook/react": "^8.2.9",
|
|
22
22
|
"@types/react": "^18.3.3",
|
|
23
|
-
"@xylabs/react-flexbox": "^
|
|
24
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
25
|
-
"@xylabs/tsconfig-react": "^
|
|
23
|
+
"@xylabs/react-flexbox": "^4.0.0",
|
|
24
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
|
|
25
|
+
"@xylabs/tsconfig-react": "^4.0.0-rc.15",
|
|
26
26
|
"react": "^18.3.1",
|
|
27
|
-
"typescript": "^5.5.
|
|
27
|
+
"typescript": "^5.5.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@mui/material": "^5",
|
|
@@ -33,33 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"types": "./dist/node/index.d.mts",
|
|
39
|
-
"default": "./dist/node/index.js"
|
|
40
|
-
},
|
|
41
|
-
"require": {
|
|
42
|
-
"types": "./dist/node/index.d.cts",
|
|
43
|
-
"default": "./dist/node/index.cjs"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"browser": {
|
|
47
|
-
"import": {
|
|
48
|
-
"types": "./dist/browser/index.d.mts",
|
|
49
|
-
"default": "./dist/browser/index.js"
|
|
50
|
-
},
|
|
51
|
-
"require": {
|
|
52
|
-
"types": "./dist/browser/index.d.cts",
|
|
53
|
-
"default": "./dist/browser/index.cjs"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"default": "./dist/browser/index.js"
|
|
36
|
+
"types": "./dist/browser/index.d.ts",
|
|
37
|
+
"default": "./dist/browser/index.mjs"
|
|
57
38
|
},
|
|
58
39
|
"./package.json": "./package.json"
|
|
59
40
|
},
|
|
60
41
|
"types": "dist/browser/index.d.ts",
|
|
61
|
-
"
|
|
62
|
-
"module": "./dist/browser/index.js",
|
|
42
|
+
"module": "./dist/browser/index.mjs",
|
|
63
43
|
"homepage": "https://xylabs.com",
|
|
64
44
|
"keywords": [
|
|
65
45
|
"utility",
|
|
@@ -75,6 +55,6 @@
|
|
|
75
55
|
"url": "https://github.com/xylabs/sdk-react.git"
|
|
76
56
|
},
|
|
77
57
|
"sideEffects": false,
|
|
78
|
-
"version": "
|
|
58
|
+
"version": "4.0.0",
|
|
79
59
|
"type": "module"
|
|
80
60
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
-
import { ButtonEx } from '@xylabs/react-button'
|
|
3
2
|
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { ButtonEx } from './ButtonEx.tsx'
|
|
4
6
|
|
|
5
7
|
const StorybookEntry = {
|
|
6
8
|
argTypes: {},
|
|
@@ -13,7 +15,7 @@ const StorybookEntry = {
|
|
|
13
15
|
title: 'button/ButtonEx',
|
|
14
16
|
} as Meta<typeof ButtonEx>
|
|
15
17
|
|
|
16
|
-
const DefaultTemplate: StoryFn<typeof ButtonEx> =
|
|
18
|
+
const DefaultTemplate: StoryFn<typeof ButtonEx> = args => (
|
|
17
19
|
<FlexRow justifyContent="flex-start">
|
|
18
20
|
<FlexCol marginX={1}>
|
|
19
21
|
<ButtonEx {...args}>Default</ButtonEx>
|
|
@@ -41,5 +43,5 @@ const BusyLinear = DefaultTemplate.bind({})
|
|
|
41
43
|
BusyLinear.args = { busy: true, busyVariant: 'linear' }
|
|
42
44
|
|
|
43
45
|
export { BusyCircular, BusyLinear, Default }
|
|
44
|
-
|
|
46
|
+
|
|
45
47
|
export default StorybookEntry
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { forwardRef } from 'react'
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
|
-
import { ButtonExBase } from './ButtonExBase.
|
|
4
|
-
import { ButtonExProps } from './ButtonExProps.
|
|
5
|
-
import { ButtonToEx } from './ButtonExTo.
|
|
3
|
+
import { ButtonExBase } from './ButtonExBase.tsx'
|
|
4
|
+
import { ButtonExProps } from './ButtonExProps.tsx'
|
|
5
|
+
import { ButtonToEx } from './ButtonExTo.tsx'
|
|
6
6
|
|
|
7
7
|
const ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {
|
|
8
8
|
return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Button, useTheme } from '@mui/material'
|
|
2
2
|
import { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'
|
|
3
|
-
import { forwardRef, MouseEvent } from 'react'
|
|
3
|
+
import React, { forwardRef, MouseEvent } from 'react'
|
|
4
4
|
|
|
5
|
-
import { ButtonExProps } from './ButtonExProps.
|
|
5
|
+
import { ButtonExProps } from './ButtonExProps.tsx'
|
|
6
6
|
|
|
7
7
|
const ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {
|
|
8
8
|
const theme = useTheme()
|
|
@@ -16,12 +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
|
-
<BusyLinearProgress rounded opacity={busyOpacity ?? 0} />
|
|
21
|
-
|
|
22
|
-
{busy && busyVariant === 'circular'
|
|
23
|
-
<BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />
|
|
24
|
-
|
|
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}
|
|
25
25
|
{children}
|
|
26
26
|
</Button>
|
|
27
27
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { forwardRef, MouseEvent } from 'react'
|
|
1
|
+
import React, { forwardRef, MouseEvent } from 'react'
|
|
2
2
|
import { useNavigate } from 'react-router-dom'
|
|
3
3
|
|
|
4
|
-
import { ButtonExBase } from './ButtonExBase.
|
|
5
|
-
import { ButtonExProps } from './ButtonExProps.
|
|
4
|
+
import { ButtonExBase } from './ButtonExBase.tsx'
|
|
5
|
+
import { ButtonExProps } from './ButtonExProps.tsx'
|
|
6
6
|
|
|
7
7
|
const ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {
|
|
8
8
|
const navigate = useNavigate()
|
package/src/components/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './ButtonEx.
|
|
2
|
-
export * from './ButtonExProps.
|
|
1
|
+
export * from './ButtonEx.tsx'
|
|
2
|
+
export * from './ButtonExProps.tsx'
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './components/index.
|
|
1
|
+
export * from './components/index.ts'
|
package/xy.config.ts
ADDED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,6GAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,6GAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,6GAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,YAAY,6GAqBhB,CAAA;AAIF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,YAAY,6GAqBhB,CAAA;AAIF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExBase.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExBase.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,YAAY,6GAqBhB,CAAA;AAIF,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ButtonProps } from '@mui/material';
|
|
2
|
-
import { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared';
|
|
3
|
-
import type { NavigateOptions, To } from 'react-router-dom';
|
|
4
|
-
interface ButtonExProps extends Omit<ButtonProps, 'ref'>, BoxlikeComponentProps, BusyProps {
|
|
5
|
-
target?: string;
|
|
6
|
-
to?: To;
|
|
7
|
-
toOptions?: NavigateOptions;
|
|
8
|
-
}
|
|
9
|
-
export type { ButtonExProps };
|
|
10
|
-
//# sourceMappingURL=ButtonExProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExProps.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAE3D,UAAU,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,qBAAqB,EAAE,SAAS;IACxF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED,YAAY,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ButtonProps } from '@mui/material';
|
|
2
|
-
import { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared';
|
|
3
|
-
import type { NavigateOptions, To } from 'react-router-dom';
|
|
4
|
-
interface ButtonExProps extends Omit<ButtonProps, 'ref'>, BoxlikeComponentProps, BusyProps {
|
|
5
|
-
target?: string;
|
|
6
|
-
to?: To;
|
|
7
|
-
toOptions?: NavigateOptions;
|
|
8
|
-
}
|
|
9
|
-
export type { ButtonExProps };
|
|
10
|
-
//# sourceMappingURL=ButtonExProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExProps.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAE3D,UAAU,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,qBAAqB,EAAE,SAAS;IACxF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED,YAAY,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ButtonProps } from '@mui/material';
|
|
2
|
-
import { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared';
|
|
3
|
-
import type { NavigateOptions, To } from 'react-router-dom';
|
|
4
|
-
interface ButtonExProps extends Omit<ButtonProps, 'ref'>, BoxlikeComponentProps, BusyProps {
|
|
5
|
-
target?: string;
|
|
6
|
-
to?: To;
|
|
7
|
-
toOptions?: NavigateOptions;
|
|
8
|
-
}
|
|
9
|
-
export type { ButtonExProps };
|
|
10
|
-
//# sourceMappingURL=ButtonExProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExProps.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAE3D,UAAU,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,qBAAqB,EAAE,SAAS;IACxF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED,YAAY,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,UAAU,6GAUd,CAAA;AAIF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,UAAU,6GAUd,CAAA;AAIF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonExTo.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonExTo.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,QAAA,MAAM,UAAU,6GAUd,CAAA;AAIF,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
|
package/dist/browser/index.cjs
DELETED
|
@@ -1,73 +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
|
-
|
|
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?.(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?.(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
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["export * from './components/index.js'\n","import { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase.jsx'\nimport { ButtonExProps } from './ButtonExProps.jsx'\nimport { ButtonToEx } from './ButtonExTo.jsx'\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.jsx'\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.jsx'\nimport { ButtonExProps } from './ButtonExProps.jsx'\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,gBAAU,KAAK;AAAA,IACjB;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,cAAU,KAAK;AACf,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"]}
|
package/dist/browser/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
|
package/dist/browser/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
|
package/dist/browser/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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?.(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?.(event);
|
|
33
|
-
if (to) {
|
|
34
|
-
navigate(to, toOptions);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
return /* @__PURE__ */ jsx2(ButtonExBase, { ref, onClick: localOnClick, ...props });
|
|
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
|
-
};
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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.jsx'\nimport { ButtonExProps } from './ButtonExProps.jsx'\nimport { ButtonToEx } from './ButtonExTo.jsx'\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.jsx'\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.jsx'\nimport { ButtonExProps } from './ButtonExProps.jsx'\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,gBAAU,KAAK;AAAA,IACjB;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,cAAU,KAAK;AACf,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonEx.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonEx.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,QAAA,MAAM,QAAQ,6GAEZ,CAAA;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|