@equinor/eds-core-react 0.48.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.
@@ -1854,7 +1854,8 @@ const StyledTableCell$1 = styled__default.default.th.withConfig({
1854
1854
  })(props => {
1855
1855
  const {
1856
1856
  theme,
1857
- $sticky
1857
+ $sticky,
1858
+ $density
1858
1859
  } = props;
1859
1860
  const {
1860
1861
  background,
@@ -1872,7 +1873,11 @@ const StyledTableCell$1 = styled__default.default.th.withConfig({
1872
1873
  if (ariaSort && ariaSort !== 'none') {
1873
1874
  sortStylingActive = styled.css(["", ";background:", ";color:", ";"], activeToken.border.type === 'bordergroup' ? styled.css(["border-color:", ";"], activeToken.border.bottom.color) : '', activeToken.background, activeToken.typography.color);
1874
1875
  }
1875
- 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;"]) : '');
1876
1881
  });
1877
1882
  const CellInner$1 = styled__default.default.div.withConfig({
1878
1883
  displayName: "HeaderCell__CellInner",
@@ -1893,6 +1898,7 @@ const TableHeaderCell = /*#__PURE__*/react.forwardRef(function TableHeaderCell({
1893
1898
  const props = {
1894
1899
  ref,
1895
1900
  $sticky: sticky,
1901
+ $density: density,
1896
1902
  ...rest
1897
1903
  };
1898
1904
  return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
@@ -7483,7 +7489,7 @@ const Breadcrumb = /*#__PURE__*/react.forwardRef(function Breadcrumb({
7483
7489
  href,
7484
7490
  ref
7485
7491
  };
7486
- const showTooltip = maxWidth > 0 || forceTooltip;
7492
+ const showTooltip = maxWidth !== undefined && maxWidth > 0 || forceTooltip === true;
7487
7493
  const isHrefDefined = href !== undefined;
7488
7494
  const forwardedAs = react.useMemo(() => as ? as : isHrefDefined ? 'a' : 'span', [as, isHrefDefined]);
7489
7495
  const crumb = /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
@@ -9513,6 +9519,10 @@ const StyledAddItemIcon = styled__default.default(Icon$1).withConfig({
9513
9519
  }) => {
9514
9520
  return styled.css(["padding:", ";color:", ";"], multiple ? '0.75rem' : '0 0.75rem 0 0', edsTokens.tokens.colors.interactive.primary__resting.hex);
9515
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);
9516
9526
  function AddNewOptionInner(props, ref) {
9517
9527
  const {
9518
9528
  value,
@@ -9525,17 +9535,21 @@ function AddNewOptionInner(props, ref) {
9525
9535
  return /*#__PURE__*/jsxRuntime.jsxs(StyledListItem, {
9526
9536
  ref: ref,
9527
9537
  $highlighted: highlighted,
9528
- "aria-label": `Add new option: ${value}`,
9529
9538
  onClick: e => {
9530
9539
  onClick(e);
9531
9540
  },
9532
9541
  ...other,
9542
+ "aria-label": `Add new option: ${value}`,
9543
+ "aria-live": "polite",
9544
+ "aria-selected": false,
9533
9545
  children: [/*#__PURE__*/jsxRuntime.jsx(StyledAddItemIcon, {
9534
9546
  multiple: multiple,
9535
9547
  data: edsIcons.add_box
9536
9548
  }), /*#__PURE__*/jsxRuntime.jsx(AutocompleteOptionLabel, {
9537
9549
  $multiline: multiline,
9538
- children: value
9550
+ children: value ? value : /*#__PURE__*/jsxRuntime.jsx(StyledPlaceholder, {
9551
+ children: "Type to add new options"
9552
+ })
9539
9553
  })]
9540
9554
  });
9541
9555
  }
@@ -9745,8 +9759,9 @@ function AutocompleteInner(props, ref) {
9745
9759
  return allowSelectAll && !typedInputValue;
9746
9760
  }, [allowSelectAll, multiple, typedInputValue]);
9747
9761
  const availableItems = react.useMemo(() => {
9762
+ if (showSelectAll && onAddNewOption) return [AddSymbol, AllSymbol, ..._availableItems];
9748
9763
  if (showSelectAll) return [AllSymbol, ..._availableItems];
9749
- if (_availableItems.length === 0 && onAddNewOption) return [AddSymbol];
9764
+ if (onAddNewOption) return [AddSymbol, ..._availableItems];
9750
9765
  return _availableItems;
9751
9766
  }, [_availableItems, showSelectAll, onAddNewOption]);
9752
9767
 
@@ -9869,6 +9884,7 @@ function AutocompleteInner(props, ref) {
9869
9884
  //can not pass readonly type to downshift so we cast it to regular T[]
9870
9885
  initialSelectedItem: initialSelectedOptions[0],
9871
9886
  isItemDisabled(item) {
9887
+ if (item === AddSymbol) return !typedInputValue.trim();
9872
9888
  return optionDisabled(item);
9873
9889
  },
9874
9890
  itemToKey,
@@ -9922,7 +9938,7 @@ function AutocompleteInner(props, ref) {
9922
9938
  if (selectedItem != null && !optionDisabled(selectedItem)) {
9923
9939
  if (selectedItem === AllSymbol) {
9924
9940
  toggleAllSelected();
9925
- } else if (selectedItem === AddSymbol) {
9941
+ } else if (selectedItem === AddSymbol && typedInputValue.trim()) {
9926
9942
  onAddNewOption?.(typedInputValue);
9927
9943
  } else if (multiple) {
9928
9944
  const shouldRemove = itemCompare ? selectedItems.some(i => itemCompare(selectedItem, i)) : selectedItems.includes(selectedItem);
@@ -9944,6 +9960,7 @@ function AutocompleteInner(props, ref) {
9944
9960
  comboBoxProps = {
9945
9961
  ...comboBoxProps,
9946
9962
  onSelectedItemChange: changes => {
9963
+ if (changes.selectedItem === AddSymbol) return;
9947
9964
  if (onOptionsChange) {
9948
9965
  let {
9949
9966
  selectedItem
@@ -10261,6 +10278,7 @@ function AutocompleteInner(props, ref) {
10261
10278
  }, 'select-all');
10262
10279
  }
10263
10280
  if (item === AddSymbol && onAddNewOption) {
10281
+ const isDisabled = !typedInputValue.trim();
10264
10282
  return /*#__PURE__*/jsxRuntime.jsx(AddNewOption, {
10265
10283
  "data-index": 0,
10266
10284
  "data-testid": 'add-item',
@@ -10280,7 +10298,7 @@ function AutocompleteInner(props, ref) {
10280
10298
  item,
10281
10299
  index: index
10282
10300
  }),
10283
- value: `${typedInputValue}`
10301
+ value: typedInputValue.trim()
10284
10302
  }, 'add-item');
10285
10303
  }
10286
10304
  return /*#__PURE__*/jsxRuntime.jsx(AutocompleteOption, {
@@ -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
  }
@@ -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
 
@@ -348,6 +349,7 @@ function AutocompleteInner(props, ref) {
348
349
  //can not pass readonly type to downshift so we cast it to regular T[]
349
350
  initialSelectedItem: initialSelectedOptions[0],
350
351
  isItemDisabled(item) {
352
+ if (item === AddSymbol) return !typedInputValue.trim();
351
353
  return optionDisabled(item);
352
354
  },
353
355
  itemToKey,
@@ -401,7 +403,7 @@ function AutocompleteInner(props, ref) {
401
403
  if (selectedItem != null && !optionDisabled(selectedItem)) {
402
404
  if (selectedItem === AllSymbol) {
403
405
  toggleAllSelected();
404
- } else if (selectedItem === AddSymbol) {
406
+ } else if (selectedItem === AddSymbol && typedInputValue.trim()) {
405
407
  onAddNewOption?.(typedInputValue);
406
408
  } else if (multiple) {
407
409
  const shouldRemove = itemCompare ? selectedItems.some(i => itemCompare(selectedItem, i)) : selectedItems.includes(selectedItem);
@@ -423,6 +425,7 @@ function AutocompleteInner(props, ref) {
423
425
  comboBoxProps = {
424
426
  ...comboBoxProps,
425
427
  onSelectedItemChange: changes => {
428
+ if (changes.selectedItem === AddSymbol) return;
426
429
  if (onOptionsChange) {
427
430
  let {
428
431
  selectedItem
@@ -740,6 +743,7 @@ function AutocompleteInner(props, ref) {
740
743
  }, 'select-all');
741
744
  }
742
745
  if (item === AddSymbol && onAddNewOption) {
746
+ const isDisabled = !typedInputValue.trim();
743
747
  return /*#__PURE__*/jsx(AddNewOption, {
744
748
  "data-index": 0,
745
749
  "data-testid": 'add-item',
@@ -759,7 +763,7 @@ function AutocompleteInner(props, ref) {
759
763
  item,
760
764
  index: index
761
765
  }),
762
- value: `${typedInputValue}`
766
+ value: typedInputValue.trim()
763
767
  }, 'add-item');
764
768
  }
765
769
  return /*#__PURE__*/jsx(AutocompleteOption, {
@@ -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 { 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, {
@@ -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 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.48.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",
55
+ "postcss": "^8.5.6",
61
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",
65
+ "storybook": "^9.1.5",
71
66
  "styled-components": "6.1.19",
72
- "tsc-watch": "^6.2.1",
73
- "typescript": "^5.8.3"
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.6",
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",
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",
88
84
  "@tanstack/react-virtual": "3.13.12",
89
85
  "downshift": "9.0.8",
90
- "react-aria": "^3.39.0",
86
+ "react-aria": "^3.43.1",
91
87
  "@equinor/eds-icons": "^0.22.0",
92
- "@equinor/eds-utils": "0.8.8",
93
- "@equinor/eds-tokens": "0.9.2"
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 {};