@vrobots/storybook 0.2.12 → 0.2.14
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/Menu.js +2 -1
- package/dist/src/components/form/Login.d.ts +2 -1
- package/dist/src/components/form/Login.js +2 -2
- package/dist/src/components/form/SecondFactorAuth.d.ts +2 -1
- package/dist/src/components/form/SecondFactorAuth.js +2 -2
- package/dist/src/components/form/index.d.ts +2 -2
- package/dist/src/stories/Login.stories.d.ts +1 -1
- package/dist/src/stories/SecondFactorAuth.stories.d.ts +1 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { createListCollection, Listbox } from "@chakra-ui/react";
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
4
|
import { useSelectedColorSchema } from "../hooks/useSelectedColorSchema";
|
|
5
|
+
import * as Icons from "react-icons/md";
|
|
5
6
|
export const Menu = forwardRef(({ label, menuItems, selected = '', onClick, }, ref) => {
|
|
6
7
|
const frameworks = React.useMemo(() => createListCollection({
|
|
7
8
|
items: menuItems || [],
|
|
@@ -11,6 +12,6 @@ export const Menu = forwardRef(({ label, menuItems, selected = '', onClick, }, r
|
|
|
11
12
|
const value = details.value[0];
|
|
12
13
|
onClick?.(value);
|
|
13
14
|
};
|
|
14
|
-
return (_jsxs(Listbox.Root, { collection: frameworks, value: [selected], onValueChange: handleValueChange, pt: 4, ref: ref, children: [!!label && _jsx(Listbox.Label, { pl: 5, children: label }), _jsx(Listbox.Content, { border: 0, bgColor: 'transparent', children: frameworks.items.map((framework, i) => (
|
|
15
|
+
return (_jsxs(Listbox.Root, { collection: frameworks, value: [selected], onValueChange: handleValueChange, pt: 4, ref: ref, children: [!!label && _jsx(Listbox.Label, { pl: 5, children: label }), _jsx(Listbox.Content, { border: 0, bgColor: 'transparent', children: frameworks.items.map((framework, i) => (_jsxs(Listbox.Item, { item: framework, pl: 4, pr: 4, ...([selected].includes(framework.value) ? selectedColorSchema : undefined), children: [framework.icon && React.createElement(Icons[framework.icon], { style: { display: 'inline', marginRight: 8 } }), _jsx(Listbox.ItemText, { children: framework.label })] }, `${framework.label} ${i + 1}`))) })] }));
|
|
15
16
|
});
|
|
16
17
|
Menu.displayName = 'Menu';
|
|
@@ -6,8 +6,9 @@ export interface ILoginCredentials {
|
|
|
6
6
|
export interface ILoginProps extends CardRootProps {
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
|
+
isLoading?: boolean;
|
|
9
10
|
onLogin: (credentials: ILoginCredentials) => void;
|
|
10
11
|
children?: React.ReactNode;
|
|
11
12
|
}
|
|
12
|
-
declare const Login: ({ title, description, onLogin, children, ...props }: ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const Login: ({ title, description, onLogin, children, isLoading, ...props }: ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default Login;
|
|
@@ -6,9 +6,9 @@ import FormRoot from "./Form.Root";
|
|
|
6
6
|
import FormDescription from "./Form.Description";
|
|
7
7
|
import FormTitle from "./Form.Title";
|
|
8
8
|
import FormBody from "./Form.Body";
|
|
9
|
-
const Login = ({ title, description, onLogin, children = null, ...props }) => {
|
|
9
|
+
const Login = ({ title, description, onLogin, children = null, isLoading = false, ...props }) => {
|
|
10
10
|
const { register, handleSubmit, formState: { errors }, } = useForm();
|
|
11
|
-
return (_jsxs(FormRoot, { onSubmit: handleSubmit((data) => onLogin(data)), children: [_jsx(FormTitle, { title: title || "Login" }), !!description && _jsx(FormDescription, { description: description }), _jsxs(FormBody, { children: [_jsxs(Stack, { gap: "4", children: [_jsxs(Field.Root, { invalid: !!errors.emailAddress, required: true, children: [_jsx(Field.Label, { children: "Email Address" }), _jsx(Input, { ...register("emailAddress", {
|
|
11
|
+
return (_jsxs(FormRoot, { onSubmit: handleSubmit((data) => onLogin(data)), ...props, isLoading: isLoading, children: [_jsx(FormTitle, { title: title || "Login" }), !!description && _jsx(FormDescription, { description: description }), _jsxs(FormBody, { children: [_jsxs(Stack, { gap: "4", children: [_jsxs(Field.Root, { invalid: !!errors.emailAddress, required: true, children: [_jsx(Field.Label, { children: "Email Address" }), _jsx(Input, { ...register("emailAddress", {
|
|
12
12
|
required: "Please enter your email address",
|
|
13
13
|
pattern: {
|
|
14
14
|
value: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
@@ -6,8 +6,9 @@ export interface IAuth {
|
|
|
6
6
|
export interface ISecondFactorAuthProps extends CardRootProps {
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
|
+
isLoading?: boolean;
|
|
9
10
|
onSecondFactorAuth: (auth: IAuth) => void;
|
|
10
11
|
onResendAuthCode: () => void;
|
|
11
12
|
}
|
|
12
|
-
declare const SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, isLoading, ...props }: ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default SecondFactorAuth;
|
|
@@ -5,9 +5,9 @@ import FormRoot from "./Form.Root";
|
|
|
5
5
|
import FormTitle from "./Form.Title";
|
|
6
6
|
import FormBody from "./Form.Body";
|
|
7
7
|
import FormDescription from "./Form.Description";
|
|
8
|
-
const SecondFactorAuth = ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }) => {
|
|
8
|
+
const SecondFactorAuth = ({ title, description, onSecondFactorAuth, onResendAuthCode, isLoading = false, ...props }) => {
|
|
9
9
|
const { register, handleSubmit, formState: { errors }, } = useForm();
|
|
10
|
-
return (_jsxs(FormRoot, { onSubmit: handleSubmit((data) => onSecondFactorAuth(data)), children: [_jsx(FormTitle, { title: title || "Second Factor Auth" }), !!description && _jsx(FormDescription, { description: description }), _jsxs(FormBody, { 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", {
|
|
10
|
+
return (_jsxs(FormRoot, { onSubmit: handleSubmit((data) => onSecondFactorAuth(data)), ...props, isLoading: isLoading, children: [_jsx(FormTitle, { title: title || "Second Factor Auth" }), !!description && _jsx(FormDescription, { description: description }), _jsxs(FormBody, { 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", {
|
|
11
11
|
required: "Please enter your authorization code",
|
|
12
12
|
}), 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", width: "full", mt: 6, children: "Submit" })] }));
|
|
13
13
|
};
|
|
@@ -13,8 +13,8 @@ declare const Form: {
|
|
|
13
13
|
Body: ({ children }: {
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
Login: ({ title, description, onLogin, children, ...props }: import("./Login").ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: import("./SecondFactorAuth").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Login: ({ title, description, onLogin, children, isLoading, ...props }: import("./Login").ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, isLoading, ...props }: import("./SecondFactorAuth").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
FileUploader: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, uploadPercentages, children, ...props }: import("./FileUploader").IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
};
|
|
20
20
|
export default Form;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ title, description, onLogin, children, ...props }: import("../components").ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ title, description, onLogin, children, isLoading, ...props }: import("../components").ILoginProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: import("../components").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ title, description, onSecondFactorAuth, onResendAuthCode, isLoading, ...props }: import("../components").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|