@westpac/ui 0.19.0 → 0.20.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 (142) hide show
  1. package/.eslintrc.cjs +7 -2
  2. package/CHANGELOG.md +6 -0
  3. package/dist/component-type.json +1 -1
  4. package/dist/components/accordion/accordion.component.d.ts +3 -2
  5. package/dist/components/accordion/accordion.types.d.ts +1 -1
  6. package/dist/components/accordion/components/accordion-item/accordion-item.component.d.ts +1 -1
  7. package/dist/components/accordion/components/accordion-item/accordion-item.types.d.ts +1 -1
  8. package/dist/components/autocomplete/autocomplete.component.js +6 -3
  9. package/dist/components/autocomplete/components/autocomplete-item/autocomplete-item.component.js +0 -1
  10. package/dist/components/autocomplete/components/autocomplete-item/autocomplete-item.types.d.ts +1 -1
  11. package/dist/components/autocomplete/components/autocomplete-list-box/autocomplete-list-box.types.d.ts +2 -2
  12. package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.d.ts +1 -1
  13. package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.types.d.ts +1 -1
  14. package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.component.d.ts +1 -1
  15. package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.types.d.ts +1 -1
  16. package/dist/components/badge/badge.component.d.ts +3 -3
  17. package/dist/components/badge/badge.component.js +1 -3
  18. package/dist/components/badge/badge.styles.d.ts +1 -1
  19. package/dist/components/badge/badge.styles.js +3 -3
  20. package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.js +3 -1
  21. package/dist/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.d.ts +3 -3
  22. package/dist/components/button/button.component.d.ts +1 -1
  23. package/dist/components/button/button.styles.js +1 -1
  24. package/dist/components/button-dropdown/button-dropdown.component.js +1 -1
  25. package/dist/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.component.js +8 -3
  26. package/dist/components/button-group/button-group.component.js +1 -1
  27. package/dist/components/checkbox-group/checkbox-group.component.js +1 -1
  28. package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.d.ts +1 -1
  29. package/dist/components/collapsible/collapsible.component.js +1 -1
  30. package/dist/components/date-picker/date-picker.component.js +9 -1
  31. package/dist/components/date-picker/date-picker.types.d.ts +8 -8
  32. package/dist/components/date-picker/date-picker.utils.d.ts +2 -2
  33. package/dist/components/date-picker/date-picker.utils.js +2 -1
  34. package/dist/components/error-message/error-message.component.js +2 -1
  35. package/dist/components/field/field.component.js +2 -1
  36. package/dist/components/flexi-cell/flexi-cell.component.d.ts +1 -1
  37. package/dist/components/header/header.component.js +4 -1
  38. package/dist/components/input-group/components/input-group-add-ons/components/input-group-add-on-default-add-on/input-group-add-on-default-add-on.component.d.ts +1 -1
  39. package/dist/components/input-group/components/input-group-add-ons/components/input-group-add-on-default-add-on/input-group-add-on-default-add-on.component.js +1 -1
  40. package/dist/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.js +2 -2
  41. package/dist/components/input-group/input-group.component.js +7 -2
  42. package/dist/components/list/components/list-item/list-item.component.d.ts +3 -3
  43. package/dist/components/pagination/pagination.component.js +6 -4
  44. package/dist/components/pagination/pagination.hooks.js +4 -2
  45. package/dist/components/pass-code/pass-code.component.js +6 -4
  46. package/dist/components/pass-code-view/pass-code-view.types.d.ts +2 -2
  47. package/dist/components/popover/components/panel/panel.component.js +6 -3
  48. package/dist/components/popover/popover.component.js +5 -3
  49. package/dist/components/popover/{popover.hooks.d.ts → popover.utils.d.ts} +1 -1
  50. package/dist/components/popover/{popover.hooks.js → popover.utils.js} +1 -1
  51. package/dist/components/progress-rope/components/progress-rope-step/progress-rope-step.component.d.ts +1 -1
  52. package/dist/components/progress-rope/components/progress-rope-step/progress-rope-step.component.js +3 -1
  53. package/dist/components/progress-rope/components/progress-rope-step/progress-rope-step.types.d.ts +1 -1
  54. package/dist/components/progress-rope/progress-rope.component.js +3 -2
  55. package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.d.ts +1 -1
  56. package/dist/components/radio-group/radio-group.component.js +1 -1
  57. package/dist/components/select/select.styles.d.ts +1 -1
  58. package/dist/components/select/select.styles.js +1 -1
  59. package/dist/components/selector/components/selector-button-group/components/selector-button-group-option/selector-button-group-option.component.js +2 -1
  60. package/dist/components/selector/components/selector-button-group/selector-button-group.component.js +3 -1
  61. package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +1 -1
  62. package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +1 -1
  63. package/dist/components/skip-link/skip-link.component.d.ts +1 -1
  64. package/dist/components/tabs/components/tabs-tab/tabs-tab.types.d.ts +1 -1
  65. package/dist/components/tabs/components/tabs-tab-panel/tabs-tab-panel.types.d.ts +1 -1
  66. package/dist/components/tabs/tabs.types.d.ts +1 -1
  67. package/dist/css/westpac-ui.css +18 -38
  68. package/dist/css/westpac-ui.min.css +18 -38
  69. package/dist/tailwind/tailwind-plugin.js +1 -1
  70. package/dist/tailwind/utils/create-font-sizes.d.ts +10 -1
  71. package/dist/tailwind/utils/generate-font-components.d.ts +2 -2
  72. package/package.json +1 -1
  73. package/src/components/accordion/accordion.component.tsx +15 -9
  74. package/src/components/accordion/accordion.types.ts +1 -1
  75. package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +4 -4
  76. package/src/components/accordion/components/accordion-item/accordion-item.types.ts +1 -1
  77. package/src/components/autocomplete/autocomplete.component.tsx +9 -2
  78. package/src/components/autocomplete/components/autocomplete-item/autocomplete-item.component.tsx +0 -1
  79. package/src/components/autocomplete/components/autocomplete-item/autocomplete-item.types.ts +1 -1
  80. package/src/components/autocomplete/components/autocomplete-list-box/autocomplete-list-box.types.ts +2 -2
  81. package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.tsx +3 -3
  82. package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.types.ts +1 -1
  83. package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.component.tsx +1 -1
  84. package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-section/autocomplete-list-box-section.types.ts +1 -1
  85. package/src/components/badge/badge.component.tsx +5 -6
  86. package/src/components/badge/badge.styles.ts +3 -3
  87. package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.component.tsx +0 -1
  88. package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.tsx +2 -3
  89. package/src/components/breadcrumb/breadcrumb.component.tsx +4 -1
  90. package/src/components/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.tsx +5 -5
  91. package/src/components/button/button.component.tsx +2 -2
  92. package/src/components/button/button.styles.ts +1 -1
  93. package/src/components/button-dropdown/button-dropdown.component.tsx +2 -2
  94. package/src/components/button-dropdown/components/button-dropdown-panel/button-dropdown-panel.component.tsx +3 -3
  95. package/src/components/button-group/button-group.component.tsx +1 -3
  96. package/src/components/checkbox-group/checkbox-group.component.tsx +2 -4
  97. package/src/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.tsx +5 -2
  98. package/src/components/collapsible/collapsible.component.tsx +1 -1
  99. package/src/components/compacta/compacta.component.tsx +1 -1
  100. package/src/components/date-picker/date-picker.component.tsx +2 -2
  101. package/src/components/date-picker/date-picker.types.ts +18 -8
  102. package/src/components/date-picker/date-picker.utils.ts +3 -3
  103. package/src/components/error-message/error-message.component.tsx +2 -2
  104. package/src/components/error-message/error-message.types.ts +1 -1
  105. package/src/components/field/field.component.tsx +1 -1
  106. package/src/components/flexi-cell/flexi-cell.component.tsx +3 -3
  107. package/src/components/header/header.component.tsx +1 -1
  108. package/src/components/input-group/components/input-group-add-ons/components/input-group-add-on-default-add-on/input-group-add-on-default-add-on.component.tsx +1 -6
  109. package/src/components/input-group/components/input-group-add-ons/input-group-add-ons.styles.ts +2 -2
  110. package/src/components/input-group/input-group.component.tsx +13 -4
  111. package/src/components/list/components/list-item/list-item.component.tsx +2 -2
  112. package/src/components/pagination/components/pagination-item/pagination-item.types.ts +2 -0
  113. package/src/components/pagination/pagination.component.tsx +2 -2
  114. package/src/components/pagination/pagination.hooks.ts +2 -2
  115. package/src/components/pass-code/pass-code.component.tsx +3 -3
  116. package/src/components/pass-code-view/pass-code-view.types.ts +2 -2
  117. package/src/components/popover/components/panel/panel.component.tsx +3 -3
  118. package/src/components/popover/popover.component.tsx +5 -5
  119. package/src/components/popover/{popover.hooks.tsx → popover.utils.tsx} +2 -2
  120. package/src/components/progress-rope/components/progress-rope-step/progress-rope-step.component.tsx +2 -3
  121. package/src/components/progress-rope/components/progress-rope-step/progress-rope-step.types.ts +1 -1
  122. package/src/components/progress-rope/progress-rope.component.tsx +1 -2
  123. package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx +2 -2
  124. package/src/components/radio-group/radio-group.component.tsx +2 -4
  125. package/src/components/select/select.styles.ts +1 -1
  126. package/src/components/selector/components/selector-button-group/components/selector-button-group-option/selector-button-group-option.component.tsx +3 -3
  127. package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx +2 -2
  128. package/src/components/selector/components/selector-checkbox-group/components/selector-checkbox-group-option/selector-checkbox-group-option.component.tsx +2 -2
  129. package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +1 -3
  130. package/src/components/selector/components/selector-link-group/components/selector-link-group-option/selector-link-group-option.component.tsx +3 -3
  131. package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.tsx +2 -2
  132. package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +1 -3
  133. package/src/components/skip-link/skip-link.component.tsx +3 -3
  134. package/src/components/tabs/components/tabs-tab/tabs-tab.component.tsx +2 -2
  135. package/src/components/tabs/components/tabs-tab/tabs-tab.types.ts +1 -1
  136. package/src/components/tabs/components/tabs-tab-panel/tabs-tab-panel.types.ts +1 -1
  137. package/src/components/tabs/tabs.component.tsx +7 -7
  138. package/src/components/tabs/tabs.types.ts +1 -1
  139. package/src/tailwind/tailwind-plugin.ts +1 -1
  140. package/src/tailwind/utils/create-font-sizes.ts +22 -11
  141. package/src/tailwind/utils/generate-font-components.ts +16 -19
  142. package/src/tailwind/utils/generate-form-control.ts +10 -11
@@ -6,7 +6,7 @@ import { styles } from './accordion-item.styles.js';
6
6
 
7
7
  type Variants = VariantProps<typeof styles>;
8
8
 
9
- export type AccordionItemProps<T = any> = {
9
+ export type AccordionItemProps<T = HTMLElement> = {
10
10
  /**
11
11
  * AccordionItem body content
12
12
  */
@@ -92,7 +92,14 @@ export function Autocomplete<T extends object>({
92
92
  ((!state.isOpen && state.isFocused && searchProps.value.length > 0 && !state.selectedItem) ||
93
93
  (state.collection.size === 0 && searchProps.value.length > 0))
94
94
  );
95
- }, [state, searchProps, noOptionsMessage]);
95
+ }, [
96
+ noOptionsMessage,
97
+ state.isOpen,
98
+ state.isFocused,
99
+ state.selectedItem,
100
+ state.collection.size,
101
+ searchProps.value.length,
102
+ ]);
96
103
 
97
104
  const iconSize = useMemo(() => {
98
105
  switch (size) {
@@ -161,7 +168,7 @@ export function Autocomplete<T extends object>({
161
168
  >
162
169
  <AutocompleteListBox
163
170
  {...listBoxProps}
164
- autoFocus={listBoxProps.autoFocus as any}
171
+ autoFocus={listBoxProps.autoFocus as boolean | undefined}
165
172
  listBoxRef={listBoxRef}
166
173
  state={state}
167
174
  />
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { Item } from 'react-stately';
3
2
 
4
3
  import { AutocompleteItemProps } from './autocomplete-item.types.js';
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { type ItemProps } from 'react-stately';
3
3
 
4
- export type AutocompleteItemProps<T = any> = ItemProps<T> & {
4
+ export type AutocompleteItemProps<T = HTMLElement> = ItemProps<T> & {
5
5
  /**
6
6
  * AutocompleteItem body content
7
7
  */
@@ -2,7 +2,7 @@ import { HTMLAttributes } from 'react';
2
2
  import { AriaListBoxOptions } from 'react-aria';
3
3
  import { ListState } from 'react-stately';
4
4
 
5
- export type AutocompleteListBoxProps<T = any> = AriaListBoxOptions<T> & {
5
+ export type AutocompleteListBoxProps = AriaListBoxOptions<unknown> & {
6
6
  listBoxRef?: React.RefObject<HTMLUListElement>;
7
- state: ListState<T>;
7
+ state: ListState<unknown>;
8
8
  } & HTMLAttributes<Element>;
@@ -1,11 +1,11 @@
1
1
  import { type Node } from '@react-types/shared';
2
2
  import * as React from 'react';
3
- import { useOption } from 'react-aria';
3
+ import { Key, useOption } from 'react-aria';
4
4
  import { type ListState } from 'react-stately';
5
5
 
6
6
  import { styles } from './autocomplete-list-box-option.styles.js';
7
7
 
8
- interface AutocompleteListBoxOptionProps<T = any> {
8
+ interface AutocompleteListBoxOptionProps<T = unknown> {
9
9
  item: Node<T>;
10
10
  state: ListState<T>;
11
11
  }
@@ -18,7 +18,7 @@ export function AutocompleteListBoxOption({ item, state }: AutocompleteListBoxOp
18
18
 
19
19
  const { optionProps, isDisabled, isSelected, isFocused } = useOption(
20
20
  {
21
- key: item.key as any,
21
+ key: item.key as Key,
22
22
  },
23
23
  state,
24
24
  ref,
@@ -1,7 +1,7 @@
1
1
  import { type Node } from '@react-types/shared';
2
2
  import { type ListState } from 'react-stately';
3
3
 
4
- export type AutocompleteListBoxOptionProps<T = any> = {
4
+ export type AutocompleteListBoxOptionProps<T = HTMLLIElement> = {
5
5
  item: Node<T>;
6
6
  state: ListState<T>;
7
7
  };
@@ -8,7 +8,7 @@ import { type AutocompleteListBoxSectionProps } from './autocomplete-list-box-se
8
8
  /**
9
9
  * @private
10
10
  */
11
- export function AutocompleteListBoxSection({ section, state }: AutocompleteListBoxSectionProps) {
11
+ export function AutocompleteListBoxSection({ section, state }: AutocompleteListBoxSectionProps<unknown>) {
12
12
  const { itemProps, headingProps, groupProps } = useListBoxSection({
13
13
  heading: section.rendered,
14
14
  'aria-label': section['aria-label'],
@@ -1,7 +1,7 @@
1
1
  import { type Node } from '@react-types/shared';
2
2
  import { ListState } from 'react-stately';
3
3
 
4
- export type AutocompleteListBoxSectionProps<T = any> = {
4
+ export type AutocompleteListBoxSectionProps<T> = {
5
5
  section: Node<T>;
6
6
  state: ListState<T>;
7
7
  };
@@ -1,20 +1,19 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef } from 'react';
3
+ import React, { Ref, forwardRef } from 'react';
4
4
 
5
5
  import { styles } from './badge.styles.js';
6
6
  import { type BadgeProps } from './badge.types.js';
7
7
 
8
8
  export function BaseBadge(
9
9
  { className, tag: Tag = 'div', color = 'hero', type = 'default', soft = false, children, ...props }: BadgeProps,
10
- ref: any,
10
+ ref: Ref<HTMLElement>,
11
11
  ) {
12
12
  return (
13
- <Tag {...({ ref } as any)} className={styles({ className, color, type, soft })} {...props}>
14
- {/* styling vertically aligns text in the middle */}
15
- <div className="relative bottom-[1px]">{children}</div>
13
+ <Tag {...({ ref } as object)} className={styles({ className, color, type, soft })} {...props}>
14
+ {children}
16
15
  </Tag>
17
16
  );
18
17
  }
19
18
 
20
- export const Badge = forwardRef<any, BadgeProps>(BaseBadge);
19
+ export const Badge = forwardRef<HTMLElement, BadgeProps>(BaseBadge);
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
2
2
 
3
3
  export const styles = tv(
4
4
  {
5
- base: 'inline-block whitespace-nowrap border text-center leading-none',
5
+ base: 'inline-block whitespace-nowrap border text-center',
6
6
  variants: {
7
7
  color: {
8
8
  danger: 'border-danger bg-danger text-white',
@@ -24,8 +24,8 @@ export const styles = tv(
24
24
  'warning-inverted': 'border-none bg-white text-warning',
25
25
  },
26
26
  type: {
27
- pill: 'typography-body-10 rounded-xl px-[0.4375rem] py-[0.25rem] font-medium leading-none',
28
- default: 'rounded-sm px-1 py-[0.125rem] text-[0.75rem] leading-none',
27
+ pill: 'typography-body-10 h-4 rounded-xl px-[0.4375rem] py-[0.25rem] font-medium leading-none',
28
+ default: 'h-3 rounded-sm px-1 text-[0.75rem] leading-none',
29
29
  },
30
30
  soft: {
31
31
  true: 'bg-white',
@@ -1,4 +1,3 @@
1
- import { clsx } from 'clsx';
2
1
  import React, { useRef } from 'react';
3
2
  import { useDialog } from 'react-aria';
4
3
 
@@ -1,4 +1,3 @@
1
- import { clsx } from 'clsx';
2
1
  import { PanInfo, motion, useAnimation } from 'framer-motion';
3
2
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
3
  import { Overlay, useModalOverlay } from 'react-aria';
@@ -52,7 +51,7 @@ export function BottomSheetModal({ state, height, width, children, portalContain
52
51
  return;
53
52
  }
54
53
  controls.start('hidden');
55
- }, [state.isOpen]);
54
+ }, [controls, state.isOpen]);
56
55
 
57
56
  const onDragEnd = useCallback(
58
57
  (_: unknown, info: PanInfo) => {
@@ -66,7 +65,7 @@ export function BottomSheetModal({ state, height, width, children, portalContain
66
65
  controls.start('visible');
67
66
  state.open();
68
67
  },
69
- [controls],
68
+ [controls, state],
70
69
  );
71
70
 
72
71
  if (!isBrowser || !state.isOpen) {
@@ -4,6 +4,7 @@ import React, { Children, FunctionComponentElement, cloneElement } from 'react';
4
4
  import { useBreadcrumbs } from 'react-aria';
5
5
 
6
6
  import { type BreadcrumbProps } from './breadcrumb.types.js';
7
+ import { BreadcrumbItemProps } from './components/breadcrumb-item/breadcrumb-item.types.js';
7
8
 
8
9
  export function Breadcrumb({ className, children, 'aria-label': ariaLabel = 'Breadcrumb', ...props }: BreadcrumbProps) {
9
10
  const { navProps } = useBreadcrumbs(props);
@@ -15,7 +16,9 @@ export function Breadcrumb({ className, children, 'aria-label': ariaLabel = 'Bre
15
16
  {Children.map(
16
17
  children,
17
18
  (child, i) =>
18
- cloneElement(child as FunctionComponentElement<any>, { isCurrent: i === childCount - 1 }) ?? <></>,
19
+ cloneElement(child as FunctionComponentElement<BreadcrumbItemProps>, {
20
+ isCurrent: i === childCount - 1,
21
+ }) ?? <></>,
19
22
  )}
20
23
  </ol>
21
24
  </nav>
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef, useRef } from 'react';
3
+ import React, { Ref, RefObject, forwardRef, useRef } from 'react';
4
4
  import { useBreadcrumbItem } from 'react-aria';
5
5
 
6
6
  import { ArrowRightIcon } from '../../../icon/index.js';
@@ -18,7 +18,7 @@ export function BaseBreadcrumbItem(
18
18
  tag: Tag = 'span',
19
19
  ...props
20
20
  }: BreadcrumbItemProps,
21
- propRef: any,
21
+ propRef: Ref<HTMLElement>,
22
22
  ) {
23
23
  const ref = useRef(propRef);
24
24
  const FinalTag = (Tag === 'a' && isDisabled) || (Tag === 'a' && isCurrent) ? 'span' : Tag;
@@ -30,12 +30,12 @@ export function BaseBreadcrumbItem(
30
30
  isCurrent,
31
31
  elementType: FinalTag,
32
32
  },
33
- ref,
33
+ ref as RefObject<HTMLElement>,
34
34
  );
35
35
  return (
36
36
  <li className="inline-flex items-center">
37
37
  <FinalTag
38
- {...({ ...itemProps, ref: propRef, href: FinalTag === 'a' ? href : undefined } as any)}
38
+ {...({ ...itemProps, ref: propRef, href: FinalTag === 'a' ? href : undefined } as object)}
39
39
  className={styles({ className, isDisabled, isCurrent })}
40
40
  >
41
41
  {children}
@@ -49,4 +49,4 @@ export function BaseBreadcrumbItem(
49
49
  );
50
50
  }
51
51
 
52
- export const BreadcrumbItem = forwardRef<any, BreadcrumbItemProps>(BaseBreadcrumbItem);
52
+ export const BreadcrumbItem = forwardRef<HTMLElement, BreadcrumbItemProps>(BaseBreadcrumbItem);
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef, useMemo } from 'react';
3
+ import React, { Ref, forwardRef, useMemo } from 'react';
4
4
  import { mergeProps, useFocusRing } from 'react-aria';
5
5
 
6
6
  import { styles as buttonStyles } from './button.styles.js';
@@ -22,7 +22,7 @@ function BaseButton(
22
22
  children,
23
23
  ...props
24
24
  }: ButtonProps,
25
- ref: any,
25
+ ref: Ref<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement & HTMLDivElement>,
26
26
  ) {
27
27
  const { isFocusVisible, focusProps } = useFocusRing();
28
28
  const iconSize = useMemo(() => getIconSize(size), [size]);
@@ -6,7 +6,7 @@ import { tv } from 'tailwind-variants';
6
6
  export const styles = tv(
7
7
  {
8
8
  slots: {
9
- base: 'items-center justify-center rounded leading-[1.5] transition-[background] disabled:pointer-events-none disabled:opacity-50 group-[.add-on-after]:rounded-l-none group-[.add-on-before]:rounded-r-none',
9
+ base: 'items-center justify-center rounded leading-[1.5] transition-[background] disabled:pointer-events-none disabled:opacity-50 group-first/add-on-before:rounded-r-none group-last/add-on-after:rounded-l-none',
10
10
  iconBefore: '',
11
11
  iconAfter: '',
12
12
  dropdown: 'ml-[0.4em]',
@@ -23,7 +23,7 @@ export function ButtonDropdown({
23
23
  soft = false,
24
24
  block = false,
25
25
  }: ButtonDropdownProps) {
26
- const ref = useRef<HTMLDivElement>(null);
26
+ const ref = useRef<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement & HTMLDivElement>(null);
27
27
  const panelId = useId();
28
28
  const styles = buttonDropdownStyles({ block, dropdownSize });
29
29
  const state = useOverlayTriggerState({ defaultOpen: open });
@@ -35,7 +35,7 @@ export function ButtonDropdown({
35
35
  (event: globalThis.KeyboardEvent) => {
36
36
  if (state.isOpen && event.key === 'Escape') state.close();
37
37
  },
38
- [state.isOpen],
38
+ [state],
39
39
  );
40
40
 
41
41
  useEffect(() => {
@@ -26,7 +26,7 @@ export function ButtonDropdownPanel({ className, children, state, block, id, ...
26
26
  )
27
27
  state.close();
28
28
  },
29
- [state.isOpen],
29
+ [props.triggerRef, state],
30
30
  );
31
31
 
32
32
  // React Aria does not handle click as we need when isNonModal is true so this is needed
@@ -42,7 +42,7 @@ export function ButtonDropdownPanel({ className, children, state, block, id, ...
42
42
  )
43
43
  state.close();
44
44
  },
45
- [state.isOpen],
45
+ [props.triggerRef, state],
46
46
  );
47
47
 
48
48
  useEffect(() => {
@@ -52,7 +52,7 @@ export function ButtonDropdownPanel({ className, children, state, block, id, ...
52
52
  window.document.removeEventListener('focusin', focusHandler);
53
53
  window.document.removeEventListener('click', clickHandler);
54
54
  };
55
- }, []);
55
+ }, [clickHandler, focusHandler]);
56
56
 
57
57
  return (
58
58
  <div
@@ -99,9 +99,7 @@ export function ButtonGroup({
99
99
  <div className={styles.base({ className })} {...radioGroupProps}>
100
100
  <Label {...labelProps}>{label}</Label>
101
101
  {hintMessage && <Hint {...descriptionProps}>{hintMessage}</Hint>}
102
- {errorMessage && state.validationState === 'invalid' && (
103
- <ErrorMessage {...errorMessageProps} message={errorMessage} />
104
- )}
102
+ {errorMessage && state.isInvalid && <ErrorMessage {...errorMessageProps} message={errorMessage} />}
105
103
  <div className={styles.buttonWrapper()}>
106
104
  <ButtonGroupContext.Provider value={{ state, size, look, block }}>
107
105
  {buttons.map((button, index) => (
@@ -91,7 +91,7 @@ export function CheckboxGroup({
91
91
  const { groupProps, labelProps, errorMessageProps, descriptionProps } = useCheckboxGroup({ ...props, label }, state);
92
92
  const { isFocusVisible, focusProps } = useFocusRing();
93
93
  const [hiddenOptions, setHiddenOptions] = useState<boolean>(showAmount > 0);
94
- const firstNewCheckboxRef = useRef<HTMLDivElement>(null);
94
+ const firstNewCheckboxRef = useRef<HTMLLabelElement>(null);
95
95
  const revealAmount = checkboxes && checkboxes.length - showAmount;
96
96
  const styles = checkboxStyles({ orientation, isFocusVisible });
97
97
  const panelId = useId();
@@ -113,9 +113,7 @@ export function CheckboxGroup({
113
113
  <div className={styles.base({ className })} {...groupProps}>
114
114
  <Label {...labelProps}>{label}</Label>
115
115
  {hintMessage && <Hint {...descriptionProps}>{hintMessage}</Hint>}
116
- {errorMessage && state.validationState === 'invalid' && (
117
- <ErrorMessage {...errorMessageProps} message={errorMessage} />
118
- )}
116
+ {errorMessage && state.isInvalid && <ErrorMessage {...errorMessageProps} message={errorMessage} />}
119
117
  <div className={styles.itemWrapper()} id={panelId}>
120
118
  <CheckboxGroupContext.Provider value={{ state, orientation, size }}>
121
119
  {childrenToRender}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef, useContext, useRef } from 'react';
3
+ import React, { Ref, forwardRef, useContext, useRef } from 'react';
4
4
  import { VisuallyHidden, useCheckboxGroupItem, useFocusRing } from 'react-aria';
5
5
 
6
6
  import { Icon } from '../../../icon/icon.component.js';
@@ -31,7 +31,10 @@ function CheckIcon({ copyrightYear = '2024', size, ...props }: IconProps) {
31
31
  );
32
32
  }
33
33
 
34
- function BaseCheckbox({ className, hint, label, value, ...props }: CheckboxGroupCheckboxProps, ref: any) {
34
+ function BaseCheckbox(
35
+ { className, hint, label, value, ...props }: CheckboxGroupCheckboxProps,
36
+ ref: Ref<HTMLLabelElement>,
37
+ ) {
35
38
  const { state, size, orientation } = useContext(CheckboxGroupContext);
36
39
  const localRef = useRef(null);
37
40
  const { inputProps, isDisabled, isSelected } = useCheckboxGroupItem(
@@ -30,7 +30,7 @@ export function Collapsible({
30
30
  const handleClick = useCallback(() => {
31
31
  onClick();
32
32
  setContentOpen(contentOpen => !contentOpen);
33
- }, [contentOpen]);
33
+ }, [onClick]);
34
34
 
35
35
  const styles = collapsibleStyles({ open: contentOpen });
36
36
 
@@ -146,7 +146,7 @@ export function Compacta({
146
146
  look="link"
147
147
  size="large"
148
148
  onClick={() => handleToggle(item.id, index)}
149
- ref={(el: HTMLElement) => {
149
+ ref={(el: HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement & HTMLDivElement) => {
150
150
  toggleRefs.current[index] = el;
151
151
  }}
152
152
  aria-labelledby={`gel-compacta-title-${item.id}`}
@@ -46,7 +46,7 @@ export function DatePicker({
46
46
 
47
47
  const dateAdapter = useMemo(
48
48
  () => ({
49
- parse(value = '', createDate: any) {
49
+ parse(value = '', createDate: (year: string, month: string, day: string) => Date) {
50
50
  const matches = value.match(/^(\d{1,2})-(\d{1,2})-(\d{4})$/);
51
51
  if (matches) {
52
52
  return createDate(matches[3], matches[2], matches[1]);
@@ -103,7 +103,7 @@ export function DatePicker({
103
103
  ref.current.isDateDisabled = (date: Date) => {
104
104
  return isDateDisabled(date, disableWeekends, disableDaysOfWeek, disableDates);
105
105
  };
106
- }, [ref, initialized]);
106
+ }, [ref, initialized, dateAdapter, localization, value, id, name, disableWeekends, disableDaysOfWeek, disableDates]);
107
107
 
108
108
  useLayoutEffect(() => {
109
109
  if (!ref.current) {
@@ -4,10 +4,10 @@ import { VariantProps } from 'tailwind-variants';
4
4
  import { styles } from './date-picker.styles.js';
5
5
 
6
6
  export type DuetDatePickerElement = Element & {
7
- dateAdapter: any;
8
- identifier: any;
7
+ dateAdapter: object;
8
+ identifier?: string;
9
9
  isDateDisabled: (date: Date) => boolean;
10
- localization: any;
10
+ localization: object;
11
11
  max?: string;
12
12
  min?: string;
13
13
  name?: string;
@@ -48,23 +48,33 @@ export type DatePickerProps = {
48
48
  /*
49
49
  * onBlur
50
50
  */
51
- onBlur?: (...args: any[]) => unknown;
51
+ // NOTE: duet library uses custom events build with another library causing these to be hard to type
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ onBlur?: (...args: any[]) => void;
52
54
  /*
53
55
  * onChange
54
56
  */
55
- onChange?: (...args: any[]) => unknown;
57
+ // NOTE: duet library uses custom events build with another library causing these to be hard to type
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ onChange?: (...args: any[]) => void;
56
60
  /*
57
61
  * onClose
58
62
  */
59
- onClose?: (...args: any[]) => unknown;
63
+ // NOTE: duet library uses custom events build with another library causing these to be hard to type
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ onClose?: (...args: any[]) => void;
60
66
  /*
61
67
  * onFocus
62
68
  */
63
- onFocus?: (...args: any[]) => unknown;
69
+ // NOTE: duet library uses custom events build with another library causing these to be hard to type
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ onFocus?: (...args: any[]) => void;
64
72
  /*
65
73
  * onOpen
66
74
  */
67
- onOpen?: (...args: any[]) => unknown;
75
+ // NOTE: duet library uses custom events build with another library causing these to be hard to type
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ onOpen?: (...args: any[]) => void;
68
78
  /*
69
79
  * placeholder
70
80
  */
@@ -1,4 +1,4 @@
1
- import { EventHandler, RefObject, useEffect } from 'react';
1
+ import { RefObject, useEffect } from 'react';
2
2
 
3
3
  import { DuetDatePickerElement } from './date-picker.types.js';
4
4
 
@@ -34,7 +34,7 @@ export function formatDate(date: Date, format: string) {
34
34
  export function useListener(
35
35
  ref: RefObject<DuetDatePickerElement> | null,
36
36
  eventName: string,
37
- handler?: EventHandler<any>,
37
+ handler?: EventListenerOrEventListenerObject,
38
38
  ) {
39
39
  useEffect(() => {
40
40
  if (ref?.current && handler) {
@@ -42,7 +42,7 @@ export function useListener(
42
42
  element.addEventListener(eventName, handler);
43
43
  return () => element.removeEventListener(eventName, handler);
44
44
  }
45
- }, [eventName, handler]);
45
+ }, [eventName, handler, ref]);
46
46
  }
47
47
 
48
48
  export function createDate(year: string, month: string, day: string) {
@@ -11,8 +11,8 @@ export function ErrorMessage({ className, tag: Tag = 'div', icon: Icon, message,
11
11
 
12
12
  return Array.isArray(message) ? (
13
13
  <ul className={styles.list({})} {...props}>
14
- {message.map(msg => (
15
- <li className={styles.base({ className })}>
14
+ {message.map((msg, index) => (
15
+ <li key={index} className={styles.base({ className })}>
16
16
  <FinalIcon copyrightYear="2023" className={styles.icon({})} size="xsmall" look="outlined" />
17
17
  {msg}
18
18
  </li>
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  import { AriaFieldProps } from 'react-aria';
3
3
 
4
4
  export type ErrorMessageProps = {
@@ -33,7 +33,7 @@ export function Field({
33
33
  return cloneElement(child, fieldProps);
34
34
  }
35
35
  });
36
- }, [children]);
36
+ }, [children, fieldProps]);
37
37
 
38
38
  return (
39
39
  <Tag className={styles({ className })} {...props}>
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef } from 'react';
3
+ import React, { Ref, forwardRef } from 'react';
4
4
  import { mergeProps, useFocusRing } from 'react-aria';
5
5
 
6
6
  import { ArrowRightIcon } from '../icon/index.js';
@@ -26,7 +26,7 @@ function FlexiCellBase(
26
26
  tabIndex,
27
27
  ...props
28
28
  }: FlexiCellProps,
29
- ref: any,
29
+ ref: Ref<HTMLElement>,
30
30
  ) {
31
31
  const { isFocusVisible, focusProps } = useFocusRing();
32
32
 
@@ -41,7 +41,7 @@ function FlexiCellBase(
41
41
 
42
42
  return (
43
43
  <Tag
44
- {...({ ref } as any)}
44
+ {...({ ref } as object)}
45
45
  className={styles.base({ className })}
46
46
  href={href}
47
47
  {...mergeProps(props, focusProps)}
@@ -83,7 +83,7 @@ export function Header({
83
83
  return () => {
84
84
  window.removeEventListener('scroll', handleScroll);
85
85
  };
86
- }, []);
86
+ }, [fixed, handleScroll]);
87
87
 
88
88
  const logoAlignment = logoCenter ? 'center' : 'left';
89
89
 
@@ -6,12 +6,7 @@ import { type InputGroupAddOnDefaultAddOnProps } from './input-group-add-on-defa
6
6
  /**
7
7
  * @private
8
8
  */
9
- export const InputGroupAddOnDefaultAddOn = ({
10
- position,
11
- className,
12
- children,
13
- ...props
14
- }: InputGroupAddOnDefaultAddOnProps) => {
9
+ export const InputGroupAddOnDefaultAddOn = ({ className, children, ...props }: InputGroupAddOnDefaultAddOnProps) => {
15
10
  return (
16
11
  <div className={styles({ className })} {...props}>
17
12
  {children}
@@ -9,8 +9,8 @@ export const styles = tv(
9
9
  false: '',
10
10
  },
11
11
  position: {
12
- before: 'add-on-before group',
13
- after: 'add-on-after group',
12
+ before: 'group/add-on-before',
13
+ after: ' group/add-on-after',
14
14
  },
15
15
  },
16
16
  compoundVariants: [
@@ -1,6 +1,15 @@
1
1
  'use client';
2
2
 
3
- import React, { Children, ReactNode, cloneElement, isValidElement, useCallback, useId, useMemo } from 'react';
3
+ import React, {
4
+ Attributes,
5
+ Children,
6
+ ReactNode,
7
+ cloneElement,
8
+ isValidElement,
9
+ useCallback,
10
+ useId,
11
+ useMemo,
12
+ } from 'react';
4
13
 
5
14
  import { ErrorMessage, Hint, Label } from '../index.js';
6
15
 
@@ -37,7 +46,7 @@ export function InputGroup({
37
46
  ...(supportingText ? [`${id}-supporting-text`] : []),
38
47
  ];
39
48
  return arr.join(' ');
40
- }, [id, hint, errorMessage, supportingText]);
49
+ }, [errorMessage, id, hint, before, after, supportingText]);
41
50
 
42
51
  const {
43
52
  element: beforeElement,
@@ -81,10 +90,10 @@ export function InputGroup({
81
90
  id,
82
91
  'aria-describedby': ariaDescribedByValue,
83
92
  ...(width !== 'full' ? { width: width } : {}),
84
- } as any);
93
+ } as Partial<unknown> & Attributes);
85
94
  }
86
95
  });
87
- }, [children, ariaDescribedByValue]);
96
+ }, [children, size, id, ariaDescribedByValue, width]);
88
97
 
89
98
  const isFieldset = useMemo(() => Tag === 'fieldset', [Tag]);
90
99
 
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { forwardRef, useContext } from 'react';
3
+ import React, { Ref, forwardRef, useContext } from 'react';
4
4
  import { useFocusRing } from 'react-aria';
5
5
 
6
6
  import { ListContext } from '../../list.component.js';
@@ -11,7 +11,7 @@ import { type ListItemProps } from './list-item.types.js';
11
11
 
12
12
  export function BaseListItem(
13
13
  { className, children, href, target, look, type, spacing, icon, ...props }: ListItemProps,
14
- ref: any,
14
+ ref: Ref<HTMLAnchorElement>,
15
15
  ) {
16
16
  const state = useContext(ListContext);
17
17