@vrobots/storybook 0.2.5 → 0.2.7

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.2.5",
4
+ "version": "0.2.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+ export interface ILoaderProps {
3
+ component?: ReactNode;
4
+ isLoading?: boolean;
5
+ isFullscreen?: boolean;
6
+ hideBackground?: boolean;
7
+ children?: React.ReactNode;
8
+ }
9
+ export declare const Loader: ({ isLoading, isFullscreen, component, hideBackground, children }: ILoaderProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Spinner } from "@chakra-ui/react";
3
+ export const Loader = ({ isLoading, isFullscreen, component, hideBackground, children }) => {
4
+ if (!!isLoading) {
5
+ return (_jsx(Box, { style: {
6
+ position: isFullscreen ? 'fixed' : 'absolute',
7
+ top: 0,
8
+ right: 0,
9
+ bottom: 0,
10
+ left: 0,
11
+ zIndex: 100000,
12
+ maxHeight: '100vh',
13
+ display: 'flex',
14
+ }, bgColor: !hideBackground ? { _light: 'blue.50', _dark: 'gray.900' } : 'transparent', children: _jsxs(Box, { m: 'auto', children: [component && component, _jsx(Spinner, { position: 'static', m: 'auto' })] }) }));
15
+ }
16
+ return children ?? null;
17
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box, Card } from "@chakra-ui/react";
3
3
  export const FormRoot = (props) => {
4
- return (_jsx(Box, { as: "form", display: "flex", justifyContent: "center", alignItems: "center", height: `100%`, bg: "neu.bg", px: 4, children: _jsx(Box, { layerStyle: "neuRaised", p: { base: 6, md: 8 }, minW: { base: "100%", sm: "460px" }, maxW: "560px", bg: { _light: 'white', _dark: 'black' }, children: _jsx(Card.Root, { bg: 'transparent', border: 'none', ...props, children: _jsx(Card.Body, { children: props.children }) }) }) }));
4
+ return (_jsx(Box, { as: "form", display: "flex", justifyContent: "center", alignItems: "center", height: `100%`, bg: "neu.bg", px: 4, ...props, children: _jsx(Box, { layerStyle: "neuRaised", p: { base: 6, md: 8 }, minW: { base: "100%", sm: "460px" }, maxW: "560px", bg: { _light: 'white', _dark: 'black' }, children: _jsx(Card.Root, { bg: 'transparent', border: 'none', ...props, children: _jsx(Card.Body, { children: props.children }) }) }) }));
5
5
  };
6
6
  export default FormRoot;
@@ -8,6 +8,7 @@ export * from './Display';
8
8
  export * from './FoldersAndFiles';
9
9
  export * from './Frame';
10
10
  export * from './Header';
11
+ export * from './Loader';
11
12
  export * from './Logo';
12
13
  export * from './Menu';
13
14
  export * from './Page';
@@ -8,6 +8,7 @@ export * from './Display';
8
8
  export * from './FoldersAndFiles';
9
9
  export * from './Frame';
10
10
  export * from './Header';
11
+ export * from './Loader';
11
12
  export * from './Logo';
12
13
  export * from './Menu';
13
14
  export * from './Page';
@@ -0,0 +1,19 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: ({ isLoading, isFullscreen, component, hideBackground, children }: import("../components").ILoaderProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
5
+ tags: string[];
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ args: {
10
+ isLoading: true;
11
+ };
12
+ };
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+ export declare const Default: Story;
16
+ export declare const Fullscreen: Story;
17
+ export declare const NoBackground: Story;
18
+ export declare const CustomComponent: Story;
19
+ export declare const NotLoading: Story;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box, Text } from '@chakra-ui/react';
3
+ import { Loader } from '../components';
4
+ const meta = {
5
+ title: 'Feedback/Loader',
6
+ component: Loader,
7
+ tags: ['autodocs'],
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ args: {
12
+ isLoading: true,
13
+ },
14
+ };
15
+ export default meta;
16
+ export const Default = {
17
+ args: {
18
+ isLoading: true,
19
+ },
20
+ parameters: {
21
+ layout: 'fullscreen',
22
+ },
23
+ };
24
+ export const Fullscreen = {
25
+ args: {
26
+ isLoading: true,
27
+ isFullscreen: true,
28
+ },
29
+ parameters: {
30
+ layout: 'fullscreen',
31
+ },
32
+ };
33
+ export const NoBackground = {
34
+ args: {
35
+ isLoading: true,
36
+ hideBackground: true,
37
+ },
38
+ parameters: {
39
+ layout: 'fullscreen',
40
+ },
41
+ };
42
+ export const CustomComponent = {
43
+ args: {
44
+ isLoading: true,
45
+ component: _jsx(Text, { fontWeight: "bold", mb: 2, children: "Loading your data\u2026" }),
46
+ },
47
+ parameters: {
48
+ layout: 'fullscreen',
49
+ },
50
+ };
51
+ export const NotLoading = {
52
+ name: 'Not Loading — renders children',
53
+ args: {
54
+ isLoading: false,
55
+ children: (_jsx(Box, { p: 6, borderWidth: "1px", borderRadius: "md", children: _jsx(Text, { children: "Content is visible because isLoading is false." }) })),
56
+ },
57
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.2.5",
4
+ "version": "0.2.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",