@luminati-io/uikit 6.3.126 → 6.3.127

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.
@@ -44113,11 +44113,36 @@ __webpack_require__.r(__webpack_exports__);
44113
44113
 
44114
44114
  /*jslint react:true*/
44115
44115
  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); }
44116
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
44117
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
44118
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
44119
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
44120
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
44121
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
44116
44122
 
44117
44123
 
44118
44124
 
44119
44125
 
44120
44126
 
44127
+ var useElementBorderBoxHeight = function useElementBorderBoxHeight() {
44128
+ var ref = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
44129
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(0),
44130
+ _useState2 = _slicedToArray(_useState, 2),
44131
+ height = _useState2[0],
44132
+ setHeight = _useState2[1];
44133
+ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
44134
+ var el = ref.current;
44135
+ if (!el) return;
44136
+ var observer = new ResizeObserver(function (entries) {
44137
+ setHeight(entries[0].borderBoxSize[0].blockSize);
44138
+ });
44139
+ observer.observe(el);
44140
+ return function () {
44141
+ return observer.disconnect();
44142
+ };
44143
+ }, []);
44144
+ return [ref, height];
44145
+ };
44121
44146
  var CodeBlock = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function (props, ref) {
44122
44147
  var className = props.className,
44123
44148
  classNamePrefix = props.classNamePrefix,
@@ -44127,6 +44152,7 @@ var CodeBlock = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(f
44127
44152
  maxHeight = props.maxHeight,
44128
44153
  _props$max_height = props.max_height,
44129
44154
  max_height = _props$max_height === void 0 ? '500px' : _props$max_height,
44155
+ maxTotalHeight = props.maxTotalHeight,
44130
44156
  lineNumbers = props.lineNumbers,
44131
44157
  copyButton = props.copyButton,
44132
44158
  onCopy = props.onCopy,
@@ -44136,6 +44162,11 @@ var CodeBlock = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(f
44136
44162
  wrap = props.wrap,
44137
44163
  _props$copyButtonPlac = props.copyButtonPlacement,
44138
44164
  copyButtonPlacement = _props$copyButtonPlac === void 0 ? 'top' : _props$copyButtonPlac;
44165
+ var _useElementBorderBoxH = useElementBorderBoxHeight(),
44166
+ _useElementBorderBoxH2 = _slicedToArray(_useElementBorderBoxH, 2),
44167
+ headerRef = _useElementBorderBoxH2[0],
44168
+ headerHeight = _useElementBorderBoxH2[1];
44169
+ var snippetMaxHeight = maxTotalHeight != null ? Math.max(0, maxTotalHeight - headerHeight) : maxHeight || max_height;
44139
44170
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CodeBlockWrapper, _extends({
44140
44171
  ref: ref,
44141
44172
  "data-testid": "code_block"
@@ -44144,6 +44175,7 @@ var CodeBlock = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(f
44144
44175
  wrapper: true
44145
44176
  }, className)
44146
44177
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CodeBlockHeader, {
44178
+ ref: headerRef,
44147
44179
  className: (0,_util__WEBPACK_IMPORTED_MODULE_3__.cn)(classNamePrefix, {
44148
44180
  header: true
44149
44181
  }, variant)
@@ -44151,7 +44183,7 @@ var CodeBlock = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(f
44151
44183
  className: (0,_util__WEBPACK_IMPORTED_MODULE_3__.cn)(classNamePrefix, {
44152
44184
  snippet: true
44153
44185
  }),
44154
- maxHeight: maxHeight || max_height,
44186
+ maxHeight: snippetMaxHeight,
44155
44187
  lang: lang,
44156
44188
  code: code,
44157
44189
  variant: variant,
@@ -44180,7 +44212,8 @@ CodeBlock.propTypes = {
44180
44212
  loading: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
44181
44213
  onCopy: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
44182
44214
  wrap: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
44183
- copyButtonPlacement: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOf(['top', 'bottom'])
44215
+ copyButtonPlacement: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOf(['top', 'bottom']),
44216
+ maxTotalHeight: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().number)
44184
44217
  };
44185
44218
  var CodeBlockWrapper = styled_components__WEBPACK_IMPORTED_MODULE_2___default().div.withConfig({
44186
44219
  displayName: "CodeBlockWrapper",