@omniumretail/component-library 1.0.74 → 1.0.76
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.
- package/.storybook/main.js +16 -16
- package/.storybook/preview-head.html +20 -20
- package/.storybook/preview.js +27 -27
- package/NPMPUBLISH.md +29 -29
- package/README.md +54 -54
- package/bitbucket-pipelines.yml +94 -94
- package/dist/bundle.js +247 -291
- package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -5
- package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/AnalyticsBar/index.d.ts +2 -2
- package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -12
- package/dist/types/components/Button/Button.stories.d.ts +6 -6
- package/dist/types/components/Button/index.d.ts +7 -7
- package/dist/types/components/Category/Category.stories.d.ts +4 -4
- package/dist/types/components/Category/CategoryContent/index.d.ts +7 -7
- package/dist/types/components/Category/CategorySidebar/index.d.ts +26 -26
- package/dist/types/components/Category/index.d.ts +7 -7
- package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +4 -4
- package/dist/types/components/CategoryReadOnly/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryReadOnly/index.d.ts +9 -9
- package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -4
- package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryResponse/index.d.ts +9 -9
- package/dist/types/components/DatePicker/DatePicker.stories.d.ts +5 -5
- package/dist/types/components/DatePicker/index.d.ts +8 -8
- package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -5
- package/dist/types/components/DatePickerTag/index.d.ts +6 -6
- package/dist/types/components/Footer/Footer.stories.d.ts +5 -5
- package/dist/types/components/Footer/index.d.ts +4 -4
- package/dist/types/components/Input/Input.stories.d.ts +5 -5
- package/dist/types/components/Input/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +5 -5
- package/dist/types/components/Label/Label.stories.d.ts +6 -6
- package/dist/types/components/Label/index.d.ts +7 -7
- package/dist/types/components/Link/Link.stories.d.ts +7 -7
- package/dist/types/components/Link/index.d.ts +7 -7
- package/dist/types/components/Menu/Menu.stories.d.ts +5 -5
- package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/Menu/index.d.ts +3 -2
- package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/ModalStatusList.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/index.d.ts +9 -9
- package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +5 -5
- package/dist/types/components/ModalWithTable/index.d.ts +13 -13
- package/dist/types/components/Navigation/Navigation.stories.d.ts +5 -5
- package/dist/types/components/Navigation/index.d.ts +10 -10
- package/dist/types/components/Notification/Notification.stories.d.ts +5 -5
- package/dist/types/components/Notification/index.d.ts +9 -9
- package/dist/types/components/Questions/Questions.stories.d.ts +4 -4
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -1
- package/dist/types/components/Questions/index.d.ts +5 -5
- package/dist/types/components/Radio/Radio.stories.d.ts +5 -5
- package/dist/types/components/Radio/index.d.ts +10 -10
- package/dist/types/components/Select/Select.stories.d.ts +6 -6
- package/dist/types/components/Select/index.d.ts +5 -5
- package/dist/types/components/Separator/Separator.stories.d.ts +6 -6
- package/dist/types/components/Separator/index.d.ts +11 -11
- package/dist/types/components/Sidebar/Sidebar.stories.d.ts +6 -6
- package/dist/types/components/Sidebar/index.d.ts +15 -15
- package/dist/types/components/Switch/Switch.stories.d.ts +5 -5
- package/dist/types/components/Switch/index.d.ts +2 -2
- package/dist/types/components/Table/Table.stories.d.ts +9 -9
- package/dist/types/components/Table/index.d.ts +37 -37
- package/dist/types/components/Tag/Tag.stories.d.ts +5 -5
- package/dist/types/components/Tag/index.d.ts +8 -8
- package/dist/types/components/Upload/Upload.stories.d.ts +4 -4
- package/dist/types/components/Upload/index.d.ts +8 -8
- package/dist/types/components/UserInfo/UserInfo.stories.d.ts +4 -4
- package/dist/types/components/UserInfo/index.d.ts +8 -8
- package/dist/types/components/index.d.ts +25 -25
- package/dist/types/constants/i18n.d.ts +1 -1
- package/dist/types/constants/translationHelper.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +198 -198
- package/src/assets/scss/_global.scss +89 -89
- package/src/assets/scss/index.scss +2 -2
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +236 -236
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -19
- package/src/components/AnalyticsBar/index.tsx +76 -76
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -13
- package/src/components/AnalyticsBar/styles.module.scss +108 -108
- package/src/components/Button/Button.stories.tsx +26 -26
- package/src/components/Button/index.tsx +24 -24
- package/src/components/Button/styles.module.scss +65 -65
- package/src/components/Category/Category.stories.tsx +88 -88
- package/src/components/Category/CategoryContent/index.tsx +188 -188
- package/src/components/Category/CategoryContent/styles.module.scss +51 -51
- package/src/components/Category/CategorySidebar/index.tsx +268 -268
- package/src/components/Category/CategorySidebar/styles.module.scss +28 -28
- package/src/components/Category/index.tsx +76 -76
- package/src/components/Category/styles.module.scss +13 -13
- package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +270 -270
- package/src/components/CategoryReadOnly/evaluationOptions.tsx +81 -81
- package/src/components/CategoryReadOnly/index.tsx +254 -254
- package/src/components/CategoryReadOnly/styles.module.scss +184 -184
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +251 -251
- package/src/components/CategoryResponse/evaluationOptions.tsx +81 -81
- package/src/components/CategoryResponse/index.tsx +277 -277
- package/src/components/CategoryResponse/styles.module.scss +180 -180
- package/src/components/DatePicker/DatePicker.stories.tsx +16 -16
- package/src/components/DatePicker/index.tsx +38 -38
- package/src/components/DatePicker/styles.module.scss +3 -3
- package/src/components/DatePickerTag/DatePickerTag.stories.tsx +19 -19
- package/src/components/DatePickerTag/index.tsx +89 -89
- package/src/components/DatePickerTag/styles.module.scss +31 -31
- package/src/components/Footer/Footer.stories.tsx +14 -14
- package/src/components/Footer/index.tsx +38 -38
- package/src/components/Footer/styles.module.scss +38 -38
- package/src/components/Input/Input.stories.tsx +13 -13
- package/src/components/Input/index.tsx +31 -31
- package/src/components/Input/styles.module.scss +8 -8
- package/src/components/InputCountryCode/index.tsx +75 -75
- package/src/components/InputCountryCode/inputCountryCode.stories.tsx +55 -55
- package/src/components/InputCountryCode/styles.module.scss +3 -3
- package/src/components/Label/Label.stories.tsx +21 -21
- package/src/components/Label/index.tsx +19 -19
- package/src/components/Label/styles.module.scss +16 -16
- package/src/components/Link/Link.stories.tsx +30 -30
- package/src/components/Link/index.tsx +21 -21
- package/src/components/Link/styles.module.scss +24 -24
- package/src/components/Menu/Menu.stories.tsx +178 -178
- package/src/components/Menu/helpers/codeMutation.tsx +19 -19
- package/src/components/Menu/index.tsx +23 -23
- package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +40 -40
- package/src/components/ModalConfirmation/ModalStatusList.tsx +5 -5
- package/src/components/ModalConfirmation/index.tsx +70 -70
- package/src/components/ModalConfirmation/styles.module.scss +62 -62
- package/src/components/ModalWithTable/ModalWithTable.stories.tsx +96 -96
- package/src/components/ModalWithTable/index.tsx +232 -232
- package/src/components/ModalWithTable/styles.module.scss +77 -77
- package/src/components/Navigation/Navigation.stories.tsx +17 -17
- package/src/components/Navigation/index.tsx +33 -33
- package/src/components/Navigation/styles.module.scss +59 -59
- package/src/components/Notification/Notification.stories.tsx +29 -29
- package/src/components/Notification/index.tsx +21 -21
- package/src/components/Questions/Questions.stories.tsx +37 -37
- package/src/components/Questions/SingleQuestion/index.tsx +84 -84
- package/src/components/Questions/SingleQuestion/styles.module.scss +81 -81
- package/src/components/Questions/index.tsx +78 -78
- package/src/components/Radio/Radio.stories.tsx +43 -43
- package/src/components/Radio/index.tsx +26 -26
- package/src/components/Radio/styles.module.scss +23 -23
- package/src/components/Select/Select.stories.tsx +39 -39
- package/src/components/Select/index.tsx +27 -27
- package/src/components/Select/styles.module.scss +13 -13
- package/src/components/Separator/Separator.stories.tsx +22 -22
- package/src/components/Separator/index.tsx +27 -27
- package/src/components/Separator/styles.module.scss +25 -25
- package/src/components/Sidebar/Sidebar.stories.tsx +85 -85
- package/src/components/Sidebar/index.tsx +103 -103
- package/src/components/Sidebar/styles.module.scss +85 -85
- package/src/components/Switch/Switch.stories.tsx +14 -14
- package/src/components/Switch/index.tsx +8 -8
- package/src/components/Switch/styles.module.scss +7 -7
- package/src/components/Table/Table.stories.tsx +222 -222
- package/src/components/Table/index.tsx +279 -275
- package/src/components/Table/styles.module.scss +75 -75
- package/src/components/Tag/Tag.stories.tsx +22 -22
- package/src/components/Tag/index.tsx +189 -189
- package/src/components/Tag/styles.module.scss +60 -60
- package/src/components/Upload/Upload.stories.tsx +45 -45
- package/src/components/Upload/index.tsx +91 -91
- package/src/components/UserInfo/UserInfo.stories.tsx +38 -37
- package/src/components/UserInfo/index.tsx +77 -62
- package/src/components/UserInfo/styles.module.scss +30 -29
- package/src/components/index.tsx +25 -25
- package/src/constants/i18n.ts +25 -25
- package/src/constants/translationHelper.ts +7 -7
- package/src/index.ts +2 -2
- package/src/locales/en.json +86 -86
- package/src/locales/es.json +86 -86
- package/src/locales/pt.json +86 -86
- package/src/types/Global.d.ts +4 -4
- package/tsconfig.json +29 -29
- package/webpack.config.js +51 -51
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
$actionsSpace: 90px;
|
|
2
|
-
$questionAndInformationGap: 20px;
|
|
3
|
-
|
|
4
|
-
.dragItem {
|
|
5
|
-
:global {
|
|
6
|
-
.ant-form-item {
|
|
7
|
-
margin-bottom: 0;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.ant-space {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
gap: 12px;
|
|
14
|
-
border-bottom: 1px solid var(--color-blue);
|
|
15
|
-
padding: 16px 10px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.ant-space-item {
|
|
19
|
-
width: 100%;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.label {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.question {
|
|
29
|
-
display: grid;
|
|
30
|
-
grid-template-columns: minmax(18px, auto) 1fr $actionsSpace;
|
|
31
|
-
gap: $questionAndInformationGap;
|
|
32
|
-
color: var(--color-black);
|
|
33
|
-
font-size: var(--font-size-body-4);
|
|
34
|
-
line-height: 100%;
|
|
35
|
-
font-weight: var(--font-weight-medium);
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.information {
|
|
40
|
-
display: grid;
|
|
41
|
-
grid-template-columns: minmax(18px, auto) 1fr $actionsSpace;
|
|
42
|
-
gap: $questionAndInformationGap;
|
|
43
|
-
color: var(--color-grey-dark);
|
|
44
|
-
font-size: var(--font-size-body-3);
|
|
45
|
-
align-items: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.input {
|
|
49
|
-
display: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.actions {
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
justify-content: flex-start;
|
|
56
|
-
gap: 20px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.notEditing {
|
|
60
|
-
display: none;
|
|
61
|
-
align-items: center;
|
|
62
|
-
justify-content: center;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.editing {
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
gap: 16px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.drag,
|
|
73
|
-
.edit,
|
|
74
|
-
.delete {
|
|
75
|
-
font-size: var(--font-size-body-5);
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.addQuestion {
|
|
80
|
-
margin-top: 24px;
|
|
81
|
-
}
|
|
1
|
+
$actionsSpace: 90px;
|
|
2
|
+
$questionAndInformationGap: 20px;
|
|
3
|
+
|
|
4
|
+
.dragItem {
|
|
5
|
+
:global {
|
|
6
|
+
.ant-form-item {
|
|
7
|
+
margin-bottom: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ant-space {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 12px;
|
|
14
|
+
border-bottom: 1px solid var(--color-blue);
|
|
15
|
+
padding: 16px 10px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ant-space-item {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.label {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.question {
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-columns: minmax(18px, auto) 1fr $actionsSpace;
|
|
31
|
+
gap: $questionAndInformationGap;
|
|
32
|
+
color: var(--color-black);
|
|
33
|
+
font-size: var(--font-size-body-4);
|
|
34
|
+
line-height: 100%;
|
|
35
|
+
font-weight: var(--font-weight-medium);
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.information {
|
|
40
|
+
display: grid;
|
|
41
|
+
grid-template-columns: minmax(18px, auto) 1fr $actionsSpace;
|
|
42
|
+
gap: $questionAndInformationGap;
|
|
43
|
+
color: var(--color-grey-dark);
|
|
44
|
+
font-size: var(--font-size-body-3);
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.input {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.actions {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
gap: 20px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.notEditing {
|
|
60
|
+
display: none;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.editing {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
gap: 16px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.drag,
|
|
73
|
+
.edit,
|
|
74
|
+
.delete {
|
|
75
|
+
font-size: var(--font-size-body-5);
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.addQuestion {
|
|
80
|
+
margin-top: 24px;
|
|
81
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { PlusOutlined } from '@ant-design/icons';
|
|
3
|
-
import { Form } from 'antd';
|
|
4
|
-
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
|
5
|
-
import { SingleQuestion } from "./SingleQuestion";
|
|
6
|
-
import { Link } from '../Link';
|
|
7
|
-
import { FieldContext } from 'rc-field-form';
|
|
8
|
-
import { t } from 'i18next';
|
|
9
|
-
|
|
10
|
-
export interface QuestionsProps {
|
|
11
|
-
showGrade?: boolean;
|
|
12
|
-
handleChanges: any;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const Questions = (props: QuestionsProps) => {
|
|
16
|
-
const {
|
|
17
|
-
showGrade = true,
|
|
18
|
-
handleChanges,
|
|
19
|
-
} = props;
|
|
20
|
-
|
|
21
|
-
const formContext = useContext(FieldContext);
|
|
22
|
-
|
|
23
|
-
const items = Form.useWatch('questions');
|
|
24
|
-
const onDragEnd = (result: any) => {
|
|
25
|
-
const newItems: any = items;
|
|
26
|
-
const [removed] = newItems.splice(result.source.index, 1);
|
|
27
|
-
newItems.splice(result.destination.index, 0, removed);
|
|
28
|
-
formContext.setFieldValue('questions', newItems);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Form.List name="questions">
|
|
33
|
-
{(fields, { add, remove }) => {
|
|
34
|
-
const fieldsUpdated = fields.map((field, index) => {
|
|
35
|
-
return field = { ...field, name: index, key: index, fieldKey: index };
|
|
36
|
-
})
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
<DragDropContext onDragEnd={onDragEnd}>
|
|
40
|
-
<Droppable droppableId="droppable">
|
|
41
|
-
{(provided) => (
|
|
42
|
-
<div {...provided.droppableProps} ref={provided.innerRef}>
|
|
43
|
-
<>
|
|
44
|
-
{fieldsUpdated.map(({ key, name, ...restField }) => {
|
|
45
|
-
return (
|
|
46
|
-
<Draggable key={key} draggableId={`${key}`} index={key}>
|
|
47
|
-
{(provided, snapshot) => (
|
|
48
|
-
<>
|
|
49
|
-
<SingleQuestion
|
|
50
|
-
provided={provided}
|
|
51
|
-
snapshot={snapshot}
|
|
52
|
-
item={name}
|
|
53
|
-
{...restField}
|
|
54
|
-
remove={remove}
|
|
55
|
-
name={name}
|
|
56
|
-
showGrade={showGrade}
|
|
57
|
-
handleChanges={handleChanges}
|
|
58
|
-
/>
|
|
59
|
-
</>
|
|
60
|
-
)}
|
|
61
|
-
</Draggable>
|
|
62
|
-
)
|
|
63
|
-
})}
|
|
64
|
-
</>
|
|
65
|
-
{provided.placeholder}
|
|
66
|
-
</div>
|
|
67
|
-
)}
|
|
68
|
-
</Droppable>
|
|
69
|
-
</DragDropContext>
|
|
70
|
-
<Form.Item>
|
|
71
|
-
<Link icon={<PlusOutlined />} onClick={() => add()}> { t('components.category.addQuestion') }</Link>
|
|
72
|
-
</Form.Item>
|
|
73
|
-
</>
|
|
74
|
-
)
|
|
75
|
-
}}
|
|
76
|
-
</Form.List>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Form } from 'antd';
|
|
4
|
+
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
|
5
|
+
import { SingleQuestion } from "./SingleQuestion";
|
|
6
|
+
import { Link } from '../Link';
|
|
7
|
+
import { FieldContext } from 'rc-field-form';
|
|
8
|
+
import { t } from 'i18next';
|
|
9
|
+
|
|
10
|
+
export interface QuestionsProps {
|
|
11
|
+
showGrade?: boolean;
|
|
12
|
+
handleChanges: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Questions = (props: QuestionsProps) => {
|
|
16
|
+
const {
|
|
17
|
+
showGrade = true,
|
|
18
|
+
handleChanges,
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const formContext = useContext(FieldContext);
|
|
22
|
+
|
|
23
|
+
const items = Form.useWatch('questions');
|
|
24
|
+
const onDragEnd = (result: any) => {
|
|
25
|
+
const newItems: any = items;
|
|
26
|
+
const [removed] = newItems.splice(result.source.index, 1);
|
|
27
|
+
newItems.splice(result.destination.index, 0, removed);
|
|
28
|
+
formContext.setFieldValue('questions', newItems);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Form.List name="questions">
|
|
33
|
+
{(fields, { add, remove }) => {
|
|
34
|
+
const fieldsUpdated = fields.map((field, index) => {
|
|
35
|
+
return field = { ...field, name: index, key: index, fieldKey: index };
|
|
36
|
+
})
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<DragDropContext onDragEnd={onDragEnd}>
|
|
40
|
+
<Droppable droppableId="droppable">
|
|
41
|
+
{(provided) => (
|
|
42
|
+
<div {...provided.droppableProps} ref={provided.innerRef}>
|
|
43
|
+
<>
|
|
44
|
+
{fieldsUpdated.map(({ key, name, ...restField }) => {
|
|
45
|
+
return (
|
|
46
|
+
<Draggable key={key} draggableId={`${key}`} index={key}>
|
|
47
|
+
{(provided, snapshot) => (
|
|
48
|
+
<>
|
|
49
|
+
<SingleQuestion
|
|
50
|
+
provided={provided}
|
|
51
|
+
snapshot={snapshot}
|
|
52
|
+
item={name}
|
|
53
|
+
{...restField}
|
|
54
|
+
remove={remove}
|
|
55
|
+
name={name}
|
|
56
|
+
showGrade={showGrade}
|
|
57
|
+
handleChanges={handleChanges}
|
|
58
|
+
/>
|
|
59
|
+
</>
|
|
60
|
+
)}
|
|
61
|
+
</Draggable>
|
|
62
|
+
)
|
|
63
|
+
})}
|
|
64
|
+
</>
|
|
65
|
+
{provided.placeholder}
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</Droppable>
|
|
69
|
+
</DragDropContext>
|
|
70
|
+
<Form.Item>
|
|
71
|
+
<Link icon={<PlusOutlined />} onClick={() => add()}> { t('components.category.addQuestion') }</Link>
|
|
72
|
+
</Form.Item>
|
|
73
|
+
</>
|
|
74
|
+
)
|
|
75
|
+
}}
|
|
76
|
+
</Form.List>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { Radio as RadioAntd, RadioChangeEvent, RadioProps } from "antd";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { Radio, RadioGroup } from '.';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Radio',
|
|
8
|
-
component: Radio,
|
|
9
|
-
} as Meta;
|
|
10
|
-
|
|
11
|
-
const Template: Story<RadioProps> = (args) => {
|
|
12
|
-
const [value, setValue] = useState();
|
|
13
|
-
|
|
14
|
-
const onChange = (e: RadioChangeEvent) => {
|
|
15
|
-
console.log('radio checked', e.target.value);
|
|
16
|
-
setValue(e.target.value);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div>
|
|
21
|
-
<RadioAntd.Group onChange={onChange} value={value} defaultValue={3}>
|
|
22
|
-
<Radio {...args} value={1}></Radio>
|
|
23
|
-
<Radio {...args} value={2}></Radio>
|
|
24
|
-
<Radio {...args} value={3}></Radio>
|
|
25
|
-
<Radio {...args} value={4}></Radio>
|
|
26
|
-
</RadioAntd.Group>
|
|
27
|
-
|
|
28
|
-
<RadioGroup
|
|
29
|
-
options={[
|
|
30
|
-
{ label: 'Option 1', value: '1' },
|
|
31
|
-
{ label: 'Option 2', value: '2' },
|
|
32
|
-
{ label: 'Option 3', value: '3' },
|
|
33
|
-
]}
|
|
34
|
-
onChange={onChange}
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
)
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const Primary = Template.bind({});
|
|
42
|
-
Primary.args = {
|
|
43
|
-
};
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Radio as RadioAntd, RadioChangeEvent, RadioProps } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Radio, RadioGroup } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Radio',
|
|
8
|
+
component: Radio,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const Template: Story<RadioProps> = (args) => {
|
|
12
|
+
const [value, setValue] = useState();
|
|
13
|
+
|
|
14
|
+
const onChange = (e: RadioChangeEvent) => {
|
|
15
|
+
console.log('radio checked', e.target.value);
|
|
16
|
+
setValue(e.target.value);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div>
|
|
21
|
+
<RadioAntd.Group onChange={onChange} value={value} defaultValue={3}>
|
|
22
|
+
<Radio {...args} value={1}></Radio>
|
|
23
|
+
<Radio {...args} value={2}></Radio>
|
|
24
|
+
<Radio {...args} value={3}></Radio>
|
|
25
|
+
<Radio {...args} value={4}></Radio>
|
|
26
|
+
</RadioAntd.Group>
|
|
27
|
+
|
|
28
|
+
<RadioGroup
|
|
29
|
+
options={[
|
|
30
|
+
{ label: 'Option 1', value: '1' },
|
|
31
|
+
{ label: 'Option 2', value: '2' },
|
|
32
|
+
{ label: 'Option 3', value: '3' },
|
|
33
|
+
]}
|
|
34
|
+
onChange={onChange}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
)
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Primary = Template.bind({});
|
|
42
|
+
Primary.args = {
|
|
43
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Radio as RadioAntd } from 'antd';
|
|
2
|
-
import type { RadioProps } from 'antd';
|
|
3
|
-
import type { RadioGroupProps } from 'antd/lib/radio';
|
|
4
|
-
import styles from './styles.module.scss';
|
|
5
|
-
|
|
6
|
-
export const Radio = ({...radioProps }: RadioProps) => {
|
|
7
|
-
return (
|
|
8
|
-
<RadioAntd className={styles.radio} {...radioProps} />
|
|
9
|
-
)
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export interface CustomRadioGroupProps extends RadioGroupProps {
|
|
13
|
-
options: { label: string; value: string }[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const RadioGroup = ({ options, ...radioGroupProps }: CustomRadioGroupProps) => {
|
|
17
|
-
return (
|
|
18
|
-
<RadioAntd.Group {...radioGroupProps}>
|
|
19
|
-
{options.map((option) => (
|
|
20
|
-
<Radio key={option.value} value={option.value}>
|
|
21
|
-
{option.label}
|
|
22
|
-
</Radio>
|
|
23
|
-
))}
|
|
24
|
-
</RadioAntd.Group>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
1
|
+
import { Radio as RadioAntd } from 'antd';
|
|
2
|
+
import type { RadioProps } from 'antd';
|
|
3
|
+
import type { RadioGroupProps } from 'antd/lib/radio';
|
|
4
|
+
import styles from './styles.module.scss';
|
|
5
|
+
|
|
6
|
+
export const Radio = ({...radioProps }: RadioProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<RadioAntd className={styles.radio} {...radioProps} />
|
|
9
|
+
)
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface CustomRadioGroupProps extends RadioGroupProps {
|
|
13
|
+
options: { label: string; value: string }[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const RadioGroup = ({ options, ...radioGroupProps }: CustomRadioGroupProps) => {
|
|
17
|
+
return (
|
|
18
|
+
<RadioAntd.Group {...radioGroupProps}>
|
|
19
|
+
{options.map((option) => (
|
|
20
|
+
<Radio key={option.value} value={option.value}>
|
|
21
|
+
{option.label}
|
|
22
|
+
</Radio>
|
|
23
|
+
))}
|
|
24
|
+
</RadioAntd.Group>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
.radio {
|
|
2
|
-
:global {
|
|
3
|
-
.ant-radio-checked .ant-radio-inner{
|
|
4
|
-
border-color: var(--color-black);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.ant-radio-checked .ant-radio-inner:after{
|
|
8
|
-
background-color: var(--color-black);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.ant-radio-checked:hover .ant-radio-inner:after{
|
|
12
|
-
background-color: var(--color-orange);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.ant-radio:hover .ant-radio-inner {
|
|
16
|
-
border-color: var(--color-orange);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
font-weight: var(--font-weight-medium);
|
|
21
|
-
font-size: var(--font-size-body-3);
|
|
22
|
-
margin-right: 44px;
|
|
23
|
-
margin-top: 18px;
|
|
1
|
+
.radio {
|
|
2
|
+
:global {
|
|
3
|
+
.ant-radio-checked .ant-radio-inner{
|
|
4
|
+
border-color: var(--color-black);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ant-radio-checked .ant-radio-inner:after{
|
|
8
|
+
background-color: var(--color-black);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ant-radio-checked:hover .ant-radio-inner:after{
|
|
12
|
+
background-color: var(--color-orange);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ant-radio:hover .ant-radio-inner {
|
|
16
|
+
border-color: var(--color-orange);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
font-weight: var(--font-weight-medium);
|
|
21
|
+
font-size: var(--font-size-body-3);
|
|
22
|
+
margin-right: 44px;
|
|
23
|
+
margin-top: 18px;
|
|
24
24
|
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { Select } from '.';
|
|
3
|
-
import { SelectProps } from 'antd';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Select',
|
|
7
|
-
component: Select,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: Story<SelectProps> = (args) => <Select {...args}></Select>;
|
|
11
|
-
|
|
12
|
-
export const Primary = Template.bind({});
|
|
13
|
-
Primary.args = {
|
|
14
|
-
defaultValue: 'something',
|
|
15
|
-
options: [
|
|
16
|
-
{
|
|
17
|
-
value: 'lucy',
|
|
18
|
-
label: 'Lucy',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
value: 'Yiminghe',
|
|
22
|
-
label: 'yiminghe',
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const noArguments = Template.bind({});
|
|
28
|
-
noArguments.args = {
|
|
29
|
-
options: [
|
|
30
|
-
{
|
|
31
|
-
value: 'lucy',
|
|
32
|
-
label: 'Lucy',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
value: 'Yiminghe',
|
|
36
|
-
label: 'yiminghe',
|
|
37
|
-
},
|
|
38
|
-
]
|
|
39
|
-
};
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Select } from '.';
|
|
3
|
+
import { SelectProps } from 'antd';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Select',
|
|
7
|
+
component: Select,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<SelectProps> = (args) => <Select {...args}></Select>;
|
|
11
|
+
|
|
12
|
+
export const Primary = Template.bind({});
|
|
13
|
+
Primary.args = {
|
|
14
|
+
defaultValue: 'something',
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
value: 'lucy',
|
|
18
|
+
label: 'Lucy',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: 'Yiminghe',
|
|
22
|
+
label: 'yiminghe',
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const noArguments = Template.bind({});
|
|
28
|
+
noArguments.args = {
|
|
29
|
+
options: [
|
|
30
|
+
{
|
|
31
|
+
value: 'lucy',
|
|
32
|
+
label: 'Lucy',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 'Yiminghe',
|
|
36
|
+
label: 'yiminghe',
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import { Select as AntdSelect, SelectProps as AntdSelectProps } from 'antd';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
export interface SelectProps extends AntdSelectProps {
|
|
6
|
-
customClass?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Select = ({customClass, ...props}: SelectProps) => {
|
|
10
|
-
const { defaultValue, options } = props;
|
|
11
|
-
|
|
12
|
-
const selectClasses = {
|
|
13
|
-
[styles.select]: true,
|
|
14
|
-
[`${customClass}`]: customClass,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
(options || defaultValue) &&
|
|
19
|
-
<AntdSelect
|
|
20
|
-
className={ classNames(selectClasses) }
|
|
21
|
-
defaultValue={defaultValue}
|
|
22
|
-
style={{ minWidth: 180 }}
|
|
23
|
-
options={options}
|
|
24
|
-
{...props}
|
|
25
|
-
></AntdSelect>
|
|
26
|
-
)
|
|
27
|
-
};
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import { Select as AntdSelect, SelectProps as AntdSelectProps } from 'antd';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface SelectProps extends AntdSelectProps {
|
|
6
|
+
customClass?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Select = ({customClass, ...props}: SelectProps) => {
|
|
10
|
+
const { defaultValue, options } = props;
|
|
11
|
+
|
|
12
|
+
const selectClasses = {
|
|
13
|
+
[styles.select]: true,
|
|
14
|
+
[`${customClass}`]: customClass,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
(options || defaultValue) &&
|
|
19
|
+
<AntdSelect
|
|
20
|
+
className={ classNames(selectClasses) }
|
|
21
|
+
defaultValue={defaultValue}
|
|
22
|
+
style={{ minWidth: 180 }}
|
|
23
|
+
options={options}
|
|
24
|
+
{...props}
|
|
25
|
+
></AntdSelect>
|
|
26
|
+
)
|
|
27
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.select {
|
|
2
|
-
:global {
|
|
3
|
-
.ant-select-selector {
|
|
4
|
-
border-color: rgba(var(--color-black-rgb), .5) !important;
|
|
5
|
-
height: 50px !important;
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
}
|
|
9
|
-
.ant-select-arrow {
|
|
10
|
-
color: var(--color-black);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
.select {
|
|
2
|
+
:global {
|
|
3
|
+
.ant-select-selector {
|
|
4
|
+
border-color: rgba(var(--color-black-rgb), .5) !important;
|
|
5
|
+
height: 50px !important;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
.ant-select-arrow {
|
|
10
|
+
color: var(--color-black);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|