@licklist/design 0.75.1-dev.0 → 0.75.1-dev.1

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.
@@ -25,12 +25,6 @@ import 'react-phone-number-input/locale/en.json';
25
25
  import 'react-select';
26
26
  import '../../../../provider/provider-form/ProviderForm.js';
27
27
  import '../../../../provider/venue-form/VenueForm.js';
28
- import 'clsx';
29
- import '@licklist/core/dist/DataMapper/User/UserRoleDataMapper';
30
- import '@licklist/plugins/dist/validation/Rules/emailRule';
31
- import '@licklist/plugins/dist/services/Form/HookFormService';
32
- import 'react-bootstrap/Col';
33
- import 'react-bootstrap/Row';
34
28
  import { CollapsibleInputGroup } from '../../../../collapsible-input-group/CollapsibleInputGroup.js';
35
29
  import { TipTapEditor } from '../../../../tiptap-editor/TipTapEditor.js';
36
30
  import { FileUpload } from '../../../../file-upload/FileUpload.js';
package/dist/index.js CHANGED
@@ -106,7 +106,6 @@ export { ProviderLinksInput } from './provider/provider-links-input/ProviderLink
106
106
  export { VenueForm } from './provider/venue-form/VenueForm.js';
107
107
  export { WorkingHoursInput } from './provider/working-hours-input/WorkingHoursInput.js';
108
108
  export { WorkingHoursInputDescription } from './provider/working-hours-input/WorkingHoursInputDescription.js';
109
- export { UserForm } from './provider/company/user-form/UserForm.js';
110
109
  export { RecurrenceInput } from './recurrence-input/RecurrenceInput.js';
111
110
  export { RecurringDatePickerInput, getDateTimeObject } from './recurring-date-picker-input/RecurringDatePickerInput.js';
112
111
  export { StatisticsChart } from './sales/statistics-chart/StatisticsChart.js';
@@ -5,5 +5,4 @@ export * from './provider-form';
5
5
  export * from './provider-links-input';
6
6
  export * from './venue-form';
7
7
  export * from './working-hours-input';
8
- export * from './company';
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.75.1-dev.0",
3
+ "version": "0.75.1-dev.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -5,4 +5,3 @@ export * from './provider-form'
5
5
  export * from './provider-links-input'
6
6
  export * from './venue-form'
7
7
  export * from './working-hours-input'
8
- export * from './company'
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
-
3
- var _path;
4
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5
- const SvgManagerRole = props => /*#__PURE__*/React.createElement("svg", _extends({
6
- xmlns: "http://www.w3.org/2000/svg",
7
- width: 48,
8
- height: 48,
9
- fill: "none"
10
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
11
- stroke: "#000",
12
- strokeLinecap: "round",
13
- strokeLinejoin: "round",
14
- strokeWidth: 2,
15
- d: "M35.936 23.36 39.018 30h5.958a1.47 1.47 0 0 1 1.036 2.566l-5.164 5.124 2.884 6.628a1.571 1.571 0 0 1-2.238 1.964l-6.972-3.922-6.974 3.922a1.572 1.572 0 0 1-2.238-1.964l2.89-6.622-5.2-5.124A1.468 1.468 0 0 1 24.018 30h6l3.088-6.646a1.6 1.6 0 0 1 2.83.006M23.664 23.466A12.04 12.04 0 0 0 13.5 18a12 12 0 0 0-12 10.5M6.75 8.25a6.75 6.75 0 1 0 13.5 0 6.75 6.75 0 0 0-13.5 0M27.75 6.75a5.25 5.25 0 1 0 10.5 0 5.25 5.25 0 0 0-10.5 0M40.8 18a9 9 0 0 0-14.568-1.42"
16
- })));
17
-
18
- export { SvgManagerRole as ReactComponent };
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
-
3
- var _path, _path2;
4
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5
- const SvgSubManagerRole = props => /*#__PURE__*/React.createElement("svg", _extends({
6
- xmlns: "http://www.w3.org/2000/svg",
7
- width: 48,
8
- height: 48,
9
- fill: "none"
10
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
11
- stroke: "#000",
12
- strokeLinecap: "round",
13
- strokeLinejoin: "round",
14
- strokeWidth: 2,
15
- d: "M31.5 33a3 3 0 1 0 6 0 3 3 0 0 0-6 0"
16
- })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
17
- stroke: "#000",
18
- strokeLinecap: "round",
19
- strokeLinejoin: "round",
20
- strokeWidth: 2,
21
- d: "m37.048 21.4.884 2.906a1.986 1.986 0 0 0 2.346 1.362l2.946-.684a2.678 2.678 0 0 1 2.548 4.438l-2.06 2.222a2 2 0 0 0 0 2.724l2.06 2.222a2.676 2.676 0 0 1-2.548 4.436l-2.946-.682a1.984 1.984 0 0 0-2.346 1.362l-.884 2.894a2.662 2.662 0 0 1-5.098 0l-.884-2.904a1.984 1.984 0 0 0-2.346-1.362l-2.946.682a2.676 2.676 0 0 1-2.548-4.436l2.06-2.222a2 2 0 0 0 0-2.724l-2.06-2.222a2.678 2.678 0 0 1 2.548-4.438l2.946.684a1.986 1.986 0 0 0 2.346-1.362l.884-2.906a2.662 2.662 0 0 1 5.098.01M20.512 20.2A12.13 12.13 0 0 0 13.5 18a12 12 0 0 0-12 10.5M6.75 8.25a6.75 6.75 0 1 0 13.5 0 6.75 6.75 0 0 0-13.5 0M27.75 6.75a5.25 5.25 0 1 0 10.5 0 5.25 5.25 0 0 0-10.5 0M39.052 15.842a9 9 0 0 0-12.828.738"
22
- })));
23
-
24
- export { SvgSubManagerRole as ReactComponent };
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
-
3
- var _path, _path2;
4
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5
- const SvgViewerRole = props => /*#__PURE__*/React.createElement("svg", _extends({
6
- xmlns: "http://www.w3.org/2000/svg",
7
- width: 48,
8
- height: 48,
9
- fill: "none"
10
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
11
- stroke: "#000",
12
- strokeLinecap: "round",
13
- strokeLinejoin: "round",
14
- strokeWidth: 2,
15
- d: "M34.998 32.001c-4.3-.072-8.746 2.933-11.542 6.01a1.774 1.774 0 0 0 0 2.374c2.735 3.013 7.169 6.087 11.542 6.013 4.374.074 8.809-3 11.546-6.013a1.774 1.774 0 0 0 0-2.374c-2.799-3.077-7.246-6.082-11.546-6.01"
16
- })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
17
- stroke: "#000",
18
- strokeLinecap: "round",
19
- strokeLinejoin: "round",
20
- strokeWidth: 2,
21
- d: "M38.999 39.2a4 4 0 1 1-8.001-.002 4 4 0 0 1 8 .002M20.512 20.2A12.13 12.13 0 0 0 13.5 18a12 12 0 0 0-12 10.5M6.75 8.25a6.75 6.75 0 1 0 13.5 0 6.75 6.75 0 0 0-13.5 0M27.75 6.75a5.25 5.25 0 1 0 10.5 0 5.25 5.25 0 0 0-10.5 0M39.052 15.842a9 9 0 0 0-12.828.738"
22
- })));
23
-
24
- export { SvgViewerRole as ReactComponent };
@@ -1,2 +0,0 @@
1
- export * from './user-form';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/company/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -1,17 +0,0 @@
1
- import { User } from '@licklist/core/dist/DataMapper/User/UserDataMapper';
2
- import { VIEWER_ROLE, MANAGER_ROLE, SUBMANAGER_ROLE } from '@licklist/core/dist/DataMapper/User/UserRoleDataMapper';
3
- export type UserFormValues = {
4
- email?: User['email'];
5
- role?: typeof VIEWER_ROLE | typeof MANAGER_ROLE | typeof SUBMANAGER_ROLE;
6
- };
7
- export type UserFormProps = {
8
- defaultValues?: UserFormValues;
9
- onSubmit: (values: {
10
- email: User['email'];
11
- role: typeof VIEWER_ROLE | typeof MANAGER_ROLE | typeof SUBMANAGER_ROLE;
12
- }) => void;
13
- isLoading?: boolean;
14
- hasPermission: boolean;
15
- };
16
- export declare const UserForm: ({ defaultValues, onSubmit, isLoading, hasPermission, }: UserFormProps) => import("react/jsx-runtime").JSX.Element;
17
- //# sourceMappingURL=UserForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserForm.d.ts","sourceRoot":"","sources":["../../../../src/provider/company/user-form/UserForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,oDAAoD,CAAA;AACzE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EAChB,MAAM,wDAAwD,CAAA;AAQ/D,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,WAAW,GAAG,OAAO,YAAY,GAAG,OAAO,eAAe,CAAA;CACzE,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QACpB,IAAI,EAAE,OAAO,WAAW,GAAG,OAAO,YAAY,GAAG,OAAO,eAAe,CAAA;KACxE,KAAK,IAAI,CAAA;IACV,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,QAAQ,2DAKlB,aAAa,4CAiHf,CAAA"}
@@ -1,205 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Form, Row, Col, Button } from 'react-bootstrap';
3
- import { useForm, Controller } from 'react-hook-form';
4
- import { useTranslation } from 'react-i18next';
5
- import clsx from 'clsx';
6
- import { MANAGER_ROLE, SUBMANAGER_ROLE, VIEWER_ROLE } from '@licklist/core/dist/DataMapper/User/UserRoleDataMapper';
7
- import emailRule from '@licklist/plugins/dist/validation/Rules/emailRule';
8
- import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService';
9
- import Logo from '../../../logo/Logo.js';
10
- import { ReactComponent as SvgManagerRole } from '../../../assets/dashboard/managerRole.svg.js';
11
- import { ReactComponent as SvgSubManagerRole } from '../../../assets/dashboard/subManagerRole.svg.js';
12
- import { ReactComponent as SvgViewerRole } from '../../../assets/dashboard/viewerRole.svg.js';
13
-
14
- function _define_property(obj, key, value) {
15
- if (key in obj) {
16
- Object.defineProperty(obj, key, {
17
- value: value,
18
- enumerable: true,
19
- configurable: true,
20
- writable: true
21
- });
22
- } else {
23
- obj[key] = value;
24
- }
25
- return obj;
26
- }
27
- function _object_spread(target) {
28
- for(var i = 1; i < arguments.length; i++){
29
- var source = arguments[i] != null ? arguments[i] : {};
30
- var ownKeys = Object.keys(source);
31
- if (typeof Object.getOwnPropertySymbols === "function") {
32
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
33
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
34
- }));
35
- }
36
- ownKeys.forEach(function(key) {
37
- _define_property(target, key, source[key]);
38
- });
39
- }
40
- return target;
41
- }
42
- function ownKeys(object, enumerableOnly) {
43
- var keys = Object.keys(object);
44
- if (Object.getOwnPropertySymbols) {
45
- var symbols = Object.getOwnPropertySymbols(object);
46
- if (enumerableOnly) {
47
- symbols = symbols.filter(function(sym) {
48
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
49
- });
50
- }
51
- keys.push.apply(keys, symbols);
52
- }
53
- return keys;
54
- }
55
- function _object_spread_props(target, source) {
56
- source = source != null ? source : {};
57
- if (Object.getOwnPropertyDescriptors) {
58
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
59
- } else {
60
- ownKeys(Object(source)).forEach(function(key) {
61
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
62
- });
63
- }
64
- return target;
65
- }
66
- var UserForm = function(param) {
67
- var _param_defaultValues = param.defaultValues, defaultValues = _param_defaultValues === void 0 ? {} : _param_defaultValues, onSubmit = param.onSubmit, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, hasPermission = param.hasPermission;
68
- var t = useTranslation([
69
- 'Design',
70
- 'User',
71
- 'Validation'
72
- ]).t;
73
- var _useForm = useForm({
74
- defaultValues: defaultValues
75
- }), control = _useForm.control, register = _useForm.register, handleSubmit = _useForm.handleSubmit, errors = _useForm.formState.errors;
76
- var rolesOptions = [
77
- {
78
- value: MANAGER_ROLE,
79
- label: t('Design:manager'),
80
- description: t('Design:managerAccessMessage'),
81
- component: /*#__PURE__*/ jsx(SvgManagerRole, {})
82
- },
83
- {
84
- value: SUBMANAGER_ROLE,
85
- label: t('Design:subManager'),
86
- description: t('Design:subManagerAccessMessage'),
87
- component: /*#__PURE__*/ jsx(SvgSubManagerRole, {})
88
- },
89
- {
90
- value: VIEWER_ROLE,
91
- label: t('Design:viewer'),
92
- description: t('Design:viewerAccessMessage'),
93
- component: /*#__PURE__*/ jsx(SvgViewerRole, {})
94
- }
95
- ];
96
- return /* @ts-expect-error 2345 */ /*#__PURE__*/ jsxs(Form, {
97
- className: "company-user-form",
98
- onSubmit: handleSubmit(onSubmit),
99
- children: [
100
- /*#__PURE__*/ jsx(Row, {
101
- children: /*#__PURE__*/ jsx(Col, {
102
- xl: 6,
103
- lg: 6,
104
- sm: 12,
105
- children: /*#__PURE__*/ jsxs(Form.Group, {
106
- children: [
107
- /*#__PURE__*/ jsxs(Form.Label, {
108
- children: [
109
- t('User:email'),
110
- "*"
111
- ]
112
- }),
113
- /*#__PURE__*/ jsx(Form.Control, _object_spread_props(_object_spread({
114
- isInvalid: !!errors.email
115
- }, register('email', {
116
- pattern: emailRule,
117
- required: true
118
- })), {
119
- disabled: isLoading || Boolean(defaultValues.email)
120
- })),
121
- /*#__PURE__*/ jsxs(Form.Control.Feedback, {
122
- type: "invalid",
123
- children: [
124
- HookFormService.hasError(errors.email, 'required') && t('Validation:fieldRequired', {
125
- attribute: t('User:email')
126
- }),
127
- HookFormService.hasError(errors.email, 'pattern') && t('Validation:fieldValidEmail', {
128
- attribute: t('User:email')
129
- })
130
- ]
131
- })
132
- ]
133
- })
134
- })
135
- }),
136
- /*#__PURE__*/ jsx(Row, {
137
- children: /*#__PURE__*/ jsx(Col, {
138
- children: /*#__PURE__*/ jsx(Controller, {
139
- render: function(param) {
140
- var _param_field = param.field, onChange = _param_field.onChange, fieldValue = _param_field.value, error = param.fieldState.error;
141
- return /*#__PURE__*/ jsxs(Form.Group, {
142
- className: clsx('roles-form-group', !!error && 'is-invalid'),
143
- children: [
144
- /*#__PURE__*/ jsxs(Form.Label, {
145
- children: [
146
- t('User:role'),
147
- "*"
148
- ]
149
- }),
150
- /*#__PURE__*/ jsx("div", {
151
- className: "roles-wrapper",
152
- children: rolesOptions.map(function(param) {
153
- var value = param.value, label = param.label, description = param.description, component = param.component;
154
- return /*#__PURE__*/ jsxs("button", {
155
- onClick: function() {
156
- return onChange(value);
157
- },
158
- className: clsx('role', {
159
- active: fieldValue === value
160
- }),
161
- type: "button",
162
- children: [
163
- /*#__PURE__*/ jsx(Logo, {
164
- logo: component
165
- }),
166
- /*#__PURE__*/ jsx("p", {
167
- className: "label",
168
- children: label
169
- }),
170
- /*#__PURE__*/ jsx("p", {
171
- className: "description",
172
- children: description
173
- })
174
- ]
175
- }, value);
176
- })
177
- }),
178
- /*#__PURE__*/ jsx(Form.Control.Feedback, {
179
- type: "invalid",
180
- children: error === null || error === void 0 ? void 0 : error.message
181
- })
182
- ]
183
- });
184
- },
185
- control: control,
186
- name: "role",
187
- rules: {
188
- required: t('Validation:fieldRequired', {
189
- fieldName: t('User:role')
190
- })
191
- }
192
- })
193
- })
194
- }),
195
- hasPermission && /*#__PURE__*/ jsx(Button, {
196
- type: "submit",
197
- size: "lg",
198
- disabled: isLoading,
199
- children: defaultValues.email ? t('User:submit') : t('Design:addUser')
200
- })
201
- ]
202
- });
203
- };
204
-
205
- export { UserForm };
@@ -1,2 +0,0 @@
1
- export * from './UserForm';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/company/user-form/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -1 +0,0 @@
1
- export * from './user-form'
@@ -1,18 +0,0 @@
1
- import { Meta, Story } from '@storybook/react'
2
- import { UserForm, UserFormProps } from './UserForm'
3
-
4
- export default {
5
- title: 'Provider/Company/User form',
6
- component: UserForm,
7
- } as Meta
8
-
9
- export const Default: Story<UserFormProps> = (args) => {
10
- return <UserForm {...args} />
11
- }
12
-
13
- Default.args = {
14
- onSubmit: (values) => console.log(values),
15
- isLoading: false,
16
- defaultValues: {},
17
- hasPermission: true,
18
- }
@@ -1,151 +0,0 @@
1
- import { Button, Col, Form, Row } from 'react-bootstrap'
2
- import { useForm, Controller } from 'react-hook-form'
3
- import { useTranslation } from 'react-i18next'
4
- import clsx from 'clsx'
5
- import { User } from '@licklist/core/dist/DataMapper/User/UserDataMapper'
6
- import {
7
- VIEWER_ROLE,
8
- MANAGER_ROLE,
9
- SUBMANAGER_ROLE,
10
- } from '@licklist/core/dist/DataMapper/User/UserRoleDataMapper'
11
- import emailRule from '@licklist/plugins/dist/validation/Rules/emailRule'
12
- import HookFormService from '@licklist/plugins/dist/services/Form/HookFormService'
13
- import Logo from '../../../logo/Logo'
14
- import { ReactComponent as ManagerRoleImg } from '../../../assets/dashboard/managerRole.svg'
15
- import { ReactComponent as SubManagerRoleImg } from '../../../assets/dashboard/subManagerRole.svg'
16
- import { ReactComponent as ViewerRoleImg } from '../../../assets/dashboard/viewerRole.svg'
17
-
18
- export type UserFormValues = {
19
- email?: User['email']
20
- role?: typeof VIEWER_ROLE | typeof MANAGER_ROLE | typeof SUBMANAGER_ROLE
21
- }
22
-
23
- export type UserFormProps = {
24
- defaultValues?: UserFormValues
25
- onSubmit: (values: {
26
- email: User['email']
27
- role: typeof VIEWER_ROLE | typeof MANAGER_ROLE | typeof SUBMANAGER_ROLE
28
- }) => void
29
- isLoading?: boolean
30
- hasPermission: boolean
31
- }
32
-
33
- export const UserForm = ({
34
- defaultValues = {},
35
- onSubmit,
36
- isLoading = false,
37
- hasPermission,
38
- }: UserFormProps) => {
39
- const { t } = useTranslation(['Design', 'User', 'Validation'])
40
- const {
41
- control,
42
- register,
43
- handleSubmit,
44
- formState: { errors },
45
- } = useForm<UserFormValues>({
46
- defaultValues,
47
- })
48
-
49
- const rolesOptions = [
50
- {
51
- value: MANAGER_ROLE,
52
- label: t('Design:manager'),
53
- description: t('Design:managerAccessMessage'),
54
- component: <ManagerRoleImg />,
55
- },
56
- {
57
- value: SUBMANAGER_ROLE,
58
- label: t('Design:subManager'),
59
- description: t('Design:subManagerAccessMessage'),
60
- component: <SubManagerRoleImg />,
61
- },
62
- {
63
- value: VIEWER_ROLE,
64
- label: t('Design:viewer'),
65
- description: t('Design:viewerAccessMessage'),
66
- component: <ViewerRoleImg />,
67
- },
68
- ]
69
-
70
- return (
71
- /* @ts-expect-error 2345 */
72
- <Form className='company-user-form' onSubmit={handleSubmit(onSubmit)}>
73
- <Row>
74
- <Col xl={6} lg={6} sm={12}>
75
- <Form.Group>
76
- <Form.Label>{t('User:email')}*</Form.Label>
77
- <Form.Control
78
- isInvalid={!!errors.email}
79
- {...register('email', {
80
- pattern: emailRule,
81
- required: true,
82
- })}
83
- disabled={isLoading || Boolean(defaultValues.email)}
84
- />
85
-
86
- <Form.Control.Feedback type='invalid'>
87
- {HookFormService.hasError(errors.email, 'required') &&
88
- t('Validation:fieldRequired', {
89
- attribute: t('User:email'),
90
- })}
91
- {HookFormService.hasError(errors.email, 'pattern') &&
92
- t('Validation:fieldValidEmail', {
93
- attribute: t('User:email'),
94
- })}
95
- </Form.Control.Feedback>
96
- </Form.Group>
97
- </Col>
98
- </Row>
99
-
100
- <Row>
101
- <Col>
102
- <Controller
103
- render={({
104
- field: { onChange, value: fieldValue },
105
- fieldState: { error },
106
- }) => (
107
- <Form.Group
108
- className={clsx('roles-form-group', !!error && 'is-invalid')}
109
- >
110
- <Form.Label>{t('User:role')}*</Form.Label>
111
- <div className='roles-wrapper'>
112
- {rolesOptions.map(
113
- ({ value, label, description, component }) => (
114
- <button
115
- key={value}
116
- onClick={() => onChange(value)}
117
- className={clsx('role', {
118
- active: fieldValue === value,
119
- })}
120
- type='button'
121
- >
122
- <Logo logo={component} />
123
- <p className='label'>{label}</p>
124
- <p className='description'>{description}</p>
125
- </button>
126
- ),
127
- )}
128
- </div>
129
- <Form.Control.Feedback type='invalid'>
130
- {error?.message}
131
- </Form.Control.Feedback>
132
- </Form.Group>
133
- )}
134
- control={control}
135
- name='role'
136
- rules={{
137
- required: t('Validation:fieldRequired', {
138
- fieldName: t('User:role'),
139
- }) as string,
140
- }}
141
- />
142
- </Col>
143
- </Row>
144
- {hasPermission && (
145
- <Button type='submit' size='lg' disabled={isLoading}>
146
- {defaultValues.email ? t('User:submit') : t('Design:addUser')}
147
- </Button>
148
- )}
149
- </Form>
150
- )
151
- }
@@ -1 +0,0 @@
1
- export * from './UserForm'