@equinor/eds-core-react 0.14.2 → 0.14.3

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.
@@ -396,7 +396,7 @@ object-assign
396
396
  */
397
397
  /* eslint-disable no-unused-vars */
398
398
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
399
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
399
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
400
400
  var propIsEnumerable = Object.prototype.propertyIsEnumerable;
401
401
 
402
402
  function toObject(val) {
@@ -460,7 +460,7 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
460
460
  from = Object(arguments[s]);
461
461
 
462
462
  for (var key in from) {
463
- if (hasOwnProperty$1.call(from, key)) {
463
+ if (hasOwnProperty.call(from, key)) {
464
464
  to[key] = from[key];
465
465
  }
466
466
  }
@@ -7830,348 +7830,16 @@ var List$1 = List$2;
7830
7830
  List$1.Item = ListItem$4;
7831
7831
  List$1.Item.displayName = 'List.Item';
7832
7832
 
7833
- /** Detect free variable `global` from Node.js. */
7834
-
7835
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
7836
-
7837
- var _freeGlobal = freeGlobal$1;
7838
-
7839
- var freeGlobal = _freeGlobal;
7840
-
7841
- /** Detect free variable `self`. */
7842
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
7843
-
7844
- /** Used as a reference to the global object. */
7845
- var root$1 = freeGlobal || freeSelf || Function('return this')();
7846
-
7847
- var _root = root$1;
7848
-
7849
- var root = _root;
7850
-
7851
- /** Built-in value references. */
7852
- var Symbol$4 = root.Symbol;
7853
-
7854
- var _Symbol = Symbol$4;
7855
-
7856
- /**
7857
- * A specialized version of `_.map` for arrays without support for iteratee
7858
- * shorthands.
7859
- *
7860
- * @private
7861
- * @param {Array} [array] The array to iterate over.
7862
- * @param {Function} iteratee The function invoked per iteration.
7863
- * @returns {Array} Returns the new mapped array.
7864
- */
7865
-
7866
- function arrayMap$1(array, iteratee) {
7867
- var index = -1,
7868
- length = array == null ? 0 : array.length,
7869
- result = Array(length);
7870
-
7871
- while (++index < length) {
7872
- result[index] = iteratee(array[index], index, array);
7873
- }
7874
- return result;
7875
- }
7876
-
7877
- var _arrayMap = arrayMap$1;
7878
-
7879
- /**
7880
- * Checks if `value` is classified as an `Array` object.
7881
- *
7882
- * @static
7883
- * @memberOf _
7884
- * @since 0.1.0
7885
- * @category Lang
7886
- * @param {*} value The value to check.
7887
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
7888
- * @example
7889
- *
7890
- * _.isArray([1, 2, 3]);
7891
- * // => true
7892
- *
7893
- * _.isArray(document.body.children);
7894
- * // => false
7895
- *
7896
- * _.isArray('abc');
7897
- * // => false
7898
- *
7899
- * _.isArray(_.noop);
7900
- * // => false
7901
- */
7902
-
7903
- var isArray$1 = Array.isArray;
7904
-
7905
- var isArray_1 = isArray$1;
7906
-
7907
- var Symbol$3 = _Symbol;
7908
-
7909
- /** Used for built-in method references. */
7910
- var objectProto$1 = Object.prototype;
7911
-
7912
- /** Used to check objects for own properties. */
7913
- var hasOwnProperty = objectProto$1.hasOwnProperty;
7914
-
7915
- /**
7916
- * Used to resolve the
7917
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
7918
- * of values.
7919
- */
7920
- var nativeObjectToString$1 = objectProto$1.toString;
7921
-
7922
- /** Built-in value references. */
7923
- var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : undefined;
7924
-
7925
- /**
7926
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
7927
- *
7928
- * @private
7929
- * @param {*} value The value to query.
7930
- * @returns {string} Returns the raw `toStringTag`.
7931
- */
7932
- function getRawTag$1(value) {
7933
- var isOwn = hasOwnProperty.call(value, symToStringTag$1),
7934
- tag = value[symToStringTag$1];
7935
-
7936
- try {
7937
- value[symToStringTag$1] = undefined;
7938
- var unmasked = true;
7939
- } catch (e) {}
7940
-
7941
- var result = nativeObjectToString$1.call(value);
7942
- if (unmasked) {
7943
- if (isOwn) {
7944
- value[symToStringTag$1] = tag;
7945
- } else {
7946
- delete value[symToStringTag$1];
7947
- }
7948
- }
7949
- return result;
7950
- }
7951
-
7952
- var _getRawTag = getRawTag$1;
7953
-
7954
- /** Used for built-in method references. */
7955
-
7956
- var objectProto = Object.prototype;
7957
-
7958
- /**
7959
- * Used to resolve the
7960
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
7961
- * of values.
7962
- */
7963
- var nativeObjectToString = objectProto.toString;
7964
-
7965
- /**
7966
- * Converts `value` to a string using `Object.prototype.toString`.
7967
- *
7968
- * @private
7969
- * @param {*} value The value to convert.
7970
- * @returns {string} Returns the converted string.
7971
- */
7972
- function objectToString$1(value) {
7973
- return nativeObjectToString.call(value);
7974
- }
7975
-
7976
- var _objectToString = objectToString$1;
7977
-
7978
- var Symbol$2 = _Symbol,
7979
- getRawTag = _getRawTag,
7980
- objectToString = _objectToString;
7981
-
7982
- /** `Object#toString` result references. */
7983
- var nullTag = '[object Null]',
7984
- undefinedTag = '[object Undefined]';
7985
-
7986
- /** Built-in value references. */
7987
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
7988
-
7989
- /**
7990
- * The base implementation of `getTag` without fallbacks for buggy environments.
7991
- *
7992
- * @private
7993
- * @param {*} value The value to query.
7994
- * @returns {string} Returns the `toStringTag`.
7995
- */
7996
- function baseGetTag$1(value) {
7997
- if (value == null) {
7998
- return value === undefined ? undefinedTag : nullTag;
7999
- }
8000
- return (symToStringTag && symToStringTag in Object(value))
8001
- ? getRawTag(value)
8002
- : objectToString(value);
8003
- }
8004
-
8005
- var _baseGetTag = baseGetTag$1;
8006
-
8007
- /**
8008
- * Checks if `value` is object-like. A value is object-like if it's not `null`
8009
- * and has a `typeof` result of "object".
8010
- *
8011
- * @static
8012
- * @memberOf _
8013
- * @since 4.0.0
8014
- * @category Lang
8015
- * @param {*} value The value to check.
8016
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
8017
- * @example
8018
- *
8019
- * _.isObjectLike({});
8020
- * // => true
8021
- *
8022
- * _.isObjectLike([1, 2, 3]);
8023
- * // => true
8024
- *
8025
- * _.isObjectLike(_.noop);
8026
- * // => false
8027
- *
8028
- * _.isObjectLike(null);
8029
- * // => false
8030
- */
8031
-
8032
- function isObjectLike$1(value) {
8033
- return value != null && typeof value == 'object';
8034
- }
8035
-
8036
- var isObjectLike_1 = isObjectLike$1;
8037
-
8038
- var baseGetTag = _baseGetTag,
8039
- isObjectLike = isObjectLike_1;
8040
-
8041
- /** `Object#toString` result references. */
8042
- var symbolTag = '[object Symbol]';
8043
-
8044
- /**
8045
- * Checks if `value` is classified as a `Symbol` primitive or object.
8046
- *
8047
- * @static
8048
- * @memberOf _
8049
- * @since 4.0.0
8050
- * @category Lang
8051
- * @param {*} value The value to check.
8052
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
8053
- * @example
8054
- *
8055
- * _.isSymbol(Symbol.iterator);
8056
- * // => true
8057
- *
8058
- * _.isSymbol('abc');
8059
- * // => false
8060
- */
8061
- function isSymbol$1(value) {
8062
- return typeof value == 'symbol' ||
8063
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
8064
- }
8065
-
8066
- var isSymbol_1 = isSymbol$1;
8067
-
8068
- var Symbol$1 = _Symbol,
8069
- arrayMap = _arrayMap,
8070
- isArray = isArray_1,
8071
- isSymbol = isSymbol_1;
8072
-
8073
- /** Used as references for various `Number` constants. */
8074
- var INFINITY = 1 / 0;
8075
-
8076
- /** Used to convert symbols to primitives and strings. */
8077
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
8078
- symbolToString = symbolProto ? symbolProto.toString : undefined;
8079
-
8080
- /**
8081
- * The base implementation of `_.toString` which doesn't convert nullish
8082
- * values to empty strings.
8083
- *
8084
- * @private
8085
- * @param {*} value The value to process.
8086
- * @returns {string} Returns the string.
8087
- */
8088
- function baseToString$1(value) {
8089
- // Exit early for strings to avoid a performance hit in some environments.
8090
- if (typeof value == 'string') {
8091
- return value;
8092
- }
8093
- if (isArray(value)) {
8094
- // Recursively convert values (susceptible to call stack limits).
8095
- return arrayMap(value, baseToString$1) + '';
8096
- }
8097
- if (isSymbol(value)) {
8098
- return symbolToString ? symbolToString.call(value) : '';
8099
- }
8100
- var result = (value + '');
8101
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
8102
- }
8103
-
8104
- var _baseToString = baseToString$1;
8105
-
8106
- var baseToString = _baseToString;
8107
-
8108
- /**
8109
- * Converts `value` to a string. An empty string is returned for `null`
8110
- * and `undefined` values. The sign of `-0` is preserved.
8111
- *
8112
- * @static
8113
- * @memberOf _
8114
- * @since 4.0.0
8115
- * @category Lang
8116
- * @param {*} value The value to convert.
8117
- * @returns {string} Returns the converted string.
8118
- * @example
8119
- *
8120
- * _.toString(null);
8121
- * // => ''
8122
- *
8123
- * _.toString(-0);
8124
- * // => '-0'
8125
- *
8126
- * _.toString([1, 2, 3]);
8127
- * // => '1,2,3'
8128
- */
8129
- function toString$1(value) {
8130
- return value == null ? '' : baseToString(value);
8131
- }
8132
-
8133
- var toString_1 = toString$1;
8134
-
8135
- var toString = toString_1;
8136
-
8137
- /** Used to generate unique IDs. */
8138
- var idCounter$1 = 0;
8139
-
8140
- /**
8141
- * Generates a unique ID. If `prefix` is given, the ID is appended to it.
8142
- *
8143
- * @static
8144
- * @since 0.1.0
8145
- * @memberOf _
8146
- * @category Util
8147
- * @param {string} [prefix=''] The value to prefix the ID with.
8148
- * @returns {string} Returns the unique ID.
8149
- * @example
8150
- *
8151
- * _.uniqueId('contact_');
8152
- * // => 'contact_104'
8153
- *
8154
- * _.uniqueId();
8155
- * // => '105'
8156
- */
8157
- function uniqueId(prefix) {
8158
- var id = ++idCounter$1;
8159
- return toString(prefix) + id;
8160
- }
8161
-
8162
- var uniqueId_1 = uniqueId;
8163
-
8164
7833
  var Accordion$1 = /*#__PURE__*/React.forwardRef(function Accordion(_a, ref) {
8165
7834
  var _a$headerLevel = _a.headerLevel,
8166
7835
  headerLevel = _a$headerLevel === void 0 ? 'h2' : _a$headerLevel,
8167
7836
  _a$chevronPosition = _a.chevronPosition,
8168
7837
  chevronPosition = _a$chevronPosition === void 0 ? 'left' : _a$chevronPosition,
8169
7838
  children = _a.children,
8170
- props = __rest(_a, ["headerLevel", "chevronPosition", "children"]);
7839
+ id = _a.id,
7840
+ props = __rest(_a, ["headerLevel", "chevronPosition", "children", "id"]);
8171
7841
 
8172
- var accordionId = React.useMemo(function () {
8173
- return uniqueId_1('accordion-');
8174
- }, []);
7842
+ var accordionId = useId(id, 'accordion');
8175
7843
  var AccordionItems = React.Children.map(children, function (child, index) {
8176
7844
  if (!child) return null;
8177
7845
  return /*#__PURE__*/React.cloneElement(child, {
@@ -8632,11 +8300,10 @@ var Tabs$1 = /*#__PURE__*/React.forwardRef(function Tabs(_a, ref) {
8632
8300
  onFocus = _a.onFocus,
8633
8301
  _a$variant = _a.variant,
8634
8302
  variant = _a$variant === void 0 ? 'minWidth' : _a$variant,
8635
- props = __rest(_a, ["activeTab", "onChange", "onBlur", "onFocus", "variant"]);
8303
+ id = _a.id,
8304
+ props = __rest(_a, ["activeTab", "onChange", "onBlur", "onFocus", "variant", "id"]);
8636
8305
 
8637
- var tabsId = React.useMemo(function () {
8638
- return uniqueId_1('tabs-');
8639
- }, []);
8306
+ var tabsId = useId(id, 'tabs');
8640
8307
 
8641
8308
  var _useState = React.useState(false),
8642
8309
  _useState2 = _slicedToArray(_useState, 2),
@@ -10531,7 +10198,7 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(_a, ref) {
10531
10198
 
10532
10199
  var onValueChange = function onValueChange(event, valueArrIdx) {
10533
10200
  var target = event.target;
10534
- var changedValue = parseInt(target.value, 10);
10201
+ var changedValue = parseFloat(target.value);
10535
10202
 
10536
10203
  if (isRangeSlider) {
10537
10204
  var newValue = sliderValue.slice();
@@ -10584,8 +10251,8 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(_a, ref) {
10584
10251
  var maxValue = maxRange.current.value;
10585
10252
  var diff = max - min;
10586
10253
  var normX = x / inputWidth * diff + min;
10587
- var maxX = Math.abs(normX - parseInt(maxValue));
10588
- var minX = Math.abs(normX - parseInt(minValue));
10254
+ var maxX = Math.abs(normX - parseFloat(maxValue));
10255
+ var minX = Math.abs(normX - parseFloat(minValue));
10589
10256
 
10590
10257
  if (minX > maxX) {
10591
10258
  minRange.current.style.zIndex = '10';
@@ -11838,6 +11505,7 @@ var Breadcrumb = /*#__PURE__*/React.forwardRef(function Breadcrumb(_a, ref) {
11838
11505
  other = __rest(_a, ["children", "maxWidth", "href"]);
11839
11506
 
11840
11507
  var props = Object.assign(Object.assign({}, other), {
11508
+ href: href,
11841
11509
  ref: ref,
11842
11510
  maxWidth: maxWidth
11843
11511
  });
@@ -12119,18 +11787,16 @@ var MenuSection = /*#__PURE__*/React__namespace.memo(function MenuSection(props)
12119
11787
  }, void 0);
12120
11788
  });
12121
11789
 
12122
- var isFragment = function isFragment(object) {
12123
- if (object.type) {
12124
- return object.type === React.Fragment;
12125
- }
12126
-
12127
- return object === React.Fragment;
12128
- };
12129
-
12130
11790
  var List = styled__default['default'].ul.withConfig({
12131
11791
  displayName: "MenuList__List",
12132
11792
  componentId: "sc-104rzof-0"
12133
11793
  })(["position:relative;list-style:none;margin:0;", " li:first-child{z-index:3;}"], spacingsTemplate(menu.spacings));
11794
+
11795
+ function isIndexable(item) {
11796
+ if ( /*#__PURE__*/React.isValidElement(item) && !item.props.disabled && item.type === MenuItem) return true;
11797
+ return false;
11798
+ }
11799
+
12134
11800
  var MenuList = /*#__PURE__*/React.forwardRef(function MenuList(_a, ref) {
12135
11801
  var children = _a.children,
12136
11802
  focus = _a.focus,
@@ -12140,19 +11806,30 @@ var MenuList = /*#__PURE__*/React.forwardRef(function MenuList(_a, ref) {
12140
11806
  focusedIndex = _useMenu.focusedIndex,
12141
11807
  setFocusedIndex = _useMenu.setFocusedIndex;
12142
11808
 
12143
- var pickedChildren = isFragment(children) ? children.props.children : children;
12144
- var updatedChildren = React.Children.map(pickedChildren, function (child, index) {
12145
- return /*#__PURE__*/React.cloneElement(child, {
12146
- index: index
11809
+ var index = -1;
11810
+ var focusableIndexs = React.useMemo(function () {
11811
+ return [];
11812
+ }, []);
11813
+ var updatedChildren = React.useMemo(function () {
11814
+ return React.Children.map(children, function (child) {
11815
+ if (child.type === MenuSection) {
11816
+ var updatedGrandChildren = React.Children.map(child.props.children, function (grandChild) {
11817
+ index++;
11818
+ if (isIndexable(grandChild)) focusableIndexs.push(index);
11819
+ return /*#__PURE__*/React.cloneElement(grandChild, {
11820
+ index: index
11821
+ });
11822
+ });
11823
+ return /*#__PURE__*/React.cloneElement(child, null, updatedGrandChildren);
11824
+ } else {
11825
+ index++;
11826
+ if (isIndexable(child)) focusableIndexs.push(index);
11827
+ return /*#__PURE__*/React.cloneElement(child, {
11828
+ index: index
11829
+ });
11830
+ }
12147
11831
  });
12148
- });
12149
- var focusableIndexs = (updatedChildren || []).filter(function (x) {
12150
- return !x.props.disabled;
12151
- }).filter(function (x) {
12152
- return /*#__PURE__*/React.isValidElement(x) && (x.type === MenuSection || x.type === MenuItem);
12153
- }).map(function (x) {
12154
- return x.props.index;
12155
- });
11832
+ }, [children, focusableIndexs, index]);
12156
11833
  var firstFocusIndex = focusableIndexs[0];
12157
11834
  var lastFocusIndex = focusableIndexs[focusableIndexs.length - 1];
12158
11835
  React.useEffect(function () {
@@ -12179,10 +11856,12 @@ var MenuList = /*#__PURE__*/React.forwardRef(function MenuList(_a, ref) {
12179
11856
  event.stopPropagation();
12180
11857
 
12181
11858
  if (key === 'ArrowDown') {
11859
+ event.preventDefault();
12182
11860
  handleMenuItemChange('down', firstFocusIndex);
12183
11861
  }
12184
11862
 
12185
11863
  if (key === 'ArrowUp') {
11864
+ event.preventDefault();
12186
11865
  handleMenuItemChange('up', lastFocusIndex);
12187
11866
  }
12188
11867
  };
@@ -12245,7 +11924,9 @@ var Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(_a, ref) {
12245
11924
  open = _a.open,
12246
11925
  _a$placement = _a.placement,
12247
11926
  placement = _a$placement === void 0 ? 'auto' : _a$placement,
12248
- rest = __rest(_a, ["anchorEl", "open", "placement"]);
11927
+ style = _a.style,
11928
+ className = _a.className,
11929
+ rest = __rest(_a, ["anchorEl", "open", "placement", "style", "className"]);
12249
11930
 
12250
11931
  var _useState = React.useState(null),
12251
11932
  _useState2 = _slicedToArray(_useState, 2),
@@ -12267,7 +11948,8 @@ var Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(_a, ref) {
12267
11948
 
12268
11949
  var props = Object.assign({
12269
11950
  open: open,
12270
- style: styles.popper
11951
+ style: Object.assign(Object.assign({}, styles.popper), style),
11952
+ className: className
12271
11953
  }, attributes.popper);
12272
11954
  var menuProps = Object.assign(Object.assign({}, rest), {
12273
11955
  anchorEl: anchorEl,