@equinor/eds-core-react 0.42.2 → 0.42.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10438,9 +10438,13 @@ const initalState = {
10438
10438
  };
10439
10439
  const SideBarContext = /*#__PURE__*/react.createContext(initalState);
10440
10440
  const SideBarProvider = ({
10441
- children
10441
+ children,
10442
+ isOpen: isOpenProp = false
10442
10443
  }) => {
10443
- const [state, setState] = react.useState(initalState);
10444
+ const [state, setState] = react.useState({
10445
+ onToggle: null,
10446
+ isOpen: isOpenProp
10447
+ });
10444
10448
  const {
10445
10449
  isOpen,
10446
10450
  onToggle
@@ -10473,13 +10477,11 @@ const useSideBar = () => react.useContext(SideBarContext);
10473
10477
 
10474
10478
  const SideBarContainer = /*#__PURE__*/react.forwardRef(function SideBarContainer({
10475
10479
  onToggle: onToggleCallback,
10476
- open = false,
10477
10480
  children,
10478
10481
  ...rest
10479
10482
  }, ref) {
10480
10483
  const {
10481
10484
  isOpen,
10482
- setIsOpen,
10483
10485
  onToggle,
10484
10486
  setOnToggle
10485
10487
  } = useSideBar();
@@ -10488,10 +10490,6 @@ const SideBarContainer = /*#__PURE__*/react.forwardRef(function SideBarContainer
10488
10490
  setOnToggle(onToggleCallback);
10489
10491
  }
10490
10492
  }, [onToggle, onToggleCallback, setOnToggle]);
10491
- react.useEffect(() => {
10492
- setIsOpen(open);
10493
- // eslint-disable-next-line react-hooks/exhaustive-deps
10494
- }, [open]);
10495
10493
  return /*#__PURE__*/jsxRuntime.jsx(GridContainer, {
10496
10494
  ...rest,
10497
10495
  open: isOpen,
@@ -10529,6 +10527,7 @@ const SideBar$1 = /*#__PURE__*/react.forwardRef(({
10529
10527
  return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
10530
10528
  theme: token,
10531
10529
  children: /*#__PURE__*/jsxRuntime.jsx(SideBarProvider, {
10530
+ isOpen: open,
10532
10531
  children: /*#__PURE__*/jsxRuntime.jsx(SideBarContainer, {
10533
10532
  ...props,
10534
10533
  ref: ref
@@ -11171,7 +11170,9 @@ SideBar.AccordionItem.displayName = 'SideBar.AccordionItem';
11171
11170
  const StyledCell = styled__default.default(Typography).withConfig({
11172
11171
  displayName: "CalendarCell__StyledCell",
11173
11172
  componentId: "sc-y5ycmg-0"
11174
- })(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}&:focus{outline:2px dashed rgba(0,112,121,1);}", " ", " ", " ", " ", " ", ""], edsTokens.tokens.colors.interactive.table__cell__fill_hover.rgba, ({
11173
+ })(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}", " ", " ", " ", " ", " ", " ", ""], edsTokens.tokens.colors.interactive.table__cell__fill_hover.rgba, ({
11174
+ $focused
11175
+ }) => $focused && `outline: 2px dashed rgba(0, 112, 121, 1);`, ({
11175
11176
  $selected
11176
11177
  }) => $selected && `background-color: ${edsTokens.tokens.colors.interactive.primary__selected_highlight.rgba};`, ({
11177
11178
  $hidden
@@ -11250,7 +11251,8 @@ function CalendarCell({
11250
11251
  isOutsideVisibleRange,
11251
11252
  isDisabled,
11252
11253
  isUnavailable,
11253
- formattedDate
11254
+ formattedDate,
11255
+ isFocused
11254
11256
  } = reactAria.useCalendarCell({
11255
11257
  date
11256
11258
  }, state, ref);
@@ -11298,6 +11300,7 @@ function CalendarCell({
11298
11300
  $highlight: isHighlight,
11299
11301
  $disabled: isDisabled || isUnavailable,
11300
11302
  $density: density,
11303
+ $focused: isFocused,
11301
11304
  children: formattedDate
11302
11305
  })
11303
11306
  });
@@ -9,7 +9,9 @@ import { useEds } from '../../EdsProvider/eds.context.js';
9
9
  const StyledCell = styled(Typography).withConfig({
10
10
  displayName: "CalendarCell__StyledCell",
11
11
  componentId: "sc-y5ycmg-0"
12
- })(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}&:focus{outline:2px dashed rgba(0,112,121,1);}", " ", " ", " ", " ", " ", ""], tokens.colors.interactive.table__cell__fill_hover.rgba, ({
12
+ })(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}", " ", " ", " ", " ", " ", " ", ""], tokens.colors.interactive.table__cell__fill_hover.rgba, ({
13
+ $focused
14
+ }) => $focused && `outline: 2px dashed rgba(0, 112, 121, 1);`, ({
13
15
  $selected
14
16
  }) => $selected && `background-color: ${tokens.colors.interactive.primary__selected_highlight.rgba};`, ({
15
17
  $hidden
@@ -88,7 +90,8 @@ function CalendarCell({
88
90
  isOutsideVisibleRange,
89
91
  isDisabled,
90
92
  isUnavailable,
91
- formattedDate
93
+ formattedDate,
94
+ isFocused
92
95
  } = useCalendarCell({
93
96
  date
94
97
  }, state, ref);
@@ -136,6 +139,7 @@ function CalendarCell({
136
139
  $highlight: isHighlight,
137
140
  $disabled: isDisabled || isUnavailable,
138
141
  $density: density,
142
+ $focused: isFocused,
139
143
  children: formattedDate
140
144
  })
141
145
  });
@@ -7,9 +7,13 @@ const initalState = {
7
7
  };
8
8
  const SideBarContext = /*#__PURE__*/createContext(initalState);
9
9
  const SideBarProvider = ({
10
- children
10
+ children,
11
+ isOpen: isOpenProp = false
11
12
  }) => {
12
- const [state, setState] = useState(initalState);
13
+ const [state, setState] = useState({
14
+ onToggle: null,
15
+ isOpen: isOpenProp
16
+ });
13
17
  const {
14
18
  isOpen,
15
19
  onToggle
@@ -8,13 +8,11 @@ import { useEds } from '../EdsProvider/eds.context.js';
8
8
 
9
9
  const SideBarContainer = /*#__PURE__*/forwardRef(function SideBarContainer({
10
10
  onToggle: onToggleCallback,
11
- open = false,
12
11
  children,
13
12
  ...rest
14
13
  }, ref) {
15
14
  const {
16
15
  isOpen,
17
- setIsOpen,
18
16
  onToggle,
19
17
  setOnToggle
20
18
  } = useSideBar();
@@ -23,10 +21,6 @@ const SideBarContainer = /*#__PURE__*/forwardRef(function SideBarContainer({
23
21
  setOnToggle(onToggleCallback);
24
22
  }
25
23
  }, [onToggle, onToggleCallback, setOnToggle]);
26
- useEffect(() => {
27
- setIsOpen(open);
28
- // eslint-disable-next-line react-hooks/exhaustive-deps
29
- }, [open]);
30
24
  return /*#__PURE__*/jsx(GridContainer, {
31
25
  ...rest,
32
26
  open: isOpen,
@@ -64,6 +58,7 @@ const SideBar = /*#__PURE__*/forwardRef(({
64
58
  return /*#__PURE__*/jsx(ThemeProvider, {
65
59
  theme: token,
66
60
  children: /*#__PURE__*/jsx(SideBarProvider, {
61
+ isOpen: open,
67
62
  children: /*#__PURE__*/jsx(SideBarContainer, {
68
63
  ...props,
69
64
  ref: ref
@@ -9,7 +9,8 @@ type UseSidebarProps<T> = T & {
9
9
  };
10
10
  type ProviderProps = {
11
11
  children: ReactNode;
12
+ isOpen: boolean;
12
13
  };
13
- export declare const SideBarProvider: ({ children }: ProviderProps) => JSX.Element;
14
+ export declare const SideBarProvider: ({ children, isOpen: isOpenProp, }: ProviderProps) => import("react/jsx-runtime").JSX.Element;
14
15
  export declare const useSideBar: () => UseSidebarProps<State>;
15
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.42.2",
3
+ "version": "0.42.3",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -88,8 +88,8 @@
88
88
  "downshift": "9.0.8",
89
89
  "react-aria": "^3.34.1",
90
90
  "@equinor/eds-icons": "^0.21.0",
91
- "@equinor/eds-utils": "0.8.5",
92
- "@equinor/eds-tokens": "0.9.2"
91
+ "@equinor/eds-tokens": "0.9.2",
92
+ "@equinor/eds-utils": "0.8.5"
93
93
  },
94
94
  "scripts": {
95
95
  "build": "rollup -c --bundleConfigAsCjs && tsc -p tsconfig.build.json",