optimized-react-component-library-xyz123 2.5.11 → 2.5.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/dist/index.d.mts CHANGED
@@ -472,6 +472,8 @@ declare const createFormSlice: (initialState: IFormState, options?: {
472
472
  * Uppdaterar svaret (answer) för en specifik fråga i global state.
473
473
  */
474
474
  updateAnswer: (state: immer.WritableDraft<IFormState>, action: PayloadAction<any>) => void;
475
+ /** Tar bort alla svar (answer) i global state. Används när man startar om formuläret. */
476
+ removeAllAnswers: (state: immer.WritableDraft<IFormState>) => void;
475
477
  /** Uppdaterar filer (files) för en specifik fråga i global state */
476
478
  addFiles: (state: immer.WritableDraft<IFormState>, action: PayloadAction<any>) => void;
477
479
  /**
@@ -994,7 +996,6 @@ interface StepperButtonsNoApiProps {
994
996
  globalLanguageState?: any;
995
997
  changeStepHandler: (activeStep: number) => void;
996
998
  nextStepButtonHandler?: (e: any) => void;
997
- onSubmitHandler?: (e: any) => void;
998
999
  steps?: any[];
999
1000
  activeStep: number;
1000
1001
  appUsesResetButton?: boolean;
@@ -1015,8 +1016,6 @@ interface StepperButtonsNoApiProps {
1015
1016
  *
1016
1017
  * @param {Function} nextStepButtonHandler Callback när användaren går till nästa steg.
1017
1018
  *
1018
- * @param {Function} onSubmitHandler Callback när sista steget nås och formuläret ska skickas in.
1019
- *
1020
1019
  * @param {Array} steps Lista över alla steg i formuläret.
1021
1020
  * Används för att räkna ut sista stegnumret.
1022
1021
  *
package/dist/index.d.ts CHANGED
@@ -472,6 +472,8 @@ declare const createFormSlice: (initialState: IFormState, options?: {
472
472
  * Uppdaterar svaret (answer) för en specifik fråga i global state.
473
473
  */
474
474
  updateAnswer: (state: immer.WritableDraft<IFormState>, action: PayloadAction<any>) => void;
475
+ /** Tar bort alla svar (answer) i global state. Används när man startar om formuläret. */
476
+ removeAllAnswers: (state: immer.WritableDraft<IFormState>) => void;
475
477
  /** Uppdaterar filer (files) för en specifik fråga i global state */
476
478
  addFiles: (state: immer.WritableDraft<IFormState>, action: PayloadAction<any>) => void;
477
479
  /**
@@ -994,7 +996,6 @@ interface StepperButtonsNoApiProps {
994
996
  globalLanguageState?: any;
995
997
  changeStepHandler: (activeStep: number) => void;
996
998
  nextStepButtonHandler?: (e: any) => void;
997
- onSubmitHandler?: (e: any) => void;
998
999
  steps?: any[];
999
1000
  activeStep: number;
1000
1001
  appUsesResetButton?: boolean;
@@ -1015,8 +1016,6 @@ interface StepperButtonsNoApiProps {
1015
1016
  *
1016
1017
  * @param {Function} nextStepButtonHandler Callback när användaren går till nästa steg.
1017
1018
  *
1018
- * @param {Function} onSubmitHandler Callback när sista steget nås och formuläret ska skickas in.
1019
- *
1020
1019
  * @param {Array} steps Lista över alla steg i formuläret.
1021
1020
  * Används för att räkna ut sista stegnumret.
1022
1021
  *
package/dist/index.js CHANGED
@@ -2494,6 +2494,13 @@ var createFormSlice = (initialState, options) => {
2494
2494
  answer: action.payload.answer
2495
2495
  }));
2496
2496
  },
2497
+ /** Tar bort alla svar (answer) i global state. Används när man startar om formuläret. */
2498
+ removeAllAnswers: (state) => {
2499
+ state.questions = state.questions.map((qObject) => ({
2500
+ ...qObject,
2501
+ answer: ""
2502
+ }));
2503
+ },
2497
2504
  /** Uppdaterar filer (files) för en specifik fråga i global state */
2498
2505
  addFiles: (state, action) => {
2499
2506
  state.questions = mapQuestionById(state.questions, action.payload.id, (q) => ({
@@ -4192,7 +4199,7 @@ var StepperButtons = ({
4192
4199
  steps,
4193
4200
  activeStep
4194
4201
  }) => {
4195
- const totalSteps = steps ? steps.length : "";
4202
+ const totalSteps = steps ? steps.length : 0;
4196
4203
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "pts-stepperButtons-container", children: [
4197
4204
  activeStep !== 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4198
4205
  "button",
@@ -4268,22 +4275,14 @@ var StepperButtonsNoApi = ({
4268
4275
  globalLanguageState,
4269
4276
  changeStepHandler,
4270
4277
  nextStepButtonHandler,
4271
- onSubmitHandler,
4278
+ //onSubmitHandler,
4272
4279
  steps,
4273
4280
  activeStep,
4274
4281
  appUsesResetButton = true
4275
4282
  }) => {
4276
- const totalSteps = steps ? steps.length : "";
4283
+ const totalSteps = steps ? steps.length : 0;
4277
4284
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "pts-stepperButtons-container", children: [
4278
- activeStep === 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4279
- "button",
4280
- {
4281
- type: "button",
4282
- className: "pts-forwardButton",
4283
- onClick: activeStep !== totalSteps ? nextStepButtonHandler : onSubmitHandler,
4284
- children: activeStep !== totalSteps && globalLanguageState ? globalLanguageState.forwardButton : ""
4285
- }
4286
- ) }),
4285
+ activeStep === 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", className: "pts-forwardButton", onClick: nextStepButtonHandler, children: activeStep !== totalSteps && globalLanguageState ? globalLanguageState.forwardButton : "" }) }),
4287
4286
  activeStep !== 0 && activeStep !== totalSteps && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
4288
4287
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4289
4288
  "button",
@@ -4294,15 +4293,7 @@ var StepperButtonsNoApi = ({
4294
4293
  children: globalLanguageState ? globalLanguageState.backButton : "<<"
4295
4294
  }
4296
4295
  ),
4297
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4298
- "button",
4299
- {
4300
- type: "button",
4301
- className: "pts-forwardButton",
4302
- onClick: activeStep !== totalSteps ? nextStepButtonHandler : onSubmitHandler,
4303
- children: activeStep !== totalSteps && globalLanguageState ? globalLanguageState.forwardButton : ""
4304
- }
4305
- )
4296
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", className: "pts-forwardButton", onClick: nextStepButtonHandler, children: activeStep !== totalSteps && globalLanguageState ? globalLanguageState.forwardButton : "" })
4306
4297
  ] }),
4307
4298
  appUsesResetButton && activeStep === totalSteps && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { onClick: () => changeStepHandler(0), className: "pts-backButton", type: "button", children: globalLanguageState && globalLanguageState.restartButton ? globalLanguageState.restartButton : "Starta om" })
4308
4299
  ] });