@bluemarble/bm-components 1.1.0 → 1.3.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
  };
@@ -3968,6 +3972,17 @@ var HttpError = class extends Error {
3968
3972
  };
3969
3973
 
3970
3974
  // src/helpers/apiHelper/index.ts
3975
+ var VALID_METHODS = [
3976
+ "GET",
3977
+ "HEAD",
3978
+ "POST",
3979
+ "PUT",
3980
+ "DELETE",
3981
+ "CONNECT",
3982
+ "OPTIONS",
3983
+ "TRACE",
3984
+ "PATCH"
3985
+ ];
3971
3986
  var ApiHelper = class _ApiHelper {
3972
3987
  onFinally(req, res) {
3973
3988
  return __async(this, null, function* () {
@@ -3979,9 +3994,9 @@ var ApiHelper = class _ApiHelper {
3979
3994
  }
3980
3995
  constructor(props) {
3981
3996
  this.middlewares = ((props == null ? void 0 : props.middlewares) || []).reverse();
3982
- this.onFinally = props.onFinally || (() => __async(this, null, function* () {
3997
+ this.onFinally = (props == null ? void 0 : props.onFinally) || (() => __async(this, null, function* () {
3983
3998
  }));
3984
- this.onError = props.onError || (() => __async(this, null, function* () {
3999
+ this.onError = (props == null ? void 0 : props.onError) || (() => __async(this, null, function* () {
3985
4000
  }));
3986
4001
  }
3987
4002
  setMiddlewares(middlewares) {
@@ -3990,12 +4005,14 @@ var ApiHelper = class _ApiHelper {
3990
4005
  }
3991
4006
  createMethods(methods) {
3992
4007
  return (req, res) => __async(this, null, function* () {
3993
- const currentMethod = methods[req.method];
4008
+ const currentMethod = methods[req.method] || methods.ALL;
3994
4009
  if (req.method === "OPTIONS")
3995
4010
  return res.status(200).end();
3996
4011
  try {
3997
- if (!currentMethod)
4012
+ if (!VALID_METHODS.includes(req.method))
3998
4013
  throw new HttpError(405, "M\xE9todo inv\xE1lido");
4014
+ if (!currentMethod)
4015
+ throw new HttpError(500, "M\xE9todo n\xE3o encontrado");
3999
4016
  const methodWithMiddlewares = this.middlewares.reduce(
4000
4017
  (acc, fn) => fn(acc),
4001
4018
  currentMethod