@contentful/f36-menu 4.0.1 → 4.1.0
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/CHANGELOG.md +11 -0
- package/README.mdx +9 -28
- package/dist/main.js +0 -0
- package/dist/main.js.map +0 -0
- package/dist/module.js +0 -0
- package/dist/module.js.map +0 -0
- package/dist/types.d.ts +0 -0
- package/dist/types.d.ts.map +0 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.1.0](https://github.com/contentful/forma-36/compare/@contentful/f36-menu@4.0.1...@contentful/f36-menu@4.1.0) (2022-01-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* implement props list redesign [BAU-535] ([#1756](https://github.com/contentful/forma-36/issues/1756)) ([21c57e7](https://github.com/contentful/forma-36/commit/21c57e72008b75990d03af4e7500edc1c7f3d26d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.0.1](https://github.com/contentful/forma-36/compare/@contentful/f36-menu@4.0.0...@contentful/f36-menu@4.0.1) (2022-01-11)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @contentful/f36-menu
|
package/README.mdx
CHANGED
|
@@ -3,6 +3,7 @@ title: 'Menu'
|
|
|
3
3
|
slug: /components/menu/
|
|
4
4
|
github: 'https://github.com/contentful/forma-36/tree/master/packages/components/menu'
|
|
5
5
|
typescript: ./src/Menu.tsx,./src/MenuItem/MenuItem.tsx,./src/MenuList/MenuList.tsx
|
|
6
|
+
storybook: 'https://v4-f36-storybook.netlify.app/?path=/story/components-menu--basic'
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
Menu is a component that offers a list of choices to the user, such as a set of actions or links.
|
|
@@ -19,7 +20,7 @@ import { Menu } from '@contentful/f36-components';
|
|
|
19
20
|
You can use following components to build a menu:
|
|
20
21
|
|
|
21
22
|
1. `<Menu>`: The main wrapper that provides nested components with all the context and state.
|
|
22
|
-
1. `<Menu.Trigger>` The wrapper for the menu list trigger. Must be a direct child of `<Menu>`.
|
|
23
|
+
1. `<Menu.Trigger>` The wrapper for the menu list trigger. Must be a direct child of `<Menu>`.
|
|
23
24
|
NOTE: 🚨 Ensure that the component that you pass accepts `ref`. Consider using `forwardRef` for functional components.
|
|
24
25
|
1. `<Menu.List>`: The wrapper for the menu items. Must be a direct child of `<Menu>`.
|
|
25
26
|
1. `<Menu.Item>` The trigger that handles menu selection. Must be a direct child of `<Menu.List>`.
|
|
@@ -54,29 +55,7 @@ By default the Menu component is uncontrolled. So when user clicks on the trigge
|
|
|
54
55
|
But you can control it by passing `isOpen` prop and `onClose`, `onOpen` callbacks.
|
|
55
56
|
|
|
56
57
|
```jsx file=examples/ControlledMenu.tsx
|
|
57
|
-
|
|
58
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
59
|
-
return (
|
|
60
|
-
<Menu
|
|
61
|
-
isOpen={isOpen}
|
|
62
|
-
onOpen={() => setIsOpen(true)}
|
|
63
|
-
onClose={() => setIsOpen(false)}
|
|
64
|
-
>
|
|
65
|
-
<Menu.Trigger>
|
|
66
|
-
<IconButton
|
|
67
|
-
variant="secondary"
|
|
68
|
-
icon={<MenuIcon />}
|
|
69
|
-
aria-label="toggle menu"
|
|
70
|
-
/>
|
|
71
|
-
</Menu.Trigger>
|
|
72
|
-
<Menu.List>
|
|
73
|
-
<Menu.Item>Create an entry</Menu.Item>
|
|
74
|
-
<Menu.Item>Remove an entry</Menu.Item>
|
|
75
|
-
<Menu.Item>Embed existing entry</Menu.Item>
|
|
76
|
-
</Menu.List>
|
|
77
|
-
</Menu>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
58
|
+
|
|
80
59
|
```
|
|
81
60
|
|
|
82
61
|
### Controlled Menu with custom trigger onClick callback
|
|
@@ -127,23 +106,25 @@ But if you have to provide your own toggle menu logic on the trigger component,
|
|
|
127
106
|
### With submenu
|
|
128
107
|
|
|
129
108
|
By default props like `closeOnSelect`, `closeOnBlur`, `closeOnEsc` that you pass to `Menu` will be shared to all submenus
|
|
130
|
-
|
|
109
|
+
but you can redefine them on any submenu by passing those props directly to that `Submenu`.
|
|
131
110
|
|
|
132
111
|
```jsx file=examples/MenuWithSubmenu.tsx
|
|
133
112
|
|
|
134
113
|
```
|
|
135
114
|
|
|
115
|
+
## Props (API reference)
|
|
116
|
+
|
|
136
117
|
### Menu
|
|
137
118
|
|
|
138
|
-
<
|
|
119
|
+
<PropsTable of="Menu" />
|
|
139
120
|
|
|
140
121
|
### Menu.Item
|
|
141
122
|
|
|
142
|
-
<
|
|
123
|
+
<PropsTable of="MenuItem" />
|
|
143
124
|
|
|
144
125
|
### Menu.List
|
|
145
126
|
|
|
146
|
-
<
|
|
127
|
+
<PropsTable of="MenuList" />
|
|
147
128
|
|
|
148
129
|
## Content guidelines
|
|
149
130
|
|
package/dist/main.js
CHANGED
|
File without changes
|
package/dist/main.js.map
CHANGED
|
File without changes
|
package/dist/module.js
CHANGED
|
File without changes
|
package/dist/module.js.map
CHANGED
|
File without changes
|
package/dist/types.d.ts
CHANGED
|
File without changes
|
package/dist/types.d.ts.map
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/f36-menu",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Forma 36: Menu component",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "parcel build"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@babel/runtime": "^7.6.2",
|
|
10
10
|
"@contentful/f36-core": "^4.0.1",
|
|
11
11
|
"@contentful/f36-icons": "^4.0.1",
|
|
12
|
-
"@contentful/f36-popover": "^4.0
|
|
12
|
+
"@contentful/f36-popover": "^4.1.0",
|
|
13
13
|
"@contentful/f36-tokens": "^4.0.0",
|
|
14
14
|
"@contentful/f36-typography": "^4.0.1",
|
|
15
15
|
"@contentful/f36-utils": "^4.0.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "1233b527fe40be14bbeccf8c9693eb338bed6ab5"
|
|
39
39
|
}
|