@xyo-network/react-shared 2.25.66 → 2.25.69

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.
@@ -0,0 +1,8 @@
1
+ import { CardHeaderProps, CardProps, SvgIconProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export interface PageCardProps extends CardProps {
4
+ icon?: (props?: SvgIconProps) => ReactNode;
5
+ onRefresh?: () => void;
6
+ subheader?: CardHeaderProps['subheader'];
7
+ }
8
+ export declare const PageCard: React.FC<PageCardProps>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageCard = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const Refresh_1 = tslib_1.__importDefault(require("@mui/icons-material/Refresh"));
7
+ const material_1 = require("@mui/material");
8
+ const TypographyEx_1 = require("./TypographyEx");
9
+ const PageCard = (_a) => {
10
+ var { subheader, title, icon, onRefresh, children, style } = _a, props = tslib_1.__rest(_a, ["subheader", "title", "icon", "onRefresh", "children", "style"]);
11
+ return ((0, jsx_runtime_1.jsxs)(material_1.Card, Object.assign({ style: Object.assign({ position: 'relative' }, style) }, props, { children: [icon === null || icon === void 0 ? void 0 : icon({ style: { fontSize: 512, left: '-144px', opacity: 0.05, position: 'absolute', top: '-144px' } }), (0, jsx_runtime_1.jsx)(material_1.CardHeader, { title: (0, jsx_runtime_1.jsx)(TypographyEx_1.TypographyEx, Object.assign({ variant: "h4", gradient: "text" }, { children: title })), subheader: subheader, action: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: onRefresh ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => onRefresh === null || onRefresh === void 0 ? void 0 : onRefresh() }, { children: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}) }))) : null }) }), children] })));
12
+ };
13
+ exports.PageCard = PageCard;
14
+ //# sourceMappingURL=PageCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageCard.js","sourceRoot":"","sources":["../../../src/components/PageCard.tsx"],"names":[],"mappings":";;;;;AAAA,kFAAqD;AACrD,4CAAsG;AAGtG,iDAA6C;AAQtC,MAAM,QAAQ,GAA4B,CAAC,EAAgE,EAAE,EAAE;QAApE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,OAAY,EAAP,KAAK,sBAA9D,gEAAgE,CAAF;IAC9G,OAAO,CACL,wBAAC,eAAI,kBAAC,KAAK,kBAAI,QAAQ,EAAE,UAAU,IAAK,KAAK,KAAQ,KAAK,eACvD,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,EACzG,uBAAC,qBAAU,IACT,KAAK,EACH,uBAAC,2BAAY,kBAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,gBACvC,KAAK,IACO,EAEjB,SAAS,EAAE,SAAS,EACpB,MAAM,EACJ,2DACG,SAAS,CAAC,CAAC,CAAC,CACX,uBAAC,qBAAU,kBAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,EAAI,gBACtC,uBAAC,iBAAW,KAAG,IACJ,CACd,CAAC,CAAC,CAAC,IAAI,GACP,GAEL,EACD,QAAQ,KACJ,CACR,CAAA;AACH,CAAC,CAAA;AAxBY,QAAA,QAAQ,YAwBpB"}
@@ -4,6 +4,7 @@ export * from './ErrorBoundry';
4
4
  export * from './FullWidthCard';
5
5
  export * from './JsonRouteWrapper';
6
6
  export * from './ListItemButtonEx';
7
+ export * from './PageCard';
7
8
  export * from './Pipe';
8
9
  export * from './ScrollTableOnSm';
9
10
  export * from './SectionSpacingRow';
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./ErrorBoundry"), exports);
7
7
  tslib_1.__exportStar(require("./FullWidthCard"), exports);
8
8
  tslib_1.__exportStar(require("./JsonRouteWrapper"), exports);
9
9
  tslib_1.__exportStar(require("./ListItemButtonEx"), exports);
10
+ tslib_1.__exportStar(require("./PageCard"), exports);
10
11
  tslib_1.__exportStar(require("./Pipe"), exports);
11
12
  tslib_1.__exportStar(require("./ScrollTableOnSm"), exports);
12
13
  tslib_1.__exportStar(require("./SectionSpacingRow"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,sDAA2B;AAC3B,yDAA8B;AAC9B,0DAA+B;AAC/B,6DAAkC;AAClC,6DAAkC;AAClC,iDAAsB;AACtB,4DAAiC;AACjC,8DAAmC;AACnC,uDAA4B;AAC5B,sDAA2B;AAC3B,yDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,sDAA2B;AAC3B,yDAA8B;AAC9B,0DAA+B;AAC/B,6DAAkC;AAClC,6DAAkC;AAClC,qDAA0B;AAC1B,iDAAsB;AACtB,4DAAiC;AACjC,8DAAmC;AACnC,uDAA4B;AAC5B,sDAA2B;AAC3B,yDAA8B"}
@@ -0,0 +1,8 @@
1
+ import { CardHeaderProps, CardProps, SvgIconProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export interface PageCardProps extends CardProps {
4
+ icon?: (props?: SvgIconProps) => ReactNode;
5
+ onRefresh?: () => void;
6
+ subheader?: CardHeaderProps['subheader'];
7
+ }
8
+ export declare const PageCard: React.FC<PageCardProps>;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import RefreshIcon from '@mui/icons-material/Refresh';
3
+ import { Card, CardHeader, IconButton } from '@mui/material';
4
+ import { TypographyEx } from './TypographyEx';
5
+ export const PageCard = ({ subheader, title, icon, onRefresh, children, style, ...props }) => {
6
+ return (_jsxs(Card, { style: { position: 'relative', ...style }, ...props, children: [icon?.({ style: { fontSize: 512, left: '-144px', opacity: 0.05, position: 'absolute', top: '-144px' } }), _jsx(CardHeader, { title: _jsx(TypographyEx, { variant: "h4", gradient: "text", children: title }), subheader: subheader, action: _jsx(_Fragment, { children: onRefresh ? (_jsx(IconButton, { onClick: () => onRefresh?.(), children: _jsx(RefreshIcon, {}) })) : null }) }), children] }));
7
+ };
8
+ //# sourceMappingURL=PageCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageCard.js","sourceRoot":"","sources":["../../../src/components/PageCard.tsx"],"names":[],"mappings":";AAAA,OAAO,WAAW,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,UAAU,EAA8B,UAAU,EAAgB,MAAM,eAAe,CAAA;AAGtG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQ7C,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACpH,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,KAAM,KAAK,aACvD,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,EACzG,KAAC,UAAU,IACT,KAAK,EACH,KAAC,YAAY,IAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,YACvC,KAAK,GACO,EAEjB,SAAS,EAAE,SAAS,EACpB,MAAM,EACJ,4BACG,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,UAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,YACtC,KAAC,WAAW,KAAG,GACJ,CACd,CAAC,CAAC,CAAC,IAAI,GACP,GAEL,EACD,QAAQ,IACJ,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -4,6 +4,7 @@ export * from './ErrorBoundry';
4
4
  export * from './FullWidthCard';
5
5
  export * from './JsonRouteWrapper';
6
6
  export * from './ListItemButtonEx';
7
+ export * from './PageCard';
7
8
  export * from './Pipe';
8
9
  export * from './ScrollTableOnSm';
9
10
  export * from './SectionSpacingRow';
@@ -4,6 +4,7 @@ export * from './ErrorBoundry';
4
4
  export * from './FullWidthCard';
5
5
  export * from './JsonRouteWrapper';
6
6
  export * from './ListItemButtonEx';
7
+ export * from './PageCard';
7
8
  export * from './Pipe';
8
9
  export * from './ScrollTableOnSm';
9
10
  export * from './SectionSpacingRow';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -88,6 +88,6 @@
88
88
  },
89
89
  "sideEffects": false,
90
90
  "types": "dist/esm/index.d.ts",
91
- "version": "2.25.66",
91
+ "version": "2.25.69",
92
92
  "packageManager": "yarn@3.1.1"
93
93
  }
@@ -0,0 +1,62 @@
1
+ /* eslint-disable import/no-internal-modules */
2
+ import { CardContent, Typography } from '@mui/material'
3
+ import { ComponentStory, Meta } from '@storybook/react'
4
+ import { useState } from 'react'
5
+
6
+ import { PageCard } from './PageCard'
7
+
8
+ const StorybookEntry: Meta = {
9
+ argTypes: {
10
+ onRefresh: {
11
+ table: {
12
+ disable: true,
13
+ },
14
+ },
15
+ },
16
+ component: PageCard,
17
+ parameters: {
18
+ docs: {
19
+ page: null,
20
+ },
21
+ },
22
+ title: 'shared/PageCard',
23
+ }
24
+
25
+ const Template: ComponentStory<typeof PageCard> = (props) => {
26
+ const [refreshedValue, setRefreshedValue] = useState<number>(Math.random)
27
+ return (
28
+ <PageCard title="Page Card" subheader="subheader" onRefresh={() => setRefreshedValue(Math.random())} {...props}>
29
+ <CardContent>
30
+ <Typography variant="body1">Page Card Content</Typography>
31
+ <Typography variant="body1">Refreshed Value: {refreshedValue?.toString()}</Typography>
32
+ </CardContent>
33
+ </PageCard>
34
+ )
35
+ }
36
+
37
+ const TemplateWithNoOnRefresh: ComponentStory<typeof PageCard> = (props) => {
38
+ return (
39
+ <PageCard title="Page Card" subheader="subheader" {...props}>
40
+ <CardContent>
41
+ <Typography variant="body1">Page Card Content</Typography>
42
+ </CardContent>
43
+ </PageCard>
44
+ )
45
+ }
46
+
47
+ const Default = Template.bind({})
48
+ Default.args = {}
49
+ Default.parameters = {
50
+ actions: { argTypesRegex: '' },
51
+ }
52
+
53
+ const WithNoOnRefresh = TemplateWithNoOnRefresh.bind({})
54
+ WithNoOnRefresh.args = {}
55
+ WithNoOnRefresh.parameters = {
56
+ actions: { argTypesRegex: '' },
57
+ }
58
+
59
+ export { Default, WithNoOnRefresh }
60
+
61
+ // eslint-disable-next-line import/no-default-export
62
+ export default StorybookEntry
@@ -0,0 +1,37 @@
1
+ import RefreshIcon from '@mui/icons-material/Refresh'
2
+ import { Card, CardHeader, CardHeaderProps, CardProps, IconButton, SvgIconProps } from '@mui/material'
3
+ import { ReactNode } from 'react'
4
+
5
+ import { TypographyEx } from './TypographyEx'
6
+
7
+ export interface PageCardProps extends CardProps {
8
+ icon?: (props?: SvgIconProps) => ReactNode
9
+ onRefresh?: () => void
10
+ subheader?: CardHeaderProps['subheader']
11
+ }
12
+
13
+ export const PageCard: React.FC<PageCardProps> = ({ subheader, title, icon, onRefresh, children, style, ...props }) => {
14
+ return (
15
+ <Card style={{ position: 'relative', ...style }} {...props}>
16
+ {icon?.({ style: { fontSize: 512, left: '-144px', opacity: 0.05, position: 'absolute', top: '-144px' } })}
17
+ <CardHeader
18
+ title={
19
+ <TypographyEx variant="h4" gradient="text">
20
+ {title}
21
+ </TypographyEx>
22
+ }
23
+ subheader={subheader}
24
+ action={
25
+ <>
26
+ {onRefresh ? (
27
+ <IconButton onClick={() => onRefresh?.()}>
28
+ <RefreshIcon />
29
+ </IconButton>
30
+ ) : null}
31
+ </>
32
+ }
33
+ />
34
+ {children}
35
+ </Card>
36
+ )
37
+ }
@@ -4,6 +4,7 @@ export * from './ErrorBoundry'
4
4
  export * from './FullWidthCard'
5
5
  export * from './JsonRouteWrapper'
6
6
  export * from './ListItemButtonEx'
7
+ export * from './PageCard'
7
8
  export * from './Pipe'
8
9
  export * from './ScrollTableOnSm'
9
10
  export * from './SectionSpacingRow'