@strapi/admin 4.6.0-beta.2 → 4.6.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.
Files changed (160) hide show
  1. package/admin/src/components/ConfigurationsProvider/index.js +21 -18
  2. package/admin/src/components/ConfigurationsProvider/reducer.js +1 -0
  3. package/admin/src/components/LeftMenu/index.js +53 -50
  4. package/admin/src/components/UnauthenticatedLogo/index.js +1 -1
  5. package/admin/src/content-manager/components/Hint/index.js +4 -17
  6. package/admin/src/content-manager/components/InputUID/index.js +3 -14
  7. package/admin/src/content-manager/components/PreviewWysiwyg/Wrapper.js +22 -27
  8. package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +19 -28
  9. package/admin/src/content-manager/components/Wysiwyg/index.js +4 -8
  10. package/admin/src/content-manager/pages/App/LeftMenu/index.js +3 -8
  11. package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +1 -0
  12. package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +24 -0
  13. package/admin/src/content-manager/pages/EditView/{Informations → Information}/index.js +55 -39
  14. package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js +0 -0
  15. package/admin/src/content-manager/pages/EditView/index.js +3 -3
  16. package/admin/src/core/store/configureStore.js +22 -4
  17. package/admin/src/core/utils/axiosInstance.js +4 -2
  18. package/admin/src/hooks/useSettingsMenu/init.js +2 -25
  19. package/admin/src/hooks/useSettingsMenu/utils/adminLinks.js +4 -0
  20. package/admin/src/hooks/useSettingsMenu/utils/customAdminLinks.js +1 -0
  21. package/admin/src/hooks/useSettingsMenu/utils/defaultAdminLinks.js +21 -0
  22. package/admin/src/index.js +3 -3
  23. package/admin/src/pages/App/index.js +6 -2
  24. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/CustomizationInfos/index.js +142 -0
  25. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/init.js +3 -0
  26. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/reducer.js +20 -0
  27. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +21 -17
  28. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +68 -42
  29. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +5 -1
  30. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +1 -1
  31. package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -11
  32. package/admin/src/permissions/defaultPermissions.js +4 -0
  33. package/admin/src/translations/en.json +22 -16
  34. package/build/2607.ce06608e.chunk.js +66 -0
  35. package/build/{2743.692b1f21.chunk.js → 2743.dea372fb.chunk.js} +14 -14
  36. package/build/3075.03ebe93d.chunk.js +115 -0
  37. package/build/3632.963ac97d.chunk.js +138 -0
  38. package/build/{4318.87affaf2.chunk.js → 4318.8cb388a5.chunk.js} +1 -1
  39. package/build/4656.a0d43cca.chunk.js +159 -0
  40. package/build/{5015.f5e15fdb.chunk.js → 5015.8e3fe50b.chunk.js} +1 -1
  41. package/build/{3557.e7115160.chunk.js → 5910.a5374848.chunk.js} +130 -90
  42. package/build/{8633.6f546066.chunk.js → 8633.4af74a50.chunk.js} +1 -1
  43. package/build/9641.a311b612.chunk.js +276 -0
  44. package/build/9707.62831b4d.chunk.js +101 -0
  45. package/build/Admin-authenticatedApp.50dc27f9.chunk.js +75 -0
  46. package/build/Admin_homePage.79ab880c.chunk.js +77 -0
  47. package/build/Admin_marketplace.eabf21b2.chunk.js +26 -0
  48. package/build/{Admin_pluginsPage.d2a9a619.chunk.js → Admin_pluginsPage.953e796b.chunk.js} +1 -1
  49. package/build/{Admin_profilePage.5e830ceb.chunk.js → Admin_profilePage.5c2efda5.chunk.js} +1 -1
  50. package/build/Admin_settingsPage.19cfb9ca.chunk.js +178 -0
  51. package/build/{Upload_ConfigureTheView.9bdf41b5.chunk.js → Upload_ConfigureTheView.3f2b6e6a.chunk.js} +1 -1
  52. package/build/admin-app.34295b50.chunk.js +112 -0
  53. package/build/{admin-edit-roles-page.32bfe5ea.chunk.js → admin-edit-roles-page.d50d9654.chunk.js} +1 -1
  54. package/build/admin-edit-users.912b856d.chunk.js +10 -0
  55. package/build/admin-users.e36e7111.chunk.js +11 -0
  56. package/build/{api-tokens-list-page.a55e427c.chunk.js → api-tokens-list-page.1cd86136.chunk.js} +1 -1
  57. package/build/audit-logs-settings-page.308a6250.chunk.js +1 -0
  58. package/build/{content-manager.ad929a94.chunk.js → content-manager.851f40ce.chunk.js} +128 -132
  59. package/build/content-type-builder-list-view.4243b2b1.chunk.js +198 -0
  60. package/build/{content-type-builder-translation-de-json.29df67b8.chunk.js → content-type-builder-translation-de-json.0979cccb.chunk.js} +1 -1
  61. package/build/{content-type-builder-translation-dk-json.e22d2527.chunk.js → content-type-builder-translation-dk-json.e05583e9.chunk.js} +1 -1
  62. package/build/content-type-builder-translation-en-json.e577d595.chunk.js +1 -0
  63. package/build/{content-type-builder-translation-es-json.1044b252.chunk.js → content-type-builder-translation-es-json.fe4daad8.chunk.js} +1 -1
  64. package/build/{content-type-builder-translation-fr-json.2183e6b3.chunk.js → content-type-builder-translation-fr-json.b1eb52f6.chunk.js} +1 -1
  65. package/build/{content-type-builder-translation-id-json.ba3e8891.chunk.js → content-type-builder-translation-id-json.ee3b36bb.chunk.js} +1 -1
  66. package/build/{content-type-builder-translation-it-json.d4661201.chunk.js → content-type-builder-translation-it-json.13b3c26a.chunk.js} +1 -1
  67. package/build/{content-type-builder-translation-ko-json.57ff7f51.chunk.js → content-type-builder-translation-ko-json.8a274be5.chunk.js} +1 -1
  68. package/build/{content-type-builder-translation-pl-json.a057b51e.chunk.js → content-type-builder-translation-pl-json.24a34349.chunk.js} +1 -1
  69. package/build/{content-type-builder-translation-pt-BR-json.446df9da.chunk.js → content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js} +1 -1
  70. package/build/{content-type-builder-translation-ru-json.8c51843e.chunk.js → content-type-builder-translation-ru-json.54d11230.chunk.js} +1 -1
  71. package/build/{content-type-builder-translation-sv-json.af6ecca1.chunk.js → content-type-builder-translation-sv-json.59f5e1e5.chunk.js} +1 -1
  72. package/build/{content-type-builder-translation-tr-json.da83a07e.chunk.js → content-type-builder-translation-tr-json.cea4d226.chunk.js} +1 -1
  73. package/build/{content-type-builder-translation-zh-json.42f94cb3.chunk.js → content-type-builder-translation-zh-json.faedd610.chunk.js} +1 -1
  74. package/build/content-type-builder.365b6bf4.chunk.js +125 -0
  75. package/build/email-settings-page.379552b1.chunk.js +15 -0
  76. package/build/en-json.38d182e5.chunk.js +1 -0
  77. package/build/i18n-settings-page.3ab28b1a.chunk.js +65 -0
  78. package/build/{i18n-translation-de-json.dc876c08.chunk.js → i18n-translation-de-json.362384a6.chunk.js} +1 -1
  79. package/build/{i18n-translation-dk-json.49aaf933.chunk.js → i18n-translation-dk-json.89401417.chunk.js} +1 -1
  80. package/build/{i18n-translation-en-json.ac9ebc1b.chunk.js → i18n-translation-en-json.60af6722.chunk.js} +1 -1
  81. package/build/{i18n-translation-es-json.57072ed3.chunk.js → i18n-translation-es-json.87b494d1.chunk.js} +1 -1
  82. package/build/{i18n-translation-fr-json.84733f34.chunk.js → i18n-translation-fr-json.57ddc77e.chunk.js} +1 -1
  83. package/build/{i18n-translation-ko-json.fc73fe20.chunk.js → i18n-translation-ko-json.ef4f9471.chunk.js} +1 -1
  84. package/build/{i18n-translation-pl-json.16e5df90.chunk.js → i18n-translation-pl-json.dfac513d.chunk.js} +1 -1
  85. package/build/{i18n-translation-tr-json.cb39c048.chunk.js → i18n-translation-tr-json.10f0600d.chunk.js} +1 -1
  86. package/build/{i18n-translation-zh-Hans-json.2cf82d2d.chunk.js → i18n-translation-zh-Hans-json.757ce62d.chunk.js} +1 -1
  87. package/build/{i18n-translation-zh-json.ed1d272e.chunk.js → i18n-translation-zh-json.bef2dc07.chunk.js} +1 -1
  88. package/build/index.html +1 -1
  89. package/build/main.9f31732e.js +4454 -0
  90. package/build/runtime~main.2b8e2318.js +2 -0
  91. package/build/sso-settings-page.b64a44e8.chunk.js +41 -0
  92. package/build/upload-settings.6c26ff37.chunk.js +89 -0
  93. package/build/upload.2c69d238.chunk.js +38 -0
  94. package/build/users-advanced-settings-page.c4270682.chunk.js +13 -0
  95. package/build/users-email-settings-page.60422a2f.chunk.js +28 -0
  96. package/build/users-providers-settings-page.e1834060.chunk.js +104 -0
  97. package/build/{users-roles-settings-page.ad28ab42.chunk.js → users-roles-settings-page.3ef35132.chunk.js} +1 -1
  98. package/build/webhook-edit-page.c0080dc1.chunk.js +75 -0
  99. package/build/webhook-list-page.f75ba3f2.chunk.js +42 -0
  100. package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +17 -0
  101. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +0 -0
  102. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionItem.js +0 -0
  103. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/index.js +5 -1
  104. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/PaginationFooter/index.js +0 -0
  105. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +0 -0
  106. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +0 -0
  107. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/index.js +7 -7
  108. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +3 -0
  109. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +0 -0
  110. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +1 -1
  111. package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/index.js +3 -3
  112. package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/utils/schema.js +0 -0
  113. package/ee/admin/pages/SettingsPage/utils/customRoutes.js +28 -16
  114. package/ee/server/bootstrap.js +2 -0
  115. package/ee/server/routes/index.js +94 -10
  116. package/ee/server/services/audit-logs.js +19 -1
  117. package/ee/server/services/passport/sso.js +13 -1
  118. package/ee/server/services/passport.js +1 -4
  119. package/package.json +11 -16
  120. package/server/controllers/admin.js +3 -2
  121. package/server/register.js +7 -7
  122. package/server/services/project-settings.js +10 -6
  123. package/server/services/user.js +3 -1
  124. package/server/validation/project-settings.js +19 -10
  125. package/strapi-server.js +1 -1
  126. package/admin/src/core/store/createReducer.js +0 -5
  127. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
  128. package/build/2235.746d3cf7.chunk.js +0 -106
  129. package/build/2598.01c96bd5.chunk.js +0 -159
  130. package/build/4958.1979bbf5.chunk.js +0 -276
  131. package/build/5052.c2eacff2.chunk.js +0 -65
  132. package/build/7295.4e2dfbbb.chunk.js +0 -114
  133. package/build/805.da20168c.chunk.js +0 -138
  134. package/build/874.be41e4b3.chunk.js +0 -104
  135. package/build/9707.a07db355.chunk.js +0 -101
  136. package/build/Admin-authenticatedApp.9933974c.chunk.js +0 -75
  137. package/build/Admin_homePage.045bb0c8.chunk.js +0 -77
  138. package/build/Admin_marketplace.bf3ac090.chunk.js +0 -26
  139. package/build/Admin_settingsPage.53fa00a4.chunk.js +0 -178
  140. package/build/admin-app.8ed108ca.chunk.js +0 -112
  141. package/build/admin-audit-logs.68f833bf.chunk.js +0 -1
  142. package/build/admin-edit-users.795f155c.chunk.js +0 -10
  143. package/build/admin-users.cbd9bcf7.chunk.js +0 -11
  144. package/build/content-type-builder-list-view.3048854d.chunk.js +0 -198
  145. package/build/content-type-builder-translation-en-json.08e28f4e.chunk.js +0 -1
  146. package/build/content-type-builder.4edd1c22.chunk.js +0 -127
  147. package/build/email-settings-page.7c9e6c5e.chunk.js +0 -15
  148. package/build/en-json.d65a13ef.chunk.js +0 -1
  149. package/build/i18n-settings-page.fbccdf12.chunk.js +0 -1
  150. package/build/main.6bbf9950.js +0 -4417
  151. package/build/runtime~main.c2bf62af.js +0 -2
  152. package/build/sso-settings-page.4031de9e.chunk.js +0 -41
  153. package/build/upload-settings.657790fd.chunk.js +0 -89
  154. package/build/upload.608a9856.chunk.js +0 -38
  155. package/build/users-advanced-settings-page.e3ab865f.chunk.js +0 -13
  156. package/build/users-email-settings-page.57adf9b7.chunk.js +0 -28
  157. package/build/users-providers-settings-page.7d1fb45c.chunk.js +0 -1
  158. package/build/webhook-edit-page.1dd6d040.chunk.js +0 -75
  159. package/build/webhook-list-page.98afa3ea.chunk.js +0 -42
  160. package/ee/server/routes/features-routes.js +0 -66
@@ -1,45 +1,48 @@
1
- import React, { useMemo, useReducer, useRef } from 'react';
1
+ import React, { useCallback, useMemo, useReducer } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { ConfigurationsContext } from '../../contexts';
4
4
  import reducer, { initialState } from './reducer';
5
5
 
6
6
  const ConfigurationsProvider = ({
7
7
  children,
8
- authLogo,
8
+ authLogo: defaultAuthLogo,
9
9
  menuLogo: defaultMenuLogo,
10
10
  showReleaseNotification,
11
11
  showTutorials,
12
12
  }) => {
13
- const [{ menuLogo }, dispatch] = useReducer(reducer, initialState);
13
+ const [{ menuLogo, authLogo }, dispatch] = useReducer(reducer, initialState);
14
14
 
15
- const updateProjectSettings = ({ menuLogo }) => {
16
- return dispatch({
17
- type: 'UPDATE_PROJECT_SETTINGS',
18
- values: {
19
- menuLogo: menuLogo || defaultMenuLogo,
20
- },
21
- });
22
- };
23
-
24
- const updateProjectSettingsRef = useRef(updateProjectSettings);
15
+ const updateProjectSettings = useCallback(
16
+ ({ menuLogo, authLogo }) => {
17
+ return dispatch({
18
+ type: 'UPDATE_PROJECT_SETTINGS',
19
+ values: {
20
+ menuLogo: menuLogo || defaultMenuLogo,
21
+ authLogo: authLogo || defaultAuthLogo,
22
+ },
23
+ });
24
+ },
25
+ [defaultAuthLogo, defaultMenuLogo]
26
+ );
25
27
 
26
28
  const configurationValue = useMemo(() => {
27
29
  return {
28
30
  logos: {
29
31
  menu: { custom: menuLogo, default: defaultMenuLogo },
30
- auth: { custom: null, default: authLogo },
32
+ auth: { custom: authLogo, default: defaultAuthLogo },
31
33
  },
32
- updateProjectSettings: updateProjectSettingsRef.current,
34
+ updateProjectSettings,
33
35
  showReleaseNotification,
34
36
  showTutorials,
35
37
  };
36
38
  }, [
37
- authLogo,
38
39
  menuLogo,
40
+ defaultMenuLogo,
41
+ authLogo,
42
+ defaultAuthLogo,
43
+ updateProjectSettings,
39
44
  showReleaseNotification,
40
45
  showTutorials,
41
- updateProjectSettingsRef,
42
- defaultMenuLogo,
43
46
  ]);
44
47
 
45
48
  return (
@@ -9,6 +9,7 @@ import produce from 'immer';
9
9
 
10
10
  const initialState = {
11
11
  menuLogo: null,
12
+ authLogo: null,
12
13
  };
13
14
 
14
15
  const reducer = (state = initialState, action) =>
@@ -12,6 +12,7 @@ import {
12
12
  NavSection,
13
13
  NavUser,
14
14
  NavCondense,
15
+ NavFooter,
15
16
  } from '@strapi/design-system/v2/MainNav';
16
17
  import { FocusTrap } from '@strapi/design-system/FocusTrap';
17
18
  import { Box } from '@strapi/design-system/Box';
@@ -183,57 +184,59 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
183
184
  ) : null}
184
185
  </NavSections>
185
186
 
186
- <NavUser
187
- id="main-nav-user-button"
188
- ref={buttonRef}
189
- onClick={handleToggleUserLinks}
190
- initials={initials}
191
- >
192
- {userDisplayName}
193
- </NavUser>
194
- {userLinksVisible && (
195
- <LinkUserWrapper
196
- onBlur={handleBlur}
197
- padding={1}
198
- shadow="tableShadow"
199
- background="neutral0"
200
- hasRadius
187
+ <NavFooter>
188
+ <NavUser
189
+ id="main-nav-user-button"
190
+ ref={buttonRef}
191
+ onClick={handleToggleUserLinks}
192
+ initials={initials}
201
193
  >
202
- <FocusTrap onEscape={handleToggleUserLinks}>
203
- <Stack spacing={0}>
204
- <LinkUser tabIndex={0} onClick={handleToggleUserLinks} to="/me">
205
- <Typography>
206
- {formatMessage({
207
- id: 'global.profile',
208
- defaultMessage: 'Profile',
209
- })}
210
- </Typography>
211
- </LinkUser>
212
- <LinkUser as="button" tabIndex={0} onClick={handleLogout} logout="logout">
213
- <Typography textColor="danger600">
214
- {formatMessage({
215
- id: 'app.components.LeftMenu.logout',
216
- defaultMessage: 'Logout',
217
- })}
218
- </Typography>
219
- <Exit />
220
- </LinkUser>
221
- </Stack>
222
- </FocusTrap>
223
- </LinkUserWrapper>
224
- )}
225
-
226
- <NavCondense onClick={() => setCondensed((s) => !s)}>
227
- {condensed
228
- ? formatMessage({
229
- id: 'app.components.LeftMenu.expand',
230
- defaultMessage: 'Expand the navbar',
231
- })
232
- : formatMessage({
233
- id: 'app.components.LeftMenu.collapse',
234
- defaultMessage: 'Collapse the navbar',
235
- })}
236
- </NavCondense>
194
+ {userDisplayName}
195
+ </NavUser>
196
+ {userLinksVisible && (
197
+ <LinkUserWrapper
198
+ onBlur={handleBlur}
199
+ padding={1}
200
+ shadow="tableShadow"
201
+ background="neutral0"
202
+ hasRadius
203
+ >
204
+ <FocusTrap onEscape={handleToggleUserLinks}>
205
+ <Stack spacing={0}>
206
+ <LinkUser tabIndex={0} onClick={handleToggleUserLinks} to="/me">
207
+ <Typography>
208
+ {formatMessage({
209
+ id: 'global.profile',
210
+ defaultMessage: 'Profile',
211
+ })}
212
+ </Typography>
213
+ </LinkUser>
214
+ <LinkUser tabIndex={0} onClick={handleLogout} logout="logout" to="/auth/login">
215
+ <Typography textColor="danger600">
216
+ {formatMessage({
217
+ id: 'app.components.LeftMenu.logout',
218
+ defaultMessage: 'Logout',
219
+ })}
220
+ </Typography>
221
+ <Exit />
222
+ </LinkUser>
223
+ </Stack>
224
+ </FocusTrap>
225
+ </LinkUserWrapper>
226
+ )}
227
+
228
+ <NavCondense onClick={() => setCondensed((s) => !s)}>
229
+ {condensed
230
+ ? formatMessage({
231
+ id: 'app.components.LeftMenu.expand',
232
+ defaultMessage: 'Expand the navbar',
233
+ })
234
+ : formatMessage({
235
+ id: 'app.components.LeftMenu.collapse',
236
+ defaultMessage: 'Collapse the navbar',
237
+ })}
238
+ </NavCondense>
239
+ </NavFooter>
237
240
  </MainNav>
238
241
  );
239
242
  };
@@ -11,7 +11,7 @@ const Logo = () => {
11
11
  logos: { auth },
12
12
  } = useConfigurations();
13
13
 
14
- return <Img src={auth.default} aria-hidden alt="" />;
14
+ return <Img src={auth?.custom ?? auth.default} aria-hidden alt="" />;
15
15
  };
16
16
 
17
17
  export default Logo;
@@ -1,18 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
3
  import { Typography } from '@strapi/design-system/Typography';
5
4
 
6
- export const Hint = ({ id, error, name, description }) => {
7
- const { formatMessage } = useIntl();
8
- const hint = description
9
- ? formatMessage(
10
- { id: description.id, defaultMessage: description.defaultMessage },
11
- { ...description.values }
12
- )
13
- : '';
14
-
15
- if (!hint || error) {
5
+ export const Hint = ({ id, error, name, hint }) => {
6
+ if (hint.length === 0 || error) {
16
7
  return null;
17
8
  }
18
9
 
@@ -25,16 +16,12 @@ export const Hint = ({ id, error, name, description }) => {
25
16
 
26
17
  Hint.defaultProps = {
27
18
  id: undefined,
28
- description: undefined,
29
19
  error: undefined,
20
+ hint: '',
30
21
  };
31
22
 
32
23
  Hint.propTypes = {
33
- description: PropTypes.shape({
34
- id: PropTypes.string.isRequired,
35
- defaultMessage: PropTypes.string.isRequired,
36
- values: PropTypes.object,
37
- }),
24
+ hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
38
25
  error: PropTypes.string,
39
26
  id: PropTypes.string,
40
27
  name: PropTypes.string.isRequired,
@@ -23,7 +23,7 @@ import {
23
23
  const InputUID = ({
24
24
  attribute,
25
25
  contentTypeUID,
26
- description,
26
+ hint,
27
27
  disabled,
28
28
  error,
29
29
  intlLabel,
@@ -54,13 +54,6 @@ const InputUID = ({
54
54
  )
55
55
  : name;
56
56
 
57
- const hint = description
58
- ? formatMessage(
59
- { id: description.id, defaultMessage: description.defaultMessage },
60
- { ...description.values }
61
- )
62
- : '';
63
-
64
57
  const formattedPlaceholder = placeholder
65
58
  ? formatMessage(
66
59
  { id: placeholder.id, defaultMessage: placeholder.defaultMessage },
@@ -251,11 +244,6 @@ InputUID.propTypes = {
251
244
  required: PropTypes.bool,
252
245
  }).isRequired,
253
246
  contentTypeUID: PropTypes.string.isRequired,
254
- description: PropTypes.shape({
255
- id: PropTypes.string.isRequired,
256
- defaultMessage: PropTypes.string.isRequired,
257
- values: PropTypes.object,
258
- }),
259
247
  disabled: PropTypes.bool,
260
248
  error: PropTypes.string,
261
249
  intlLabel: PropTypes.shape({
@@ -273,16 +261,17 @@ InputUID.propTypes = {
273
261
  values: PropTypes.object,
274
262
  }),
275
263
  required: PropTypes.bool,
264
+ hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
276
265
  };
277
266
 
278
267
  InputUID.defaultProps = {
279
- description: undefined,
280
268
  disabled: false,
281
269
  error: undefined,
282
270
  labelAction: undefined,
283
271
  placeholder: undefined,
284
272
  value: '',
285
273
  required: false,
274
+ hint: '',
286
275
  };
287
276
 
288
277
  export default InputUID;
@@ -9,9 +9,8 @@ const Wrapper = styled.div`
9
9
  padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
10
10
  font-size: ${14 / 16}rem;
11
11
  background-color: ${({ theme }) => theme.colors.neutral0};
12
- z-index: 2;
13
- cursor: not-allowed;
14
12
  color: ${({ theme }) => theme.colors.neutral800};
13
+ line-height: ${({ theme }) => theme.lineHeights[6]};
15
14
 
16
15
  h1,
17
16
  h2,
@@ -19,12 +18,12 @@ const Wrapper = styled.div`
19
18
  h4,
20
19
  h5,
21
20
  h6 {
22
- margin-block-start: 10px;
23
- margin-block-end: 10px;
21
+ margin-block-start: ${({ theme }) => theme.spaces[2]};
22
+ margin-block-end: ${({ theme }) => theme.spaces[2]};
24
23
  }
25
24
 
26
25
  p {
27
- margin-bottom: 10px;
26
+ margin-bottom: ${({ theme }) => theme.spaces[2]};
28
27
  }
29
28
 
30
29
  h1 {
@@ -56,13 +55,13 @@ const Wrapper = styled.div`
56
55
  }
57
56
 
58
57
  blockquote {
59
- margin-top: 41px;
60
- margin-bottom: 34px;
58
+ margin-top: ${({ theme }) => theme.spaces[8]};
59
+ margin-bottom: ${({ theme }) => theme.spaces[7]};
61
60
  font-size: ${14 / 16}rem;
62
61
  font-weight: 400;
63
- border-left: 5px solid #eee;
62
+ border-left: 4px solid ${({ theme }) => theme.colors.neutral150};
64
63
  font-style: italic;
65
- padding: 10px 20px;
64
+ padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};
66
65
  }
67
66
 
68
67
  img {
@@ -91,9 +90,18 @@ const Wrapper = styled.div`
91
90
 
92
91
  pre,
93
92
  code {
94
- font-size: 13px;
95
- border-radius: 3px;
96
- background-color: #002b36;
93
+ font-size: ${14 / 16}rem;
94
+ border-radius: 4px;
95
+ /*
96
+ Hard coded since the color is the same between themes,
97
+ theme.colors.neutral800 changes between themes.
98
+
99
+ Matches the color of the JSON Input component.
100
+ */
101
+ background-color: #32324d;
102
+ max-width: 100%;
103
+ overflow: auto;
104
+ padding: ${({ theme }) => theme.spaces[2]};
97
105
  }
98
106
 
99
107
  /* Inline code */
@@ -105,21 +113,6 @@ const Wrapper = styled.div`
105
113
  }
106
114
  }
107
115
 
108
- .warning {
109
- background-color: #faa684;
110
- padding: 30px;
111
- border-radius: 3px;
112
- }
113
- .tip {
114
- padding: 30px;
115
- border-radius: 3px;
116
- }
117
-
118
- .footnote-ref,
119
- .footnote-backref {
120
- color: #007bff;
121
- }
122
-
123
116
  ol {
124
117
  list-style-type: decimal;
125
118
  margin-block-start: ${({ theme }) => theme.spaces[4]};
@@ -127,6 +120,7 @@ const Wrapper = styled.div`
127
120
  margin-inline-start: 0px;
128
121
  margin-inline-end: 0px;
129
122
  padding-inline-start: ${({ theme }) => theme.spaces[4]};
123
+
130
124
  ol,
131
125
  ul {
132
126
  margin-block-start: 0px;
@@ -141,6 +135,7 @@ const Wrapper = styled.div`
141
135
  margin-inline-start: 0px;
142
136
  margin-inline-end: 0px;
143
137
  padding-inline-start: ${({ theme }) => theme.spaces[4]};
138
+
144
139
  ul,
145
140
  ol {
146
141
  margin-block-start: 0px;
@@ -1,15 +1,11 @@
1
- import React, { useEffect } from 'react';
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
2
3
  import PropTypes from 'prop-types';
3
4
  import styled from 'styled-components';
4
- import { Flex } from '@strapi/design-system/Flex';
5
- import { Box } from '@strapi/design-system/Box';
6
- import { FocusTrap } from '@strapi/design-system/FocusTrap';
7
- import { Portal } from '@strapi/design-system/Portal';
8
- import { BaseButton } from '@strapi/design-system/BaseButton';
9
- import { Typography } from '@strapi/design-system/Typography';
10
- import { pxToRem } from '@strapi/helper-plugin';
11
- import Collapse from '@strapi/icons/Collapse';
12
- import { useIntl } from 'react-intl';
5
+ import { BaseButton, Box, Flex, FocusTrap, Portal, Typography } from '@strapi/design-system';
6
+ import { Collapse } from '@strapi/icons';
7
+ import { pxToRem, useLockScroll } from '@strapi/helper-plugin';
8
+
13
9
  import PreviewWysiwyg from '../PreviewWysiwyg';
14
10
 
15
11
  const setOpacity = (hex, alpha) =>
@@ -32,6 +28,7 @@ export const ExpandButton = styled(BaseButton)`
32
28
 
33
29
  svg {
34
30
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
31
+
35
32
  path {
36
33
  fill: ${({ theme }) => theme.colors.neutral700};
37
34
  width: ${12 / 16}rem;
@@ -42,19 +39,8 @@ export const ExpandButton = styled(BaseButton)`
42
39
 
43
40
  export const EditorLayout = ({ children, isExpandMode, error, previewContent, onCollapse }) => {
44
41
  const { formatMessage } = useIntl();
45
- useEffect(() => {
46
- const body = document.body;
47
-
48
- if (isExpandMode) {
49
- body.classList.add('lock-body-scroll');
50
- }
51
42
 
52
- return () => {
53
- if (isExpandMode) {
54
- body.classList.remove('lock-body-scroll');
55
- }
56
- };
57
- }, [isExpandMode]);
43
+ useLockScroll(isExpandMode);
58
44
 
59
45
  if (isExpandMode) {
60
46
  return (
@@ -71,7 +57,6 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
71
57
  onClick={onCollapse}
72
58
  >
73
59
  <Box
74
- id="wysiwyg-expand"
75
60
  background="neutral0"
76
61
  hasRadius
77
62
  shadow="popupShadow"
@@ -84,9 +69,15 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
84
69
  <BoxWithBorder flex="1" height="100%">
85
70
  {children}
86
71
  </BoxWithBorder>
87
- <Box flex="1" height="100%">
88
- <Flex height={pxToRem(48)} background="neutral100" justifyContent="flex-end">
89
- <ExpandButton id="collapse" onClick={onCollapse}>
72
+ <Flex alignItems="start" direction="column" flex={1} height="100%" width="100%">
73
+ <Flex
74
+ height={pxToRem(48)}
75
+ background="neutral100"
76
+ justifyContent="flex-end"
77
+ shrink={0}
78
+ width="100%"
79
+ >
80
+ <ExpandButton onClick={onCollapse}>
90
81
  <Typography>
91
82
  {formatMessage({
92
83
  id: 'components.Wysiwyg.collapse',
@@ -97,10 +88,10 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
97
88
  </ExpandButton>
98
89
  </Flex>
99
90
 
100
- <Box position="relative" height="100%">
91
+ <Box position="relative" height="100%" width="100%">
101
92
  <PreviewWysiwyg data={previewContent} />
102
93
  </Box>
103
- </Box>
94
+ </Flex>
104
95
  </Flex>
105
96
  </Box>
106
97
  </ExpandWrapper>
@@ -31,7 +31,7 @@ const TypographyAsterisk = styled(Typography)`
31
31
  `;
32
32
 
33
33
  const Wysiwyg = ({
34
- description,
34
+ hint,
35
35
  disabled,
36
36
  error,
37
37
  intlLabel,
@@ -167,7 +167,7 @@ const Wysiwyg = ({
167
167
 
168
168
  {!isExpandMode && <WysiwygFooter onToggleExpand={handleToggleExpand} />}
169
169
  </EditorLayout>
170
- <Hint description={description} name={name} error={error} />
170
+ <Hint hint={hint} name={name} error={error} />
171
171
  </Stack>
172
172
 
173
173
  {error && (
@@ -186,21 +186,17 @@ const Wysiwyg = ({
186
186
  };
187
187
 
188
188
  Wysiwyg.defaultProps = {
189
- description: null,
190
189
  disabled: false,
191
190
  error: '',
192
191
  labelAction: undefined,
193
192
  placeholder: null,
194
193
  required: false,
195
194
  value: '',
195
+ hint: '',
196
196
  };
197
197
 
198
198
  Wysiwyg.propTypes = {
199
- description: PropTypes.shape({
200
- id: PropTypes.string.isRequired,
201
- defaultMessage: PropTypes.string.isRequired,
202
- values: PropTypes.object,
203
- }),
199
+ hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
204
200
  disabled: PropTypes.bool,
205
201
  error: PropTypes.string,
206
202
  intlLabel: PropTypes.shape({
@@ -7,10 +7,8 @@
7
7
  import React, { useMemo, useState } from 'react';
8
8
  import { useSelector, shallowEqual } from 'react-redux';
9
9
  import { useIntl } from 'react-intl';
10
- import matchSorter from 'match-sorter';
11
- import sortBy from 'lodash/sortBy';
12
- import toLower from 'lodash/toLower';
13
10
  import { NavLink } from 'react-router-dom';
11
+
14
12
  import {
15
13
  SubNav,
16
14
  SubNavHeader,
@@ -18,14 +16,11 @@ import {
18
16
  SubNavSections,
19
17
  SubNavLink,
20
18
  } from '@strapi/design-system/v2/SubNav';
19
+
20
+ import { matchByTitle } from './utils';
21
21
  import getTrad from '../../../utils/getTrad';
22
22
  import { makeSelectModelLinks } from '../selectors';
23
23
 
24
- const matchByTitle = (links, search) =>
25
- search
26
- ? matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] })
27
- : sortBy(links, (object) => object.title.toLowerCase());
28
-
29
24
  const LeftMenu = () => {
30
25
  const [search, setSearch] = useState('');
31
26
  const { formatMessage } = useIntl();
@@ -0,0 +1 @@
1
+ export { default as matchByTitle } from './matchByTitle';
@@ -0,0 +1,24 @@
1
+ import matchSorter from 'match-sorter';
2
+ import camelCase from 'lodash/camelCase';
3
+
4
+ /**
5
+ * @type {(links: array, search? : string) => array }
6
+ */
7
+ const matchByTitle = (links, search) =>
8
+ search
9
+ ? matchSorter(links, search.toLowerCase(), { keys: [(item) => item.title.toLowerCase()] })
10
+ : links.sort((link, nextLink) => {
11
+ const title = camelCase(link.title);
12
+ const nextTitle = camelCase(nextLink.title);
13
+
14
+ if (title < nextTitle) {
15
+ return -1;
16
+ }
17
+ if (title > nextTitle) {
18
+ return 1;
19
+ }
20
+
21
+ return 0;
22
+ });
23
+
24
+ export default matchByTitle;