@equinor/eds-core-react 0.47.0 → 0.49.0

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.
Files changed (45) hide show
  1. package/dist/eds-core-react.cjs +67 -38
  2. package/dist/esm/components/Autocomplete/AddNewOption.js +11 -2
  3. package/dist/esm/components/Autocomplete/Autocomplete.js +14 -14
  4. package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -1
  5. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +1 -1
  6. package/dist/esm/components/Button/tokens/contained.js +1 -1
  7. package/dist/esm/components/Button/tokens/contained_icon.js +1 -1
  8. package/dist/esm/components/Button/tokens/ghost.js +1 -1
  9. package/dist/esm/components/Button/tokens/icon.js +1 -1
  10. package/dist/esm/components/Button/tokens/outlined.js +1 -1
  11. package/dist/esm/components/Datepicker/calendars/Calendar.js +1 -0
  12. package/dist/esm/components/Datepicker/calendars/CalendarHeader.js +8 -3
  13. package/dist/esm/components/Datepicker/calendars/RangeCalendar.js +2 -1
  14. package/dist/esm/components/Datepicker/calendars/YearGrid.js +2 -6
  15. package/dist/esm/components/Datepicker/utils/getPageYears.js +10 -0
  16. package/dist/esm/components/Input/Input.tokens.js +1 -1
  17. package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +1 -1
  18. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +1 -1
  19. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +9 -3
  20. package/dist/esm/components/Table/index.js +1 -1
  21. package/dist/esm/components/Tabs/TabList.js +10 -6
  22. package/dist/esm/components/Tabs/TabPanels.js +2 -2
  23. package/dist/esm/components/Tooltip/Tooltip.js +2 -1
  24. package/dist/esm/index.js +1 -1
  25. package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeDeepRight.js +1 -1
  26. package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeWith.js +1 -1
  27. package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeWithKey.js +1 -1
  28. package/dist/types/components/Breadcrumbs/Breadcrumb.d.ts +1 -1
  29. package/dist/types/components/Datepicker/calendars/CalendarHeader.d.ts +2 -1
  30. package/dist/types/components/Datepicker/utils/getPageYears.d.ts +1 -0
  31. package/dist/types/components/Table/index.d.ts +3 -3
  32. package/dist/types/components/Tabs/Tabs.context.d.ts +1 -1
  33. package/dist/types/components/Tabs/Tabs.d.ts +2 -2
  34. package/dist/types/components/Tooltip/Tooltip.d.ts +4 -0
  35. package/package.json +32 -36
  36. package/dist/types/components/Datepicker/DatePicker.spec.d.ts +0 -1
  37. package/dist/types/components/Datepicker/DateRangePicker.spec.d.ts +0 -1
  38. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_curry1.js +0 -0
  39. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_curry2.js +0 -0
  40. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_curry3.js +0 -0
  41. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_has.js +0 -0
  42. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_isObject.js +0 -0
  43. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_isPlaceholder.js +0 -0
  44. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeDeepWithKey.js +0 -0
  45. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/pickBy.js +0 -0
@@ -269,7 +269,7 @@ function _isObject(x) {
269
269
  * @param {Object} l
270
270
  * @param {Object} r
271
271
  * @return {Object}
272
- * @see R.mergeDeepWithKey, R.merge, R.mergeWith
272
+ * @see R.mergeDeepWithKey, R.mergeWith
273
273
  * @example
274
274
  *
275
275
  * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
@@ -349,7 +349,7 @@ var mergeDeepWithKey = /*#__PURE__*/_curry3(function mergeDeepWithKey(fn, lObj,
349
349
  * @param {Object} lObj
350
350
  * @param {Object} rObj
351
351
  * @return {Object}
352
- * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
352
+ * @see R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
353
353
  * @example
354
354
  *
355
355
  * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},
@@ -377,7 +377,7 @@ var mergeDeepRight = /*#__PURE__*/_curry2(function mergeDeepRight(lObj, rObj) {
377
377
  * @param {Object} l
378
378
  * @param {Object} r
379
379
  * @return {Object}
380
- * @see R.mergeDeepWith, R.merge, R.mergeWithKey
380
+ * @see R.mergeDeepWith, R.mergeWithKey
381
381
  * @example
382
382
  *
383
383
  * R.mergeWith(R.concat,
@@ -1149,6 +1149,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1149
1149
  children,
1150
1150
  style,
1151
1151
  enterDelay = 100,
1152
+ disabled = false,
1152
1153
  portalContainer,
1153
1154
  ...rest
1154
1155
  }, ref) {
@@ -1264,7 +1265,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1264
1265
  })]
1265
1266
  });
1266
1267
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1267
- children: [shouldOpen && open && /*#__PURE__*/reactDom.createPortal(TooltipEl, portalContainer ?? rootElement ?? document.body), updatedChildren]
1268
+ children: [shouldOpen && open && !disabled && /*#__PURE__*/reactDom.createPortal(TooltipEl, portalContainer ?? rootElement ?? document.body), updatedChildren]
1268
1269
  });
1269
1270
  });
1270
1271
 
@@ -1853,7 +1854,8 @@ const StyledTableCell$1 = styled__default.default.th.withConfig({
1853
1854
  })(props => {
1854
1855
  const {
1855
1856
  theme,
1856
- $sticky
1857
+ $sticky,
1858
+ $density
1857
1859
  } = props;
1858
1860
  const {
1859
1861
  background,
@@ -1871,7 +1873,11 @@ const StyledTableCell$1 = styled__default.default.th.withConfig({
1871
1873
  if (ariaSort && ariaSort !== 'none') {
1872
1874
  sortStylingActive = styled.css(["", ";background:", ";color:", ";"], activeToken.border.type === 'bordergroup' ? styled.css(["border-color:", ";"], activeToken.border.bottom.color) : '', activeToken.background, activeToken.typography.color);
1873
1875
  }
1874
- return styled.css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", ""], height, height, background, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(theme.border), sortStylingHover, sortStylingActive, $sticky ? styled.css(["position:sticky;top:0;z-index:1;"]) : '');
1876
+
1877
+ // Firefox specific workaround (bug in v142.0) - see issue #3910
1878
+ // Hardcoded padding values compensate for Firefox's incorrect table cell height calculation
1879
+ const firefoxFix = edsUtils.isFirefox() ? styled.css(["vertical-align:top;height:auto;min-height:", ";> div{padding:", " 0;}"], height, $density === 'compact' ? '7px' : '13px') : styled.css([""]);
1880
+ return styled.css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", " ", ""], height, height, background, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(theme.border), sortStylingHover, sortStylingActive, firefoxFix, $sticky ? styled.css(["position:sticky;top:0;z-index:1;"]) : '');
1875
1881
  });
1876
1882
  const CellInner$1 = styled__default.default.div.withConfig({
1877
1883
  displayName: "HeaderCell__CellInner",
@@ -1892,6 +1898,7 @@ const TableHeaderCell = /*#__PURE__*/react.forwardRef(function TableHeaderCell({
1892
1898
  const props = {
1893
1899
  ref,
1894
1900
  $sticky: sticky,
1901
+ $density: density,
1895
1902
  ...rest
1896
1903
  };
1897
1904
  return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
@@ -3998,20 +4005,24 @@ const TabList = /*#__PURE__*/react.forwardRef(function TabsList({
3998
4005
  }
3999
4006
  }, [arrowNavigating, tabsFocused]);
4000
4007
  const Tabs = react.Children.map(children, (child, $index) => {
4001
- const childProps = child.props;
4008
+ if (! /*#__PURE__*/react.isValidElement(child)) {
4009
+ return null;
4010
+ }
4011
+ const tabChild = child;
4012
+ const childProps = tabChild.props;
4002
4013
  const controlledActive = childProps.value;
4003
4014
  const isActive = controlledActive ? controlledActive === activeTab : $index === activeTab;
4004
- const tabRef = isActive ? edsUtils.mergeRefs(child.ref, selectedTabRef) : child.ref;
4015
+ const tabRef = isActive ? edsUtils.mergeRefs(tabChild.ref, selectedTabRef) : tabChild.ref;
4005
4016
  if (isActive) currentTab.current = $index;
4006
- return /*#__PURE__*/react.cloneElement(child, {
4017
+ return /*#__PURE__*/react.cloneElement(tabChild, {
4007
4018
  id: `${tabsId}-tab-${$index + 1}`,
4008
4019
  'aria-controls': `${tabsId}-panel-${$index + 1}`,
4009
4020
  active: isActive,
4010
4021
  $index,
4011
- onClick: () => handleChange($index),
4022
+ onClick: () => handleChange(controlledActive !== undefined ? controlledActive : $index),
4012
4023
  ref: tabRef
4013
4024
  });
4014
- });
4025
+ }) ?? [];
4015
4026
  const focusableChildren = Tabs.filter(child => {
4016
4027
  const childProps = child.props;
4017
4028
  return !childProps.disabled;
@@ -4098,7 +4109,7 @@ const TabPanels = /*#__PURE__*/react.forwardRef(function TabPanels({
4098
4109
  tabsId
4099
4110
  } = react.useContext(TabsContext);
4100
4111
  const Panels = react.Children.map(children, (child, $index) => {
4101
- if (conditionalRender && activeTab !== $index) return null;
4112
+ if (! /*#__PURE__*/react.isValidElement(child) || conditionalRender && activeTab !== $index) return null;
4102
4113
  return /*#__PURE__*/react.cloneElement(child, {
4103
4114
  id: `${tabsId}-panel-${$index + 1}`,
4104
4115
  'aria-labelledby': `${tabsId}-tab-${$index + 1}`,
@@ -7478,7 +7489,7 @@ const Breadcrumb = /*#__PURE__*/react.forwardRef(function Breadcrumb({
7478
7489
  href,
7479
7490
  ref
7480
7491
  };
7481
- const showTooltip = maxWidth > 0 || forceTooltip;
7492
+ const showTooltip = maxWidth !== undefined && maxWidth > 0 || forceTooltip === true;
7482
7493
  const isHrefDefined = href !== undefined;
7483
7494
  const forwardedAs = react.useMemo(() => as ? as : isHrefDefined ? 'a' : 'span', [as, isHrefDefined]);
7484
7495
  const crumb = /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
@@ -9508,6 +9519,10 @@ const StyledAddItemIcon = styled__default.default(Icon$1).withConfig({
9508
9519
  }) => {
9509
9520
  return styled.css(["padding:", ";color:", ";"], multiple ? '0.75rem' : '0 0.75rem 0 0', edsTokens.tokens.colors.interactive.primary__resting.hex);
9510
9521
  });
9522
+ const StyledPlaceholder = styled__default.default.span.withConfig({
9523
+ displayName: "AddNewOption__StyledPlaceholder",
9524
+ componentId: "sc-8xtrxx-1"
9525
+ })(["color:", ";"], input$1.entities.placeholder.typography.color);
9511
9526
  function AddNewOptionInner(props, ref) {
9512
9527
  const {
9513
9528
  value,
@@ -9520,17 +9535,21 @@ function AddNewOptionInner(props, ref) {
9520
9535
  return /*#__PURE__*/jsxRuntime.jsxs(StyledListItem, {
9521
9536
  ref: ref,
9522
9537
  $highlighted: highlighted,
9523
- "aria-label": `Add new option: ${value}`,
9524
9538
  onClick: e => {
9525
9539
  onClick(e);
9526
9540
  },
9527
9541
  ...other,
9542
+ "aria-label": `Add new option: ${value}`,
9543
+ "aria-live": "polite",
9544
+ "aria-selected": false,
9528
9545
  children: [/*#__PURE__*/jsxRuntime.jsx(StyledAddItemIcon, {
9529
9546
  multiple: multiple,
9530
9547
  data: edsIcons.add_box
9531
9548
  }), /*#__PURE__*/jsxRuntime.jsx(AutocompleteOptionLabel, {
9532
9549
  $multiline: multiline,
9533
- children: value
9550
+ children: value ? value : /*#__PURE__*/jsxRuntime.jsx(StyledPlaceholder, {
9551
+ children: "Type to add new options"
9552
+ })
9534
9553
  })]
9535
9554
  });
9536
9555
  }
@@ -9740,8 +9759,9 @@ function AutocompleteInner(props, ref) {
9740
9759
  return allowSelectAll && !typedInputValue;
9741
9760
  }, [allowSelectAll, multiple, typedInputValue]);
9742
9761
  const availableItems = react.useMemo(() => {
9762
+ if (showSelectAll && onAddNewOption) return [AddSymbol, AllSymbol, ..._availableItems];
9743
9763
  if (showSelectAll) return [AllSymbol, ..._availableItems];
9744
- if (_availableItems.length === 0 && onAddNewOption) return [AddSymbol];
9764
+ if (onAddNewOption) return [AddSymbol, ..._availableItems];
9745
9765
  return _availableItems;
9746
9766
  }, [_availableItems, showSelectAll, onAddNewOption]);
9747
9767
 
@@ -9826,12 +9846,10 @@ function AutocompleteInner(props, ref) {
9826
9846
  if (item == null) {
9827
9847
  return '';
9828
9848
  }
9829
- if (typeof item === 'object') {
9830
- if (optionLabel) {
9831
- return optionLabel(item);
9832
- } else {
9833
- throw new Error('Missing label. When using objects for options make sure to define the `optionLabel` property');
9834
- }
9849
+ if (optionLabel) {
9850
+ return optionLabel(item);
9851
+ } else if (typeof item === 'object') {
9852
+ throw new Error('Missing label. When using objects for options make sure to define the `optionLabel` property');
9835
9853
  }
9836
9854
  if (typeof item === 'string') {
9837
9855
  return item;
@@ -9866,6 +9884,7 @@ function AutocompleteInner(props, ref) {
9866
9884
  //can not pass readonly type to downshift so we cast it to regular T[]
9867
9885
  initialSelectedItem: initialSelectedOptions[0],
9868
9886
  isItemDisabled(item) {
9887
+ if (item === AddSymbol) return !typedInputValue.trim();
9869
9888
  return optionDisabled(item);
9870
9889
  },
9871
9890
  itemToKey,
@@ -9919,7 +9938,7 @@ function AutocompleteInner(props, ref) {
9919
9938
  if (selectedItem != null && !optionDisabled(selectedItem)) {
9920
9939
  if (selectedItem === AllSymbol) {
9921
9940
  toggleAllSelected();
9922
- } else if (selectedItem === AddSymbol) {
9941
+ } else if (selectedItem === AddSymbol && typedInputValue.trim()) {
9923
9942
  onAddNewOption?.(typedInputValue);
9924
9943
  } else if (multiple) {
9925
9944
  const shouldRemove = itemCompare ? selectedItems.some(i => itemCompare(selectedItem, i)) : selectedItems.includes(selectedItem);
@@ -9941,6 +9960,7 @@ function AutocompleteInner(props, ref) {
9941
9960
  comboBoxProps = {
9942
9961
  ...comboBoxProps,
9943
9962
  onSelectedItemChange: changes => {
9963
+ if (changes.selectedItem === AddSymbol) return;
9944
9964
  if (onOptionsChange) {
9945
9965
  let {
9946
9966
  selectedItem
@@ -9967,11 +9987,9 @@ function AutocompleteInner(props, ref) {
9967
9987
  case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter:
9968
9988
  case downshift.useCombobox.stateChangeTypes.ItemClick:
9969
9989
  if (changes.selectedItem === AddSymbol) {
9970
- onAddNewOption(typedInputValue);
9971
9990
  return {
9972
9991
  ...changes,
9973
- inputValue: '',
9974
- selectedItem: null
9992
+ inputValue: ''
9975
9993
  };
9976
9994
  }
9977
9995
  return {
@@ -10260,6 +10278,7 @@ function AutocompleteInner(props, ref) {
10260
10278
  }, 'select-all');
10261
10279
  }
10262
10280
  if (item === AddSymbol && onAddNewOption) {
10281
+ const isDisabled = !typedInputValue.trim();
10263
10282
  return /*#__PURE__*/jsxRuntime.jsx(AddNewOption, {
10264
10283
  "data-index": 0,
10265
10284
  "data-testid": 'add-item',
@@ -10279,7 +10298,7 @@ function AutocompleteInner(props, ref) {
10279
10298
  item,
10280
10299
  index: index
10281
10300
  }),
10282
- value: `${typedInputValue}`
10301
+ value: typedInputValue.trim()
10283
10302
  }, 'add-item');
10284
10303
  }
10285
10304
  return /*#__PURE__*/jsxRuntime.jsx(AutocompleteOption, {
@@ -11385,6 +11404,15 @@ function CalendarCell({
11385
11404
  });
11386
11405
  }
11387
11406
 
11407
+ const TOTAL_VISIBLE_YEARS = 36;
11408
+ const RANGE_OFFSET = 30 / 2;
11409
+ const getPageYears = (selectedYear, yearPickerPage = 0) => {
11410
+ const page = yearPickerPage * TOTAL_VISIBLE_YEARS;
11411
+ return Array.from({
11412
+ length: TOTAL_VISIBLE_YEARS
11413
+ }, (_, i) => i + (selectedYear + page - RANGE_OFFSET));
11414
+ };
11415
+
11388
11416
  // Disable no-autofocus - it's not the native autofocus attribute, but react-aria's autoFocus prop
11389
11417
  /* eslint-disable jsx-a11y/no-autofocus */
11390
11418
  const Grid = styled__default.default.div.withConfig({
@@ -11397,8 +11425,6 @@ const GridColumn = styled__default.default.button.withConfig({
11397
11425
  })(["background-color:transparent;outline:none;border:none;display:flex;justify-content:center;cursor:pointer;padding:8px;font-size:", ";font-family:", ";font-weight:", ";line-height:", ";color:", ";border-radius:999px;", ";&:hover{background-color:#f0f0f0;}&:focus{outline:2px dashed ", ";}"], edsTokens.tokens.typography.navigation.button.fontSize, edsTokens.tokens.typography.navigation.button.fontFamily, edsTokens.tokens.typography.navigation.button.fontWeight, edsTokens.tokens.typography.navigation.button.lineHeight, edsTokens.tokens.colors.text.static_icons__default.rgba, ({
11398
11426
  $active
11399
11427
  }) => $active ? `background-color: ${edsTokens.tokens.colors.interactive.primary__selected_highlight.rgba}` : '', edsTokens.tokens.colors.interactive.primary__resting.rgba);
11400
- const TOTAL_VISIBLE_YEARS = 36;
11401
- const RANGE_OFFSET = 30 / 2;
11402
11428
  const GridFocusManager = ({
11403
11429
  year: selectedYear,
11404
11430
  setFocusedYear,
@@ -11408,10 +11434,7 @@ const GridFocusManager = ({
11408
11434
  const focusManager = reactAria.useFocusManager();
11409
11435
  const prevYear = react.useRef();
11410
11436
  const navByKeyboard = react.useRef(false);
11411
- const page = yearPickerPage * TOTAL_VISIBLE_YEARS;
11412
- const years = Array.from({
11413
- length: TOTAL_VISIBLE_YEARS
11414
- }, (_, i) => i + (selectedYear + page - RANGE_OFFSET));
11437
+ const years = getPageYears(selectedYear, yearPickerPage);
11415
11438
  react.useEffect(() => {
11416
11439
  if (prevYear.current === undefined) {
11417
11440
  prevYear.current = yearPickerPage;
@@ -11614,14 +11637,18 @@ function CalendarHeader({
11614
11637
  nextMonthDisabled,
11615
11638
  showYearPicker,
11616
11639
  setShowYearPicker,
11617
- setYearPickerPage
11640
+ setYearPickerPage,
11641
+ yearPickerPage
11618
11642
  }) {
11643
+ const years = getPageYears(state.focusedDate.year, yearPickerPage);
11644
+ const backButtonDisabled = showYearPicker && state.minValue ? years[0] < state.minValue.year : previousMonthDisabled;
11645
+ const nextButtonDisabled = showYearPicker && state.maxValue ? years[years.length - 1] > state.maxValue.year : nextMonthDisabled;
11619
11646
  return /*#__PURE__*/jsxRuntime.jsx(HeaderWrapper, {
11620
11647
  children: /*#__PURE__*/jsxRuntime.jsxs(HeaderActions, {
11621
11648
  children: [/*#__PURE__*/jsxRuntime.jsx(Button$1, {
11622
11649
  variant: 'ghost_icon',
11623
11650
  "aria-label": 'Previous month',
11624
- disabled: previousMonthDisabled,
11651
+ disabled: backButtonDisabled,
11625
11652
  onClick: () => showYearPicker ? setYearPickerPage(page => page - 1) : state.focusPreviousPage(),
11626
11653
  children: /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
11627
11654
  data: edsIcons.chevron_left
@@ -11652,7 +11679,7 @@ function CalendarHeader({
11652
11679
  }), /*#__PURE__*/jsxRuntime.jsx(Button$1, {
11653
11680
  variant: 'ghost_icon',
11654
11681
  onClick: () => showYearPicker ? setYearPickerPage(page => page + 1) : state.focusNextPage(),
11655
- disabled: nextMonthDisabled,
11682
+ disabled: nextButtonDisabled,
11656
11683
  "aria-label": 'Next month',
11657
11684
  children: /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
11658
11685
  data: edsIcons.chevron_right
@@ -11712,6 +11739,7 @@ const Calendar = /*#__PURE__*/react.forwardRef(({
11712
11739
  nextMonthDisabled: nextButtonProps.isDisabled,
11713
11740
  setShowYearPicker: setShowYearPicker,
11714
11741
  showYearPicker: showYearPicker,
11742
+ yearPickerPage: yearPickerPage,
11715
11743
  setYearPickerPage: setYearPickerPage
11716
11744
  })
11717
11745
  }), /*#__PURE__*/jsxRuntime.jsx(Popover.Content, {
@@ -12307,7 +12335,8 @@ const RangeCalendar = /*#__PURE__*/react.forwardRef(({
12307
12335
  title: title,
12308
12336
  setShowYearPicker: setShowYearPicker,
12309
12337
  showYearPicker: showYearPicker,
12310
- setYearPickerPage: setYearPickerPage
12338
+ setYearPickerPage: setYearPickerPage,
12339
+ yearPickerPage: yearPickerPage
12311
12340
  })
12312
12341
  }), /*#__PURE__*/jsxRuntime.jsx(Popover.Content, {
12313
12342
  children: /*#__PURE__*/jsxRuntime.jsx(CalendarGrid, {
@@ -12610,6 +12639,7 @@ exports.TableFoot = Foot;
12610
12639
  exports.TableHead = Head;
12611
12640
  exports.TableOfContents = TableOfContents;
12612
12641
  exports.TableOfContentsLinkItem = LinkItem;
12642
+ exports.TableRow = Row;
12613
12643
  exports.Tabs = Tabs;
12614
12644
  exports.TextField = TextField;
12615
12645
  exports.ToggleButton = ToggleButton;
@@ -12619,6 +12649,5 @@ exports.TopbarActions = Actions;
12619
12649
  exports.TopbarCustomContent = CustomContent;
12620
12650
  exports.TopbarHeader = Header$2;
12621
12651
  exports.Typography = Typography;
12622
- exports.tableRow = Row;
12623
12652
  exports.useEds = useEds;
12624
12653
  exports.useSideBar = useSideBar;
@@ -4,6 +4,7 @@ import { forwardRef } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { Icon } from '../Icon/index.js';
6
6
  import { StyledListItem, AutocompleteOptionLabel } from './Option.js';
7
+ import { input } from '../Input/Input.tokens.js';
7
8
  import { jsxs, jsx } from 'react/jsx-runtime';
8
9
 
9
10
  const StyledAddItemIcon = styled(Icon).withConfig({
@@ -14,6 +15,10 @@ const StyledAddItemIcon = styled(Icon).withConfig({
14
15
  }) => {
15
16
  return css(["padding:", ";color:", ";"], multiple ? '0.75rem' : '0 0.75rem 0 0', tokens.colors.interactive.primary__resting.hex);
16
17
  });
18
+ const StyledPlaceholder = styled.span.withConfig({
19
+ displayName: "AddNewOption__StyledPlaceholder",
20
+ componentId: "sc-8xtrxx-1"
21
+ })(["color:", ";"], input.entities.placeholder.typography.color);
17
22
  function AddNewOptionInner(props, ref) {
18
23
  const {
19
24
  value,
@@ -26,17 +31,21 @@ function AddNewOptionInner(props, ref) {
26
31
  return /*#__PURE__*/jsxs(StyledListItem, {
27
32
  ref: ref,
28
33
  $highlighted: highlighted,
29
- "aria-label": `Add new option: ${value}`,
30
34
  onClick: e => {
31
35
  onClick(e);
32
36
  },
33
37
  ...other,
38
+ "aria-label": `Add new option: ${value}`,
39
+ "aria-live": "polite",
40
+ "aria-selected": false,
34
41
  children: [/*#__PURE__*/jsx(StyledAddItemIcon, {
35
42
  multiple: multiple,
36
43
  data: add_box
37
44
  }), /*#__PURE__*/jsx(AutocompleteOptionLabel, {
38
45
  $multiline: multiline,
39
- children: value
46
+ children: value ? value : /*#__PURE__*/jsx(StyledPlaceholder, {
47
+ children: "Type to add new options"
48
+ })
40
49
  })]
41
50
  });
42
51
  }
@@ -13,8 +13,8 @@ import { AutocompleteOption } from './Option.js';
13
13
  import { useFloating, offset, flip, size, useInteractions, autoUpdate } from '@floating-ui/react';
14
14
  import { AddNewOption } from './AddNewOption.js';
15
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
- import pickBy from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/pickBy.js';
17
- import mergeWith from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeWith.js';
16
+ import pickBy from '../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/pickBy.js';
17
+ import mergeWith from '../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeWith.js';
18
18
  import { useEds } from '../EdsProvider/eds.context.js';
19
19
  import { Label } from '../Label/Label.js';
20
20
  import { Input } from '../Input/Input.js';
@@ -224,8 +224,9 @@ function AutocompleteInner(props, ref) {
224
224
  return allowSelectAll && !typedInputValue;
225
225
  }, [allowSelectAll, multiple, typedInputValue]);
226
226
  const availableItems = useMemo(() => {
227
+ if (showSelectAll && onAddNewOption) return [AddSymbol, AllSymbol, ..._availableItems];
227
228
  if (showSelectAll) return [AllSymbol, ..._availableItems];
228
- if (_availableItems.length === 0 && onAddNewOption) return [AddSymbol];
229
+ if (onAddNewOption) return [AddSymbol, ..._availableItems];
229
230
  return _availableItems;
230
231
  }, [_availableItems, showSelectAll, onAddNewOption]);
231
232
 
@@ -310,12 +311,10 @@ function AutocompleteInner(props, ref) {
310
311
  if (item == null) {
311
312
  return '';
312
313
  }
313
- if (typeof item === 'object') {
314
- if (optionLabel) {
315
- return optionLabel(item);
316
- } else {
317
- throw new Error('Missing label. When using objects for options make sure to define the `optionLabel` property');
318
- }
314
+ if (optionLabel) {
315
+ return optionLabel(item);
316
+ } else if (typeof item === 'object') {
317
+ throw new Error('Missing label. When using objects for options make sure to define the `optionLabel` property');
319
318
  }
320
319
  if (typeof item === 'string') {
321
320
  return item;
@@ -350,6 +349,7 @@ function AutocompleteInner(props, ref) {
350
349
  //can not pass readonly type to downshift so we cast it to regular T[]
351
350
  initialSelectedItem: initialSelectedOptions[0],
352
351
  isItemDisabled(item) {
352
+ if (item === AddSymbol) return !typedInputValue.trim();
353
353
  return optionDisabled(item);
354
354
  },
355
355
  itemToKey,
@@ -403,7 +403,7 @@ function AutocompleteInner(props, ref) {
403
403
  if (selectedItem != null && !optionDisabled(selectedItem)) {
404
404
  if (selectedItem === AllSymbol) {
405
405
  toggleAllSelected();
406
- } else if (selectedItem === AddSymbol) {
406
+ } else if (selectedItem === AddSymbol && typedInputValue.trim()) {
407
407
  onAddNewOption?.(typedInputValue);
408
408
  } else if (multiple) {
409
409
  const shouldRemove = itemCompare ? selectedItems.some(i => itemCompare(selectedItem, i)) : selectedItems.includes(selectedItem);
@@ -425,6 +425,7 @@ function AutocompleteInner(props, ref) {
425
425
  comboBoxProps = {
426
426
  ...comboBoxProps,
427
427
  onSelectedItemChange: changes => {
428
+ if (changes.selectedItem === AddSymbol) return;
428
429
  if (onOptionsChange) {
429
430
  let {
430
431
  selectedItem
@@ -451,11 +452,9 @@ function AutocompleteInner(props, ref) {
451
452
  case useCombobox.stateChangeTypes.InputKeyDownEnter:
452
453
  case useCombobox.stateChangeTypes.ItemClick:
453
454
  if (changes.selectedItem === AddSymbol) {
454
- onAddNewOption(typedInputValue);
455
455
  return {
456
456
  ...changes,
457
- inputValue: '',
458
- selectedItem: null
457
+ inputValue: ''
459
458
  };
460
459
  }
461
460
  return {
@@ -744,6 +743,7 @@ function AutocompleteInner(props, ref) {
744
743
  }, 'select-all');
745
744
  }
746
745
  if (item === AddSymbol && onAddNewOption) {
746
+ const isDisabled = !typedInputValue.trim();
747
747
  return /*#__PURE__*/jsx(AddNewOption, {
748
748
  "data-index": 0,
749
749
  "data-testid": 'add-item',
@@ -763,7 +763,7 @@ function AutocompleteInner(props, ref) {
763
763
  item,
764
764
  index: index
765
765
  }),
766
- value: `${typedInputValue}`
766
+ value: typedInputValue.trim()
767
767
  }, 'add-item');
768
768
  }
769
769
  return /*#__PURE__*/jsx(AutocompleteOption, {
@@ -1,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  typography,
@@ -30,7 +30,7 @@ const Breadcrumb = /*#__PURE__*/forwardRef(function Breadcrumb({
30
30
  href,
31
31
  ref
32
32
  };
33
- const showTooltip = maxWidth > 0 || forceTooltip;
33
+ const showTooltip = maxWidth !== undefined && maxWidth > 0 || forceTooltip === true;
34
34
  const isHrefDefined = href !== undefined;
35
35
  const forwardedAs = useMemo(() => as ? as : isHrefDefined ? 'a' : 'span', [as, isHrefDefined]);
36
36
  const crumb = /*#__PURE__*/jsx(StyledTypography, {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { primary as primary$1, secondary as secondary$1, danger as danger$1 } from './contained.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  clickbounds: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -53,6 +53,7 @@ const Calendar = /*#__PURE__*/forwardRef(({
53
53
  nextMonthDisabled: nextButtonProps.isDisabled,
54
54
  setShowYearPicker: setShowYearPicker,
55
55
  showYearPicker: showYearPicker,
56
+ yearPickerPage: yearPickerPage,
56
57
  setYearPickerPage: setYearPickerPage
57
58
  })
58
59
  }), /*#__PURE__*/jsx(Popover.Content, {
@@ -4,6 +4,7 @@ import { Icon } from '../../Icon/index.js';
4
4
  import { chevron_left, chevron_up, chevron_down, chevron_right } from '@equinor/eds-icons';
5
5
  import { CalendarDate } from '@internationalized/date';
6
6
  import { tokens } from '@equinor/eds-tokens';
7
+ import { getPageYears } from '../utils/getPageYears.js';
7
8
  import { jsx, jsxs } from 'react/jsx-runtime';
8
9
 
9
10
  const HeaderWrapper = styled.div.withConfig({
@@ -40,14 +41,18 @@ function CalendarHeader({
40
41
  nextMonthDisabled,
41
42
  showYearPicker,
42
43
  setShowYearPicker,
43
- setYearPickerPage
44
+ setYearPickerPage,
45
+ yearPickerPage
44
46
  }) {
47
+ const years = getPageYears(state.focusedDate.year, yearPickerPage);
48
+ const backButtonDisabled = showYearPicker && state.minValue ? years[0] < state.minValue.year : previousMonthDisabled;
49
+ const nextButtonDisabled = showYearPicker && state.maxValue ? years[years.length - 1] > state.maxValue.year : nextMonthDisabled;
45
50
  return /*#__PURE__*/jsx(HeaderWrapper, {
46
51
  children: /*#__PURE__*/jsxs(HeaderActions, {
47
52
  children: [/*#__PURE__*/jsx(Button, {
48
53
  variant: 'ghost_icon',
49
54
  "aria-label": 'Previous month',
50
- disabled: previousMonthDisabled,
55
+ disabled: backButtonDisabled,
51
56
  onClick: () => showYearPicker ? setYearPickerPage(page => page - 1) : state.focusPreviousPage(),
52
57
  children: /*#__PURE__*/jsx(Icon, {
53
58
  data: chevron_left
@@ -78,7 +83,7 @@ function CalendarHeader({
78
83
  }), /*#__PURE__*/jsx(Button, {
79
84
  variant: 'ghost_icon',
80
85
  onClick: () => showYearPicker ? setYearPickerPage(page => page + 1) : state.focusNextPage(),
81
- disabled: nextMonthDisabled,
86
+ disabled: nextButtonDisabled,
82
87
  "aria-label": 'Next month',
83
88
  children: /*#__PURE__*/jsx(Icon, {
84
89
  data: chevron_right
@@ -46,7 +46,8 @@ const RangeCalendar = /*#__PURE__*/forwardRef(({
46
46
  title: title,
47
47
  setShowYearPicker: setShowYearPicker,
48
48
  showYearPicker: showYearPicker,
49
- setYearPickerPage: setYearPickerPage
49
+ setYearPickerPage: setYearPickerPage,
50
+ yearPickerPage: yearPickerPage
50
51
  })
51
52
  }), /*#__PURE__*/jsx(Popover.Content, {
52
53
  children: /*#__PURE__*/jsx(CalendarGrid, {
@@ -2,6 +2,7 @@ import styled from 'styled-components';
2
2
  import { tokens } from '@equinor/eds-tokens';
3
3
  import { FocusScope, useFocusManager } from 'react-aria';
4
4
  import { useRef, useEffect } from 'react';
5
+ import { getPageYears } from '../utils/getPageYears.js';
5
6
  import { jsx } from 'react/jsx-runtime';
6
7
 
7
8
  // Disable no-autofocus - it's not the native autofocus attribute, but react-aria's autoFocus prop
@@ -16,8 +17,6 @@ const GridColumn = styled.button.withConfig({
16
17
  })(["background-color:transparent;outline:none;border:none;display:flex;justify-content:center;cursor:pointer;padding:8px;font-size:", ";font-family:", ";font-weight:", ";line-height:", ";color:", ";border-radius:999px;", ";&:hover{background-color:#f0f0f0;}&:focus{outline:2px dashed ", ";}"], tokens.typography.navigation.button.fontSize, tokens.typography.navigation.button.fontFamily, tokens.typography.navigation.button.fontWeight, tokens.typography.navigation.button.lineHeight, tokens.colors.text.static_icons__default.rgba, ({
17
18
  $active
18
19
  }) => $active ? `background-color: ${tokens.colors.interactive.primary__selected_highlight.rgba}` : '', tokens.colors.interactive.primary__resting.rgba);
19
- const TOTAL_VISIBLE_YEARS = 36;
20
- const RANGE_OFFSET = 30 / 2;
21
20
  const GridFocusManager = ({
22
21
  year: selectedYear,
23
22
  setFocusedYear,
@@ -27,10 +26,7 @@ const GridFocusManager = ({
27
26
  const focusManager = useFocusManager();
28
27
  const prevYear = useRef();
29
28
  const navByKeyboard = useRef(false);
30
- const page = yearPickerPage * TOTAL_VISIBLE_YEARS;
31
- const years = Array.from({
32
- length: TOTAL_VISIBLE_YEARS
33
- }, (_, i) => i + (selectedYear + page - RANGE_OFFSET));
29
+ const years = getPageYears(selectedYear, yearPickerPage);
34
30
  useEffect(() => {
35
31
  if (prevYear.current === undefined) {
36
32
  prevYear.current = yearPickerPage;
@@ -0,0 +1,10 @@
1
+ const TOTAL_VISIBLE_YEARS = 36;
2
+ const RANGE_OFFSET = 30 / 2;
3
+ const getPageYears = (selectedYear, yearPickerPage = 0) => {
4
+ const page = yearPickerPage * TOTAL_VISIBLE_YEARS;
5
+ return Array.from({
6
+ length: TOTAL_VISIBLE_YEARS
7
+ }, (_, i) => i + (selectedYear + page - RANGE_OFFSET));
8
+ };
9
+
10
+ export { getPageYears };
@@ -1,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  colors: {
@@ -1,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  colors: {
@@ -1,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.31.3/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  typography: {
@@ -1,6 +1,6 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { ThemeProvider, css } from 'styled-components';
3
- import { useToken, spacingsTemplate, typographyTemplate, bordersTemplate } from '@equinor/eds-utils';
3
+ import { useToken, isFirefox, spacingsTemplate, typographyTemplate, bordersTemplate } from '@equinor/eds-utils';
4
4
  import { token } from './HeaderCell.tokens.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
  import { useEds } from '../../EdsProvider/eds.context.js';
@@ -11,7 +11,8 @@ const StyledTableCell = styled.th.withConfig({
11
11
  })(props => {
12
12
  const {
13
13
  theme,
14
- $sticky
14
+ $sticky,
15
+ $density
15
16
  } = props;
16
17
  const {
17
18
  background,
@@ -29,7 +30,11 @@ const StyledTableCell = styled.th.withConfig({
29
30
  if (ariaSort && ariaSort !== 'none') {
30
31
  sortStylingActive = css(["", ";background:", ";color:", ";"], activeToken.border.type === 'bordergroup' ? css(["border-color:", ";"], activeToken.border.bottom.color) : '', activeToken.background, activeToken.typography.color);
31
32
  }
32
- return css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", ""], height, height, background, spacingsTemplate(spacings), typographyTemplate(typography), bordersTemplate(theme.border), sortStylingHover, sortStylingActive, $sticky ? css(["position:sticky;top:0;z-index:1;"]) : '');
33
+
34
+ // Firefox specific workaround (bug in v142.0) - see issue #3910
35
+ // Hardcoded padding values compensate for Firefox's incorrect table cell height calculation
36
+ const firefoxFix = isFirefox() ? css(["vertical-align:top;height:auto;min-height:", ";> div{padding:", " 0;}"], height, $density === 'compact' ? '7px' : '13px') : css([""]);
37
+ return css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", " ", ""], height, height, background, spacingsTemplate(spacings), typographyTemplate(typography), bordersTemplate(theme.border), sortStylingHover, sortStylingActive, firefoxFix, $sticky ? css(["position:sticky;top:0;z-index:1;"]) : '');
33
38
  });
34
39
  const CellInner = styled.div.withConfig({
35
40
  displayName: "HeaderCell__CellInner",
@@ -50,6 +55,7 @@ const TableHeaderCell = /*#__PURE__*/forwardRef(function TableHeaderCell({
50
55
  const props = {
51
56
  ref,
52
57
  $sticky: sticky,
58
+ $density: density,
53
59
  ...rest
54
60
  };
55
61
  return /*#__PURE__*/jsx(ThemeProvider, {
@@ -20,4 +20,4 @@ Table.Foot.displayName = 'Table.Foot';
20
20
  Table.Row.displayName = 'Table.Row';
21
21
  Table.Caption.displayName = 'Table.Caption';
22
22
 
23
- export { Table, Body as TableBody, Caption as TableCaption, Cell as TableCell, Foot as TableFoot, Head as TableHead, Row as tableRow };
23
+ export { Table, Body as TableBody, Caption as TableCaption, Cell as TableCell, Foot as TableFoot, Head as TableHead, Row as TableRow };
@@ -1,4 +1,4 @@
1
- import { forwardRef, useContext, useRef, useState, useCallback, Children, cloneElement } from 'react';
1
+ import { forwardRef, useContext, useRef, useState, useCallback, Children, isValidElement, cloneElement } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { mergeRefs } from '@equinor/eds-utils';
4
4
  import { TabsContext } from './Tabs.context.js';
@@ -39,20 +39,24 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
39
39
  }
40
40
  }, [arrowNavigating, tabsFocused]);
41
41
  const Tabs = Children.map(children, (child, $index) => {
42
- const childProps = child.props;
42
+ if (! /*#__PURE__*/isValidElement(child)) {
43
+ return null;
44
+ }
45
+ const tabChild = child;
46
+ const childProps = tabChild.props;
43
47
  const controlledActive = childProps.value;
44
48
  const isActive = controlledActive ? controlledActive === activeTab : $index === activeTab;
45
- const tabRef = isActive ? mergeRefs(child.ref, selectedTabRef) : child.ref;
49
+ const tabRef = isActive ? mergeRefs(tabChild.ref, selectedTabRef) : tabChild.ref;
46
50
  if (isActive) currentTab.current = $index;
47
- return /*#__PURE__*/cloneElement(child, {
51
+ return /*#__PURE__*/cloneElement(tabChild, {
48
52
  id: `${tabsId}-tab-${$index + 1}`,
49
53
  'aria-controls': `${tabsId}-panel-${$index + 1}`,
50
54
  active: isActive,
51
55
  $index,
52
- onClick: () => handleChange($index),
56
+ onClick: () => handleChange(controlledActive !== undefined ? controlledActive : $index),
53
57
  ref: tabRef
54
58
  });
55
- });
59
+ }) ?? [];
56
60
  const focusableChildren = Tabs.filter(child => {
57
61
  const childProps = child.props;
58
62
  return !childProps.disabled;
@@ -1,4 +1,4 @@
1
- import { forwardRef, useContext, Children, cloneElement } from 'react';
1
+ import { forwardRef, useContext, Children, isValidElement, cloneElement } from 'react';
2
2
  import { TabsContext } from './Tabs.context.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -12,7 +12,7 @@ const TabPanels = /*#__PURE__*/forwardRef(function TabPanels({
12
12
  tabsId
13
13
  } = useContext(TabsContext);
14
14
  const Panels = Children.map(children, (child, $index) => {
15
- if (conditionalRender && activeTab !== $index) return null;
15
+ if (! /*#__PURE__*/isValidElement(child) || conditionalRender && activeTab !== $index) return null;
16
16
  return /*#__PURE__*/cloneElement(child, {
17
17
  id: `${tabsId}-panel-${$index + 1}`,
18
18
  'aria-labelledby': `${tabsId}-tab-${$index + 1}`,
@@ -27,6 +27,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
27
27
  children,
28
28
  style,
29
29
  enterDelay = 100,
30
+ disabled = false,
30
31
  portalContainer,
31
32
  ...rest
32
33
  }, ref) {
@@ -142,7 +143,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
142
143
  })]
143
144
  });
144
145
  return /*#__PURE__*/jsxs(Fragment, {
145
- children: [shouldOpen && open && /*#__PURE__*/createPortal(TooltipEl, portalContainer ?? rootElement ?? document.body), updatedChildren]
146
+ children: [shouldOpen && open && !disabled && /*#__PURE__*/createPortal(TooltipEl, portalContainer ?? rootElement ?? document.body), updatedChildren]
146
147
  });
147
148
  });
148
149
 
package/dist/esm/index.js CHANGED
@@ -23,7 +23,7 @@ export { Body as TableBody } from './components/Table/Body.js';
23
23
  export { Cell as TableCell } from './components/Table/Cell.js';
24
24
  export { Head as TableHead } from './components/Table/Head/Head.js';
25
25
  export { Foot as TableFoot } from './components/Table/Foot/Foot.js';
26
- export { Row as tableRow } from './components/Table/Row/Row.js';
26
+ export { Row as TableRow } from './components/Table/Row/Row.js';
27
27
  export { Caption as TableCaption } from './components/Table/Caption.js';
28
28
  export { Divider } from './components/Divider/Divider.js';
29
29
  export { TextField } from './components/TextField/TextField.js';
@@ -15,7 +15,7 @@ import mergeDeepWithKey from './mergeDeepWithKey.js';
15
15
  * @param {Object} lObj
16
16
  * @param {Object} rObj
17
17
  * @return {Object}
18
- * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
18
+ * @see R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
19
19
  * @example
20
20
  *
21
21
  * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},
@@ -16,7 +16,7 @@ import mergeWithKey from './mergeWithKey.js';
16
16
  * @param {Object} l
17
17
  * @param {Object} r
18
18
  * @return {Object}
19
- * @see R.mergeDeepWith, R.merge, R.mergeWithKey
19
+ * @see R.mergeDeepWith, R.mergeWithKey
20
20
  * @example
21
21
  *
22
22
  * R.mergeWith(R.concat,
@@ -16,7 +16,7 @@ import _has from './internal/_has.js';
16
16
  * @param {Object} l
17
17
  * @param {Object} r
18
18
  * @return {Object}
19
- * @see R.mergeDeepWithKey, R.merge, R.mergeWith
19
+ * @see R.mergeDeepWithKey, R.mergeWith
20
20
  * @example
21
21
  *
22
22
  * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
@@ -6,7 +6,7 @@ type OverridableSubComponent = OverridableComponent<BreadcrumbProps, HTMLAnchorE
6
6
  export type BreadcrumbProps = {
7
7
  maxWidth?: number;
8
8
  /** Children is breadcrumb text */
9
- children: string;
9
+ children: React.ReactNode;
10
10
  /** Always show tooltip */
11
11
  forceTooltip?: boolean;
12
12
  /** Override element type */
@@ -3,7 +3,7 @@ import { Dispatch, SetStateAction } from 'react';
3
3
  /**
4
4
  * The default header for the calendar components if no custom header is provided
5
5
  */
6
- export declare function CalendarHeader({ state, title, previousMonthDisabled, nextMonthDisabled, showYearPicker, setShowYearPicker, setYearPickerPage, }: {
6
+ export declare function CalendarHeader({ state, title, previousMonthDisabled, nextMonthDisabled, showYearPicker, setShowYearPicker, setYearPickerPage, yearPickerPage, }: {
7
7
  state: CalendarState | RangeCalendarState;
8
8
  title: string;
9
9
  previousMonthDisabled?: boolean;
@@ -11,4 +11,5 @@ export declare function CalendarHeader({ state, title, previousMonthDisabled, ne
11
11
  showYearPicker: boolean;
12
12
  setShowYearPicker: (showYearPicker: boolean) => void;
13
13
  setYearPickerPage?: Dispatch<SetStateAction<number>>;
14
+ yearPickerPage: number;
14
15
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const getPageYears: (selectedYear: number, yearPickerPage?: number) => number[];
@@ -3,16 +3,16 @@ import { Body as TableBody, BodyProps } from './Body';
3
3
  import { Cell as TableCell, CellProps } from './Cell';
4
4
  import { Head as TableHead, HeadProps } from './Head';
5
5
  import { Foot as TableFoot, FootProps } from './Foot';
6
- import { Row as tableRow, RowProps } from './Row';
6
+ import { Row as TableRow, RowProps } from './Row';
7
7
  import { Caption as TableCaption, CaptionProps } from './Caption';
8
8
  type TableCompoundProps = typeof BaseTable & {
9
9
  Body: typeof TableBody;
10
10
  Cell: typeof TableCell;
11
11
  Head: typeof TableHead;
12
12
  Foot: typeof TableFoot;
13
- Row: typeof tableRow;
13
+ Row: typeof TableRow;
14
14
  Caption: typeof TableCaption;
15
15
  };
16
16
  declare const Table: TableCompoundProps;
17
- export { Table, TableBody, TableCell, TableHead, TableFoot, tableRow, TableCaption, };
17
+ export { Table, TableBody, TableCell, TableHead, TableFoot, TableRow, TableCaption, };
18
18
  export type { TableProps, CellProps, BodyProps, RowProps, CaptionProps, HeadProps, FootProps, };
@@ -2,7 +2,7 @@ import { Variants } from './Tabs.types';
2
2
  type State = {
3
3
  variant: Variants;
4
4
  scrollable: boolean;
5
- handleChange: (index: number) => void;
5
+ handleChange: (value: number | string) => void;
6
6
  activeTab: number | string;
7
7
  tabsId: string;
8
8
  tabsFocused: boolean;
@@ -4,7 +4,7 @@ export type TabsProps = {
4
4
  /** The index of the active tab OR a string matching the value prop on the active tab */
5
5
  activeTab?: number | string;
6
6
  /** The callback function for selecting a tab */
7
- onChange?: (index: number) => void;
7
+ onChange?: (value: number | string) => void;
8
8
  /** Sets the width of the tabs. Tabs can have a maximum width of 360px */
9
9
  variant?: Variants;
10
10
  /** adds scrollbar if tabs overflow on non-touch devices */
@@ -14,7 +14,7 @@ declare const Tabs: import("react").ForwardRefExoticComponent<{
14
14
  /** The index of the active tab OR a string matching the value prop on the active tab */
15
15
  activeTab?: number | string;
16
16
  /** The callback function for selecting a tab */
17
- onChange?: (index: number) => void;
17
+ onChange?: (value: number | string) => void;
18
18
  /** Sets the width of the tabs. Tabs can have a maximum width of 360px */
19
19
  variant?: Variants;
20
20
  /** adds scrollbar if tabs overflow on non-touch devices */
@@ -5,6 +5,8 @@ export type TooltipProps = {
5
5
  placement?: Placement;
6
6
  /** Tooltip title */
7
7
  title?: ReactNode;
8
+ /** Disable the tooltip */
9
+ disabled?: boolean;
8
10
  /** Tooltip anchor element */
9
11
  children: React.ReactElement & React.RefAttributes<HTMLElement>;
10
12
  /** Delay in ms, default 100 */
@@ -19,6 +21,8 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
19
21
  placement?: Placement;
20
22
  /** Tooltip title */
21
23
  title?: ReactNode;
24
+ /** Disable the tooltip */
25
+ disabled?: boolean;
22
26
  /** Tooltip anchor element */
23
27
  children: React.ReactElement & React.RefAttributes<HTMLElement>;
24
28
  /** Delay in ms, default 100 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.47.0",
3
+ "version": "0.49.0",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -33,44 +33,40 @@
33
33
  ],
34
34
  "devDependencies": {
35
35
  "@rollup/plugin-babel": "^6.0.4",
36
- "@rollup/plugin-commonjs": "^28.0.3",
36
+ "@rollup/plugin-commonjs": "^28.0.6",
37
37
  "@rollup/plugin-node-resolve": "^16.0.1",
38
- "@storybook/addon-a11y": "^8.6.12",
39
- "@storybook/addon-actions": "^8.6.12",
40
- "@storybook/addon-docs": "^8.6.12",
41
- "@storybook/addon-essentials": "^8.6.12",
42
- "@storybook/addon-links": "^8.6.12",
43
- "@storybook/blocks": "^8.6.12",
44
- "@storybook/preview-api": "^8.6.12",
45
- "@storybook/react": "^8.6.12",
46
- "@storybook/react-vite": "^8.6.12",
47
- "@testing-library/dom": "^10.4.0",
48
- "@testing-library/jest-dom": "^6.6.3",
38
+ "@storybook/addon-a11y": "^9.1.5",
39
+ "@storybook/addon-docs": "^9.1.5",
40
+ "@storybook/addon-links": "^9.1.5",
41
+ "@storybook/react-vite": "^9.1.5",
42
+ "@testing-library/dom": "^10.4.1",
43
+ "@testing-library/jest-dom": "^6.8.0",
49
44
  "@testing-library/react": "16.3.0",
50
45
  "@testing-library/user-event": "14.5.2",
51
46
  "@types/jest": "^29.5.14",
52
47
  "@types/ramda": "^0.30.2",
53
- "@types/react": "^18.3.20",
54
- "@types/react-dom": "^18.3.6",
48
+ "@types/react": "^18.3.24",
49
+ "@types/react-dom": "^18.3.7",
55
50
  "babel-plugin-styled-components": "^2.1.4",
56
51
  "jest": "^29.7.0",
57
52
  "jest-environment-jsdom": "^29.7.0",
58
53
  "jest-styled-components": "^7.2.0",
59
54
  "js-file-download": "^0.4.12",
60
- "postcss": "^8.5.3",
61
- "ramda": "^0.30.1",
55
+ "postcss": "^8.5.6",
56
+ "ramda": "^0.31.3",
62
57
  "react": "^18.3.1",
63
58
  "react-dom": "^18.3.1",
64
- "react-hook-form": "^7.56.1",
65
- "react-router-dom": "^6.30.0",
66
- "rollup": "^4.40.1",
59
+ "react-hook-form": "^7.62.0",
60
+ "react-router-dom": "^6.30.1",
61
+ "rollup": "^4.50.0",
67
62
  "rollup-plugin-delete": "^2.2.0",
68
63
  "rollup-plugin-postcss": "^4.0.2",
69
64
  "rollup-preserve-directives": "^1.1.3",
70
- "storybook": "^8.6.14",
71
- "styled-components": "6.1.18",
72
- "tsc-watch": "^6.2.1",
73
- "typescript": "^5.8.3"
65
+ "storybook": "^9.1.5",
66
+ "styled-components": "6.1.19",
67
+ "tsc-watch": "^6.3.1",
68
+ "typescript": "^5.9.2",
69
+ "eslint-plugin-storybook": "9.1.5"
74
70
  },
75
71
  "peerDependencies": {
76
72
  "react": ">=16.8",
@@ -78,19 +74,19 @@
78
74
  "styled-components": ">=5.1"
79
75
  },
80
76
  "dependencies": {
81
- "@babel/runtime": "^7.27.4",
82
- "@floating-ui/react": "^0.27.8",
83
- "@internationalized/date": "^3.8.0",
84
- "@react-aria/utils": "^3.28.2",
85
- "@react-stately/calendar": "^3.8.0",
86
- "@react-stately/datepicker": "^3.14.0",
87
- "@react-types/shared": "^3.29.0",
88
- "@tanstack/react-virtual": "3.13.8",
77
+ "@babel/runtime": "^7.28.3",
78
+ "@floating-ui/react": "^0.27.16",
79
+ "@internationalized/date": "^3.9.0",
80
+ "@react-aria/utils": "^3.30.1",
81
+ "@react-stately/calendar": "^3.8.4",
82
+ "@react-stately/datepicker": "^3.15.1",
83
+ "@react-types/shared": "^3.32.0",
84
+ "@tanstack/react-virtual": "3.13.12",
89
85
  "downshift": "9.0.8",
90
- "react-aria": "^3.39.0",
91
- "@equinor/eds-tokens": "0.9.2",
92
- "@equinor/eds-utils": "0.8.7",
93
- "@equinor/eds-icons": "^0.22.0"
86
+ "react-aria": "^3.43.1",
87
+ "@equinor/eds-icons": "^0.22.0",
88
+ "@equinor/eds-utils": "0.9.0",
89
+ "@equinor/eds-tokens": "0.10.0"
94
90
  },
95
91
  "scripts": {
96
92
  "build": "rollup -c --bundleConfigAsCjs && tsc -p tsconfig.build.json",
@@ -1 +0,0 @@
1
- export {};