@equinor/echo-components 0.6.3 → 0.6.4

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/dist/index.js CHANGED
@@ -18413,8 +18413,8 @@ var InlineTagIconLink = function InlineTagIconLink(_ref) {
18413
18413
  }, description)));
18414
18414
  };
18415
18415
 
18416
- var css_248z$k = ".MainLegend-module_accordion__xjveF{align-items:center;align-self:flex-start;background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;display:flex;font-size:.875rem;font-weight:500;height:2.25rem;justify-content:space-between;margin-top:2px;max-width:460px;padding:8px 14px;user-select:none;width:100%}.MainLegend-module_accordion__xjveF:hover{background:rgba(0,0,0,.9);color:var(--white)}.MainLegend-module_left__NKMwB,.MainLegend-module_right__0BIFF{align-items:center;display:flex}.MainLegend-module_icon__neT4f{margin-right:8px}.MainLegend-module_content__nzDkL{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding-right:4px}.MainLegend-module_content__nzDkL::-webkit-scrollbar{width:8px}.MainLegend-module_content__nzDkL::-webkit-scrollbar-thumb{background:rgba(0,0,0,.65)}.MainLegend-module_content__nzDkL::-webkit-scrollbar-track{background:none}.MainLegend-module_layerIcon__xI2Mf{margin-right:10px}.MainLegend-module_layerIcon__xI2Mf:last-of-type{margin-right:0}";
18417
- var styles$i = {"accordion":"MainLegend-module_accordion__xjveF","left":"MainLegend-module_left__NKMwB","right":"MainLegend-module_right__0BIFF","icon":"MainLegend-module_icon__neT4f","content":"MainLegend-module_content__nzDkL","layerIcon":"MainLegend-module_layerIcon__xI2Mf"};
18416
+ var css_248z$k = ".MainLegend-module_accordion__xjveF{align-items:center;align-self:flex-start;background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;display:flex;font-size:.875rem;font-weight:500;height:2.25rem;justify-content:space-between;margin-top:2px;max-width:460px;padding:8px 14px;user-select:none;width:100%}.MainLegend-module_accordionDesktop__Z7SS-:hover{background:rgba(0,0,0,.9);color:var(--white)}.MainLegend-module_accordionMobile__tOTvf{width:278px}.MainLegend-module_left__NKMwB,.MainLegend-module_right__0BIFF{align-items:center;display:flex}.MainLegend-module_icon__neT4f{margin-right:8px}.MainLegend-module_content__nzDkL{align-self:stretch;display:flex;flex-direction:column;overflow:auto;padding-right:4px}.MainLegend-module_content__nzDkL::-webkit-scrollbar{width:8px}.MainLegend-module_content__nzDkL::-webkit-scrollbar-thumb{background:rgba(0,0,0,.65)}.MainLegend-module_content__nzDkL::-webkit-scrollbar-track{background:none}.MainLegend-module_contentMobile__msQoO{padding-right:0;width:278px}.MainLegend-module_contentMobile__msQoO::-webkit-scrollbar{display:none}.MainLegend-module_layerIcon__xI2Mf{margin-right:10px}.MainLegend-module_layerIcon__xI2Mf:last-of-type{margin-right:0}";
18417
+ var styles$i = {"accordion":"MainLegend-module_accordion__xjveF","accordionDesktop":"MainLegend-module_accordionDesktop__Z7SS- MainLegend-module_accordion__xjveF","accordionMobile":"MainLegend-module_accordionMobile__tOTvf MainLegend-module_accordion__xjveF","left":"MainLegend-module_left__NKMwB","right":"MainLegend-module_right__0BIFF","icon":"MainLegend-module_icon__neT4f","content":"MainLegend-module_content__nzDkL","contentMobile":"MainLegend-module_contentMobile__msQoO MainLegend-module_content__nzDkL","layerIcon":"MainLegend-module_layerIcon__xI2Mf"};
18418
18418
  styleInject(css_248z$k);
18419
18419
 
18420
18420
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
@@ -18444,6 +18444,7 @@ function separateLayers(layers) {
18444
18444
  return [iconLayers, nonIconLayers];
18445
18445
  }
18446
18446
  function MainLegend(_ref) {
18447
+ var _classnames, _classnames2;
18447
18448
  var legends = _ref.legends,
18448
18449
  layers = _ref.layers,
18449
18450
  legendStyle = _ref.legendStyle,
@@ -18481,12 +18482,14 @@ function MainLegend(_ref) {
18481
18482
  }).join(' ');
18482
18483
  return undefined;
18483
18484
  };
18485
+ var accordion = classnames$1((_classnames = {}, _defineProperty$1(_classnames, styles$i.accordionMobile, isMobile), _defineProperty$1(_classnames, styles$i.accordionDesktop, !isMobile), _classnames));
18486
+ var content = classnames$1((_classnames2 = {}, _defineProperty$1(_classnames2, styles$i.contentMobile, isMobile), _defineProperty$1(_classnames2, styles$i.content, !isMobile), _classnames2));
18484
18487
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isOpen && /*#__PURE__*/React__default.createElement("div", {
18485
18488
  style: legendContentStyle,
18486
- className: styles$i.content
18489
+ className: content
18487
18490
  }, legends), /*#__PURE__*/React__default.createElement("button", {
18488
18491
  style: legendStyle,
18489
- className: styles$i.accordion,
18492
+ className: accordion,
18490
18493
  onClick: toggle,
18491
18494
  role: "widget"
18492
18495
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -18520,12 +18523,12 @@ function MainLegend(_ref) {
18520
18523
  }, /*#__PURE__*/React__default.createElement("div", null, "+", defaultLayers.length)))));
18521
18524
  }
18522
18525
 
18523
- var css_248z$j = ".LayerLegend-module_layerLegendContainer__DLfLy{background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;font-weight:500;margin-bottom:2px;max-width:460px;user-select:none}.LayerLegend-module_layerLegendContainer__DLfLy:last-of-type{margin-bottom:0}.LayerLegend-module_header__8NHIX{align-items:center;display:flex;height:2.5rem;justify-content:space-between;padding:12px;width:100%}.LayerLegend-module_activeHeader__EBvGl{cursor:pointer}.LayerLegend-module_activeHeader__EBvGl:hover{background:rgba(0,0,0,.9);border-radius:4px;color:var(--white)}.LayerLegend-module_leftInactive__1Lq18{align-items:center;display:flex;font-size:.875rem}.LayerLegend-module_leftActive__KrRDh{font-weight:700}.LayerLegend-module_right__-IwVs{align-items:center;display:flex;font-size:.625rem}.LayerLegend-module_icon__8VwWd{margin-right:8px}.LayerLegend-module_content__ElkbY{cursor:auto;height:auto;padding-bottom:14px;padding-top:8px;width:100%}.LayerLegend-module_items__BC1cp{margin-right:4px}";
18524
- var styles$h = {"layerLegendContainer":"LayerLegend-module_layerLegendContainer__DLfLy","header":"LayerLegend-module_header__8NHIX","activeHeader":"LayerLegend-module_activeHeader__EBvGl LayerLegend-module_header__8NHIX","disabledHeader":"LayerLegend-module_disabledHeader__Rd25i LayerLegend-module_header__8NHIX","leftInactive":"LayerLegend-module_leftInactive__1Lq18","leftActive":"LayerLegend-module_leftActive__KrRDh LayerLegend-module_leftInactive__1Lq18","right":"LayerLegend-module_right__-IwVs","icon":"LayerLegend-module_icon__8VwWd","content":"LayerLegend-module_content__ElkbY","items":"LayerLegend-module_items__BC1cp"};
18526
+ var css_248z$j = ".LayerLegend-module_layerLegendContainer__DLfLy{background:rgba(0,0,0,.65);border-radius:4px;color:var(--white);cursor:pointer;font-weight:500;margin-bottom:2px;max-width:460px;user-select:none}.LayerLegend-module_layerLegendContainer__DLfLy:last-of-type{margin-bottom:0}.LayerLegend-module_header__8NHIX{align-items:center;display:flex;height:2.5rem;justify-content:space-between;padding:12px;width:100%}.LayerLegend-module_desktopHeader__ztHh3{cursor:pointer}.LayerLegend-module_desktopHeader__ztHh3:hover{background:rgba(0,0,0,.9);border-radius:4px;color:var(--white)}.LayerLegend-module_leftInactive__1Lq18{align-items:center;display:flex;font-size:.875rem}.LayerLegend-module_leftActive__KrRDh{font-weight:700}.LayerLegend-module_right__-IwVs{align-items:center;display:flex;font-size:.625rem}.LayerLegend-module_icon__8VwWd{margin-right:8px}.LayerLegend-module_content__ElkbY{cursor:auto;height:auto;padding-bottom:14px;padding-top:8px;width:100%}.LayerLegend-module_items__BC1cp{margin-right:4px}";
18527
+ var styles$h = {"layerLegendContainer":"LayerLegend-module_layerLegendContainer__DLfLy","header":"LayerLegend-module_header__8NHIX","desktopHeader":"LayerLegend-module_desktopHeader__ztHh3 LayerLegend-module_header__8NHIX","mobileHeader":"LayerLegend-module_mobileHeader__qDHmS LayerLegend-module_header__8NHIX","disabledHeader":"LayerLegend-module_disabledHeader__Rd25i LayerLegend-module_header__8NHIX","leftInactive":"LayerLegend-module_leftInactive__1Lq18","leftActive":"LayerLegend-module_leftActive__KrRDh LayerLegend-module_leftInactive__1Lq18","right":"LayerLegend-module_right__-IwVs","icon":"LayerLegend-module_icon__8VwWd","content":"LayerLegend-module_content__ElkbY","items":"LayerLegend-module_items__BC1cp"};
18525
18528
  styleInject(css_248z$j);
18526
18529
 
18527
18530
  function LayerLegend(_ref) {
18528
- var _classnames;
18531
+ var _classnames, _classnames2;
18529
18532
  var title = _ref.title,
18530
18533
  iconName = _ref.iconName,
18531
18534
  itemsCount = _ref.itemsCount,
@@ -18537,17 +18540,19 @@ function LayerLegend(_ref) {
18537
18540
  _useState2 = _slicedToArray(_useState, 2),
18538
18541
  isOpen = _useState2[0],
18539
18542
  setIsOpen = _useState2[1];
18543
+ var isMobile = useIsMobile();
18540
18544
  var toggle = function toggle() {
18541
18545
  setIsOpen(function (isOpen) {
18542
18546
  return !isOpen;
18543
18547
  });
18544
18548
  };
18545
18549
  var left = classnames$1((_classnames = {}, _defineProperty$1(_classnames, styles$h.leftActive, isOpen), _defineProperty$1(_classnames, styles$h.leftInactive, !isOpen), _classnames));
18550
+ var header = classnames$1((_classnames2 = {}, _defineProperty$1(_classnames2, styles$h.mobileHeader, isMobile), _defineProperty$1(_classnames2, styles$h.desktopHeader, !isMobile), _classnames2));
18546
18551
  return /*#__PURE__*/React__default.createElement("div", {
18547
18552
  style: style,
18548
18553
  className: styles$h.layerLegendContainer
18549
18554
  }, /*#__PURE__*/React__default.createElement("button", {
18550
- className: disabled ? styles$h.disabledHeader : styles$h.activeHeader,
18555
+ className: disabled ? styles$h.disabledHeader : header,
18551
18556
  onClick: toggle,
18552
18557
  "aria-expanded": isOpen,
18553
18558
  "aria-controls": "legendContent",
@@ -18560,9 +18565,9 @@ function LayerLegend(_ref) {
18560
18565
  name: iconName
18561
18566
  }), /*#__PURE__*/React__default.createElement("div", null, title)), /*#__PURE__*/React__default.createElement("div", {
18562
18567
  className: styles$h.right
18563
- }, /*#__PURE__*/React__default.createElement("div", {
18568
+ }, !isMobile && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
18564
18569
  className: styles$h.items
18565
- }, itemsTitle ? itemsTitle.toUpperCase() : 'ITEMS', ":"), /*#__PURE__*/React__default.createElement("div", null, itemsCount), !disabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isOpen ? /*#__PURE__*/React__default.createElement(Icon$1, {
18570
+ }, itemsTitle ? itemsTitle.toUpperCase() : 'ITEMS', ":"), /*#__PURE__*/React__default.createElement("div", null, itemsCount)), !disabled && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isOpen ? /*#__PURE__*/React__default.createElement(Icon$1, {
18566
18571
  size: 24,
18567
18572
  name: "chevron_up"
18568
18573
  }) : /*#__PURE__*/React__default.createElement(Icon$1, {