@zesty-io/material 0.11.0 → 0.12.1
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/es/SSOButton/SSOButton.stories.d.ts +7 -0
- package/es/SSOButton/SSOButton.stories.js +22 -0
- package/es/SSOButton/index.d.ts +26 -0
- package/es/SSOButton/index.js +26 -0
- package/{cjs/FieldTypeSort/FieldTypeSort.stories.d.ts → es/SSOButtonGroup/SSOButtonGroup.stories.d.ts} +2 -2
- package/es/SSOButtonGroup/SSOButtonGroup.stories.js +21 -0
- package/es/SSOButtonGroup/index.d.ts +30 -0
- package/es/SSOButtonGroup/index.js +30 -0
- package/es/icons/Github.d.ts +3 -0
- package/es/icons/Github.js +3 -0
- package/es/icons/Google.d.ts +3 -0
- package/es/icons/Google.js +3 -0
- package/es/icons/ImageSync.d.ts +3 -0
- package/es/icons/ImageSync.js +3 -0
- package/es/icons/Microsoft.d.ts +3 -0
- package/es/icons/Microsoft.js +3 -0
- package/es/icons/index.d.ts +4 -0
- package/es/icons/index.js +4 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/theme/index.js +6 -1
- package/es/utils/useSSO.d.ts +2 -0
- package/es/utils/useSSO.js +33 -0
- package/package.json +6 -2
- package/cjs/ConfirmDialog/ConfirmDialog.stories.d.ts +0 -6
- package/cjs/ConfirmDialog/ConfirmDialog.stories.js +0 -27
- package/cjs/ConfirmDialog/index.d.ts +0 -18
- package/cjs/ConfirmDialog/index.js +0 -13
- package/cjs/CopyButton/CopyButton.stories.d.ts +0 -5
- package/cjs/CopyButton/CopyButton.stories.js +0 -17
- package/cjs/CopyButton/index.d.ts +0 -10
- package/cjs/CopyButton/index.js +0 -28
- package/cjs/FieldTypeColor/FieldTypeColor.stories.d.ts +0 -5
- package/cjs/FieldTypeColor/FieldTypeColor.stories.js +0 -24
- package/cjs/FieldTypeColor/index.d.ts +0 -6
- package/cjs/FieldTypeColor/index.js +0 -18
- package/cjs/FieldTypeDate/FieldTypeDate.stories.d.ts +0 -5
- package/cjs/FieldTypeDate/FieldTypeDate.stories.js +0 -20
- package/cjs/FieldTypeDate/index.d.ts +0 -9
- package/cjs/FieldTypeDate/index.js +0 -12
- package/cjs/FieldTypeDateTime/FieldTypeDateTime.stories.d.ts +0 -5
- package/cjs/FieldTypeDateTime/FieldTypeDateTime.stories.js +0 -20
- package/cjs/FieldTypeDateTime/index.d.ts +0 -9
- package/cjs/FieldTypeDateTime/index.js +0 -12
- package/cjs/FieldTypeNumber/FieldTypeNumber.stories.d.ts +0 -5
- package/cjs/FieldTypeNumber/FieldTypeNumber.stories.js +0 -24
- package/cjs/FieldTypeNumber/index.d.ts +0 -6
- package/cjs/FieldTypeNumber/index.js +0 -9
- package/cjs/FieldTypeOneToMany/FieldTypeOneToMany.stories.d.ts +0 -5
- package/cjs/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +0 -31
- package/cjs/FieldTypeOneToMany/index.d.ts +0 -32
- package/cjs/FieldTypeOneToMany/index.js +0 -31
- package/cjs/FieldTypeOneToOne/FieldTypeOneToOne.stories.d.ts +0 -5
- package/cjs/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +0 -31
- package/cjs/FieldTypeOneToOne/index.d.ts +0 -34
- package/cjs/FieldTypeOneToOne/index.js +0 -35
- package/cjs/FieldTypeSort/FieldTypeSort.stories.js +0 -25
- package/cjs/FieldTypeSort/index.d.ts +0 -7
- package/cjs/FieldTypeSort/index.js +0 -36
- package/cjs/FieldTypeText/FieldTypeText.stories.d.ts +0 -6
- package/cjs/FieldTypeText/FieldTypeText.stories.js +0 -32
- package/cjs/FieldTypeText/index.d.ts +0 -12
- package/cjs/FieldTypeText/index.js +0 -9
- package/cjs/FieldTypeUrl/FieldTypeUrl.stories.d.ts +0 -5
- package/cjs/FieldTypeUrl/FieldTypeUrl.stories.js +0 -24
- package/cjs/FieldTypeUrl/index.d.ts +0 -12
- package/cjs/FieldTypeUrl/index.js +0 -16
- package/cjs/LegacyTheme/index.d.ts +0 -3
- package/cjs/LegacyTheme/index.js +0 -83
- package/cjs/LegacyTheme/palette.d.ts +0 -3
- package/cjs/LegacyTheme/palette.js +0 -25
- package/cjs/LegacyTheme/typography.d.ts +0 -3
- package/cjs/LegacyTheme/typography.js +0 -6
- package/cjs/VitualizedAutocomplete/VirtualizedAutocomplete.stories.d.ts +0 -5
- package/cjs/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +0 -30
- package/cjs/VitualizedAutocomplete/index.d.ts +0 -28
- package/cjs/VitualizedAutocomplete/index.js +0 -23
- package/cjs/index.d.ts +0 -14
- package/cjs/index.js +0 -31
- package/cjs/theme/Theme.stories.d.ts +0 -4
- package/cjs/theme/Theme.stories.js +0 -13
- package/cjs/theme/index.d.ts +0 -3
- package/cjs/theme/index.js +0 -52
- package/cjs/theme/palette.d.ts +0 -15
- package/cjs/theme/palette.js +0 -138
- package/cjs/theme/typography.d.ts +0 -9
- package/cjs/theme/typography.js +0 -59
- package/cjs/utils/virtualization.d.ts +0 -2
- package/cjs/utils/virtualization.js +0 -66
- package/es/ConfirmModal/ConfirmModal.stories.d.ts +0 -6
- package/es/ConfirmModal/ConfirmModal.stories.js +0 -24
- package/es/ConfirmModal/index.d.ts +0 -18
- package/es/ConfirmModal/index.js +0 -11
- package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.d.ts +0 -5
- package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.js +0 -35
- package/es/FieldTypeDropdown/index.d.ts +0 -11
- package/es/FieldTypeDropdown/index.js +0 -10
- package/es/stories/Theme.stories.d.ts +0 -4
- package/es/stories/Theme.stories.js +0 -10
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Story, Meta } from "@storybook/react/types-6-0";
|
|
2
|
+
import { SSOButtonProps } from ".";
|
|
3
|
+
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Google: Story<SSOButtonProps>;
|
|
6
|
+
export declare const Microsoft: Story<SSOButtonProps>;
|
|
7
|
+
export declare const Github: Story<SSOButtonProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import SSOButton from ".";
|
|
3
|
+
export default {
|
|
4
|
+
title: "SSOButton",
|
|
5
|
+
component: SSOButton,
|
|
6
|
+
argType: {},
|
|
7
|
+
};
|
|
8
|
+
const Template = (args) => {
|
|
9
|
+
return _jsx(SSOButton, { ...args });
|
|
10
|
+
};
|
|
11
|
+
export const Google = Template.bind({});
|
|
12
|
+
export const Microsoft = Template.bind({});
|
|
13
|
+
export const Github = Template.bind({});
|
|
14
|
+
Google.args = {
|
|
15
|
+
service: "google",
|
|
16
|
+
};
|
|
17
|
+
Microsoft.args = {
|
|
18
|
+
service: "azure",
|
|
19
|
+
};
|
|
20
|
+
Github.args = {
|
|
21
|
+
service: "github",
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonProps, SxProps, Theme } from "@mui/material";
|
|
3
|
+
import { SSOService } from "../utils/useSSO";
|
|
4
|
+
/**
|
|
5
|
+
* Props for the SSOButton component.
|
|
6
|
+
*/
|
|
7
|
+
export interface SSOButtonProps {
|
|
8
|
+
/**
|
|
9
|
+
* Specifies the SSO service to use.
|
|
10
|
+
*/
|
|
11
|
+
service: SSOService;
|
|
12
|
+
/**
|
|
13
|
+
* Optional styling properties.
|
|
14
|
+
*/
|
|
15
|
+
sx?: SxProps<Theme>;
|
|
16
|
+
/**
|
|
17
|
+
* Optional click handler that returns the selected SSO service.
|
|
18
|
+
*/
|
|
19
|
+
onClick?: (service: SSOService) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Optional properties for underlying MUI Button component.
|
|
22
|
+
*/
|
|
23
|
+
ButtonProps?: ButtonProps;
|
|
24
|
+
}
|
|
25
|
+
declare const SSOButton: ({ sx, service, onClick, ButtonProps }: SSOButtonProps) => JSX.Element;
|
|
26
|
+
export default SSOButton;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@mui/material";
|
|
3
|
+
import { Github, Google, Microsoft } from "../icons";
|
|
4
|
+
const ssoServiceMap = {
|
|
5
|
+
"google": {
|
|
6
|
+
name: "Google",
|
|
7
|
+
icon: _jsx(Google, {}),
|
|
8
|
+
},
|
|
9
|
+
"azure": {
|
|
10
|
+
name: "Microsoft",
|
|
11
|
+
icon: _jsx(Microsoft, {}),
|
|
12
|
+
},
|
|
13
|
+
"github": {
|
|
14
|
+
name: "Github",
|
|
15
|
+
icon: _jsx(Github, {}),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const SSOButton = ({ sx, service, onClick, ButtonProps }) => {
|
|
19
|
+
const ssoService = ssoServiceMap[service];
|
|
20
|
+
return (_jsxs(Button, { size: "large", variant: "outlined", color: "inherit", onClick: () => {
|
|
21
|
+
if (onClick) {
|
|
22
|
+
onClick(service);
|
|
23
|
+
}
|
|
24
|
+
}, startIcon: ssoService.icon, sx: { justifyContent: "flex-start", ...sx }, ...ButtonProps, children: ["Continue with ", ssoService.name] }, service));
|
|
25
|
+
};
|
|
26
|
+
export default SSOButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
2
|
-
import {
|
|
2
|
+
import { SSOButtonGroupProps } from '.';
|
|
3
3
|
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
4
4
|
export default _default;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const Google: Story<SSOButtonGroupProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import SSOButtonGroup from '.';
|
|
3
|
+
import SSOButton from '../SSOButton';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'SSOButtonGroup',
|
|
6
|
+
component: SSOButtonGroup,
|
|
7
|
+
argType: {},
|
|
8
|
+
};
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
return (_jsxs(SSOButtonGroup, { ...args, children: [_jsx(SSOButton, { service: 'google' }), _jsx(SSOButton, { service: 'azure' }), _jsx(SSOButton, { service: 'github' })] }));
|
|
11
|
+
};
|
|
12
|
+
export const Google = Template.bind({});
|
|
13
|
+
Google.args = {
|
|
14
|
+
authServiceUrl: "https://auth.api.dev.zesty.io",
|
|
15
|
+
onSuccess: () => {
|
|
16
|
+
console.log('exittoooo');
|
|
17
|
+
},
|
|
18
|
+
onError: (error) => {
|
|
19
|
+
console.log(error);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SxProps, Theme } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Props for the SSOButtonGroup component.
|
|
5
|
+
*/
|
|
6
|
+
export interface SSOButtonGroupProps {
|
|
7
|
+
/**
|
|
8
|
+
* React elements to be rendered within the group.
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The URL endpoint for the authentication service.
|
|
13
|
+
*/
|
|
14
|
+
authServiceUrl: string;
|
|
15
|
+
/**
|
|
16
|
+
* Callback invoked upon successful authentication.
|
|
17
|
+
*/
|
|
18
|
+
onSuccess: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Callback invoked when an error occurs during authentication.
|
|
21
|
+
* @param error - Description or details of the error.
|
|
22
|
+
*/
|
|
23
|
+
onError: (error: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Optional styling properties.
|
|
26
|
+
*/
|
|
27
|
+
sx?: SxProps<Theme>;
|
|
28
|
+
}
|
|
29
|
+
declare const SSOButtonGroup: ({ children, sx, authServiceUrl, onSuccess, onError, }: SSOButtonGroupProps) => JSX.Element;
|
|
30
|
+
export default SSOButtonGroup;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
|
+
import { useSSO } from "../utils/useSSO";
|
|
5
|
+
const SSOButtonGroup = ({ children, sx, authServiceUrl, onSuccess, onError, }) => {
|
|
6
|
+
const [initiate, isAuthenticated, ssoError] = useSSO(authServiceUrl);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (isAuthenticated && onSuccess) {
|
|
9
|
+
onSuccess();
|
|
10
|
+
}
|
|
11
|
+
else if (ssoError && onError) {
|
|
12
|
+
onError(ssoError);
|
|
13
|
+
}
|
|
14
|
+
}, [isAuthenticated, ssoError]);
|
|
15
|
+
return (_jsx(Box, { display: "flex", flexDirection: "column", gap: 2, sx: sx, children: React.Children.map(children, (child) => {
|
|
16
|
+
if (React.isValidElement(child)) {
|
|
17
|
+
return React.cloneElement(child, {
|
|
18
|
+
...child.props,
|
|
19
|
+
authServiceUrl,
|
|
20
|
+
onSuccess,
|
|
21
|
+
onError,
|
|
22
|
+
onClick: (service) => {
|
|
23
|
+
initiate(service);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return child;
|
|
28
|
+
}) }));
|
|
29
|
+
};
|
|
30
|
+
export default SSOButtonGroup;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
export const Github = (props) => (_jsx(SvgIcon, { ...props, children: _jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.7998 1.00001C8.99838 0.99788 6.28774 1.99327 4.15345 3.80786C2.01917 5.62244 0.600696 8.13766 0.152147 10.9029C-0.296401 13.6682 0.254281 16.5028 1.70554 18.899C3.15681 21.2952 5.41383 23.0964 8.07227 23.9799C8.66262 24.0872 8.8773 23.7229 8.8773 23.4107C8.8773 23.131 8.86754 22.3894 8.86103 21.4054C5.58237 22.1178 4.88956 19.8247 4.88956 19.8247C4.35288 18.4618 3.58037 18.1008 3.58037 18.1008C2.51026 17.3689 3.66169 17.3836 3.66169 17.3836C4.84565 17.4665 5.4669 18.5984 5.4669 18.5984C6.51913 20.4004 8.22677 19.88 8.89844 19.5775C9.00578 18.8163 9.31153 18.2959 9.64655 18.0016C7.02817 17.7039 4.27644 16.6924 4.27644 12.1744C4.25941 11.003 4.69452 9.87012 5.4913 9.01126C5.36933 8.71201 4.96437 7.51504 5.60514 5.88872C5.60514 5.88872 6.5972 5.57322 8.84802 7.09871C9.81019 6.83705 10.8027 6.70363 11.7998 6.70188C12.7969 6.70376 13.7894 6.83718 14.7516 7.09871C17.0024 5.57322 17.9912 5.89035 17.9912 5.89035C18.6352 7.51342 18.2303 8.71201 18.1083 9.01126C18.8645 9.8358 19.3199 10.8864 19.3199 12.1744C19.3199 16.7037 16.5633 17.7007 13.9368 17.9918C14.3596 18.3561 14.7369 19.0766 14.7369 20.1759C14.7369 21.7535 14.7223 23.0236 14.7223 23.4107C14.7223 23.7262 14.9353 24.0937 15.5338 23.9783C18.1917 23.0937 20.4479 21.2917 21.8981 18.895C23.3483 16.4984 23.8979 13.6637 23.4484 10.8988C22.9989 8.13384 21.5797 5.61925 19.4449 3.80544C17.3102 1.99163 14.601 0.997108 11.7998 1.00001Z", fill: "black" }) }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
export const Google = (props) => (_jsxs(SvgIcon, { ...props, children: ["(", _jsx("path", { d: "M23.9888 12.2244C23.9888 11.2412 23.9071 10.5236 23.7304 9.77954H12.2393V14.2175H18.9843C18.8484 15.3204 18.114 16.9814 16.4821 18.0975L16.4592 18.246L20.0925 20.9962L20.3442 21.0208C22.656 18.9346 23.9888 15.8652 23.9888 12.2244Z", fill: "#4285F4" }), _jsx("path", { d: "M12.2393 23.9176C15.5438 23.9176 18.3179 22.8545 20.3442 21.0209L16.4821 18.0976C15.4486 18.8018 14.0615 19.2934 12.2393 19.2934C9.00273 19.2934 6.25576 17.2074 5.27654 14.324L5.13301 14.3359L1.35507 17.1927L1.30566 17.3269C3.31829 21.2334 7.45238 23.9176 12.2393 23.9176Z", fill: "#34A853" }), _jsx("path", { d: "M5.27634 14.324C5.01797 13.58 4.86844 12.7826 4.86844 11.9589C4.86844 11.135 5.01797 10.3378 5.26275 9.59366L5.25591 9.43519L1.43062 6.53247L1.30547 6.59064C0.475969 8.21174 0 10.0322 0 11.9589C0 13.8855 0.475969 15.7059 1.30547 17.327L5.27634 14.324Z", fill: "#FBBC05" }), _jsx("path", { d: "M12.2393 4.62403C14.5374 4.62403 16.0877 5.59402 16.9717 6.40461L20.4258 3.10928C18.3044 1.1826 15.5438 0 12.2393 0C7.45238 0 3.31829 2.68406 1.30566 6.59056L5.26295 9.59359C6.25576 6.7102 9.00273 4.62403 12.2393 4.62403Z", fill: "#EB4335" }), ")"] }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
export const ImageSync = (props) => (_jsx(SvgIcon, { ...props, children: _jsx("path", { d: "M8.5 13.5L5 18H13.03C13.11 19.1 13.47 20.12 14.03 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 3.9 3.9 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V11.18C20.5 11.07 20 11 19.5 11C17.78 11 16.23 11.67 15.07 12.76L14.5 12L11 16.5L8.5 13.5ZM19 20C18.337 20 17.7011 19.7366 17.2322 19.2678C16.7634 18.7989 16.5 18.163 16.5 17.5C16.5 17.1 16.59 16.72 16.76 16.38L15.67 15.29C15.25 15.92 15 16.68 15 17.5C15 19.71 16.79 21.5 19 21.5V23L21.25 20.75L19 18.5V20ZM19 13.5V12L16.75 14.25L19 16.5V15C19.663 15 20.2989 15.2634 20.7678 15.7322C21.2366 16.2011 21.5 16.837 21.5 17.5C21.5 17.9 21.41 18.28 21.24 18.62L22.33 19.71C22.75 19.08 23 18.32 23 17.5C23 15.29 21.21 13.5 19 13.5Z", fill: "currentColor" }) }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
export const Microsoft = (props) => (_jsxs(SvgIcon, { ...props, children: ["(", _jsx("path", { d: "M11.4062 11.4062H0V0H11.4062V11.4062Z", fill: "#F1511B" }), _jsx("path", { d: "M23.9998 11.4062H12.5938V0H23.9998V11.4062Z", fill: "#80CC28" }), _jsx("path", { d: "M11.4059 24.0002H0V12.594H11.4059V24.0002Z", fill: "#00ADEF" }), _jsx("path", { d: "M23.9998 24.0002H12.5938V12.594H23.9998V24.0002Z", fill: "#FBBC09" }), ")"] }));
|
package/es/icons/index.d.ts
CHANGED
|
@@ -10,3 +10,7 @@ export { Brain } from "./Brain";
|
|
|
10
10
|
export { Home } from "./Home";
|
|
11
11
|
export { ScreenShare } from "./ScreenShare";
|
|
12
12
|
export { DatabaseSearch } from "./DatabaseSearch";
|
|
13
|
+
export { Google } from "./Google";
|
|
14
|
+
export { Github } from "./Github";
|
|
15
|
+
export { Microsoft } from "./Microsoft";
|
|
16
|
+
export { ImageSync } from "./ImageSync";
|
package/es/icons/index.js
CHANGED
|
@@ -10,3 +10,7 @@ export { Brain } from "./Brain";
|
|
|
10
10
|
export { Home } from "./Home";
|
|
11
11
|
export { ScreenShare } from "./ScreenShare";
|
|
12
12
|
export { DatabaseSearch } from "./DatabaseSearch";
|
|
13
|
+
export { Google } from "./Google";
|
|
14
|
+
export { Github } from "./Github";
|
|
15
|
+
export { Microsoft } from "./Microsoft";
|
|
16
|
+
export { ImageSync } from "./ImageSync";
|
package/es/index.d.ts
CHANGED
|
@@ -12,5 +12,7 @@ export { default as FieldTypeOneToMany } from "./FieldTypeOneToMany";
|
|
|
12
12
|
export { default as CopyButton } from "./CopyButton";
|
|
13
13
|
export { default as ConfirmDialog } from "./ConfirmDialog";
|
|
14
14
|
export { default as VirtualizedAutocomplete } from "./VitualizedAutocomplete";
|
|
15
|
+
export { default as SSOButtonGroup } from "./SSOButtonGroup";
|
|
16
|
+
export { default as SSOButton } from "./SSOButton";
|
|
15
17
|
export { IconButton } from "./IconButton";
|
|
16
18
|
export * from "./icons";
|
package/es/index.js
CHANGED
|
@@ -12,5 +12,7 @@ export { default as FieldTypeOneToMany } from "./FieldTypeOneToMany";
|
|
|
12
12
|
export { default as CopyButton } from "./CopyButton";
|
|
13
13
|
export { default as ConfirmDialog } from "./ConfirmDialog";
|
|
14
14
|
export { default as VirtualizedAutocomplete } from "./VitualizedAutocomplete";
|
|
15
|
+
export { default as SSOButtonGroup } from "./SSOButtonGroup";
|
|
16
|
+
export { default as SSOButton } from "./SSOButton";
|
|
15
17
|
export { IconButton } from "./IconButton";
|
|
16
18
|
export * from "./icons";
|
package/es/theme/index.js
CHANGED
|
@@ -274,6 +274,8 @@ const components = {
|
|
|
274
274
|
MuiMenuItem: {
|
|
275
275
|
styleOverrides: {
|
|
276
276
|
root: {
|
|
277
|
+
// Overrides the media query of the MenuItem that sets minHeight
|
|
278
|
+
minHeight: "36px !important",
|
|
277
279
|
" .MuiListItemIcon-root": {
|
|
278
280
|
minWidth: "32px",
|
|
279
281
|
},
|
|
@@ -324,10 +326,13 @@ const components = {
|
|
|
324
326
|
},
|
|
325
327
|
}),
|
|
326
328
|
standardInfo: ({ theme }) => ({
|
|
327
|
-
backgroundColor:
|
|
329
|
+
backgroundColor: theme.palette.blue[100],
|
|
328
330
|
" .MuiAlert-icon": {
|
|
329
331
|
color: theme.palette.info.main,
|
|
330
332
|
},
|
|
333
|
+
"& .MuiAlert-message": {
|
|
334
|
+
color: theme.palette.info.dark,
|
|
335
|
+
},
|
|
331
336
|
}),
|
|
332
337
|
standardError: ({ theme }) => ({
|
|
333
338
|
backgroundColor: alpha(theme.palette.error.main, 0.1),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
let tabWindow = null;
|
|
3
|
+
export const useSSO = (authServiceUrl) => {
|
|
4
|
+
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
5
|
+
const [error, setError] = useState("");
|
|
6
|
+
const receiveMessage = (event) => {
|
|
7
|
+
if (event.origin === authServiceUrl &&
|
|
8
|
+
event.data.source === "zesty") {
|
|
9
|
+
if (event.data.status === "200") {
|
|
10
|
+
setIsAuthenticated(true);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
setError(event.data.error_message);
|
|
14
|
+
}
|
|
15
|
+
if (tabWindow) {
|
|
16
|
+
tabWindow.close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
window.addEventListener("message", receiveMessage);
|
|
22
|
+
return () => {
|
|
23
|
+
window.removeEventListener("message", receiveMessage);
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
const initiate = (service) => {
|
|
27
|
+
if (tabWindow) {
|
|
28
|
+
tabWindow.close();
|
|
29
|
+
}
|
|
30
|
+
tabWindow = window.open(`${authServiceUrl}/${service}/login`);
|
|
31
|
+
};
|
|
32
|
+
return [initiate, isAuthenticated, error];
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zesty-io/material",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Contains custom components which are in addition to the @mui design-system",
|
|
5
5
|
"author": "Zesty.io",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@emotion/react": "^11.9.0",
|
|
31
31
|
"@emotion/styled": "^11.8.1",
|
|
32
32
|
"@mui/icons-material": "^5.14.3",
|
|
33
|
+
"@mui/lab": "^5.0.0-alpha.150",
|
|
33
34
|
"@mui/material": "^5.14.5",
|
|
34
35
|
"@mui/x-date-pickers": "^5.0.0-alpha.5",
|
|
35
36
|
"date-fns": "^2.28.0",
|
|
@@ -52,5 +53,8 @@
|
|
|
52
53
|
"react-json-view": "^1.21.3",
|
|
53
54
|
"typescript": "^4.6.3"
|
|
54
55
|
},
|
|
55
|
-
"files": [
|
|
56
|
+
"files": [
|
|
57
|
+
"cjs",
|
|
58
|
+
"es"
|
|
59
|
+
]
|
|
56
60
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
2
|
-
import { ConfirmDialogProps } from '.';
|
|
3
|
-
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const Default: Story<ConfirmDialogProps>;
|
|
6
|
-
export declare const CustomChildren: Story<ConfirmDialogProps>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CustomChildren = exports.Default = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const material_1 = require("@mui/material");
|
|
7
|
-
const _1 = require(".");
|
|
8
|
-
exports.default = {
|
|
9
|
-
title: 'ConfirmDialog',
|
|
10
|
-
component: _1.default,
|
|
11
|
-
argType: {},
|
|
12
|
-
};
|
|
13
|
-
const Template = (args) => {
|
|
14
|
-
const [open, setOpen] = (0, react_1.useState)(false);
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => setOpen(true), children: "Click me to open" }), (0, jsx_runtime_1.jsx)(_1.default, { ...args, open: open, callback: (confirmed) => setOpen(false) })] }));
|
|
16
|
-
};
|
|
17
|
-
exports.Default = Template.bind({});
|
|
18
|
-
exports.Default.args = {
|
|
19
|
-
title: 'Confirm modal title',
|
|
20
|
-
content: 'Confirm modal content',
|
|
21
|
-
};
|
|
22
|
-
exports.CustomChildren = Template.bind({});
|
|
23
|
-
exports.CustomChildren.args = {
|
|
24
|
-
title: 'Confirm modal title',
|
|
25
|
-
content: 'Confirm modal content',
|
|
26
|
-
children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { color: "error", variant: "contained", children: "Custom 1" }), (0, jsx_runtime_1.jsx)(material_1.Button, { color: "success", variant: "contained", children: "Custom 2" })] })
|
|
27
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { DialogProps } from '@mui/material/Dialog';
|
|
3
|
-
export interface ConfirmDialogProps extends Omit<DialogProps, 'title'> {
|
|
4
|
-
/**
|
|
5
|
-
* Title of confirm dialog
|
|
6
|
-
*/
|
|
7
|
-
title: string | ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Content of confirm dialog
|
|
10
|
-
*/
|
|
11
|
-
content: string | ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Callback of confirm dialog
|
|
14
|
-
*/
|
|
15
|
-
callback: (confirmed: boolean) => void;
|
|
16
|
-
}
|
|
17
|
-
declare const ConfirmDialog: ({ title, content, onClose, children, callback, ...props }: ConfirmDialogProps) => JSX.Element;
|
|
18
|
-
export default ConfirmDialog;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const Dialog_1 = require("@mui/material/Dialog");
|
|
5
|
-
const DialogActions_1 = require("@mui/material/DialogActions");
|
|
6
|
-
const DialogContent_1 = require("@mui/material/DialogContent");
|
|
7
|
-
const DialogContentText_1 = require("@mui/material/DialogContentText");
|
|
8
|
-
const DialogTitle_1 = require("@mui/material/DialogTitle");
|
|
9
|
-
const material_1 = require("@mui/material");
|
|
10
|
-
const ConfirmDialog = ({ title, content, onClose, children, callback, ...props }) => {
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { ...props, children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, { children: title }), (0, jsx_runtime_1.jsx)(DialogContent_1.default, { children: (0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: content }) }), children ? (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: children }) : ((0, jsx_runtime_1.jsxs)(DialogActions_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => callback(false), children: "No" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => callback(true), autoFocus: true, children: "Yes" })] }))] }));
|
|
12
|
-
};
|
|
13
|
-
exports.default = ConfirmDialog;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Default = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
exports.default = {
|
|
7
|
-
title: 'CopyButton',
|
|
8
|
-
component: _1.default,
|
|
9
|
-
argType: {},
|
|
10
|
-
};
|
|
11
|
-
const Template = (args) => {
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args }));
|
|
13
|
-
};
|
|
14
|
-
exports.Default = Template.bind({});
|
|
15
|
-
exports.Default.args = {
|
|
16
|
-
value: 'Copy Me!'
|
|
17
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
-
export interface CopyButtonProps extends ButtonProps {
|
|
4
|
-
/**
|
|
5
|
-
* Value to be copied to clipboard
|
|
6
|
-
*/
|
|
7
|
-
value: string;
|
|
8
|
-
}
|
|
9
|
-
declare const CopyButton: ({ value, sx, ...props }: CopyButtonProps) => JSX.Element;
|
|
10
|
-
export default CopyButton;
|
package/cjs/CopyButton/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const Button_1 = require("@mui/material/Button");
|
|
6
|
-
const ContentCopy_1 = require("@mui/icons-material/ContentCopy");
|
|
7
|
-
const Check_1 = require("@mui/icons-material/Check");
|
|
8
|
-
const CopyButton = ({ value, sx, ...props }) => {
|
|
9
|
-
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
10
|
-
const copyValue = (0, react_1.useCallback)(() => {
|
|
11
|
-
navigator?.clipboard.writeText(value);
|
|
12
|
-
setCopied(true);
|
|
13
|
-
}, [value]);
|
|
14
|
-
(0, react_1.useEffect)(() => {
|
|
15
|
-
const iconTimer = setTimeout(() => {
|
|
16
|
-
setCopied(false);
|
|
17
|
-
}, 500);
|
|
18
|
-
return () => {
|
|
19
|
-
clearTimeout(iconTimer);
|
|
20
|
-
};
|
|
21
|
-
}, [copied]);
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: 'outlined', onClick: copyValue, size: "small", title: props.children ? `Copy ${props.children}` : `Copy ${value}`, sx: {
|
|
23
|
-
textTransform: 'unset',
|
|
24
|
-
// Spread sx prop at the end to allow sx prop overrides
|
|
25
|
-
...sx,
|
|
26
|
-
}, startIcon: copied ? ((0, jsx_runtime_1.jsx)(Check_1.default, { color: 'success', fontSize: 'small' })) : ((0, jsx_runtime_1.jsx)(ContentCopy_1.default, { fontSize: 'small' })), ...props, children: props.children ? props.children : value }));
|
|
27
|
-
};
|
|
28
|
-
exports.default = CopyButton;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Default = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const _1 = require("./");
|
|
7
|
-
exports.default = {
|
|
8
|
-
title: 'FieldTypeColor',
|
|
9
|
-
component: _1.default,
|
|
10
|
-
argType: {},
|
|
11
|
-
};
|
|
12
|
-
const Template = (args) => {
|
|
13
|
-
const [value, setValue] = (0, react_1.useState)('');
|
|
14
|
-
const handleOnChange = (e) => {
|
|
15
|
-
setValue(e.target.value);
|
|
16
|
-
};
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange }));
|
|
18
|
-
};
|
|
19
|
-
exports.Default = Template.bind({});
|
|
20
|
-
exports.Default.args = {
|
|
21
|
-
placeholder: 'Placeholder Text...',
|
|
22
|
-
label: 'Color label',
|
|
23
|
-
helperText: 'Color helper text',
|
|
24
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { OutlinedTextFieldProps } from '@mui/material/TextField';
|
|
3
|
-
export interface FieldTypeColorProps extends Omit<OutlinedTextFieldProps, 'variant'> {
|
|
4
|
-
}
|
|
5
|
-
declare const FieldTypeColor: ({ InputProps, label, required, ...props }: FieldTypeColorProps) => JSX.Element;
|
|
6
|
-
export default FieldTypeColor;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const TextField_1 = require("@mui/material/TextField");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const Brush_1 = require("@mui/icons-material/Brush");
|
|
7
|
-
const FieldTypeColor = ({ InputProps, label, required, ...props }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(TextField_1.default, { size: "small", variant: 'outlined', type: 'color', InputProps: {
|
|
9
|
-
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", onClick: (e) => {
|
|
10
|
-
// References color input via event in order to open color picker
|
|
11
|
-
const input = e.currentTarget?.parentElement?.parentElement?.firstElementChild;
|
|
12
|
-
input?.click();
|
|
13
|
-
}, children: (0, jsx_runtime_1.jsx)(Brush_1.default, { fontSize: 'small' }) }) })),
|
|
14
|
-
// Spread props at the end to allow Input prop overrides
|
|
15
|
-
...InputProps,
|
|
16
|
-
}, ...props })] }));
|
|
17
|
-
};
|
|
18
|
-
exports.default = FieldTypeColor;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Default = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const _1 = require(".");
|
|
7
|
-
exports.default = {
|
|
8
|
-
title: 'FieldTypeDate',
|
|
9
|
-
component: _1.default,
|
|
10
|
-
argType: {},
|
|
11
|
-
};
|
|
12
|
-
const Template = (args) => {
|
|
13
|
-
const [value, setValue] = (0, react_1.useState)(null);
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: (value) => setValue(value) }));
|
|
15
|
-
};
|
|
16
|
-
exports.Default = Template.bind({});
|
|
17
|
-
exports.Default.args = {
|
|
18
|
-
label: 'Date label',
|
|
19
|
-
helperText: 'Date helper text',
|
|
20
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DesktopDatePickerProps } from '@mui/x-date-pickers';
|
|
3
|
-
export interface FieldTypeDateProps extends Omit<DesktopDatePickerProps<Date, Date>, 'renderInput'> {
|
|
4
|
-
helperText?: string;
|
|
5
|
-
error?: boolean;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare const FieldTypeDate: ({ label, helperText, error, required, ...props }: FieldTypeDateProps) => JSX.Element;
|
|
9
|
-
export default FieldTypeDate;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const AdapterDateFns_1 = require("@mui/x-date-pickers/AdapterDateFns");
|
|
5
|
-
const LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
6
|
-
const x_date_pickers_1 = require("@mui/x-date-pickers");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
;
|
|
9
|
-
const FieldTypeDate = ({ label, helperText, error, required, ...props }) => {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterDateFns_1.AdapterDateFns, children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DesktopDatePicker, { "data-testid": "zds-date-picker", renderInput: (params) => (0, jsx_runtime_1.jsx)(material_1.TextField, { ...params, helperText: helperText, error: error, size: "small" }), ...props }) })] }));
|
|
11
|
-
};
|
|
12
|
-
exports.default = FieldTypeDate;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Default = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const _1 = require(".");
|
|
7
|
-
exports.default = {
|
|
8
|
-
title: 'FieldTypeDateTime',
|
|
9
|
-
component: _1.default,
|
|
10
|
-
argType: {},
|
|
11
|
-
};
|
|
12
|
-
const Template = (args) => {
|
|
13
|
-
const [value, setValue] = (0, react_1.useState)(null);
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: (value) => setValue(value) }));
|
|
15
|
-
};
|
|
16
|
-
exports.Default = Template.bind({});
|
|
17
|
-
exports.Default.args = {
|
|
18
|
-
label: 'Date label',
|
|
19
|
-
helperText: 'Date helper text',
|
|
20
|
-
};
|