@bluemarble/bm-components 1.0.0 → 1.2.0

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.mjs CHANGED
@@ -255,7 +255,7 @@ var require_react_is_development = __commonJS({
255
255
  var ContextProvider = REACT_PROVIDER_TYPE;
256
256
  var Element = REACT_ELEMENT_TYPE;
257
257
  var ForwardRef = REACT_FORWARD_REF_TYPE;
258
- var Fragment = REACT_FRAGMENT_TYPE;
258
+ var Fragment2 = REACT_FRAGMENT_TYPE;
259
259
  var Lazy = REACT_LAZY_TYPE;
260
260
  var Memo = REACT_MEMO_TYPE;
261
261
  var Portal = REACT_PORTAL_TYPE;
@@ -314,7 +314,7 @@ var require_react_is_development = __commonJS({
314
314
  exports.ContextProvider = ContextProvider;
315
315
  exports.Element = Element;
316
316
  exports.ForwardRef = ForwardRef;
317
- exports.Fragment = Fragment;
317
+ exports.Fragment = Fragment2;
318
318
  exports.Lazy = Lazy;
319
319
  exports.Memo = Memo;
320
320
  exports.Portal = Portal;
@@ -3346,11 +3346,12 @@ function FormikSelect(_a) {
3346
3346
  }
3347
3347
 
3348
3348
  // src/components/Autocomplete/index.tsx
3349
- import React13, { useMemo as useMemo2 } from "react";
3349
+ import React13, { Fragment, useMemo as useMemo2 } from "react";
3350
3350
  import { useField as useField2 } from "formik";
3351
3351
  import {
3352
3352
  Autocomplete as MuiAutocomplete,
3353
- TextField as TextField5
3353
+ TextField as TextField5,
3354
+ CircularProgress
3354
3355
  } from "@mui/material";
3355
3356
  function Autocomplete2(_a) {
3356
3357
  var _b = _a, {
@@ -3436,6 +3437,9 @@ function FormikAutocomplete(_a) {
3436
3437
  error: Boolean(meta == null ? void 0 : meta.error),
3437
3438
  helperText: meta == null ? void 0 : meta.error
3438
3439
  }, params), field), {
3440
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
3441
+ endAdornment: /* @__PURE__ */ React13.createElement(Fragment, null, props.loading ? /* @__PURE__ */ React13.createElement(CircularProgress, { color: "inherit", size: 20 }) : null, params.InputProps.endAdornment)
3442
+ }),
3439
3443
  label: props.label
3440
3444
  })
3441
3445
  ),
@@ -3641,7 +3645,7 @@ var FormikRadio = (_a) => {
3641
3645
  import React17 from "react";
3642
3646
  import {
3643
3647
  Button as Button2,
3644
- CircularProgress
3648
+ CircularProgress as CircularProgress2
3645
3649
  } from "@mui/material";
3646
3650
  var LargeButton = (_a) => {
3647
3651
  var _b = _a, {
@@ -3664,7 +3668,7 @@ var LargeButton = (_a) => {
3664
3668
  disabled: rest.disabled || loading
3665
3669
  }, rest),
3666
3670
  loading ? /* @__PURE__ */ React17.createElement(
3667
- CircularProgress,
3671
+ CircularProgress2,
3668
3672
  __spreadValues({
3669
3673
  size: 25,
3670
3674
  color: "inherit"
@@ -3922,7 +3926,7 @@ import {
3922
3926
  DialogActions,
3923
3927
  DialogTitle,
3924
3928
  Button as Button3,
3925
- CircularProgress as CircularProgress2
3929
+ CircularProgress as CircularProgress3
3926
3930
  } from "@mui/material";
3927
3931
  var Dialog = (_a) => {
3928
3932
  var _b = _a, {
@@ -3952,7 +3956,7 @@ var Dialog = (_a) => {
3952
3956
  disableElevation: true,
3953
3957
  disabled: loading
3954
3958
  },
3955
- loading && option.focus ? /* @__PURE__ */ React22.createElement(CircularProgress2, { size: 25, color: "inherit" }) : /* @__PURE__ */ React22.createElement(React22.Fragment, null, option.label)
3959
+ loading && option.focus ? /* @__PURE__ */ React22.createElement(CircularProgress3, { size: 25, color: "inherit" }) : /* @__PURE__ */ React22.createElement(React22.Fragment, null, option.label)
3956
3960
  );
3957
3961
  }))));
3958
3962
  };
@@ -3969,7 +3973,11 @@ var HttpError = class extends Error {
3969
3973
 
3970
3974
  // src/helpers/apiHelper/index.ts
3971
3975
  var ApiHelper = class _ApiHelper {
3972
- onFinally(req) {
3976
+ onFinally(req, res) {
3977
+ return __async(this, null, function* () {
3978
+ });
3979
+ }
3980
+ onError(req, res) {
3973
3981
  return __async(this, null, function* () {
3974
3982
  });
3975
3983
  }
@@ -3977,6 +3985,8 @@ var ApiHelper = class _ApiHelper {
3977
3985
  this.middlewares = ((props == null ? void 0 : props.middlewares) || []).reverse();
3978
3986
  this.onFinally = props.onFinally || (() => __async(this, null, function* () {
3979
3987
  }));
3988
+ this.onError = props.onError || (() => __async(this, null, function* () {
3989
+ }));
3980
3990
  }
3981
3991
  setMiddlewares(middlewares) {
3982
3992
  this.middlewares = middlewares.reverse();
@@ -3998,15 +4008,18 @@ var ApiHelper = class _ApiHelper {
3998
4008
  } catch (error) {
3999
4009
  if (error instanceof HttpError)
4000
4010
  return res.status(error.status).json(error.message);
4001
- if (process.env.NODE_ENV === "production")
4002
- return res.status(500).json({
4011
+ if (process.env.NODE_ENV === "production") {
4012
+ res.status(500).json({
4003
4013
  code: "internal.error",
4004
4014
  error: "Erro interno do servidor",
4005
4015
  details: error
4006
4016
  });
4017
+ return this.onError(req, res);
4018
+ }
4019
+ this.onError(req, res);
4007
4020
  throw new Error(error);
4008
4021
  } finally {
4009
- yield this.onFinally(req);
4022
+ yield this.onFinally(req, res);
4010
4023
  }
4011
4024
  });
4012
4025
  }