@contentful/field-editor-reference 5.31.1 → 5.31.2

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.
@@ -94,7 +94,7 @@ const styles = {
94
94
  };
95
95
  const CreateEntryMenuTrigger = ({ contentTypes, suggestedContentTypeId, contentTypesLabel, onSelect, testId, dropdownSettings = {
96
96
  position: 'bottom-left'
97
- }, customDropdownItems, children, menuProps })=>{
97
+ }, customDropdownItems, children, menuProps, filterExperienceTypes = true })=>{
98
98
  const [isOpen, setOpen] = (0, _react.useState)(false);
99
99
  const [isSelecting, setSelecting] = (0, _react.useState)(false);
100
100
  const [searchInput, setSearchInput] = (0, _react.useState)('');
@@ -102,11 +102,12 @@ const CreateEntryMenuTrigger = ({ contentTypes, suggestedContentTypeId, contentT
102
102
  const textField = (0, _react.useRef)(null);
103
103
  const menuListRef = (0, _react.useRef)(null);
104
104
  const [dropdownWidth, setDropdownWidth] = (0, _react.useState)();
105
- const filteredContentTypes = (0, _react.useMemo)(()=>contentTypes.filter((contentType)=>{
105
+ const filteredContentTypes = (0, _react.useMemo)(()=>filterExperienceTypes ? contentTypes.filter((contentType)=>{
106
106
  const annotations = (0, _get.default)(contentType, 'metadata.annotations.ContentType', []);
107
107
  return !annotations.some((annotation)=>(0, _get.default)(annotation, 'sys.id') === 'Contentful:ExperienceType');
108
- }), [
109
- contentTypes
108
+ }) : contentTypes, [
109
+ contentTypes,
110
+ filterExperienceTypes
110
111
  ]);
111
112
  const hasDropdown = contentTypes.length > 1 || !!customDropdownItems;
112
113
  const closeMenu = ()=>setOpen(false);
@@ -204,5 +205,6 @@ const CreateEntryMenuTrigger = ({ contentTypes, suggestedContentTypeId, contentT
204
205
  };
205
206
  CreateEntryMenuTrigger.defaultProps = {
206
207
  testId: 'create-entry-button-menu-trigger',
207
- contentTypesLabel: 'All Content Types'
208
+ contentTypesLabel: 'All Content Types',
209
+ filterExperienceTypes: true
208
210
  };
@@ -38,7 +38,7 @@ const styles = {
38
38
  };
39
39
  export const CreateEntryMenuTrigger = ({ contentTypes, suggestedContentTypeId, contentTypesLabel, onSelect, testId, dropdownSettings = {
40
40
  position: 'bottom-left'
41
- }, customDropdownItems, children, menuProps })=>{
41
+ }, customDropdownItems, children, menuProps, filterExperienceTypes = true })=>{
42
42
  const [isOpen, setOpen] = useState(false);
43
43
  const [isSelecting, setSelecting] = useState(false);
44
44
  const [searchInput, setSearchInput] = useState('');
@@ -46,11 +46,12 @@ export const CreateEntryMenuTrigger = ({ contentTypes, suggestedContentTypeId, c
46
46
  const textField = useRef(null);
47
47
  const menuListRef = useRef(null);
48
48
  const [dropdownWidth, setDropdownWidth] = useState();
49
- const filteredContentTypes = useMemo(()=>contentTypes.filter((contentType)=>{
49
+ const filteredContentTypes = useMemo(()=>filterExperienceTypes ? contentTypes.filter((contentType)=>{
50
50
  const annotations = get(contentType, 'metadata.annotations.ContentType', []);
51
51
  return !annotations.some((annotation)=>get(annotation, 'sys.id') === 'Contentful:ExperienceType');
52
- }), [
53
- contentTypes
52
+ }) : contentTypes, [
53
+ contentTypes,
54
+ filterExperienceTypes
54
55
  ]);
55
56
  const hasDropdown = contentTypes.length > 1 || !!customDropdownItems;
56
57
  const closeMenu = ()=>setOpen(false);
@@ -148,5 +149,6 @@ export const CreateEntryMenuTrigger = ({ contentTypes, suggestedContentTypeId, c
148
149
  };
149
150
  CreateEntryMenuTrigger.defaultProps = {
150
151
  testId: 'create-entry-button-menu-trigger',
151
- contentTypesLabel: 'All Content Types'
152
+ contentTypesLabel: 'All Content Types',
153
+ filterExperienceTypes: true
152
154
  };
@@ -22,12 +22,14 @@ interface CreateEntryMenuTrigger {
22
22
  customDropdownItems?: React.ReactNode;
23
23
  children: CreateEntryMenuTriggerChild;
24
24
  menuProps?: Omit<MenuProps, 'children'>;
25
+ filterExperienceTypes?: boolean;
25
26
  }
26
27
  export declare const CreateEntryMenuTrigger: {
27
- ({ contentTypes, suggestedContentTypeId, contentTypesLabel, onSelect, testId, dropdownSettings, customDropdownItems, children, menuProps, }: CreateEntryMenuTrigger): React.JSX.Element;
28
+ ({ contentTypes, suggestedContentTypeId, contentTypesLabel, onSelect, testId, dropdownSettings, customDropdownItems, children, menuProps, filterExperienceTypes, }: CreateEntryMenuTrigger): React.JSX.Element;
28
29
  defaultProps: {
29
30
  testId: string;
30
31
  contentTypesLabel: string;
32
+ filterExperienceTypes: boolean;
31
33
  };
32
34
  };
33
35
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "5.31.1",
3
+ "version": "5.31.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "registry": "https://npm.pkg.github.com/"
66
66
  },
67
- "gitHead": "05beff8083e711ec10c00a95e49ce0ea6135db08"
67
+ "gitHead": "eb3a6f6fd6b37d1ec6fb83dc8401a55ebfe4ff68"
68
68
  }