@roqua/quby-frontend 0.10.8 → 0.10.9

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 (50) hide show
  1. package/dist/components/AnswerPage.d.ts +2 -3
  2. package/dist/components/MainLabel.d.ts +2 -3
  3. package/dist/components/Paginator.d.ts +3 -4
  4. package/dist/components/PanelContent.d.ts +2 -3
  5. package/dist/components/PanelItem.d.ts +2 -3
  6. package/dist/components/ProgressBar.d.ts +1 -2
  7. package/dist/components/Quby.d.ts +2 -3
  8. package/dist/components/QuestionDescription.d.ts +1 -2
  9. package/dist/components/QuestionWrapper.d.ts +2 -3
  10. package/dist/components/SubQuestions.d.ts +2 -3
  11. package/dist/components/ValidationErrors.d.ts +2 -3
  12. package/dist/components/index.d.ts +2 -2
  13. package/dist/components/items/HtmlItem.d.ts +2 -3
  14. package/dist/components/items/InfoItem.d.ts +2 -3
  15. package/dist/components/items/QuestionItem.d.ts +1 -2
  16. package/dist/components/items/UnknownItem.d.ts +2 -3
  17. package/dist/components/questions/CheckBoxQuestion.d.ts +2 -3
  18. package/dist/components/questions/CountrySelectQuestion.d.ts +2 -3
  19. package/dist/components/questions/DatePartsQuestion.d.ts +2 -3
  20. package/dist/components/questions/FloatQuestion.d.ts +2 -3
  21. package/dist/components/questions/IntegerQuestion.d.ts +2 -3
  22. package/dist/components/questions/OldSliderQuestion.d.ts +2 -3
  23. package/dist/components/questions/RadioQuestion.d.ts +2 -3
  24. package/dist/components/questions/ScaleQuestion.d.ts +2 -3
  25. package/dist/components/questions/SelectQuestion.d.ts +2 -3
  26. package/dist/components/questions/SliderQuestion.d.ts +2 -3
  27. package/dist/components/questions/SplitToUnitsQuestion.d.ts +2 -3
  28. package/dist/components/questions/StringQuestion.d.ts +2 -3
  29. package/dist/components/questions/TextareaQuestion.d.ts +2 -3
  30. package/dist/core/calculations.d.ts +0 -1
  31. package/dist/core/curlies_interpolator.d.ts +2 -3
  32. package/dist/core/index.d.ts +7 -7
  33. package/dist/core/panel_logic.d.ts +2 -3
  34. package/dist/core/quby_context.d.ts +2 -3
  35. package/dist/core/questionnaire.d.ts +4 -3
  36. package/dist/core/questionnaire_json.d.ts +8 -3
  37. package/dist/core/response.d.ts +4 -5
  38. package/dist/core/response_json.d.ts +2 -3
  39. package/dist/core/validators.d.ts +2 -3
  40. package/dist/core/visibility_rules.d.ts +2 -3
  41. package/dist/i18n.d.ts +1 -2
  42. package/dist/index.d.ts +2 -3
  43. package/dist/logic/index.d.ts +3 -3
  44. package/dist/logic/map_css_vars.d.ts +0 -1
  45. package/dist/logic/use_might_become_valid.d.ts +1 -2
  46. package/dist/logic/use_question_shortkeys.d.ts +2 -3
  47. package/dist/quby-frontend.es.js +8879 -8907
  48. package/dist/quby-frontend.umd.js +76 -76
  49. package/dist/stories/_helpers.d.ts +4 -4
  50. package/package.json +1 -1
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IDisplayOptions, IInterpolateTextvars, Questionnaire, Response } from '../core';
3
-
1
+ import React from "react";
2
+ import { IDisplayOptions, IInterpolateTextvars, Questionnaire, Response } from "../core";
4
3
  export declare const InterpolateCurliesContext: React.Context<IInterpolateTextvars>;
5
4
  interface Props {
6
5
  questionnaire: Questionnaire;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IQuestion } from '../core';
3
-
1
+ import React from "react";
2
+ import { IQuestion } from "../core";
4
3
  interface Props {
5
4
  question: IQuestion;
6
5
  }
@@ -1,7 +1,6 @@
1
- import { default as React } from 'react';
2
- import { IDisplayOptions } from '../core';
3
- import { PanelLogic } from '../core/panel_logic';
4
-
1
+ import React from "react";
2
+ import { IDisplayOptions } from "../core";
3
+ import { PanelLogic } from "../core/panel_logic";
5
4
  export interface INavigationCallbacks {
6
5
  done: () => void;
7
6
  prev?: () => void;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IPanel } from '../core';
3
-
1
+ import React from "react";
2
+ import { IPanel } from "../core";
4
3
  interface Props {
5
4
  panel: IPanel;
6
5
  }
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IPanelItem } from '../core';
3
-
1
+ import React from "react";
2
+ import { IPanelItem } from "../core";
4
3
  interface Props {
5
4
  item: IPanelItem;
6
5
  }
@@ -1,5 +1,4 @@
1
- import { default as React } from 'react';
2
-
1
+ import React from "react";
3
2
  interface Props {
4
3
  max: number;
5
4
  current: number;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { Response, IDisplayOptions, IResponseJson } from '../core';
3
-
1
+ import React from "react";
2
+ import { Response, IDisplayOptions, IResponseJson } from "../core";
4
3
  export interface Props {
5
4
  questionnaireJson: any;
6
5
  responseJson: IResponseJson;
@@ -1,5 +1,4 @@
1
- import { default as React } from 'react';
2
-
1
+ import React from "react";
3
2
  interface HasDescription {
4
3
  description?: string;
5
4
  }
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IQuestion } from '../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IQuestion } from "../core";
4
3
  interface Props {
5
4
  question: IQuestion;
6
5
  fieldState: IFieldState<any>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IQuestion } from '../core';
3
-
1
+ import React from "react";
2
+ import { IQuestion } from "../core";
4
3
  export declare const SubQuestions: React.FunctionComponent<{
5
4
  questions: IQuestion[];
6
5
  }>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IValidated } from '../core';
3
-
1
+ import React from "react";
2
+ import { IValidated } from "../core";
4
3
  interface Props {
5
4
  fieldState: IValidated;
6
5
  }
@@ -1,2 +1,2 @@
1
- export * from './AnswerPage';
2
- export * from './Quby';
1
+ export * from "./AnswerPage";
2
+ export * from "./Quby";
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IHtmlItem } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IHtmlItem } from "../../core";
4
3
  interface Props {
5
4
  item: IHtmlItem;
6
5
  }
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IInfoItem } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IInfoItem } from "../../core";
4
3
  interface Props {
5
4
  item: IInfoItem;
6
5
  }
@@ -1,5 +1,4 @@
1
- import { default as React } from 'react';
2
-
1
+ import React from "react";
3
2
  interface Props {
4
3
  fieldKey: string;
5
4
  }
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IPanelItem } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IPanelItem } from "../../core";
4
3
  interface Props {
5
4
  item: IPanelItem;
6
5
  }
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { ICheckBoxQuestion, IFieldState, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { ICheckBoxQuestion, IFieldState, SetQuestionRef } from "../../core";
4
3
  type CheckBoxFieldState = IFieldState<Set<string>>;
5
4
  interface Props {
6
5
  question: ICheckBoxQuestion;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IStringQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IStringQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IStringQuestion;
6
5
  fieldState: IFieldState<string>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { DatePartsComponent, IDatePartsQuestion, IFieldState, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { DatePartsComponent, IDatePartsQuestion, IFieldState, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IDatePartsQuestion;
6
5
  fieldState: IFieldState<Map<DatePartsComponent, string>>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IFloatQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IFloatQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IFloatQuestion;
6
5
  fieldState: IFieldState<number>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IIntegerQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IIntegerQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IIntegerQuestion;
6
5
  fieldState: IFieldState<number>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, ISliderQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, ISliderQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: ISliderQuestion;
6
5
  fieldState: IFieldState<number>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IRadioQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IRadioQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IRadioQuestion;
6
5
  fieldState: IFieldState<string>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IScaleQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IScaleQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IScaleQuestion;
6
5
  fieldState: IFieldState<string>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, ISelectQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, ISelectQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: ISelectQuestion;
6
5
  fieldState: IFieldState<string>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, ISliderQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, ISliderQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: ISliderQuestion;
6
5
  fieldState: IFieldState<number>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, ISplitToUnitsQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, ISplitToUnitsQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: ISplitToUnitsQuestion;
6
5
  fieldState: IFieldState<number>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { IFieldState, IStringQuestion, SetQuestionRef } from '../../core';
3
-
1
+ import React from "react";
2
+ import { IFieldState, IStringQuestion, SetQuestionRef } from "../../core";
4
3
  interface Props {
5
4
  question: IStringQuestion;
6
5
  fieldState: IFieldState<string>;
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { ITextareaQuestion, IFieldState } from '../../core';
3
-
1
+ import React from "react";
2
+ import { ITextareaQuestion, IFieldState } from "../../core";
4
3
  interface Props {
5
4
  question: ITextareaQuestion;
6
5
  fieldState: IFieldState<string>;
@@ -1,6 +1,5 @@
1
1
  import { IBooleanCalculation, ICalcBooleanReducer, ICalcComparer, ICalculation, INumberCalculation, ISexpVariables } from './questionnaire_json';
2
2
  import { Response } from './response';
3
-
4
3
  type INumberReducer = (acc: number, value: number) => number;
5
4
  export declare class Calculations {
6
5
  sexpVariables: ISexpVariables;
@@ -1,6 +1,5 @@
1
- import { Questionnaire } from './questionnaire';
2
- import { Response } from './response';
3
-
1
+ import { Questionnaire } from "./questionnaire";
2
+ import { Response } from "./response";
4
3
  export declare class CurliesInterpolator {
5
4
  response: Response;
6
5
  questionnaire: Questionnaire;
@@ -1,7 +1,7 @@
1
- export * from './questionnaire_json';
2
- export * from './questionnaire';
3
- export * from './response';
4
- export * from './quby_context';
5
- export * from './validators';
6
- export * from './response_json';
7
- export * from './curlies_interpolator';
1
+ export * from "./questionnaire_json";
2
+ export * from "./questionnaire";
3
+ export * from "./response";
4
+ export * from "./quby_context";
5
+ export * from "./validators";
6
+ export * from "./response_json";
7
+ export * from "./curlies_interpolator";
@@ -1,6 +1,5 @@
1
- import { IPanel } from './questionnaire_json';
2
- import { Response } from './response';
3
-
1
+ import { IPanel } from "./questionnaire_json";
2
+ import { Response } from "./response";
4
3
  export declare class PanelLogic {
5
4
  private response;
6
5
  panels: IPanel[];
@@ -1,6 +1,5 @@
1
- import { default as React } from 'react';
2
- import { Response, Questionnaire, IDisplayOptions } from '.';
3
-
1
+ import React from "react";
2
+ import { Response, Questionnaire, IDisplayOptions } from ".";
4
3
  export type SetQuestionRef = (key: string, ref: React.RefObject<HTMLElement | null>) => void;
5
4
  export interface IQubyContext {
6
5
  questionnaire: Questionnaire;
@@ -1,7 +1,7 @@
1
- import { IQuestionnaire, IQuestion, IPanel, ITextvar, IValidation, IQuestions, ISexpVariables } from './questionnaire_json';
2
- import { VisibilityRule } from './visibility_rules';
3
-
1
+ import { IQuestionnaire, IQuestion, IPanel, ITextvar, IValidation, IQuestions, ISexpVariables, ISelectOption, IRadioOption } from "./questionnaire_json";
2
+ import { VisibilityRule } from "./visibility_rules";
4
3
  export declare class Questionnaire {
4
+ #private;
5
5
  key: string;
6
6
  panels: IPanel[];
7
7
  footer?: string;
@@ -18,5 +18,6 @@ export declare class Questionnaire {
18
18
  constructor(data: IQuestionnaire);
19
19
  getField(key: string): IQuestion;
20
20
  getQuestionsInSameGroup(questionKey: string): IQuestion[];
21
+ getFlatOptions(questionKey: string): (ISelectOption | IRadioOption)[];
21
22
  getOptionNumberValue(questionKey: string, optionKey: string): number | null;
22
23
  }
@@ -1,5 +1,4 @@
1
- import { z } from 'zod';
2
-
1
+ import { z } from "zod";
3
2
  export interface ITranslatable {
4
3
  t: string;
5
4
  [interpolationKey: string]: string | number;
@@ -147,7 +146,7 @@ export interface ISplitToUnitsQuestion extends IBaseField, INumberQuestion {
147
146
  export interface ISelectQuestion extends IBaseField {
148
147
  type: "select";
149
148
  as: "select";
150
- children: (ISelectOption)[];
149
+ children: (ISelectOption | IOptgroup)[];
151
150
  placeholder: string;
152
151
  }
153
152
  export interface IRadioQuestion extends IBaseField {
@@ -187,6 +186,12 @@ export interface IRadioOption extends IOption {
187
186
  label?: string;
188
187
  description?: string;
189
188
  }
189
+ export interface IOptgroup {
190
+ type: "optgroup";
191
+ key: string;
192
+ label: string;
193
+ options: ISelectOption[];
194
+ }
190
195
  export interface ISelectOption extends IOption {
191
196
  value: number;
192
197
  label?: string;
@@ -1,8 +1,7 @@
1
- import { z } from 'zod';
2
- import { Questionnaire } from './questionnaire';
3
- import { IPanel, ITranslatable, IValidation } from './questionnaire_json';
4
- import { Calculations } from './calculations';
5
-
1
+ import { z } from "zod";
2
+ import { Questionnaire } from "./questionnaire";
3
+ import { IPanel, ITranslatable, IValidation } from "./questionnaire_json";
4
+ import { Calculations } from "./calculations";
6
5
  export interface IAnswerFromServer {
7
6
  value: IValues;
8
7
  flags: IFlags;
@@ -1,6 +1,5 @@
1
- import { Questionnaire } from './questionnaire';
2
- import { IAnswerFromServer } from './response';
3
-
1
+ import { Questionnaire } from "./questionnaire";
2
+ import { IAnswerFromServer } from "./response";
4
3
  export declare class ResponseParseError extends Error {
5
4
  }
6
5
  export interface IResponseJson {
@@ -1,6 +1,5 @@
1
- import { IAnswerGroupMaximumValidation, IAnswerGroupMinimumValidation, IRequiresAnswerValidation, IValidation, IMinimumValidation, IMaximumValidation, IMinimumDateValidation, IMinimumCheckedRequiredValidation, IMaximumCheckedAllowedValidation, IMaximumDateValidation, IValidDateValidation, IValidIntegerValidation, IValidFloatValidation, IRegexpValidation } from './questionnaire_json';
2
- import { Response } from './response';
3
-
1
+ import { IAnswerGroupMaximumValidation, IAnswerGroupMinimumValidation, IRequiresAnswerValidation, IValidation, IMinimumValidation, IMaximumValidation, IMinimumDateValidation, IMinimumCheckedRequiredValidation, IMaximumCheckedAllowedValidation, IMaximumDateValidation, IValidDateValidation, IValidIntegerValidation, IValidFloatValidation, IRegexpValidation } from "./questionnaire_json";
2
+ import { Response } from "./response";
4
3
  export type ValidatableResponse = Pick<Response, "getValidationFieldState">;
5
4
  export declare const ignorableErrors: IValidation["type"][];
6
5
  export declare function buildValidator(data: IValidation): RequiresAnswerValidator | ValidIntegerValidator | ValidFloatValidator | ValidDateValidator | MinimumValidator | MaximumValidator | MinimumDateValidator | MaximumDateValidator | MinimumCheckedRequiredValidator | MaximumCheckedAllowedValidator | AnswerGroupMinimumValidator | AnswerGroupMaximumValidator | RegexpValidator;
@@ -1,6 +1,5 @@
1
- import { IVisibilityRule } from './questionnaire_json';
2
- import { Response } from './response';
3
-
1
+ import { IVisibilityRule } from "./questionnaire_json";
2
+ import { Response } from "./response";
4
3
  interface ICondition {
5
4
  match(response: Response): boolean;
6
5
  }
package/dist/i18n.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import { default as i18n } from 'i18next';
2
-
1
+ import i18n from "i18next";
3
2
  export default i18n;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
-
2
- export * from './core';
3
- export * from './components';
1
+ export * from "./core";
2
+ export * from "./components";
@@ -1,3 +1,3 @@
1
- export * from './use_might_become_valid';
2
- export * from './use_question_shortkeys';
3
- export * from './map_css_vars';
1
+ export * from "./use_might_become_valid";
2
+ export * from "./use_question_shortkeys";
3
+ export * from "./map_css_vars";
@@ -1,5 +1,4 @@
1
1
  import { CSSProperties } from 'react';
2
-
3
2
  export declare const mapCssVars: (cssVars: {
4
3
  [key: string]: string | number;
5
4
  } | undefined) => CSSProperties | undefined;
@@ -1,5 +1,4 @@
1
- import { default as React } from 'react';
2
-
1
+ import React from "react";
3
2
  export declare function useMightBecomeValid(value: string | undefined, handleChange: (newValue: string) => string | undefined): {
4
3
  onChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
5
4
  value: string;
@@ -1,4 +1,3 @@
1
- import { default as React } from 'react';
2
- import { Response, Questionnaire } from '../core';
3
-
1
+ import React from "react";
2
+ import { Response, Questionnaire } from "../core";
4
3
  export declare const useQuestionShortkeys: (response: Response, questionnaire: Questionnaire, qubyRef: React.RefObject<HTMLDivElement | null>) => void;