@bluemarble/bm-components 1.16.2 → 1.17.2

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
@@ -2404,7 +2404,7 @@ function createBox(options = {}) {
2404
2404
  const BoxRoot = styled("div", {
2405
2405
  shouldForwardProp: (prop) => prop !== "theme" && prop !== "sx" && prop !== "as"
2406
2406
  })(styleFunctionSx_default);
2407
- const Box8 = /* @__PURE__ */ React3.forwardRef(function Box9(inProps, ref) {
2407
+ const Box9 = /* @__PURE__ */ React3.forwardRef(function Box10(inProps, ref) {
2408
2408
  const theme = useTheme_default(defaultTheme);
2409
2409
  const _extendSxProp = extendSxProp(inProps), {
2410
2410
  className,
@@ -2417,7 +2417,7 @@ function createBox(options = {}) {
2417
2417
  theme: themeId ? theme[themeId] || theme : theme
2418
2418
  }, other));
2419
2419
  });
2420
- return Box8;
2420
+ return Box9;
2421
2421
  }
2422
2422
 
2423
2423
  // node_modules/@mui/utils/generateUtilityClass/generateUtilityClass.js
@@ -3992,11 +3992,11 @@ import {
3992
3992
  Modal as MuiModal
3993
3993
  } from "@mui/material";
3994
3994
  var Modal = (_a) => {
3995
- var _b = _a, { open, onClose } = _b, rest = __objRest(_b, ["open", "onClose"]);
3995
+ var _b = _a, { open, onClose, BoxProps: BoxProps3 } = _b, rest = __objRest(_b, ["open", "onClose", "BoxProps"]);
3996
3996
  return /* @__PURE__ */ React22.createElement(MuiModal, __spreadValues({ open, onClose }, rest), /* @__PURE__ */ React22.createElement(
3997
3997
  Box5,
3998
- {
3999
- sx: {
3998
+ __spreadProps(__spreadValues({}, BoxProps3), {
3999
+ sx: __spreadValues({
4000
4000
  outline: "none",
4001
4001
  backgroundColor: "background.paper",
4002
4002
  position: "absolute",
@@ -4004,9 +4004,9 @@ var Modal = (_a) => {
4004
4004
  left: "50%",
4005
4005
  transform: "translate(-50%, -50%)",
4006
4006
  borderRadius: 1
4007
- }
4008
- },
4009
- /* @__PURE__ */ React22.createElement(React22.Fragment, null, rest.children)
4007
+ }, BoxProps3 == null ? void 0 : BoxProps3.sx)
4008
+ }),
4009
+ rest.children
4010
4010
  ));
4011
4011
  };
4012
4012
 
@@ -4157,6 +4157,175 @@ var DialogConfirm = (props) => {
4157
4157
  ))))));
4158
4158
  };
4159
4159
 
4160
+ // src/components/BaseDialog/BaseDialog.tsx
4161
+ import React28 from "react";
4162
+
4163
+ // src/components/BaseDialog/BaseDialogHook.ts
4164
+ import { useContext as useContext2 } from "react";
4165
+
4166
+ // src/components/BaseDialog/BaseDialogContext.tsx
4167
+ import React25 from "react";
4168
+ import { createContext, useCallback, useState as useState5 } from "react";
4169
+ var BaseDialogContext = createContext({});
4170
+ var BaseDialogProvider = (props) => {
4171
+ const [openedDialogs, setOpenedDialogs] = useState5([]);
4172
+ const isOpened = useCallback(
4173
+ (dialog) => {
4174
+ return openedDialogs.includes(dialog);
4175
+ },
4176
+ [openedDialogs]
4177
+ );
4178
+ const toggleDialog = useCallback(
4179
+ (dialog) => {
4180
+ return openedDialogs.includes(dialog);
4181
+ },
4182
+ [openedDialogs]
4183
+ );
4184
+ const openDialog = useCallback((dialog) => {
4185
+ return setOpenedDialogs((prev) => {
4186
+ const filteredArr = prev.filter((item) => item !== dialog);
4187
+ return [...filteredArr, dialog];
4188
+ });
4189
+ }, []);
4190
+ const closeDialog = useCallback((dialog) => {
4191
+ return setOpenedDialogs((prev) => prev.filter((item) => item !== dialog));
4192
+ }, []);
4193
+ const closeAllDialogs = useCallback(() => {
4194
+ return setOpenedDialogs([]);
4195
+ }, [openedDialogs]);
4196
+ return /* @__PURE__ */ React25.createElement(
4197
+ BaseDialogContext.Provider,
4198
+ {
4199
+ value: {
4200
+ opened: openedDialogs,
4201
+ isOpened,
4202
+ toggle: toggleDialog,
4203
+ open: openDialog,
4204
+ closeAll: closeAllDialogs,
4205
+ close: closeDialog
4206
+ }
4207
+ },
4208
+ props.children
4209
+ );
4210
+ };
4211
+
4212
+ // src/components/BaseDialog/BaseDialogInstanceContext.tsx
4213
+ import React26 from "react";
4214
+ import { createContext as createContext2 } from "react";
4215
+ var BaseDialogInstanceContext = createContext2(
4216
+ {}
4217
+ );
4218
+ var BaseDialogInstanceProvider = (props) => {
4219
+ const actions = useBaseDialog();
4220
+ return /* @__PURE__ */ React26.createElement(BaseDialogInstanceContext.Provider, { value: { name: props.name, actions } }, props.children);
4221
+ };
4222
+
4223
+ // src/components/BaseDialog/BaseDialogHook.ts
4224
+ function useBaseDialog() {
4225
+ return useContext2(BaseDialogContext);
4226
+ }
4227
+ function useBaseDialogInstance() {
4228
+ return useContext2(BaseDialogInstanceContext);
4229
+ }
4230
+
4231
+ // src/components/BaseDialog/BaseDialog.tsx
4232
+ import { Box as Box8, Button as Button4 } from "@mui/material";
4233
+
4234
+ // src/components/BaseDialog/BaseDialogHeader.tsx
4235
+ import React27 from "react";
4236
+ import {
4237
+ IconButton as IconButton4,
4238
+ Stack as Stack3,
4239
+ Typography as Typography4
4240
+ } from "@mui/material";
4241
+ import { MdClose as MdClose2 } from "react-icons/md";
4242
+ var BaseDialogHeader = (_a) => {
4243
+ var _b = _a, {
4244
+ title,
4245
+ onClose,
4246
+ IconButtonProps,
4247
+ TypographyProps: TypographyProps2
4248
+ } = _b, props = __objRest(_b, [
4249
+ "title",
4250
+ "onClose",
4251
+ "IconButtonProps",
4252
+ "TypographyProps"
4253
+ ]);
4254
+ const { name } = useBaseDialogInstance();
4255
+ const { close: closeDialog } = useBaseDialog();
4256
+ function handleClose() {
4257
+ if (onClose)
4258
+ return onClose();
4259
+ closeDialog(name);
4260
+ }
4261
+ return /* @__PURE__ */ React27.createElement(
4262
+ Stack3,
4263
+ __spreadValues({
4264
+ direction: "row",
4265
+ alignItems: "center",
4266
+ justifyContent: "space-between",
4267
+ px: 2,
4268
+ my: 1
4269
+ }, props),
4270
+ /* @__PURE__ */ React27.createElement(Typography4, __spreadValues({ variant: "h6", fontWeight: "bold" }, TypographyProps2), title),
4271
+ /* @__PURE__ */ React27.createElement(IconButton4, __spreadProps(__spreadValues({}, IconButtonProps), { onClick: handleClose }), /* @__PURE__ */ React27.createElement(MdClose2, null))
4272
+ );
4273
+ };
4274
+
4275
+ // src/components/BaseDialog/BaseDialog.tsx
4276
+ var BaseDialogContainer = (_a) => {
4277
+ var _b = _a, {
4278
+ children
4279
+ } = _b, rest = __objRest(_b, [
4280
+ "children"
4281
+ ]);
4282
+ const { name } = useBaseDialogInstance();
4283
+ const { isOpened, close: closeDialog } = useBaseDialog();
4284
+ return /* @__PURE__ */ React28.createElement(Modal, __spreadValues({ open: isOpened(name), onClose: () => closeDialog(name) }, rest), children instanceof Function ? children({ close: () => closeDialog(name) }) : children);
4285
+ };
4286
+ var BaseDialogBody = (props) => {
4287
+ return /* @__PURE__ */ React28.createElement(Box8, __spreadValues({ px: 2, pb: 2, width: "100vw", maxWidth: 650 }, props), props.children);
4288
+ };
4289
+ var BaseDialogTrigger = (_a) => {
4290
+ var _b = _a, {
4291
+ name,
4292
+ onClick
4293
+ } = _b, props = __objRest(_b, [
4294
+ "name",
4295
+ "onClick"
4296
+ ]);
4297
+ const { open } = useBaseDialog();
4298
+ return /* @__PURE__ */ React28.createElement(
4299
+ Button4,
4300
+ __spreadProps(__spreadValues({}, props), {
4301
+ onClick: (...params) => {
4302
+ if (onClick)
4303
+ onClick(...params);
4304
+ open(name);
4305
+ }
4306
+ }),
4307
+ props.children
4308
+ );
4309
+ };
4310
+ var BaseDialogCreate = (name = Symbol()) => {
4311
+ return {
4312
+ Trigger: (props) => /* @__PURE__ */ React28.createElement(BaseDialogTrigger, __spreadValues({ name }, props)),
4313
+ Root: (props) => /* @__PURE__ */ React28.createElement(BaseDialogInstanceProvider, __spreadValues({ name }, props)),
4314
+ Container: BaseDialogContainer,
4315
+ Header: BaseDialogHeader,
4316
+ Body: BaseDialogBody
4317
+ };
4318
+ };
4319
+ var BaseDialog = {
4320
+ Create: BaseDialogCreate,
4321
+ Trigger: BaseDialogTrigger,
4322
+ Provider: BaseDialogProvider,
4323
+ Root: BaseDialogInstanceProvider,
4324
+ Container: BaseDialogContainer,
4325
+ Header: BaseDialogHeader,
4326
+ Body: BaseDialogBody
4327
+ };
4328
+
4160
4329
  // src/errors/HttpError.ts
4161
4330
  var HttpError = class extends Error {
4162
4331
  constructor(status, message) {
@@ -4270,21 +4439,21 @@ var ApiHelper = class _ApiHelper {
4270
4439
  };
4271
4440
 
4272
4441
  // src/hooks/useFormHelper.ts
4273
- import { useCallback as useCallback3, useContext as useContext3, useEffect as useEffect4, useRef as useRef4 } from "react";
4442
+ import { useCallback as useCallback4, useContext as useContext4, useEffect as useEffect4, useRef as useRef4 } from "react";
4274
4443
 
4275
4444
  // src/hooks/useAlert.ts
4276
- import { useContext as useContext2 } from "react";
4445
+ import { useContext as useContext3 } from "react";
4277
4446
 
4278
4447
  // src/contexts/AlertContext.tsx
4279
- import React26, { useCallback } from "react";
4280
- import { createContext, useState as useState5 } from "react";
4448
+ import React30, { useCallback as useCallback2 } from "react";
4449
+ import { createContext as createContext3, useState as useState6 } from "react";
4281
4450
 
4282
4451
  // src/components/Toast/index.tsx
4283
- import React25 from "react";
4284
- import { Alert, IconButton as IconButton4, Snackbar } from "@mui/material";
4285
- import { MdClose as MdClose2 } from "react-icons/md";
4452
+ import React29 from "react";
4453
+ import { Alert, IconButton as IconButton5, Snackbar } from "@mui/material";
4454
+ import { MdClose as MdClose3 } from "react-icons/md";
4286
4455
  var Toast = ({ open, onClose, severity, message }) => {
4287
- return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
4456
+ return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
4288
4457
  Snackbar,
4289
4458
  {
4290
4459
  open,
@@ -4293,20 +4462,20 @@ var Toast = ({ open, onClose, severity, message }) => {
4293
4462
  anchorOrigin: { vertical: "top", horizontal: "right" },
4294
4463
  sx: { zIndex: 99999999 }
4295
4464
  },
4296
- /* @__PURE__ */ React25.createElement(
4465
+ /* @__PURE__ */ React29.createElement(
4297
4466
  Alert,
4298
4467
  {
4299
4468
  severity,
4300
4469
  elevation: 2,
4301
- action: /* @__PURE__ */ React25.createElement(
4302
- IconButton4,
4470
+ action: /* @__PURE__ */ React29.createElement(
4471
+ IconButton5,
4303
4472
  {
4304
4473
  "aria-label": "close",
4305
4474
  color: "inherit",
4306
4475
  size: "small",
4307
4476
  onClick: onClose
4308
4477
  },
4309
- /* @__PURE__ */ React25.createElement(MdClose2, { fontSize: "inherit" })
4478
+ /* @__PURE__ */ React29.createElement(MdClose3, { fontSize: "inherit" })
4310
4479
  )
4311
4480
  },
4312
4481
  message
@@ -4315,12 +4484,12 @@ var Toast = ({ open, onClose, severity, message }) => {
4315
4484
  };
4316
4485
 
4317
4486
  // src/contexts/AlertContext.tsx
4318
- var AlertContext = createContext({});
4487
+ var AlertContext = createContext3({});
4319
4488
  var AlertProvider = ({ children }) => {
4320
- const [severity, setSeverity] = useState5("info");
4321
- const [message, setMessage] = useState5("");
4322
- const [isVisible, setIsVisible] = useState5(false);
4323
- const createAlert = useCallback(
4489
+ const [severity, setSeverity] = useState6("info");
4490
+ const [message, setMessage] = useState6("");
4491
+ const [isVisible, setIsVisible] = useState6(false);
4492
+ const createAlert = useCallback2(
4324
4493
  (newMessage, severity2) => {
4325
4494
  setMessage(newMessage);
4326
4495
  setSeverity(severity2);
@@ -4328,10 +4497,10 @@ var AlertProvider = ({ children }) => {
4328
4497
  },
4329
4498
  []
4330
4499
  );
4331
- const onCloseToast = useCallback(() => {
4500
+ const onCloseToast = useCallback2(() => {
4332
4501
  setIsVisible(false);
4333
4502
  }, []);
4334
- return /* @__PURE__ */ React26.createElement(AlertContext.Provider, { value: { createAlert } }, children, /* @__PURE__ */ React26.createElement(
4503
+ return /* @__PURE__ */ React30.createElement(AlertContext.Provider, { value: { createAlert } }, children, /* @__PURE__ */ React30.createElement(
4335
4504
  Toast,
4336
4505
  {
4337
4506
  open: isVisible,
@@ -4344,15 +4513,15 @@ var AlertProvider = ({ children }) => {
4344
4513
 
4345
4514
  // src/hooks/useAlert.ts
4346
4515
  var useAlert = () => {
4347
- return useContext2(AlertContext);
4516
+ return useContext3(AlertContext);
4348
4517
  };
4349
4518
 
4350
4519
  // src/hooks/useLoading.ts
4351
- import { useCallback as useCallback2, useState as useState6 } from "react";
4520
+ import { useCallback as useCallback3, useState as useState7 } from "react";
4352
4521
  function useLoading() {
4353
- const [state, setState] = useState6([]);
4354
- const isLoading = useCallback2((prop) => state.includes(prop), [state]);
4355
- const setLoading = useCallback2((prop, remove) => {
4522
+ const [state, setState] = useState7([]);
4523
+ const isLoading = useCallback3((prop) => state.includes(prop), [state]);
4524
+ const setLoading = useCallback3((prop, remove) => {
4356
4525
  if (remove)
4357
4526
  setState((prevState) => prevState.filter((state2) => state2 !== prop));
4358
4527
  else
@@ -4362,22 +4531,22 @@ function useLoading() {
4362
4531
  }
4363
4532
 
4364
4533
  // src/contexts/FormHelperProvider.tsx
4365
- import React27 from "react";
4366
- import { createContext as createContext2 } from "react";
4367
- var FormHelperContext = createContext2({});
4534
+ import React31 from "react";
4535
+ import { createContext as createContext4 } from "react";
4536
+ var FormHelperContext = createContext4({});
4368
4537
  var FormHelperProvider = ({ formatErrorMessage, api, children }) => {
4369
- return /* @__PURE__ */ React27.createElement(FormHelperContext.Provider, { value: { formatErrorMessage, api } }, children);
4538
+ return /* @__PURE__ */ React31.createElement(FormHelperContext.Provider, { value: { formatErrorMessage, api } }, children);
4370
4539
  };
4371
4540
 
4372
4541
  // src/hooks/useFormHelper.ts
4373
4542
  function useFormHelper() {
4374
4543
  const alertProps = useAlert();
4375
4544
  const loadingProps = useLoading();
4376
- const { api, formatErrorMessage } = useContext3(FormHelperContext);
4545
+ const { api, formatErrorMessage } = useContext4(FormHelperContext);
4377
4546
  const { createAlert } = alertProps;
4378
4547
  const { setLoading } = loadingProps;
4379
4548
  const sourceRef = useRef4(new AbortController());
4380
- const onSubmitWrapper = useCallback3(
4549
+ const onSubmitWrapper = useCallback4(
4381
4550
  (fn, { name }) => {
4382
4551
  return (fields, methods) => __async(this, null, function* () {
4383
4552
  const LOADING_NAME = name;
@@ -4393,7 +4562,7 @@ function useFormHelper() {
4393
4562
  },
4394
4563
  [setLoading]
4395
4564
  );
4396
- const onRequestWrapper = useCallback3(
4565
+ const onRequestWrapper = useCallback4(
4397
4566
  (fn, { name }) => {
4398
4567
  return (...params) => __async(this, null, function* () {
4399
4568
  const LOADING_NAME = name;
@@ -4421,7 +4590,7 @@ function useFormHelper() {
4421
4590
  },
4422
4591
  [setLoading, api]
4423
4592
  );
4424
- const errorHandler = useCallback3(
4593
+ const errorHandler = useCallback4(
4425
4594
  (error, callback) => {
4426
4595
  if ((error == null ? void 0 : error.message) === "cancel.navigation")
4427
4596
  return;
@@ -4454,55 +4623,7 @@ function useFormHelper() {
4454
4623
  // src/helpers/authHelper.ts
4455
4624
  import { serialize } from "cookie";
4456
4625
  import { parseCookies, setCookie } from "nookies";
4457
-
4458
- // node_modules/uuid/dist/esm-node/rng.js
4459
- import crypto from "crypto";
4460
- var rnds8Pool = new Uint8Array(256);
4461
- var poolPtr = rnds8Pool.length;
4462
- function rng() {
4463
- if (poolPtr > rnds8Pool.length - 16) {
4464
- crypto.randomFillSync(rnds8Pool);
4465
- poolPtr = 0;
4466
- }
4467
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
4468
- }
4469
-
4470
- // node_modules/uuid/dist/esm-node/stringify.js
4471
- var byteToHex = [];
4472
- for (let i = 0; i < 256; ++i) {
4473
- byteToHex.push((i + 256).toString(16).slice(1));
4474
- }
4475
- function unsafeStringify(arr, offset = 0) {
4476
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
4477
- }
4478
-
4479
- // node_modules/uuid/dist/esm-node/native.js
4480
- import crypto2 from "crypto";
4481
- var native_default = {
4482
- randomUUID: crypto2.randomUUID
4483
- };
4484
-
4485
- // node_modules/uuid/dist/esm-node/v4.js
4486
- function v4(options, buf, offset) {
4487
- if (native_default.randomUUID && !buf && !options) {
4488
- return native_default.randomUUID();
4489
- }
4490
- options = options || {};
4491
- const rnds = options.random || (options.rng || rng)();
4492
- rnds[6] = rnds[6] & 15 | 64;
4493
- rnds[8] = rnds[8] & 63 | 128;
4494
- if (buf) {
4495
- offset = offset || 0;
4496
- for (let i = 0; i < 16; ++i) {
4497
- buf[offset + i] = rnds[i];
4498
- }
4499
- return buf;
4500
- }
4501
- return unsafeStringify(rnds);
4502
- }
4503
- var v4_default = v4;
4504
-
4505
- // src/helpers/authHelper.ts
4626
+ import { v4 as uuid } from "uuid";
4506
4627
  import jwt from "jsonwebtoken";
4507
4628
  function decodeSessionToken({
4508
4629
  req,
@@ -4547,7 +4668,7 @@ var AuthHelper = class {
4547
4668
  expiresIn: this.tokenExpTimeInSeconds || 60 * 15
4548
4669
  // 15 minutos
4549
4670
  });
4550
- const uniqueToken = v4_default();
4671
+ const uniqueToken = uuid();
4551
4672
  yield this.onCreateRefreshToken(userId, uniqueToken);
4552
4673
  return {
4553
4674
  token,
@@ -4775,11 +4896,11 @@ var AuthHelper = class {
4775
4896
  };
4776
4897
 
4777
4898
  // src/hooks/useGrid.ts
4778
- import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo3, useState as useState8 } from "react";
4899
+ import { useCallback as useCallback6, useEffect as useEffect5, useMemo as useMemo3, useState as useState9 } from "react";
4779
4900
 
4780
4901
  // src/hooks/useFilter.ts
4781
4902
  import moment2 from "moment";
4782
- import { useCallback as useCallback4, useState as useState7 } from "react";
4903
+ import { useCallback as useCallback5, useState as useState8 } from "react";
4783
4904
 
4784
4905
  // src/components/utils/getObjectValue.ts
4785
4906
  function getObjectValue(obj) {
@@ -4794,11 +4915,11 @@ function getObjectValue(obj) {
4794
4915
 
4795
4916
  // src/hooks/useFilter.ts
4796
4917
  function useFilter(props = { defaultFilters: [] }) {
4797
- const [selectedFilters, setSelectedFilters] = useState7(() => {
4918
+ const [selectedFilters, setSelectedFilters] = useState8(() => {
4798
4919
  const { defaultFilters } = props;
4799
4920
  return defaultFilters || [];
4800
4921
  });
4801
- const filterBy = useCallback4((newFilter) => {
4922
+ const filterBy = useCallback5((newFilter) => {
4802
4923
  const propToCompare = (newFilter == null ? void 0 : newFilter.id) ? "id" : "prop";
4803
4924
  function removeRepeatedFilters(filter) {
4804
4925
  return filter[propToCompare] !== newFilter[propToCompare];
@@ -4808,7 +4929,7 @@ function useFilter(props = { defaultFilters: [] }) {
4808
4929
  newFilter
4809
4930
  ]);
4810
4931
  }, []);
4811
- const removeFilter = useCallback4(
4932
+ const removeFilter = useCallback5(
4812
4933
  (prop, isId) => {
4813
4934
  const propToCompare = isId ? "id" : "prop";
4814
4935
  setSelectedFilters(
@@ -4885,13 +5006,13 @@ function useGrid({
4885
5006
  defaultCurrentPage,
4886
5007
  defaultSortedBy
4887
5008
  }) {
4888
- const [defaultData, setDefaultData] = useState8(externalDefaultData || []);
4889
- const [sortedBy, setSortedBy] = useState8(
5009
+ const [defaultData, setDefaultData] = useState9(externalDefaultData || []);
5010
+ const [sortedBy, setSortedBy] = useState9(
4890
5011
  defaultSortedBy || []
4891
5012
  );
4892
- const [currentPage, setCurrentPage] = useState8(defaultCurrentPage || 0);
4893
- const [rowsPerPage, setRowsPerPage] = useState8(rowsPerPageOptions[0]);
4894
- const toggleSortedDirection = useCallback5(
5013
+ const [currentPage, setCurrentPage] = useState9(defaultCurrentPage || 0);
5014
+ const [rowsPerPage, setRowsPerPage] = useState9(rowsPerPageOptions[0]);
5015
+ const toggleSortedDirection = useCallback6(
4895
5016
  (direction) => {
4896
5017
  if (direction === "asc")
4897
5018
  return "desc";
@@ -4899,16 +5020,16 @@ function useGrid({
4899
5020
  },
4900
5021
  []
4901
5022
  );
4902
- const clearSort = useCallback5(() => {
5023
+ const clearSort = useCallback6(() => {
4903
5024
  setSortedBy([]);
4904
5025
  }, []);
4905
- const appendSort = useCallback5((prop, direction) => {
5026
+ const appendSort = useCallback6((prop, direction) => {
4906
5027
  setSortedBy((prev) => [...prev, { prop, direction }]);
4907
5028
  }, []);
4908
- const setSort = useCallback5((prop, direction) => {
5029
+ const setSort = useCallback6((prop, direction) => {
4909
5030
  setSortedBy([{ prop, direction }]);
4910
5031
  }, []);
4911
- const onSortBy = useCallback5(
5032
+ const onSortBy = useCallback6(
4912
5033
  (prop) => {
4913
5034
  if (!prop)
4914
5035
  return;
@@ -4935,10 +5056,10 @@ function useGrid({
4935
5056
  },
4936
5057
  [toggleSortedDirection, sortedBy]
4937
5058
  );
4938
- const set = useCallback5((data) => {
5059
+ const set = useCallback6((data) => {
4939
5060
  setDefaultData(data);
4940
5061
  }, []);
4941
- const sortData = useCallback5(
5062
+ const sortData = useCallback6(
4942
5063
  (data) => {
4943
5064
  if (sortedBy.length > 0) {
4944
5065
  const symbolDir = {
@@ -4961,7 +5082,7 @@ function useGrid({
4961
5082
  return;
4962
5083
  setCurrentPage(pageNumber);
4963
5084
  };
4964
- const onChangeRowsPerPage = useCallback5(
5085
+ const onChangeRowsPerPage = useCallback6(
4965
5086
  (rows) => {
4966
5087
  let totalNumberOfPages2 = Math.round(filteredData.length / rows) - 1;
4967
5088
  totalNumberOfPages2 = totalNumberOfPages2 <= 0 ? 0 : 1;
@@ -5057,7 +5178,7 @@ function createSearch(options) {
5057
5178
  }
5058
5179
 
5059
5180
  // src/hooks/useAsyncGrid.ts
5060
- import { useCallback as useCallback6, useEffect as useEffect6, useState as useState9 } from "react";
5181
+ import { useCallback as useCallback7, useEffect as useEffect6, useState as useState10 } from "react";
5061
5182
  function useAsyncGrid({
5062
5183
  columns,
5063
5184
  filters = [],
@@ -5070,16 +5191,16 @@ function useAsyncGrid({
5070
5191
  defaultCurrentPage,
5071
5192
  defaultSortedBy
5072
5193
  }) {
5073
- const [defaultData, setDefaultData] = useState9(externalDefaultData || []);
5074
- const [sortedBy, setSortedBy] = useState9(
5194
+ const [defaultData, setDefaultData] = useState10(externalDefaultData || []);
5195
+ const [sortedBy, setSortedBy] = useState10(
5075
5196
  defaultSortedBy || []
5076
5197
  );
5077
- const [totalNumberOfItems, setTotalNumberOfItems] = useState9(0);
5078
- const [isLoading, setIsLoading] = useState9(false);
5079
- const [currentPage, setCurrentPage] = useState9(defaultCurrentPage || 0);
5080
- const [rowsPerPage, setRowsPerPage] = useState9(rowsPerPageOptions[0]);
5198
+ const [totalNumberOfItems, setTotalNumberOfItems] = useState10(0);
5199
+ const [isLoading, setIsLoading] = useState10(false);
5200
+ const [currentPage, setCurrentPage] = useState10(defaultCurrentPage || 0);
5201
+ const [rowsPerPage, setRowsPerPage] = useState10(rowsPerPageOptions[0]);
5081
5202
  const totalNumberOfPages = Math.ceil(totalNumberOfItems / rowsPerPage) - 1;
5082
- const toggleSortedDirection = useCallback6(
5203
+ const toggleSortedDirection = useCallback7(
5083
5204
  (direction) => {
5084
5205
  if (direction === "asc")
5085
5206
  return "desc";
@@ -5087,10 +5208,10 @@ function useAsyncGrid({
5087
5208
  },
5088
5209
  []
5089
5210
  );
5090
- const setSort = useCallback6((prop, direction) => {
5211
+ const setSort = useCallback7((prop, direction) => {
5091
5212
  setSortedBy((prev) => [...prev, { prop, direction }]);
5092
5213
  }, []);
5093
- const onSortBy = useCallback6(
5214
+ const onSortBy = useCallback7(
5094
5215
  (prop) => __async(this, null, function* () {
5095
5216
  if (!prop)
5096
5217
  return;
@@ -5120,10 +5241,10 @@ function useAsyncGrid({
5120
5241
  }),
5121
5242
  [sortedBy, toggleSortedDirection, rowsPerPage, currentPage]
5122
5243
  );
5123
- const set = useCallback6((data) => {
5244
+ const set = useCallback7((data) => {
5124
5245
  setDefaultData(data);
5125
5246
  }, []);
5126
- const baseRequest = useCallback6(
5247
+ const baseRequest = useCallback7(
5127
5248
  (_0) => __async(this, [_0], function* ({
5128
5249
  page,
5129
5250
  search: search2,
@@ -5153,7 +5274,7 @@ function useAsyncGrid({
5153
5274
  }),
5154
5275
  [axiosInstance, url]
5155
5276
  );
5156
- const updateGridContent = useCallback6(
5277
+ const updateGridContent = useCallback7(
5157
5278
  (_0) => __async(this, [_0], function* ({
5158
5279
  page,
5159
5280
  sortedBy: sortedBy2,
@@ -5179,7 +5300,7 @@ function useAsyncGrid({
5179
5300
  }),
5180
5301
  [set, search, filters, onRequest, baseRequest]
5181
5302
  );
5182
- const onPageChange = useCallback6(
5303
+ const onPageChange = useCallback7(
5183
5304
  (pageNumber) => {
5184
5305
  if (pageNumber < 0)
5185
5306
  return;
@@ -5189,7 +5310,7 @@ function useAsyncGrid({
5189
5310
  },
5190
5311
  [updateGridContent, totalNumberOfPages, sortedBy, rowsPerPage]
5191
5312
  );
5192
- const onChangeRowsPerPage = useCallback6(
5313
+ const onChangeRowsPerPage = useCallback7(
5193
5314
  (rows) => {
5194
5315
  let totalNumberOfPages2 = Math.round(totalNumberOfItems / rows) - 1;
5195
5316
  totalNumberOfPages2 = totalNumberOfPages2 <= 0 ? 0 : 1;
@@ -5242,15 +5363,15 @@ function useEvent(event, handler, passive = false) {
5242
5363
  }
5243
5364
 
5244
5365
  // src/contexts/AuthContext.tsx
5245
- import React28, { useCallback as useCallback7 } from "react";
5366
+ import React32, { useCallback as useCallback8 } from "react";
5246
5367
  import {
5247
- createContext as createContext3,
5368
+ createContext as createContext5,
5248
5369
  useEffect as useEffect8,
5249
- useState as useState10
5370
+ useState as useState11
5250
5371
  } from "react";
5251
5372
  import { parseCookies as parseCookies2 } from "nookies";
5252
5373
  function createAuthContext() {
5253
- return createContext3({});
5374
+ return createContext5({});
5254
5375
  }
5255
5376
  function CreateAuthProvider({
5256
5377
  api,
@@ -5258,10 +5379,10 @@ function CreateAuthProvider({
5258
5379
  sessionTokenName,
5259
5380
  Provider
5260
5381
  }) {
5261
- const [user, setUser] = useState10();
5262
- const [status, setStatus] = useState10("unauthenticated");
5382
+ const [user, setUser] = useState11();
5383
+ const [status, setStatus] = useState11("unauthenticated");
5263
5384
  const { createAlert } = useAlert();
5264
- const signIn = useCallback7(
5385
+ const signIn = useCallback8(
5265
5386
  (_0) => __async(this, [_0], function* ({ email, password }) {
5266
5387
  var _a, _b;
5267
5388
  setStatus("loading");
@@ -5284,7 +5405,7 @@ function CreateAuthProvider({
5284
5405
  }),
5285
5406
  [createAlert, api]
5286
5407
  );
5287
- const ClientSignOut = useCallback7(() => __async(this, null, function* () {
5408
+ const ClientSignOut = useCallback8(() => __async(this, null, function* () {
5288
5409
  yield api.get("/auth/logout");
5289
5410
  setUser(void 0);
5290
5411
  }), [api]);
@@ -5300,7 +5421,7 @@ function CreateAuthProvider({
5300
5421
  });
5301
5422
  }
5302
5423
  }, [api, sessionTokenName]);
5303
- return /* @__PURE__ */ React28.createElement(
5424
+ return /* @__PURE__ */ React32.createElement(
5304
5425
  Provider,
5305
5426
  {
5306
5427
  value: {
@@ -5319,6 +5440,11 @@ export {
5319
5440
  ApiHelper,
5320
5441
  AuthHelper,
5321
5442
  Autocomplete2 as Autocomplete,
5443
+ BaseDialog,
5444
+ BaseDialogBody,
5445
+ BaseDialogContainer,
5446
+ BaseDialogCreate,
5447
+ BaseDialogTrigger,
5322
5448
  BaseGrid,
5323
5449
  BaseGridAutoRows,
5324
5450
  Checkbox,
@@ -5349,6 +5475,8 @@ export {
5349
5475
  getTabProps,
5350
5476
  useAlert,
5351
5477
  useAsyncGrid,
5478
+ useBaseDialog,
5479
+ useBaseDialogInstance,
5352
5480
  useEvent,
5353
5481
  useFilter,
5354
5482
  useFormHelper,