@westpac/ui 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.
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import React, { useContext } from 'react';
2
+ import React, { useContext, useMemo } from 'react';
3
3
  import { DismissButton, mergeProps, Overlay, usePopover } from 'react-aria';
4
4
  import { MultiSelectContext } from '../../multi-select.component.js';
5
5
  import { styles as popoverStyles } from './multi-select-popover.styles.js';
@@ -16,11 +16,16 @@ export function MultiSelectPopover({ children, className, ...props }) {
16
16
  shouldCloseOnInteractOutside: ()=>false,
17
17
  offset: 6
18
18
  }, overlayState);
19
+ const brandContainer = useMemo(()=>{
20
+ if (typeof window !== 'undefined') {
21
+ return document.querySelector('[data-theme]') || document.querySelector('[class^="theme-"], [class*=" theme-"]') || document.body;
22
+ }
23
+ }, []);
19
24
  const width = (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.getBoundingClientRect().width;
20
25
  const styles = popoverStyles();
21
26
  return React.createElement(Overlay, {
22
27
  disableFocusManagement: true,
23
- portalContainer: portalContainer
28
+ portalContainer: portalContainer || brandContainer
24
29
  }, React.createElement("div", {
25
30
  ...mergeProps(popoverProps, overlayProps),
26
31
  ref: popoverRef,
@@ -181,6 +181,9 @@
181
181
  .relative {
182
182
  position: relative;
183
183
  }
184
+ .static {
185
+ position: static;
186
+ }
184
187
  .sticky {
185
188
  position: sticky;
186
189
  }
@@ -181,6 +181,9 @@
181
181
  .relative {
182
182
  position: relative;
183
183
  }
184
+ .static {
185
+ position: static;
186
+ }
184
187
  .sticky {
185
188
  position: sticky;
186
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westpac/ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -254,7 +254,7 @@
254
254
  "vite": "^7.1.12",
255
255
  "vitest": "^3.2.4",
256
256
  "@westpac/eslint-config": "~1.1.0",
257
- "@westpac/style-config": "~1.0.0",
257
+ "@westpac/style-config": "~1.0.1",
258
258
  "@westpac/ts-config": "~0.0.0",
259
259
  "@westpac/test-config": "~0.0.0"
260
260
  },
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { useContext } from 'react';
3
+ import React, { useContext, useMemo } from 'react';
4
4
  import { DismissButton, mergeProps, Overlay, usePopover } from 'react-aria';
5
5
 
6
6
  import { MultiSelectContext } from '../../multi-select.component.js';
@@ -27,11 +27,22 @@ export function MultiSelectPopover({ children, className, ...props }: MultiSelec
27
27
  overlayState,
28
28
  );
29
29
 
30
+ // This is required so branding applies correctly by default due to portal location, can be overridden with portalContainer prop
31
+ const brandContainer = useMemo(() => {
32
+ if (typeof window !== 'undefined') {
33
+ return (
34
+ document.querySelector('[data-theme]') ||
35
+ document.querySelector('[class^="theme-"], [class*=" theme-"]') ||
36
+ document.body
37
+ );
38
+ }
39
+ }, []);
40
+
30
41
  const width = buttonRef.current?.getBoundingClientRect().width;
31
42
  const styles = popoverStyles();
32
43
 
33
44
  return (
34
- <Overlay disableFocusManagement portalContainer={portalContainer}>
45
+ <Overlay disableFocusManagement portalContainer={portalContainer || brandContainer}>
35
46
  <div
36
47
  {...mergeProps(popoverProps, overlayProps)}
37
48
  ref={popoverRef}