@synerise/ds-popover 1.1.0 → 1.1.2

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.
package/CHANGELOG.md CHANGED
@@ -3,9 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # 1.1.0 (2025-11-06)
6
+ ## [1.1.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-popover@1.1.1...@synerise/ds-popover@1.1.2) (2025-12-15)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-popover
9
+
10
+ ## [1.1.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-popover@1.1.0...@synerise/ds-popover@1.1.1) (2025-11-13)
7
11
 
12
+ ### Bug Fixes
13
+
14
+ - **date-picker:** dropdown state ([e16e4ce](https://github.com/Synerise/synerise-design/commit/e16e4ce8374c374512d0dc59a2361000ab89c8b9))
15
+
16
+ # 1.1.0 (2025-11-06)
8
17
 
9
18
  ### Features
10
19
 
11
- * **dropdown:** dropdownMenu component ([f0ec827](https://github.com/Synerise/synerise-design/commit/f0ec82792cdcb021fa9a454912f6e7a892e53895))
20
+ - **dropdown:** dropdownMenu component ([f0ec827](https://github.com/Synerise/synerise-design/commit/f0ec82792cdcb021fa9a454912f6e7a892e53895))
@@ -1,5 +1,5 @@
1
- import { type ReactNode } from 'react';
2
- import { type AutoUpdateOptions, type FlipOptions, type OffsetOptions, type OpenChangeReason, type Placement, type ShiftOptions, type UseDismissProps, type UseListNavigationProps, type UseTransitionStylesProps } from '@floating-ui/react';
1
+ import { type CSSProperties, type Dispatch, type ReactNode, type SetStateAction } from 'react';
2
+ import { type AutoUpdateOptions, type FlipOptions, type OffsetOptions, type OpenChangeReason, type Placement, type ShiftOptions, type UseDismissProps, type UseFloatingReturn, type UseInteractionsReturn, type UseListNavigationProps, type UseTransitionStylesProps } from '@floating-ui/react';
3
3
  export type PopoverProps = {
4
4
  children: ReactNode;
5
5
  } & PopoverOptions;
@@ -18,6 +18,11 @@ export type PopoverOptions = {
18
18
  componentId?: string;
19
19
  autoUpdate?: boolean | AutoUpdateOptions;
20
20
  open?: boolean;
21
+ /**
22
+ * @default true
23
+ * set to false in order to prevent returning focus to the trigger element after popover closes
24
+ */
25
+ returnFocus?: boolean;
21
26
  offsetConfig?: OffsetConfig;
22
27
  flipConfig?: FlipConfig;
23
28
  shiftConfig?: ShiftConfig;
@@ -28,7 +33,7 @@ export type PopoverOptions = {
28
33
  * defaults to theme.variables['zindex-dropdown'],
29
34
  */
30
35
  zIndex?: number;
31
- onOpenChange?: (open: boolean, event?: Event, reason?: OpenChangeReason) => void;
36
+ onOpenChange?: OpenChangeFn;
32
37
  onDismiss?: (event?: Event, reason?: OpenChangeReason) => void;
33
38
  getPopupContainer?: (element: HTMLElement) => HTMLElement;
34
39
  transitionDuration?: number;
@@ -36,4 +41,20 @@ export type PopoverOptions = {
36
41
  placement: Placement;
37
42
  }) => Partial<UseTransitionStylesProps>;
38
43
  };
44
+ type OpenChangeFn = (open: boolean, event?: Event, reason?: OpenChangeReason) => void;
45
+ export type UsePopoverReturn = Omit<UseFloatingReturn, 'open'> & UseInteractionsReturn & {
46
+ open: boolean;
47
+ setOpen: OpenChangeFn;
48
+ transitionStyles: CSSProperties | undefined;
49
+ modal: boolean | undefined;
50
+ labelId: string | undefined;
51
+ descriptionId: string | undefined;
52
+ setLabelId: Dispatch<SetStateAction<string | undefined>>;
53
+ setDescriptionId: Dispatch<SetStateAction<string | undefined>>;
54
+ getPopupContainer?: (element: HTMLElement) => HTMLElement;
55
+ testId: string;
56
+ zIndex?: number;
57
+ returnFocus?: boolean;
58
+ componentId?: string;
59
+ };
39
60
  export {};
@@ -20,6 +20,8 @@ export var PopoverContent = /*#__PURE__*/forwardRef(function PopoverContent(_ref
20
20
  descriptionId = _usePopoverContext.descriptionId,
21
21
  transitionStyles = _usePopoverContext.transitionStyles,
22
22
  componentId = _usePopoverContext.componentId,
23
+ _usePopoverContext$re = _usePopoverContext.returnFocus,
24
+ returnFocus = _usePopoverContext$re === void 0 ? true : _usePopoverContext$re,
23
25
  zIndex = _usePopoverContext.zIndex;
24
26
  var theme = useTheme();
25
27
  var _useState = useState(false),
@@ -55,7 +57,8 @@ export var PopoverContent = /*#__PURE__*/forwardRef(function PopoverContent(_ref
55
57
  }, /*#__PURE__*/React.createElement(FloatingFocusManager, {
56
58
  initialFocus: -1,
57
59
  context: floatingContext,
58
- modal: modal
60
+ modal: modal,
61
+ returnFocus: returnFocus
59
62
  }, /*#__PURE__*/React.createElement("div", _extends({}, dataProps, {
60
63
  ref: ref,
61
64
  style: _extends({}, floatingStyles, style, {
@@ -1,6 +1,6 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
- import { type usePopover } from '../hooks';
3
- export type ContextType = (ReturnType<typeof usePopover> & {
2
+ import { type UsePopoverReturn } from '../Popover.types';
3
+ export type ContextType = (UsePopoverReturn & {
4
4
  setLabelId: Dispatch<SetStateAction<string | undefined>>;
5
5
  setDescriptionId: Dispatch<SetStateAction<string | undefined>>;
6
6
  }) | null;
@@ -19,6 +19,6 @@ export declare const useListNavigationConfig: (listNavigationConfig?: UseListNav
19
19
  cols?: number;
20
20
  scrollItemIntoView?: boolean | ScrollIntoViewOptions;
21
21
  virtualItemRef?: React.MutableRefObject<HTMLElement | null>;
22
- itemSizes?: import("@floating-ui/utils").Dimensions[];
22
+ itemSizes?: import("@floating-ui/react").Dimensions[];
23
23
  dense?: boolean;
24
24
  };
@@ -1,58 +1,2 @@
1
- import { type OpenChangeReason } from '@floating-ui/react';
2
- import { type PopoverOptions } from '../Popover.types';
3
- export declare const usePopover: ({ initialOpen, placement, modal, trigger, open: controlledOpen, onOpenChange: setControlledOpen, onDismiss, transitionDuration, getPopupContainer, autoUpdate: autoUpdateWhileMounted, dismissConfig, offsetConfig, flipConfig, shiftConfig, testId, componentId, listNavigationConfig, getTransitionConfig, zIndex, }?: PopoverOptions) => {
4
- modal: boolean | undefined;
5
- labelId: string | undefined;
6
- getPopupContainer: ((element: HTMLElement) => HTMLElement) | undefined;
7
- descriptionId: string | undefined;
8
- setLabelId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
9
- setDescriptionId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
10
- testId: string;
11
- zIndex: number | undefined;
12
- componentId: string | undefined;
13
- placement: import("@floating-ui/utils").Placement;
14
- strategy: import("@floating-ui/utils").Strategy;
15
- middlewareData: import("@floating-ui/core").MiddlewareData;
16
- x: number;
17
- y: number;
18
- isPositioned: boolean;
19
- update: () => void;
20
- floatingStyles: React.CSSProperties;
21
- refs: {
22
- reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
23
- floating: React.MutableRefObject<HTMLElement | null>;
24
- setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
25
- setFloating: (node: HTMLElement | null) => void;
26
- } & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
27
- elements: {
28
- reference: import("@floating-ui/react-dom").ReferenceType | null;
29
- floating: HTMLElement | null;
30
- } & import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
31
- context: {
32
- x: number;
33
- y: number;
34
- placement: import("@floating-ui/utils").Placement;
35
- strategy: import("@floating-ui/utils").Strategy;
36
- middlewareData: import("@floating-ui/core").MiddlewareData;
37
- isPositioned: boolean;
38
- update: () => void;
39
- floatingStyles: React.CSSProperties;
40
- open: boolean;
41
- onOpenChange: (open: boolean, event?: Event, reason?: OpenChangeReason) => void;
42
- events: import("@floating-ui/react").FloatingEvents;
43
- dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
44
- nodeId: string | undefined;
45
- floatingId: string | undefined;
46
- refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
47
- elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
48
- };
49
- getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
50
- getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
51
- getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
52
- active?: boolean;
53
- selected?: boolean;
54
- }) => Record<string, unknown>;
55
- open: boolean;
56
- setOpen: (open: boolean, event?: Event, reason?: OpenChangeReason) => void;
57
- transitionStyles: import("react").CSSProperties | undefined;
58
- };
1
+ import { type PopoverOptions, type UsePopoverReturn } from '../Popover.types';
2
+ export declare const usePopover: ({ initialOpen, placement, modal, trigger, open: controlledOpen, onOpenChange: setControlledOpen, onDismiss, transitionDuration, getPopupContainer, autoUpdate: autoUpdateWhileMounted, dismissConfig, offsetConfig, flipConfig, shiftConfig, testId, componentId, returnFocus, listNavigationConfig, getTransitionConfig, zIndex, }?: PopoverOptions) => UsePopoverReturn;
@@ -30,6 +30,7 @@ export var usePopover = function usePopover(_temp) {
30
30
  _ref$testId = _ref.testId,
31
31
  testId = _ref$testId === void 0 ? 'noTestId' : _ref$testId,
32
32
  componentId = _ref.componentId,
33
+ returnFocus = _ref.returnFocus,
33
34
  listNavigationConfig = _ref.listNavigationConfig,
34
35
  _ref$getTransitionCon = _ref.getTransitionConfig,
35
36
  getTransitionConfig = _ref$getTransitionCon === void 0 ? getDefaultTransitionConfig : _ref$getTransitionCon,
@@ -111,7 +112,8 @@ export var usePopover = function usePopover(_temp) {
111
112
  setDescriptionId: setDescriptionId,
112
113
  testId: testId,
113
114
  zIndex: zIndex,
115
+ returnFocus: returnFocus,
114
116
  componentId: componentId
115
117
  });
116
- }, [getPopupContainer, isMounted, setOpen, transitionDuration, styles, interactions, data, modal, labelId, descriptionId, zIndex, testId, componentId]);
118
+ }, [getPopupContainer, isMounted, setOpen, transitionDuration, styles, interactions, data, modal, labelId, descriptionId, zIndex, testId, returnFocus, componentId]);
117
119
  };
@@ -1,59 +1,2 @@
1
- export declare const usePopoverContext: () => {
2
- modal: boolean | undefined;
3
- labelId: string | undefined;
4
- getPopupContainer: ((element: HTMLElement) => HTMLElement) | undefined;
5
- descriptionId: string | undefined;
6
- setLabelId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
7
- setDescriptionId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
8
- testId: string;
9
- zIndex: number | undefined;
10
- componentId: string | undefined;
11
- placement: import("@floating-ui/utils").Placement;
12
- strategy: import("@floating-ui/utils").Strategy;
13
- middlewareData: import("@floating-ui/core").MiddlewareData;
14
- x: number;
15
- y: number;
16
- isPositioned: boolean;
17
- update: () => void;
18
- floatingStyles: React.CSSProperties;
19
- refs: {
20
- reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
21
- floating: React.MutableRefObject<HTMLElement | null>;
22
- setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
23
- setFloating: (node: HTMLElement | null) => void;
24
- } & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
25
- elements: {
26
- reference: import("@floating-ui/react-dom").ReferenceType | null;
27
- floating: HTMLElement | null;
28
- } & import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
29
- context: {
30
- x: number;
31
- y: number;
32
- placement: import("@floating-ui/utils").Placement;
33
- strategy: import("@floating-ui/utils").Strategy;
34
- middlewareData: import("@floating-ui/core").MiddlewareData;
35
- isPositioned: boolean;
36
- update: () => void;
37
- floatingStyles: React.CSSProperties;
38
- open: boolean;
39
- onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
40
- events: import("@floating-ui/react").FloatingEvents;
41
- dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
42
- nodeId: string | undefined;
43
- floatingId: string | undefined;
44
- refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
45
- elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
46
- };
47
- getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
48
- getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
49
- getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
50
- active?: boolean;
51
- selected?: boolean;
52
- }) => Record<string, unknown>;
53
- open: boolean;
54
- setOpen: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
55
- transitionStyles: import("react").CSSProperties | undefined;
56
- } & {
57
- setLabelId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
58
- setDescriptionId: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
59
- };
1
+ import { type ContextType } from '../contexts';
2
+ export declare const usePopoverContext: () => Exclude<ContextType, null>;
@@ -7,6 +7,6 @@ type GetMiddleware = {
7
7
  export declare const getMiddleware: ({ offsetConfig, flipConfig, shiftConfig, }: GetMiddleware) => {
8
8
  name: string;
9
9
  options?: any;
10
- fn: (state: import("@floating-ui/dom").MiddlewareState) => import("@floating-ui/core").MiddlewareReturn | Promise<import("@floating-ui/core").MiddlewareReturn>;
10
+ fn: (state: import("@floating-ui/react").MiddlewareState) => import("@floating-ui/react").MiddlewareReturn | Promise<import("@floating-ui/react").MiddlewareReturn>;
11
11
  }[];
12
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-popover",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Popover UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@floating-ui/react": "^0.27.13"
37
+ "@floating-ui/react": "^0.27.16"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@testing-library/user-event": "^14"
@@ -43,5 +43,5 @@
43
43
  "@synerise/ds-core": "*",
44
44
  "react": ">=16.9.0 <= 18.3.1"
45
45
  },
46
- "gitHead": "cbbb7d9f155735bcc4035d8fd8a7813878d6e051"
46
+ "gitHead": "b1279d5354132a2bf0b6f0cfa343db4c6c928f72"
47
47
  }