@equinor/eds-core-react 0.33.0 → 0.33.1

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.
@@ -856,7 +856,7 @@ var useEds = function useEds() {
856
856
  return react.useContext(EdsContext);
857
857
  };
858
858
 
859
- var _excluded$1t = ["color", "variant", "children", "disabled", "href", "tabIndex", "fullWidth"];
859
+ var _excluded$1u = ["color", "variant", "children", "disabled", "href", "tabIndex", "fullWidth"];
860
860
  var getVariant = function getVariant(tokenSet, variant) {
861
861
  switch (variant) {
862
862
  case 'ghost':
@@ -898,7 +898,7 @@ var ButtonBase = styled__default.default.button.withConfig({
898
898
  var focus = states.focus,
899
899
  hover = states.hover,
900
900
  disabled = states.disabled;
901
- return styled.css(["box-sizing:border-box;margin:0;padding:0;text-decoration:none;position:relative;cursor:pointer;display:inline-block;background:", ";height:", ";width:", ";svg{justify-self:center;}", " ", " ", " &::before{position:absolute;top:0;left:0;width:auto;min-height:auto;content:'';}&::after{position:absolute;top:-", ";left:-", ";width:", ";height:", ";content:'';}@media (hover:hover) and (pointer:fine){&:hover{background:", ";color:", ";", ";}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}&:disabled,&[aria-disabled='true']{cursor:not-allowed;background:", ";", ";", ";@media (hover:hover) and (pointer:fine){&:hover{background:", ";}}}"], theme.background, theme.height, theme.width, edsUtils.spacingsTemplate(theme.spacings), edsUtils.bordersTemplate(theme.border), edsUtils.typographyTemplate(theme.typography), clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset = clickbound.offset) === null || _clickbound$offset === void 0 ? void 0 : _clickbound$offset.top, clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset2 = clickbound.offset) === null || _clickbound$offset2 === void 0 ? void 0 : _clickbound$offset2.left, clickbound === null || clickbound === void 0 ? void 0 : clickbound.width, clickbound === null || clickbound === void 0 ? void 0 : clickbound.height, hover.background, (_hover$typography = hover.typography) === null || _hover$typography === void 0 ? void 0 : _hover$typography.color, edsUtils.bordersTemplate(hover === null || hover === void 0 ? void 0 : hover.border), edsUtils.outlineTemplate(focus.outline), edsUtils.outlineTemplate(focus.outline), disabled.background, edsUtils.bordersTemplate(disabled.border), edsUtils.typographyTemplate(disabled.typography), disabled.background);
901
+ return styled.css(["box-sizing:border-box;margin:0;padding:0;text-decoration:none;position:relative;cursor:pointer;display:inline-block;background:", ";height:", ";width:", ";svg{justify-self:center;}", " ", " ", " &::before{position:absolute;top:0;left:0;width:auto;min-height:auto;content:'';}&::after{position:absolute;top:-", ";left:-", ";width:", ";height:", ";content:'';}@media (hover:hover) and (pointer:fine){&:hover{background:", ";color:", ";", ";}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}&:disabled,&[aria-disabled='true']{cursor:not-allowed;background:", ";", ";", ";@media (hover:hover) and (pointer:fine){&:hover{background:", ";}}}"], theme.background, theme.height, theme.width, edsUtils.spacingsTemplate(theme.spacings), edsUtils.bordersTemplate(theme.border), edsUtils.typographyTemplate(theme.typography), clickbound === null || clickbound === void 0 || (_clickbound$offset = clickbound.offset) === null || _clickbound$offset === void 0 ? void 0 : _clickbound$offset.top, clickbound === null || clickbound === void 0 || (_clickbound$offset2 = clickbound.offset) === null || _clickbound$offset2 === void 0 ? void 0 : _clickbound$offset2.left, clickbound === null || clickbound === void 0 ? void 0 : clickbound.width, clickbound === null || clickbound === void 0 ? void 0 : clickbound.height, hover.background, (_hover$typography = hover.typography) === null || _hover$typography === void 0 ? void 0 : _hover$typography.color, edsUtils.bordersTemplate(hover === null || hover === void 0 ? void 0 : hover.border), edsUtils.outlineTemplate(focus.outline), edsUtils.outlineTemplate(focus.outline), disabled.background, edsUtils.bordersTemplate(disabled.border), edsUtils.typographyTemplate(disabled.typography), disabled.background);
902
902
  });
903
903
  var Button$2 = /*#__PURE__*/react.forwardRef(function Button(_ref2, ref) {
904
904
  var _ref2$color = _ref2.color,
@@ -913,7 +913,7 @@ var Button$2 = /*#__PURE__*/react.forwardRef(function Button(_ref2, ref) {
913
913
  tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex,
914
914
  _ref2$fullWidth = _ref2.fullWidth,
915
915
  fullWidth = _ref2$fullWidth === void 0 ? false : _ref2$fullWidth,
916
- other = _objectWithoutProperties__default.default(_ref2, _excluded$1t);
916
+ other = _objectWithoutProperties__default.default(_ref2, _excluded$1u);
917
917
  var _useEds = useEds(),
918
918
  density = _useEds.density;
919
919
  var token = edsUtils.useToken({
@@ -950,7 +950,7 @@ var group = {
950
950
  }
951
951
  };
952
952
 
953
- var _excluded$1s = ["children", "vertical"];
953
+ var _excluded$1t = ["children", "vertical"];
954
954
  var border$5 = group.border;
955
955
  var radius$1 = border$5.radius;
956
956
  var ButtonGroupBase = styled__default.default.div.withConfig({
@@ -963,7 +963,7 @@ var ButtonGroupBase = styled__default.default.div.withConfig({
963
963
  var ButtonGroup = /*#__PURE__*/react.forwardRef(function ButtonGroup(_ref2, ref) {
964
964
  var children = _ref2.children,
965
965
  vertical = _ref2.vertical,
966
- rest = _objectWithoutProperties__default.default(_ref2, _excluded$1s);
966
+ rest = _objectWithoutProperties__default.default(_ref2, _excluded$1t);
967
967
  var props = _objectSpread__default.default({
968
968
  ref: ref,
969
969
  $vertical: vertical
@@ -1015,7 +1015,7 @@ var tooltip = {
1015
1015
  }
1016
1016
  };
1017
1017
 
1018
- var _excluded$1r = ["title", "placement", "children", "style", "enterDelay"];
1018
+ var _excluded$1s = ["title", "placement", "children", "style", "enterDelay"];
1019
1019
  var StyledTooltip = styled__default.default.div.withConfig({
1020
1020
  displayName: "Tooltip__StyledTooltip",
1021
1021
  componentId: "sc-m2im2p-0"
@@ -1036,7 +1036,7 @@ var Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip(_ref, ref) {
1036
1036
  style = _ref.style,
1037
1037
  _ref$enterDelay = _ref.enterDelay,
1038
1038
  enterDelay = _ref$enterDelay === void 0 ? 100 : _ref$enterDelay,
1039
- rest = _objectWithoutProperties__default.default(_ref, _excluded$1r);
1039
+ rest = _objectWithoutProperties__default.default(_ref, _excluded$1s);
1040
1040
  var arrowRef = react.useRef(null);
1041
1041
  var _useState = react.useState(false),
1042
1042
  _useState2 = _slicedToArray__default.default(_useState, 2),
@@ -1145,13 +1145,13 @@ var Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip(_ref, ref) {
1145
1145
  });
1146
1146
  });
1147
1147
 
1148
- var _excluded$1q = ["children", "multiple", "selectedIndexes", "onChange"];
1148
+ var _excluded$1r = ["children", "multiple", "selectedIndexes", "onChange"];
1149
1149
  var ToggleButton = /*#__PURE__*/react.forwardRef(function ToggleButton(_ref, ref) {
1150
1150
  var children = _ref.children,
1151
1151
  multiple = _ref.multiple,
1152
1152
  selectedIndexes = _ref.selectedIndexes,
1153
1153
  onChange = _ref.onChange,
1154
- props = _objectWithoutProperties__default.default(_ref, _excluded$1q);
1154
+ props = _objectWithoutProperties__default.default(_ref, _excluded$1r);
1155
1155
  var _useState = react.useState(selectedIndexes || []),
1156
1156
  _useState2 = _slicedToArray__default.default(_useState, 2),
1157
1157
  pickedIndexes = _useState2[0],
@@ -1169,7 +1169,7 @@ var ToggleButton = /*#__PURE__*/react.forwardRef(function ToggleButton(_ref, ref
1169
1169
  variant: isSelected ? 'contained' : 'outlined',
1170
1170
  onClick: function onClick(e) {
1171
1171
  var _childElement$props, _childElement$props$o;
1172
- (_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
1172
+ (_childElement$props = childElement.props) === null || _childElement$props === void 0 || (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 || _childElement$props$o.call(_childElement$props, e);
1173
1173
  var updatedSelection = [index];
1174
1174
  if (multiple) {
1175
1175
  updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(function (i) {
@@ -1246,7 +1246,7 @@ var link = {
1246
1246
  }
1247
1247
  };
1248
1248
 
1249
- var _excluded$1p = ["variant", "children", "bold", "italic", "link", "lines", "color", "group", "token", "as"];
1249
+ var _excluded$1q = ["variant", "children", "bold", "italic", "link", "lines", "color", "group", "token", "as"];
1250
1250
  var getElementType = function getElementType(variant, link) {
1251
1251
  if (link) {
1252
1252
  return 'a';
@@ -1323,7 +1323,7 @@ var Typography = /*#__PURE__*/react.forwardRef(function Typography(_ref5, ref) {
1323
1323
  group = _ref5.group,
1324
1324
  token = _ref5.token,
1325
1325
  providedAs = _ref5.as,
1326
- other = _objectWithoutProperties__default.default(_ref5, _excluded$1p);
1326
+ other = _objectWithoutProperties__default.default(_ref5, _excluded$1q);
1327
1327
  var as = providedAs ? providedAs : getElementType(variant, link);
1328
1328
  var variantName = toVariantName(variant, bold, italic, link);
1329
1329
  var typography = findTypography(variantName, group);
@@ -1464,14 +1464,14 @@ var applyVariant = function applyVariant(variant, token) {
1464
1464
  }
1465
1465
  };
1466
1466
 
1467
- var _excluded$1o = ["children"];
1467
+ var _excluded$1p = ["children"];
1468
1468
  var TableBase$1 = styled__default.default.table.withConfig({
1469
1469
  displayName: "Table__TableBase",
1470
1470
  componentId: "sc-14kktwc-0"
1471
1471
  })(["border-spacing:0;background:", ";"], tableCell.background);
1472
1472
  var Table$1 = /*#__PURE__*/react.forwardRef(function Table(_ref, ref) {
1473
1473
  var children = _ref.children,
1474
- props = _objectWithoutProperties__default.default(_ref, _excluded$1o);
1474
+ props = _objectWithoutProperties__default.default(_ref, _excluded$1p);
1475
1475
  return /*#__PURE__*/jsxRuntime.jsx(TableBase$1, _objectSpread__default.default(_objectSpread__default.default({}, props), {}, {
1476
1476
  ref: ref,
1477
1477
  children: children
@@ -1485,14 +1485,14 @@ var initalState$2 = {
1485
1485
  };
1486
1486
  var InnerContext = /*#__PURE__*/react.createContext(initalState$2);
1487
1487
 
1488
- var _excluded$1n = ["children"];
1488
+ var _excluded$1o = ["children"];
1489
1489
  var TableBase = styled__default.default.tbody.withConfig({
1490
1490
  displayName: "Body__TableBase",
1491
1491
  componentId: "sc-1pdmiku-0"
1492
1492
  })([""]);
1493
1493
  var Body = /*#__PURE__*/react.forwardRef(function Body(_ref, ref) {
1494
1494
  var children = _ref.children,
1495
- props = _objectWithoutProperties__default.default(_ref, _excluded$1n);
1495
+ props = _objectWithoutProperties__default.default(_ref, _excluded$1o);
1496
1496
  return /*#__PURE__*/jsxRuntime.jsx(InnerContext.Provider, {
1497
1497
  value: {
1498
1498
  variant: 'body'
@@ -1504,7 +1504,7 @@ var Body = /*#__PURE__*/react.forwardRef(function Body(_ref, ref) {
1504
1504
  });
1505
1505
  });
1506
1506
 
1507
- var _excluded$1m = ["children", "variant"];
1507
+ var _excluded$1n = ["children", "variant"];
1508
1508
  var StyledTableCell$1 = styled__default.default.td.withConfig({
1509
1509
  displayName: "DataCell__StyledTableCell",
1510
1510
  componentId: "sc-15tuitc-0"
@@ -1525,7 +1525,7 @@ var TableDataCell = /*#__PURE__*/react.forwardRef(function TableDataCell(_ref2,
1525
1525
  var children = _ref2.children,
1526
1526
  _ref2$variant = _ref2.variant,
1527
1527
  variant = _ref2$variant === void 0 ? 'text' : _ref2$variant,
1528
- rest = _objectWithoutProperties__default.default(_ref2, _excluded$1m);
1528
+ rest = _objectWithoutProperties__default.default(_ref2, _excluded$1n);
1529
1529
  var _useEds = useEds(),
1530
1530
  density = _useEds.density;
1531
1531
  var token = edsUtils.useToken({
@@ -1630,7 +1630,7 @@ var token$4 = {
1630
1630
  }
1631
1631
  };
1632
1632
 
1633
- var _excluded$1l = ["children", "sort", "sticky"];
1633
+ var _excluded$1m = ["children", "sort", "sticky"];
1634
1634
  var StyledTableCell = styled__default.default.th.withConfig({
1635
1635
  displayName: "HeaderCell__StyledTableCell",
1636
1636
  componentId: "sc-18w2o3a-0"
@@ -1661,7 +1661,7 @@ var TableHeaderCell = /*#__PURE__*/react.forwardRef(function TableHeaderCell(_re
1661
1661
  var children = _ref.children,
1662
1662
  sort = _ref.sort,
1663
1663
  sticky = _ref.sticky,
1664
- rest = _objectWithoutProperties__default.default(_ref, _excluded$1l);
1664
+ rest = _objectWithoutProperties__default.default(_ref, _excluded$1m);
1665
1665
  var _useEds = useEds(),
1666
1666
  density = _useEds.density;
1667
1667
  var token = edsUtils.useToken({
@@ -1721,7 +1721,7 @@ var token$3 = {
1721
1721
  }
1722
1722
  };
1723
1723
 
1724
- var _excluded$1k = ["children", "sticky"];
1724
+ var _excluded$1l = ["children", "sticky"];
1725
1725
  var StyledTableHead = styled__default.default.thead.withConfig({
1726
1726
  displayName: "Head__StyledTableHead",
1727
1727
  componentId: "sc-g9tch7-0"
@@ -1729,7 +1729,7 @@ var StyledTableHead = styled__default.default.thead.withConfig({
1729
1729
  var Head = /*#__PURE__*/react.forwardRef(function Head(_ref, ref) {
1730
1730
  var children = _ref.children,
1731
1731
  sticky = _ref.sticky,
1732
- props = _objectWithoutProperties__default.default(_ref, _excluded$1k);
1732
+ props = _objectWithoutProperties__default.default(_ref, _excluded$1l);
1733
1733
  return /*#__PURE__*/jsxRuntime.jsx(InnerContext.Provider, {
1734
1734
  value: {
1735
1735
  variant: 'head',
@@ -1756,6 +1756,7 @@ var token$2 = {
1756
1756
  }
1757
1757
  };
1758
1758
 
1759
+ var _excluded$1k = ["children", "active"];
1759
1760
  var _token$states$hover;
1760
1761
  var StyledRow = styled__default.default.tr.withConfig({
1761
1762
  displayName: "Row__StyledRow",
@@ -1766,9 +1767,9 @@ var StyledRow = styled__default.default.tr.withConfig({
1766
1767
  return $active ? (_token$states$active = token$2.states.active) === null || _token$states$active === void 0 ? void 0 : _token$states$active.background : null;
1767
1768
  }, (_token$states$hover = token$2.states.hover) === null || _token$states$hover === void 0 ? void 0 : _token$states$hover.background);
1768
1769
  var Row = /*#__PURE__*/react.forwardRef(function Row(_ref2, ref) {
1769
- var props = _extends__default.default({}, (_objectDestructuringEmpty__default.default(_ref2), _ref2));
1770
- var children = props.children,
1771
- active = props.active;
1770
+ var children = _ref2.children,
1771
+ active = _ref2.active,
1772
+ props = _objectWithoutProperties__default.default(_ref2, _excluded$1k);
1772
1773
  return /*#__PURE__*/jsxRuntime.jsx(StyledRow, _objectSpread__default.default(_objectSpread__default.default({}, props), {}, {
1773
1774
  $active: active,
1774
1775
  ref: ref,
@@ -2401,13 +2402,13 @@ var Container$4 = styled__default.default.div.withConfig({
2401
2402
  displayName: "Input__Container",
2402
2403
  componentId: "sc-1ykv024-0"
2403
2404
  })(function (_ref) {
2404
- var _entities$adornment, _entities$adornment$s;
2405
+ var _entities$adornment;
2405
2406
  var $token = _ref.$token,
2406
2407
  disabled = _ref.disabled,
2407
2408
  readOnly = _ref.readOnly;
2408
2409
  var states = $token.states,
2409
2410
  entities = $token.entities;
2410
- return styled.css(["--eds-input-adornment-color:", ";--eds-input-color:", ";position:relative;height:", ";width:", ";display:flex;flex-direction:row;border:none;box-sizing:border-box;box-shadow:", ";background:var(--eds-input-background,", ");", " &:focus-within{--eds-input-adornment-color:", ";box-shadow:none;", "}", " ", " & > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"], entities.adornment.typography.color, $token.typography.color, $token.height, $token.width, $token.boxShadow, $token.background, edsUtils.outlineTemplate($token.outline), (_entities$adornment = entities.adornment) === null || _entities$adornment === void 0 ? void 0 : (_entities$adornment$s = _entities$adornment.states.focus) === null || _entities$adornment$s === void 0 ? void 0 : _entities$adornment$s.outline.color, edsUtils.outlineTemplate(states.focus.outline), disabled && styled.css(["--eds-input-adornment-color:", ";--eds-input-color:", ";cursor:not-allowed;box-shadow:none;"], states.disabled.typography.color, states.disabled.typography.color), readOnly && styled.css({
2411
+ return styled.css(["--eds-input-adornment-color:", ";--eds-input-color:", ";position:relative;height:", ";width:", ";display:flex;flex-direction:row;border:none;box-sizing:border-box;box-shadow:", ";background:var(--eds-input-background,", ");", " &:focus-within{--eds-input-adornment-color:", ";box-shadow:none;", "}", " ", " & > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"], entities.adornment.typography.color, $token.typography.color, $token.height, $token.width, $token.boxShadow, $token.background, edsUtils.outlineTemplate($token.outline), (_entities$adornment = entities.adornment) === null || _entities$adornment === void 0 || (_entities$adornment = _entities$adornment.states.focus) === null || _entities$adornment === void 0 ? void 0 : _entities$adornment.outline.color, edsUtils.outlineTemplate(states.focus.outline), disabled && styled.css(["--eds-input-adornment-color:", ";--eds-input-color:", ";cursor:not-allowed;box-shadow:none;"], states.disabled.typography.color, states.disabled.typography.color), readOnly && styled.css({
2411
2412
  background: states.readOnly.background,
2412
2413
  boxShadow: states.readOnly.boxShadow
2413
2414
  }));
@@ -4064,10 +4065,10 @@ var Dialog$1 = /*#__PURE__*/react.forwardRef(function Dialog(_ref3, ref) {
4064
4065
  react.useEffect(function () {
4065
4066
  if (open) {
4066
4067
  var _localRef$current;
4067
- localRef === null || localRef === void 0 ? void 0 : (_localRef$current = localRef.current) === null || _localRef$current === void 0 ? void 0 : _localRef$current.showModal();
4068
+ localRef === null || localRef === void 0 || (_localRef$current = localRef.current) === null || _localRef$current === void 0 || _localRef$current.showModal();
4068
4069
  } else {
4069
4070
  var _localRef$current2;
4070
- localRef === null || localRef === void 0 ? void 0 : (_localRef$current2 = localRef.current) === null || _localRef$current2 === void 0 ? void 0 : _localRef$current2.close();
4071
+ localRef === null || localRef === void 0 || (_localRef$current2 = localRef.current) === null || _localRef$current2 === void 0 || _localRef$current2.close();
4071
4072
  }
4072
4073
  }, [open]);
4073
4074
 
@@ -4653,12 +4654,13 @@ var StyledChips = styled__default.default.div.attrs(function (_ref) {
4653
4654
  var $clickable = _ref2.$clickable;
4654
4655
  return $clickable && styled.css(["@media (hover:hover) and (pointer:fine){&:hover{cursor:pointer;color:", ";svg{fill:", ";}}}"], states$2.hover.typography.color, states$2.hover.typography.color);
4655
4656
  }, function (_ref3) {
4656
- var $variant = _ref3.$variant;
4657
+ var $variant = _ref3.$variant,
4658
+ $clickable = _ref3.$clickable;
4657
4659
  switch ($variant) {
4658
4660
  case 'active':
4659
4661
  return styled.css(["background:", ";"], states$2.active.background);
4660
4662
  case 'error':
4661
- return styled.css(["background:", ";color:", ";svg{fill:", ";}", ";@media (hover:hover) and (pointer:fine){&:hover{border-color:", ";color:", ";svg{fill:", ";}}}"], error.background, error.typography.color, error.entities.icon.typography.color, edsUtils.bordersTemplate(error.border), error.states.hover.typography.color, error.states.hover.typography.color, error.states.hover.typography.color);
4663
+ return styled.css(["background:", ";color:", ";svg{fill:", ";}", ";@media (hover:hover) and (pointer:fine){&:hover{border-color:", ";color:", ";svg{fill:", ";}}}"], error.background, error.typography.color, error.entities.icon.typography.color, edsUtils.bordersTemplate(error.border), $clickable && error.states.hover.typography.color, $clickable && error.states.hover.typography.color, $clickable && error.states.hover.typography.color);
4662
4664
  default:
4663
4665
  return '';
4664
4666
  }
@@ -5135,8 +5137,9 @@ var Slider = /*#__PURE__*/react.forwardRef(function Slider(_ref3, ref) {
5135
5137
  ariaLabelledby = _ref3.ariaLabelledby,
5136
5138
  ariaLabelledbyNative = _ref3['aria-labelledby'],
5137
5139
  rest = _objectWithoutProperties__default.default(_ref3, _excluded$C);
5138
- var isRangeSlider = Array.isArray(value);
5139
- var parsedValue = isRangeSlider ? value : [value];
5140
+ var isNumber = !Array.isArray(value);
5141
+ var isRangeSlider = !isNumber && value.length === 2;
5142
+ var parsedValue = isNumber ? [value] : value;
5140
5143
  var _useState = react.useState(parsedValue),
5141
5144
  _useState2 = _slicedToArray__default.default(_useState, 2),
5142
5145
  initalValue = _useState2[0],
@@ -5156,9 +5159,10 @@ var Slider = /*#__PURE__*/react.forwardRef(function Slider(_ref3, ref) {
5156
5159
  setSliderValue(value);
5157
5160
  }
5158
5161
  } else {
5159
- if (value !== initalValue[0]) {
5160
- setInitalValue([value]);
5161
- setSliderValue([value]);
5162
+ var numberValue = Number(value);
5163
+ if (numberValue !== initalValue[0]) {
5164
+ setInitalValue([numberValue]);
5165
+ setSliderValue([numberValue]);
5162
5166
  }
5163
5167
  }
5164
5168
  }, [value, initalValue, isRangeSlider]);
@@ -5174,12 +5178,12 @@ var Slider = /*#__PURE__*/react.forwardRef(function Slider(_ref3, ref) {
5174
5178
  if (valueArrIdx === 0 && _newValue[0] >= _newValue[1]) {
5175
5179
  var _maxRange$current;
5176
5180
  _newValue[0] = _newValue[1];
5177
- (_maxRange$current = maxRange.current) === null || _maxRange$current === void 0 ? void 0 : _maxRange$current.focus();
5181
+ (_maxRange$current = maxRange.current) === null || _maxRange$current === void 0 || _maxRange$current.focus();
5178
5182
  }
5179
5183
  if (valueArrIdx === 1 && _newValue[1] <= _newValue[0]) {
5180
5184
  var _minRange$current;
5181
5185
  _newValue[1] = _newValue[0];
5182
- (_minRange$current = minRange.current) === null || _minRange$current === void 0 ? void 0 : _minRange$current.focus();
5186
+ (_minRange$current = minRange.current) === null || _minRange$current === void 0 || _minRange$current.focus();
5183
5187
  }
5184
5188
  setSliderValue(_newValue);
5185
5189
  if (onChange) {
@@ -7261,7 +7265,7 @@ var Pagination = /*#__PURE__*/react.forwardRef(function Pagination(_ref2, ref) {
7261
7265
  edsUtils.useIsomorphicLayoutEffect(function () {
7262
7266
  if (isMounted) {
7263
7267
  setActivePage(1);
7264
- onChange === null || onChange === void 0 ? void 0 : onChange(null, 1);
7268
+ onChange === null || onChange === void 0 || onChange(null, 1);
7265
7269
  }
7266
7270
  // eslint-disable-next-line react-hooks/exhaustive-deps
7267
7271
  }, [itemsPerPage]);
@@ -8598,7 +8602,7 @@ function AutocompleteInner(props, ref) {
8598
8602
  //https://github.com/TanStack/virtual/discussions/379#discussioncomment-3501037
8599
8603
  edsUtils.useIsomorphicLayoutEffect(function () {
8600
8604
  var _rowVirtualizer$measu;
8601
- rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : (_rowVirtualizer$measu = rowVirtualizer.measure) === null || _rowVirtualizer$measu === void 0 ? void 0 : _rowVirtualizer$measu.call(rowVirtualizer);
8605
+ rowVirtualizer === null || rowVirtualizer === void 0 || (_rowVirtualizer$measu = rowVirtualizer.measure) === null || _rowVirtualizer$measu === void 0 || _rowVirtualizer$measu.call(rowVirtualizer);
8602
8606
  }, [rowVirtualizer, density]);
8603
8607
  var comboBoxProps = {
8604
8608
  items: availableItems,
@@ -8863,7 +8867,7 @@ function AutocompleteInner(props, ref) {
8863
8867
  disabled: disabled,
8864
8868
  onChange: function onChange(e) {
8865
8869
  var _e$currentTarget;
8866
- return setTypedInputValue(e === null || e === void 0 ? void 0 : (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.value);
8870
+ return setTypedInputValue(e === null || e === void 0 || (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.value);
8867
8871
  }
8868
8872
  }));
8869
8873
  var consolidatedEvents = mergeEventsFromRight(other, inputProps);
@@ -9044,7 +9048,7 @@ var SideBarProvider = function SideBarProvider(_ref) {
9044
9048
  isOpen: open
9045
9049
  });
9046
9050
  });
9047
- onToggle === null || onToggle === void 0 ? void 0 : onToggle(open);
9051
+ onToggle === null || onToggle === void 0 || onToggle(open);
9048
9052
  }, [onToggle]);
9049
9053
  var setOnToggle = function setOnToggle(onToggle) {
9050
9054
  setState(function (prevState) {
@@ -247,7 +247,7 @@ function AutocompleteInner(props, ref) {
247
247
  //https://github.com/TanStack/virtual/discussions/379#discussioncomment-3501037
248
248
  useIsomorphicLayoutEffect(function () {
249
249
  var _rowVirtualizer$measu;
250
- rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : (_rowVirtualizer$measu = rowVirtualizer.measure) === null || _rowVirtualizer$measu === void 0 ? void 0 : _rowVirtualizer$measu.call(rowVirtualizer);
250
+ rowVirtualizer === null || rowVirtualizer === void 0 || (_rowVirtualizer$measu = rowVirtualizer.measure) === null || _rowVirtualizer$measu === void 0 || _rowVirtualizer$measu.call(rowVirtualizer);
251
251
  }, [rowVirtualizer, density]);
252
252
  var comboBoxProps = {
253
253
  items: availableItems,
@@ -512,7 +512,7 @@ function AutocompleteInner(props, ref) {
512
512
  disabled: disabled,
513
513
  onChange: function onChange(e) {
514
514
  var _e$currentTarget;
515
- return setTypedInputValue(e === null || e === void 0 ? void 0 : (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.value);
515
+ return setTypedInputValue(e === null || e === void 0 || (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.value);
516
516
  }
517
517
  }));
518
518
  var consolidatedEvents = mergeEventsFromRight(other, inputProps);
@@ -50,7 +50,7 @@ var ButtonBase = styled.button.withConfig({
50
50
  var focus = states.focus,
51
51
  hover = states.hover,
52
52
  disabled = states.disabled;
53
- return css(["box-sizing:border-box;margin:0;padding:0;text-decoration:none;position:relative;cursor:pointer;display:inline-block;background:", ";height:", ";width:", ";svg{justify-self:center;}", " ", " ", " &::before{position:absolute;top:0;left:0;width:auto;min-height:auto;content:'';}&::after{position:absolute;top:-", ";left:-", ";width:", ";height:", ";content:'';}@media (hover:hover) and (pointer:fine){&:hover{background:", ";color:", ";", ";}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}&:disabled,&[aria-disabled='true']{cursor:not-allowed;background:", ";", ";", ";@media (hover:hover) and (pointer:fine){&:hover{background:", ";}}}"], theme.background, theme.height, theme.width, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset = clickbound.offset) === null || _clickbound$offset === void 0 ? void 0 : _clickbound$offset.top, clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset2 = clickbound.offset) === null || _clickbound$offset2 === void 0 ? void 0 : _clickbound$offset2.left, clickbound === null || clickbound === void 0 ? void 0 : clickbound.width, clickbound === null || clickbound === void 0 ? void 0 : clickbound.height, hover.background, (_hover$typography = hover.typography) === null || _hover$typography === void 0 ? void 0 : _hover$typography.color, bordersTemplate(hover === null || hover === void 0 ? void 0 : hover.border), outlineTemplate(focus.outline), outlineTemplate(focus.outline), disabled.background, bordersTemplate(disabled.border), typographyTemplate(disabled.typography), disabled.background);
53
+ return css(["box-sizing:border-box;margin:0;padding:0;text-decoration:none;position:relative;cursor:pointer;display:inline-block;background:", ";height:", ";width:", ";svg{justify-self:center;}", " ", " ", " &::before{position:absolute;top:0;left:0;width:auto;min-height:auto;content:'';}&::after{position:absolute;top:-", ";left:-", ";width:", ";height:", ";content:'';}@media (hover:hover) and (pointer:fine){&:hover{background:", ";color:", ";", ";}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}&:disabled,&[aria-disabled='true']{cursor:not-allowed;background:", ";", ";", ";@media (hover:hover) and (pointer:fine){&:hover{background:", ";}}}"], theme.background, theme.height, theme.width, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), clickbound === null || clickbound === void 0 || (_clickbound$offset = clickbound.offset) === null || _clickbound$offset === void 0 ? void 0 : _clickbound$offset.top, clickbound === null || clickbound === void 0 || (_clickbound$offset2 = clickbound.offset) === null || _clickbound$offset2 === void 0 ? void 0 : _clickbound$offset2.left, clickbound === null || clickbound === void 0 ? void 0 : clickbound.width, clickbound === null || clickbound === void 0 ? void 0 : clickbound.height, hover.background, (_hover$typography = hover.typography) === null || _hover$typography === void 0 ? void 0 : _hover$typography.color, bordersTemplate(hover === null || hover === void 0 ? void 0 : hover.border), outlineTemplate(focus.outline), outlineTemplate(focus.outline), disabled.background, bordersTemplate(disabled.border), typographyTemplate(disabled.typography), disabled.background);
54
54
  });
55
55
  var Button = /*#__PURE__*/forwardRef(function Button(_ref2, ref) {
56
56
  var _ref2$color = _ref2.color,
@@ -32,7 +32,7 @@ var ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
32
32
  variant: isSelected ? 'contained' : 'outlined',
33
33
  onClick: function onClick(e) {
34
34
  var _childElement$props, _childElement$props$o;
35
- (_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
35
+ (_childElement$props = childElement.props) === null || _childElement$props === void 0 || (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 || _childElement$props$o.call(_childElement$props, e);
36
36
  var updatedSelection = [index];
37
37
  if (multiple) {
38
38
  updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(function (i) {
@@ -30,12 +30,13 @@ var StyledChips = styled.div.attrs(function (_ref) {
30
30
  var $clickable = _ref2.$clickable;
31
31
  return $clickable && css(["@media (hover:hover) and (pointer:fine){&:hover{cursor:pointer;color:", ";svg{fill:", ";}}}"], states.hover.typography.color, states.hover.typography.color);
32
32
  }, function (_ref3) {
33
- var $variant = _ref3.$variant;
33
+ var $variant = _ref3.$variant,
34
+ $clickable = _ref3.$clickable;
34
35
  switch ($variant) {
35
36
  case 'active':
36
37
  return css(["background:", ";"], states.active.background);
37
38
  case 'error':
38
- return css(["background:", ";color:", ";svg{fill:", ";}", ";@media (hover:hover) and (pointer:fine){&:hover{border-color:", ";color:", ";svg{fill:", ";}}}"], error.background, error.typography.color, error.entities.icon.typography.color, bordersTemplate(error.border), error.states.hover.typography.color, error.states.hover.typography.color, error.states.hover.typography.color);
39
+ return css(["background:", ";color:", ";svg{fill:", ";}", ";@media (hover:hover) and (pointer:fine){&:hover{border-color:", ";color:", ";svg{fill:", ";}}}"], error.background, error.typography.color, error.entities.icon.typography.color, bordersTemplate(error.border), $clickable && error.states.hover.typography.color, $clickable && error.states.hover.typography.color, $clickable && error.states.hover.typography.color);
39
40
  default:
40
41
  return '';
41
42
  }
@@ -47,10 +47,10 @@ var Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref3, ref) {
47
47
  useEffect(function () {
48
48
  if (open) {
49
49
  var _localRef$current;
50
- localRef === null || localRef === void 0 ? void 0 : (_localRef$current = localRef.current) === null || _localRef$current === void 0 ? void 0 : _localRef$current.showModal();
50
+ localRef === null || localRef === void 0 || (_localRef$current = localRef.current) === null || _localRef$current === void 0 || _localRef$current.showModal();
51
51
  } else {
52
52
  var _localRef$current2;
53
- localRef === null || localRef === void 0 ? void 0 : (_localRef$current2 = localRef.current) === null || _localRef$current2 === void 0 ? void 0 : _localRef$current2.close();
53
+ localRef === null || localRef === void 0 || (_localRef$current2 = localRef.current) === null || _localRef$current2 === void 0 || _localRef$current2.close();
54
54
  }
55
55
  }, [open]);
56
56
 
@@ -13,13 +13,13 @@ var Container = styled.div.withConfig({
13
13
  displayName: "Input__Container",
14
14
  componentId: "sc-1ykv024-0"
15
15
  })(function (_ref) {
16
- var _entities$adornment, _entities$adornment$s;
16
+ var _entities$adornment;
17
17
  var $token = _ref.$token,
18
18
  disabled = _ref.disabled,
19
19
  readOnly = _ref.readOnly;
20
20
  var states = $token.states,
21
21
  entities = $token.entities;
22
- return css(["--eds-input-adornment-color:", ";--eds-input-color:", ";position:relative;height:", ";width:", ";display:flex;flex-direction:row;border:none;box-sizing:border-box;box-shadow:", ";background:var(--eds-input-background,", ");", " &:focus-within{--eds-input-adornment-color:", ";box-shadow:none;", "}", " ", " & > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"], entities.adornment.typography.color, $token.typography.color, $token.height, $token.width, $token.boxShadow, $token.background, outlineTemplate($token.outline), (_entities$adornment = entities.adornment) === null || _entities$adornment === void 0 ? void 0 : (_entities$adornment$s = _entities$adornment.states.focus) === null || _entities$adornment$s === void 0 ? void 0 : _entities$adornment$s.outline.color, outlineTemplate(states.focus.outline), disabled && css(["--eds-input-adornment-color:", ";--eds-input-color:", ";cursor:not-allowed;box-shadow:none;"], states.disabled.typography.color, states.disabled.typography.color), readOnly && css({
22
+ return css(["--eds-input-adornment-color:", ";--eds-input-color:", ";position:relative;height:", ";width:", ";display:flex;flex-direction:row;border:none;box-sizing:border-box;box-shadow:", ";background:var(--eds-input-background,", ");", " &:focus-within{--eds-input-adornment-color:", ";box-shadow:none;", "}", " ", " & > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}"], entities.adornment.typography.color, $token.typography.color, $token.height, $token.width, $token.boxShadow, $token.background, outlineTemplate($token.outline), (_entities$adornment = entities.adornment) === null || _entities$adornment === void 0 || (_entities$adornment = _entities$adornment.states.focus) === null || _entities$adornment === void 0 ? void 0 : _entities$adornment.outline.color, outlineTemplate(states.focus.outline), disabled && css(["--eds-input-adornment-color:", ";--eds-input-color:", ";cursor:not-allowed;box-shadow:none;"], states.disabled.typography.color, states.disabled.typography.color), readOnly && css({
23
23
  background: states.readOnly.background,
24
24
  boxShadow: states.readOnly.boxShadow
25
25
  }));
@@ -83,7 +83,7 @@ var Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
83
83
  useIsomorphicLayoutEffect(function () {
84
84
  if (isMounted) {
85
85
  setActivePage(1);
86
- onChange === null || onChange === void 0 ? void 0 : onChange(null, 1);
86
+ onChange === null || onChange === void 0 || onChange(null, 1);
87
87
  }
88
88
  // eslint-disable-next-line react-hooks/exhaustive-deps
89
89
  }, [itemsPerPage]);
@@ -22,7 +22,7 @@ var SideBarProvider = function SideBarProvider(_ref) {
22
22
  isOpen: open
23
23
  });
24
24
  });
25
- onToggle === null || onToggle === void 0 ? void 0 : onToggle(open);
25
+ onToggle === null || onToggle === void 0 || onToggle(open);
26
26
  }, [onToggle]);
27
27
  var setOnToggle = function setOnToggle(onToggle) {
28
28
  setState(function (prevState) {
@@ -91,8 +91,9 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
91
91
  ariaLabelledby = _ref3.ariaLabelledby,
92
92
  ariaLabelledbyNative = _ref3['aria-labelledby'],
93
93
  rest = _objectWithoutProperties(_ref3, _excluded);
94
- var isRangeSlider = Array.isArray(value);
95
- var parsedValue = isRangeSlider ? value : [value];
94
+ var isNumber = !Array.isArray(value);
95
+ var isRangeSlider = !isNumber && value.length === 2;
96
+ var parsedValue = isNumber ? [value] : value;
96
97
  var _useState = useState(parsedValue),
97
98
  _useState2 = _slicedToArray(_useState, 2),
98
99
  initalValue = _useState2[0],
@@ -112,9 +113,10 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
112
113
  setSliderValue(value);
113
114
  }
114
115
  } else {
115
- if (value !== initalValue[0]) {
116
- setInitalValue([value]);
117
- setSliderValue([value]);
116
+ var numberValue = Number(value);
117
+ if (numberValue !== initalValue[0]) {
118
+ setInitalValue([numberValue]);
119
+ setSliderValue([numberValue]);
118
120
  }
119
121
  }
120
122
  }, [value, initalValue, isRangeSlider]);
@@ -130,12 +132,12 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
130
132
  if (valueArrIdx === 0 && _newValue[0] >= _newValue[1]) {
131
133
  var _maxRange$current;
132
134
  _newValue[0] = _newValue[1];
133
- (_maxRange$current = maxRange.current) === null || _maxRange$current === void 0 ? void 0 : _maxRange$current.focus();
135
+ (_maxRange$current = maxRange.current) === null || _maxRange$current === void 0 || _maxRange$current.focus();
134
136
  }
135
137
  if (valueArrIdx === 1 && _newValue[1] <= _newValue[0]) {
136
138
  var _minRange$current;
137
139
  _newValue[1] = _newValue[0];
138
- (_minRange$current = minRange.current) === null || _minRange$current === void 0 ? void 0 : _minRange$current.focus();
140
+ (_minRange$current = minRange.current) === null || _minRange$current === void 0 || _minRange$current.focus();
139
141
  }
140
142
  setSliderValue(_newValue);
141
143
  if (onChange) {
@@ -1,11 +1,11 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
3
- import _extends from '@babel/runtime/helpers/extends';
2
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
3
  import { forwardRef } from 'react';
5
4
  import styled from 'styled-components';
6
5
  import { token } from './Row.tokens.js';
7
6
  import { jsx } from 'react/jsx-runtime';
8
7
 
8
+ var _excluded = ["children", "active"];
9
9
  var _token$states$hover;
10
10
  var StyledRow = styled.tr.withConfig({
11
11
  displayName: "Row__StyledRow",
@@ -16,9 +16,9 @@ var StyledRow = styled.tr.withConfig({
16
16
  return $active ? (_token$states$active = token.states.active) === null || _token$states$active === void 0 ? void 0 : _token$states$active.background : null;
17
17
  }, (_token$states$hover = token.states.hover) === null || _token$states$hover === void 0 ? void 0 : _token$states$hover.background);
18
18
  var Row = /*#__PURE__*/forwardRef(function Row(_ref2, ref) {
19
- var props = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
20
- var children = props.children,
21
- active = props.active;
19
+ var children = _ref2.children,
20
+ active = _ref2.active,
21
+ props = _objectWithoutProperties(_ref2, _excluded);
22
22
  return /*#__PURE__*/jsx(StyledRow, _objectSpread(_objectSpread({}, props), {}, {
23
23
  $active: active,
24
24
  ref: ref,
@@ -18,7 +18,7 @@ export type ButtonProps = {
18
18
  * @default 'button'
19
19
  */
20
20
  type?: string;
21
- /** FullWidth (stretched) button */
21
+ /** Floats icon to the side if button is stretched beyond its intrinsic width */
22
22
  fullWidth?: boolean;
23
23
  } & ButtonHTMLAttributes<HTMLButtonElement>;
24
24
  export declare const Button: OverridableComponent<ButtonProps, HTMLButtonElement>;
@@ -8,9 +8,9 @@ export type SliderProps = {
8
8
  /** Components value, range of numbers */
9
9
  value: number[] | number;
10
10
  /** Function to be called when value change */
11
- onChange?: (event: ChangeEvent<HTMLInputElement>, newValue: number[] | number) => void;
11
+ onChange?: (event: ChangeEvent<HTMLInputElement>, newValue: number[]) => void;
12
12
  /** Function to be called when value is committed by mouseup event */
13
- onChangeCommitted?: (event: MouseEvent | KeyboardEvent, newValue: number[] | number) => void;
13
+ onChangeCommitted?: (event: MouseEvent | KeyboardEvent, newValue: number[]) => void;
14
14
  /** Function for formatting the displayed value. E.g. formatting dates, or adding a unit suffix */
15
15
  outputFunction?: (value: number) => string;
16
16
  /** Max value */
@@ -35,9 +35,9 @@ export declare const Slider: import("react").ForwardRefExoticComponent<{
35
35
  /** Components value, range of numbers */
36
36
  value: number[] | number;
37
37
  /** Function to be called when value change */
38
- onChange?: (event: ChangeEvent<HTMLInputElement>, newValue: number[] | number) => void;
38
+ onChange?: (event: ChangeEvent<HTMLInputElement>, newValue: number[]) => void;
39
39
  /** Function to be called when value is committed by mouseup event */
40
- onChangeCommitted?: (event: MouseEvent | KeyboardEvent, newValue: number[] | number) => void;
40
+ onChangeCommitted?: (event: MouseEvent | KeyboardEvent, newValue: number[]) => void;
41
41
  /** Function for formatting the displayed value. E.g. formatting dates, or adding a unit suffix */
42
42
  outputFunction?: (value: number) => string;
43
43
  /** Max value */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -82,13 +82,13 @@
82
82
  "styled-components": ">=4.2"
83
83
  },
84
84
  "dependencies": {
85
- "@babel/runtime": "^7.22.5",
85
+ "@babel/runtime": "^7.23.2",
86
86
  "@floating-ui/react": "^0.25.1",
87
87
  "@tanstack/react-virtual": "3.0.0-beta.54",
88
88
  "downshift": "^8.2.1",
89
89
  "@equinor/eds-icons": "^0.19.3",
90
- "@equinor/eds-utils": "0.8.2",
91
- "@equinor/eds-tokens": "0.9.2"
90
+ "@equinor/eds-tokens": "0.9.2",
91
+ "@equinor/eds-utils": "0.8.3"
92
92
  },
93
93
  "engines": {
94
94
  "pnpm": ">=4",