@indico-data/design-system 2.32.1 → 2.33.1

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.
@@ -1,2 +1,2 @@
1
1
  import { FloatUIProps } from './types';
2
- export declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, floatingOptions, }: FloatUIProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, }: FloatUIProps): import("react/jsx-runtime").JSX.Element;
@@ -6,5 +6,8 @@ export type FloatUIProps = {
6
6
  floatingOptions?: UseFloatingOptions;
7
7
  isOpen?: boolean;
8
8
  isPortal?: boolean;
9
+ portalOptions?: {
10
+ rootId?: string;
11
+ };
9
12
  setIsOpen?: React.Dispatch<React.SetStateAction<boolean>>;
10
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "2.32.1",
3
+ "version": "2.33.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -40,10 +40,6 @@
40
40
  .btn--icon-only {
41
41
  padding-left: var(--pf-padding-2);
42
42
  padding-right: var(--pf-padding-2);
43
-
44
- &.btn--md {
45
- height: 32px;
46
- }
47
43
  }
48
44
 
49
45
  @mixin button-variant($color-name) {
@@ -63,6 +63,17 @@ const meta: Meta<typeof FloatUI> = {
63
63
  },
64
64
  },
65
65
  },
66
+ portalOptions: {
67
+ control: 'object',
68
+ description:
69
+ 'Options for configuring the portal behavior. Includes the rootId, which is the id of the root element to render the portal into.',
70
+ table: {
71
+ category: 'Props',
72
+ type: {
73
+ summary: 'PortalOptions',
74
+ },
75
+ },
76
+ },
66
77
  setIsOpen: {
67
78
  control: false,
68
79
  description: 'Function to toggle the visibility of the FloatUI (for controlled mode).',
@@ -22,6 +22,7 @@ export function FloatUI({
22
22
  isOpen: controlledIsOpen,
23
23
  setIsOpen: controlledSetIsOpen,
24
24
  isPortal = false,
25
+ portalOptions = {},
25
26
  floatingOptions = defaultOptions,
26
27
  }: FloatUIProps) {
27
28
  const [internalIsOpen, setInternalIsOpen] = useState(false);
@@ -80,7 +81,12 @@ export function FloatUI({
80
81
  <div ref={referenceElementRef} onClick={() => setIsOpen(!isOpen)}>
81
82
  {trigger}
82
83
  </div>
83
- {isOpen && (isPortal ? <FloatingPortal>{tooltipContent}</FloatingPortal> : tooltipContent)}
84
+ {isOpen &&
85
+ (isPortal ? (
86
+ <FloatingPortal id={portalOptions?.rootId}>{tooltipContent}</FloatingPortal>
87
+ ) : (
88
+ tooltipContent
89
+ ))}
84
90
  </>
85
91
  );
86
92
  }
@@ -7,5 +7,8 @@ export type FloatUIProps = {
7
7
  floatingOptions?: UseFloatingOptions;
8
8
  isOpen?: boolean;
9
9
  isPortal?: boolean;
10
+ portalOptions?: {
11
+ rootId?: string;
12
+ };
10
13
  setIsOpen?: React.Dispatch<React.SetStateAction<boolean>>;
11
14
  };