@equinor/eds-core-react 0.47.0 → 0.48.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 (39) hide show
  1. package/dist/eds-core-react.cjs +41 -30
  2. package/dist/esm/components/Autocomplete/Autocomplete.js +7 -11
  3. package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -1
  4. package/dist/esm/components/Button/tokens/contained.js +1 -1
  5. package/dist/esm/components/Button/tokens/contained_icon.js +1 -1
  6. package/dist/esm/components/Button/tokens/ghost.js +1 -1
  7. package/dist/esm/components/Button/tokens/icon.js +1 -1
  8. package/dist/esm/components/Button/tokens/outlined.js +1 -1
  9. package/dist/esm/components/Datepicker/calendars/Calendar.js +1 -0
  10. package/dist/esm/components/Datepicker/calendars/CalendarHeader.js +8 -3
  11. package/dist/esm/components/Datepicker/calendars/RangeCalendar.js +2 -1
  12. package/dist/esm/components/Datepicker/calendars/YearGrid.js +2 -6
  13. package/dist/esm/components/Datepicker/utils/getPageYears.js +10 -0
  14. package/dist/esm/components/Input/Input.tokens.js +1 -1
  15. package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +1 -1
  16. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +1 -1
  17. package/dist/esm/components/Table/index.js +1 -1
  18. package/dist/esm/components/Tabs/TabList.js +10 -6
  19. package/dist/esm/components/Tabs/TabPanels.js +2 -2
  20. package/dist/esm/components/Tooltip/Tooltip.js +2 -1
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeDeepRight.js +1 -1
  23. package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeWith.js +1 -1
  24. package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeWithKey.js +1 -1
  25. package/dist/types/components/Datepicker/calendars/CalendarHeader.d.ts +2 -1
  26. package/dist/types/components/Datepicker/utils/getPageYears.d.ts +1 -0
  27. package/dist/types/components/Table/index.d.ts +3 -3
  28. package/dist/types/components/Tabs/Tabs.context.d.ts +1 -1
  29. package/dist/types/components/Tabs/Tabs.d.ts +2 -2
  30. package/dist/types/components/Tooltip/Tooltip.d.ts +4 -0
  31. package/package.json +8 -8
  32. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_curry1.js +0 -0
  33. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_curry2.js +0 -0
  34. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_curry3.js +0 -0
  35. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_has.js +0 -0
  36. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_isObject.js +0 -0
  37. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/internal/_isPlaceholder.js +0 -0
  38. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.1 → ramda@0.31.3}/node_modules/ramda/es/mergeDeepWithKey.js +0 -0
  39. /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
 
@@ -3998,20 +3999,24 @@ const TabList = /*#__PURE__*/react.forwardRef(function TabsList({
3998
3999
  }
3999
4000
  }, [arrowNavigating, tabsFocused]);
4000
4001
  const Tabs = react.Children.map(children, (child, $index) => {
4001
- const childProps = child.props;
4002
+ if (! /*#__PURE__*/react.isValidElement(child)) {
4003
+ return null;
4004
+ }
4005
+ const tabChild = child;
4006
+ const childProps = tabChild.props;
4002
4007
  const controlledActive = childProps.value;
4003
4008
  const isActive = controlledActive ? controlledActive === activeTab : $index === activeTab;
4004
- const tabRef = isActive ? edsUtils.mergeRefs(child.ref, selectedTabRef) : child.ref;
4009
+ const tabRef = isActive ? edsUtils.mergeRefs(tabChild.ref, selectedTabRef) : tabChild.ref;
4005
4010
  if (isActive) currentTab.current = $index;
4006
- return /*#__PURE__*/react.cloneElement(child, {
4011
+ return /*#__PURE__*/react.cloneElement(tabChild, {
4007
4012
  id: `${tabsId}-tab-${$index + 1}`,
4008
4013
  'aria-controls': `${tabsId}-panel-${$index + 1}`,
4009
4014
  active: isActive,
4010
4015
  $index,
4011
- onClick: () => handleChange($index),
4016
+ onClick: () => handleChange(controlledActive !== undefined ? controlledActive : $index),
4012
4017
  ref: tabRef
4013
4018
  });
4014
- });
4019
+ }) ?? [];
4015
4020
  const focusableChildren = Tabs.filter(child => {
4016
4021
  const childProps = child.props;
4017
4022
  return !childProps.disabled;
@@ -4098,7 +4103,7 @@ const TabPanels = /*#__PURE__*/react.forwardRef(function TabPanels({
4098
4103
  tabsId
4099
4104
  } = react.useContext(TabsContext);
4100
4105
  const Panels = react.Children.map(children, (child, $index) => {
4101
- if (conditionalRender && activeTab !== $index) return null;
4106
+ if (! /*#__PURE__*/react.isValidElement(child) || conditionalRender && activeTab !== $index) return null;
4102
4107
  return /*#__PURE__*/react.cloneElement(child, {
4103
4108
  id: `${tabsId}-panel-${$index + 1}`,
4104
4109
  'aria-labelledby': `${tabsId}-tab-${$index + 1}`,
@@ -9826,12 +9831,10 @@ function AutocompleteInner(props, ref) {
9826
9831
  if (item == null) {
9827
9832
  return '';
9828
9833
  }
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
- }
9834
+ if (optionLabel) {
9835
+ return optionLabel(item);
9836
+ } else if (typeof item === 'object') {
9837
+ throw new Error('Missing label. When using objects for options make sure to define the `optionLabel` property');
9835
9838
  }
9836
9839
  if (typeof item === 'string') {
9837
9840
  return item;
@@ -9967,11 +9970,9 @@ function AutocompleteInner(props, ref) {
9967
9970
  case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter:
9968
9971
  case downshift.useCombobox.stateChangeTypes.ItemClick:
9969
9972
  if (changes.selectedItem === AddSymbol) {
9970
- onAddNewOption(typedInputValue);
9971
9973
  return {
9972
9974
  ...changes,
9973
- inputValue: '',
9974
- selectedItem: null
9975
+ inputValue: ''
9975
9976
  };
9976
9977
  }
9977
9978
  return {
@@ -11385,6 +11386,15 @@ function CalendarCell({
11385
11386
  });
11386
11387
  }
11387
11388
 
11389
+ const TOTAL_VISIBLE_YEARS = 36;
11390
+ const RANGE_OFFSET = 30 / 2;
11391
+ const getPageYears = (selectedYear, yearPickerPage = 0) => {
11392
+ const page = yearPickerPage * TOTAL_VISIBLE_YEARS;
11393
+ return Array.from({
11394
+ length: TOTAL_VISIBLE_YEARS
11395
+ }, (_, i) => i + (selectedYear + page - RANGE_OFFSET));
11396
+ };
11397
+
11388
11398
  // Disable no-autofocus - it's not the native autofocus attribute, but react-aria's autoFocus prop
11389
11399
  /* eslint-disable jsx-a11y/no-autofocus */
11390
11400
  const Grid = styled__default.default.div.withConfig({
@@ -11397,8 +11407,6 @@ const GridColumn = styled__default.default.button.withConfig({
11397
11407
  })(["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
11408
  $active
11399
11409
  }) => $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
11410
  const GridFocusManager = ({
11403
11411
  year: selectedYear,
11404
11412
  setFocusedYear,
@@ -11408,10 +11416,7 @@ const GridFocusManager = ({
11408
11416
  const focusManager = reactAria.useFocusManager();
11409
11417
  const prevYear = react.useRef();
11410
11418
  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));
11419
+ const years = getPageYears(selectedYear, yearPickerPage);
11415
11420
  react.useEffect(() => {
11416
11421
  if (prevYear.current === undefined) {
11417
11422
  prevYear.current = yearPickerPage;
@@ -11614,14 +11619,18 @@ function CalendarHeader({
11614
11619
  nextMonthDisabled,
11615
11620
  showYearPicker,
11616
11621
  setShowYearPicker,
11617
- setYearPickerPage
11622
+ setYearPickerPage,
11623
+ yearPickerPage
11618
11624
  }) {
11625
+ const years = getPageYears(state.focusedDate.year, yearPickerPage);
11626
+ const backButtonDisabled = showYearPicker && state.minValue ? years[0] < state.minValue.year : previousMonthDisabled;
11627
+ const nextButtonDisabled = showYearPicker && state.maxValue ? years[years.length - 1] > state.maxValue.year : nextMonthDisabled;
11619
11628
  return /*#__PURE__*/jsxRuntime.jsx(HeaderWrapper, {
11620
11629
  children: /*#__PURE__*/jsxRuntime.jsxs(HeaderActions, {
11621
11630
  children: [/*#__PURE__*/jsxRuntime.jsx(Button$1, {
11622
11631
  variant: 'ghost_icon',
11623
11632
  "aria-label": 'Previous month',
11624
- disabled: previousMonthDisabled,
11633
+ disabled: backButtonDisabled,
11625
11634
  onClick: () => showYearPicker ? setYearPickerPage(page => page - 1) : state.focusPreviousPage(),
11626
11635
  children: /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
11627
11636
  data: edsIcons.chevron_left
@@ -11652,7 +11661,7 @@ function CalendarHeader({
11652
11661
  }), /*#__PURE__*/jsxRuntime.jsx(Button$1, {
11653
11662
  variant: 'ghost_icon',
11654
11663
  onClick: () => showYearPicker ? setYearPickerPage(page => page + 1) : state.focusNextPage(),
11655
- disabled: nextMonthDisabled,
11664
+ disabled: nextButtonDisabled,
11656
11665
  "aria-label": 'Next month',
11657
11666
  children: /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
11658
11667
  data: edsIcons.chevron_right
@@ -11712,6 +11721,7 @@ const Calendar = /*#__PURE__*/react.forwardRef(({
11712
11721
  nextMonthDisabled: nextButtonProps.isDisabled,
11713
11722
  setShowYearPicker: setShowYearPicker,
11714
11723
  showYearPicker: showYearPicker,
11724
+ yearPickerPage: yearPickerPage,
11715
11725
  setYearPickerPage: setYearPickerPage
11716
11726
  })
11717
11727
  }), /*#__PURE__*/jsxRuntime.jsx(Popover.Content, {
@@ -12307,7 +12317,8 @@ const RangeCalendar = /*#__PURE__*/react.forwardRef(({
12307
12317
  title: title,
12308
12318
  setShowYearPicker: setShowYearPicker,
12309
12319
  showYearPicker: showYearPicker,
12310
- setYearPickerPage: setYearPickerPage
12320
+ setYearPickerPage: setYearPickerPage,
12321
+ yearPickerPage: yearPickerPage
12311
12322
  })
12312
12323
  }), /*#__PURE__*/jsxRuntime.jsx(Popover.Content, {
12313
12324
  children: /*#__PURE__*/jsxRuntime.jsx(CalendarGrid, {
@@ -12610,6 +12621,7 @@ exports.TableFoot = Foot;
12610
12621
  exports.TableHead = Head;
12611
12622
  exports.TableOfContents = TableOfContents;
12612
12623
  exports.TableOfContentsLinkItem = LinkItem;
12624
+ exports.TableRow = Row;
12613
12625
  exports.Tabs = Tabs;
12614
12626
  exports.TextField = TextField;
12615
12627
  exports.ToggleButton = ToggleButton;
@@ -12619,6 +12631,5 @@ exports.TopbarActions = Actions;
12619
12631
  exports.TopbarCustomContent = CustomContent;
12620
12632
  exports.TopbarHeader = Header$2;
12621
12633
  exports.Typography = Typography;
12622
- exports.tableRow = Row;
12623
12634
  exports.useEds = useEds;
12624
12635
  exports.useSideBar = useSideBar;
@@ -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';
@@ -310,12 +310,10 @@ function AutocompleteInner(props, ref) {
310
310
  if (item == null) {
311
311
  return '';
312
312
  }
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
- }
313
+ if (optionLabel) {
314
+ return optionLabel(item);
315
+ } else if (typeof item === 'object') {
316
+ throw new Error('Missing label. When using objects for options make sure to define the `optionLabel` property');
319
317
  }
320
318
  if (typeof item === 'string') {
321
319
  return item;
@@ -451,11 +449,9 @@ function AutocompleteInner(props, ref) {
451
449
  case useCombobox.stateChangeTypes.InputKeyDownEnter:
452
450
  case useCombobox.stateChangeTypes.ItemClick:
453
451
  if (changes.selectedItem === AddSymbol) {
454
- onAddNewOption(typedInputValue);
455
452
  return {
456
453
  ...changes,
457
- inputValue: '',
458
- selectedItem: null
454
+ inputValue: ''
459
455
  };
460
456
  }
461
457
  return {
@@ -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 { 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: {
@@ -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
@@ -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.48.0",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -58,7 +58,7 @@
58
58
  "jest-styled-components": "^7.2.0",
59
59
  "js-file-download": "^0.4.12",
60
60
  "postcss": "^8.5.3",
61
- "ramda": "^0.30.1",
61
+ "ramda": "^0.31.3",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1",
64
64
  "react-hook-form": "^7.56.1",
@@ -68,7 +68,7 @@
68
68
  "rollup-plugin-postcss": "^4.0.2",
69
69
  "rollup-preserve-directives": "^1.1.3",
70
70
  "storybook": "^8.6.14",
71
- "styled-components": "6.1.18",
71
+ "styled-components": "6.1.19",
72
72
  "tsc-watch": "^6.2.1",
73
73
  "typescript": "^5.8.3"
74
74
  },
@@ -78,19 +78,19 @@
78
78
  "styled-components": ">=5.1"
79
79
  },
80
80
  "dependencies": {
81
- "@babel/runtime": "^7.27.4",
81
+ "@babel/runtime": "^7.27.6",
82
82
  "@floating-ui/react": "^0.27.8",
83
83
  "@internationalized/date": "^3.8.0",
84
84
  "@react-aria/utils": "^3.28.2",
85
85
  "@react-stately/calendar": "^3.8.0",
86
86
  "@react-stately/datepicker": "^3.14.0",
87
87
  "@react-types/shared": "^3.29.0",
88
- "@tanstack/react-virtual": "3.13.8",
88
+ "@tanstack/react-virtual": "3.13.12",
89
89
  "downshift": "9.0.8",
90
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"
91
+ "@equinor/eds-icons": "^0.22.0",
92
+ "@equinor/eds-utils": "0.8.8",
93
+ "@equinor/eds-tokens": "0.9.2"
94
94
  },
95
95
  "scripts": {
96
96
  "build": "rollup -c --bundleConfigAsCjs && tsc -p tsconfig.build.json",