@redsift/table 8.0.0 → 8.0.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.
Files changed (3) hide show
  1. package/index.js +68 -50
  2. package/index.js.map +1 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -115,6 +115,21 @@ function chainPropTypes(propType1, propType2) {
115
115
  };
116
116
  }
117
117
 
118
+ function _extends() {
119
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
120
+ for (var i = 1; i < arguments.length; i++) {
121
+ var source = arguments[i];
122
+ for (var key in source) {
123
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
124
+ target[key] = source[key];
125
+ }
126
+ }
127
+ }
128
+ return target;
129
+ };
130
+ return _extends.apply(this, arguments);
131
+ }
132
+
118
133
  function isPlainObject(item) {
119
134
  return item !== null && typeof item === 'object' && item.constructor === Object;
120
135
  }
@@ -131,9 +146,7 @@ function deepClone(source) {
131
146
  function deepmerge(target, source, options = {
132
147
  clone: true
133
148
  }) {
134
- const output = options.clone ? {
135
- ...target
136
- } : target;
149
+ const output = options.clone ? _extends({}, target) : target;
137
150
  if (isPlainObject(target) && isPlainObject(source)) {
138
151
  Object.keys(source).forEach(key => {
139
152
  // Avoid prototype pollution
@@ -1353,8 +1366,7 @@ function exactProp(propTypes) {
1353
1366
  if (process.env.NODE_ENV === 'production') {
1354
1367
  return propTypes;
1355
1368
  }
1356
- return {
1357
- ...propTypes,
1369
+ return _extends({}, propTypes, {
1358
1370
  [specialProperty]: props => {
1359
1371
  const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
1360
1372
  if (unsupportedProps.length > 0) {
@@ -1362,7 +1374,7 @@ function exactProp(propTypes) {
1362
1374
  }
1363
1375
  return null;
1364
1376
  }
1365
- };
1377
+ });
1366
1378
  }
1367
1379
 
1368
1380
  /**
@@ -1736,6 +1748,7 @@ function debounce(func, wait = 166) {
1736
1748
  let timeout;
1737
1749
  function debounced(...args) {
1738
1750
  const later = () => {
1751
+ // @ts-ignore
1739
1752
  func.apply(this, args);
1740
1753
  };
1741
1754
  clearTimeout(timeout);
@@ -1954,15 +1967,10 @@ var integerPropType = process.env.NODE_ENV === 'production' ? validatorNoop : va
1954
1967
  * @returns {object} resolved props
1955
1968
  */
1956
1969
  function resolveProps(defaultProps, props) {
1957
- const output = {
1958
- ...props
1959
- };
1970
+ const output = _extends({}, props);
1960
1971
  Object.keys(defaultProps).forEach(propName => {
1961
1972
  if (propName.toString().match(/^(components|slots)$/)) {
1962
- output[propName] = {
1963
- ...defaultProps[propName],
1964
- ...output[propName]
1965
- };
1973
+ output[propName] = _extends({}, defaultProps[propName], output[propName]);
1966
1974
  } else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
1967
1975
  const defaultSlotProps = defaultProps[propName] || {};
1968
1976
  const slotProps = props[propName];
@@ -1974,9 +1982,7 @@ function resolveProps(defaultProps, props) {
1974
1982
  // Reduce the iteration if the default slot props is empty
1975
1983
  output[propName] = slotProps;
1976
1984
  } else {
1977
- output[propName] = {
1978
- ...slotProps
1979
- };
1985
+ output[propName] = _extends({}, slotProps);
1980
1986
  Object.keys(defaultSlotProps).forEach(slotPropName => {
1981
1987
  output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
1982
1988
  });
@@ -3442,21 +3448,6 @@ const internal_processStyles = (tag, processor) => {
3442
3448
  }
3443
3449
  };
3444
3450
 
3445
- function _extends() {
3446
- _extends = Object.assign ? Object.assign.bind() : function (target) {
3447
- for (var i = 1; i < arguments.length; i++) {
3448
- var source = arguments[i];
3449
- for (var key in source) {
3450
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3451
- target[key] = source[key];
3452
- }
3453
- }
3454
- }
3455
- return target;
3456
- };
3457
- return _extends.apply(this, arguments);
3458
- }
3459
-
3460
3451
  function _objectWithoutPropertiesLoose(source, excluded) {
3461
3452
  if (source == null) return {};
3462
3453
  var target = {};
@@ -6230,11 +6221,11 @@ function defaultIsEnabled() {
6230
6221
  *
6231
6222
  * Demos:
6232
6223
  *
6233
- * - [Focus Trap](https://mui.com/base/react-focus-trap/)
6224
+ * - [Focus Trap](https://mui.com/base-ui/react-focus-trap/)
6234
6225
  *
6235
6226
  * API:
6236
6227
  *
6237
- * - [FocusTrap API](https://mui.com/base/react-focus-trap/components-api/#focus-trap)
6228
+ * - [FocusTrap API](https://mui.com/base-ui/react-focus-trap/components-api/#focus-trap)
6238
6229
  */
6239
6230
  function FocusTrap(props) {
6240
6231
  const {
@@ -6491,11 +6482,11 @@ function getContainer$1(container) {
6491
6482
  *
6492
6483
  * Demos:
6493
6484
  *
6494
- * - [Portal](https://mui.com/base/react-portal/)
6485
+ * - [Portal](https://mui.com/base-ui/react-portal/)
6495
6486
  *
6496
6487
  * API:
6497
6488
  *
6498
- * - [Portal API](https://mui.com/base/react-portal/components-api/#portal)
6489
+ * - [Portal API](https://mui.com/base-ui/react-portal/components-api/#portal)
6499
6490
  */
6500
6491
  const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef) {
6501
6492
  const {
@@ -6820,11 +6811,11 @@ const defaultManager = new ModalManager();
6820
6811
  *
6821
6812
  * Demos:
6822
6813
  *
6823
- * - [Modal](https://mui.com/base/react-modal/)
6814
+ * - [Modal](https://mui.com/base-ui/react-modal/)
6824
6815
  *
6825
6816
  * API:
6826
6817
  *
6827
- * - [Modal API](https://mui.com/base/react-modal/components-api/#modal)
6818
+ * - [Modal API](https://mui.com/base-ui/react-modal/components-api/#modal)
6828
6819
  */
6829
6820
  const Modal$2 = /*#__PURE__*/React.forwardRef(function Modal(props, forwardedRef) {
6830
6821
  var _props$ariaHidden, _slots$root;
@@ -7117,6 +7108,14 @@ process.env.NODE_ENV !== "production" ? Modal$2.propTypes /* remove-proptypes */
7117
7108
  * @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`.
7118
7109
  */
7119
7110
  onClose: PropTypes.func,
7111
+ /**
7112
+ * A function called when a transition enters.
7113
+ */
7114
+ onTransitionEnter: PropTypes.func,
7115
+ /**
7116
+ * A function called when a transition has exited.
7117
+ */
7118
+ onTransitionExited: PropTypes.func,
7120
7119
  /**
7121
7120
  * If `true`, the component is shown.
7122
7121
  */
@@ -7168,12 +7167,12 @@ function isEmpty$1(obj) {
7168
7167
  *
7169
7168
  * Demos:
7170
7169
  *
7171
- * - [Textarea Autosize](https://mui.com/base/react-textarea-autosize/)
7170
+ * - [Textarea Autosize](https://mui.com/base-ui/react-textarea-autosize/)
7172
7171
  * - [Textarea Autosize](https://mui.com/material-ui/react-textarea-autosize/)
7173
7172
  *
7174
7173
  * API:
7175
7174
  *
7176
- * - [TextareaAutosize API](https://mui.com/base/react-textarea-autosize/components-api/#textarea-autosize)
7175
+ * - [TextareaAutosize API](https://mui.com/base-ui/react-textarea-autosize/components-api/#textarea-autosize)
7177
7176
  */
7178
7177
  const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize(props, forwardedRef) {
7179
7178
  const {
@@ -12150,6 +12149,14 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes /* remove-proptypes */ =
12150
12149
  * @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`.
12151
12150
  */
12152
12151
  onClose: PropTypes.func,
12152
+ /**
12153
+ * A function called when a transition enters.
12154
+ */
12155
+ onTransitionEnter: PropTypes.func,
12156
+ /**
12157
+ * A function called when a transition has exited.
12158
+ */
12159
+ onTransitionExited: PropTypes.func,
12153
12160
  /**
12154
12161
  * If `true`, the component is shown.
12155
12162
  */
@@ -13957,7 +13964,9 @@ const SvgIconRoot = styled$1('svg', {
13957
13964
  width: '1em',
13958
13965
  height: '1em',
13959
13966
  display: 'inline-block',
13960
- fill: 'currentColor',
13967
+ // the <svg> will define the property that has `currentColor`
13968
+ // e.g. heroicons uses fill="none" and stroke="currentColor"
13969
+ fill: ownerState.hasSvgAsChild ? undefined : 'currentColor',
13961
13970
  flexShrink: 0,
13962
13971
  transition: (_theme$transitions = theme.transitions) == null ? void 0 : (_theme$transitions$cr = _theme$transitions.create) == null ? void 0 : _theme$transitions$cr.call(_theme$transitions, 'fill', {
13963
13972
  duration: (_theme$transitions2 = theme.transitions) == null ? void 0 : (_theme$transitions2$d = _theme$transitions2.duration) == null ? void 0 : _theme$transitions2$d.shorter
@@ -13993,13 +14002,15 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
13993
14002
  viewBox = '0 0 24 24'
13994
14003
  } = props,
13995
14004
  other = _objectWithoutPropertiesLoose(props, _excluded$7);
14005
+ const hasSvgAsChild = /*#__PURE__*/React.isValidElement(children) && children.type === 'svg';
13996
14006
  const ownerState = _extends({}, props, {
13997
14007
  color,
13998
14008
  component,
13999
14009
  fontSize,
14000
14010
  instanceFontSize: inProps.fontSize,
14001
14011
  inheritViewBox,
14002
- viewBox
14012
+ viewBox,
14013
+ hasSvgAsChild
14003
14014
  });
14004
14015
  const more = {};
14005
14016
  if (!inheritViewBox) {
@@ -14014,9 +14025,9 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
14014
14025
  "aria-hidden": titleAccess ? undefined : true,
14015
14026
  role: titleAccess ? 'img' : undefined,
14016
14027
  ref: ref
14017
- }, more, other, {
14028
+ }, more, other, hasSvgAsChild && children.props, {
14018
14029
  ownerState: ownerState,
14019
- children: [children, titleAccess ? /*#__PURE__*/jsxRuntimeExports.jsx("title", {
14030
+ children: [hasSvgAsChild ? children.props.children : children, titleAccess ? /*#__PURE__*/jsxRuntimeExports.jsx("title", {
14020
14031
  children: titleAccess
14021
14032
  }) : null]
14022
14033
  }));
@@ -14992,13 +15003,16 @@ class LicenseInfo {
14992
15003
  // eslint-disable-next-line no-underscore-dangle
14993
15004
  return ponyfillGlobal.__MUI_LICENSE_INFO__;
14994
15005
  }
15006
+
14995
15007
  static getLicenseKey() {
14996
15008
  return LicenseInfo.getLicenseInfo().key;
14997
15009
  }
15010
+
14998
15011
  static setLicenseKey(key) {
14999
15012
  const licenseInfo = LicenseInfo.getLicenseInfo();
15000
15013
  licenseInfo.key = key;
15001
15014
  }
15015
+
15002
15016
  }
15003
15017
 
15004
15018
  /**
@@ -15173,8 +15187,9 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
15173
15187
  onClick: onClick,
15174
15188
  ref: ref,
15175
15189
  variant: "unstyled",
15176
- isActive: props['aria-expanded'] === 'true'
15177
- }), startIcon, children);
15190
+ isActive: props['aria-expanded'] === 'true',
15191
+ leftIcon: startIcon
15192
+ }), children);
15178
15193
  });
15179
15194
 
15180
15195
  const _excluded$2 = ["checked", "indeterminate", "disabled", "onChange"];
@@ -15196,27 +15211,28 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
15196
15211
  }));
15197
15212
  });
15198
15213
 
15199
- const _excluded$1 = ["className", "filterModel", "hideToolbar", "height", "license", "onFilterModelChange", "rows"];
15214
+ const _excluded$1 = ["autoHeight", "className", "filterModel", "hideToolbar", "height", "license", "onFilterModelChange", "rows"];
15200
15215
  const COMPONENT_NAME$1 = 'DataGrid';
15201
15216
  const CLASSNAME$1 = 'redsift-datagrid';
15202
15217
  const DEFAULT_PROPS = {
15203
- license: process.env.MUI_LICENSE_KEY,
15204
- height: '500px'
15218
+ license: process.env.MUI_LICENSE_KEY
15205
15219
  };
15206
15220
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
15207
15221
  var _props$componentsProp;
15208
15222
  const datagridRef = ref || useRef();
15209
15223
  const {
15224
+ autoHeight,
15210
15225
  className,
15211
15226
  filterModel: propsFilterModel,
15212
15227
  hideToolbar,
15213
- height,
15228
+ height: propsHeight,
15214
15229
  license,
15215
15230
  onFilterModelChange: propsOnFilterModelChange,
15216
15231
  rows
15217
15232
  } = props,
15218
15233
  forwardedProps = _objectWithoutProperties(props, _excluded$1);
15219
15234
  LicenseInfo.setLicenseKey(license);
15235
+ const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? '0' : '500px';
15220
15236
  const [filterModel, setFilterModel] = useState(propsFilterModel);
15221
15237
  useEffect(() => {
15222
15238
  setFilterModel(propsFilterModel);
@@ -15235,7 +15251,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
15235
15251
  ref: datagridRef,
15236
15252
  className: classNames(DataGrid.className, className),
15237
15253
  $height: height
15238
- }, /*#__PURE__*/React__default.createElement(DataGridPro, _extends$1({}, forwardedProps, {
15254
+ }, /*#__PURE__*/React__default.createElement(DataGridPro, _extends$1({
15255
+ autoHeight: autoHeight
15256
+ }, forwardedProps, {
15239
15257
  rows: rows,
15240
15258
  filterModel: filterModel,
15241
15259
  onFilterModelChange: onFilterModelChange,