magneto365.ui 2.75.10 → 2.75.11
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/dist/assets/fd3c5f6d7a977109.svg +12 -0
- package/dist/cjs/css/magneto.ui.lib.min.css +1 -1
- package/dist/cjs/index.js +1087 -890
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/UI/atoms/Button/Button.interface.d.ts +9 -1
- package/dist/cjs/types/components/UI/atoms/HorizontalBar/HorizontalBar.component.d.ts +3 -0
- package/dist/cjs/types/components/UI/atoms/HorizontalBar/HorizontalBar.interfaces.d.ts +40 -0
- package/dist/cjs/types/components/UI/atoms/HorizontalBar/index.d.ts +1 -0
- package/dist/cjs/types/components/UI/atoms/index.d.ts +1 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/TestsFormHandler.component.d.ts +4 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/TestsFormHandler.context.d.ts +7 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/TestsFormHandler.interface.d.ts +56 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/TestsFormHandlerContext.interface.d.ts +14 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/GlobalQuestion.component.d.ts +4 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/GlobalQuestion.interface.d.ts +46 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/index.d.ts +1 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/children/GlobalQuestionError/GlobalQuestionError.component.d.ts +4 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/children/GlobalQuestionError/GlobalQuestionError.interface.d.ts +6 -0
- package/dist/cjs/types/components/UI/template/TestsFormHandler/index.d.ts +5 -0
- package/dist/cjs/types/components/UI/template/index.d.ts +1 -0
- package/dist/cjs/types/constants/icons.constants.d.ts +1 -0
- package/dist/cjs/types/utils/colors/getContrastColor.d.ts +1 -0
- package/dist/cjs/types/utils/validateAnswers/validateStepAnswers.d.ts +12 -0
- package/dist/esm/css/magneto.ui.lib.min.css +1 -1
- package/dist/esm/index.js +1083 -891
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/UI/atoms/Button/Button.interface.d.ts +9 -1
- package/dist/esm/types/components/UI/atoms/HorizontalBar/HorizontalBar.component.d.ts +3 -0
- package/dist/esm/types/components/UI/atoms/HorizontalBar/HorizontalBar.interfaces.d.ts +40 -0
- package/dist/esm/types/components/UI/atoms/HorizontalBar/index.d.ts +1 -0
- package/dist/esm/types/components/UI/atoms/index.d.ts +1 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/TestsFormHandler.component.d.ts +4 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/TestsFormHandler.context.d.ts +7 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/TestsFormHandler.interface.d.ts +56 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/TestsFormHandlerContext.interface.d.ts +14 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/GlobalQuestion.component.d.ts +4 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/GlobalQuestion.interface.d.ts +46 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/index.d.ts +1 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/children/GlobalQuestionError/GlobalQuestionError.component.d.ts +4 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/children/GlobalQuestionError/GlobalQuestionError.interface.d.ts +6 -0
- package/dist/esm/types/components/UI/template/TestsFormHandler/index.d.ts +5 -0
- package/dist/esm/types/components/UI/template/index.d.ts +1 -0
- package/dist/esm/types/constants/icons.constants.d.ts +1 -0
- package/dist/esm/types/utils/colors/getContrastColor.d.ts +1 -0
- package/dist/esm/types/utils/validateAnswers/validateStepAnswers.d.ts +12 -0
- package/dist/index.d.ts +178 -2
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export interface IButton {
|
|
|
8
8
|
/**
|
|
9
9
|
* Callback function to be executed when the save button is clicked.
|
|
10
10
|
*/
|
|
11
|
-
onClick
|
|
11
|
+
onClick?: () => void;
|
|
12
12
|
/**
|
|
13
13
|
* Button classname
|
|
14
14
|
*/
|
|
@@ -34,4 +34,12 @@ export interface IButton {
|
|
|
34
34
|
* Icon size
|
|
35
35
|
*/
|
|
36
36
|
iconSize?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Button type
|
|
39
|
+
*/
|
|
40
|
+
type?: 'button' | 'submit' | 'reset';
|
|
41
|
+
/**
|
|
42
|
+
* Disable the button
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
37
45
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface IClassNames {
|
|
2
|
+
/**
|
|
3
|
+
* Custom styles for the bar
|
|
4
|
+
*/
|
|
5
|
+
bar?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Custom styles for the fill container
|
|
8
|
+
*/
|
|
9
|
+
container?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Custom styles for the text description
|
|
12
|
+
*/
|
|
13
|
+
text?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Custom styles for the fill value within the bar
|
|
16
|
+
*/
|
|
17
|
+
value?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Custom styles for the fill
|
|
20
|
+
*/
|
|
21
|
+
fill?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IHorizontalBarProps {
|
|
24
|
+
/**
|
|
25
|
+
* Sets the value to show within the bar
|
|
26
|
+
*/
|
|
27
|
+
value: number;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the text of the bar
|
|
30
|
+
*/
|
|
31
|
+
text?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the range of the bar
|
|
34
|
+
*/
|
|
35
|
+
maxPercentage?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Sets custom classnames
|
|
38
|
+
*/
|
|
39
|
+
classNames?: IClassNames;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HorizontalBar } from './HorizontalBar.component';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { IFormHandlerContext } from './TestsFormHandlerContext.interface';
|
|
3
|
+
export declare const FormHandlerProvider: React.FC<{
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useFormHandler: () => IFormHandlerContext;
|
|
7
|
+
export default FormHandlerProvider;
|
package/dist/cjs/types/components/UI/template/TestsFormHandler/TestsFormHandler.interface.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AnswerType } from './children/GlobalQuestion/GlobalQuestion.interface';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface ICustomButtonText {
|
|
4
|
+
/**
|
|
5
|
+
* The text to display on the previous button
|
|
6
|
+
*/
|
|
7
|
+
previous: string;
|
|
8
|
+
/**
|
|
9
|
+
* The text to display on the next button
|
|
10
|
+
*/
|
|
11
|
+
next: string;
|
|
12
|
+
/**
|
|
13
|
+
* The text to display on the submit button
|
|
14
|
+
*/
|
|
15
|
+
finish: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IFormHandler {
|
|
18
|
+
/**
|
|
19
|
+
* Determines if the form should be displayed as multiple steps
|
|
20
|
+
*/
|
|
21
|
+
multiStep?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Function to customize the submit action
|
|
24
|
+
*/
|
|
25
|
+
onSubmit: (answers: {
|
|
26
|
+
[key: string]: AnswerType;
|
|
27
|
+
}) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Custom classname for the form container
|
|
30
|
+
*/
|
|
31
|
+
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Enable resend the test
|
|
34
|
+
*/
|
|
35
|
+
isDisabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Children components to render (questions)
|
|
38
|
+
*/
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Total number of steps for multi-step forms
|
|
42
|
+
*/
|
|
43
|
+
totalSteps?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Current step for multi-step forms
|
|
46
|
+
*/
|
|
47
|
+
currentStep?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Callback for step changes
|
|
50
|
+
*/
|
|
51
|
+
onStepChange?: (step: number) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Object with custom texts for the form buttons
|
|
54
|
+
*/
|
|
55
|
+
customButtonText: ICustomButtonText;
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnswerType } from './children/GlobalQuestion';
|
|
2
|
+
export interface IFormHandlerContext {
|
|
3
|
+
answers: {
|
|
4
|
+
[key: string]: AnswerType;
|
|
5
|
+
};
|
|
6
|
+
submitted: boolean;
|
|
7
|
+
handleChange: (questionId: string, value: AnswerType) => void;
|
|
8
|
+
setSubmitted: (value: boolean) => void;
|
|
9
|
+
currentStepQuestions: {
|
|
10
|
+
[key: string]: 'single' | 'multiple' | 'text';
|
|
11
|
+
};
|
|
12
|
+
registerQuestion: (questionId: string, questionType: 'single' | 'multiple' | 'text') => void;
|
|
13
|
+
unregisterQuestion: (questionId: string) => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface IGlobalQuestionProps {
|
|
2
|
+
/**
|
|
3
|
+
* The question to be displayed
|
|
4
|
+
*/
|
|
5
|
+
question: IQuestion;
|
|
6
|
+
/**
|
|
7
|
+
* The text to be displayed in the error message
|
|
8
|
+
*/
|
|
9
|
+
errorText: string;
|
|
10
|
+
/**
|
|
11
|
+
* Index of the question (optional, will use context if not provided)
|
|
12
|
+
*/
|
|
13
|
+
idx?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IQuestion {
|
|
16
|
+
/**
|
|
17
|
+
* Unique identifier for the question
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* The text of the question
|
|
22
|
+
*/
|
|
23
|
+
text: string;
|
|
24
|
+
/**
|
|
25
|
+
* The type of the question: single, multiple, or text
|
|
26
|
+
*/
|
|
27
|
+
type: 'single' | 'multiple' | 'text';
|
|
28
|
+
/**
|
|
29
|
+
* Array of options for the question, if any
|
|
30
|
+
*/
|
|
31
|
+
options?: IQuestionOptions[];
|
|
32
|
+
}
|
|
33
|
+
export interface IQuestionOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Unique identifier for the option
|
|
36
|
+
*/
|
|
37
|
+
id: number;
|
|
38
|
+
/**
|
|
39
|
+
* The text of the option
|
|
40
|
+
*/
|
|
41
|
+
label: string;
|
|
42
|
+
}
|
|
43
|
+
export declare type AnswerType = string | IQuestionOptions | IQuestionOptions[];
|
|
44
|
+
export interface QuestionTypeValidators {
|
|
45
|
+
[key: string]: (answer: AnswerType) => boolean;
|
|
46
|
+
}
|
package/dist/cjs/types/components/UI/template/TestsFormHandler/children/GlobalQuestion/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GlobalQuestion.interface';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './TestsFormHandler.interface';
|
|
2
|
+
export * from './children/GlobalQuestion/GlobalQuestion.interface';
|
|
3
|
+
export * from './TestsFormHandler.context';
|
|
4
|
+
export { default as TestFormHandler } from './TestsFormHandler.component';
|
|
5
|
+
export { default as GlobalQuestion } from './children/GlobalQuestion/GlobalQuestion.component';
|
|
@@ -192,5 +192,6 @@ export { default as WhatsAppDark } from '../assets/Whatsapp.svg';
|
|
|
192
192
|
export { default as X } from '../assets/X.svg';
|
|
193
193
|
export { default as Youtube } from '../assets/Youtube.svg';
|
|
194
194
|
export { default as YoutubeSolid } from '../assets/YoutubeSolid.svg';
|
|
195
|
+
export { default as InfoRed } from '../assets/info-circle-red.svg';
|
|
195
196
|
export { default as AdvertisementOutline } from '../assets/advertisement.svg';
|
|
196
197
|
export { default as AdvertisementBold } from '../assets/advertisementBold.svg';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getContrastColor: (hexColor: string) => "#000000" | "#ffffff";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnswerType, IQuestion } from '@components/UI/template';
|
|
2
|
+
export declare const validateCurrentStepAnswers: (currentStepQuestions: {
|
|
3
|
+
[key: string]: "text" | "multiple" | "single";
|
|
4
|
+
}, answers: {
|
|
5
|
+
[key: string]: AnswerType;
|
|
6
|
+
}) => boolean;
|
|
7
|
+
export declare const questionTypeValidators: {
|
|
8
|
+
multiple: (answer: AnswerType) => boolean;
|
|
9
|
+
single: (answer: AnswerType) => boolean;
|
|
10
|
+
text: (answer: AnswerType) => boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const isMissingValidator: (answer: AnswerType, question: IQuestion) => boolean;
|