@strapi/admin 4.5.4 → 4.5.6

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 (210) hide show
  1. package/admin/src/components/GlobalStyle/index.js +0 -11
  2. package/admin/src/components/GuidedTour/Modal/components/Content.js +7 -2
  3. package/admin/src/content-manager/components/ComponentIcon/ComponentIcon.js +49 -0
  4. package/admin/src/content-manager/components/ComponentIcon/index.js +1 -0
  5. package/admin/src/content-manager/components/DynamicZone/components/ComponentCard.js +17 -31
  6. package/admin/src/content-manager/components/DynamicZone/components/ComponentCategory.js +2 -2
  7. package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +3 -3
  8. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +19 -2
  9. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +2 -1
  10. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +2 -1
  11. package/admin/src/content-manager/components/InputJSON/FieldWrapper.js +10 -2
  12. package/admin/src/content-manager/components/InputJSON/Label.js +2 -18
  13. package/admin/src/content-manager/components/InputJSON/index.js +7 -3
  14. package/admin/src/content-manager/components/RelationInput/RelationInput.js +2 -4
  15. package/admin/src/content-manager/components/RepeatableComponent/AccordionGroupCustom/index.js +0 -1
  16. package/admin/src/content-manager/components/RepeatableComponent/index.js +1 -3
  17. package/admin/src/content-manager/pages/App/LeftMenu/index.js +5 -7
  18. package/admin/src/content-manager/pages/EditSettingsView/components/DynamicZoneList.js +18 -38
  19. package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
  20. package/admin/src/content-manager/pages/ListSettingsView/index.js +3 -5
  21. package/admin/src/pages/Admin/Onboarding/index.js +42 -44
  22. package/admin/src/pages/AuthPage/components/Register/index.js +1 -1
  23. package/admin/src/pages/AuthPage/components/ResetPassword/index.js +1 -1
  24. package/admin/src/pages/ProfilePage/index.js +1 -1
  25. package/admin/src/translations/ca.json +2 -3
  26. package/admin/src/translations/dk.json +2 -2
  27. package/admin/src/translations/en.json +9 -1
  28. package/admin/src/translations/es.json +2 -2
  29. package/admin/src/translations/fr.json +2 -2
  30. package/admin/src/translations/hu.json +197 -2
  31. package/admin/src/translations/ja.json +2 -2
  32. package/admin/src/translations/nl.json +2 -2
  33. package/admin/src/translations/sk.json +274 -52
  34. package/admin/src/translations/zh-Hans.json +1 -1
  35. package/admin/src/translations/zh.json +11 -3
  36. package/build/2235.06c13219.chunk.js +106 -0
  37. package/build/{1233.802422fa.chunk.js → 2473.7ad04700.chunk.js} +40 -40
  38. package/build/2598.962797b2.chunk.js +159 -0
  39. package/build/{4318.9283c350.chunk.js → 4318.0bbd3f4b.chunk.js} +1 -1
  40. package/build/4958.7c118f5e.chunk.js +276 -0
  41. package/build/5052.712419ea.chunk.js +65 -0
  42. package/build/7295.e12e5587.chunk.js +114 -0
  43. package/build/805.ddcead70.chunk.js +138 -0
  44. package/build/{8633.43ec9042.chunk.js → 8633.19be8f45.chunk.js} +1 -1
  45. package/build/874.bde3ea04.chunk.js +104 -0
  46. package/build/9707.77e475ee.chunk.js +101 -0
  47. package/build/Admin-authenticatedApp.377e2d11.chunk.js +75 -0
  48. package/build/{Admin_marketplace.ed754a4a.chunk.js → Admin_marketplace.615343fb.chunk.js} +6 -6
  49. package/build/Admin_pluginsPage.67728975.chunk.js +6 -0
  50. package/build/{Admin_profilePage.60ab80bb.chunk.js → Admin_profilePage.175c6516.chunk.js} +2 -2
  51. package/build/Admin_settingsPage.ba0605a2.chunk.js +178 -0
  52. package/build/Upload_ConfigureTheView.7cb2a3fd.chunk.js +1 -0
  53. package/build/admin-app.77b9f2b9.chunk.js +112 -0
  54. package/build/{admin-users.e64fb0f1.chunk.js → admin-users.4b6b47f8.chunk.js} +2 -2
  55. package/build/api-tokens-create-page.dd4ddfcb.chunk.js +1 -0
  56. package/build/api-tokens-edit-page.821c5a6c.chunk.js +1 -0
  57. package/build/{api-tokens-list-page.700e575f.chunk.js → api-tokens-list-page.50519ed7.chunk.js} +1 -1
  58. package/build/ca-json.fa3e6f48.chunk.js +1 -0
  59. package/build/{codemirror-css.4e2bbed3.chunk.js → codemirror-css.aa4c2de2.chunk.js} +2 -3
  60. package/build/{codemirror-javacript.41bdefda.chunk.js → codemirror-javacript.589c8ecc.chunk.js} +1 -1
  61. package/build/codemirror-theme.c1d2b07c.chunk.js +33 -0
  62. package/build/content-manager.a489bdc0.chunk.js +1184 -0
  63. package/build/content-type-builder-list-view.4aea46fa.chunk.js +198 -0
  64. package/build/content-type-builder-translation-de-json.a52482c7.chunk.js +1 -0
  65. package/build/content-type-builder-translation-dk-json.a8616510.chunk.js +1 -0
  66. package/build/content-type-builder-translation-en-json.1d9a3c14.chunk.js +1 -0
  67. package/build/content-type-builder-translation-es-json.c3ea46fb.chunk.js +1 -0
  68. package/build/content-type-builder-translation-ko-json.3fb7ddc8.chunk.js +1 -0
  69. package/build/content-type-builder-translation-pl-json.9b2993b2.chunk.js +1 -0
  70. package/build/content-type-builder-translation-pt-BR-json.6d255441.chunk.js +1 -0
  71. package/build/content-type-builder-translation-sv-json.c608b9ca.chunk.js +1 -0
  72. package/build/content-type-builder-translation-zh-json.b79513e4.chunk.js +1 -0
  73. package/build/content-type-builder.aa05d3a5.chunk.js +127 -0
  74. package/build/dk-json.ab5dd6ac.chunk.js +1 -0
  75. package/build/email-settings-page.d7165683.chunk.js +15 -0
  76. package/build/en-json.058a913d.chunk.js +1 -0
  77. package/build/es-json.8fe19fb3.chunk.js +1 -0
  78. package/build/fr-json.7ba93468.chunk.js +1 -0
  79. package/build/highlight.js.aea3bcf9.chunk.js +85 -0
  80. package/build/hu-json.ec123259.chunk.js +1 -0
  81. package/build/{i18n-settings-page.195d42fe.chunk.js → i18n-settings-page.ee572037.chunk.js} +1 -1
  82. package/build/index.html +1 -1
  83. package/build/ja-json.e69860d6.chunk.js +1 -0
  84. package/build/main.386bbeb5.js +4417 -0
  85. package/build/nl-json.02de2e84.chunk.js +1 -0
  86. package/build/runtime~main.13d2c7fa.js +2 -0
  87. package/build/sk-json.2af48064.chunk.js +1 -0
  88. package/build/sso-settings-page.91924df1.chunk.js +41 -0
  89. package/build/upload-settings.5fd96cda.chunk.js +89 -0
  90. package/build/upload-translation-en-json.32cf9aff.chunk.js +1 -0
  91. package/build/upload-translation-sk-json.fe86c53b.chunk.js +1 -0
  92. package/build/upload-translation-zh-json.656ddd8a.chunk.js +1 -0
  93. package/build/upload.9993c14f.chunk.js +38 -0
  94. package/build/users-advanced-settings-page.c4431a05.chunk.js +13 -0
  95. package/build/users-email-settings-page.d8a0bf10.chunk.js +28 -0
  96. package/build/{users-permissions-translation-dk-json.fe39c74b.chunk.js → users-permissions-translation-dk-json.bad0b786.chunk.js} +1 -1
  97. package/build/{users-permissions-translation-en-json.765abf48.chunk.js → users-permissions-translation-en-json.aeab388a.chunk.js} +1 -1
  98. package/build/{users-permissions-translation-es-json.1bb9cde2.chunk.js → users-permissions-translation-es-json.152a923f.chunk.js} +1 -1
  99. package/build/{users-permissions-translation-ko-json.3be77775.chunk.js → users-permissions-translation-ko-json.6bd0ae22.chunk.js} +1 -1
  100. package/build/{users-permissions-translation-pl-json.1dbdd4a1.chunk.js → users-permissions-translation-pl-json.c6a02992.chunk.js} +1 -1
  101. package/build/{users-permissions-translation-sv-json.d5d11648.chunk.js → users-permissions-translation-sv-json.370d6eee.chunk.js} +1 -1
  102. package/build/{users-permissions-translation-zh-json.92f406f9.chunk.js → users-permissions-translation-zh-json.1fea833f.chunk.js} +1 -1
  103. package/build/users-providers-settings-page.47a69fe9.chunk.js +1 -0
  104. package/build/users-roles-settings-page.0a87ba15.chunk.js +30 -0
  105. package/build/{webhook-edit-page.1215a6b7.chunk.js → webhook-edit-page.dcc3d145.chunk.js} +4 -4
  106. package/build/{webhook-list-page.b87821f2.chunk.js → webhook-list-page.894e6959.chunk.js} +1 -1
  107. package/build/zh-Hans-json.1b3b4a64.chunk.js +1 -0
  108. package/build/zh-json.8643bc81.chunk.js +1 -0
  109. package/package.json +15 -20
  110. package/server/index.js +2 -0
  111. package/server/middlewares/index.js +7 -0
  112. package/server/middlewares/rateLimit.js +43 -0
  113. package/server/routes/authentication.js +4 -1
  114. package/server/routes/roles.js +0 -8
  115. package/server/services/role.js +1 -0
  116. package/webpack.alias.js +0 -2
  117. package/admin/src/content-manager/components/BackHeader/index.js +0 -8
  118. package/admin/src/content-manager/components/Block/components.js +0 -28
  119. package/admin/src/content-manager/components/Block/index.js +0 -43
  120. package/admin/src/content-manager/components/Container/index.js +0 -7
  121. package/admin/src/content-manager/components/CustomInputCheckbox/components.js +0 -77
  122. package/admin/src/content-manager/components/CustomInputCheckbox/index.js +0 -53
  123. package/admin/src/content-manager/components/DynamicComponentCard/Wrapper.js +0 -63
  124. package/admin/src/content-manager/components/FilterOptionsCTA/index.js +0 -14
  125. package/admin/src/content-manager/components/FormTitle/index.js +0 -22
  126. package/admin/src/content-manager/components/FormWrapper/index.js +0 -20
  127. package/admin/src/content-manager/components/InputJSON/FieldError.js +0 -38
  128. package/admin/src/content-manager/components/LayoutTitle/index.js +0 -19
  129. package/admin/src/content-manager/components/PlusButton/index.js +0 -52
  130. package/admin/src/content-manager/components/PreviewCarret/components.js +0 -27
  131. package/admin/src/content-manager/components/PreviewCarret/index.js +0 -22
  132. package/admin/src/content-manager/components/SectionTitle/Title.js +0 -11
  133. package/admin/src/content-manager/components/SectionTitle/index.js +0 -26
  134. package/build/1551f4f60c37af51121f.woff2 +0 -0
  135. package/build/1e59d2330b4c6deb84b3.ttf +0 -0
  136. package/build/20fd1704ea223900efa9.woff2 +0 -0
  137. package/build/2285773e6b4b172f07d9.woff +0 -0
  138. package/build/23f19bb08961f37aaf69.eot +0 -0
  139. package/build/2f517e09eb2ca6650ff5.svg +0 -3717
  140. package/build/4306.df40a798.chunk.js +0 -98
  141. package/build/4689f52cc96215721344.svg +0 -801
  142. package/build/491974d108fe4002b2aa.ttf +0 -0
  143. package/build/504.9aeff724.chunk.js +0 -758
  144. package/build/5057.195a59ff.chunk.js +0 -65
  145. package/build/527940b104eb2ea366c8.ttf +0 -0
  146. package/build/77206a6bb316fa0aded5.eot +0 -0
  147. package/build/7a3337626410ca2f4071.woff2 +0 -0
  148. package/build/7a8b4f130182d19a2d7c.svg +0 -5034
  149. package/build/805.e991a370.chunk.js +0 -138
  150. package/build/8176.e929d326.chunk.js +0 -145
  151. package/build/8881.c693411a.chunk.js +0 -245
  152. package/build/8b43027f47b20503057d.eot +0 -0
  153. package/build/9161.4a0ab137.chunk.js +0 -2119
  154. package/build/9279.6290c87a.chunk.js +0 -117
  155. package/build/9707.a0cc4ad8.chunk.js +0 -70
  156. package/build/9bbb245e67a133f6e486.eot +0 -0
  157. package/build/Admin-authenticatedApp.0da578b8.chunk.js +0 -80
  158. package/build/Admin_pluginsPage.3c872de7.chunk.js +0 -6
  159. package/build/Admin_settingsPage.6ef8acc9.chunk.js +0 -178
  160. package/build/admin-app.a3277e72.chunk.js +0 -112
  161. package/build/api-tokens-create-page.93dd0689.chunk.js +0 -1
  162. package/build/api-tokens-edit-page.b0adac81.chunk.js +0 -1
  163. package/build/bb58e57c48a3e911f15f.woff +0 -0
  164. package/build/be9ee23c0c6390141475.ttf +0 -0
  165. package/build/c1e38fd9e0e74ba58f7a.svg +0 -2671
  166. package/build/ca-json.07ae0f2c.chunk.js +0 -1
  167. package/build/codemirror-theme.a82cae4e.chunk.js +0 -34
  168. package/build/content-manager.f9630c3b.chunk.js +0 -1197
  169. package/build/content-type-builder-list-view.4412efc3.chunk.js +0 -201
  170. package/build/content-type-builder-translation-de-json.0d7696b9.chunk.js +0 -1
  171. package/build/content-type-builder-translation-dk-json.4729f055.chunk.js +0 -1
  172. package/build/content-type-builder-translation-en-json.f985c9c4.chunk.js +0 -1
  173. package/build/content-type-builder-translation-es-json.333cf47f.chunk.js +0 -1
  174. package/build/content-type-builder-translation-ko-json.51201b12.chunk.js +0 -1
  175. package/build/content-type-builder-translation-pl-json.4a42349b.chunk.js +0 -1
  176. package/build/content-type-builder-translation-pt-BR-json.6fe3b8d1.chunk.js +0 -1
  177. package/build/content-type-builder-translation-sv-json.6deff030.chunk.js +0 -1
  178. package/build/content-type-builder-translation-zh-json.3b0afd31.chunk.js +0 -1
  179. package/build/content-type-builder.b132b5f4.chunk.js +0 -145
  180. package/build/cropper-css.12fe038c.chunk.js +0 -306
  181. package/build/d878b0a6a1144760244f.woff2 +0 -0
  182. package/build/dk-json.144c6a8e.chunk.js +0 -1
  183. package/build/eeccf4f66002c6f2ba24.woff +0 -0
  184. package/build/email-settings-page.c6e62f6b.chunk.js +0 -15
  185. package/build/en-json.7dd57947.chunk.js +0 -1
  186. package/build/es-json.6d123a82.chunk.js +0 -1
  187. package/build/f691f37e57f04c152e23.woff +0 -0
  188. package/build/fontawesome-css-all.15068c6e.chunk.js +0 -4618
  189. package/build/fontawesome-css.418f40da.chunk.js +0 -6
  190. package/build/fontawesome-js.252cc5f3.chunk.js +0 -7
  191. package/build/fr-json.28ab54cb.chunk.js +0 -1
  192. package/build/highlight.js.af2de364.chunk.js +0 -86
  193. package/build/hu-json.c4b641bb.chunk.js +0 -1
  194. package/build/ja-json.1c9eeeec.chunk.js +0 -1
  195. package/build/main.71f24343.js +0 -2034
  196. package/build/nl-json.26f39180.chunk.js +0 -1
  197. package/build/runtime~main.1115f82b.js +0 -2
  198. package/build/sk-json.7ba4b330.chunk.js +0 -1
  199. package/build/sso-settings-page.feed2f45.chunk.js +0 -1
  200. package/build/upload-settings.450cab1a.chunk.js +0 -18
  201. package/build/upload-translation-en-json.86da7b0a.chunk.js +0 -1
  202. package/build/upload-translation-sk-json.b03d4904.chunk.js +0 -1
  203. package/build/upload-translation-zh-json.ac5711de.chunk.js +0 -1
  204. package/build/upload.74540aab.chunk.js +0 -64
  205. package/build/users-advanced-settings-page.0c0b8230.chunk.js +0 -13
  206. package/build/users-email-settings-page.3126ff8c.chunk.js +0 -28
  207. package/build/users-providers-settings-page.b7b602e2.chunk.js +0 -33
  208. package/build/users-roles-settings-page.ce5b582d.chunk.js +0 -30
  209. package/build/zh-Hans-json.21617c24.chunk.js +0 -1
  210. package/build/zh-json.2ecc6b99.chunk.js +0 -1
@@ -1,16 +1,5 @@
1
1
  import { createGlobalStyle } from 'styled-components';
2
2
 
3
- const loadCss = async () => {
4
- await import(/* webpackChunkName: "fontawesome-css" */ 'font-awesome/css/font-awesome.min.css');
5
- await import(
6
- /* webpackChunkName: "fontawesome-css-all" */ '@fortawesome/fontawesome-free/css/all.css'
7
- );
8
- await import(/* webpackChunkName: "fontawesome-js" */ '@fortawesome/fontawesome-free/js/all.min');
9
- await import(/* webpackChunkName: "cropper-css" */ 'cropperjs/dist/cropper.css');
10
- };
11
-
12
- loadCss();
13
-
14
3
  const GlobalStyle = createGlobalStyle`
15
4
  body {
16
5
  background: ${({ theme }) => theme.colors.neutral100};
@@ -8,6 +8,9 @@ import { useIntl } from 'react-intl';
8
8
 
9
9
  const LiStyled = styled.li`
10
10
  list-style: disc;
11
+ &::marker {
12
+ color: ${({ theme }) => theme.colors.neutral800};
13
+ }
11
14
  `;
12
15
 
13
16
  const Content = ({ id, defaultMessage }) => {
@@ -19,13 +22,15 @@ const Content = ({ id, defaultMessage }) => {
19
22
  { id, defaultMessage },
20
23
  {
21
24
  documentationLink: (children) => (
22
- <a
25
+ <Typography
26
+ as="a"
27
+ textColor="primary600"
23
28
  target="_blank"
24
29
  rel="noopener noreferrer"
25
30
  href="https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html#api-parameters"
26
31
  >
27
32
  {children}
28
- </a>
33
+ </Typography>
29
34
  ),
30
35
  b: (children) => <Typography fontWeight="semiBold">{children}</Typography>,
31
36
  p: (children) => <Typography>{children}</Typography>,
@@ -0,0 +1,49 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+
5
+ import { Flex } from '@strapi/design-system';
6
+
7
+ const WIDTH_S = 5;
8
+ const WIDTH_M = 8;
9
+
10
+ const Wrapper = styled(Flex)`
11
+ border-radius: ${({ showBackground }) => (showBackground ? `50%` : 0)};
12
+ color: ${({ theme }) => theme.colors.neutral600};
13
+ height: ${({ theme, size }) => theme.spaces[size === 'S' ? WIDTH_S : WIDTH_M]};
14
+ width: ${({ theme, size }) => theme.spaces[size === 'S' ? WIDTH_S : WIDTH_M]};
15
+
16
+ svg {
17
+ height: ${({ theme, size }) => theme.spaces[size === 'S' ? WIDTH_S - 2 : WIDTH_M - 3]};
18
+ width: ${({ theme, size }) => theme.spaces[size === 'S' ? WIDTH_S - 2 : WIDTH_M - 3]};
19
+ }
20
+ `;
21
+
22
+ export function ComponentIcon({ showBackground = true, size = 'M' }) {
23
+ return (
24
+ <Wrapper
25
+ alignItems="center"
26
+ background={showBackground ? 'neutral200' : null}
27
+ justifyContent="center"
28
+ size={size}
29
+ showBackground={showBackground}
30
+ >
31
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
32
+ <path
33
+ d="M216.3 2c4.8-2.6 10.5-2.6 15.3 0L422.3 106c5.1 2.8 8.3 8.2 8.3 14s-3.2 11.2-8.3 14L231.7 238c-4.8 2.6-10.5 2.6-15.3 0L25.7 134c-5.1-2.8-8.3-8.2-8.3-14s3.2-11.2 8.3-14L216.3 2zM23.7 170l176 96c5.1 2.8 8.3 8.2 8.3 14V496c0 5.6-3 10.9-7.8 13.8s-10.9 3-15.8 .3L8.3 414C3.2 411.2 0 405.9 0 400V184c0-5.6 3-10.9 7.8-13.8s10.9-3 15.8-.3zm400.7 0c5-2.7 11-2.6 15.8 .3s7.8 8.1 7.8 13.8V400c0 5.9-3.2 11.2-8.3 14l-176 96c-5 2.7-11 2.6-15.8-.3s-7.8-8.1-7.8-13.8V280c0-5.9 3.2-11.2 8.3-14l176-96z"
34
+ fill="currentColor"
35
+ />
36
+ </svg>
37
+ </Wrapper>
38
+ );
39
+ }
40
+
41
+ ComponentIcon.defaultProps = {
42
+ showBackground: true,
43
+ size: 'M',
44
+ };
45
+
46
+ ComponentIcon.propTypes = {
47
+ showBackground: PropTypes.bool,
48
+ size: PropTypes.string,
49
+ };
@@ -0,0 +1 @@
1
+ export * from './ComponentIcon';
@@ -7,23 +7,13 @@
7
7
  import React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import styled from 'styled-components';
10
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11
10
 
12
11
  import { Box } from '@strapi/design-system/Box';
13
12
  import { Typography } from '@strapi/design-system/Typography';
14
13
  import { Stack } from '@strapi/design-system/Stack';
15
14
  import { pxToRem } from '@strapi/helper-plugin';
16
15
 
17
- const StyledFontAwesomeIcon = styled(FontAwesomeIcon)`
18
- width: ${pxToRem(32)} !important;
19
- height: ${pxToRem(32)} !important;
20
- padding: ${pxToRem(9)};
21
- border-radius: ${pxToRem(64)};
22
- background: ${({ theme }) => theme.colors.neutral150};
23
- path {
24
- fill: ${({ theme }) => theme.colors.neutral500};
25
- }
26
- `;
16
+ import { ComponentIcon } from '../../ComponentIcon';
27
17
 
28
18
  const ComponentBox = styled(Box)`
29
19
  flex-shrink: 0;
@@ -35,46 +25,42 @@ const ComponentBox = styled(Box)`
35
25
  justify-content: center;
36
26
  align-items: center;
37
27
 
38
- &.active,
28
+ &:focus,
39
29
  &:hover {
40
30
  border: 1px solid ${({ theme }) => theme.colors.primary200};
41
31
  background: ${({ theme }) => theme.colors.primary100};
42
32
 
43
- ${StyledFontAwesomeIcon} {
44
- background: ${({ theme }) => theme.colors.primary200};
45
- path {
46
- fill: ${({ theme }) => theme.colors.primary600};
47
- }
33
+ ${Typography} {
34
+ color: ${({ theme }) => theme.colors.primary600};
48
35
  }
49
36
 
50
- ${Typography} {
37
+ /* > Stack > ComponentIcon */
38
+ > div > div:first-child {
39
+ background: ${({ theme }) => theme.colors.primary200};
51
40
  color: ${({ theme }) => theme.colors.primary600};
52
41
  }
53
42
  }
54
43
  `;
55
44
 
56
- export default function ComponentCard({ children, icon, onClick }) {
45
+ export default function ComponentCard({ children, onClick }) {
57
46
  return (
58
- <button type="button" onClick={onClick}>
59
- <ComponentBox borderRadius="borderRadius">
60
- <Stack spacing={1} style={{ justifyContent: 'center', alignItems: 'center' }}>
61
- <StyledFontAwesomeIcon data-testid="component-card-icon" icon={icon} />
62
- <Typography variant="pi" fontWeight="bold" textColor="neutral600">
63
- {children}
64
- </Typography>
65
- </Stack>
66
- </ComponentBox>
67
- </button>
47
+ <ComponentBox as="button" type="button" onClick={onClick} hasRadius>
48
+ <Stack spacing={1} alignItems="center" justifyContent="center">
49
+ <ComponentIcon />
50
+
51
+ <Typography variant="pi" fontWeight="bold" textColor="neutral600">
52
+ {children}
53
+ </Typography>
54
+ </Stack>
55
+ </ComponentBox>
68
56
  );
69
57
  }
70
58
 
71
59
  ComponentCard.defaultProps = {
72
- icon: 'dice-d6',
73
60
  onClick() {},
74
61
  };
75
62
 
76
63
  ComponentCard.propTypes = {
77
64
  children: PropTypes.node.isRequired,
78
- icon: PropTypes.string,
79
65
  onClick: PropTypes.func,
80
66
  };
@@ -30,8 +30,8 @@ const ComponentCategory = ({ category, components, variant, isOpen, onAddCompone
30
30
  <AccordionContent>
31
31
  <Box paddingTop={4} paddingBottom={4} paddingLeft={3} paddingRight={3}>
32
32
  <Grid>
33
- {components.map(({ componentUid, info: { displayName, icon } }) => (
34
- <ComponentCard key={componentUid} icon={icon} onClick={onAddComponent(componentUid)}>
33
+ {components.map(({ componentUid, info: { displayName } }) => (
34
+ <ComponentCard key={componentUid} onClick={onAddComponent(componentUid)}>
35
35
  {formatMessage({ id: displayName, defaultMessage: displayName })}
36
36
  </ComponentCard>
37
37
  ))}
@@ -2,7 +2,6 @@ import React, { useMemo, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import { useIntl } from 'react-intl';
5
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
6
5
  import get from 'lodash/get';
7
6
 
8
7
  import { Accordion, AccordionToggle, AccordionContent } from '@strapi/design-system/Accordion';
@@ -20,6 +19,7 @@ import ArrowUp from '@strapi/icons/ArrowUp';
20
19
  import { useContentTypeLayout } from '../../../hooks';
21
20
  import { getTrad } from '../../../utils';
22
21
 
22
+ import { ComponentIcon } from '../../ComponentIcon';
23
23
  import FieldComponent from '../../FieldComponent';
24
24
 
25
25
  const IconButtonCustom = styled(IconButton)`
@@ -73,7 +73,7 @@ const DynamicZoneComponent = ({
73
73
 
74
74
  const mainField = get(modifiedData, [name, index, mainFieldKey]) ?? '';
75
75
 
76
- const displayedValue = mainFieldKey === 'id' ? '' : mainField.trim();
76
+ const displayedValue = mainFieldKey === 'id' ? '' : String(mainField).trim();
77
77
 
78
78
  const mainValue = displayedValue.length > 0 ? ` - ${displayedValue}` : displayedValue;
79
79
 
@@ -111,7 +111,7 @@ const DynamicZoneComponent = ({
111
111
  <StyledBox hasRadius>
112
112
  <Accordion expanded={isOpen} onToggle={handleToggle} size="S" error={errorMessage}>
113
113
  <AccordionToggle
114
- startIcon={icon && <FontAwesomeIcon icon={icon} />}
114
+ startIcon={<ComponentIcon showBackground={false} size="S" />}
115
115
  action={
116
116
  <Stack horizontal spacing={0} expanded={isOpen}>
117
117
  {showDownIcon && (
@@ -104,6 +104,11 @@ const reducer = (state, action) =>
104
104
  (value) => value.type === 'component' && value.repeatable
105
105
  )(componentLayoutData.attributes);
106
106
 
107
+ const nonRepeatableComponentPaths = recursivelyFindPathsBasedOnCondition(
108
+ allComponents,
109
+ (value) => value.type === 'component' && !value.repeatable
110
+ )(componentLayoutData.attributes);
111
+
107
112
  const componentDataStructure = relationPaths.reduce((acc, current) => {
108
113
  const [componentName] = current.split('.');
109
114
 
@@ -112,8 +117,21 @@ const reducer = (state, action) =>
112
117
  * has another repeatable component inside of it we
113
118
  * don't need to attach the array at this point because that will be
114
119
  * done again deeper in the nest.
120
+ *
121
+ * We also need to handle cases with single components nested within
122
+ * repeatables by checking that the relation path does not match a
123
+ * non-repeatable component path. This accounts for component
124
+ * structures such as:
125
+ * - outer_single_compo
126
+ * - level_one_repeatable
127
+ * - level_two_single_component
128
+ * - level_three_repeatable
115
129
  */
116
- if (!repeatableFields.includes(componentName)) {
130
+
131
+ if (
132
+ !repeatableFields.includes(componentName) &&
133
+ !nonRepeatableComponentPaths.includes(componentName)
134
+ ) {
117
135
  set(acc, current, []);
118
136
  }
119
137
 
@@ -128,7 +146,6 @@ const reducer = (state, action) =>
128
146
 
129
147
  break;
130
148
  }
131
-
132
149
  case 'LOAD_RELATION': {
133
150
  const initialDataPath = ['initialData', ...action.keys];
134
151
  const modifiedDataPath = ['modifiedData', ...action.keys];
@@ -24,7 +24,8 @@ export const findLeafByPathAndReplace = (endpath, replaceWith) => {
24
24
  * and the current path is not undefined in the accumulator
25
25
  * then we assume it's a leaf and we can replace it.
26
26
  */
27
- if (endpath === curr && acc[curr] !== undefined) {
27
+
28
+ if (ind === currentArr.length - 1 && endpath === curr && acc[curr] !== undefined) {
28
29
  set(acc, curr, replaceWith);
29
30
 
30
31
  return acc;
@@ -284,7 +284,8 @@ const createYupSchemaAttribute = (type, validations, options) => {
284
284
  }
285
285
 
286
286
  if (type === 'boolean') {
287
- return value !== null;
287
+ // Boolean value can be undefined/unset in modifiedData when generated in a new component
288
+ return value !== null && value !== undefined;
288
289
  }
289
290
 
290
291
  if (type === 'date' || type === 'datetime') {
@@ -3,12 +3,18 @@ import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { Field } from '@strapi/design-system/Field';
5
5
 
6
- const FieldWrapper = ({ name, hint, error, children }) => {
6
+ const FieldWrapper = ({ name, hint, error, children, required }) => {
7
7
  const { formatMessage } = useIntl();
8
8
  const errorMessage = error ? formatMessage({ id: error, defaultMessage: error }) : '';
9
9
 
10
10
  return (
11
- <Field name={name} hint={hint && formatMessage(hint)} error={errorMessage} id={name}>
11
+ <Field
12
+ name={name}
13
+ hint={hint && formatMessage(hint)}
14
+ error={errorMessage}
15
+ id={name}
16
+ required={required}
17
+ >
12
18
  {children}
13
19
  </Field>
14
20
  );
@@ -17,6 +23,7 @@ const FieldWrapper = ({ name, hint, error, children }) => {
17
23
  FieldWrapper.defaultProps = {
18
24
  hint: undefined,
19
25
  error: '',
26
+ required: false,
20
27
  };
21
28
 
22
29
  FieldWrapper.propTypes = {
@@ -27,6 +34,7 @@ FieldWrapper.propTypes = {
27
34
  }),
28
35
  error: PropTypes.string,
29
36
  children: PropTypes.node.isRequired,
37
+ required: PropTypes.bool,
30
38
  };
31
39
 
32
40
  export default FieldWrapper;
@@ -1,18 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { useIntl } from 'react-intl';
5
4
  import { FieldLabel } from '@strapi/design-system/Field';
6
- import { Box } from '@strapi/design-system/Box';
7
- import { Flex } from '@strapi/design-system/Flex';
8
5
 
9
- const LabelAction = styled(Box)`
10
- svg path {
11
- fill: ${({ theme }) => theme.colors.neutral500};
12
- }
13
- `;
14
-
15
- const Label = ({ intlLabel, labelAction, name, required }) => {
6
+ const Label = ({ intlLabel, labelAction, name }) => {
16
7
  const { formatMessage } = useIntl();
17
8
  const label = intlLabel?.id
18
9
  ? formatMessage(
@@ -21,19 +12,13 @@ const Label = ({ intlLabel, labelAction, name, required }) => {
21
12
  )
22
13
  : name;
23
14
 
24
- return (
25
- <Flex>
26
- <FieldLabel required={required}>{label}</FieldLabel>
27
- {labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>}
28
- </Flex>
29
- );
15
+ return <FieldLabel action={labelAction}>{label}</FieldLabel>;
30
16
  };
31
17
 
32
18
  Label.defaultProps = {
33
19
  id: undefined,
34
20
  intlLabel: undefined,
35
21
  labelAction: undefined,
36
- required: false,
37
22
  };
38
23
 
39
24
  Label.propTypes = {
@@ -45,7 +30,6 @@ Label.propTypes = {
45
30
  }),
46
31
  labelAction: PropTypes.element,
47
32
  name: PropTypes.string.isRequired,
48
- required: PropTypes.bool,
49
33
  };
50
34
 
51
35
  export default Label;
@@ -157,13 +157,17 @@ class InputJSON extends React.Component {
157
157
  }
158
158
 
159
159
  return (
160
- <FieldWrapper name={this.props.name} hint={this.props.description} error={this.props.error}>
160
+ <FieldWrapper
161
+ name={this.props.name}
162
+ hint={this.props.description}
163
+ error={this.props.error}
164
+ required={this.props.required}
165
+ >
161
166
  <Stack spacing={1}>
162
167
  <Label
163
168
  intlLabel={this.props.intlLabel}
164
- labelAction={this.props.labelAction}
165
169
  name={this.props.name}
166
- required={this.props.required}
170
+ labelAction={this.props.labelAction}
167
171
  />
168
172
  <StyledBox error={this.props.error}>
169
173
  <EditorWrapper disabled={this.props.disabled}>
@@ -226,15 +226,13 @@ const RelationInput = ({
226
226
  }, [previewRelationsLength, relations]);
227
227
 
228
228
  return (
229
- <Field error={error} name={name} hint={description} id={id}>
229
+ <Field error={error} name={name} hint={description} id={id} required={required}>
230
230
  <Relation
231
231
  totalNumberOfRelations={totalNumberOfRelations}
232
232
  size={size}
233
233
  search={
234
234
  <>
235
- <FieldLabel action={labelAction} required={required}>
236
- {label}
237
- </FieldLabel>
235
+ <FieldLabel action={labelAction}>{label}</FieldLabel>
238
236
  <ReactSelect
239
237
  // position fixed doesn't update position on scroll
240
238
  // react select doesn't update menu position on options change
@@ -8,7 +8,6 @@ import { Flex } from '@strapi/design-system/Flex';
8
8
  import { KeyboardNavigable } from '@strapi/design-system/KeyboardNavigable';
9
9
 
10
10
  const AccordionFooter = styled(Box)`
11
- overflow: hidden;
12
11
  border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
13
12
  border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
14
13
  border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
@@ -54,9 +54,7 @@ const RepeatableComponent = ({
54
54
  [componentUid, getComponentLayout]
55
55
  );
56
56
 
57
- const nextTempKey = useMemo(() => {
58
- return getMaxTempKey(componentValue || []) + 1;
59
- }, [componentValue]);
57
+ const nextTempKey = useMemo(() => getMaxTempKey(componentValue || []) + 1, [componentValue]);
60
58
 
61
59
  const componentErrorKeys = getComponentErrorKeys(name, formErrors);
62
60
 
@@ -22,7 +22,9 @@ import getTrad from '../../../utils/getTrad';
22
22
  import { makeSelectModelLinks } from '../selectors';
23
23
 
24
24
  const matchByTitle = (links, search) =>
25
- matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] });
25
+ search
26
+ ? matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] })
27
+ : sortBy(links, (object) => object.title.toLowerCase());
26
28
 
27
29
  const LeftMenu = () => {
28
30
  const [search, setSearch] = useState('');
@@ -52,9 +54,7 @@ const LeftMenu = () => {
52
54
  defaultMessage: 'Collection Types',
53
55
  },
54
56
  searchable: true,
55
- links: sortBy(matchByTitle(intlCollectionTypeLinks, search), (object) =>
56
- object.title.toLowerCase()
57
- ),
57
+ links: matchByTitle(intlCollectionTypeLinks, search),
58
58
  },
59
59
  {
60
60
  id: 'singleTypes',
@@ -63,9 +63,7 @@ const LeftMenu = () => {
63
63
  defaultMessage: 'Single Types',
64
64
  },
65
65
  searchable: true,
66
- links: sortBy(matchByTitle(intlSingleTypeLinks, search), (object) =>
67
- object.title.toLowerCase()
68
- ),
66
+ links: matchByTitle(intlSingleTypeLinks, search),
69
67
  },
70
68
  ];
71
69
 
@@ -1,43 +1,31 @@
1
1
  import React from 'react';
2
- import get from 'lodash/get';
3
- import PropTypes from 'prop-types';
4
- import { Flex } from '@strapi/design-system/Flex';
5
- import { Typography } from '@strapi/design-system/Typography';
6
- import { Box } from '@strapi/design-system/Box';
7
- import { Stack } from '@strapi/design-system/Stack';
8
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
2
  import styled from 'styled-components';
10
3
  import { Link } from 'react-router-dom';
4
+ import PropTypes from 'prop-types';
5
+ import { Box, Flex, Typography, Stack } from '@strapi/design-system';
6
+
7
+ import { ComponentIcon } from '../../../components/ComponentIcon';
11
8
  import useLayoutDnd from '../../../hooks/useLayoutDnd';
12
9
 
13
- const CustomFlex = styled(Flex)`
14
- border-radius: 50%;
15
- svg {
16
- & > * {
17
- fill: ${({ theme }) => theme.colors.neutral500};
18
- }
19
- width: 12px;
20
- height: 12px;
21
- }
22
- `;
23
10
  const CustomLink = styled(Flex)`
24
11
  text-decoration: none;
12
+
13
+ &:focus,
25
14
  &:hover {
26
15
  ${({ theme }) => `
27
- background: ${theme.colors.primary100};
28
- svg {
29
- & > * {
30
- fill: ${theme.colors.primary600};
31
- }
32
- }
16
+ background-color: ${theme.colors.primary100};
17
+ border-color: ${theme.colors.primary200};
18
+
33
19
  ${Typography} {
34
20
  color: ${theme.colors.primary600};
35
21
  }
36
- ${CustomFlex} {
37
- background: ${theme.colors.primary200};
38
- }
39
- border-color: ${theme.colors.primary200};
40
22
  `}
23
+
24
+ /* > ComponentIcon */
25
+ > div:first-child {
26
+ background: ${({ theme }) => theme.colors.primary200};
27
+ color: ${({ theme }) => theme.colors.primary600};
28
+ }
41
29
  }
42
30
  `;
43
31
 
@@ -61,19 +49,11 @@ const DynamicZoneList = ({ components }) => {
61
49
  as={Link}
62
50
  to={`/content-manager/components/${componentUid}/configurations/edit`}
63
51
  >
64
- <CustomFlex
65
- width={`${32 / 16}rem`}
66
- height={`${32 / 16}rem`}
67
- background="neutral150"
68
- justifyContent="center"
69
- alignItems="center"
70
- padding={2}
71
- >
72
- <FontAwesomeIcon icon={get(componentLayouts, [componentUid, 'info', 'icon'], '')} />
73
- </CustomFlex>
52
+ <ComponentIcon />
53
+
74
54
  <Box paddingTop={1}>
75
55
  <Typography fontSize={1} textColor="neutral600" fontWeight="bold">
76
- {get(componentLayouts, [componentUid, 'info', 'displayName'], '')}
56
+ {componentLayouts?.[componentUid]?.info?.displayName ?? ''}
77
57
  </Typography>
78
58
  </Box>
79
59
  </CustomLink>
@@ -74,7 +74,7 @@ const Header = ({
74
74
  {formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}
75
75
  </Button>
76
76
  )}
77
- <Button disabled={!didChangeData} isLoading={status === 'submit-pending'} type="submit">
77
+ <Button disabled={!didChangeData} loading={status === 'submit-pending'} type="submit">
78
78
  {formatMessage({
79
79
  id: getTrad('containers.Edit.submit'),
80
80
  defaultMessage: 'Save',
@@ -5,6 +5,7 @@ import isEqual from 'lodash/isEqual';
5
5
  import upperFirst from 'lodash/upperFirst';
6
6
  import pick from 'lodash/pick';
7
7
  import get from 'lodash/get';
8
+ import isEmpty from 'lodash/isEmpty';
8
9
  import { stringify } from 'qs';
9
10
  import { useNotification, useTracking, ConfirmDialog, Link } from '@strapi/helper-plugin';
10
11
  import { useIntl } from 'react-intl';
@@ -35,12 +36,12 @@ const ListSettingsView = ({ layout, slug }) => {
35
36
 
36
37
  const [showWarningSubmit, setWarningSubmit] = useState(false);
37
38
  const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
38
- const [isModalFormOpen, setIsModalFormOpen] = useState(false);
39
- const toggleModalForm = () => setIsModalFormOpen((prevState) => !prevState);
40
39
  const [reducerState, dispatch] = useReducer(reducer, initialState, () =>
41
40
  init(initialState, layout)
42
41
  );
43
42
  const { fieldToEdit, fieldForm, initialData, modifiedData } = reducerState;
43
+ const isModalFormOpen = !isEmpty(fieldForm);
44
+
44
45
  const { attributes } = layout;
45
46
  const displayedFields = modifiedData.layouts.list;
46
47
 
@@ -110,19 +111,16 @@ const ListSettingsView = ({ layout, slug }) => {
110
111
  type: 'SET_FIELD_TO_EDIT',
111
112
  fieldToEdit,
112
113
  });
113
- toggleModalForm();
114
114
  };
115
115
 
116
116
  const handleCloseModal = () => {
117
117
  dispatch({
118
118
  type: 'UNSET_FIELD_TO_EDIT',
119
119
  });
120
- toggleModalForm();
121
120
  };
122
121
 
123
122
  const handleSubmitFieldEdit = (e) => {
124
123
  e.preventDefault();
125
- toggleModalForm();
126
124
  dispatch({
127
125
  type: 'SUBMIT_FIELD_FORM',
128
126
  });