@bluemarble/bm-components 1.10.1 → 1.10.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.js +61 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3348,7 +3348,8 @@ function FormikSelect(_a) {
|
|
|
3348
3348
|
// src/components/Autocomplete/index.tsx
|
|
3349
3349
|
import React13, {
|
|
3350
3350
|
Fragment,
|
|
3351
|
-
useMemo as useMemo2
|
|
3351
|
+
useMemo as useMemo2,
|
|
3352
|
+
useState as useState3
|
|
3352
3353
|
} from "react";
|
|
3353
3354
|
import { useField as useField2 } from "formik";
|
|
3354
3355
|
import {
|
|
@@ -3368,8 +3369,22 @@ function Autocomplete2(_a) {
|
|
|
3368
3369
|
"getOptionValue"
|
|
3369
3370
|
]);
|
|
3370
3371
|
if (withFormik) {
|
|
3372
|
+
const theme = useTheme3();
|
|
3373
|
+
const isLegacyBehaviorDisabledTheme = useMemo2(() => {
|
|
3374
|
+
var _a2, _b2, _c;
|
|
3375
|
+
return ((_c = (_b2 = (_a2 = theme.components) == null ? void 0 : _a2.MuiAutocomplete) == null ? void 0 : _b2.defaultProps) == null ? void 0 : _c["data-legacy-behavior"]) === "disabled";
|
|
3376
|
+
}, [theme]);
|
|
3377
|
+
const isLegacyBehaviorDisabled = typeof (rest == null ? void 0 : rest["data-legacy-behavior"]) !== "undefined" ? rest["data-legacy-behavior"] === "disabled" : isLegacyBehaviorDisabledTheme;
|
|
3378
|
+
if (isLegacyBehaviorDisabled)
|
|
3379
|
+
return /* @__PURE__ */ React13.createElement(
|
|
3380
|
+
FormikAutocomplete,
|
|
3381
|
+
__spreadValues({
|
|
3382
|
+
name,
|
|
3383
|
+
getOptionValue
|
|
3384
|
+
}, rest)
|
|
3385
|
+
);
|
|
3371
3386
|
return /* @__PURE__ */ React13.createElement(
|
|
3372
|
-
|
|
3387
|
+
FormikAutocompleteLegacy,
|
|
3373
3388
|
__spreadValues({
|
|
3374
3389
|
name,
|
|
3375
3390
|
getOptionValue
|
|
@@ -3387,7 +3402,7 @@ function BaseInput2(props) {
|
|
|
3387
3402
|
}, props)
|
|
3388
3403
|
);
|
|
3389
3404
|
}
|
|
3390
|
-
function
|
|
3405
|
+
function FormikAutocompleteLegacy(_a) {
|
|
3391
3406
|
var _b = _a, {
|
|
3392
3407
|
getOptionValue,
|
|
3393
3408
|
option
|
|
@@ -3398,22 +3413,14 @@ function FormikAutocomplete(_a) {
|
|
|
3398
3413
|
const [_a2, ..._b2] = useField2({
|
|
3399
3414
|
name: props.name
|
|
3400
3415
|
}), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
|
|
3401
|
-
const theme = useTheme3();
|
|
3402
|
-
const isLegacyBehaviorDisabledTheme = useMemo2(() => {
|
|
3403
|
-
var _a3, _b3, _c2;
|
|
3404
|
-
return ((_c2 = (_b3 = (_a3 = theme.components) == null ? void 0 : _a3.MuiAutocomplete) == null ? void 0 : _b3.defaultProps) == null ? void 0 : _c2["data-legacy-behavior"]) === "disabled";
|
|
3405
|
-
}, [theme]);
|
|
3406
|
-
const isLegacyBehaviorDisabled = typeof (props == null ? void 0 : props["data-legacy-behavior"]) !== "undefined" ? props["data-legacy-behavior"] === "disabled" : isLegacyBehaviorDisabledTheme;
|
|
3407
3416
|
const defaultOption = useMemo2(() => {
|
|
3408
|
-
if (!option && isLegacyBehaviorDisabled)
|
|
3409
|
-
return value;
|
|
3410
3417
|
const key = option == null ? void 0 : option.key;
|
|
3411
3418
|
if (key)
|
|
3412
3419
|
return props.options.find((option2) => option2[key] === value);
|
|
3413
3420
|
return props.options.find(
|
|
3414
3421
|
(option2) => Object.values(option2)[0] === value
|
|
3415
3422
|
);
|
|
3416
|
-
}, [value, option, props.options.find
|
|
3423
|
+
}, [value, option, props.options.find]);
|
|
3417
3424
|
const onChange = (_, newValue) => {
|
|
3418
3425
|
const value2 = option == null ? void 0 : option.value;
|
|
3419
3426
|
if (getOptionValue) {
|
|
@@ -3462,6 +3469,49 @@ function FormikAutocomplete(_a) {
|
|
|
3462
3469
|
}, props)
|
|
3463
3470
|
);
|
|
3464
3471
|
}
|
|
3472
|
+
function FormikAutocomplete(_a) {
|
|
3473
|
+
var _b = _a, {
|
|
3474
|
+
getOptionValue,
|
|
3475
|
+
option
|
|
3476
|
+
} = _b, props = __objRest(_b, [
|
|
3477
|
+
"getOptionValue",
|
|
3478
|
+
"option"
|
|
3479
|
+
]);
|
|
3480
|
+
const [_a2, ..._b2] = useField2({
|
|
3481
|
+
name: props.name
|
|
3482
|
+
}), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
|
|
3483
|
+
const [defaultValue] = useState3(value);
|
|
3484
|
+
const onChange = (_, newValue) => {
|
|
3485
|
+
const value2 = option == null ? void 0 : option.value;
|
|
3486
|
+
if (getOptionValue) {
|
|
3487
|
+
setValue(getOptionValue(newValue));
|
|
3488
|
+
} else if (value2) {
|
|
3489
|
+
setValue(newValue[value2]);
|
|
3490
|
+
} else
|
|
3491
|
+
setValue(newValue);
|
|
3492
|
+
};
|
|
3493
|
+
return /* @__PURE__ */ React13.createElement(
|
|
3494
|
+
MuiAutocomplete,
|
|
3495
|
+
__spreadValues({
|
|
3496
|
+
renderInput: (params) => /* @__PURE__ */ React13.createElement(
|
|
3497
|
+
TextField5,
|
|
3498
|
+
__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
3499
|
+
error: Boolean(meta == null ? void 0 : meta.error),
|
|
3500
|
+
helperText: meta == null ? void 0 : meta.error
|
|
3501
|
+
}, params), field), {
|
|
3502
|
+
InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
|
|
3503
|
+
endAdornment: /* @__PURE__ */ React13.createElement(Fragment, null, props.loading ? /* @__PURE__ */ React13.createElement(CircularProgress, { color: "inherit", size: 20 }) : null, params.InputProps.endAdornment)
|
|
3504
|
+
}),
|
|
3505
|
+
label: props.label,
|
|
3506
|
+
required: props.required,
|
|
3507
|
+
autoFocus: props.autoFocus
|
|
3508
|
+
}), props.textFieldProps)
|
|
3509
|
+
),
|
|
3510
|
+
defaultValue,
|
|
3511
|
+
onChange
|
|
3512
|
+
}, props)
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3465
3515
|
|
|
3466
3516
|
// src/components/Checkbox/index.tsx
|
|
3467
3517
|
import React14 from "react";
|
|
@@ -4127,7 +4177,7 @@ import { useContext as useContext2 } from "react";
|
|
|
4127
4177
|
|
|
4128
4178
|
// src/contexts/AlertContext.tsx
|
|
4129
4179
|
import React25, { useCallback } from "react";
|
|
4130
|
-
import { createContext, useState as
|
|
4180
|
+
import { createContext, useState as useState4 } from "react";
|
|
4131
4181
|
|
|
4132
4182
|
// src/components/Toast/index.tsx
|
|
4133
4183
|
import React24 from "react";
|
|
@@ -4167,9 +4217,9 @@ var Toast = ({ open, onClose, severity, message }) => {
|
|
|
4167
4217
|
// src/contexts/AlertContext.tsx
|
|
4168
4218
|
var AlertContext = createContext({});
|
|
4169
4219
|
var AlertProvider = ({ children }) => {
|
|
4170
|
-
const [severity, setSeverity] =
|
|
4171
|
-
const [message, setMessage] =
|
|
4172
|
-
const [isVisible, setIsVisible] =
|
|
4220
|
+
const [severity, setSeverity] = useState4("info");
|
|
4221
|
+
const [message, setMessage] = useState4("");
|
|
4222
|
+
const [isVisible, setIsVisible] = useState4(false);
|
|
4173
4223
|
const createAlert = useCallback(
|
|
4174
4224
|
(newMessage, severity2) => {
|
|
4175
4225
|
setMessage(newMessage);
|
|
@@ -4198,9 +4248,9 @@ var useAlert = () => {
|
|
|
4198
4248
|
};
|
|
4199
4249
|
|
|
4200
4250
|
// src/hooks/useLoading.ts
|
|
4201
|
-
import { useCallback as useCallback2, useState as
|
|
4251
|
+
import { useCallback as useCallback2, useState as useState5 } from "react";
|
|
4202
4252
|
function useLoading() {
|
|
4203
|
-
const [state, setState] =
|
|
4253
|
+
const [state, setState] = useState5([]);
|
|
4204
4254
|
const isLoading = useCallback2((prop) => state.includes(prop), [state]);
|
|
4205
4255
|
const setLoading = useCallback2((prop, remove) => {
|
|
4206
4256
|
if (remove)
|
|
@@ -4616,11 +4666,11 @@ var AuthHelper = class {
|
|
|
4616
4666
|
};
|
|
4617
4667
|
|
|
4618
4668
|
// src/hooks/useGrid.ts
|
|
4619
|
-
import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo3, useState as
|
|
4669
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo3, useState as useState7 } from "react";
|
|
4620
4670
|
|
|
4621
4671
|
// src/hooks/useFilter.ts
|
|
4622
4672
|
import moment2 from "moment";
|
|
4623
|
-
import { useCallback as useCallback4, useState as
|
|
4673
|
+
import { useCallback as useCallback4, useState as useState6 } from "react";
|
|
4624
4674
|
|
|
4625
4675
|
// src/components/utils/getObjectValue.ts
|
|
4626
4676
|
function getObjectValue(obj) {
|
|
@@ -4635,7 +4685,7 @@ function getObjectValue(obj) {
|
|
|
4635
4685
|
|
|
4636
4686
|
// src/hooks/useFilter.ts
|
|
4637
4687
|
function useFilter() {
|
|
4638
|
-
const [selectedFilters, setSelectedFilters] =
|
|
4688
|
+
const [selectedFilters, setSelectedFilters] = useState6([]);
|
|
4639
4689
|
const filterBy = useCallback4((newFilter) => {
|
|
4640
4690
|
const propToCompare = (newFilter == null ? void 0 : newFilter.id) ? "id" : "prop";
|
|
4641
4691
|
function removeRepeatedFilters(filter) {
|
|
@@ -4723,13 +4773,13 @@ function useGrid({
|
|
|
4723
4773
|
defaultCurrentPage,
|
|
4724
4774
|
defaultSortedBy
|
|
4725
4775
|
}) {
|
|
4726
|
-
const [defaultData, setDefaultData] =
|
|
4727
|
-
const [sortedBy, setSortedBy] =
|
|
4776
|
+
const [defaultData, setDefaultData] = useState7(externalDefaultData || []);
|
|
4777
|
+
const [sortedBy, setSortedBy] = useState7(
|
|
4728
4778
|
defaultSortedBy || []
|
|
4729
4779
|
);
|
|
4730
|
-
const [currentPage, setCurrentPage] =
|
|
4731
|
-
const [rowsPerPage, setRowsPerPage] =
|
|
4732
|
-
const [updatedTimes, setUpdatedTimes] =
|
|
4780
|
+
const [currentPage, setCurrentPage] = useState7(defaultCurrentPage || 0);
|
|
4781
|
+
const [rowsPerPage, setRowsPerPage] = useState7(rowsPerPageOptions[0]);
|
|
4782
|
+
const [updatedTimes, setUpdatedTimes] = useState7(0);
|
|
4733
4783
|
const toggleSortedDirection = useCallback5(
|
|
4734
4784
|
(direction) => {
|
|
4735
4785
|
if (direction === "asc")
|
|
@@ -4878,7 +4928,7 @@ function createSearch(options) {
|
|
|
4878
4928
|
}
|
|
4879
4929
|
|
|
4880
4930
|
// src/hooks/useAsyncGrid.ts
|
|
4881
|
-
import { useCallback as useCallback6, useEffect as useEffect6, useState as
|
|
4931
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useState as useState8 } from "react";
|
|
4882
4932
|
function useAsyncGrid({
|
|
4883
4933
|
columns,
|
|
4884
4934
|
filters = [],
|
|
@@ -4891,14 +4941,14 @@ function useAsyncGrid({
|
|
|
4891
4941
|
defaultCurrentPage,
|
|
4892
4942
|
defaultSortedBy
|
|
4893
4943
|
}) {
|
|
4894
|
-
const [defaultData, setDefaultData] =
|
|
4895
|
-
const [sortedBy, setSortedBy] =
|
|
4944
|
+
const [defaultData, setDefaultData] = useState8(externalDefaultData || []);
|
|
4945
|
+
const [sortedBy, setSortedBy] = useState8(
|
|
4896
4946
|
defaultSortedBy || []
|
|
4897
4947
|
);
|
|
4898
|
-
const [totalNumberOfItems, setTotalNumberOfItems] =
|
|
4899
|
-
const [isLoading, setIsLoading] =
|
|
4900
|
-
const [currentPage, setCurrentPage] =
|
|
4901
|
-
const [rowsPerPage, setRowsPerPage] =
|
|
4948
|
+
const [totalNumberOfItems, setTotalNumberOfItems] = useState8(0);
|
|
4949
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
4950
|
+
const [currentPage, setCurrentPage] = useState8(defaultCurrentPage || 0);
|
|
4951
|
+
const [rowsPerPage, setRowsPerPage] = useState8(rowsPerPageOptions[0]);
|
|
4902
4952
|
const totalNumberOfPages = Math.ceil(totalNumberOfItems / rowsPerPage) - 1;
|
|
4903
4953
|
const toggleSortedDirection = useCallback6(
|
|
4904
4954
|
(direction) => {
|
|
@@ -5067,7 +5117,7 @@ import React27, { useCallback as useCallback7 } from "react";
|
|
|
5067
5117
|
import {
|
|
5068
5118
|
createContext as createContext3,
|
|
5069
5119
|
useEffect as useEffect8,
|
|
5070
|
-
useState as
|
|
5120
|
+
useState as useState9
|
|
5071
5121
|
} from "react";
|
|
5072
5122
|
import { parseCookies as parseCookies2 } from "nookies";
|
|
5073
5123
|
function createAuthContext() {
|
|
@@ -5079,8 +5129,8 @@ function CreateAuthProvider({
|
|
|
5079
5129
|
sessionTokenName,
|
|
5080
5130
|
Provider
|
|
5081
5131
|
}) {
|
|
5082
|
-
const [user, setUser] =
|
|
5083
|
-
const [status, setStatus] =
|
|
5132
|
+
const [user, setUser] = useState9();
|
|
5133
|
+
const [status, setStatus] = useState9("unauthenticated");
|
|
5084
5134
|
const { createAlert } = useAlert();
|
|
5085
5135
|
const signIn = useCallback7(
|
|
5086
5136
|
(_0) => __async(this, [_0], function* ({ email, password }) {
|