@vrobots/storybook 0.1.35 → 0.1.38

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.35",
4
+ "version": "0.1.38",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { AccordionRootProps } from "@chakra-ui/react";
3
+ export interface IAccordionItem {
4
+ title: React.ReactNode;
5
+ component: React.ReactNode;
6
+ }
7
+ export interface IAccordionProps extends AccordionRootProps {
8
+ items?: IAccordionItem[];
9
+ }
10
+ export declare const Accordion: React.ForwardRefExoticComponent<IAccordionProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Accordion as ChakraAccordion, Span } from "@chakra-ui/react";
4
+ const createAccordionItem = (item, index) => (_jsxs(ChakraAccordion.Item, { value: index.toString(), children: [_jsxs(ChakraAccordion.ItemTrigger, { children: [_jsx(Span, { flex: "1", children: item.title }), _jsx(ChakraAccordion.ItemIndicator, {})] }), _jsx(ChakraAccordion.ItemContent, { children: _jsx(ChakraAccordion.ItemBody, { children: item.component }) })] }, index));
5
+ export const Accordion = React.forwardRef(({ items = [], ...props }, ref) => {
6
+ return (_jsx(ChakraAccordion.Root, { ref: ref, ...props, children: items.map(createAccordionItem) }));
7
+ });
8
+ Accordion.displayName = "Accordion";
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { TimelineRootProps } from "@chakra-ui/react";
3
+ import * as Icons from "react-icons/md";
4
+ export interface ITimelineItem {
5
+ date: string;
6
+ icon: keyof typeof Icons;
7
+ title?: string;
8
+ component?: React.ReactNode;
9
+ }
10
+ export interface ITimelineProps extends TimelineRootProps {
11
+ items?: ITimelineItem[];
12
+ }
13
+ export declare const Timeline: React.ForwardRefExoticComponent<ITimelineProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Timeline as ChakraTimeline } from "@chakra-ui/react";
4
+ import * as Icons from "react-icons/md";
5
+ const createTimelineItem = (item, index) => (_jsxs(ChakraTimeline.Item, { children: [_jsxs(ChakraTimeline.Connector, { children: [_jsx(ChakraTimeline.Separator, {}), _jsx(ChakraTimeline.Indicator, { children: Icons[item.icon] ? React.createElement(Icons[item.icon]) : null })] }), _jsxs(ChakraTimeline.Content, { children: [_jsx(ChakraTimeline.Description, { pt: 1, children: item.date }), !!item.title && _jsx(ChakraTimeline.Title, { textStyle: "sm", children: item.title }), item.component || null] })] }, item.date + index));
6
+ export const Timeline = React.forwardRef(({ items = [], ...props }, ref) => {
7
+ return (_jsx(ChakraTimeline.Root, { ref: ref, ...props, children: items.map(createTimelineItem) }));
8
+ });
9
+ Timeline.displayName = "Timeline";
@@ -1,4 +1,5 @@
1
1
  export * from './ui/color-mode';
2
+ export * from './Accordion';
2
3
  export * from './AvatarIconMenu';
3
4
  export * from './Breadcrumbs';
4
5
  export * from './Display';
@@ -9,3 +10,4 @@ export * from './Menu';
9
10
  export * from './Page';
10
11
  export * from './Section';
11
12
  export * from './Sidebar';
13
+ export * from './Timeline';
@@ -1,4 +1,5 @@
1
1
  export * from './ui/color-mode';
2
+ export * from './Accordion';
2
3
  export * from './AvatarIconMenu';
3
4
  export * from './Breadcrumbs';
4
5
  export * from './Display';
@@ -9,3 +10,4 @@ export * from './Menu';
9
10
  export * from './Page';
10
11
  export * from './Section';
11
12
  export * from './Sidebar';
13
+ export * from './Timeline';
@@ -0,0 +1,14 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import { IAccordionItem } from '../components/Accordion';
3
+ export declare const EXAMPLE_TIMELINE_ITEMS: IAccordionItem[];
4
+ declare const meta: {
5
+ title: string;
6
+ component: import("react").ForwardRefExoticComponent<import("../components").IAccordionProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ tags: string[];
8
+ parameters: {
9
+ layout: string;
10
+ };
11
+ };
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+ export declare const Component: Story;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Accordion } from '../components/Accordion';
3
+ import { Heading } from '@chakra-ui/react';
4
+ export const EXAMPLE_TIMELINE_ITEMS = [
5
+ {
6
+ title: _jsx(Heading, { size: "md", children: "Accordion Item 1" }),
7
+ component: _jsx("div", { children: "This is the content of Accordion Item 1" }),
8
+ },
9
+ ];
10
+ const meta = {
11
+ title: 'Data/Accordion',
12
+ component: Accordion,
13
+ tags: ['autodocs'],
14
+ parameters: {
15
+ layout: 'fullscreen',
16
+ },
17
+ };
18
+ export default meta;
19
+ export const Component = {
20
+ args: {
21
+ items: EXAMPLE_TIMELINE_ITEMS
22
+ }
23
+ };
@@ -0,0 +1,14 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import { ITimelineItem } from '../components/Timeline';
3
+ export declare const EXAMPLE_TIMELINE_ITEMS: ITimelineItem[];
4
+ declare const meta: {
5
+ title: string;
6
+ component: import("react").ForwardRefExoticComponent<import("../components").ITimelineProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ tags: string[];
8
+ parameters: {
9
+ layout: string;
10
+ };
11
+ };
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+ export declare const Component: Story;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Timeline } from '../components/Timeline';
3
+ export const EXAMPLE_TIMELINE_ITEMS = [
4
+ {
5
+ date: "18th May 2021",
6
+ title: "Order Confirmed",
7
+ component: _jsx("div", { children: "Order confirmed and processing" }),
8
+ icon: 'MdAddBusiness'
9
+ },
10
+ ];
11
+ const meta = {
12
+ title: 'Data/Timeline',
13
+ component: Timeline,
14
+ tags: ['autodocs'],
15
+ parameters: {
16
+ layout: 'fullscreen',
17
+ },
18
+ };
19
+ export default meta;
20
+ export const Component = {
21
+ args: {
22
+ items: EXAMPLE_TIMELINE_ITEMS
23
+ }
24
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.35",
4
+ "version": "0.1.38",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",