@vrobots/storybook 0.1.48 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.48",
4
+ "version": "0.1.50",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -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;
@@ -1,5 +1,8 @@
1
1
  import Login from "./Login";
2
+ import SecondFactorAuth from "./SecondFactorAuth";
2
3
  export * from "./Login";
4
+ export * from "./SecondFactorAuth";
3
5
  const Form = () => null;
4
6
  Form.Login = Login;
7
+ Form.SecondFactorAuth = SecondFactorAuth;
5
8
  export default Form;
@@ -1,4 +1,5 @@
1
1
  export * from './ui/color-mode';
2
+ export * from './ui/toaster';
2
3
  export * from './Accordion';
3
4
  export * from './AvatarIconMenu';
4
5
  export * from './Breadcrumbs';
@@ -11,4 +12,5 @@ export * from './Page';
11
12
  export * from './Section';
12
13
  export * from './Sidebar';
13
14
  export * from './Timeline';
15
+ export * from './form/Login';
14
16
  export { default as Form } from './form';
@@ -1,4 +1,5 @@
1
1
  export * from './ui/color-mode';
2
+ export * from './ui/toaster';
2
3
  export * from './Accordion';
3
4
  export * from './AvatarIconMenu';
4
5
  export * from './Breadcrumbs';
@@ -11,4 +12,5 @@ export * from './Page';
11
12
  export * from './Section';
12
13
  export * from './Sidebar';
13
14
  export * from './Timeline';
15
+ export * from './form/Login';
14
16
  export { default as Form } from './form';
@@ -0,0 +1,2 @@
1
+ export declare const toaster: import("@zag-js/toast").Store<any>;
2
+ export declare const Toaster: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Toaster as ChakraToaster, Portal, Spinner, Stack, Toast, createToaster, } from "@chakra-ui/react";
4
+ export const toaster = createToaster({
5
+ placement: "top-end",
6
+ pauseOnPageIdle: true,
7
+ });
8
+ export const Toaster = () => {
9
+ return (_jsx(Portal, { children: _jsx(ChakraToaster, { toaster: toaster, insetInline: { mdDown: "4" }, children: (toast) => (_jsxs(Toast.Root, { width: { md: "sm" }, children: [toast.type === "loading" ? (_jsx(Spinner, { size: "sm", color: "blue.solid" })) : (_jsx(Toast.Indicator, {})), _jsxs(Stack, { gap: "1", flex: "1", maxWidth: "100%", children: [toast.title && _jsx(Toast.Title, { children: toast.title }), toast.description && (_jsx(Toast.Description, { children: toast.description }))] }), toast.action && (_jsx(Toast.ActionTrigger, { children: toast.action.label })), toast.closable && _jsx(Toast.CloseTrigger, {})] })) }) }));
10
+ };
@@ -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, ...props }: import("../components/form").ILoginProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ title, description, onLogin, ...props }: import("../components").ILoginProps) => import("react/jsx-runtime").JSX.Element;
5
5
  tags: string[];
6
6
  parameters: {
7
7
  layout: string;
@@ -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
+ };
@@ -0,0 +1,15 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: () => 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,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { toaster, Toaster } from '../components';
3
+ import React from 'react';
4
+ import { Button } from '@chakra-ui/react';
5
+ const meta = {
6
+ title: 'Feedback/Toaster',
7
+ component: Toaster,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ layout: 'fullscreen',
11
+ },
12
+ args: {
13
+ title: "Toaster",
14
+ }
15
+ };
16
+ export default meta;
17
+ export const Component = {
18
+ args: {
19
+ title: "Toaster",
20
+ description: "Please enter your credentials to continue",
21
+ onToaster: (data) => console.log(data)
22
+ },
23
+ decorators: [
24
+ (Story) => {
25
+ return (_jsxs(React.Fragment, { children: [_jsx(Story, {}), _jsx(Button, { variant: "outline", size: "sm", onClick: () => toaster.create({
26
+ description: "File saved successfully",
27
+ type: "info",
28
+ closable: true,
29
+ }), children: "Show Toast" })] }));
30
+ },
31
+ ],
32
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.48",
4
+ "version": "0.1.50",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",