@copart/ops-tool-kit 1.13.0-beta.27 → 1.13.0-beta.28

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.
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
47
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
48
48
 
49
49
  const name$1 = "@copart/ops-tool-kit";
50
- const version$3 = "1.13.0-beta.27";
50
+ const version$3 = "1.13.0-beta.28";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -290,6 +290,54 @@ function _createClass$2(e, r, t) {
290
290
  writable: !1
291
291
  }), e;
292
292
  }
293
+ function _createForOfIteratorHelper(r, e) {
294
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
295
+ if (!t) {
296
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
297
+ t && (r = t);
298
+ var n = 0,
299
+ F = function () {};
300
+ return {
301
+ s: F,
302
+ n: function () {
303
+ return n >= r.length ? {
304
+ done: !0
305
+ } : {
306
+ done: !1,
307
+ value: r[n++]
308
+ };
309
+ },
310
+ e: function (r) {
311
+ throw r;
312
+ },
313
+ f: F
314
+ };
315
+ }
316
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
317
+ }
318
+ var o,
319
+ a = !0,
320
+ u = !1;
321
+ return {
322
+ s: function () {
323
+ t = t.call(r);
324
+ },
325
+ n: function () {
326
+ var r = t.next();
327
+ return a = r.done, r;
328
+ },
329
+ e: function (r) {
330
+ u = !0, o = r;
331
+ },
332
+ f: function () {
333
+ try {
334
+ a || null == t.return || t.return();
335
+ } finally {
336
+ if (u) throw o;
337
+ }
338
+ }
339
+ };
340
+ }
293
341
  function _defineProperty$2(e, r, t) {
294
342
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
295
343
  value: t,
@@ -2927,6 +2975,42 @@ var getCrumbProps = function getCrumbProps(props) {
2927
2975
  var crumbProps = _objectWithoutProperties(props, _excluded$6);
2928
2976
  return crumbProps;
2929
2977
  };
2978
+
2979
+ // Flatten children to a comparable text label. Children may be a React element
2980
+ // (e.g. <span onClick>Label</span>) whose internal fiber refs (`_owner`) are
2981
+ // circular, so it must never be passed to JSON.stringify.
2982
+ var _crumbLabel = function crumbLabel(children) {
2983
+ if (children == null) return '';
2984
+ if (typeof children === 'string' || typeof children === 'number') return String(children);
2985
+ if (Array.isArray(children)) return children.map(_crumbLabel).join('');
2986
+ if (React__namespace.isValidElement(children) && children.props && children.props.children != null) {
2987
+ return _crumbLabel(children.props.children);
2988
+ }
2989
+ return '';
2990
+ };
2991
+
2992
+ // Safe replacement for the old JSON.stringify diff, which threw
2993
+ // "Converting circular structure to JSON" whenever children was a React element.
2994
+ var crumbPropsChanged = function crumbPropsChanged(oldProps, newProps) {
2995
+ var keys = new Set([].concat(_toConsumableArray(Object.keys(oldProps)), _toConsumableArray(Object.keys(newProps))));
2996
+ var _iterator = _createForOfIteratorHelper(keys),
2997
+ _step;
2998
+ try {
2999
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3000
+ var key = _step.value;
3001
+ if (key === 'children') {
3002
+ if (_crumbLabel(oldProps.children) !== _crumbLabel(newProps.children)) return true;
3003
+ } else if (oldProps[key] !== newProps[key]) {
3004
+ return true;
3005
+ }
3006
+ }
3007
+ } catch (err) {
3008
+ _iterator.e(err);
3009
+ } finally {
3010
+ _iterator.f();
3011
+ }
3012
+ return false;
3013
+ };
2930
3014
  var Crumb$1 = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
2931
3015
  function Crumb() {
2932
3016
  var _this;
@@ -2950,9 +3034,7 @@ var Crumb$1 = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component)
2950
3034
  value: function shouldComponentUpdate(nextProps) {
2951
3035
  var oldProps = getCrumbProps(this.props);
2952
3036
  var newProps = getCrumbProps(nextProps);
2953
-
2954
- // TODO: Fix this hack, it is so hacky that the hackers cry themselves to sleep.
2955
- return JSON.stringify(newProps) !== JSON.stringify(oldProps);
3037
+ return crumbPropsChanged(oldProps, newProps);
2956
3038
  }
2957
3039
  }, {
2958
3040
  key: "componentDidUpdate",