react-aria-components 1.6.0 → 1.7.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.
- package/README.md +1 -1
- package/dist/Autocomplete.main.js +23 -12
- package/dist/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.mjs +23 -12
- package/dist/Autocomplete.module.js +23 -12
- package/dist/Autocomplete.module.js.map +1 -1
- package/dist/Checkbox.main.js +1 -1
- package/dist/Checkbox.main.js.map +1 -1
- package/dist/Checkbox.mjs +1 -1
- package/dist/Checkbox.module.js +1 -1
- package/dist/Checkbox.module.js.map +1 -1
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.module.js.map +1 -1
- package/dist/ColorArea.main.js +4 -4
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +2 -2
- package/dist/ColorArea.module.js +2 -2
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorField.main.js +8 -10
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +4 -6
- package/dist/ColorField.module.js +4 -6
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorPicker.main.js +2 -2
- package/dist/ColorPicker.main.js.map +1 -1
- package/dist/ColorPicker.mjs +1 -1
- package/dist/ColorPicker.module.js +1 -1
- package/dist/ColorPicker.module.js.map +1 -1
- package/dist/ColorSlider.main.js +5 -7
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +3 -5
- package/dist/ColorSlider.module.js +3 -5
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.main.js +2 -2
- package/dist/ColorSwatch.main.js.map +1 -1
- package/dist/ColorSwatch.mjs +1 -1
- package/dist/ColorSwatch.module.js +1 -1
- package/dist/ColorSwatch.module.js.map +1 -1
- package/dist/ColorSwatchPicker.main.js +3 -3
- package/dist/ColorSwatchPicker.main.js.map +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorSwatchPicker.module.js +1 -1
- package/dist/ColorSwatchPicker.module.js.map +1 -1
- package/dist/ColorThumb.main.js +2 -6
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.mjs +1 -5
- package/dist/ColorThumb.module.js +1 -5
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +4 -4
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +2 -2
- package/dist/ColorWheel.module.js +2 -2
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/ComboBox.main.js +1 -1
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +1 -1
- package/dist/ComboBox.module.js +1 -1
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +4 -3
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +4 -3
- package/dist/DateField.module.js +4 -3
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +2 -2
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +2 -2
- package/dist/DatePicker.module.js +2 -2
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/Dialog.main.js +2 -1
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.mjs +2 -1
- package/dist/Dialog.module.js +2 -1
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +5 -7
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +2 -4
- package/dist/Disclosure.module.js +2 -4
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/DropZone.main.js +1 -3
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +1 -3
- package/dist/DropZone.module.js +1 -3
- package/dist/DropZone.module.js.map +1 -1
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.module.js.map +1 -1
- package/dist/ListBox.main.js +17 -16
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +19 -18
- package/dist/ListBox.module.js +19 -18
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +39 -24
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +40 -25
- package/dist/Menu.module.js +40 -25
- package/dist/Menu.module.js.map +1 -1
- package/dist/Meter.main.js +1 -1
- package/dist/Meter.main.js.map +1 -1
- package/dist/Meter.mjs +1 -1
- package/dist/Meter.module.js +1 -1
- package/dist/Meter.module.js.map +1 -1
- package/dist/NumberField.main.js +4 -2
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.mjs +4 -2
- package/dist/NumberField.module.js +4 -2
- package/dist/NumberField.module.js.map +1 -1
- package/dist/Popover.main.js +67 -15
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +69 -17
- package/dist/Popover.module.js +69 -17
- package/dist/Popover.module.js.map +1 -1
- package/dist/ProgressBar.main.js +1 -1
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.mjs +1 -1
- package/dist/ProgressBar.module.js +1 -1
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RadioGroup.main.js +1 -1
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.mjs +1 -1
- package/dist/RadioGroup.module.js +1 -1
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +4 -2
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +5 -3
- package/dist/SearchField.module.js +5 -3
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js +3 -2
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.mjs +3 -2
- package/dist/Select.module.js +3 -2
- package/dist/Select.module.js.map +1 -1
- package/dist/Slider.main.js +2 -2
- package/dist/Slider.main.js.map +1 -1
- package/dist/Slider.mjs +2 -2
- package/dist/Slider.module.js +2 -2
- package/dist/Slider.module.js.map +1 -1
- package/dist/Table.main.js +15 -6
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +15 -6
- package/dist/Table.module.js +15 -6
- package/dist/Table.module.js.map +1 -1
- package/dist/TableLayout.main.js.map +1 -1
- package/dist/TableLayout.module.js.map +1 -1
- package/dist/Tabs.main.js +3 -2
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +4 -3
- package/dist/Tabs.module.js +4 -3
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +1 -1
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +1 -1
- package/dist/TagGroup.module.js +1 -1
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/TextField.main.js +4 -2
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +5 -3
- package/dist/TextField.module.js +5 -3
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js +148 -0
- package/dist/Toast.main.js.map +1 -0
- package/dist/Toast.mjs +137 -0
- package/dist/Toast.module.js +137 -0
- package/dist/Toast.module.js.map +1 -0
- package/dist/Tree.main.js +38 -34
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +34 -30
- package/dist/Tree.module.js +34 -30
- package/dist/Tree.module.js.map +1 -1
- package/dist/Virtualizer.main.js +4 -1
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +4 -1
- package/dist/Virtualizer.module.js +4 -1
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/import.mjs +9 -7
- package/dist/main.js +31 -17
- package/dist/main.js.map +1 -1
- package/dist/module.js +9 -7
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +159 -59
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js +9 -7
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +9 -7
- package/dist/utils.module.js +9 -7
- package/dist/utils.module.js.map +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.mjs +1 -1
- package/package.json +25 -30
- package/src/Autocomplete.tsx +19 -15
- package/src/Checkbox.tsx +3 -1
- package/src/Collection.tsx +2 -2
- package/src/ColorArea.tsx +2 -3
- package/src/ColorField.tsx +8 -6
- package/src/ColorPicker.tsx +1 -2
- package/src/ColorSlider.tsx +5 -5
- package/src/ColorSwatch.tsx +2 -2
- package/src/ColorSwatchPicker.tsx +1 -1
- package/src/ColorThumb.tsx +2 -4
- package/src/ColorWheel.tsx +2 -2
- package/src/ComboBox.tsx +3 -1
- package/src/DateField.tsx +8 -3
- package/src/DatePicker.tsx +6 -2
- package/src/Dialog.tsx +6 -2
- package/src/Disclosure.tsx +2 -3
- package/src/DropZone.tsx +1 -2
- package/src/GridList.tsx +5 -0
- package/src/Group.tsx +1 -0
- package/src/ListBox.tsx +11 -9
- package/src/Menu.tsx +53 -25
- package/src/Meter.tsx +3 -1
- package/src/NumberField.tsx +11 -2
- package/src/Popover.tsx +77 -25
- package/src/ProgressBar.tsx +3 -1
- package/src/RadioGroup.tsx +3 -1
- package/src/SearchField.tsx +6 -4
- package/src/Select.tsx +5 -2
- package/src/Slider.tsx +6 -2
- package/src/Table.tsx +35 -15
- package/src/TableLayout.ts +1 -1
- package/src/Tabs.tsx +6 -3
- package/src/TagGroup.tsx +3 -1
- package/src/TextField.tsx +6 -4
- package/src/Toast.tsx +184 -0
- package/src/Tree.tsx +67 -49
- package/src/Virtualizer.tsx +18 -3
- package/src/index.ts +16 -16
- package/src/utils.tsx +8 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-aria-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "A library of styleable components built using React Aria",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -39,38 +39,30 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@internationalized/date": "^3.7.0",
|
|
41
41
|
"@internationalized/string": "^3.2.5",
|
|
42
|
-
"@react-aria/autocomplete": "3.0.0-
|
|
43
|
-
"@react-aria/collections": "3.0.0-
|
|
44
|
-
"@react-aria/
|
|
45
|
-
"@react-aria/
|
|
46
|
-
"@react-aria/
|
|
47
|
-
"@react-aria/focus": "^3.19.1",
|
|
48
|
-
"@react-aria/interactions": "^3.23.0",
|
|
42
|
+
"@react-aria/autocomplete": "3.0.0-beta.0",
|
|
43
|
+
"@react-aria/collections": "3.0.0-beta.0",
|
|
44
|
+
"@react-aria/dnd": "^3.9.0",
|
|
45
|
+
"@react-aria/focus": "^3.20.0",
|
|
46
|
+
"@react-aria/interactions": "^3.24.0",
|
|
49
47
|
"@react-aria/live-announcer": "^3.4.1",
|
|
50
|
-
"@react-aria/
|
|
51
|
-
"@react-aria/
|
|
52
|
-
"@react-aria/
|
|
53
|
-
"@react-
|
|
54
|
-
"@react-
|
|
55
|
-
"@react-stately/
|
|
56
|
-
"@react-stately/
|
|
57
|
-
"@react-stately/disclosure": "^3.0.1",
|
|
58
|
-
"@react-stately/layout": "^4.1.1",
|
|
59
|
-
"@react-stately/menu": "^3.9.1",
|
|
60
|
-
"@react-stately/selection": "^3.19.0",
|
|
61
|
-
"@react-stately/table": "^3.13.1",
|
|
48
|
+
"@react-aria/toolbar": "3.0.0-beta.13",
|
|
49
|
+
"@react-aria/utils": "^3.28.0",
|
|
50
|
+
"@react-aria/virtualizer": "^4.1.2",
|
|
51
|
+
"@react-stately/autocomplete": "3.0.0-beta.0",
|
|
52
|
+
"@react-stately/layout": "^4.2.0",
|
|
53
|
+
"@react-stately/selection": "^3.20.0",
|
|
54
|
+
"@react-stately/table": "^3.14.0",
|
|
62
55
|
"@react-stately/utils": "^3.10.5",
|
|
63
|
-
"@react-stately/virtualizer": "^4.
|
|
64
|
-
"@react-types/
|
|
65
|
-
"@react-types/
|
|
66
|
-
"@react-types/
|
|
67
|
-
"@react-types/
|
|
68
|
-
"@react-types/table": "^3.10.4",
|
|
56
|
+
"@react-stately/virtualizer": "^4.3.0",
|
|
57
|
+
"@react-types/form": "^3.7.10",
|
|
58
|
+
"@react-types/grid": "^3.3.0",
|
|
59
|
+
"@react-types/shared": "^3.28.0",
|
|
60
|
+
"@react-types/table": "^3.11.0",
|
|
69
61
|
"@swc/helpers": "^0.5.0",
|
|
70
62
|
"client-only": "^0.0.1",
|
|
71
|
-
"react-aria": "^3.
|
|
72
|
-
"react-stately": "^3.
|
|
73
|
-
"use-sync-external-store": "^1.
|
|
63
|
+
"react-aria": "^3.38.0",
|
|
64
|
+
"react-stately": "^3.36.0",
|
|
65
|
+
"use-sync-external-store": "^1.4.0"
|
|
74
66
|
},
|
|
75
67
|
"peerDependencies": {
|
|
76
68
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -79,5 +71,8 @@
|
|
|
79
71
|
"publishConfig": {
|
|
80
72
|
"access": "public"
|
|
81
73
|
},
|
|
82
|
-
"
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@tailwindcss/postcss": "^4.0.0"
|
|
76
|
+
},
|
|
77
|
+
"gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
|
|
83
78
|
}
|
package/src/Autocomplete.tsx
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {AriaAutocompleteProps, CollectionOptions,
|
|
14
|
-
import {AutocompleteState,
|
|
13
|
+
import {AriaAutocompleteProps, CollectionOptions, useAutocomplete} from '@react-aria/autocomplete';
|
|
14
|
+
import {AutocompleteState, useAutocompleteState} from '@react-stately/autocomplete';
|
|
15
|
+
import {InputContext} from './Input';
|
|
15
16
|
import {mergeProps} from '@react-aria/utils';
|
|
16
17
|
import {Provider, removeDataAttributes, SlotProps, SlottedContextValue, useSlottedContext} from './utils';
|
|
17
18
|
import React, {createContext, RefObject, useRef} from 'react';
|
|
@@ -21,46 +22,49 @@ import {TextFieldContext} from './TextField';
|
|
|
21
22
|
export interface AutocompleteProps extends AriaAutocompleteProps, SlotProps {}
|
|
22
23
|
|
|
23
24
|
interface InternalAutocompleteContextValue {
|
|
24
|
-
|
|
25
|
+
filter?: (nodeTextValue: string) => boolean,
|
|
25
26
|
collectionProps: CollectionOptions,
|
|
26
27
|
collectionRef: RefObject<HTMLElement | null>
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export const
|
|
30
|
-
export const
|
|
30
|
+
export const AutocompleteContext = createContext<SlottedContextValue<Partial<AutocompleteProps>>>(null);
|
|
31
|
+
export const AutocompleteStateContext = createContext<AutocompleteState | null>(null);
|
|
31
32
|
// This context is to pass the register and filter down to whatever collection component is wrapped by the Autocomplete
|
|
32
33
|
// TODO: export from RAC, but rename to something more appropriate
|
|
33
34
|
export const UNSTABLE_InternalAutocompleteContext = createContext<InternalAutocompleteContextValue | null>(null);
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* An autocomplete combines a TextField or SearchField with a Menu or ListBox, allowing users to search or filter a list of suggestions.
|
|
37
38
|
*/
|
|
38
|
-
export function
|
|
39
|
-
let ctx = useSlottedContext(
|
|
39
|
+
export function Autocomplete(props: AutocompleteProps) {
|
|
40
|
+
let ctx = useSlottedContext(AutocompleteContext, props.slot);
|
|
40
41
|
props = mergeProps(ctx, props);
|
|
41
|
-
let {filter} = props;
|
|
42
|
-
let state =
|
|
42
|
+
let {filter, disableAutoFocusFirst} = props;
|
|
43
|
+
let state = useAutocompleteState(props);
|
|
44
|
+
let inputRef = useRef<HTMLInputElement | null>(null);
|
|
43
45
|
let collectionRef = useRef<HTMLElement>(null);
|
|
44
|
-
|
|
45
46
|
let {
|
|
46
47
|
textFieldProps,
|
|
47
48
|
collectionProps,
|
|
48
49
|
collectionRef: mergedCollectionRef,
|
|
49
|
-
filterFn
|
|
50
|
-
} =
|
|
50
|
+
filter: filterFn
|
|
51
|
+
} = useAutocomplete({
|
|
51
52
|
...removeDataAttributes(props),
|
|
52
53
|
filter,
|
|
54
|
+
disableAutoFocusFirst,
|
|
55
|
+
inputRef,
|
|
53
56
|
collectionRef
|
|
54
57
|
}, state);
|
|
55
58
|
|
|
56
59
|
return (
|
|
57
60
|
<Provider
|
|
58
61
|
values={[
|
|
59
|
-
[
|
|
62
|
+
[AutocompleteStateContext, state],
|
|
60
63
|
[SearchFieldContext, textFieldProps],
|
|
61
64
|
[TextFieldContext, textFieldProps],
|
|
65
|
+
[InputContext, {ref: inputRef}],
|
|
62
66
|
[UNSTABLE_InternalAutocompleteContext, {
|
|
63
|
-
filterFn,
|
|
67
|
+
filter: filterFn,
|
|
64
68
|
collectionProps,
|
|
65
69
|
collectionRef: mergedCollectionRef
|
|
66
70
|
}]
|
package/src/Checkbox.tsx
CHANGED
|
@@ -123,7 +123,9 @@ export const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(functi
|
|
|
123
123
|
...props,
|
|
124
124
|
validationBehavior
|
|
125
125
|
});
|
|
126
|
-
let [labelRef, label] = useSlot(
|
|
126
|
+
let [labelRef, label] = useSlot(
|
|
127
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
128
|
+
);
|
|
127
129
|
let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({
|
|
128
130
|
...props,
|
|
129
131
|
label,
|
package/src/Collection.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'>
|
|
|
19
19
|
/** The contents of the collection. */
|
|
20
20
|
children?: ReactNode | ((item: T) => ReactNode),
|
|
21
21
|
/** Values that should invalidate the item cache when using dynamic collections. */
|
|
22
|
-
dependencies?: any
|
|
22
|
+
dependencies?: ReadonlyArray<any>
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface ItemRenderProps {
|
|
@@ -89,7 +89,7 @@ export interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children'
|
|
|
89
89
|
/** Static child items or a function to render children. */
|
|
90
90
|
children?: ReactNode | ((item: T) => ReactElement),
|
|
91
91
|
/** Values that should invalidate the item cache when using dynamic collections. */
|
|
92
|
-
dependencies?: any
|
|
92
|
+
dependencies?: ReadonlyArray<any>
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
interface SectionContextValue {
|
package/src/ColorArea.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {AriaColorAreaProps} from '
|
|
1
|
+
import {AriaColorAreaProps, useColorArea} from 'react-aria';
|
|
2
2
|
import {ColorAreaContext} from './RSPContexts';
|
|
3
|
-
import {ColorAreaState, useColorAreaState} from '
|
|
3
|
+
import {ColorAreaState, useColorAreaState} from 'react-stately';
|
|
4
4
|
import {filterDOMProps} from '@react-aria/utils';
|
|
5
5
|
import {InternalColorThumbContext} from './ColorThumb';
|
|
6
6
|
import {Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';
|
|
7
7
|
import React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';
|
|
8
|
-
import {useColorArea} from '@react-aria/color';
|
|
9
8
|
|
|
10
9
|
export interface ColorAreaRenderProps {
|
|
11
10
|
/**
|
package/src/ColorField.tsx
CHANGED
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {AriaColorFieldProps, useColorChannelField, useColorField} from '
|
|
14
|
-
import {ColorChannel, ColorSpace} from '
|
|
13
|
+
import {AriaColorFieldProps, useColorChannelField, useColorField, useLocale} from 'react-aria';
|
|
14
|
+
import {ColorChannel, ColorFieldState, ColorSpace, useColorChannelFieldState, useColorFieldState} from 'react-stately';
|
|
15
15
|
import {ColorFieldContext} from './RSPContexts';
|
|
16
|
-
import {ColorFieldState, useColorChannelFieldState, useColorFieldState} from '@react-stately/color';
|
|
17
16
|
import {FieldErrorContext} from './FieldError';
|
|
18
17
|
import {filterDOMProps} from '@react-aria/utils';
|
|
19
18
|
import {InputContext} from './Input';
|
|
@@ -22,7 +21,6 @@ import {LabelContext} from './Label';
|
|
|
22
21
|
import {Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';
|
|
23
22
|
import React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, Ref, useRef} from 'react';
|
|
24
23
|
import {TextContext} from './Text';
|
|
25
|
-
import {useLocale} from 'react-aria';
|
|
26
24
|
|
|
27
25
|
export interface ColorFieldRenderProps {
|
|
28
26
|
/**
|
|
@@ -86,7 +84,9 @@ function ColorChannelField(props: ColorChannelFieldProps) {
|
|
|
86
84
|
});
|
|
87
85
|
|
|
88
86
|
let inputRef = useRef<HTMLInputElement>(null);
|
|
89
|
-
let [labelRef, label] = useSlot(
|
|
87
|
+
let [labelRef, label] = useSlot(
|
|
88
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
89
|
+
);
|
|
90
90
|
let {
|
|
91
91
|
labelProps,
|
|
92
92
|
inputProps,
|
|
@@ -129,7 +129,9 @@ function HexColorField(props: HexColorFieldProps) {
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
let inputRef = useRef<HTMLInputElement>(null);
|
|
132
|
-
let [labelRef, label] = useSlot(
|
|
132
|
+
let [labelRef, label] = useSlot(
|
|
133
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
134
|
+
);
|
|
133
135
|
let {
|
|
134
136
|
labelProps,
|
|
135
137
|
inputProps,
|
package/src/ColorPicker.tsx
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {Color} from '
|
|
13
|
+
import {Color, ColorPickerState, ColorPickerProps as StatelyColorPickerProps, useColorPickerState} from 'react-stately';
|
|
14
14
|
import {ColorAreaContext, ColorFieldContext, ColorSliderContext, ColorWheelContext} from './RSPContexts';
|
|
15
|
-
import {ColorPickerState, ColorPickerProps as StatelyColorPickerProps, useColorPickerState} from '@react-stately/color';
|
|
16
15
|
import {ColorSwatchContext} from './ColorSwatch';
|
|
17
16
|
import {ColorSwatchPickerContext} from './ColorSwatchPicker';
|
|
18
17
|
import {mergeProps} from 'react-aria';
|
package/src/ColorSlider.tsx
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {AriaColorSliderProps} from '
|
|
1
|
+
import {AriaColorSliderProps, Orientation, useColorSlider, useLocale} from 'react-aria';
|
|
2
2
|
import {ColorSliderContext} from './RSPContexts';
|
|
3
|
-
import {ColorSliderState, useColorSliderState} from '
|
|
3
|
+
import {ColorSliderState, useColorSliderState} from 'react-stately';
|
|
4
4
|
import {filterDOMProps} from '@react-aria/utils';
|
|
5
5
|
import {InternalColorThumbContext} from './ColorThumb';
|
|
6
6
|
import {LabelContext} from './Label';
|
|
7
|
-
import {Orientation, useLocale} from 'react-aria';
|
|
8
7
|
import {Provider, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';
|
|
9
8
|
import React, {createContext, ForwardedRef, forwardRef} from 'react';
|
|
10
9
|
import {SliderOutputContext, SliderStateContext, SliderTrackContext} from './Slider';
|
|
11
|
-
import {useColorSlider} from '@react-aria/color';
|
|
12
10
|
|
|
13
11
|
export interface ColorSliderRenderProps {
|
|
14
12
|
/**
|
|
@@ -41,7 +39,9 @@ export const ColorSlider = forwardRef(function ColorSlider(props: ColorSliderPro
|
|
|
41
39
|
let trackRef = React.useRef(null);
|
|
42
40
|
let inputRef = React.useRef(null);
|
|
43
41
|
|
|
44
|
-
let [labelRef, label] = useSlot(
|
|
42
|
+
let [labelRef, label] = useSlot(
|
|
43
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
44
|
+
);
|
|
45
45
|
let {
|
|
46
46
|
trackProps,
|
|
47
47
|
thumbProps,
|
package/src/ColorSwatch.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {AriaColorSwatchProps, useColorSwatch} from '
|
|
2
|
-
import {Color} from '
|
|
1
|
+
import {AriaColorSwatchProps, useColorSwatch} from 'react-aria';
|
|
2
|
+
import {Color} from 'react-stately';
|
|
3
3
|
import {ContextValue, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';
|
|
4
4
|
import React, {createContext, ForwardedRef, forwardRef} from 'react';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {AriaLabelingProps, HoverEvents, ValueBase} from '@react-types/shared';
|
|
2
|
-
import {Color, parseColor, useColorPickerState} from '
|
|
2
|
+
import {Color, parseColor, useColorPickerState} from 'react-stately';
|
|
3
3
|
import {ColorSwatchContext} from './ColorSwatch';
|
|
4
4
|
import {composeRenderProps, ContextValue, RenderProps, StyleRenderProps, useContextProps} from './utils';
|
|
5
5
|
import {filterDOMProps} from '@react-aria/utils';
|
package/src/ColorThumb.tsx
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {Color} from '
|
|
1
|
+
import {Color} from 'react-stately';
|
|
2
2
|
import {filterDOMProps} from '@react-aria/utils';
|
|
3
3
|
import {HoverEvents, RefObject} from '@react-types/shared';
|
|
4
|
-
import {mergeProps} from 'react-aria';
|
|
4
|
+
import {mergeProps, useFocusRing, useHover} from 'react-aria';
|
|
5
5
|
import React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, InputHTMLAttributes, useContext} from 'react';
|
|
6
6
|
import {RenderProps, useRenderProps} from './utils';
|
|
7
|
-
import {useFocusRing} from '@react-aria/focus';
|
|
8
|
-
import {useHover} from '@react-aria/interactions';
|
|
9
7
|
|
|
10
8
|
interface ColorState {
|
|
11
9
|
getDisplayColor(): Color,
|
package/src/ColorWheel.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {AriaColorWheelOptions, useColorWheel} from '
|
|
1
|
+
import {AriaColorWheelOptions, useColorWheel} from 'react-aria';
|
|
2
2
|
import {ColorWheelContext} from './RSPContexts';
|
|
3
|
-
import {ColorWheelState, useColorWheelState} from '
|
|
3
|
+
import {ColorWheelState, useColorWheelState} from 'react-stately';
|
|
4
4
|
import {ContextValue, Provider, RenderProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';
|
|
5
5
|
import {filterDOMProps} from '@react-aria/utils';
|
|
6
6
|
import {InternalColorThumbContext} from './ColorThumb';
|
package/src/ComboBox.tsx
CHANGED
|
@@ -126,7 +126,9 @@ function ComboBoxInner<T extends object>({props, collection, comboBoxRef: ref}:
|
|
|
126
126
|
let inputRef = useRef<HTMLInputElement>(null);
|
|
127
127
|
let listBoxRef = useRef<HTMLDivElement>(null);
|
|
128
128
|
let popoverRef = useRef<HTMLDivElement>(null);
|
|
129
|
-
let [labelRef, label] = useSlot(
|
|
129
|
+
let [labelRef, label] = useSlot(
|
|
130
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
131
|
+
);
|
|
130
132
|
let {
|
|
131
133
|
buttonProps,
|
|
132
134
|
inputProps,
|
package/src/DateField.tsx
CHANGED
|
@@ -64,7 +64,9 @@ export const DateField = /*#__PURE__*/ (forwardRef as forwardRefType)(function D
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
let fieldRef = useRef<HTMLDivElement>(null);
|
|
67
|
-
let [labelRef, label] = useSlot(
|
|
67
|
+
let [labelRef, label] = useSlot(
|
|
68
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
69
|
+
);
|
|
68
70
|
let inputRef = useRef<HTMLInputElement>(null);
|
|
69
71
|
let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, ...validation} = useDateField({
|
|
70
72
|
...removeDataAttributes(props),
|
|
@@ -127,7 +129,9 @@ export const TimeField = /*#__PURE__*/ (forwardRef as forwardRefType)(function T
|
|
|
127
129
|
});
|
|
128
130
|
|
|
129
131
|
let fieldRef = useRef<HTMLDivElement>(null);
|
|
130
|
-
let [labelRef, label] = useSlot(
|
|
132
|
+
let [labelRef, label] = useSlot(
|
|
133
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
134
|
+
);
|
|
131
135
|
let inputRef = useRef<HTMLInputElement>(null);
|
|
132
136
|
let {labelProps, fieldProps, inputProps, descriptionProps, errorMessageProps, ...validation} = useTimeField({
|
|
133
137
|
...removeDataAttributes(props),
|
|
@@ -341,9 +345,10 @@ export const DateSegment = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
341
345
|
|
|
342
346
|
|
|
343
347
|
return (
|
|
344
|
-
<
|
|
348
|
+
<span
|
|
345
349
|
{...mergeProps(filterDOMProps(otherProps as any), segmentProps, focusProps, hoverProps)}
|
|
346
350
|
{...renderProps}
|
|
351
|
+
style={segmentProps.style}
|
|
347
352
|
ref={domRef}
|
|
348
353
|
data-placeholder={segment.isPlaceholder || undefined}
|
|
349
354
|
data-invalid={state.isInvalid || undefined}
|
package/src/DatePicker.tsx
CHANGED
|
@@ -85,7 +85,9 @@ export const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
let groupRef = useRef<HTMLDivElement>(null);
|
|
88
|
-
let [labelRef, label] = useSlot(
|
|
88
|
+
let [labelRef, label] = useSlot(
|
|
89
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
90
|
+
);
|
|
89
91
|
let {
|
|
90
92
|
groupProps,
|
|
91
93
|
labelProps,
|
|
@@ -186,7 +188,9 @@ export const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(func
|
|
|
186
188
|
});
|
|
187
189
|
|
|
188
190
|
let groupRef = useRef<HTMLDivElement>(null);
|
|
189
|
-
let [labelRef, label] = useSlot(
|
|
191
|
+
let [labelRef, label] = useSlot(
|
|
192
|
+
!props['aria-label'] && !props['aria-labelledby']
|
|
193
|
+
);
|
|
190
194
|
let {
|
|
191
195
|
groupProps,
|
|
192
196
|
labelProps,
|
package/src/Dialog.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export interface DialogTriggerProps extends OverlayTriggerProps {
|
|
|
25
25
|
children: ReactNode
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
interface DialogRenderProps {
|
|
28
|
+
export interface DialogRenderProps {
|
|
29
29
|
close: () => void
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -61,7 +61,11 @@ export function DialogTrigger(props: DialogTriggerProps) {
|
|
|
61
61
|
[OverlayTriggerStateContext, state],
|
|
62
62
|
[RootMenuTriggerStateContext, state],
|
|
63
63
|
[DialogContext, overlayProps],
|
|
64
|
-
[PopoverContext, {
|
|
64
|
+
[PopoverContext, {
|
|
65
|
+
trigger: 'DialogTrigger',
|
|
66
|
+
triggerRef: buttonRef,
|
|
67
|
+
'aria-labelledby': overlayProps['aria-labelledby']
|
|
68
|
+
}]
|
|
65
69
|
]}>
|
|
66
70
|
<PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>
|
|
67
71
|
{props.children}
|
package/src/Disclosure.tsx
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {AriaDisclosureProps, useDisclosure} from '
|
|
13
|
+
import {AriaDisclosureProps, useDisclosure, useFocusRing} from 'react-aria';
|
|
14
14
|
import {ButtonContext} from './Button';
|
|
15
15
|
import {ContextValue, DEFAULT_SLOT, Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';
|
|
16
|
-
import {DisclosureGroupState, DisclosureState, DisclosureGroupProps as StatelyDisclosureGroupProps, useDisclosureGroupState, useDisclosureState} from '
|
|
16
|
+
import {DisclosureGroupState, DisclosureState, DisclosureGroupProps as StatelyDisclosureGroupProps, useDisclosureGroupState, useDisclosureState} from 'react-stately';
|
|
17
17
|
import {DOMProps, forwardRefType, Key} from '@react-types/shared';
|
|
18
18
|
import {filterDOMProps, mergeProps, mergeRefs, useId} from '@react-aria/utils';
|
|
19
19
|
import React, {createContext, DOMAttributes, ForwardedRef, forwardRef, ReactNode, useContext} from 'react';
|
|
20
|
-
import {useFocusRing} from 'react-aria';
|
|
21
20
|
|
|
22
21
|
export interface DisclosureGroupProps extends StatelyDisclosureGroupProps, RenderProps<DisclosureGroupRenderProps>, DOMProps {}
|
|
23
22
|
|
package/src/DropZone.tsx
CHANGED
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
import {AriaLabelingProps, HoverEvents} from '@react-types/shared';
|
|
14
14
|
import {ContextValue, Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';
|
|
15
15
|
import {DropOptions, mergeProps, useButton, useClipboard, useDrop, useFocusRing, useHover, useLocalizedStringFormatter, VisuallyHidden} from 'react-aria';
|
|
16
|
-
import {filterDOMProps, useLabels, useObjectRef, useSlotId} from '@react-aria/utils';
|
|
16
|
+
import {filterDOMProps, isFocusable, useLabels, useObjectRef, useSlotId} from '@react-aria/utils';
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
import intlMessages from '../intl/*.json';
|
|
19
|
-
import {isFocusable} from '@react-aria/focus';
|
|
20
19
|
import React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';
|
|
21
20
|
import {TextContext} from './Text';
|
|
22
21
|
|
package/src/GridList.tsx
CHANGED
|
@@ -57,6 +57,11 @@ export interface GridListRenderProps {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export interface GridListProps<T> extends Omit<AriaGridListProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<GridListRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {
|
|
60
|
+
/**
|
|
61
|
+
* Whether typeahead navigation is disabled.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
disallowTypeAhead?: boolean,
|
|
60
65
|
/** How multiple selection should behave in the collection. */
|
|
61
66
|
selectionBehavior?: SelectionBehavior,
|
|
62
67
|
/** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the GridList. */
|
package/src/Group.tsx
CHANGED
|
@@ -74,6 +74,7 @@ export const Group = /*#__PURE__*/ (forwardRef as forwardRefType)(function Group
|
|
|
74
74
|
|
|
75
75
|
isDisabled ??= !!props['aria-disabled'] && props['aria-disabled'] !== 'false';
|
|
76
76
|
isInvalid ??= !!props['aria-invalid'] && props['aria-invalid'] !== 'false';
|
|
77
|
+
|
|
77
78
|
let renderProps = useRenderProps({
|
|
78
79
|
...props,
|
|
79
80
|
values: {isHovered, isFocusWithin: isFocused, isFocusVisible, isDisabled, isInvalid},
|
package/src/ListBox.tsx
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
import {AriaListBoxOptions, AriaListBoxProps, DraggableItemResult, DragPreviewRenderer, DroppableCollectionResult, DroppableItemResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useHover, useListBox, useListBoxSection, useLocale, useOption} from 'react-aria';
|
|
14
14
|
import {Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';
|
|
15
15
|
import {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps} from './Collection';
|
|
16
|
-
import {ContextValue, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps, useSlot} from './utils';
|
|
16
|
+
import {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps, useSlot} from './utils';
|
|
17
17
|
import {DragAndDropContext, DropIndicatorContext, DropIndicatorProps, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';
|
|
18
18
|
import {DragAndDropHooks} from './useDragAndDrop';
|
|
19
|
-
import {DraggableCollectionState, DroppableCollectionState, ListState, Node, Orientation, SelectionBehavior, useListState} from 'react-stately';
|
|
19
|
+
import {DraggableCollectionState, DroppableCollectionState, ListState, Node, Orientation, SelectionBehavior, UNSTABLE_useFilteredListState, useListState} from 'react-stately';
|
|
20
20
|
import {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';
|
|
21
21
|
import {forwardRefType, HoverEvents, Key, LinkDOMProps, RefObject} from '@react-types/shared';
|
|
22
22
|
import {HeaderContext} from './Header';
|
|
@@ -107,12 +107,8 @@ export const ListBox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Lis
|
|
|
107
107
|
function StandaloneListBox({props, listBoxRef, collection}) {
|
|
108
108
|
props = {...props, collection, children: null, items: null};
|
|
109
109
|
let {layoutDelegate} = useContext(CollectionRendererContext);
|
|
110
|
-
let
|
|
111
|
-
|
|
112
|
-
listBoxRef = useObjectRef(useMemo(() => mergeRefs(listBoxRef, collectionRef !== undefined ? collectionRef as RefObject<HTMLDivElement> : null), [collectionRef, listBoxRef]));
|
|
113
|
-
let filteredCollection = useMemo(() => filterFn ? collection.filter(filterFn) : collection, [collection, filterFn]);
|
|
114
|
-
let state = useListState({...props, collection: filteredCollection, layoutDelegate});
|
|
115
|
-
return <ListBoxInner state={state} props={{...props, ...collectionProps}} listBoxRef={listBoxRef} />;
|
|
110
|
+
let state = useListState({...props, layoutDelegate});
|
|
111
|
+
return <ListBoxInner state={state} props={props} listBoxRef={listBoxRef} />;
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
interface ListBoxInnerProps<T> {
|
|
@@ -121,8 +117,13 @@ interface ListBoxInnerProps<T> {
|
|
|
121
117
|
listBoxRef: RefObject<HTMLDivElement | null>
|
|
122
118
|
}
|
|
123
119
|
|
|
124
|
-
function ListBoxInner<T extends object>({state, props, listBoxRef}: ListBoxInnerProps<T>) {
|
|
120
|
+
function ListBoxInner<T extends object>({state: inputState, props, listBoxRef}: ListBoxInnerProps<T>) {
|
|
121
|
+
let {filter, collectionProps, collectionRef} = useContext(UNSTABLE_InternalAutocompleteContext) || {};
|
|
122
|
+
props = useMemo(() => collectionProps ? ({...props, ...collectionProps}) : props, [props, collectionProps]);
|
|
125
123
|
let {dragAndDropHooks, layout = 'stack', orientation = 'vertical'} = props;
|
|
124
|
+
// Memoed so that useAutocomplete callback ref is properly only called once on mount and not everytime a rerender happens
|
|
125
|
+
listBoxRef = useObjectRef(useMemo(() => mergeRefs(listBoxRef, collectionRef !== undefined ? collectionRef as RefObject<HTMLDivElement> : null), [collectionRef, listBoxRef]));
|
|
126
|
+
let state = UNSTABLE_useFilteredListState(inputState, filter);
|
|
126
127
|
let {collection, selectionManager} = state;
|
|
127
128
|
let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;
|
|
128
129
|
let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;
|
|
@@ -398,6 +399,7 @@ export const ListBoxItem = /*#__PURE__*/ createLeafComponent('item', function Li
|
|
|
398
399
|
values={[
|
|
399
400
|
[TextContext, {
|
|
400
401
|
slots: {
|
|
402
|
+
[DEFAULT_SLOT]: labelProps,
|
|
401
403
|
label: labelProps,
|
|
402
404
|
description: descriptionProps
|
|
403
405
|
}
|