@westpac/ui 0.17.0 → 0.19.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/component-type.json +1 -1
  3. package/dist/components/accordion/accordion.component.d.ts +2 -1
  4. package/dist/components/autocomplete/autocomplete.component.js +4 -2
  5. package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.d.ts +1 -1
  6. package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.js +1 -1
  7. package/dist/components/autocomplete/components/autocomplete-popover/autocomplete-popover.component.js +9 -3
  8. package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.js +2 -2
  9. package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.js +7 -2
  10. package/dist/components/button-group/button-group.component.js +58 -11
  11. package/dist/components/button-group/button-group.types.d.ts +9 -1
  12. package/dist/components/button-group/components/button-group-button/button-group-button.component.js +1 -2
  13. package/dist/components/checkbox-group/checkbox-group.component.js +61 -10
  14. package/dist/components/checkbox-group/checkbox-group.types.d.ts +5 -1
  15. package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.js +1 -2
  16. package/dist/components/date-picker/date-picker.types.d.ts +1 -0
  17. package/dist/components/error-message/error-message.types.d.ts +3 -2
  18. package/dist/components/list/components/list-item/list-item.component.d.ts +1 -1
  19. package/dist/components/list/list.utils.d.ts +1 -1
  20. package/dist/components/modal/components/modal-backdrop/modal-backdrop.component.js +8 -2
  21. package/dist/components/modal/components/modal-dialog/modal-dialog.styles.js +2 -2
  22. package/dist/components/popover/components/panel/panel.component.js +7 -2
  23. package/dist/components/popover/components/panel/panel.styles.js +2 -2
  24. package/dist/components/popover/popover.hooks.js +1 -1
  25. package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.js +1 -2
  26. package/dist/components/radio-group/radio-group.component.js +58 -11
  27. package/dist/components/radio-group/radio-group.types.d.ts +5 -1
  28. package/dist/components/selector/components/selector-button-group/selector-button-group.component.js +9 -7
  29. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +50 -1
  30. package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.js +1 -1
  31. package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +58 -11
  32. package/dist/components/selector/components/selector-radio-group/selector-radio-group.types.d.ts +5 -1
  33. package/dist/components/tabs/components/tabs-tab/tabs-tab.component.js +1 -1
  34. package/dist/components/tabs/tabs.component.d.ts +6 -2
  35. package/dist/components/tabs/tabs.component.js +7 -1
  36. package/dist/constants/message.d.ts +1 -0
  37. package/dist/constants/message.js +1 -0
  38. package/package.json +8 -8
  39. package/src/components/accordion/accordion.component.tsx +3 -3
  40. package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +2 -2
  41. package/src/components/autocomplete/autocomplete.component.tsx +5 -1
  42. package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.tsx +1 -1
  43. package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.ts +1 -1
  44. package/src/components/autocomplete/components/autocomplete-popover/autocomplete-popover.component.tsx +14 -3
  45. package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.ts +2 -2
  46. package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.tsx +11 -2
  47. package/src/components/button-group/button-group.component.tsx +58 -11
  48. package/src/components/button-group/button-group.types.ts +9 -2
  49. package/src/components/button-group/components/button-group-button/button-group-button.component.tsx +1 -2
  50. package/src/components/checkbox-group/checkbox-group.component.tsx +62 -10
  51. package/src/components/checkbox-group/checkbox-group.types.ts +5 -1
  52. package/src/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.tsx +1 -2
  53. package/src/components/date-picker/date-picker.types.ts +4 -0
  54. package/src/components/error-message/error-message.component.tsx +2 -2
  55. package/src/components/error-message/error-message.types.ts +2 -1
  56. package/src/components/modal/components/modal-backdrop/modal-backdrop.component.tsx +13 -2
  57. package/src/components/modal/components/modal-dialog/modal-dialog.styles.ts +2 -2
  58. package/src/components/pagination/pagination.component.tsx +6 -6
  59. package/src/components/popover/components/panel/panel.component.tsx +7 -2
  60. package/src/components/popover/components/panel/panel.styles.ts +2 -2
  61. package/src/components/popover/popover.hooks.tsx +5 -2
  62. package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx +1 -2
  63. package/src/components/radio-group/radio-group.component.tsx +57 -13
  64. package/src/components/radio-group/radio-group.types.ts +5 -1
  65. package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx +10 -7
  66. package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +49 -0
  67. package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.tsx +1 -1
  68. package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +58 -11
  69. package/src/components/selector/components/selector-radio-group/selector-radio-group.types.ts +5 -1
  70. package/src/components/tabs/components/tabs-tab/tabs-tab.component.tsx +1 -1
  71. package/src/components/tabs/tabs.component.tsx +26 -5
  72. package/src/constants/message.ts +1 -0
  73. package/src/tailwind/utils/create-font-sizes.ts +11 -8
  74. package/src/tailwind/utils/generate-font-components.ts +18 -15
  75. package/src/tailwind/utils/generate-form-control.ts +11 -8
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ItemProps } from 'react-stately';
2
3
  import { type AccordionProps } from './accordion.types.js';
3
4
  declare function Accordion<T extends object>({ className, rounded, look, ...props }: AccordionProps<T>, ref: any): import("react/jsx-runtime").JSX.Element;
4
5
  declare const _Accordion: {
@@ -16,4 +17,4 @@ declare const _Accordion: {
16
17
  ref?: any;
17
18
  }) => ReturnType<typeof Accordion>);
18
19
  export { _Accordion as Accordion };
19
- export declare const AccordionItem: <T>(props: import("react-stately").ItemProps<T>) => JSX.Element;
20
+ export declare const AccordionItem: <T>(props: ItemProps<T>) => JSX.Element;
@@ -109,10 +109,12 @@ export function Autocomplete({ size ='medium' , invalid =false , isDisabled , fo
109
109
  }, React.createElement("div", {
110
110
  className: styles.iconWrapper()
111
111
  }, loadingState ? React.createElement(ProgressIndicator, {
112
- size: iconSize
112
+ size: iconSize,
113
+ color: "muted"
113
114
  }) : React.createElement(SearchIcon, {
114
115
  "aria-hidden": true,
115
- size: iconSize
116
+ size: iconSize,
117
+ color: "muted"
116
118
  })), React.createElement("input", _extends({}, mergeProps(inputProps, inputFocusProps), {
117
119
  ref: inputRef,
118
120
  className: styles.input(),
@@ -8,7 +8,7 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
8
8
  isDisabled: {
9
9
  true: string;
10
10
  };
11
- }, undefined, "flex cursor-pointer items-center justify-between border-t border-t-border bg-white p-2 px-3 text-sm transition-colors first:border-t-0 hover:bg-hero hover:text-white focus:bg-hero focus:text-white", {
11
+ }, undefined, "flex cursor-pointer items-center justify-between border-t border-t-border bg-white p-2 px-3 text-sm text-text transition-colors first:border-t-0 hover:bg-hero hover:text-white focus:bg-hero focus:text-white", {
12
12
  responsiveVariants: string[];
13
13
  }, {
14
14
  isFocused: {
@@ -1,6 +1,6 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
- base: 'flex cursor-pointer items-center justify-between border-t border-t-border bg-white p-2 px-3 text-sm transition-colors first:border-t-0 hover:bg-hero hover:text-white focus:bg-hero focus:text-white',
3
+ base: 'flex cursor-pointer items-center justify-between border-t border-t-border bg-white p-2 px-3 text-sm text-text transition-colors first:border-t-0 hover:bg-hero hover:text-white focus:bg-hero focus:text-white',
4
4
  variants: {
5
5
  isFocused: {
6
6
  true: 'bg-hero !text-white'
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  function _extends() {
2
3
  _extends = Object.assign || function(target) {
3
4
  for(var i = 1; i < arguments.length; i++){
@@ -13,19 +14,24 @@ function _extends() {
13
14
  return _extends.apply(this, arguments);
14
15
  }
15
16
  import { clsx } from 'clsx';
16
- import * as React from 'react';
17
+ import React, { useMemo, useRef } from 'react';
17
18
  import { DismissButton, Overlay, usePopover } from 'react-aria';
18
19
  export function AutocompletePopover(props) {
19
20
  var _props_triggerRef_current;
20
- const ref = React.useRef(null);
21
+ const ref = useRef(null);
21
22
  const { popoverRef =ref , state , children , className , isNonModal , portalContainer } = props;
22
23
  const { popoverProps , underlayProps } = usePopover({
23
24
  ...props,
24
25
  popoverRef
25
26
  }, state);
27
+ const brandContainer = useMemo(()=>{
28
+ if (typeof window !== 'undefined') {
29
+ return document.querySelector('[data-theme]') || document.querySelector('[className="data-theme"]') || document.body;
30
+ }
31
+ }, []);
26
32
  const width = (_props_triggerRef_current = props.triggerRef.current) === null || _props_triggerRef_current === void 0 ? void 0 : _props_triggerRef_current.getBoundingClientRect().width;
27
33
  return React.createElement(Overlay, {
28
- portalContainer: portalContainer
34
+ portalContainer: portalContainer || brandContainer
29
35
  }, !isNonModal && React.createElement("div", _extends({}, underlayProps, {
30
36
  className: "fixed inset-0"
31
37
  })), React.createElement("div", _extends({}, popoverProps, {
@@ -2,8 +2,8 @@ import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
3
  slots: {
4
4
  base: 'flex max-h-screen max-w-full flex-1 flex-col overflow-hidden rounded-t-md bg-white shadow-sm md:w-[37.5rem] md:rounded-md',
5
- title: 'typography-body-7 p-7 pb-4 pt-9 font-bold max-md:px-5',
6
- body: 'flex-1 overflow-auto px-7 pb-7 max-md:px-5',
5
+ title: 'typography-body-7 p-7 pb-4 pt-9 font-bold text-text max-md:px-5',
6
+ body: 'flex-1 overflow-auto px-7 pb-7 text-text max-md:px-5',
7
7
  closeBtn: 'absolute right-3 top-3 p-0',
8
8
  buttonWrapper: '-mt-2 flex gap-1 px-7 pb-7 max-md:flex-col max-md:px-5 max-md:pb-5',
9
9
  primaryBtn: '',
@@ -13,7 +13,7 @@ function _extends() {
13
13
  return _extends.apply(this, arguments);
14
14
  }
15
15
  import { motion, useAnimation } from 'framer-motion';
16
- import React, { useCallback, useEffect, useRef, useState } from 'react';
16
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
17
17
  import { Overlay, useModalOverlay } from 'react-aria';
18
18
  import { BREAKPOINTS } from '../../../../tailwind/constants/index.js';
19
19
  import { styles as bottomSheetModalStyles } from './bottom-sheet-modal.styles.js';
@@ -32,6 +32,11 @@ export function BottomSheetModal({ state , height , width , children , portalCon
32
32
  const { modalProps , underlayProps } = useModalOverlay(props, state, ref);
33
33
  const controls = useAnimation();
34
34
  const [isMobile, setIsMobile] = useState(checkIfItIsMobile(MEDIUM_BREAKPOINT_AS_NUMBER));
35
+ const brandContainer = useMemo(()=>{
36
+ if (isBrowser) {
37
+ return document.querySelector('[data-theme]') || document.querySelector('[className="data-theme"]') || document.body;
38
+ }
39
+ }, []);
35
40
  useEffect(()=>{
36
41
  function handleResize() {
37
42
  setIsMobile(checkIfItIsMobile(MEDIUM_BREAKPOINT_AS_NUMBER));
@@ -64,7 +69,7 @@ export function BottomSheetModal({ state , height , width , children , portalCon
64
69
  return null;
65
70
  }
66
71
  return React.createElement(Overlay, {
67
- portalContainer: portalContainer
72
+ portalContainer: portalContainer || brandContainer
68
73
  }, React.createElement("div", _extends({
69
74
  className: styles.underlay()
70
75
  }, underlayProps), React.createElement(motion.div, {
@@ -16,21 +16,68 @@ function _extends() {
16
16
  import React, { createContext } from 'react';
17
17
  import { useRadioGroup } from 'react-aria';
18
18
  import { useRadioGroupState } from 'react-stately';
19
+ import { FUNCTION_NOT_IMPLEMENTED } from '../../constants/message.js';
19
20
  import { ButtonGroupButton, ErrorMessage, Hint, Label } from '../index.js';
20
21
  import { styles as buttonGroupStyles } from './button-group.styles.js';
21
22
  export const ButtonGroupContext = createContext({
22
- name: '',
23
- isDisabled: false,
24
- isReadOnly: false,
25
- isRequired: false,
26
- validationState: null,
27
- selectedValue: null,
28
- setSelectedValue: ()=>null,
29
- lastFocusedValue: null,
30
- setLastFocusedValue: ()=>null,
31
23
  block: false,
32
24
  look: 'hero',
33
- size: 'medium'
25
+ size: 'medium',
26
+ state: {
27
+ name: '',
28
+ isDisabled: false,
29
+ isReadOnly: false,
30
+ isRequired: false,
31
+ validationState: null,
32
+ selectedValue: null,
33
+ setSelectedValue: ()=>null,
34
+ lastFocusedValue: null,
35
+ setLastFocusedValue: ()=>null,
36
+ isInvalid: false,
37
+ realtimeValidation: {
38
+ isInvalid: false,
39
+ validationErrors: [],
40
+ validationDetails: {
41
+ badInput: false,
42
+ customError: false,
43
+ patternMismatch: false,
44
+ rangeOverflow: false,
45
+ rangeUnderflow: false,
46
+ stepMismatch: false,
47
+ tooLong: false,
48
+ tooShort: false,
49
+ typeMismatch: false,
50
+ valid: false,
51
+ valueMissing: false
52
+ }
53
+ },
54
+ displayValidation: {
55
+ isInvalid: false,
56
+ validationErrors: [],
57
+ validationDetails: {
58
+ badInput: false,
59
+ customError: false,
60
+ patternMismatch: false,
61
+ rangeOverflow: false,
62
+ rangeUnderflow: false,
63
+ stepMismatch: false,
64
+ tooLong: false,
65
+ tooShort: false,
66
+ typeMismatch: false,
67
+ valid: false,
68
+ valueMissing: false
69
+ }
70
+ },
71
+ updateValidation: function() {
72
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
73
+ },
74
+ resetValidation: function() {
75
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
76
+ },
77
+ commitValidation: function() {
78
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
79
+ }
80
+ }
34
81
  });
35
82
  export function ButtonGroup({ className , buttons , label , look ='hero' , size ='medium' , block =false , errorMessage , hintMessage , ...props }) {
36
83
  const state = useRadioGroupState({
@@ -55,7 +102,7 @@ export function ButtonGroup({ className , buttons , label , look ='hero' , size
55
102
  className: styles.buttonWrapper()
56
103
  }, React.createElement(ButtonGroupContext.Provider, {
57
104
  value: {
58
- ...state,
105
+ state,
59
106
  size,
60
107
  look,
61
108
  block
@@ -40,5 +40,13 @@ export type ButtonGroupContextState = {
40
40
  * Controls look of `Button` components, can't be applied directly to `Button`
41
41
  */
42
42
  look?: 'hero' | 'primary';
43
- } & RadioGroupState & Pick<ButtonProps, 'size'>;
43
+ /**
44
+ * Controls look of `Button` components, can't be applied directly to `Button`
45
+ */
46
+ size: ButtonProps['size'];
47
+ /**
48
+ * Radio group state
49
+ */
50
+ state: RadioGroupState;
51
+ };
44
52
  export {};
@@ -19,8 +19,7 @@ import { Button as GELButton } from '../../../button/index.js';
19
19
  import { ButtonGroupContext } from '../../button-group.component.js';
20
20
  import { styles as buttonStyles } from './button-group-button.styles.js';
21
21
  export function ButtonGroupButton({ className , label , ...props }) {
22
- const state = useContext(ButtonGroupContext);
23
- const { size , look , block } = state;
22
+ const { state , size , look , block } = useContext(ButtonGroupContext);
24
23
  const ref = useRef(null);
25
24
  const { inputProps , isSelected , isDisabled } = useRadio({
26
25
  ...props,
@@ -16,6 +16,7 @@ function _extends() {
16
16
  import React, { createContext, useEffect, useId, useMemo, useRef, useState } from 'react';
17
17
  import { useCheckboxGroup, useFocusRing } from 'react-aria';
18
18
  import { useCheckboxGroupState } from 'react-stately';
19
+ import { FUNCTION_NOT_IMPLEMENTED } from '../../constants/message.js';
19
20
  import { Button } from '../button/index.js';
20
21
  import { ExpandMoreIcon } from '../icon/index.js';
21
22
  import { CheckboxGroupCheckbox, ErrorMessage, Hint, Label } from '../index.js';
@@ -23,15 +24,65 @@ import { styles as checkboxStyles } from './checkbox-group.styles.js';
23
24
  export const CheckboxGroupContext = createContext({
24
25
  orientation: 'vertical',
25
26
  size: 'medium',
26
- value: [],
27
- isDisabled: false,
28
- isReadOnly: false,
29
- isSelected: ()=>false,
30
- setValue: ()=>null,
31
- addValue: ()=>null,
32
- removeValue: ()=>null,
33
- toggleValue: ()=>null,
34
- validationState: 'valid'
27
+ state: {
28
+ value: [],
29
+ isDisabled: false,
30
+ isReadOnly: false,
31
+ isSelected: ()=>false,
32
+ setValue: ()=>null,
33
+ addValue: ()=>null,
34
+ removeValue: ()=>null,
35
+ toggleValue: ()=>null,
36
+ validationState: 'valid',
37
+ isInvalid: false,
38
+ isRequired: false,
39
+ setInvalid: ()=>function() {
40
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
41
+ },
42
+ realtimeValidation: {
43
+ isInvalid: false,
44
+ validationErrors: [],
45
+ validationDetails: {
46
+ badInput: false,
47
+ customError: false,
48
+ patternMismatch: false,
49
+ rangeOverflow: false,
50
+ rangeUnderflow: false,
51
+ stepMismatch: false,
52
+ tooLong: false,
53
+ tooShort: false,
54
+ typeMismatch: false,
55
+ valid: false,
56
+ valueMissing: false
57
+ }
58
+ },
59
+ displayValidation: {
60
+ isInvalid: false,
61
+ validationErrors: [],
62
+ validationDetails: {
63
+ badInput: false,
64
+ customError: false,
65
+ patternMismatch: false,
66
+ rangeOverflow: false,
67
+ rangeUnderflow: false,
68
+ stepMismatch: false,
69
+ tooLong: false,
70
+ tooShort: false,
71
+ typeMismatch: false,
72
+ valid: false,
73
+ valueMissing: false
74
+ }
75
+ },
76
+ updateValidation: function() {
77
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
78
+ },
79
+ resetValidation: function() {
80
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
81
+ },
82
+ commitValidation: function() {
83
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
84
+ }
85
+ }
35
86
  });
36
87
  export function CheckboxGroup({ className , checkboxes , label , orientation ='vertical' , showAmount =0 , size ='medium' , errorMessage , hintMessage , ...props }) {
37
88
  const state = useCheckboxGroupState({
@@ -82,7 +133,7 @@ export function CheckboxGroup({ className , checkboxes , label , orientation ='v
82
133
  id: panelId
83
134
  }, React.createElement(CheckboxGroupContext.Provider, {
84
135
  value: {
85
- ...state,
136
+ state,
86
137
  orientation,
87
138
  size
88
139
  }
@@ -41,4 +41,8 @@ export type CheckboxGroupContextState = {
41
41
  * Controls size of `CheckboxItem` components, can't be applied directly on `CheckboxItem`
42
42
  */
43
43
  size: 'medium' | 'large';
44
- } & CheckboxGroupState;
44
+ /**
45
+ * State
46
+ */
47
+ state: CheckboxGroupState;
48
+ };
@@ -32,8 +32,7 @@ function CheckIcon({ copyrightYear ='2024' , size , ...props }) {
32
32
  }));
33
33
  }
34
34
  function BaseCheckbox({ className , hint , label , value , ...props }, ref) {
35
- const state = useContext(CheckboxGroupContext);
36
- const { size , orientation } = state;
35
+ const { state , size , orientation } = useContext(CheckboxGroupContext);
37
36
  const localRef = useRef(null);
38
37
  const { inputProps , isDisabled , isSelected } = useCheckboxGroupItem({
39
38
  ...props,
@@ -34,6 +34,7 @@ export type DatePickerProps = {
34
34
  onClose?: (...args: any[]) => unknown;
35
35
  onFocus?: (...args: any[]) => unknown;
36
36
  onOpen?: (...args: any[]) => unknown;
37
+ placeholder?: string;
37
38
  /**
38
39
  * Size of datepicker input
39
40
  */
@@ -1,4 +1,5 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes } from 'react';
2
+ import { AriaFieldProps } from 'react-aria';
2
3
  export type ErrorMessageProps = {
3
4
  /**
4
5
  * Icon
@@ -7,7 +8,7 @@ export type ErrorMessageProps = {
7
8
  /**
8
9
  * Message or messages
9
10
  */
10
- message?: ReactNode | ReactNode[];
11
+ message?: AriaFieldProps['errorMessage'];
11
12
  /**
12
13
  * Tag to render
13
14
  */
@@ -9,5 +9,5 @@ export declare const ListItem: React.ForwardRefExoticComponent<{
9
9
  nested?: number | undefined;
10
10
  spacing?: "medium" | "large" | undefined;
11
11
  target?: React.HTMLAttributeAnchorTarget | undefined;
12
- type?: "link" | "icon" | "bullet" | "tick" | "cross" | "unstyled" | "ordered" | undefined;
12
+ type?: "link" | "icon" | "ordered" | "bullet" | "tick" | "cross" | "unstyled" | undefined;
13
13
  } & React.HTMLAttributes<Element> & React.RefAttributes<unknown>>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
2
  import { GetStateValuesProps } from './list.types.js';
3
3
  export declare const getStateValues: (props: GetStateValuesProps) => {
4
- type: "link" | "icon" | "bullet" | "tick" | "cross" | "unstyled" | "ordered";
4
+ type: "link" | "icon" | "ordered" | "bullet" | "tick" | "cross" | "unstyled";
5
5
  look: "link" | "primary" | "hero" | "success" | "danger" | "neutral";
6
6
  spacing: "medium" | "large";
7
7
  icon: ((props: import("../icon/icon.types.js").IconProps) => JSX.Element) | undefined;
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  function _extends() {
2
3
  _extends = Object.assign || function(target) {
3
4
  for(var i = 1; i < arguments.length; i++){
@@ -12,7 +13,7 @@ function _extends() {
12
13
  };
13
14
  return _extends.apply(this, arguments);
14
15
  }
15
- import React, { useRef } from 'react';
16
+ import React, { useMemo, useRef } from 'react';
16
17
  import { Overlay, useModalOverlay } from 'react-aria';
17
18
  import { styles as backdropStyles } from './modal-backdrop.styles.js';
18
19
  export function ModalBackdrop({ zIndex =100 , portalContainer , size , ...props }) {
@@ -24,11 +25,16 @@ export function ModalBackdrop({ zIndex =100 , portalContainer , size , ...props
24
25
  fluid: size === 'fluid'
25
26
  });
26
27
  const { modalProps , underlayProps } = useModalOverlay(props, state, ref);
28
+ const brandContainer = useMemo(()=>{
29
+ if (typeof window !== 'undefined') {
30
+ return document.querySelector('[data-theme]') || document.querySelector('[className="data-theme"]') || document.body;
31
+ }
32
+ }, []);
27
33
  if (!state.isOpen) {
28
34
  return null;
29
35
  }
30
36
  return React.createElement(Overlay, {
31
- portalContainer: portalContainer
37
+ portalContainer: portalContainer || brandContainer
32
38
  }, React.createElement("div", _extends({
33
39
  style: {
34
40
  zIndex
@@ -1,8 +1,8 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
  export const styles = tv({
3
3
  slots: {
4
- base: 'relative mx-auto flex max-w-full flex-col overflow-hidden rounded bg-white outline-none',
5
- title: 'typography-body-7 pb-4 pt-9 font-bold',
4
+ base: 'relative mx-auto flex max-w-full flex-col overflow-hidden rounded bg-white text-text outline-none',
5
+ title: 'typography-body-7 pb-4 pt-9 font-bold text-text',
6
6
  close: 'absolute right-0 top-0 block p-3'
7
7
  },
8
8
  variants: {
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
1
+ import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
2
2
  import { FocusScope } from 'react-aria';
3
3
  import { Button } from '../../../button/index.js';
4
4
  import { CloseIcon } from '../../../icon/index.js';
@@ -7,7 +7,12 @@ import { styles as panelStyles } from './panel.styles.js';
7
7
  export function Panel({ state , heading , headingTag: Tag = 'h1' , content , placement , id , triggerRef }) {
8
8
  const popoverRef = useRef(null);
9
9
  const arrowRef = useRef(null);
10
- const remSize = parseInt(window.getComputedStyle(document.getElementsByTagName('html')[0]).fontSize);
10
+ const remSize = useMemo(()=>{
11
+ if (typeof window !== 'undefined') {
12
+ return parseInt(window.getComputedStyle(document.getElementsByTagName('html')[0]).fontSize);
13
+ }
14
+ return 1;
15
+ }, []);
11
16
  const [position, setPosition] = useState({
12
17
  placement: 'top',
13
18
  offset: 'left',
@@ -6,8 +6,8 @@ export const styles = tv({
6
6
  arrow: 'absolute h-0 w-0 border-x-[8px] border-t-[12px] border-x-[transparent] border-t-muted after:absolute after:h-0 after:w-0 after:border-x-[7px] after:border-t-[11px] after:border-x-[transparent] after:border-t-white',
7
7
  closeBtn: 'absolute right-1 top-1 m-1 p-0 hover:opacity-80',
8
8
  content: 'w-[17.625rem] py-4 pl-3 pr-5',
9
- heading: 'typography-body-9 mb-2 font-bold',
10
- body: 'typography-body-10'
9
+ heading: 'typography-body-9 mb-2 font-bold text-text',
10
+ body: 'typography-body-10 text-text'
11
11
  },
12
12
  variants: {
13
13
  placement: {
@@ -5,7 +5,7 @@ export const usePopoverPosition = (triggerRef, popoverRef, arrowRef, placement)=
5
5
  const trigger = triggerRef.current.getBoundingClientRect();
6
6
  const popover = popoverRef.current.getBoundingClientRect();
7
7
  const arrow = arrowRef.current.getBoundingClientRect();
8
- const remSize = parseInt(window.getComputedStyle(document.getElementsByTagName('html')[0]).fontSize);
8
+ const remSize = typeof window !== 'undefined' ? parseInt(window.getComputedStyle(document.getElementsByTagName('html')[0]).fontSize) : 1;
9
9
  const position = {
10
10
  placement: placement ? placement : 'top',
11
11
  offset: popover.right >= window.innerWidth ? 'right' : 'left',
@@ -18,8 +18,7 @@ import { VisuallyHidden, useFocusRing, useRadio } from 'react-aria';
18
18
  import { RadioGroupContext } from '../../radio-group.component.js';
19
19
  import { styles as radioStyles } from './radio-group-radio.styles.js';
20
20
  function BaseRadioGroupRadio({ className , hint , label , ...props }, ref) {
21
- const state = useContext(RadioGroupContext);
22
- const { size , orientation } = state;
21
+ const { state , size , orientation } = useContext(RadioGroupContext);
23
22
  const localRef = useRef(null);
24
23
  const { inputProps , isSelected , isDisabled } = useRadio({
25
24
  ...props,
@@ -16,22 +16,69 @@ function _extends() {
16
16
  import React, { createContext, useEffect, useId, useMemo, useRef, useState } from 'react';
17
17
  import { useFocusRing, useRadioGroup } from 'react-aria';
18
18
  import { useRadioGroupState } from 'react-stately';
19
+ import { FUNCTION_NOT_IMPLEMENTED } from '../../constants/message.js';
19
20
  import { Button } from '../button/index.js';
20
21
  import { ExpandMoreIcon } from '../icon/index.js';
21
22
  import { ErrorMessage, Hint, Label, RadioGroupRadio } from '../index.js';
22
23
  import { styles as radioGroupStyles } from './radio-group.styles.js';
23
24
  export const RadioGroupContext = createContext({
24
- name: '',
25
- isDisabled: false,
26
- isReadOnly: false,
27
- isRequired: false,
28
- validationState: null,
29
- selectedValue: null,
30
- setSelectedValue: ()=>null,
31
- lastFocusedValue: null,
32
- setLastFocusedValue: ()=>null,
33
25
  orientation: 'vertical',
34
- size: 'medium'
26
+ size: 'medium',
27
+ state: {
28
+ name: '',
29
+ isDisabled: false,
30
+ isReadOnly: false,
31
+ isRequired: false,
32
+ validationState: null,
33
+ selectedValue: null,
34
+ setSelectedValue: ()=>null,
35
+ lastFocusedValue: null,
36
+ setLastFocusedValue: ()=>null,
37
+ isInvalid: false,
38
+ realtimeValidation: {
39
+ isInvalid: false,
40
+ validationErrors: [],
41
+ validationDetails: {
42
+ badInput: false,
43
+ customError: false,
44
+ patternMismatch: false,
45
+ rangeOverflow: false,
46
+ rangeUnderflow: false,
47
+ stepMismatch: false,
48
+ tooLong: false,
49
+ tooShort: false,
50
+ typeMismatch: false,
51
+ valid: false,
52
+ valueMissing: false
53
+ }
54
+ },
55
+ displayValidation: {
56
+ isInvalid: false,
57
+ validationErrors: [],
58
+ validationDetails: {
59
+ badInput: false,
60
+ customError: false,
61
+ patternMismatch: false,
62
+ rangeOverflow: false,
63
+ rangeUnderflow: false,
64
+ stepMismatch: false,
65
+ tooLong: false,
66
+ tooShort: false,
67
+ typeMismatch: false,
68
+ valid: false,
69
+ valueMissing: false
70
+ }
71
+ },
72
+ updateValidation: function() {
73
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
74
+ },
75
+ resetValidation: function() {
76
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
77
+ },
78
+ commitValidation: function() {
79
+ throw new Error(FUNCTION_NOT_IMPLEMENTED);
80
+ }
81
+ }
35
82
  });
36
83
  export function RadioGroup({ className , radios , label , orientation ='vertical' , showAmount =0 , size ='medium' , errorMessage , hintMessage , ...props }) {
37
84
  const state = useRadioGroupState({
@@ -84,7 +131,7 @@ export function RadioGroup({ className , radios , label , orientation ='vertical
84
131
  id: panelId
85
132
  }, React.createElement(RadioGroupContext.Provider, {
86
133
  value: {
87
- ...state,
134
+ state,
88
135
  orientation,
89
136
  size
90
137
  }
@@ -37,4 +37,8 @@ export type RadioGroupContextState = {
37
37
  * Controls size of `Radio` components, can't be applied directly on `Radio`
38
38
  */
39
39
  size: 'medium' | 'large';
40
- } & RadioGroupState;
40
+ /**
41
+ * State
42
+ */
43
+ state: RadioGroupState;
44
+ };
@@ -13,7 +13,7 @@ function _extends() {
13
13
  };
14
14
  return _extends.apply(this, arguments);
15
15
  }
16
- import { createContext, useCallback, useState } from 'react';
16
+ import { createContext, useCallback, useMemo, useState } from 'react';
17
17
  import { useField } from 'react-aria';
18
18
  import { ErrorMessage, Hint, Label } from '../../../index.js';
19
19
  import { styles } from './selector-button-group.styles.js';
@@ -31,12 +31,14 @@ export function SelectorButtonGroup({ className , children , label , orientation
31
31
  selected,
32
32
  setSelected
33
33
  ]);
34
- const state = {
35
- value: selected,
36
- onClick: (id)=>handleChange(id),
37
- validationState: errorMessage ? 'invalid' : 'valid',
38
- isDisabled
39
- };
34
+ const state = useMemo(()=>({
35
+ value: selected,
36
+ onClick: (id)=>handleChange(id),
37
+ validationState: errorMessage ? 'invalid' : 'valid',
38
+ isDisabled
39
+ }), [
40
+ selected
41
+ ]);
40
42
  const { labelProps , fieldProps , descriptionProps , errorMessageProps } = useField({
41
43
  validationState: state.validationState,
42
44
  label,