@bluemarble/bm-components 1.10.0 → 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 +80 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2919,7 +2919,7 @@ import moment from "moment";
|
|
|
2919
2919
|
var DefaultInput = (allProps) => {
|
|
2920
2920
|
var _a;
|
|
2921
2921
|
const {
|
|
2922
|
-
TextFieldProps:
|
|
2922
|
+
TextFieldProps: TextFieldProps3,
|
|
2923
2923
|
onSave,
|
|
2924
2924
|
name,
|
|
2925
2925
|
onUpdateValue,
|
|
@@ -2973,7 +2973,7 @@ var DefaultInput = (allProps) => {
|
|
|
2973
2973
|
defaultValue: formatDefaultValue(rowData == null ? void 0 : rowData[name]),
|
|
2974
2974
|
sx: __spreadValues({
|
|
2975
2975
|
width: fullWidth ? "100%" : "intial"
|
|
2976
|
-
},
|
|
2976
|
+
}, TextFieldProps3 == null ? void 0 : TextFieldProps3.sx),
|
|
2977
2977
|
inputProps: {
|
|
2978
2978
|
style: {
|
|
2979
2979
|
paddingBottom: 6,
|
|
@@ -2981,13 +2981,13 @@ var DefaultInput = (allProps) => {
|
|
|
2981
2981
|
},
|
|
2982
2982
|
onKeyDown
|
|
2983
2983
|
},
|
|
2984
|
-
InputProps: __spreadProps(__spreadValues({},
|
|
2984
|
+
InputProps: __spreadProps(__spreadValues({}, TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps), {
|
|
2985
2985
|
sx: __spreadValues({
|
|
2986
2986
|
fontSize: 14,
|
|
2987
2987
|
pl: 0.2
|
|
2988
|
-
}, (_a =
|
|
2988
|
+
}, (_a = TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps) == null ? void 0 : _a.sx)
|
|
2989
2989
|
})
|
|
2990
|
-
},
|
|
2990
|
+
}, TextFieldProps3)
|
|
2991
2991
|
);
|
|
2992
2992
|
};
|
|
2993
2993
|
|
|
@@ -2998,7 +2998,7 @@ import { TextField as TextField3 } from "@mui/material";
|
|
|
2998
2998
|
var InputMask = (allProps) => {
|
|
2999
2999
|
var _a;
|
|
3000
3000
|
const {
|
|
3001
|
-
TextFieldProps:
|
|
3001
|
+
TextFieldProps: TextFieldProps3,
|
|
3002
3002
|
onSave,
|
|
3003
3003
|
name,
|
|
3004
3004
|
rowData,
|
|
@@ -3045,7 +3045,7 @@ var InputMask = (allProps) => {
|
|
|
3045
3045
|
size: "small",
|
|
3046
3046
|
sx: __spreadValues({
|
|
3047
3047
|
width: fullWidth ? "100%" : "intial"
|
|
3048
|
-
},
|
|
3048
|
+
}, TextFieldProps3 == null ? void 0 : TextFieldProps3.sx),
|
|
3049
3049
|
inputProps: {
|
|
3050
3050
|
style: {
|
|
3051
3051
|
paddingBottom: 6,
|
|
@@ -3053,20 +3053,20 @@ var InputMask = (allProps) => {
|
|
|
3053
3053
|
},
|
|
3054
3054
|
onKeyDown
|
|
3055
3055
|
},
|
|
3056
|
-
InputProps: __spreadProps(__spreadValues({},
|
|
3056
|
+
InputProps: __spreadProps(__spreadValues({}, TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps), {
|
|
3057
3057
|
sx: __spreadValues({
|
|
3058
3058
|
fontSize: 14,
|
|
3059
3059
|
pl: 0.2
|
|
3060
|
-
}, (_a =
|
|
3060
|
+
}, (_a = TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps) == null ? void 0 : _a.sx)
|
|
3061
3061
|
})
|
|
3062
|
-
},
|
|
3062
|
+
}, TextFieldProps3)
|
|
3063
3063
|
);
|
|
3064
3064
|
};
|
|
3065
3065
|
|
|
3066
3066
|
// src/components/Grid/EditableTableCell/index.tsx
|
|
3067
3067
|
var EditableTableCell = (allProps) => {
|
|
3068
3068
|
const _a = allProps, {
|
|
3069
|
-
TextFieldProps:
|
|
3069
|
+
TextFieldProps: TextFieldProps3,
|
|
3070
3070
|
onSave = () => {
|
|
3071
3071
|
},
|
|
3072
3072
|
onCancel,
|
|
@@ -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 {
|
|
@@ -3356,6 +3357,7 @@ import {
|
|
|
3356
3357
|
TextField as TextField5,
|
|
3357
3358
|
CircularProgress
|
|
3358
3359
|
} from "@mui/material";
|
|
3360
|
+
import { useTheme as useTheme3 } from "@mui/material/styles";
|
|
3359
3361
|
function Autocomplete2(_a) {
|
|
3360
3362
|
var _b = _a, {
|
|
3361
3363
|
withFormik = true,
|
|
@@ -3367,8 +3369,22 @@ function Autocomplete2(_a) {
|
|
|
3367
3369
|
"getOptionValue"
|
|
3368
3370
|
]);
|
|
3369
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
|
+
);
|
|
3370
3386
|
return /* @__PURE__ */ React13.createElement(
|
|
3371
|
-
|
|
3387
|
+
FormikAutocompleteLegacy,
|
|
3372
3388
|
__spreadValues({
|
|
3373
3389
|
name,
|
|
3374
3390
|
getOptionValue
|
|
@@ -3386,7 +3402,7 @@ function BaseInput2(props) {
|
|
|
3386
3402
|
}, props)
|
|
3387
3403
|
);
|
|
3388
3404
|
}
|
|
3389
|
-
function
|
|
3405
|
+
function FormikAutocompleteLegacy(_a) {
|
|
3390
3406
|
var _b = _a, {
|
|
3391
3407
|
getOptionValue,
|
|
3392
3408
|
option
|
|
@@ -3396,23 +3412,21 @@ function FormikAutocomplete(_a) {
|
|
|
3396
3412
|
]);
|
|
3397
3413
|
const [_a2, ..._b2] = useField2({
|
|
3398
3414
|
name: props.name
|
|
3399
|
-
}), _c = _a2, { value
|
|
3415
|
+
}), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
|
|
3400
3416
|
const defaultOption = useMemo2(() => {
|
|
3401
|
-
if (!option)
|
|
3402
|
-
return defaultValue;
|
|
3403
3417
|
const key = option == null ? void 0 : option.key;
|
|
3404
3418
|
if (key)
|
|
3405
|
-
return props.options.find((option2) => option2[key] ===
|
|
3419
|
+
return props.options.find((option2) => option2[key] === value);
|
|
3406
3420
|
return props.options.find(
|
|
3407
|
-
(option2) => Object.values(option2)[0] ===
|
|
3421
|
+
(option2) => Object.values(option2)[0] === value
|
|
3408
3422
|
);
|
|
3409
|
-
}, [
|
|
3423
|
+
}, [value, option, props.options.find]);
|
|
3410
3424
|
const onChange = (_, newValue) => {
|
|
3411
|
-
const
|
|
3425
|
+
const value2 = option == null ? void 0 : option.value;
|
|
3412
3426
|
if (getOptionValue) {
|
|
3413
3427
|
setValue(getOptionValue(newValue));
|
|
3414
|
-
} else if (
|
|
3415
|
-
setValue(newValue[
|
|
3428
|
+
} else if (value2) {
|
|
3429
|
+
setValue(newValue[value2]);
|
|
3416
3430
|
} else
|
|
3417
3431
|
setValue(newValue);
|
|
3418
3432
|
};
|
|
@@ -3449,12 +3463,55 @@ function FormikAutocomplete(_a) {
|
|
|
3449
3463
|
autoFocus: props.autoFocus
|
|
3450
3464
|
}), props.textFieldProps)
|
|
3451
3465
|
),
|
|
3452
|
-
|
|
3466
|
+
value: defaultOption || null,
|
|
3453
3467
|
onChange,
|
|
3454
3468
|
isOptionEqualToValue
|
|
3455
3469
|
}, props)
|
|
3456
3470
|
);
|
|
3457
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
|
+
}
|
|
3458
3515
|
|
|
3459
3516
|
// src/components/Checkbox/index.tsx
|
|
3460
3517
|
import React14 from "react";
|
|
@@ -4120,7 +4177,7 @@ import { useContext as useContext2 } from "react";
|
|
|
4120
4177
|
|
|
4121
4178
|
// src/contexts/AlertContext.tsx
|
|
4122
4179
|
import React25, { useCallback } from "react";
|
|
4123
|
-
import { createContext, useState as
|
|
4180
|
+
import { createContext, useState as useState4 } from "react";
|
|
4124
4181
|
|
|
4125
4182
|
// src/components/Toast/index.tsx
|
|
4126
4183
|
import React24 from "react";
|
|
@@ -4160,9 +4217,9 @@ var Toast = ({ open, onClose, severity, message }) => {
|
|
|
4160
4217
|
// src/contexts/AlertContext.tsx
|
|
4161
4218
|
var AlertContext = createContext({});
|
|
4162
4219
|
var AlertProvider = ({ children }) => {
|
|
4163
|
-
const [severity, setSeverity] =
|
|
4164
|
-
const [message, setMessage] =
|
|
4165
|
-
const [isVisible, setIsVisible] =
|
|
4220
|
+
const [severity, setSeverity] = useState4("info");
|
|
4221
|
+
const [message, setMessage] = useState4("");
|
|
4222
|
+
const [isVisible, setIsVisible] = useState4(false);
|
|
4166
4223
|
const createAlert = useCallback(
|
|
4167
4224
|
(newMessage, severity2) => {
|
|
4168
4225
|
setMessage(newMessage);
|
|
@@ -4191,9 +4248,9 @@ var useAlert = () => {
|
|
|
4191
4248
|
};
|
|
4192
4249
|
|
|
4193
4250
|
// src/hooks/useLoading.ts
|
|
4194
|
-
import { useCallback as useCallback2, useState as
|
|
4251
|
+
import { useCallback as useCallback2, useState as useState5 } from "react";
|
|
4195
4252
|
function useLoading() {
|
|
4196
|
-
const [state, setState] =
|
|
4253
|
+
const [state, setState] = useState5([]);
|
|
4197
4254
|
const isLoading = useCallback2((prop) => state.includes(prop), [state]);
|
|
4198
4255
|
const setLoading = useCallback2((prop, remove) => {
|
|
4199
4256
|
if (remove)
|
|
@@ -4609,11 +4666,11 @@ var AuthHelper = class {
|
|
|
4609
4666
|
};
|
|
4610
4667
|
|
|
4611
4668
|
// src/hooks/useGrid.ts
|
|
4612
|
-
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";
|
|
4613
4670
|
|
|
4614
4671
|
// src/hooks/useFilter.ts
|
|
4615
4672
|
import moment2 from "moment";
|
|
4616
|
-
import { useCallback as useCallback4, useState as
|
|
4673
|
+
import { useCallback as useCallback4, useState as useState6 } from "react";
|
|
4617
4674
|
|
|
4618
4675
|
// src/components/utils/getObjectValue.ts
|
|
4619
4676
|
function getObjectValue(obj) {
|
|
@@ -4628,7 +4685,7 @@ function getObjectValue(obj) {
|
|
|
4628
4685
|
|
|
4629
4686
|
// src/hooks/useFilter.ts
|
|
4630
4687
|
function useFilter() {
|
|
4631
|
-
const [selectedFilters, setSelectedFilters] =
|
|
4688
|
+
const [selectedFilters, setSelectedFilters] = useState6([]);
|
|
4632
4689
|
const filterBy = useCallback4((newFilter) => {
|
|
4633
4690
|
const propToCompare = (newFilter == null ? void 0 : newFilter.id) ? "id" : "prop";
|
|
4634
4691
|
function removeRepeatedFilters(filter) {
|
|
@@ -4716,13 +4773,13 @@ function useGrid({
|
|
|
4716
4773
|
defaultCurrentPage,
|
|
4717
4774
|
defaultSortedBy
|
|
4718
4775
|
}) {
|
|
4719
|
-
const [defaultData, setDefaultData] =
|
|
4720
|
-
const [sortedBy, setSortedBy] =
|
|
4776
|
+
const [defaultData, setDefaultData] = useState7(externalDefaultData || []);
|
|
4777
|
+
const [sortedBy, setSortedBy] = useState7(
|
|
4721
4778
|
defaultSortedBy || []
|
|
4722
4779
|
);
|
|
4723
|
-
const [currentPage, setCurrentPage] =
|
|
4724
|
-
const [rowsPerPage, setRowsPerPage] =
|
|
4725
|
-
const [updatedTimes, setUpdatedTimes] =
|
|
4780
|
+
const [currentPage, setCurrentPage] = useState7(defaultCurrentPage || 0);
|
|
4781
|
+
const [rowsPerPage, setRowsPerPage] = useState7(rowsPerPageOptions[0]);
|
|
4782
|
+
const [updatedTimes, setUpdatedTimes] = useState7(0);
|
|
4726
4783
|
const toggleSortedDirection = useCallback5(
|
|
4727
4784
|
(direction) => {
|
|
4728
4785
|
if (direction === "asc")
|
|
@@ -4871,7 +4928,7 @@ function createSearch(options) {
|
|
|
4871
4928
|
}
|
|
4872
4929
|
|
|
4873
4930
|
// src/hooks/useAsyncGrid.ts
|
|
4874
|
-
import { useCallback as useCallback6, useEffect as useEffect6, useState as
|
|
4931
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useState as useState8 } from "react";
|
|
4875
4932
|
function useAsyncGrid({
|
|
4876
4933
|
columns,
|
|
4877
4934
|
filters = [],
|
|
@@ -4884,14 +4941,14 @@ function useAsyncGrid({
|
|
|
4884
4941
|
defaultCurrentPage,
|
|
4885
4942
|
defaultSortedBy
|
|
4886
4943
|
}) {
|
|
4887
|
-
const [defaultData, setDefaultData] =
|
|
4888
|
-
const [sortedBy, setSortedBy] =
|
|
4944
|
+
const [defaultData, setDefaultData] = useState8(externalDefaultData || []);
|
|
4945
|
+
const [sortedBy, setSortedBy] = useState8(
|
|
4889
4946
|
defaultSortedBy || []
|
|
4890
4947
|
);
|
|
4891
|
-
const [totalNumberOfItems, setTotalNumberOfItems] =
|
|
4892
|
-
const [isLoading, setIsLoading] =
|
|
4893
|
-
const [currentPage, setCurrentPage] =
|
|
4894
|
-
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]);
|
|
4895
4952
|
const totalNumberOfPages = Math.ceil(totalNumberOfItems / rowsPerPage) - 1;
|
|
4896
4953
|
const toggleSortedDirection = useCallback6(
|
|
4897
4954
|
(direction) => {
|
|
@@ -5060,7 +5117,7 @@ import React27, { useCallback as useCallback7 } from "react";
|
|
|
5060
5117
|
import {
|
|
5061
5118
|
createContext as createContext3,
|
|
5062
5119
|
useEffect as useEffect8,
|
|
5063
|
-
useState as
|
|
5120
|
+
useState as useState9
|
|
5064
5121
|
} from "react";
|
|
5065
5122
|
import { parseCookies as parseCookies2 } from "nookies";
|
|
5066
5123
|
function createAuthContext() {
|
|
@@ -5072,8 +5129,8 @@ function CreateAuthProvider({
|
|
|
5072
5129
|
sessionTokenName,
|
|
5073
5130
|
Provider
|
|
5074
5131
|
}) {
|
|
5075
|
-
const [user, setUser] =
|
|
5076
|
-
const [status, setStatus] =
|
|
5132
|
+
const [user, setUser] = useState9();
|
|
5133
|
+
const [status, setStatus] = useState9("unauthenticated");
|
|
5077
5134
|
const { createAlert } = useAlert();
|
|
5078
5135
|
const signIn = useCallback7(
|
|
5079
5136
|
(_0) => __async(this, [_0], function* ({ email, password }) {
|