@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 CHANGED
@@ -2919,7 +2919,7 @@ var _moment = require('moment'); var _moment2 = _interopRequireDefault(_moment);
2919
2919
  var DefaultInput = (allProps) => {
2920
2920
  var _a;
2921
2921
  const {
2922
- TextFieldProps: TextFieldProps4,
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
- }, TextFieldProps4 == null ? void 0 : TextFieldProps4.sx),
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({}, TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps), {
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 = TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps) == null ? void 0 : _a.sx)
2988
+ }, (_a = TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps) == null ? void 0 : _a.sx)
2989
2989
  })
2990
- }, TextFieldProps4)
2990
+ }, TextFieldProps3)
2991
2991
  );
2992
2992
  };
2993
2993
 
@@ -2998,7 +2998,7 @@ var _reactimask = require('react-imask');
2998
2998
  var InputMask = (allProps) => {
2999
2999
  var _a;
3000
3000
  const {
3001
- TextFieldProps: TextFieldProps4,
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
- }, TextFieldProps4 == null ? void 0 : TextFieldProps4.sx),
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({}, TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps), {
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 = TextFieldProps4 == null ? void 0 : TextFieldProps4.InputProps) == null ? void 0 : _a.sx)
3060
+ }, (_a = TextFieldProps3 == null ? void 0 : TextFieldProps3.InputProps) == null ? void 0 : _a.sx)
3061
3061
  })
3062
- }, TextFieldProps4)
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: TextFieldProps4,
3069
+ TextFieldProps: TextFieldProps3,
3070
3070
  onSave = () => {
3071
3071
  },
3072
3072
  onCancel,
@@ -3356,6 +3356,8 @@ function FormikSelect(_a) {
3356
3356
 
3357
3357
 
3358
3358
 
3359
+
3360
+ var _styles = require('@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 = _styles.useTheme.call(void 0, );
3373
+ const isLegacyBehaviorDisabledTheme = _react.useMemo.call(void 0, () => {
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__ */ React2.default.createElement(
3380
+ FormikAutocomplete,
3381
+ __spreadValues({
3382
+ name,
3383
+ getOptionValue
3384
+ }, rest)
3385
+ );
3370
3386
  return /* @__PURE__ */ React2.default.createElement(
3371
- FormikAutocomplete,
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 FormikAutocomplete(_a) {
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] = _formik.useField.call(void 0, {
3398
3414
  name: props.name
3399
- }), _c = _a2, { value: defaultValue } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
3415
+ }), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
3400
3416
  const defaultOption = _react.useMemo.call(void 0, () => {
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] === defaultValue);
3419
+ return props.options.find((option2) => option2[key] === value);
3406
3420
  return props.options.find(
3407
- (option2) => Object.values(option2)[0] === defaultValue
3421
+ (option2) => Object.values(option2)[0] === value
3408
3422
  );
3409
- }, [defaultValue, option, props.options.find]);
3423
+ }, [value, option, props.options.find]);
3410
3424
  const onChange = (_, newValue) => {
3411
- const value = option == null ? void 0 : option.value;
3425
+ const value2 = option == null ? void 0 : option.value;
3412
3426
  if (getOptionValue) {
3413
3427
  setValue(getOptionValue(newValue));
3414
- } else if (value) {
3415
- setValue(newValue[value]);
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
- defaultValue: defaultOption,
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] = _formik.useField.call(void 0, {
3481
+ name: props.name
3482
+ }), _c = _a2, { value } = _c, field = __objRest(_c, ["value"]), [meta, { setValue }] = _b2;
3483
+ const [defaultValue] = _react.useState.call(void 0, 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__ */ React2.default.createElement(
3494
+ _material.Autocomplete,
3495
+ __spreadValues({
3496
+ renderInput: (params) => /* @__PURE__ */ React2.default.createElement(
3497
+ _material.TextField,
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__ */ React2.default.createElement(_react.Fragment, null, props.loading ? /* @__PURE__ */ React2.default.createElement(_material.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