@akemona-org/strapi-plugin-users-permissions 3.7.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 (143) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +19 -0
  3. package/admin/src/assets/images/logo.svg +1 -0
  4. package/admin/src/components/BaselineAlignement/index.js +33 -0
  5. package/admin/src/components/Bloc/index.js +10 -0
  6. package/admin/src/components/BoundRoute/Components.js +78 -0
  7. package/admin/src/components/BoundRoute/index.js +56 -0
  8. package/admin/src/components/ContainerFluid/index.js +13 -0
  9. package/admin/src/components/FormBloc/index.js +61 -0
  10. package/admin/src/components/IntlInput/index.js +38 -0
  11. package/admin/src/components/ListBaselineAlignment/index.js +8 -0
  12. package/admin/src/components/ListRow/Components.js +74 -0
  13. package/admin/src/components/ListRow/index.js +35 -0
  14. package/admin/src/components/ModalForm/Wrapper.js +12 -0
  15. package/admin/src/components/ModalForm/index.js +59 -0
  16. package/admin/src/components/Permissions/ListWrapper.js +9 -0
  17. package/admin/src/components/Permissions/PermissionRow/BaselineAlignment.js +7 -0
  18. package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.js +37 -0
  19. package/admin/src/components/Permissions/PermissionRow/RowStyle.js +28 -0
  20. package/admin/src/components/Permissions/PermissionRow/SubCategory/ConditionsButtonWrapper.js +13 -0
  21. package/admin/src/components/Permissions/PermissionRow/SubCategory/PolicyWrapper.js +8 -0
  22. package/admin/src/components/Permissions/PermissionRow/SubCategory/SubCategoryWrapper.js +26 -0
  23. package/admin/src/components/Permissions/PermissionRow/SubCategory/index.js +116 -0
  24. package/admin/src/components/Permissions/PermissionRow/index.js +92 -0
  25. package/admin/src/components/Permissions/index.js +44 -0
  26. package/admin/src/components/Permissions/init.js +14 -0
  27. package/admin/src/components/Permissions/reducer.js +27 -0
  28. package/admin/src/components/Policies/Components.js +26 -0
  29. package/admin/src/components/Policies/index.js +61 -0
  30. package/admin/src/components/PrefixedIcon/index.js +27 -0
  31. package/admin/src/components/Roles/EmptyRole/BaselineAlignment.js +7 -0
  32. package/admin/src/components/Roles/EmptyRole/index.js +27 -0
  33. package/admin/src/components/Roles/RoleListWrapper/index.js +17 -0
  34. package/admin/src/components/Roles/RoleRow/RoleDescription.js +9 -0
  35. package/admin/src/components/Roles/RoleRow/index.js +45 -0
  36. package/admin/src/components/Roles/index.js +3 -0
  37. package/admin/src/components/SizedInput/index.js +24 -0
  38. package/admin/src/components/UsersPermissions/index.js +91 -0
  39. package/admin/src/components/UsersPermissions/init.js +11 -0
  40. package/admin/src/components/UsersPermissions/reducer.js +60 -0
  41. package/admin/src/containers/AdvancedSettings/index.js +218 -0
  42. package/admin/src/containers/AdvancedSettings/reducer.js +65 -0
  43. package/admin/src/containers/AdvancedSettings/utils/form.js +52 -0
  44. package/admin/src/containers/EmailTemplates/CustomTextInput.js +105 -0
  45. package/admin/src/containers/EmailTemplates/Wrapper.js +36 -0
  46. package/admin/src/containers/EmailTemplates/index.js +222 -0
  47. package/admin/src/containers/EmailTemplates/reducer.js +58 -0
  48. package/admin/src/containers/EmailTemplates/utils/forms.js +81 -0
  49. package/admin/src/containers/EmailTemplates/utils/schema.js +25 -0
  50. package/admin/src/containers/Providers/index.js +283 -0
  51. package/admin/src/containers/Providers/reducer.js +54 -0
  52. package/admin/src/containers/Providers/utils/createProvidersArray.js +21 -0
  53. package/admin/src/containers/Providers/utils/forms.js +205 -0
  54. package/admin/src/containers/Roles/CreatePage/index.js +167 -0
  55. package/admin/src/containers/Roles/CreatePage/utils/schema.js +9 -0
  56. package/admin/src/containers/Roles/EditPage/index.js +161 -0
  57. package/admin/src/containers/Roles/EditPage/utils/schema.js +9 -0
  58. package/admin/src/containers/Roles/ListPage/BaselineAlignment.js +8 -0
  59. package/admin/src/containers/Roles/ListPage/index.js +188 -0
  60. package/admin/src/containers/Roles/ProtectedCreatePage/index.js +12 -0
  61. package/admin/src/containers/Roles/ProtectedEditPage/index.js +12 -0
  62. package/admin/src/containers/Roles/ProtectedListPage/index.js +15 -0
  63. package/admin/src/containers/Roles/index.js +35 -0
  64. package/admin/src/contexts/EditPage/index.js +26 -0
  65. package/admin/src/contexts/HomePage/index.js +27 -0
  66. package/admin/src/contexts/UsersPermissionsContext/index.js +17 -0
  67. package/admin/src/hooks/index.js +5 -0
  68. package/admin/src/hooks/useFetchRole/index.js +55 -0
  69. package/admin/src/hooks/useFetchRole/reducer.js +31 -0
  70. package/admin/src/hooks/useForm/index.js +96 -0
  71. package/admin/src/hooks/useForm/reducer.js +59 -0
  72. package/admin/src/hooks/usePlugins/index.js +73 -0
  73. package/admin/src/hooks/usePlugins/init.js +5 -0
  74. package/admin/src/hooks/usePlugins/reducer.js +37 -0
  75. package/admin/src/hooks/useRolesList/index.js +62 -0
  76. package/admin/src/hooks/useRolesList/init.js +5 -0
  77. package/admin/src/hooks/useRolesList/reducer.js +31 -0
  78. package/admin/src/index.js +109 -0
  79. package/admin/src/permissions.js +33 -0
  80. package/admin/src/pluginId.js +5 -0
  81. package/admin/src/translations/ar.json +49 -0
  82. package/admin/src/translations/cs.json +55 -0
  83. package/admin/src/translations/de.json +68 -0
  84. package/admin/src/translations/dk.json +116 -0
  85. package/admin/src/translations/en.json +104 -0
  86. package/admin/src/translations/es.json +70 -0
  87. package/admin/src/translations/fr.json +55 -0
  88. package/admin/src/translations/id.json +69 -0
  89. package/admin/src/translations/index.js +55 -0
  90. package/admin/src/translations/it.json +68 -0
  91. package/admin/src/translations/ja.json +53 -0
  92. package/admin/src/translations/ko.json +55 -0
  93. package/admin/src/translations/ms.json +54 -0
  94. package/admin/src/translations/nl.json +53 -0
  95. package/admin/src/translations/pl.json +55 -0
  96. package/admin/src/translations/pt-BR.json +49 -0
  97. package/admin/src/translations/pt.json +53 -0
  98. package/admin/src/translations/ru.json +68 -0
  99. package/admin/src/translations/sk.json +57 -0
  100. package/admin/src/translations/sv.json +68 -0
  101. package/admin/src/translations/th.json +66 -0
  102. package/admin/src/translations/tr.json +53 -0
  103. package/admin/src/translations/uk.json +54 -0
  104. package/admin/src/translations/vi.json +55 -0
  105. package/admin/src/translations/zh-Hans.json +104 -0
  106. package/admin/src/translations/zh.json +53 -0
  107. package/admin/src/utils/cleanPermissions.js +25 -0
  108. package/admin/src/utils/formatPolicies.js +8 -0
  109. package/admin/src/utils/getRequestURL.js +5 -0
  110. package/admin/src/utils/getTrad.js +5 -0
  111. package/admin/src/utils/index.js +4 -0
  112. package/config/functions/bootstrap.js +234 -0
  113. package/config/layout.js +10 -0
  114. package/config/policies/isAuthenticated.js +9 -0
  115. package/config/policies/permissions.js +93 -0
  116. package/config/policies/rateLimit.js +33 -0
  117. package/config/request.json +6 -0
  118. package/config/routes.json +397 -0
  119. package/config/schema.graphql.js +280 -0
  120. package/config/security.json +5 -0
  121. package/config/users-permissions-actions.js +80 -0
  122. package/controllers/Auth.js +612 -0
  123. package/controllers/User.js +125 -0
  124. package/controllers/UsersPermissions.js +291 -0
  125. package/controllers/user/admin.js +224 -0
  126. package/controllers/user/api.js +173 -0
  127. package/controllers/validation/email-template.js +40 -0
  128. package/documentation/1.0.0/overrides/users-permissions-Role.json +281 -0
  129. package/documentation/1.0.0/overrides/users-permissions-User.json +325 -0
  130. package/middlewares/users-permissions/defaults.json +5 -0
  131. package/middlewares/users-permissions/index.js +40 -0
  132. package/models/Permission.js +7 -0
  133. package/models/Permission.settings.json +43 -0
  134. package/models/Role.js +7 -0
  135. package/models/Role.settings.json +42 -0
  136. package/models/User.config.js +15 -0
  137. package/models/User.js +7 -0
  138. package/models/User.settings.json +62 -0
  139. package/package.json +70 -0
  140. package/services/Jwt.js +65 -0
  141. package/services/Providers.js +596 -0
  142. package/services/User.js +167 -0
  143. package/services/UsersPermissions.js +416 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015-present Strapi Solutions SAS
2
+
3
+ Portions of the Strapi software are licensed as follows:
4
+
5
+ * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined in "ee/LICENSE".
6
+
7
+ * All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
8
+
9
+ MIT Expat License
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Strapi plugin
2
+
3
+ ---
4
+
5
+ ## Deprecation Warning :warning:
6
+
7
+ Hello! We have some news to share,
8
+
9
+ We’ve decided it’ll soon be time to end the support for `strapi-plugin-users-permissions`.
10
+
11
+ After years of iterations, Strapi is going to V4 and we won’t maintain V3 packages when it’ll reach its end-of-support milestone (~end of Q3 2022).
12
+
13
+ If you’ve been using `strapi-plugin-users-permissions` and have migrated to V4 (or if you want to), you can find the equivalent and updated version of this package at this [URL](https://github.com/strapi/strapi/tree/master/packages/plugins/users-permissions) and with the following name on NPM: `@strapi/plugin-users-permissions`.
14
+
15
+ If you’ve contributed to the development of this package, thank you again for that! We hope to see you on the V4 soon.
16
+
17
+ The Akemona team
18
+
19
+ ---
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><text transform="translate(-24 -6)" fill="#4B515A" fill-rule="evenodd" font-size="24" font-family="AppleColorEmoji, Apple Color Emoji"><tspan x="24" y="28">🔐</tspan></text></svg>
@@ -0,0 +1,33 @@
1
+ import PropTypes from 'prop-types';
2
+ import styled from 'styled-components';
3
+
4
+ // You can see in the index.js file that I used the design system to do the UI integration but
5
+ // sometimes, we need to create some "temporary" custom style to fix the baseline alignment.
6
+ // -----
7
+ // TODO : remove this component. I think that this kind components should not exist in Strapi.
8
+ // I create it to temporary fix the baseline alignment until we have the design system.
9
+
10
+ const BaselineAlignment = styled.div`
11
+ padding-top: ${({ size, top }) => top && size};
12
+ padding-right: ${({ size, right }) => right && size};
13
+ padding-bottom: ${({ size, bottom }) => bottom && size};
14
+ padding-left: ${({ size, left }) => left && size};
15
+ `;
16
+
17
+ BaselineAlignment.defaultProps = {
18
+ bottom: false,
19
+ left: false,
20
+ right: false,
21
+ size: '0',
22
+ top: false,
23
+ };
24
+
25
+ BaselineAlignment.propTypes = {
26
+ bottom: PropTypes.bool,
27
+ left: PropTypes.bool,
28
+ right: PropTypes.bool,
29
+ size: PropTypes.string,
30
+ top: PropTypes.bool,
31
+ };
32
+
33
+ export default BaselineAlignment;
@@ -0,0 +1,10 @@
1
+ import styled from 'styled-components';
2
+
3
+ const Bloc = styled.div`
4
+ flex: 1;
5
+ background: ${({ theme }) => theme.main.colors.white};
6
+ border-radius: ${({ theme }) => theme.main.sizes.borderRadius};
7
+ box-shadow: 0 2px 4px #e3e9f3;
8
+ `;
9
+
10
+ export default Bloc;
@@ -0,0 +1,78 @@
1
+ import styled from 'styled-components';
2
+ import { themePropTypes } from 'strapi-helper-plugin';
3
+
4
+ const Wrapper = styled.div`
5
+ display: flex;
6
+ min-height: 2.4rem;
7
+ border-radius: 3px;
8
+ background-color: #e9eaeb;
9
+ line-height: 2.4rem;
10
+ `;
11
+
12
+ const Header = styled.div`
13
+ margin-bottom: 3rem;
14
+ padding-top: 1.2rem;
15
+ color: #333740;
16
+ font-size: 18px;
17
+ font-weight: ${({ theme }) => theme.main.fontWeights.bold};
18
+
19
+ > span:not(:first-child) {
20
+ color: #787e8f;
21
+ font-size: 16px;
22
+ font-weight: ${({ theme }) => theme.main.fontWeights.semiBold};
23
+ }
24
+
25
+ > span:last-child {
26
+ color: #1642e1;
27
+ font-weight: ${({ theme }) => theme.main.fontWeights.bold};
28
+ }
29
+ `;
30
+
31
+ Header.propTypes = {
32
+ ...themePropTypes,
33
+ };
34
+
35
+ const Path = styled.div`
36
+ padding: 0 1rem;
37
+ font-size: 13px;
38
+ font-weight: ${({ theme }) => theme.main.fontWeights.bold};
39
+ color: #333740;
40
+ `;
41
+
42
+ Path.propTypes = {
43
+ ...themePropTypes,
44
+ };
45
+
46
+ const Verb = styled.div`
47
+ display: flex;
48
+ flex-direction: column;
49
+ justify-content: center;
50
+ padding: 0 1rem;
51
+ border-radius: 3px;
52
+ color: #ffffff;
53
+ font-size: 12px;
54
+ font-weight: ${({ theme }) => theme.main.fontWeights.bold};
55
+ text-transform: uppercase;
56
+ letter-spacing: 0.5px;
57
+ &.get {
58
+ background-color: #008dfe;
59
+ }
60
+
61
+ &.post {
62
+ background-color: #69ba05;
63
+ }
64
+
65
+ &.put {
66
+ background-color: #f68e0e;
67
+ }
68
+
69
+ &.delete {
70
+ background-color: #f64d0a;
71
+ }
72
+ `;
73
+
74
+ Verb.propTypes = {
75
+ ...themePropTypes,
76
+ };
77
+
78
+ export { Header, Path, Verb, Wrapper };
@@ -0,0 +1,56 @@
1
+ /**
2
+ *
3
+ * BoundRoute
4
+ *
5
+ */
6
+
7
+ import React from 'react';
8
+ import { get, includes, map, tail, toLower } from 'lodash';
9
+ import { FormattedMessage } from 'react-intl';
10
+ import PropTypes from 'prop-types';
11
+ import { Header, Path, Verb, Wrapper } from './Components';
12
+
13
+ function BoundRoute({ route }) {
14
+ const title = get(route, 'handler');
15
+ const formattedRoute = get(route, 'path') ? tail(get(route, 'path').split('/')) : [];
16
+ const [controller = '', action = ''] = title ? title.split('.') : [];
17
+
18
+ return (
19
+ <div className="col-md-12">
20
+ <Header>
21
+ <FormattedMessage id="users-permissions.BoundRoute.title" />
22
+ &nbsp;
23
+ <span>{controller}</span>
24
+ <span>.{action} </span>
25
+ </Header>
26
+ <Wrapper>
27
+ <Verb className={toLower(get(route, 'method'))}>{get(route, 'method')}</Verb>
28
+ <Path>
29
+ {map(formattedRoute, value => (
30
+ <span key={value} style={includes(value, ':') ? { color: '#787E8F' } : {}}>
31
+ /{value}
32
+ </span>
33
+ ))}
34
+ </Path>
35
+ </Wrapper>
36
+ </div>
37
+ );
38
+ }
39
+
40
+ BoundRoute.defaultProps = {
41
+ route: {
42
+ handler: 'Nocontroller.error',
43
+ method: 'GET',
44
+ path: '/there-is-no-path',
45
+ },
46
+ };
47
+
48
+ BoundRoute.propTypes = {
49
+ route: PropTypes.shape({
50
+ handler: PropTypes.string,
51
+ method: PropTypes.string,
52
+ path: PropTypes.string,
53
+ }),
54
+ };
55
+
56
+ export default BoundRoute;
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components';
2
+ import { Container } from 'reactstrap';
3
+
4
+ const ContainerFluid = styled(Container)`
5
+ padding: ${({ padding }) => padding};
6
+ `;
7
+
8
+ ContainerFluid.defaultProps = {
9
+ fluid: true,
10
+ padding: '18px 30px !important',
11
+ };
12
+
13
+ export default ContainerFluid;
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { Flex, Padded, Text } from '@buffetjs/core';
3
+ import { LoadingIndicator } from 'strapi-helper-plugin';
4
+ import PropTypes from 'prop-types';
5
+ import BaselineAlignement from '../BaselineAlignement';
6
+ import Bloc from '../Bloc';
7
+
8
+ const FormBloc = ({ children, actions, isLoading, title, subtitle }) => (
9
+ <Bloc>
10
+ <BaselineAlignement top size={title ? '18px' : '22px'} />
11
+ <Padded left right size="sm">
12
+ {isLoading ? (
13
+ <>
14
+ <LoadingIndicator />
15
+ <BaselineAlignement bottom size="22px" />
16
+ </>
17
+ ) : (
18
+ <>
19
+ {title && (
20
+ <>
21
+ <Padded left right size="xs">
22
+ <Flex justifyContent="space-between">
23
+ <Padded left right size="sm">
24
+ <Text fontSize="lg" fontWeight="bold">
25
+ {title}
26
+ </Text>
27
+ {subtitle && (
28
+ <Text color="grey" lineHeight="1.8rem">
29
+ {subtitle}
30
+ </Text>
31
+ )}
32
+ </Padded>
33
+ {actions}
34
+ </Flex>
35
+ </Padded>
36
+ <BaselineAlignement top size="18px" />
37
+ </>
38
+ )}
39
+ {children}
40
+ </>
41
+ )}
42
+ </Padded>
43
+ </Bloc>
44
+ );
45
+
46
+ FormBloc.defaultProps = {
47
+ actions: null,
48
+ isLoading: false,
49
+ subtitle: null,
50
+ title: null,
51
+ };
52
+
53
+ FormBloc.propTypes = {
54
+ actions: PropTypes.any,
55
+ children: PropTypes.node.isRequired,
56
+ isLoading: PropTypes.bool,
57
+ subtitle: PropTypes.string,
58
+ title: PropTypes.string,
59
+ };
60
+
61
+ export default FormBloc;
@@ -0,0 +1,38 @@
1
+ import React, { useMemo } from 'react';
2
+ import { translatedErrors } from 'strapi-helper-plugin';
3
+ import { useIntl } from 'react-intl';
4
+ import { Inputs } from '@buffetjs/custom';
5
+ import PropTypes from 'prop-types';
6
+
7
+ const IntlInput = ({ label: labelId, defaultMessage, error, ...rest }) => {
8
+ const { formatMessage } = useIntl();
9
+ const label = formatMessage({ id: labelId, defaultMessage: defaultMessage || labelId });
10
+ const translatedError = error ? formatMessage(error) : null;
11
+ const formattedErrors = useMemo(() => {
12
+ return Object.keys(translatedErrors).reduce((acc, current) => {
13
+ acc[current] = formatMessage({ id: translatedErrors[current] });
14
+
15
+ return acc;
16
+ }, {});
17
+ // eslint-disable-next-line react-hooks/exhaustive-deps
18
+ }, []);
19
+
20
+ return (
21
+ <Inputs {...rest} label={label} error={translatedError} translatedErrors={formattedErrors} />
22
+ );
23
+ };
24
+
25
+ IntlInput.defaultProps = {
26
+ defaultMessage: null,
27
+ error: null,
28
+ };
29
+
30
+ IntlInput.propTypes = {
31
+ defaultMessage: PropTypes.string,
32
+ error: PropTypes.shape({
33
+ id: PropTypes.string,
34
+ }),
35
+ label: PropTypes.string.isRequired,
36
+ };
37
+
38
+ export default IntlInput;
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components';
2
+
3
+ // TODO : Temporary baseline alignment
4
+ const ListBaselineAlignment = styled.div`
5
+ padding-top: 3px;
6
+ `;
7
+
8
+ export default ListBaselineAlignment;
@@ -0,0 +1,74 @@
1
+ import styled from 'styled-components';
2
+
3
+ const Container = styled.div`
4
+ margin: 0 3.2rem 0 1.9rem;
5
+ padding: 0 1.4rem 0 0rem;
6
+ border-bottom: 1px solid rgba(14, 22, 34, 0.04);
7
+ color: #333740;
8
+ font-size: 1.3rem;
9
+ > div {
10
+ padding: 0;
11
+ align-self: center;
12
+ }
13
+ > div:first-child {
14
+ padding-left: 1.4rem;
15
+ }
16
+ > div:last-child {
17
+ text-align: right;
18
+ }
19
+ `;
20
+
21
+ const Flex = styled.div`
22
+ display: flex;
23
+ padding-left: 7px;
24
+ font-weight: 600;
25
+ > div:first-child {
26
+ width: 17px;
27
+ padding-top: 2px;
28
+ > i,
29
+ > svg {
30
+ font-size: 12px;
31
+ vertical-align: inherit;
32
+ }
33
+ }
34
+ > div:last-child {
35
+ width: 80%;
36
+ margin-left: 54px;
37
+ padding-left: 7px;
38
+ text-align: left;
39
+ font-weight: 500 !important;
40
+ }
41
+ `;
42
+
43
+ const Row = styled.div`
44
+ margin-top: 0 !important;
45
+ position: relative;
46
+ height: 5.4rem;
47
+ line-height: 5.4rem;
48
+ cursor: pointer;
49
+ &:hover {
50
+ background-color: #f7f8f8;
51
+ }
52
+ div {
53
+ overflow: hidden;
54
+ text-overflow: ellipsis;
55
+ white-space: nowrap;
56
+ }
57
+ `;
58
+
59
+ const Wrapper = styled.div`
60
+ > div:first-child {
61
+ text-align: left;
62
+ }
63
+ > div:nth-of-type(2) {
64
+ text-align: center;
65
+ }
66
+ strong {
67
+ font-weight: 600;
68
+ }
69
+ b {
70
+ font-weight: 500;
71
+ }
72
+ `;
73
+
74
+ export { Container, Flex, Row, Wrapper };
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { CustomRow } from '@buffetjs/styles';
3
+ import { IconLinks } from '@buffetjs/core';
4
+ import PropTypes from 'prop-types';
5
+ import PrefixedIcon from '../PrefixedIcon';
6
+
7
+ const ListRow = ({ icon, name, onClick, links, children }) => {
8
+ return (
9
+ <CustomRow onClick={onClick}>
10
+ <td>
11
+ <PrefixedIcon icon={icon} name={name} />
12
+ </td>
13
+ {children}
14
+ <td>
15
+ <IconLinks links={links} />
16
+ </td>
17
+ </CustomRow>
18
+ );
19
+ };
20
+
21
+ ListRow.defaultProps = {
22
+ children: null,
23
+ onClick: () => {},
24
+ links: [],
25
+ };
26
+
27
+ ListRow.propTypes = {
28
+ children: PropTypes.node,
29
+ icon: PropTypes.array.isRequired,
30
+ links: PropTypes.array,
31
+ name: PropTypes.string.isRequired,
32
+ onClick: PropTypes.func,
33
+ };
34
+
35
+ export default ListRow;
@@ -0,0 +1,12 @@
1
+ import styled from 'styled-components';
2
+ import { Container } from 'reactstrap';
3
+
4
+ const Wrapper = styled(Container)`
5
+ padding: 0;
6
+ `;
7
+
8
+ Wrapper.defaultProps = {
9
+ fluid: true,
10
+ };
11
+
12
+ export default Wrapper;
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { Modal, ModalHeader, ModalSection, ModalFooter } from 'strapi-helper-plugin';
3
+ import { useIntl } from 'react-intl';
4
+ import { Button, Padded } from '@buffetjs/core';
5
+ import PropTypes from 'prop-types';
6
+ import BaselineAlignment from '../ListBaselineAlignment';
7
+ import Wrapper from './Wrapper';
8
+
9
+ const ModalForm = ({
10
+ children,
11
+ headerBreadcrumbs,
12
+ isLoading,
13
+ isOpen,
14
+ onCancel,
15
+ onClosed,
16
+ onClick,
17
+ onOpened,
18
+ onToggle,
19
+ }) => {
20
+ const { formatMessage } = useIntl();
21
+
22
+ return (
23
+ <Modal isOpen={isOpen} onOpened={onOpened} onToggle={onToggle} onClosed={onClosed}>
24
+ <ModalHeader headerBreadcrumbs={headerBreadcrumbs} />
25
+ <ModalSection>
26
+ <Wrapper>
27
+ <BaselineAlignment />
28
+ <Padded top size="md">
29
+ {children}
30
+ </Padded>
31
+ </Wrapper>
32
+ </ModalSection>
33
+ <ModalFooter>
34
+ <section>
35
+ <Button type="button" color="cancel" onClick={onCancel}>
36
+ {formatMessage({ id: 'app.components.Button.cancel' })}
37
+ </Button>
38
+ <Button color="success" type="button" onClick={onClick} isLoading={isLoading}>
39
+ {formatMessage({ id: 'app.components.Button.save' })}
40
+ </Button>
41
+ </section>
42
+ </ModalFooter>
43
+ </Modal>
44
+ );
45
+ };
46
+
47
+ ModalForm.propTypes = {
48
+ children: PropTypes.node.isRequired,
49
+ headerBreadcrumbs: PropTypes.array.isRequired,
50
+ isLoading: PropTypes.bool.isRequired,
51
+ isOpen: PropTypes.bool.isRequired,
52
+ onCancel: PropTypes.func.isRequired,
53
+ onClosed: PropTypes.func.isRequired,
54
+ onClick: PropTypes.func.isRequired,
55
+ onOpened: PropTypes.func.isRequired,
56
+ onToggle: PropTypes.func.isRequired,
57
+ };
58
+
59
+ export default ModalForm;
@@ -0,0 +1,9 @@
1
+ import styled from 'styled-components';
2
+
3
+ const ListWrapper = styled.div`
4
+ background-color: ${({ theme }) => theme.main.colors.white};
5
+ padding-top: 1rem;
6
+ padding-bottom: 1.8rem;
7
+ `;
8
+
9
+ export default ListWrapper;
@@ -0,0 +1,7 @@
1
+ import styled from 'styled-components';
2
+
3
+ const BaselineAlignment = styled.div`
4
+ padding-top: 1px;
5
+ `;
6
+
7
+ export default BaselineAlignment;
@@ -0,0 +1,37 @@
1
+ /* eslint-disable indent */
2
+ import styled from 'styled-components';
3
+ import PolicyWrapper from './SubCategory/PolicyWrapper';
4
+
5
+ const CheckboxWrapper = styled.div`
6
+ display: flex;
7
+ justify-content: space-between;
8
+ min-width: 50%;
9
+ padding: 0.9rem;
10
+ height: 3.6rem;
11
+ position: relative;
12
+ ${PolicyWrapper} {
13
+ opacity: 0;
14
+ > svg {
15
+ align-self: center;
16
+ font-size: 1.4rem;
17
+ color: ${({ theme }) => theme.main.colors.greyDark};
18
+ }
19
+ cursor: pointer;
20
+ }
21
+ &:hover {
22
+ ${PolicyWrapper} {
23
+ opacity: 1;
24
+ }
25
+ background-color: ${({ theme }) => theme.main.colors.mediumGrey};
26
+ }
27
+ ${({ isActive, theme }) =>
28
+ isActive &&
29
+ `
30
+ ${PolicyWrapper} {
31
+ opacity: 1;
32
+ }
33
+ background-color: ${theme.main.colors.mediumGrey};
34
+ `}
35
+ `;
36
+
37
+ export default CheckboxWrapper;
@@ -0,0 +1,28 @@
1
+ import styled from 'styled-components';
2
+ import { Text } from '@buffetjs/core';
3
+
4
+ const activeStyle = theme => `
5
+ background-color: ${({ theme }) => theme.main.colors.lightestBlue};
6
+ border: 1px solid ${theme.main.colors.darkBlue};
7
+ ${Text} {
8
+ color: ${theme.main.colors.mediumBlue};
9
+ }
10
+ svg {
11
+ color: ${theme.main.colors.mediumBlue};
12
+ }
13
+ `;
14
+
15
+ const RowStyle = styled.div`
16
+ height: 5.4rem;
17
+ padding: 1rem 3rem;
18
+ border: 1px solid transparent;
19
+ background-color: ${({ theme, isWhite }) => theme.main.colors[isWhite ? 'white' : 'lightGrey']};
20
+ cursor: pointer;
21
+ &:hover {
22
+ background-color: ${({ theme }) => theme.main.colors.lightestBlue};
23
+ ${({ theme }) => activeStyle(theme)};
24
+ }
25
+ ${({ isActive, theme }) => isActive && activeStyle(theme)};
26
+ `;
27
+
28
+ export default RowStyle;
@@ -0,0 +1,13 @@
1
+ /* eslint-disable indent */
2
+ import styled from 'styled-components';
3
+
4
+ const ConditionsButtonWrapper = styled.div`
5
+ padding: 0.9rem;
6
+ ${({ hasConditions }) =>
7
+ hasConditions &&
8
+ `
9
+ padding-left: 22px;
10
+ `}
11
+ `;
12
+
13
+ export default ConditionsButtonWrapper;
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components';
2
+
3
+ const PolicyWrapper = styled.div`
4
+ flex: 1;
5
+ text-align: end;
6
+ `;
7
+
8
+ export default PolicyWrapper;
@@ -0,0 +1,26 @@
1
+ /* eslint-disable indent */
2
+ import styled from 'styled-components';
3
+
4
+ const SubCategoryWrapper = styled.div`
5
+ padding-bottom: 2.6rem;
6
+ input[type='checkbox'] {
7
+ &:after {
8
+ color: ${({ theme }) => theme.main.colors.mediumBlue};
9
+ }
10
+ }
11
+ ${({ disabled, theme }) =>
12
+ disabled &&
13
+ `
14
+ label {
15
+ cursor: default !important;
16
+ color: ${theme.main.colors.grey};
17
+ }
18
+ input[type='checkbox'] {
19
+ &:after {
20
+ color: ${theme.main.colors.grey};
21
+ }
22
+ }
23
+ `}
24
+ `;
25
+
26
+ export default SubCategoryWrapper;