aport-tools 4.4.5 → 4.4.6
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.esm.js +9 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
    
        package/dist/index.js
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            /*! aport-tools v4.4. | 
| 1 | 
            +
            /*! aport-tools v4.4.6 | ISC */
         | 
| 2 2 | 
             
            'use strict';
         | 
| 3 3 |  | 
| 4 4 | 
             
            var React = require('react');
         | 
| @@ -209,6 +209,9 @@ var Stepper = function Stepper(_a) { | |
| 209 209 | 
             
              var _e = useFormContext(),
         | 
| 210 210 | 
             
                formValues = _e.formValues,
         | 
| 211 211 | 
             
                handleFormSubmit = _e.handleFormSubmit;
         | 
| 212 | 
            +
              var _f = React.useState(false),
         | 
| 213 | 
            +
                errorBack = _f[0],
         | 
| 214 | 
            +
                seterrorBack = _f[1];
         | 
| 212 215 | 
             
              var handleStepPress = function handleStepPress(stepIndex) {
         | 
| 213 216 | 
             
                return __awaiter(void 0, void 0, void 0, function () {
         | 
| 214 217 | 
             
                  var errors;
         | 
| @@ -216,13 +219,17 @@ var Stepper = function Stepper(_a) { | |
| 216 219 | 
             
                    switch (_a.label) {
         | 
| 217 220 | 
             
                      case 0:
         | 
| 218 221 | 
             
                        if (!presseable || stepIndex === currentStep) return [2 /*return*/];
         | 
| 222 | 
            +
                        if (!(stepIndex > currentStep)) return [3 /*break*/, 2];
         | 
| 219 223 | 
             
                        return [4 /*yield*/, handleFormSubmit(formValues)];
         | 
| 220 224 | 
             
                      case 1:
         | 
| 221 225 | 
             
                        errors = _a.sent();
         | 
| 222 226 | 
             
                        if (Object.keys(errors).length > 0) {
         | 
| 223 227 | 
             
                          console.log("Validation failed. Cannot proceed to step", stepIndex);
         | 
| 228 | 
            +
                          seterrorBack(true);
         | 
| 224 229 | 
             
                          return [2 /*return*/]; // Prevent step change
         | 
| 225 230 | 
             
                        }
         | 
| 231 | 
            +
                        _a.label = 2;
         | 
| 232 | 
            +
                      case 2:
         | 
| 226 233 | 
             
                        // Proceed to change step
         | 
| 227 234 | 
             
                        onPress === null || onPress === void 0 ? void 0 : onPress(stepIndex);
         | 
| 228 235 | 
             
                        return [2 /*return*/];
         | 
| @@ -320,7 +327,7 @@ var Stepper = function Stepper(_a) { | |
| 320 327 | 
             
                  }
         | 
| 321 328 | 
             
                }, /*#__PURE__*/React.createElement(reactNative.View, {
         | 
| 322 329 | 
             
                  style: [styles$9.step, stepStyle === "square" && styles$9.squareStep, {
         | 
| 323 | 
            -
                    backgroundColor: currentStep >= index ? colors.primary.hex : colors.body.hex
         | 
| 330 | 
            +
                    backgroundColor: !errorBack ? currentStep >= index ? colors.primary.hex : colors.body.hex : colors.error.hex
         | 
| 324 331 | 
             
                  }]
         | 
| 325 332 | 
             
                }, renderStepContent(index)), steps && /*#__PURE__*/React.createElement(Text, {
         | 
| 326 333 | 
             
                  style: styles$9.stepText
         |