@vrobots/storybook 0.1.49 → 0.1.50
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/package.json +1 -1
- package/dist/src/components/form/SecondFactorAuth.d.ts +13 -0
- package/dist/src/components/form/SecondFactorAuth.js +10 -0
- package/dist/src/components/form/index.d.ts +2 -0
- package/dist/src/components/form/index.js +3 -0
- package/dist/src/stories/SecondFactorAuth.stories.d.ts +15 -0
- package/dist/src/stories/SecondFactorAuth.stories.js +21 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CardRootProps } from "@chakra-ui/react";
|
|
2
|
+
export interface IAuth {
|
|
3
|
+
authCode: string;
|
|
4
|
+
rememberDevice: 'on' | false;
|
|
5
|
+
}
|
|
6
|
+
export interface ISecondFactorAuthProps extends CardRootProps {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
onSecondFactorAuth: (auth: IAuth) => void;
|
|
10
|
+
onResendAuthCode: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default SecondFactorAuth;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Button, Card, Checkbox, Field, Input, InputGroup, Stack } from "@chakra-ui/react";
|
|
3
|
+
import { useForm } from "react-hook-form";
|
|
4
|
+
const SecondFactorAuth = ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }) => {
|
|
5
|
+
const { register, handleSubmit, formState: { errors }, } = useForm();
|
|
6
|
+
return (_jsx(Card.Root, { ...props, children: _jsxs(Card.Body, { children: [_jsx(Card.Title, { children: title || "Second Factor Auth" }), !!description && _jsx(Card.Description, { children: description }), _jsxs(Box, { as: "form", onSubmit: handleSubmit((data) => onSecondFactorAuth(data)), mt: 4, children: [_jsxs(Stack, { gap: "4", children: [_jsxs(Field.Root, { invalid: !!errors.authCode, required: true, children: [_jsx(Field.Label, { children: "Authorization Code" }), _jsx(InputGroup, { endAddon: _jsx(Button, { h: '1.75rem', size: 'sm', variant: 'ghost', onClick: onResendAuthCode, children: "Resend" }), children: _jsx(Input, { type: 'text', placeholder: 'Authorization code', ...register("authCode", {
|
|
7
|
+
required: "Please enter your authorization code",
|
|
8
|
+
}), autoFocus: true }) }), _jsx(Field.ErrorText, { children: errors.authCode?.message })] }), _jsxs(Checkbox.Root, { ...register("rememberDevice"), size: 'sm', children: [_jsx(Checkbox.HiddenInput, {}), _jsx(Checkbox.Control, {}), _jsx(Checkbox.Label, { children: "Remember Device" })] })] }), _jsx(Button, { type: "submit", colorScheme: "teal", width: "full", mt: 6, children: "SecondFactorAuth" })] })] }) }));
|
|
9
|
+
};
|
|
10
|
+
export default SecondFactorAuth;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Login";
|
|
2
|
+
export * from "./SecondFactorAuth";
|
|
2
3
|
declare const Form: {
|
|
3
4
|
(): null;
|
|
4
5
|
Login: ({ title, description, onLogin, ...props }: import("./Login").ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: import("./SecondFactorAuth").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
};
|
|
6
8
|
export default Form;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: import("../components/form").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {
|
|
10
|
+
title: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Component: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Form } from '../components';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Forms/SecondFactorAuth',
|
|
4
|
+
component: Form.SecondFactorAuth,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'fullscreen',
|
|
8
|
+
},
|
|
9
|
+
args: {
|
|
10
|
+
title: "SecondFactorAuth",
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
export const Component = {
|
|
15
|
+
args: {
|
|
16
|
+
title: "Second FactorAuth Form",
|
|
17
|
+
description: "Please enter your auth code to continue",
|
|
18
|
+
onSecondFactorAuth: (data) => console.log(data),
|
|
19
|
+
onResendAuthCode: () => console.log("Resend auth code")
|
|
20
|
+
}
|
|
21
|
+
};
|