@luminati-io/uikit 3.5.7 → 3.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -28267,7 +28267,7 @@ __webpack_require__.r(__webpack_exports__);
28267
28267
 
28268
28268
 
28269
28269
  /*jslint react:true*/
28270
- var _excluded = ["items"];
28270
+ var _excluded = ["items", "minItemWidth", "maxItemWidth"];
28271
28271
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
28272
28272
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
28273
28273
  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."); }
@@ -28287,6 +28287,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
28287
28287
  var Breadcrumbs = function Breadcrumbs(props) {
28288
28288
  var _props$items = props.items,
28289
28289
  items = _props$items === void 0 ? [] : _props$items,
28290
+ minItemWidth = props.minItemWidth,
28291
+ maxItemWidth = props.maxItemWidth,
28290
28292
  rest = _objectWithoutProperties(props, _excluded);
28291
28293
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(),
28292
28294
  _useState2 = _slicedToArray(_useState, 2),
@@ -28394,7 +28396,9 @@ var Breadcrumbs = function Breadcrumbs(props) {
28394
28396
  key: item.text,
28395
28397
  active: index === activeIndex,
28396
28398
  item: item,
28397
- isLastItem: visibleItems.length - 1 == index
28399
+ isLastItem: visibleItems.length - 1 == index,
28400
+ minItemWidth: minItemWidth,
28401
+ maxItemWidth: maxItemWidth
28398
28402
  });
28399
28403
  });
28400
28404
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(BreadcrumbsContainer, _extends({
@@ -28418,11 +28422,17 @@ var Breadcrumbs = function Breadcrumbs(props) {
28418
28422
  }, itemsList.slice(-1))));
28419
28423
  };
28420
28424
  Breadcrumbs.displayName = 'Breadcrumbs';
28425
+ Breadcrumbs.defaultValues = {
28426
+ minItemWidth: 200,
28427
+ maxItemWidth: 400
28428
+ };
28421
28429
  Breadcrumbs.propTypes = {
28422
28430
  items: prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
28423
28431
  text: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node).isRequired,
28424
28432
  onClick: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func)
28425
- }))
28433
+ })),
28434
+ minItemWidth: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().number),
28435
+ maxItemWidth: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().number)
28426
28436
  };
28427
28437
  var BreadcrumbsContainer = styled_components__WEBPACK_IMPORTED_MODULE_2___default().nav.withConfig({
28428
28438
  displayName: "BreadcrumbsContainer",
@@ -28444,15 +28454,28 @@ __webpack_require__.r(__webpack_exports__);
28444
28454
  /* harmony export */ });
28445
28455
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
28446
28456
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
28447
- /* harmony import */ var _layout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../layout */ "./src/layout/index.js");
28448
- /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../link */ "./src/link/index.js");
28449
- /* harmony import */ var _typography__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../typography */ "./src/typography/index.js");
28450
- /* harmony import */ var _divider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./divider */ "./src/breadcrumbs/divider.js");
28457
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! styled-components */ "styled-components");
28458
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_1__);
28459
+ /* harmony import */ var _layout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../layout */ "./src/layout/index.js");
28460
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../link */ "./src/link/index.js");
28461
+ /* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../tooltip */ "./src/tooltip.js");
28462
+ /* harmony import */ var _typography__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../typography */ "./src/typography/index.js");
28463
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils */ "./src/utils.js");
28464
+ /* harmony import */ var _divider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./divider */ "./src/breadcrumbs/divider.js");
28451
28465
  // LICENSE_CODE ZON
28452
28466
 
28453
28467
 
28454
28468
  /*jslint react:true*/
28455
28469
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
28470
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
28471
+ 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."); }
28472
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
28473
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
28474
+ 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; } }
28475
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28476
+
28477
+
28478
+
28456
28479
 
28457
28480
 
28458
28481
 
@@ -28462,16 +28485,35 @@ var BreadcrumbsItem = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forward
28462
28485
  var item = props.item,
28463
28486
  isBackItem = props.isBackItem,
28464
28487
  isLastItem = props.isLastItem,
28465
- active = props.active;
28466
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_layout__WEBPACK_IMPORTED_MODULE_1__.Flex, {
28488
+ active = props.active,
28489
+ minItemWidth = props.minItemWidth,
28490
+ maxItemWidth = props.maxItemWidth;
28491
+ var labelRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
28492
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
28493
+ _useState2 = _slicedToArray(_useState, 2),
28494
+ isOverflown = _useState2[0],
28495
+ setIsOverflown = _useState2[1];
28496
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
28497
+ var element = labelRef.current;
28498
+ var compare = element ? element.offsetWidth < element.scrollWidth || element.offsetHeight < element.scrollHeight : false;
28499
+ setIsOverflown(compare);
28500
+ }, [item.text, maxItemWidth]);
28501
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_layout__WEBPACK_IMPORTED_MODULE_2__.Flex, {
28467
28502
  ref: ref
28468
- }, isLastItem && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_typography__WEBPACK_IMPORTED_MODULE_3__.Label, {
28503
+ }, isLastItem && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_tooltip__WEBPACK_IMPORTED_MODULE_4__.Tooltip, {
28504
+ noWrap: true,
28505
+ tooltip: isOverflown ? item.text : undefined
28506
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(StyledLabel, {
28507
+ ref: labelRef,
28469
28508
  "data-role": "item",
28470
28509
  "data-testid": active ? 'active-item' : 'item',
28510
+ style: {
28511
+ minWidth: (0,_utils__WEBPACK_IMPORTED_MODULE_6__.toPixel)(minItemWidth),
28512
+ maxWidth: (0,_utils__WEBPACK_IMPORTED_MODULE_6__.toPixel)(maxItemWidth)
28513
+ },
28471
28514
  variant: "xs",
28472
- color: "gray_11",
28473
- no_wrap: true
28474
- }, item.text), !isLastItem && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_link__WEBPACK_IMPORTED_MODULE_2__.Link, _extends({
28515
+ color: "gray_11"
28516
+ }, item.text)), !isLastItem && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_link__WEBPACK_IMPORTED_MODULE_3__.Link, _extends({
28475
28517
  "data-role": "item",
28476
28518
  "data-testid": active ? 'active-item' : 'item'
28477
28519
  }, item, {
@@ -28479,9 +28521,13 @@ var BreadcrumbsItem = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forward
28479
28521
  iconPlacement: "left",
28480
28522
  variant: "secondary",
28481
28523
  size: "sm"
28482
- })), !isBackItem && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_divider__WEBPACK_IMPORTED_MODULE_4__.Divider, null)));
28524
+ })), !isBackItem && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_divider__WEBPACK_IMPORTED_MODULE_7__.Divider, null)));
28483
28525
  });
28484
28526
  BreadcrumbsItem.displayName = 'BreadcrumbsItem';
28527
+ var StyledLabel = styled_components__WEBPACK_IMPORTED_MODULE_1___default()(_typography__WEBPACK_IMPORTED_MODULE_5__.Label).withConfig({
28528
+ displayName: "StyledLabel",
28529
+ componentId: "sc-19foph6-0"
28530
+ })(["white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:15px;"]);
28485
28531
 
28486
28532
  /***/ }),
28487
28533