@vrobots/storybook 0.2.13 → 0.2.15

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.13",
4
+ "version": "0.2.15",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -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) => (_jsx(Listbox.Item, { item: framework, pl: 4, pr: 4, ...([selected].includes(framework.value) ? selectedColorSchema : undefined), children: _jsx(Listbox.ItemText, { children: framework.label }) }, `${framework.label} ${i + 1}`))) })] }));
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';
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { forwardRef } from "react";
3
3
  import { Box, IconButton } from "@chakra-ui/react";
4
- import { useColorMode } from "./ui/color-mode";
5
4
  import { LuMenu } from "react-icons/lu";
6
5
  import { motion } from "motion/react";
7
6
  import { useBreakpoint, useIsMobile } from "../hooks";
@@ -26,7 +25,6 @@ export const SidebarToggleButton = (props) => {
26
25
  };
27
26
  export const Sidebar = forwardRef((props, ref) => {
28
27
  const sidebar = useSidebar();
29
- const { colorMode } = useColorMode();
30
28
  const breakpoint = useBreakpoint();
31
29
  const isMobile = useIsMobile();
32
30
  const [mounted, setMounted] = React.useState(false);
@@ -6,5 +6,9 @@ export const toaster = createToaster({
6
6
  pauseOnPageIdle: true,
7
7
  });
8
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, {})] })) }) }));
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, { color: "fg", bg: "bg.muted", borderWidth: "1px", borderColor: "border.emphasized", _hover: { bg: "bg.emphasized" }, _focusVisible: {
10
+ outline: "2px solid",
11
+ outlineColor: "blue.400",
12
+ outlineOffset: "2px",
13
+ } }))] })) }) }));
10
14
  };
@@ -3,7 +3,7 @@ export const useSelectedColorSchema = (_color) => {
3
3
  const { colorMode } = useColorMode();
4
4
  return {
5
5
  color: 'neu.text',
6
- bgColor: colorMode === 'light' ? 'neu.bg' : 'neu.surface',
6
+ bgColor: _color ? `${_color}.${colorMode === 'light' ? '500' : '200'}` : 'neu.bg',
7
7
  boxShadow: 'neuInset',
8
8
  };
9
9
  };
@@ -1,7 +1,9 @@
1
1
  import type { StoryObj } from '@storybook/react-vite';
2
+ import * as Icons from 'react-icons/md';
2
3
  export declare const SIDEBAR_MENU: {
3
4
  label: string;
4
5
  value: string;
6
+ icon: keyof typeof Icons;
5
7
  }[];
6
8
  declare const meta: {
7
9
  title: string;
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Sidebar, SidebarProvider } from '../components/Sidebar';
3
3
  import { Menu } from '../components/Menu';
4
4
  export const SIDEBAR_MENU = [
5
- { label: 'Dashboard', value: 'dashboard' },
6
- { label: 'Settings', value: 'settings' },
7
- { label: 'Profile', value: 'profile' },
8
- { label: 'Logout', value: 'logout' },
5
+ { label: 'Dashboard', value: 'dashboard', icon: 'MdDashboard' },
6
+ { label: 'Settings', value: 'settings', icon: 'MdSettings' },
7
+ { label: 'Profile', value: 'profile', icon: 'MdPerson' },
8
+ { label: 'Logout', value: 'logout', icon: 'MdLogout' },
9
9
  ];
10
10
  const meta = {
11
11
  title: 'Frame/Sidebar',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.2.13",
4
+ "version": "0.2.15",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",