dynamic-mui 1.0.83 → 1.0.85

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/craco.config.js CHANGED
@@ -1,11 +1,29 @@
1
+ /// /////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // Copyright 2023 Realm Inc.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ /// /////////////////////////////////////////////////////////////////////////
18
+
1
19
  module.exports = {
2
- // 1) Keep your existing webpack tweaks
3
20
  webpack: {
4
21
  configure(config) {
5
22
  const experiments = {
6
23
  ...config.experiments,
7
24
  topLevelAwait: true,
8
25
  };
26
+
9
27
  return {
10
28
  ...config,
11
29
  experiments,
@@ -13,23 +31,4 @@ module.exports = {
13
31
  },
14
32
  alias: {},
15
33
  },
16
-
17
- // 2) Add an eslint section so CRACO drives all of ESLint
18
- eslint: {
19
- enable: true,
20
- mode: 'extends', // use "extends" mode to build on CRA’s base
21
- configure: {
22
- extends: [
23
- 'react-app', // CRA’s default
24
- 'react-app/jest',
25
- 'airbnb', // your Airbnb rules
26
- 'prettier', // disable conflicts with Prettier
27
- ],
28
- plugins: ['react', 'react-hooks', 'jsx-a11y', 'import', 'prettier'],
29
- rules: {
30
- 'react/react-in-jsx-scope': 'off',
31
- 'prettier/prettier': 'error',
32
- },
33
- },
34
- },
35
34
  };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = MixChart;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
9
- var _ChartContainer = require("@mui/x-charts/ChartContainer");
9
+ var _ResponsiveChartContainer = require("@mui/x-charts/ResponsiveChartContainer");
10
10
  var _LineChart = require("@mui/x-charts/LineChart");
11
11
  var _BarChart = require("@mui/x-charts/BarChart");
12
12
  var _ChartsXAxis = require("@mui/x-charts/ChartsXAxis");
@@ -39,7 +39,7 @@ function MixChart(_ref) {
39
39
  maxWidth: 600
40
40
  },
41
41
  key: id
42
- }, MuiBoxAttributes), /*#__PURE__*/React.createElement(_ChartContainer.ChartContainer, _extends({
42
+ }, MuiBoxAttributes), /*#__PURE__*/React.createElement(_ResponsiveChartContainer.ResponsiveChartContainer, _extends({
43
43
  sx: _objectSpread({
44
44
  [".".concat(_ChartsAxis.axisClasses.left, " .").concat(_ChartsAxis.axisClasses.label)]: {
45
45
  transform: 'translate(-25px, 0)'
@@ -31,35 +31,34 @@ const getValue = function () {
31
31
  let defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
32
32
  let isMultiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
33
33
  if (isMultiple) {
34
- const values = Array.isArray(defaultValue) ? defaultValue : (() => {
35
- let sep = ',';
36
- if (defaultValue.includes(';')) sep = ';';
37
- return defaultValue.split(sep).map(v => v.trim());
38
- })();
39
- const dValueSet = new Set(values);
40
- return options.filter(opt => dValueSet.has(opt.value));
34
+ let separator = ',';
35
+ if (defaultValue !== null && defaultValue !== void 0 && defaultValue.includes(',')) separator = ',';else if (defaultValue !== null && defaultValue !== void 0 && defaultValue.includes(';')) separator = ';';
36
+ const dValueSet = new Set(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.split(separator));
37
+ return options === null || options === void 0 ? void 0 : options.filter(_ref => {
38
+ let {
39
+ value
40
+ } = _ref;
41
+ return dValueSet === null || dValueSet === void 0 ? void 0 : dValueSet.has(value);
42
+ });
41
43
  }
42
- return options.find(_ref => {
44
+ return options.find(_ref2 => {
43
45
  let {
44
46
  value
45
- } = _ref;
47
+ } = _ref2;
46
48
  return value === defaultValue;
47
49
  });
48
50
  };
49
- function Select(_ref2) {
51
+ function Select(_ref3) {
50
52
  let {
51
53
  attributes,
52
54
  onChange
53
- } = _ref2;
55
+ } = _ref3;
54
56
  const {
55
57
  MuiAttributes = {},
56
58
  options = [],
57
59
  MuiBoxAttributes = {},
58
60
  id = '',
59
- InputProps = {},
60
- additionalProps = {
61
- split: ','
62
- }
61
+ InputProps = {}
63
62
  } = attributes;
64
63
  const [value, setValue] = _react.default.useState((attributes === null || attributes === void 0 ? void 0 : attributes.value) && getValue(options, attributes === null || attributes === void 0 ? void 0 : attributes.value, MuiAttributes.multiple));
65
64
  const getMuiAttributes = () => {
@@ -89,7 +88,7 @@ function Select(_ref2) {
89
88
  const data = MuiAttributes.multiple ? newValue.map(extractValue) : extractValue(newValue);
90
89
  onChange({
91
90
  id,
92
- value: MuiAttributes.multiple ? data === null || data === void 0 ? void 0 : data.join(additionalProps === null || additionalProps === void 0 ? void 0 : additionalProps.split) : data,
91
+ value: MuiAttributes.multiple ? data.toString() : data,
93
92
  option: newValue
94
93
  });
95
94
  } else onChange({
@@ -15,7 +15,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
15
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
16
16
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
17
17
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
18
- const ColorSwitch = (0, _styles.styled)(_ref => {
18
+ const ColorSwitch = (0, _styles.experimentalStyled)(_ref => {
19
19
  let {
20
20
  color
21
21
  } = _ref,
@@ -12,7 +12,13 @@ var _helper = require("../../../util/helper");
12
12
  var _validation = _interopRequireDefault(require("../../../util/validation"));
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable react/jsx-no-duplicate-props */
15
20
  function TextField(_ref) {
21
+ var _MuiAttributes$slotPr;
16
22
  let {
17
23
  attributes,
18
24
  rules = {},
@@ -59,7 +65,6 @@ function TextField(_ref) {
59
65
  const {
60
66
  value
61
67
  } = args[0].target;
62
- // const formatValue = value ? getValue(value) : '';
63
68
  const validator = validate(value);
64
69
  setTextData({
65
70
  value,
@@ -81,25 +86,47 @@ function TextField(_ref) {
81
86
  helperText: validator.message,
82
87
  error: !validator.isValid
83
88
  });
84
- if (typeof onChange === 'function') {
85
- onChange({
86
- id,
87
- value: formatValue
88
- });
89
- }
89
+ if (typeof onChange === 'function') onChange({
90
+ id,
91
+ value: formatValue
92
+ });
90
93
  };
91
- const handleOnFocus = () => {
92
- // const { value } = args[0].target;
93
- // const formatValue = getValue(value);
94
- // const validator = validate(formatValue);
95
- // setTextData({
96
- // value: formatValue,
97
- // helperText: validator.message,
98
- // });
94
+ const handleOnFocus = () => {};
95
+
96
+ // Wheel-block for numeric inputs
97
+ const isNumberType = (MuiAttributes === null || MuiAttributes === void 0 ? void 0 : MuiAttributes.type) === 'number' || (attributes === null || attributes === void 0 ? void 0 : attributes.type) === 'number' || (MuiAttributes === null || MuiAttributes === void 0 ? void 0 : MuiAttributes.inputMode) === 'numeric';
98
+ const onWheelBlock = e => {
99
+ const el = e.currentTarget;
100
+ el.blur();
101
+ setTimeout(() => el.focus(), 0);
99
102
  };
103
+
104
+ // Build merged input props we want to ensure exist
105
+ const ourInputProps = _objectSpread(_objectSpread({}, isNumberType ? {
106
+ onWheel: onWheelBlock
107
+ } : {}), {}, {
108
+ inputMode: (MuiAttributes === null || MuiAttributes === void 0 ? void 0 : MuiAttributes.inputProps) && MuiAttributes.inputProps.inputMode || (MuiAttributes === null || MuiAttributes === void 0 || (_MuiAttributes$slotPr = MuiAttributes.slotProps) === null || _MuiAttributes$slotPr === void 0 ? void 0 : _MuiAttributes$slotPr.input) && MuiAttributes.slotProps.input.inputMode || 'numeric'
109
+ });
110
+ const isV6 = !!(MuiAttributes !== null && MuiAttributes !== void 0 && MuiAttributes.slotProps);
111
+ const baseAttrs = _objectSpread({}, MuiAttributes);
112
+ let finalInputProps;
113
+ let finalSlotProps;
114
+ if (isV6) {
115
+ const existingSlotInput = MuiAttributes.slotProps && MuiAttributes.slotProps.input || {};
116
+ finalSlotProps = _objectSpread(_objectSpread({}, MuiAttributes.slotProps || {}), {}, {
117
+ input: _objectSpread(_objectSpread({}, existingSlotInput), ourInputProps)
118
+ });
119
+ delete baseAttrs.slotProps;
120
+ } else {
121
+ const existingInputProps = MuiAttributes.inputProps || {};
122
+ finalInputProps = _objectSpread(_objectSpread({}, existingInputProps), ourInputProps);
123
+ delete baseAttrs.inputProps;
124
+ }
100
125
  return /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({
101
126
  fullWidth: true
102
- }, MuiAttributes, {
127
+ }, baseAttrs, {
128
+ inputProps: !isV6 ? finalInputProps : undefined,
129
+ slotProps: isV6 ? finalSlotProps : undefined,
103
130
  InputProps: (0, _helper.getInputProps)(InputProps),
104
131
  onChange: handleOnChange,
105
132
  onBlur: handleOnBlur,
@@ -110,11 +137,8 @@ function TextField(_ref) {
110
137
  }));
111
138
  }
112
139
  TextField.propTypes = process.env.NODE_ENV !== "production" ? {
113
- /** Attributes for TextField */
114
140
  attributes: _propTypes.default.objectOf(_propTypes.default.object),
115
- /** Rules to be used */
116
141
  rules: _propTypes.default.objectOf(_propTypes.default.array),
117
- /** Function */
118
142
  onChange: _propTypes.default.func
119
143
  } : {};
120
144
  TextField.defaultProps = {
@@ -58,13 +58,13 @@ function getInputProps(InputProps) {
58
58
  text,
59
59
  textstyle = {}
60
60
  } = InputProps;
61
- return position ? {
61
+ return {
62
62
  ["".concat(position, "Adornment")]: /*#__PURE__*/_react.default.createElement(_material.InputAdornment, _extends({}, MuiInputAdornment, {
63
63
  key: "custom-icon-Adornment-".concat(position)
64
64
  }), icon && /*#__PURE__*/_react.default.createElement(_material.Icon, null, icon), !(0, _isEmpty.default)(textstyle) ? /*#__PURE__*/_react.default.createElement("div", {
65
65
  style: textstyle
66
66
  }, text || '') : text || '')
67
- } : _objectSpread({}, InputProps);
67
+ };
68
68
  }
69
69
  return {};
70
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamic-mui",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "author": "Dinakaran S",
5
5
  "user": "dinakarans",
6
6
  "repository": {
@@ -19,11 +19,11 @@
19
19
  "@babel/plugin-transform-modules-commonjs": "^7.26.3",
20
20
  "@emotion/react": "^11.14.0",
21
21
  "@emotion/styled": "^11.14.0",
22
- "@mui/icons-material": "^7.3.0",
23
- "@mui/material": "^7.3.0",
24
- "@mui/x-charts": "^8.9.2",
25
- "@mui/x-data-grid": "^8.9.2",
26
- "@mui/x-date-pickers": "^8.9.2",
22
+ "@mui/icons-material": "^6.3.1",
23
+ "@mui/material": "^6.3.1",
24
+ "@mui/x-charts": "^7.23.2",
25
+ "@mui/x-data-grid": "^7.23.5",
26
+ "@mui/x-date-pickers": "^7.23.3",
27
27
  "@testing-library/jest-dom": "^6.6.3",
28
28
  "@testing-library/react": "^16.1.0",
29
29
  "@testing-library/user-event": "^14.5.2",