@basic-ui/material 1.0.0-alpha.19 → 1.0.0-alpha.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basic-ui/material",
3
- "version": "1.0.0-alpha.19",
3
+ "version": "1.0.0-alpha.20",
4
4
  "description": "Accessible React Components used as building blocks for UI patterns",
5
5
  "author": "Lucas Terra <lucasterra7@gmail.com>",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "test": "echo \"Error: no test specified\" && exit 1"
28
28
  },
29
29
  "dependencies": {
30
- "@basic-ui/core": "^0.0.47",
30
+ "@basic-ui/core": "^0.0.48",
31
31
  "@basic-ui/dynamic-theme": "^0.0.8",
32
32
  "@styled-system/should-forward-prop": "5.1.5",
33
33
  "@types/styled-system": "^5.1.10",
@@ -52,5 +52,5 @@
52
52
  "react": "^16.14.0 || ^17.0.0 || ^18.0.0",
53
53
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0"
54
54
  },
55
- "gitHead": "df48930923f035af2701c01a29722bea78a79581"
55
+ "gitHead": "399dd736f1a67f5ed2b040f1d22d2bb92e784ccb"
56
56
  }
@@ -0,0 +1,34 @@
1
+ import { Menu, MenuList, MenuItem, MenuPopover, ContextMenuTrigger } from '.';
2
+ import { Divider } from '../Divider';
3
+ import { Box } from '../Box';
4
+ // import './styles.css';
5
+
6
+ export default {
7
+ title: 'components/Menu/ContextMenu',
8
+ };
9
+
10
+ const ContextMenuUncontrolled = ({ disabled }: { disabled?: boolean }) => {
11
+ return (
12
+ <Box px={5}>
13
+ <Menu>
14
+ <ContextMenuTrigger as="button" disabled={disabled}>
15
+ I only show menu on right click
16
+ </ContextMenuTrigger>
17
+ <MenuPopover usePortal>
18
+ <MenuList>
19
+ <MenuItem>Dog</MenuItem>
20
+ <MenuItem>Lion</MenuItem>
21
+ <MenuItem disabled={true}>Cat</MenuItem>
22
+ <Divider />
23
+ <MenuItem>Bear</MenuItem>
24
+ </MenuList>
25
+ </MenuPopover>
26
+ </Menu>
27
+ </Box>
28
+ );
29
+ };
30
+
31
+ export const Uncontrolled = () => (
32
+ <ContextMenuUncontrolled disabled={undefined} />
33
+ );
34
+ export const Disabled = () => <ContextMenuUncontrolled disabled={true} />;
@@ -28,23 +28,11 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
28
28
  }
29
29
  );
30
30
 
31
- const SelectButtonInner = forwardRef<
32
- HTMLButtonElement,
33
- SelectProps & { innerAs?: ElementType<any> }
34
- >(({ innerAs = 'div', ...props }, forwardedRef) => {
35
- const InputButton: FC<SelectProps & RefAttributes<HTMLButtonElement>> =
36
- Input as any;
37
-
38
- return (
39
- <InputButton as={innerAs} ref={forwardedRef} tabIndex={0} {...props} />
40
- );
41
- });
42
-
43
31
  export const SelectButton = forwardRef<
44
32
  HTMLButtonElement,
45
33
  SelectProps & MenuButtonProps
46
- >(({ as, children, ...props }, ref) => (
47
- <BaseMenuButton as={SelectButtonInner} innerAs={as} ref={ref} {...props}>
34
+ >(({ as = 'div', children, ...props }, ref) => (
35
+ <BaseMenuButton as={Input} innerAs={as} ref={ref} tabIndex={0} {...props}>
48
36
  {children}
49
37
  </BaseMenuButton>
50
38
  ));