freemium-survey-components 2.0.12 → 2.0.13
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/lib/index.cjs.js +13 -7
- package/lib/index.esm.js +13 -7
- package/lib/types/components/form-field/index.d.ts +1 -1
- package/lib/types/components/number/index.d.ts +2 -2
- package/lib/types/components/phone-number-input/index.d.ts +2 -2
- package/lib/types/components/textbox/index.d.ts +2 -2
- package/lib/types/stories/BooleanStory.d.ts +12 -0
- package/lib/types/stories/SliderStory.d.ts +14 -0
- package/lib/types/survey/question.d.ts +1 -1
- package/lib/types/survey/utils/logics.d.ts +4 -1
- package/lib/types/survey/utils/use-standard-survey.d.ts +2 -3
- package/lib/types/types.d.ts +3 -2
- package/package.json +3 -2
|
@@ -4,7 +4,7 @@ import './style.scss';
|
|
|
4
4
|
type FormFieldProps = {
|
|
5
5
|
question: SurveyQuestionType;
|
|
6
6
|
autoFocusDelay: number;
|
|
7
|
-
onChangeHandler: (answer: QuestionAnswerType) => void;
|
|
7
|
+
onChangeHandler: (answer: QuestionAnswerType, commitValue?: boolean) => void;
|
|
8
8
|
isRequired?: boolean;
|
|
9
9
|
translationVariables: TranslationVariablesType;
|
|
10
10
|
surveyStyle?: SurveyProps['surveyStyle'];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnswersType, SurveyLayoutType, SurveyQuestionType } from '../../types';
|
|
2
|
+
import { AnswersType, QuestionAnswerType, SurveyLayoutType, SurveyQuestionType } from '../../types';
|
|
3
3
|
type NumberProps = {
|
|
4
4
|
question: SurveyQuestionType;
|
|
5
5
|
autoFocusDelay: number;
|
|
6
6
|
setFocus?: boolean;
|
|
7
|
-
onChangeHandler: (
|
|
7
|
+
onChangeHandler: (answer: QuestionAnswerType, commitValue?: boolean) => void;
|
|
8
8
|
formValues: AnswersType['formValues'];
|
|
9
9
|
surveyLayout: SurveyLayoutType;
|
|
10
10
|
};
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { InputProps } from '../text-input/types';
|
|
3
3
|
import '../text-input/style.scss';
|
|
4
4
|
import './style.scss';
|
|
5
|
-
import { SurveyLayoutType } from '../../types';
|
|
5
|
+
import { QuestionAnswerType, SurveyLayoutType } from '../../types';
|
|
6
6
|
type PhoneNumberInputProps = InputProps & {
|
|
7
|
-
onChangeHandler
|
|
7
|
+
onChangeHandler: (answer: QuestionAnswerType, commitValue?: boolean) => void;
|
|
8
8
|
surveyLayout: SurveyLayoutType;
|
|
9
9
|
};
|
|
10
10
|
declare const PhoneNumberInput: React.ForwardRefExoticComponent<Omit<PhoneNumberInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnswersType, SurveyLayoutType, SurveyQuestionType, ValidatingQuestions } from '../../types';
|
|
2
|
+
import { AnswersType, QuestionAnswerType, SurveyLayoutType, SurveyQuestionType, ValidatingQuestions } from '../../types';
|
|
3
3
|
type TextboxProps = {
|
|
4
4
|
question: SurveyQuestionType;
|
|
5
5
|
autoFocusDelay: number;
|
|
6
|
-
onChangeHandler: (
|
|
6
|
+
onChangeHandler: (answer: QuestionAnswerType, commitValue?: boolean) => void;
|
|
7
7
|
formValues: AnswersType['formValues'];
|
|
8
8
|
textboxErrors: ValidatingQuestions['textboxQuestionErrors'];
|
|
9
9
|
setFocus?: boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropertiesLabelsPreferenceType, ScalePropertiesOrderType } from '../types';
|
|
3
|
+
import { QuestionStoryProps } from './QuestionStory';
|
|
4
|
+
interface BooleanStoryProps extends Omit<QuestionStoryProps, 'question'> {
|
|
5
|
+
positiveLabel: string;
|
|
6
|
+
negativeLabel: string;
|
|
7
|
+
preference: PropertiesLabelsPreferenceType;
|
|
8
|
+
order: ScalePropertiesOrderType;
|
|
9
|
+
typeVariant: 'EMOJI' | 'THUMBS' | 'TICK' | 'TEXT';
|
|
10
|
+
}
|
|
11
|
+
declare const BooleanStory: (props: BooleanStoryProps) => React.JSX.Element;
|
|
12
|
+
export default BooleanStory;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QuestionStoryProps } from './QuestionStory';
|
|
3
|
+
interface SliderStoryProps extends Omit<QuestionStoryProps, 'question'> {
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
openingPosition: number;
|
|
7
|
+
decimalPoints: '1' | '2';
|
|
8
|
+
gridLines: 1 | 2 | 3 | 4 | 5;
|
|
9
|
+
stopOnlyAtGridLines: boolean;
|
|
10
|
+
numericalInputBox: boolean;
|
|
11
|
+
allowDecimal: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const SliderStory: (props: SliderStoryProps) => React.JSX.Element;
|
|
14
|
+
export default SliderStory;
|
|
@@ -8,7 +8,7 @@ declare const Question: ({ surveyLanguage, language, question, formValues, other
|
|
|
8
8
|
surveyStyle: SurveyProps['surveyStyle'];
|
|
9
9
|
formValues: AnswersType['formValues'];
|
|
10
10
|
othersMeta: AnswersType['others'];
|
|
11
|
-
onChangeHandler: (answer: QuestionAnswerType) => void;
|
|
11
|
+
onChangeHandler: (answer: QuestionAnswerType, commitValue?: boolean) => void;
|
|
12
12
|
autoFocusDelay: number;
|
|
13
13
|
activeIndexOfRenderedStatement?: number | undefined;
|
|
14
14
|
setFocus?: boolean | undefined;
|
|
@@ -65,7 +65,7 @@ export declare const canCommitDirtyValue: ({ question, answers, isLastRenderedBl
|
|
|
65
65
|
answers: AnswersType;
|
|
66
66
|
isLastRenderedBlock?: boolean | undefined;
|
|
67
67
|
}) => boolean | undefined;
|
|
68
|
-
export declare const canMoveToNextBlock: ({ blocks, activeIndexOfBlocks, renderedBlocks, activeIndexOfRenderedBlocks, answers, questions, surveyLayout, }: {
|
|
68
|
+
export declare const canMoveToNextBlock: ({ blocks, activeIndexOfBlocks, renderedBlocks, activeIndexOfRenderedBlocks, answers, questions, surveyLayout, pages, activePage, }: {
|
|
69
69
|
blocks: SurveyBlockWithQuestionNamesType[];
|
|
70
70
|
activeIndexOfBlocks: number;
|
|
71
71
|
renderedBlocks: BlockWithQuestionType[];
|
|
@@ -73,6 +73,8 @@ export declare const canMoveToNextBlock: ({ blocks, activeIndexOfBlocks, rendere
|
|
|
73
73
|
answers: AnswersType;
|
|
74
74
|
questions: SurveyQuestionType[];
|
|
75
75
|
surveyLayout: SurveyLayoutType;
|
|
76
|
+
pages?: SurveyPageType[] | undefined;
|
|
77
|
+
activePage?: SurveyPageType | undefined;
|
|
76
78
|
}) => boolean | undefined;
|
|
77
79
|
export type CanDisplayDisableButtonProps = {
|
|
78
80
|
answers: AnswersType;
|
|
@@ -108,6 +110,7 @@ export declare const getAnswersTillActiveBlock: ({ renderedBlocks, activeIndexOf
|
|
|
108
110
|
[key: string]: string;
|
|
109
111
|
};
|
|
110
112
|
commitDirtyValue?: boolean | undefined;
|
|
113
|
+
moveToNextPage?: boolean | undefined;
|
|
111
114
|
};
|
|
112
115
|
export declare const getRenderedBlocksTillActiveBlock: ({ renderedBlocks, activeIndexOfRenderedBlocks, }: {
|
|
113
116
|
renderedBlocks: BlockWithQuestionType[];
|
|
@@ -4,13 +4,11 @@ export declare const useStandardSurvey: (props: AugmentedSurveyProps) => {
|
|
|
4
4
|
setErrors: React.Dispatch<React.SetStateAction<ValidatingQuestions>>;
|
|
5
5
|
saveFormValues: (block: BlockWithQuestionType, value: QuestionAnswerType, commitDirtyValue?: boolean, blockIndex?: number) => void;
|
|
6
6
|
saveOthersValue: (questionName: string, inputValue: string | null, blockIndex?: number) => void;
|
|
7
|
-
skipBlock: () => void;
|
|
8
|
-
skipStatement: () => void;
|
|
9
7
|
clearRadioSelection: (blockIndex: number) => void;
|
|
10
8
|
onSubmitHandler: (status?: AnswerStatus) => void;
|
|
11
9
|
navigateToStart: () => void;
|
|
12
10
|
resetSurvey: () => void;
|
|
13
|
-
|
|
11
|
+
moveToNextPage: (nullifyValues?: boolean) => void;
|
|
14
12
|
formQuestionErrors: Record<string, Record<string, string>>;
|
|
15
13
|
textboxQuestionErrors: Record<string, string>;
|
|
16
14
|
fileUploadErrors: Record<string, string>;
|
|
@@ -31,6 +29,7 @@ export declare const useStandardSurvey: (props: AugmentedSurveyProps) => {
|
|
|
31
29
|
navigateToPreviousStatement: () => void;
|
|
32
30
|
isInitialTransition: boolean;
|
|
33
31
|
isSurveyCompleted: boolean;
|
|
32
|
+
setIsSurveyCompleted: React.Dispatch<React.SetStateAction<boolean>>;
|
|
34
33
|
pivot: {
|
|
35
34
|
question: import("../../types").SurveyQuestionType;
|
|
36
35
|
answer?: number | boolean | undefined;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -609,6 +609,7 @@ export type AnswersType = {
|
|
|
609
609
|
[key: string]: string;
|
|
610
610
|
};
|
|
611
611
|
commitDirtyValue?: boolean;
|
|
612
|
+
moveToNextPage?: boolean;
|
|
612
613
|
};
|
|
613
614
|
type QuestionFooterProps = {
|
|
614
615
|
isWidget: boolean;
|
|
@@ -620,8 +621,6 @@ type QuestionFooterProps = {
|
|
|
620
621
|
activeIndexOfRenderedBlocks: number;
|
|
621
622
|
activeIndexOfBlocks: number;
|
|
622
623
|
saveFormValues: (block: BlockWithQuestionType, value: QuestionAnswerType, commitDirtyValue?: boolean, blockIndex?: number, skipPage?: boolean) => void;
|
|
623
|
-
skipStatement: () => void;
|
|
624
|
-
skipBlock: () => void;
|
|
625
624
|
isInitialTransition?: boolean;
|
|
626
625
|
onSubmitHandler: (status: AnswerStatus) => void;
|
|
627
626
|
initialPivotAnswer?: number;
|
|
@@ -637,6 +636,8 @@ export type CardQuestionFooterProps = QuestionFooterProps & {
|
|
|
637
636
|
widgetStyle?: WidgetStyles;
|
|
638
637
|
navigateToPreviousBlock: () => void;
|
|
639
638
|
navigateToNextBlock: () => void;
|
|
639
|
+
skipStatement: () => void;
|
|
640
|
+
skipBlock: () => void;
|
|
640
641
|
activeIndexOfRenderedStatement: number;
|
|
641
642
|
setFooterElementRef?: Function;
|
|
642
643
|
isReverseAnimation?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "freemium-survey-components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"description": "React Survey Ui Components",
|
|
5
5
|
"main": "lib/index.cjs.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
48
48
|
"@rollup/plugin-commonjs": "^13.0.0",
|
|
49
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
49
50
|
"@rollup/plugin-node-resolve": "^8.1.0",
|
|
50
51
|
"@storybook/addon-essentials": "^8.0.9",
|
|
51
52
|
"@storybook/addon-interactions": "^8.0.9",
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
"filepond-plugin-file-validate-type": "^1.2.9",
|
|
99
100
|
"framer-motion": "^6.3.13",
|
|
100
101
|
"lodash.clonedeep": "^4.5.0",
|
|
101
|
-
"moment": "^
|
|
102
|
+
"moment-timezone": "^0.5.45",
|
|
102
103
|
"react": ">=16.0.2",
|
|
103
104
|
"react-dom": ">=16.0.2",
|
|
104
105
|
"react-filepond": "^7.1.2",
|