@compa11y/react 0.1.2 → 0.1.5

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/dist/chunk-32AW37KT.js +1 -0
  2. package/dist/chunk-AJ7JSWUT.cjs +1 -0
  3. package/dist/chunk-ASK7XTJD.cjs +1 -0
  4. package/dist/chunk-BFN4HW4Y.cjs +1 -0
  5. package/dist/chunk-FOVHQAY5.cjs +1 -0
  6. package/dist/chunk-HEA4NAOM.js +1 -0
  7. package/dist/chunk-IFZVKAUZ.js +1 -0
  8. package/dist/chunk-IZ7LLPPV.js +1 -0
  9. package/dist/chunk-JS3UD7KS.cjs +1 -0
  10. package/dist/chunk-L6H47IF4.js +1 -0
  11. package/dist/chunk-MAR6RBHF.cjs +1 -0
  12. package/dist/chunk-MD4AVTLT.js +1 -0
  13. package/dist/chunk-PO5IUVYY.cjs +1 -0
  14. package/dist/chunk-QOY5G3EC.js +1 -0
  15. package/dist/chunk-ROFBF3PJ.cjs +1 -0
  16. package/dist/chunk-VMM4K2K4.js +1 -0
  17. package/dist/components/combobox/index.cjs +1 -31
  18. package/dist/components/combobox/index.js +1 -6
  19. package/dist/components/dialog/index.cjs +1 -46
  20. package/dist/components/dialog/index.js +1 -5
  21. package/dist/components/menu/index.cjs +1 -46
  22. package/dist/components/menu/index.js +1 -5
  23. package/dist/components/tabs/index.cjs +1 -35
  24. package/dist/components/tabs/index.js +1 -6
  25. package/dist/components/toast/index.cjs +1 -24
  26. package/dist/components/toast/index.js +1 -3
  27. package/dist/index.cjs +1 -3714
  28. package/dist/index.d.cts +28 -2
  29. package/dist/index.d.ts +28 -2
  30. package/dist/index.js +1 -3408
  31. package/package.json +2 -2
  32. package/dist/chunk-2S4C6FGA.js +0 -380
  33. package/dist/chunk-2S4C6FGA.js.map +0 -1
  34. package/dist/chunk-52J4Z3QD.cjs +0 -45
  35. package/dist/chunk-52J4Z3QD.cjs.map +0 -1
  36. package/dist/chunk-C7QK2I7H.js +0 -373
  37. package/dist/chunk-C7QK2I7H.js.map +0 -1
  38. package/dist/chunk-D2UMS62N.cjs +0 -245
  39. package/dist/chunk-D2UMS62N.cjs.map +0 -1
  40. package/dist/chunk-E265U2RK.js +0 -234
  41. package/dist/chunk-E265U2RK.js.map +0 -1
  42. package/dist/chunk-E4XJRXWM.js +0 -215
  43. package/dist/chunk-E4XJRXWM.js.map +0 -1
  44. package/dist/chunk-GDLOJH6K.cjs +0 -110
  45. package/dist/chunk-GDLOJH6K.cjs.map +0 -1
  46. package/dist/chunk-IR46CNNY.cjs +0 -329
  47. package/dist/chunk-IR46CNNY.cjs.map +0 -1
  48. package/dist/chunk-JXYOE7SH.js +0 -103
  49. package/dist/chunk-JXYOE7SH.js.map +0 -1
  50. package/dist/chunk-O3YYQZ5O.js +0 -317
  51. package/dist/chunk-O3YYQZ5O.js.map +0 -1
  52. package/dist/chunk-OIVTOU4Z.cjs +0 -386
  53. package/dist/chunk-OIVTOU4Z.cjs.map +0 -1
  54. package/dist/chunk-OND5B7UG.js +0 -85
  55. package/dist/chunk-OND5B7UG.js.map +0 -1
  56. package/dist/chunk-R4FR6M6I.cjs +0 -383
  57. package/dist/chunk-R4FR6M6I.cjs.map +0 -1
  58. package/dist/chunk-RBDQCIS7.cjs +0 -89
  59. package/dist/chunk-RBDQCIS7.cjs.map +0 -1
  60. package/dist/chunk-SOBS7MIH.cjs +0 -220
  61. package/dist/chunk-SOBS7MIH.cjs.map +0 -1
  62. package/dist/chunk-WURPAE3R.js +0 -41
  63. package/dist/chunk-WURPAE3R.js.map +0 -1
  64. package/dist/components/combobox/index.cjs.map +0 -1
  65. package/dist/components/combobox/index.js.map +0 -1
  66. package/dist/components/dialog/index.cjs.map +0 -1
  67. package/dist/components/dialog/index.js.map +0 -1
  68. package/dist/components/menu/index.cjs.map +0 -1
  69. package/dist/components/menu/index.js.map +0 -1
  70. package/dist/components/tabs/index.cjs.map +0 -1
  71. package/dist/components/tabs/index.js.map +0 -1
  72. package/dist/components/toast/index.cjs.map +0 -1
  73. package/dist/components/toast/index.js.map +0 -1
  74. package/dist/index.cjs.map +0 -1
  75. package/dist/index.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactNode, InputHTMLAttributes, ButtonHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
- import { FocusTrapOptions, AnnouncerOptions, KeyboardHandlers } from '@compa11y/core';
3
+ import { FocusTrapOptions, AnnouncerOptions, KeyboardHandlers, FocusNeighborOptions, FocusReturnOptions } from '@compa11y/core';
4
4
  export { announce, announceAssertive, announceError, announcePolite, announceProgress, announceStatus, aria, buildAriaProps, checks, createComponentWarnings, hasAccessibleName, isAndroid, isBrowser, isIOS, isMac, mergeAriaIds, prefersDarkMode, prefersHighContrast, prefersReducedMotion, setWarningHandler, warn } from '@compa11y/core';
5
5
  export { DialogCompound as Dialog, DialogActions, DialogActionsProps, Dialog as DialogBase, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogContextValue, DialogDescription, DialogDescriptionProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, useDialogContext } from './components/dialog/index.cjs';
6
6
  export { ActionMenuCompound as ActionMenu, ActionMenu as ActionMenuBase, ActionMenuContent, ActionMenuContentProps, ActionMenuContextValue, ActionMenuItem, ActionMenuItemProps, ActionMenuLabel, ActionMenuLabelProps, ActionMenuProps, ActionMenuSeparator, ActionMenuSeparatorProps, ActionMenuTrigger, ActionMenuTriggerProps, useActionMenuContext } from './components/menu/index.cjs';
@@ -358,6 +358,28 @@ declare function useRovingTabindexMap<T extends string>(ids: T[], options?: Omit
358
358
  previous: () => void;
359
359
  };
360
360
 
361
+ /**
362
+ * Hook that provides a ref and methods to find/focus the nearest
363
+ * focusable neighbor of the referenced element.
364
+ *
365
+ * Useful when the element is about to be removed or disabled.
366
+ */
367
+ declare function useFocusNeighbor<T extends HTMLElement = HTMLElement>(options?: FocusNeighborOptions): {
368
+ ref: React$1.RefObject<T>;
369
+ getNeighbor: () => HTMLElement | null;
370
+ focusNeighbor: () => void;
371
+ };
372
+ /**
373
+ * Hook that remembers an element and can restore focus to it later.
374
+ * If the saved element is no longer focusable (disabled, removed),
375
+ * focus moves to its nearest neighbor instead.
376
+ */
377
+ declare function useFocusReturn(): {
378
+ save: (element?: HTMLElement) => void;
379
+ returnFocus: (options?: FocusReturnOptions) => void;
380
+ clear: () => void;
381
+ };
382
+
361
383
  interface SelectOption {
362
384
  value: string;
363
385
  label: string;
@@ -960,6 +982,8 @@ interface InputContextValue {
960
982
  value: string;
961
983
  setValue: (value: string) => void;
962
984
  hasError: boolean;
985
+ hasHint: boolean;
986
+ setHasHint: (hasHint: boolean) => void;
963
987
  disabled: boolean;
964
988
  readOnly: boolean;
965
989
  required: boolean;
@@ -1111,6 +1135,8 @@ interface TextareaContextValue {
1111
1135
  value: string;
1112
1136
  setValue: (value: string) => void;
1113
1137
  hasError: boolean;
1138
+ hasHint: boolean;
1139
+ setHasHint: (value: boolean) => void;
1114
1140
  disabled: boolean;
1115
1141
  readOnly: boolean;
1116
1142
  required: boolean;
@@ -1156,4 +1182,4 @@ declare const TextareaCompound: React$1.ForwardRefExoticComponent<TextareaProps
1156
1182
  Error: React$1.ForwardRefExoticComponent<TextareaErrorProps & React$1.RefAttributes<HTMLDivElement>>;
1157
1183
  };
1158
1184
 
1159
- export { Button, type ButtonProps, CheckboxCompound as Checkbox, Checkbox as CheckboxBase, CheckboxGroup, type CheckboxGroupContextValue, type CheckboxGroupProps, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, InputCompound as Input, Input as InputBase, type InputContextValue, InputError, type InputErrorProps, InputField, type InputFieldProps, InputHint, type InputHintProps, InputLabel, type InputLabelProps, type InputProps, ListboxCompound as Listbox, Listbox as ListboxBase, type ListboxContextValue, ListboxGroup, type ListboxGroupProps, ListboxOption, type ListboxOptionProps, type ListboxProps, Radio, RadioGroupCompound as RadioGroup, RadioGroup as RadioGroupBase, type RadioGroupContextValue, type RadioGroupProps, type RadioProps, type RovingTabindexItem, SelectCompound as Select, Select as SelectBase, SelectListbox, type SelectListboxProps, SelectOptionItem, type SelectOptionProps, type SelectOption as SelectOptionType, type SelectProps, SelectTrigger, type SelectTriggerProps, Switch, type SwitchProps, TextareaCompound as Textarea, Textarea as TextareaBase, type TextareaContextValue, TextareaError, type TextareaErrorProps, TextareaField, type TextareaFieldProps, TextareaHint, type TextareaHintProps, TextareaLabel, type TextareaLabelProps, type TextareaProps, type UseFocusTrapOptions, type UseRovingTabindexOptions, useAnnounceLoading, useAnnounceOnChange, useAnnouncer, useCheckboxGroupContext, useFocusControl, useFocusManager, useFocusTrap, useFocusTrapControls, useFocusVisible, useFocusWithin, useGridKeyboard, useId, useIdScope, useIds, useInputContext, useKeyPressed, useKeyboard, useListboxContext, useMenuKeyboard, useRadioGroupContext, useRovingTabindex, useRovingTabindexMap, useTabsKeyboard, useTextareaContext, useTypeAhead };
1185
+ export { Button, type ButtonProps, CheckboxCompound as Checkbox, Checkbox as CheckboxBase, CheckboxGroup, type CheckboxGroupContextValue, type CheckboxGroupProps, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, InputCompound as Input, Input as InputBase, type InputContextValue, InputError, type InputErrorProps, InputField, type InputFieldProps, InputHint, type InputHintProps, InputLabel, type InputLabelProps, type InputProps, ListboxCompound as Listbox, Listbox as ListboxBase, type ListboxContextValue, ListboxGroup, type ListboxGroupProps, ListboxOption, type ListboxOptionProps, type ListboxProps, Radio, RadioGroupCompound as RadioGroup, RadioGroup as RadioGroupBase, type RadioGroupContextValue, type RadioGroupProps, type RadioProps, type RovingTabindexItem, SelectCompound as Select, Select as SelectBase, SelectListbox, type SelectListboxProps, SelectOptionItem, type SelectOptionProps, type SelectOption as SelectOptionType, type SelectProps, SelectTrigger, type SelectTriggerProps, Switch, type SwitchProps, TextareaCompound as Textarea, Textarea as TextareaBase, type TextareaContextValue, TextareaError, type TextareaErrorProps, TextareaField, type TextareaFieldProps, TextareaHint, type TextareaHintProps, TextareaLabel, type TextareaLabelProps, type TextareaProps, type UseFocusTrapOptions, type UseRovingTabindexOptions, useAnnounceLoading, useAnnounceOnChange, useAnnouncer, useCheckboxGroupContext, useFocusControl, useFocusManager, useFocusNeighbor, useFocusReturn, useFocusTrap, useFocusTrapControls, useFocusVisible, useFocusWithin, useGridKeyboard, useId, useIdScope, useIds, useInputContext, useKeyPressed, useKeyboard, useListboxContext, useMenuKeyboard, useRadioGroupContext, useRovingTabindex, useRovingTabindexMap, useTabsKeyboard, useTextareaContext, useTypeAhead };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactNode, InputHTMLAttributes, ButtonHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
- import { FocusTrapOptions, AnnouncerOptions, KeyboardHandlers } from '@compa11y/core';
3
+ import { FocusTrapOptions, AnnouncerOptions, KeyboardHandlers, FocusNeighborOptions, FocusReturnOptions } from '@compa11y/core';
4
4
  export { announce, announceAssertive, announceError, announcePolite, announceProgress, announceStatus, aria, buildAriaProps, checks, createComponentWarnings, hasAccessibleName, isAndroid, isBrowser, isIOS, isMac, mergeAriaIds, prefersDarkMode, prefersHighContrast, prefersReducedMotion, setWarningHandler, warn } from '@compa11y/core';
5
5
  export { DialogCompound as Dialog, DialogActions, DialogActionsProps, Dialog as DialogBase, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogContextValue, DialogDescription, DialogDescriptionProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps, useDialogContext } from './components/dialog/index.js';
6
6
  export { ActionMenuCompound as ActionMenu, ActionMenu as ActionMenuBase, ActionMenuContent, ActionMenuContentProps, ActionMenuContextValue, ActionMenuItem, ActionMenuItemProps, ActionMenuLabel, ActionMenuLabelProps, ActionMenuProps, ActionMenuSeparator, ActionMenuSeparatorProps, ActionMenuTrigger, ActionMenuTriggerProps, useActionMenuContext } from './components/menu/index.js';
@@ -358,6 +358,28 @@ declare function useRovingTabindexMap<T extends string>(ids: T[], options?: Omit
358
358
  previous: () => void;
359
359
  };
360
360
 
361
+ /**
362
+ * Hook that provides a ref and methods to find/focus the nearest
363
+ * focusable neighbor of the referenced element.
364
+ *
365
+ * Useful when the element is about to be removed or disabled.
366
+ */
367
+ declare function useFocusNeighbor<T extends HTMLElement = HTMLElement>(options?: FocusNeighborOptions): {
368
+ ref: React$1.RefObject<T>;
369
+ getNeighbor: () => HTMLElement | null;
370
+ focusNeighbor: () => void;
371
+ };
372
+ /**
373
+ * Hook that remembers an element and can restore focus to it later.
374
+ * If the saved element is no longer focusable (disabled, removed),
375
+ * focus moves to its nearest neighbor instead.
376
+ */
377
+ declare function useFocusReturn(): {
378
+ save: (element?: HTMLElement) => void;
379
+ returnFocus: (options?: FocusReturnOptions) => void;
380
+ clear: () => void;
381
+ };
382
+
361
383
  interface SelectOption {
362
384
  value: string;
363
385
  label: string;
@@ -960,6 +982,8 @@ interface InputContextValue {
960
982
  value: string;
961
983
  setValue: (value: string) => void;
962
984
  hasError: boolean;
985
+ hasHint: boolean;
986
+ setHasHint: (hasHint: boolean) => void;
963
987
  disabled: boolean;
964
988
  readOnly: boolean;
965
989
  required: boolean;
@@ -1111,6 +1135,8 @@ interface TextareaContextValue {
1111
1135
  value: string;
1112
1136
  setValue: (value: string) => void;
1113
1137
  hasError: boolean;
1138
+ hasHint: boolean;
1139
+ setHasHint: (value: boolean) => void;
1114
1140
  disabled: boolean;
1115
1141
  readOnly: boolean;
1116
1142
  required: boolean;
@@ -1156,4 +1182,4 @@ declare const TextareaCompound: React$1.ForwardRefExoticComponent<TextareaProps
1156
1182
  Error: React$1.ForwardRefExoticComponent<TextareaErrorProps & React$1.RefAttributes<HTMLDivElement>>;
1157
1183
  };
1158
1184
 
1159
- export { Button, type ButtonProps, CheckboxCompound as Checkbox, Checkbox as CheckboxBase, CheckboxGroup, type CheckboxGroupContextValue, type CheckboxGroupProps, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, InputCompound as Input, Input as InputBase, type InputContextValue, InputError, type InputErrorProps, InputField, type InputFieldProps, InputHint, type InputHintProps, InputLabel, type InputLabelProps, type InputProps, ListboxCompound as Listbox, Listbox as ListboxBase, type ListboxContextValue, ListboxGroup, type ListboxGroupProps, ListboxOption, type ListboxOptionProps, type ListboxProps, Radio, RadioGroupCompound as RadioGroup, RadioGroup as RadioGroupBase, type RadioGroupContextValue, type RadioGroupProps, type RadioProps, type RovingTabindexItem, SelectCompound as Select, Select as SelectBase, SelectListbox, type SelectListboxProps, SelectOptionItem, type SelectOptionProps, type SelectOption as SelectOptionType, type SelectProps, SelectTrigger, type SelectTriggerProps, Switch, type SwitchProps, TextareaCompound as Textarea, Textarea as TextareaBase, type TextareaContextValue, TextareaError, type TextareaErrorProps, TextareaField, type TextareaFieldProps, TextareaHint, type TextareaHintProps, TextareaLabel, type TextareaLabelProps, type TextareaProps, type UseFocusTrapOptions, type UseRovingTabindexOptions, useAnnounceLoading, useAnnounceOnChange, useAnnouncer, useCheckboxGroupContext, useFocusControl, useFocusManager, useFocusTrap, useFocusTrapControls, useFocusVisible, useFocusWithin, useGridKeyboard, useId, useIdScope, useIds, useInputContext, useKeyPressed, useKeyboard, useListboxContext, useMenuKeyboard, useRadioGroupContext, useRovingTabindex, useRovingTabindexMap, useTabsKeyboard, useTextareaContext, useTypeAhead };
1185
+ export { Button, type ButtonProps, CheckboxCompound as Checkbox, Checkbox as CheckboxBase, CheckboxGroup, type CheckboxGroupContextValue, type CheckboxGroupProps, CheckboxIndicator, type CheckboxIndicatorProps, type CheckboxProps, InputCompound as Input, Input as InputBase, type InputContextValue, InputError, type InputErrorProps, InputField, type InputFieldProps, InputHint, type InputHintProps, InputLabel, type InputLabelProps, type InputProps, ListboxCompound as Listbox, Listbox as ListboxBase, type ListboxContextValue, ListboxGroup, type ListboxGroupProps, ListboxOption, type ListboxOptionProps, type ListboxProps, Radio, RadioGroupCompound as RadioGroup, RadioGroup as RadioGroupBase, type RadioGroupContextValue, type RadioGroupProps, type RadioProps, type RovingTabindexItem, SelectCompound as Select, Select as SelectBase, SelectListbox, type SelectListboxProps, SelectOptionItem, type SelectOptionProps, type SelectOption as SelectOptionType, type SelectProps, SelectTrigger, type SelectTriggerProps, Switch, type SwitchProps, TextareaCompound as Textarea, Textarea as TextareaBase, type TextareaContextValue, TextareaError, type TextareaErrorProps, TextareaField, type TextareaFieldProps, TextareaHint, type TextareaHintProps, TextareaLabel, type TextareaLabelProps, type TextareaProps, type UseFocusTrapOptions, type UseRovingTabindexOptions, useAnnounceLoading, useAnnounceOnChange, useAnnouncer, useCheckboxGroupContext, useFocusControl, useFocusManager, useFocusNeighbor, useFocusReturn, useFocusTrap, useFocusTrapControls, useFocusVisible, useFocusWithin, useGridKeyboard, useId, useIdScope, useIds, useInputContext, useKeyPressed, useKeyboard, useListboxContext, useMenuKeyboard, useRadioGroupContext, useRovingTabindex, useRovingTabindexMap, useTabsKeyboard, useTextareaContext, useTypeAhead };