@equinor/eds-core-react 0.49.0 → 1.0.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.
@@ -3422,16 +3422,17 @@ const AccordionItem = /*#__PURE__*/react.forwardRef(function AccordionItem({
3422
3422
  ...props
3423
3423
  }, ref) {
3424
3424
  const [expanded, setExpanded] = react.useState(isExpanded);
3425
- const controlled = onExpandedChange != undefined;
3425
+ const controlled = onExpandedChange !== undefined;
3426
3426
  const activeExpandedState = controlled ? isExpanded : expanded;
3427
3427
  const toggleExpanded = () => {
3428
+ if (disabled) return;
3428
3429
  if (controlled) {
3429
- onExpandedChange(!isExpanded);
3430
+ onExpandedChange?.(!isExpanded);
3430
3431
  } else {
3431
3432
  setExpanded(!expanded);
3432
3433
  }
3433
3434
  };
3434
- const Children = react.Children.map(children, (child, childIndex) => {
3435
+ const processedChildren = react.Children.map(children, (child, childIndex) => {
3435
3436
  const headerId = `${accordionId}-header-${index + 1}`;
3436
3437
  const panelId = `${accordionId}-panel-${index + 1}`;
3437
3438
  return childIndex === 0 ? /*#__PURE__*/react.cloneElement(child, {
@@ -3457,7 +3458,7 @@ const AccordionItem = /*#__PURE__*/react.forwardRef(function AccordionItem({
3457
3458
  return /*#__PURE__*/jsxRuntime.jsx("div", {
3458
3459
  ...props,
3459
3460
  ref: ref,
3460
- children: Children
3461
+ children: processedChildren
3461
3462
  });
3462
3463
  });
3463
3464
 
@@ -3996,7 +3997,7 @@ const TabList = /*#__PURE__*/react.forwardRef(function TabsList({
3996
3997
  scrollable = false,
3997
3998
  tabsFocused
3998
3999
  } = react.useContext(TabsContext);
3999
- const currentTab = react.useRef();
4000
+ const currentTab = react.useRef(0);
4000
4001
  const [arrowNavigating, setArrowNavigating] = react.useState(false);
4001
4002
  const selectedTabRef = react.useCallback(node => {
4002
4003
  if (node !== null && tabsFocused || node !== null && arrowNavigating) {
@@ -4008,13 +4009,13 @@ const TabList = /*#__PURE__*/react.forwardRef(function TabsList({
4008
4009
  if (! /*#__PURE__*/react.isValidElement(child)) {
4009
4010
  return null;
4010
4011
  }
4011
- const tabChild = child;
4012
- const childProps = tabChild.props;
4012
+ const childProps = child.props;
4013
4013
  const controlledActive = childProps.value;
4014
4014
  const isActive = controlledActive ? controlledActive === activeTab : $index === activeTab;
4015
- const tabRef = isActive ? edsUtils.mergeRefs(tabChild.ref, selectedTabRef) : tabChild.ref;
4015
+ const childRef = childProps?.ref || null;
4016
+ const tabRef = isActive && childRef ? edsUtils.mergeRefs(childRef, selectedTabRef) : isActive ? selectedTabRef : childRef;
4016
4017
  if (isActive) currentTab.current = $index;
4017
- return /*#__PURE__*/react.cloneElement(tabChild, {
4018
+ return /*#__PURE__*/react.cloneElement(child, {
4018
4019
  id: `${tabsId}-tab-${$index + 1}`,
4019
4020
  'aria-controls': `${tabsId}-panel-${$index + 1}`,
4020
4021
  active: isActive,
@@ -6272,7 +6273,7 @@ const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
6272
6273
  ...rest
6273
6274
  }, ref) {
6274
6275
  const [visible, setVisible] = react.useState(open);
6275
- const timer = react.useRef();
6276
+ const timer = react.useRef(null);
6276
6277
  react.useEffect(() => {
6277
6278
  setVisible(open);
6278
6279
  if (open) {
@@ -6301,7 +6302,9 @@ const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
6301
6302
  children: visible && /*#__PURE__*/jsxRuntime.jsx(PopoverDiv, {
6302
6303
  popover: "manual",
6303
6304
  $placement: placement,
6304
- ref: el => el?.showPopover(),
6305
+ ref: el => {
6306
+ el?.showPopover();
6307
+ },
6305
6308
  children: /*#__PURE__*/jsxRuntime.jsx(StyledSnackbar, {
6306
6309
  role: "alert",
6307
6310
  elevation: "overlay",
@@ -7503,7 +7506,12 @@ const Breadcrumb = /*#__PURE__*/react.forwardRef(function Breadcrumb({
7503
7506
  return showTooltip ? /*#__PURE__*/jsxRuntime.jsx(Tooltip$2, {
7504
7507
  title: children,
7505
7508
  placement: "top",
7506
- children: crumb
7509
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
7510
+ style: {
7511
+ display: 'inline-block'
7512
+ },
7513
+ children: crumb
7514
+ })
7507
7515
  }) : crumb;
7508
7516
  });
7509
7517
 
@@ -11163,10 +11171,9 @@ const SideBarAccordion = /*#__PURE__*/react.forwardRef(function SideBarAccordion
11163
11171
  onClose: closeMenu,
11164
11172
  anchorEl: anchorEl,
11165
11173
  children: react.Children.map(children, child => {
11166
- const item = child;
11167
11174
  return /*#__PURE__*/jsxRuntime.jsx(Menu.Item, {
11168
11175
  ...child.props,
11169
- children: item.props.label
11176
+ children: child.props.label
11170
11177
  });
11171
11178
  })
11172
11179
  })]
@@ -11432,7 +11439,7 @@ const GridFocusManager = ({
11432
11439
  setYearPickerPage
11433
11440
  }) => {
11434
11441
  const focusManager = reactAria.useFocusManager();
11435
- const prevYear = react.useRef();
11442
+ const prevYear = react.useRef(null);
11436
11443
  const navByKeyboard = react.useRef(false);
11437
11444
  const years = getPageYears(selectedYear, yearPickerPage);
11438
11445
  react.useEffect(() => {
@@ -13,16 +13,17 @@ const AccordionItem = /*#__PURE__*/forwardRef(function AccordionItem({
13
13
  ...props
14
14
  }, ref) {
15
15
  const [expanded, setExpanded] = useState(isExpanded);
16
- const controlled = onExpandedChange != undefined;
16
+ const controlled = onExpandedChange !== undefined;
17
17
  const activeExpandedState = controlled ? isExpanded : expanded;
18
18
  const toggleExpanded = () => {
19
+ if (disabled) return;
19
20
  if (controlled) {
20
- onExpandedChange(!isExpanded);
21
+ onExpandedChange?.(!isExpanded);
21
22
  } else {
22
23
  setExpanded(!expanded);
23
24
  }
24
25
  };
25
- const Children$1 = Children.map(children, (child, childIndex) => {
26
+ const processedChildren = Children.map(children, (child, childIndex) => {
26
27
  const headerId = `${accordionId}-header-${index + 1}`;
27
28
  const panelId = `${accordionId}-panel-${index + 1}`;
28
29
  return childIndex === 0 ? /*#__PURE__*/cloneElement(child, {
@@ -48,7 +49,7 @@ const AccordionItem = /*#__PURE__*/forwardRef(function AccordionItem({
48
49
  return /*#__PURE__*/jsx("div", {
49
50
  ...props,
50
51
  ref: ref,
51
- children: Children$1
52
+ children: processedChildren
52
53
  });
53
54
  });
54
55
 
@@ -44,7 +44,12 @@ const Breadcrumb = /*#__PURE__*/forwardRef(function Breadcrumb({
44
44
  return showTooltip ? /*#__PURE__*/jsx(Tooltip, {
45
45
  title: children,
46
46
  placement: "top",
47
- children: crumb
47
+ children: /*#__PURE__*/jsx("span", {
48
+ style: {
49
+ display: 'inline-block'
50
+ },
51
+ children: crumb
52
+ })
48
53
  }) : crumb;
49
54
  });
50
55
 
@@ -24,7 +24,7 @@ const GridFocusManager = ({
24
24
  setYearPickerPage
25
25
  }) => {
26
26
  const focusManager = useFocusManager();
27
- const prevYear = useRef();
27
+ const prevYear = useRef(null);
28
28
  const navByKeyboard = useRef(false);
29
29
  const years = getPageYears(selectedYear, yearPickerPage);
30
30
  useEffect(() => {
@@ -222,10 +222,9 @@ const SideBarAccordion = /*#__PURE__*/forwardRef(function SideBarAccordion({
222
222
  onClose: closeMenu,
223
223
  anchorEl: anchorEl,
224
224
  children: Children.map(children, child => {
225
- const item = child;
226
225
  return /*#__PURE__*/jsx(Menu.Item, {
227
226
  ...child.props,
228
- children: item.props.label
227
+ children: child.props.label
229
228
  });
230
229
  })
231
230
  })]
@@ -40,7 +40,7 @@ const Snackbar = /*#__PURE__*/forwardRef(function Snackbar({
40
40
  ...rest
41
41
  }, ref) {
42
42
  const [visible, setVisible] = useState(open);
43
- const timer = useRef();
43
+ const timer = useRef(null);
44
44
  useEffect(() => {
45
45
  setVisible(open);
46
46
  if (open) {
@@ -69,7 +69,9 @@ const Snackbar = /*#__PURE__*/forwardRef(function Snackbar({
69
69
  children: visible && /*#__PURE__*/jsx(PopoverDiv, {
70
70
  popover: "manual",
71
71
  $placement: placement,
72
- ref: el => el?.showPopover(),
72
+ ref: el => {
73
+ el?.showPopover();
74
+ },
73
75
  children: /*#__PURE__*/jsx(StyledSnackbar, {
74
76
  role: "alert",
75
77
  elevation: "overlay",
@@ -30,7 +30,7 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
30
30
  scrollable = false,
31
31
  tabsFocused
32
32
  } = useContext(TabsContext);
33
- const currentTab = useRef();
33
+ const currentTab = useRef(0);
34
34
  const [arrowNavigating, setArrowNavigating] = useState(false);
35
35
  const selectedTabRef = useCallback(node => {
36
36
  if (node !== null && tabsFocused || node !== null && arrowNavigating) {
@@ -42,13 +42,13 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
42
42
  if (! /*#__PURE__*/isValidElement(child)) {
43
43
  return null;
44
44
  }
45
- const tabChild = child;
46
- const childProps = tabChild.props;
45
+ const childProps = child.props;
47
46
  const controlledActive = childProps.value;
48
47
  const isActive = controlledActive ? controlledActive === activeTab : $index === activeTab;
49
- const tabRef = isActive ? mergeRefs(tabChild.ref, selectedTabRef) : tabChild.ref;
48
+ const childRef = childProps?.ref || null;
49
+ const tabRef = isActive && childRef ? mergeRefs(childRef, selectedTabRef) : isActive ? selectedTabRef : childRef;
50
50
  if (isActive) currentTab.current = $index;
51
- return /*#__PURE__*/cloneElement(tabChild, {
51
+ return /*#__PURE__*/cloneElement(child, {
52
52
  id: `${tabsId}-tab-${$index + 1}`,
53
53
  'aria-controls': `${tabsId}-panel-${$index + 1}`,
54
54
  active: isActive,
@@ -2,7 +2,7 @@ type IconProps = {
2
2
  $variant: 'active' | 'error' | 'default';
3
3
  $disabled: boolean;
4
4
  };
5
- export declare const Icon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<{
5
+ export declare const Icon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<{
6
6
  title?: string;
7
7
  color?: string;
8
8
  size?: 16 | 18 | 24 | 32 | 40 | 48;
@@ -10,9 +10,7 @@ export declare const Icon: import("styled-components/dist/types").IStyledCompone
10
10
  name: import("../Icon/Icon.types").Name;
11
11
  data?: import("@equinor/eds-icons").IconData;
12
12
  ref?: import("react").Ref<SVGSVGElement>;
13
- } & import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>, "ref"> & {
14
- ref?: import("react").Ref<SVGSVGElement>;
15
- }) | (Omit<Omit<{
13
+ } & import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>) | (Omit<{
16
14
  title?: string;
17
15
  color?: string;
18
16
  size?: 16 | 18 | 24 | 32 | 40 | 48;
@@ -20,7 +18,5 @@ export declare const Icon: import("styled-components/dist/types").IStyledCompone
20
18
  name?: import("../Icon/Icon.types").Name;
21
19
  data: import("@equinor/eds-icons").IconData;
22
20
  ref?: import("react").Ref<SVGSVGElement>;
23
- } & import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>, "ref"> & {
24
- ref?: import("react").Ref<SVGSVGElement>;
25
- }), IconProps>> & string & Omit<import("../Icon/Icon.types").IconType, keyof import("react").Component<any, {}, any>>;
21
+ } & import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>), IconProps>> & string & Omit<import("../Icon/Icon.types").IconType, keyof import("react").Component<any, {}, any>>;
26
22
  export {};
@@ -16,7 +16,7 @@ export declare const FieldWrapper: import("react").ForwardRefExoticComponent<{
16
16
  setIsOpen: (open: boolean) => void;
17
17
  label?: string;
18
18
  calendar: ReactNode;
19
- pickerRef: RefObject<HTMLDivElement>;
19
+ pickerRef: RefObject<HTMLDivElement | null>;
20
20
  readonly: boolean;
21
21
  extraProps?: GroupDOMAttributes;
22
22
  } & {
@@ -1,4 +1,4 @@
1
- import { ReactNode, MouseEvent } from 'react';
1
+ import { ReactNode, MouseEvent, type JSX } from 'react';
2
2
  import type { FocusTarget } from './Menu.types';
3
3
  export type State = {
4
4
  focusedIndex: number;
@@ -7,4 +7,4 @@ export type SideBarButtonProps = {
7
7
  export declare const SideBarButton: import("react").ForwardRefExoticComponent<{
8
8
  label: string;
9
9
  icon: IconData;
10
- } & Omit<ButtonProps, "type" | "href" | "variant" | "fullWidth"> & import("react").RefAttributes<HTMLButtonElement>>;
10
+ } & Omit<ButtonProps, "type" | "variant" | "href" | "fullWidth"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,5 +1,3 @@
1
1
  export declare const BaseInputWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
2
- export declare const BaseInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
3
- ref?: import("react").Ref<HTMLInputElement>;
4
- }>, never>, never>> & string;
2
+ export declare const BaseInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>, never>, never>> & string;
5
3
  export declare const GridWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, RefAttributes } from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  export type TabListProps = HTMLAttributes<HTMLDivElement>;
3
- declare const TabList: import("react").ForwardRefExoticComponent<TabListProps & RefAttributes<HTMLDivElement>>;
3
+ declare const TabList: import("react").ForwardRefExoticComponent<TabListProps & import("react").RefAttributes<HTMLDivElement>>;
4
4
  export { TabList };
@@ -8,7 +8,7 @@ export type TooltipProps = {
8
8
  /** Disable the tooltip */
9
9
  disabled?: boolean;
10
10
  /** Tooltip anchor element */
11
- children: React.ReactElement & React.RefAttributes<HTMLElement>;
11
+ children: React.ReactElement<HTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>;
12
12
  /** Delay in ms, default 100 */
13
13
  enterDelay?: number;
14
14
  /** Portal container
@@ -24,7 +24,7 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
24
24
  /** Disable the tooltip */
25
25
  disabled?: boolean;
26
26
  /** Tooltip anchor element */
27
- children: React.ReactElement & React.RefAttributes<HTMLElement>;
27
+ children: React.ReactElement<HTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>;
28
28
  /** Delay in ms, default 100 */
29
29
  enterDelay?: number;
30
30
  /** Portal container
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.49.0",
3
+ "version": "1.0.0",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -45,17 +45,18 @@
45
45
  "@testing-library/user-event": "14.5.2",
46
46
  "@types/jest": "^29.5.14",
47
47
  "@types/ramda": "^0.30.2",
48
- "@types/react": "^18.3.24",
49
- "@types/react-dom": "^18.3.7",
48
+ "@types/react": "^19.1.12",
49
+ "@types/react-dom": "^19.1.9",
50
50
  "babel-plugin-styled-components": "^2.1.4",
51
+ "eslint-plugin-storybook": "9.1.5",
51
52
  "jest": "^29.7.0",
52
53
  "jest-environment-jsdom": "^29.7.0",
53
54
  "jest-styled-components": "^7.2.0",
54
55
  "js-file-download": "^0.4.12",
55
56
  "postcss": "^8.5.6",
56
57
  "ramda": "^0.31.3",
57
- "react": "^18.3.1",
58
- "react-dom": "^18.3.1",
58
+ "react": "^19.1.1",
59
+ "react-dom": "^19.1.1",
59
60
  "react-hook-form": "^7.62.0",
60
61
  "react-router-dom": "^6.30.1",
61
62
  "rollup": "^4.50.0",
@@ -65,11 +66,10 @@
65
66
  "storybook": "^9.1.5",
66
67
  "styled-components": "6.1.19",
67
68
  "tsc-watch": "^6.3.1",
68
- "typescript": "^5.9.2",
69
- "eslint-plugin-storybook": "9.1.5"
69
+ "typescript": "^5.9.2"
70
70
  },
71
71
  "peerDependencies": {
72
- "react": ">=16.8",
72
+ "react": ">=19.0.0",
73
73
  "react-dom": ">=16.8",
74
74
  "styled-components": ">=5.1"
75
75
  },
@@ -84,9 +84,9 @@
84
84
  "@tanstack/react-virtual": "3.13.12",
85
85
  "downshift": "9.0.8",
86
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"
87
+ "@equinor/eds-icons": "^1.0.0",
88
+ "@equinor/eds-tokens": "1.0.0",
89
+ "@equinor/eds-utils": "1.0.0"
90
90
  },
91
91
  "scripts": {
92
92
  "build": "rollup -c --bundleConfigAsCjs && tsc -p tsconfig.build.json",