@fluentui/react-list 9.74.9-experimental.menu-disable-autofocus.20261008-e9914a95c6.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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/CHANGELOG.md +25 -12
- package/dist/index.d.cts +119 -15
- package/dist/index.d.ts +119 -15
- package/lib/List.js +1 -1
- package/lib/List.js.map +1 -1
- package/lib/ListItem.js +1 -1
- package/lib/ListItem.js.map +1 -1
- package/lib/components/List/List.js.map +1 -1
- package/lib/components/List/List.module.css +8 -0
- package/lib/components/List/List.types.js.map +1 -1
- package/lib/components/List/index.js +3 -1
- package/lib/components/List/index.js.map +1 -1
- package/lib/components/List/listContext.js.map +1 -1
- package/lib/components/List/renderList.js +2 -2
- package/lib/components/List/renderList.js.map +1 -1
- package/lib/components/List/useList.js +51 -12
- package/lib/components/List/useList.js.map +1 -1
- package/lib/components/List/useListContextValues.js.map +1 -1
- package/lib/components/List/useListStyles.styles.css.js +9 -0
- package/lib/components/List/useListStyles.styles.css.js.map +1 -0
- package/lib/components/List/useListStyles.styles.raw.css.js +9 -0
- package/lib/components/List/useListStyles.styles.raw.css.js.map +1 -0
- package/lib/components/List/useListStyles.styles.raw.js.map +1 -1
- package/lib/components/ListItem/ListItem.js.map +1 -1
- package/lib/components/ListItem/ListItem.module.css +25 -0
- package/lib/components/ListItem/ListItem.types.js +1 -1
- package/lib/components/ListItem/ListItem.types.js.map +1 -1
- package/lib/components/ListItem/index.js +1 -1
- package/lib/components/ListItem/index.js.map +1 -1
- package/lib/components/ListItem/renderListItem.js +2 -2
- package/lib/components/ListItem/renderListItem.js.map +1 -1
- package/lib/components/ListItem/useListItem.js +109 -51
- package/lib/components/ListItem/useListItem.js.map +1 -1
- package/lib/components/ListItem/useListItemStyles.styles.css.js +13 -0
- package/lib/components/ListItem/useListItemStyles.styles.css.js.map +1 -0
- package/lib/components/ListItem/useListItemStyles.styles.raw.css.js +13 -0
- package/lib/components/ListItem/useListItemStyles.styles.raw.css.js.map +1 -0
- package/lib/components/ListItem/useListItemStyles.styles.raw.js.map +1 -1
- package/lib/events/ListItemActionEvent.js.map +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/useListSelection.js.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/calculateListItemRoleForListRole.js.map +1 -1
- package/lib/utils/calculateListRole.js.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/validateGridCellsArePresent.js.map +1 -1
- package/lib/utils/validateListItemElement.js +17 -0
- package/lib/utils/validateListItemElement.js.map +1 -0
- package/lib/utils/validateProperElementTypes.js.map +1 -1
- package/lib/utils/validateProperRolesAreUsed.js.map +1 -1
- package/lib-commonjs/List.cjs +18 -6
- package/lib-commonjs/List.cjs.map +1 -1
- package/lib-commonjs/ListItem.cjs +9 -6
- package/lib-commonjs/ListItem.cjs.map +1 -1
- package/lib-commonjs/components/List/List.cjs.map +1 -1
- package/lib-commonjs/components/List/List.module.css +8 -0
- package/lib-commonjs/components/List/List.types.cjs.map +1 -1
- package/lib-commonjs/components/List/index.cjs +20 -6
- package/lib-commonjs/components/List/index.cjs.map +1 -1
- package/lib-commonjs/components/List/listContext.cjs +6 -6
- package/lib-commonjs/components/List/listContext.cjs.map +1 -1
- package/lib-commonjs/components/List/renderList.cjs.map +1 -1
- package/lib-commonjs/components/List/useList.cjs +53 -14
- package/lib-commonjs/components/List/useList.cjs.map +1 -1
- package/lib-commonjs/components/List/useListContextValues.cjs.map +1 -1
- package/lib-commonjs/components/List/useListStyles.styles.cjs +3 -3
- package/lib-commonjs/components/List/useListStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/List/useListStyles.styles.css.cjs +28 -0
- package/lib-commonjs/components/List/useListStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/List/useListStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/List/useListStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/List/useListStyles.styles.raw.css.cjs +28 -0
- package/lib-commonjs/components/List/useListStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/ListItem/ListItem.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/ListItem.module.css +25 -0
- package/lib-commonjs/components/ListItem/ListItem.types.cjs +1 -1
- package/lib-commonjs/components/ListItem/ListItem.types.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/index.cjs +9 -6
- package/lib-commonjs/components/ListItem/index.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/renderListItem.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/useListItem.cjs +110 -53
- package/lib-commonjs/components/ListItem/useListItem.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.cjs +3 -3
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.css.cjs +32 -0
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.raw.css.cjs +32 -0
- package/lib-commonjs/components/ListItem/useListItemStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/events/ListItemActionEvent.cjs +3 -3
- package/lib-commonjs/events/ListItemActionEvent.cjs.map +1 -1
- package/lib-commonjs/hooks/index.cjs.map +1 -1
- package/lib-commonjs/hooks/types.cjs.map +1 -1
- package/lib-commonjs/hooks/useListSelection.cjs.map +1 -1
- package/lib-commonjs/index.cjs +45 -11
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/utils/calculateListItemRoleForListRole.cjs.map +1 -1
- package/lib-commonjs/utils/calculateListRole.cjs.map +1 -1
- package/lib-commonjs/utils/index.cjs +10 -6
- package/lib-commonjs/utils/index.cjs.map +1 -1
- package/lib-commonjs/utils/validateGridCellsArePresent.cjs.map +1 -1
- package/lib-commonjs/utils/validateListItemElement.cjs +22 -0
- package/lib-commonjs/utils/validateListItemElement.cjs.map +1 -0
- package/lib-commonjs/utils/validateProperElementTypes.cjs.map +1 -1
- package/lib-commonjs/utils/validateProperRolesAreUsed.cjs.map +1 -1
- package/package.json +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-list
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sat, 31 Oct 2026 11:08:47 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.
|
|
7
|
+
## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-list_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Sat, 31 Oct 2026 11:08:47 GMT
|
|
10
10
|
|
|
11
11
|
### Changes
|
|
12
12
|
|
|
13
|
-
- Release 9.
|
|
14
|
-
- Bump @fluentui/keyboard-keys to v9.
|
|
15
|
-
- Bump @fluentui/react-checkbox to v9.
|
|
16
|
-
- Bump @fluentui/react-context-selector to v9.
|
|
17
|
-
- Bump @fluentui/react-jsx-runtime to v9.
|
|
18
|
-
- Bump @fluentui/react-shared-contexts to v9.
|
|
19
|
-
- Bump @fluentui/react-tabster to v9.
|
|
20
|
-
- Bump @fluentui/react-theme to v9.
|
|
21
|
-
- Bump @fluentui/react-utilities to v9.
|
|
13
|
+
- Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
14
|
+
- Bump @fluentui/keyboard-keys to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
15
|
+
- Bump @fluentui/react-checkbox to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-context-selector to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-tabster to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
- Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
|
+
- Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
22
|
+
|
|
23
|
+
## [9.7.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-list_v9.7.0)
|
|
24
|
+
|
|
25
|
+
Mon, 19 Oct 2026 16:49:00 GMT
|
|
26
|
+
|
|
27
|
+
### Minor changes
|
|
28
|
+
|
|
29
|
+
- feat: expose design-free List base hooks and context APIs with complete public types, editable-child validation, inferred roles, and explicit root support ([PR #36590](https://github.com/microsoft/fluentui/pull/36590) by dmytrokirpa@microsoft.com)
|
|
30
|
+
- Bump @fluentui/react-checkbox to v9.6.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
31
|
+
- Bump @fluentui/react-context-selector to v9.2.21 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
32
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
33
|
+
- Bump @fluentui/react-tabster to v9.26.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
34
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
22
35
|
|
|
23
36
|
## [9.6.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-list_v9.6.19)
|
|
24
37
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Checkbox } from '@fluentui/react-checkbox';
|
|
2
2
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
3
3
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
4
|
+
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
4
5
|
import type { EventData } from '@fluentui/react-utilities';
|
|
5
6
|
import type { EventHandler } from '@fluentui/react-utilities';
|
|
6
7
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
@@ -11,33 +12,62 @@ import type { SelectionMode as SelectionMode_2 } from '@fluentui/react-utilities
|
|
|
11
12
|
import type { Slot } from '@fluentui/react-utilities';
|
|
12
13
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Calculate the role for the list item based on the list role.
|
|
17
|
+
* @param listRole - the role of the list
|
|
18
|
+
* @returns proper role for the list item
|
|
19
|
+
*/
|
|
20
|
+
export declare const calculateListItemRoleForListRole: (listRole: string) => string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Calculate the role for the list based on the navigation mode and selectable state
|
|
24
|
+
* @param navigationMode - the navigation mode of the list
|
|
25
|
+
* @param selectable - whether the list is selectable
|
|
26
|
+
* @returns 'grid' if navigationMode is 'composite', otherwise 'listbox' if selectable or 'list' if not
|
|
27
|
+
*/
|
|
28
|
+
export declare const calculateListRole: (navigationMode: ListNavigationMode | undefined, selectable: boolean) => "grid" | "listbox" | "list";
|
|
29
|
+
|
|
14
30
|
export declare const List: ForwardRefComponent<ListProps>;
|
|
15
31
|
|
|
16
32
|
export declare const listClassNames: SlotClassNames<ListSlots>;
|
|
17
33
|
|
|
18
|
-
declare
|
|
34
|
+
export declare const ListContextProvider: React_2.Provider<ListContextValue | undefined> & React_2.FC<React_2.ProviderProps<ListContextValue | undefined>>;
|
|
35
|
+
|
|
36
|
+
export declare type ListContextValue = {
|
|
19
37
|
selection?: ListSelectionState;
|
|
20
38
|
validateListItem: (listItemElement: HTMLElement) => void;
|
|
21
39
|
};
|
|
22
40
|
|
|
23
|
-
declare type ListContextValues = {
|
|
41
|
+
export declare type ListContextValues = {
|
|
24
42
|
listContext: ListContextValue;
|
|
25
43
|
synchronousContext: ListSynchronousContextValue;
|
|
26
44
|
};
|
|
27
45
|
|
|
28
46
|
export declare const ListItem: ForwardRefComponent<ListItemProps>;
|
|
29
47
|
|
|
30
|
-
declare type
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
export declare type ListItemActionEventData = EventData<'ListItemAction', CustomEvent<{
|
|
49
|
+
originalEvent: React_2.MouseEvent | React_2.KeyboardEvent;
|
|
50
|
+
}>> & {
|
|
33
51
|
value: ListItemValue;
|
|
34
52
|
};
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
/**
|
|
55
|
+
* ListItem props accepted by `useListItemBase_unstable`.
|
|
56
|
+
*/
|
|
57
|
+
export declare type ListItemBaseProps = ComponentProps<ListItemBaseSlots> & Pick<ListItemProps, 'value' | 'onAction' | 'disabledSelection'>;
|
|
39
58
|
|
|
40
|
-
|
|
59
|
+
/**
|
|
60
|
+
* ListItem slots without any design dependency, used by `useListItemBase_unstable`.
|
|
61
|
+
*/
|
|
62
|
+
export declare type ListItemBaseSlots = {
|
|
63
|
+
root: NonNullable<Slot<'li', 'div'>>;
|
|
64
|
+
checkmark?: Slot<'input'>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* State returned by `useListItemBase_unstable`.
|
|
69
|
+
*/
|
|
70
|
+
export declare type ListItemBaseState = ComponentState<ListItemBaseSlots> & Pick<ListItemState, 'selectable' | 'navigable' | 'disabled'>;
|
|
41
71
|
|
|
42
72
|
export declare const listItemClassNames: SlotClassNames<ListItemSlots>;
|
|
43
73
|
|
|
@@ -64,9 +94,9 @@ export declare type ListItemState = ComponentState<ListItemSlots> & {
|
|
|
64
94
|
disabled?: boolean;
|
|
65
95
|
};
|
|
66
96
|
|
|
67
|
-
declare type ListItemValue = string | number;
|
|
97
|
+
export declare type ListItemValue = string | number;
|
|
68
98
|
|
|
69
|
-
declare type ListNavigationMode = 'items' | 'composite';
|
|
99
|
+
export declare type ListNavigationMode = 'items' | 'composite';
|
|
70
100
|
|
|
71
101
|
/**
|
|
72
102
|
* List Props
|
|
@@ -79,7 +109,7 @@ export declare type ListProps = ComponentProps<ListSlots> & {
|
|
|
79
109
|
onSelectionChange?: EventHandler<OnListSelectionChangeData>;
|
|
80
110
|
};
|
|
81
111
|
|
|
82
|
-
declare type ListSelectionState = {
|
|
112
|
+
export declare type ListSelectionState = {
|
|
83
113
|
isSelected: (item: string | number) => boolean;
|
|
84
114
|
toggleItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
85
115
|
deselectItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
@@ -99,12 +129,12 @@ export declare type ListSlots = {
|
|
|
99
129
|
*/
|
|
100
130
|
export declare type ListState = ComponentState<ListSlots> & ListContextValue & ListSynchronousContextValue;
|
|
101
131
|
|
|
102
|
-
declare type ListSynchronousContextValue = {
|
|
132
|
+
export declare type ListSynchronousContextValue = {
|
|
103
133
|
navigationMode: ListNavigationMode | undefined;
|
|
104
134
|
listItemRole: string;
|
|
105
135
|
};
|
|
106
136
|
|
|
107
|
-
declare type OnListSelectionChangeData = EventData<'change', React_2.SyntheticEvent> & {
|
|
137
|
+
export declare type OnListSelectionChangeData = EventData<'change', React_2.SyntheticEvent> & {
|
|
108
138
|
selectedItems: SelectionItemId[];
|
|
109
139
|
};
|
|
110
140
|
|
|
@@ -129,6 +159,21 @@ export declare const renderListItem_unstable: (state: ListItemState) => JSXEleme
|
|
|
129
159
|
*/
|
|
130
160
|
export declare const useList_unstable: (props: ListProps, ref: React_2.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>) => ListState;
|
|
131
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Base state hook for List, free of any focus or keyboard navigation runtime.
|
|
164
|
+
*
|
|
165
|
+
* Arrow key navigation is layered on by the wrapping `useList_unstable` hook, so consumers of this
|
|
166
|
+
* hook are expected to bring their own focus management.
|
|
167
|
+
*
|
|
168
|
+
* @param props - props from this instance of List
|
|
169
|
+
* @param ref - reference to root HTMLElement of List
|
|
170
|
+
*/
|
|
171
|
+
export declare const useListBase_unstable: (props: ListProps, ref: React_2.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>) => ListState;
|
|
172
|
+
|
|
173
|
+
export declare const useListContext_unstable: <T>(selector: ContextSelector<ListContextValue, T>) => T;
|
|
174
|
+
|
|
175
|
+
export declare function useListContextValues_unstable(state: ListState): ListContextValues;
|
|
176
|
+
|
|
132
177
|
/**
|
|
133
178
|
* Create the state required to render ListItem.
|
|
134
179
|
*
|
|
@@ -136,10 +181,22 @@ export declare const useList_unstable: (props: ListProps, ref: React_2.Ref<HTMLD
|
|
|
136
181
|
* before being passed to renderListItem_unstable.
|
|
137
182
|
*
|
|
138
183
|
* @param props - props from this instance of ListItem
|
|
139
|
-
* @param ref - reference to root HTMLLIElement |
|
|
184
|
+
* @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem
|
|
140
185
|
*/
|
|
141
186
|
export declare const useListItem_unstable: (props: ListItemProps, ref: React_2.Ref<HTMLLIElement | HTMLDivElement>) => ListItemState;
|
|
142
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Base state hook for ListItem, free of any focus or keyboard navigation runtime and of the
|
|
190
|
+
* Fluent `Checkbox` used for the selection indicator.
|
|
191
|
+
*
|
|
192
|
+
* The checkmark slot is rendered as a native `input[type="checkbox"]`, and the Tabster driven
|
|
193
|
+
* arrow key handling is layered on by the wrapping `useListItem_unstable` hook.
|
|
194
|
+
*
|
|
195
|
+
* @param props - props from this instance of ListItem
|
|
196
|
+
* @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem
|
|
197
|
+
*/
|
|
198
|
+
export declare const useListItemBase_unstable: (props: ListItemBaseProps, ref: React_2.Ref<HTMLLIElement | HTMLDivElement>) => ListItemBaseState;
|
|
199
|
+
|
|
143
200
|
/**
|
|
144
201
|
* Apply styling to the ListItem slots based on the state
|
|
145
202
|
*/
|
|
@@ -150,4 +207,51 @@ export declare const useListItemStyles_unstable: (state: ListItemState) => ListI
|
|
|
150
207
|
*/
|
|
151
208
|
export declare const useListStyles_unstable: (state: ListState) => ListState;
|
|
152
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Validates that grid cells are present in a grid list item. This is necessary for proper screen reader support.
|
|
212
|
+
* If grid cells are not present and we're not running in production mode, a warning will be logged to the console.
|
|
213
|
+
* @param listRole - The role of the list
|
|
214
|
+
* @param listItemEl - The list item element
|
|
215
|
+
* @returns
|
|
216
|
+
*/
|
|
217
|
+
export declare const validateGridCellsArePresent: (listRole: string, listItemEl: HTMLElement) => void;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Runs the development time validations for a single list item element.
|
|
221
|
+
*
|
|
222
|
+
* The focusable children detection is passed in so that callers can choose between a Tabster
|
|
223
|
+
* aware implementation and a plain DOM one.
|
|
224
|
+
*/
|
|
225
|
+
export declare const validateListItemElement: (listItemEl: HTMLElement, { listRenderedAs, listRole, hasSelection, hasFocusableChildren }: ValidateListItemElementOptions) => void;
|
|
226
|
+
|
|
227
|
+
export declare type ValidateListItemElementOptions = {
|
|
228
|
+
/** The element type the parent List renders as. */
|
|
229
|
+
listRenderedAs: string;
|
|
230
|
+
/** The resolved role of the parent List. */
|
|
231
|
+
listRole: string;
|
|
232
|
+
/** Whether the parent List has selection enabled. */
|
|
233
|
+
hasSelection: boolean;
|
|
234
|
+
/** Whether the list item contains focusable children. */
|
|
235
|
+
hasFocusableChildren: boolean;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Validates that the List and ListItem elements are compatible
|
|
240
|
+
* @param listRenderedAs - the type of the parent element
|
|
241
|
+
* @param listItemRenderedAs - the type of the child element
|
|
242
|
+
*/
|
|
243
|
+
export declare function validateProperElementTypes(listRenderedAs?: string, listItemRenderedAs?: string): void;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Validate that the proper roles are used for the given combination of roles and states.
|
|
247
|
+
* If the roles are invalid and we're not running in production mode, an warning will be logged to the console.
|
|
248
|
+
*
|
|
249
|
+
* @param role - the role of the list
|
|
250
|
+
* @param listItemRole - the role of the list item
|
|
251
|
+
* @param hasSelection - whether the list has selection enabled
|
|
252
|
+
* @param hasFocusableChildren - whether the list has focusable children
|
|
253
|
+
* @returns
|
|
254
|
+
*/
|
|
255
|
+
export declare const validateProperRolesAreUsed: (role: string, listItemRole: string, hasSelection: boolean, hasFocusableChildren: boolean) => void;
|
|
256
|
+
|
|
153
257
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Checkbox } from '@fluentui/react-checkbox';
|
|
2
2
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
3
3
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
4
|
+
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
4
5
|
import type { EventData } from '@fluentui/react-utilities';
|
|
5
6
|
import type { EventHandler } from '@fluentui/react-utilities';
|
|
6
7
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
@@ -11,33 +12,62 @@ import type { SelectionMode as SelectionMode_2 } from '@fluentui/react-utilities
|
|
|
11
12
|
import type { Slot } from '@fluentui/react-utilities';
|
|
12
13
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Calculate the role for the list item based on the list role.
|
|
17
|
+
* @param listRole - the role of the list
|
|
18
|
+
* @returns proper role for the list item
|
|
19
|
+
*/
|
|
20
|
+
export declare const calculateListItemRoleForListRole: (listRole: string) => string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Calculate the role for the list based on the navigation mode and selectable state
|
|
24
|
+
* @param navigationMode - the navigation mode of the list
|
|
25
|
+
* @param selectable - whether the list is selectable
|
|
26
|
+
* @returns 'grid' if navigationMode is 'composite', otherwise 'listbox' if selectable or 'list' if not
|
|
27
|
+
*/
|
|
28
|
+
export declare const calculateListRole: (navigationMode: ListNavigationMode | undefined, selectable: boolean) => "grid" | "listbox" | "list";
|
|
29
|
+
|
|
14
30
|
export declare const List: ForwardRefComponent<ListProps>;
|
|
15
31
|
|
|
16
32
|
export declare const listClassNames: SlotClassNames<ListSlots>;
|
|
17
33
|
|
|
18
|
-
declare
|
|
34
|
+
export declare const ListContextProvider: React_2.Provider<ListContextValue | undefined> & React_2.FC<React_2.ProviderProps<ListContextValue | undefined>>;
|
|
35
|
+
|
|
36
|
+
export declare type ListContextValue = {
|
|
19
37
|
selection?: ListSelectionState;
|
|
20
38
|
validateListItem: (listItemElement: HTMLElement) => void;
|
|
21
39
|
};
|
|
22
40
|
|
|
23
|
-
declare type ListContextValues = {
|
|
41
|
+
export declare type ListContextValues = {
|
|
24
42
|
listContext: ListContextValue;
|
|
25
43
|
synchronousContext: ListSynchronousContextValue;
|
|
26
44
|
};
|
|
27
45
|
|
|
28
46
|
export declare const ListItem: ForwardRefComponent<ListItemProps>;
|
|
29
47
|
|
|
30
|
-
declare type
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
export declare type ListItemActionEventData = EventData<'ListItemAction', CustomEvent<{
|
|
49
|
+
originalEvent: React_2.MouseEvent | React_2.KeyboardEvent;
|
|
50
|
+
}>> & {
|
|
33
51
|
value: ListItemValue;
|
|
34
52
|
};
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
/**
|
|
55
|
+
* ListItem props accepted by `useListItemBase_unstable`.
|
|
56
|
+
*/
|
|
57
|
+
export declare type ListItemBaseProps = ComponentProps<ListItemBaseSlots> & Pick<ListItemProps, 'value' | 'onAction' | 'disabledSelection'>;
|
|
39
58
|
|
|
40
|
-
|
|
59
|
+
/**
|
|
60
|
+
* ListItem slots without any design dependency, used by `useListItemBase_unstable`.
|
|
61
|
+
*/
|
|
62
|
+
export declare type ListItemBaseSlots = {
|
|
63
|
+
root: NonNullable<Slot<'li', 'div'>>;
|
|
64
|
+
checkmark?: Slot<'input'>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* State returned by `useListItemBase_unstable`.
|
|
69
|
+
*/
|
|
70
|
+
export declare type ListItemBaseState = ComponentState<ListItemBaseSlots> & Pick<ListItemState, 'selectable' | 'navigable' | 'disabled'>;
|
|
41
71
|
|
|
42
72
|
export declare const listItemClassNames: SlotClassNames<ListItemSlots>;
|
|
43
73
|
|
|
@@ -64,9 +94,9 @@ export declare type ListItemState = ComponentState<ListItemSlots> & {
|
|
|
64
94
|
disabled?: boolean;
|
|
65
95
|
};
|
|
66
96
|
|
|
67
|
-
declare type ListItemValue = string | number;
|
|
97
|
+
export declare type ListItemValue = string | number;
|
|
68
98
|
|
|
69
|
-
declare type ListNavigationMode = 'items' | 'composite';
|
|
99
|
+
export declare type ListNavigationMode = 'items' | 'composite';
|
|
70
100
|
|
|
71
101
|
/**
|
|
72
102
|
* List Props
|
|
@@ -79,7 +109,7 @@ export declare type ListProps = ComponentProps<ListSlots> & {
|
|
|
79
109
|
onSelectionChange?: EventHandler<OnListSelectionChangeData>;
|
|
80
110
|
};
|
|
81
111
|
|
|
82
|
-
declare type ListSelectionState = {
|
|
112
|
+
export declare type ListSelectionState = {
|
|
83
113
|
isSelected: (item: string | number) => boolean;
|
|
84
114
|
toggleItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
85
115
|
deselectItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
@@ -99,12 +129,12 @@ export declare type ListSlots = {
|
|
|
99
129
|
*/
|
|
100
130
|
export declare type ListState = ComponentState<ListSlots> & ListContextValue & ListSynchronousContextValue;
|
|
101
131
|
|
|
102
|
-
declare type ListSynchronousContextValue = {
|
|
132
|
+
export declare type ListSynchronousContextValue = {
|
|
103
133
|
navigationMode: ListNavigationMode | undefined;
|
|
104
134
|
listItemRole: string;
|
|
105
135
|
};
|
|
106
136
|
|
|
107
|
-
declare type OnListSelectionChangeData = EventData<'change', React_2.SyntheticEvent> & {
|
|
137
|
+
export declare type OnListSelectionChangeData = EventData<'change', React_2.SyntheticEvent> & {
|
|
108
138
|
selectedItems: SelectionItemId[];
|
|
109
139
|
};
|
|
110
140
|
|
|
@@ -129,6 +159,21 @@ export declare const renderListItem_unstable: (state: ListItemState) => JSXEleme
|
|
|
129
159
|
*/
|
|
130
160
|
export declare const useList_unstable: (props: ListProps, ref: React_2.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>) => ListState;
|
|
131
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Base state hook for List, free of any focus or keyboard navigation runtime.
|
|
164
|
+
*
|
|
165
|
+
* Arrow key navigation is layered on by the wrapping `useList_unstable` hook, so consumers of this
|
|
166
|
+
* hook are expected to bring their own focus management.
|
|
167
|
+
*
|
|
168
|
+
* @param props - props from this instance of List
|
|
169
|
+
* @param ref - reference to root HTMLElement of List
|
|
170
|
+
*/
|
|
171
|
+
export declare const useListBase_unstable: (props: ListProps, ref: React_2.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>) => ListState;
|
|
172
|
+
|
|
173
|
+
export declare const useListContext_unstable: <T>(selector: ContextSelector<ListContextValue, T>) => T;
|
|
174
|
+
|
|
175
|
+
export declare function useListContextValues_unstable(state: ListState): ListContextValues;
|
|
176
|
+
|
|
132
177
|
/**
|
|
133
178
|
* Create the state required to render ListItem.
|
|
134
179
|
*
|
|
@@ -136,10 +181,22 @@ export declare const useList_unstable: (props: ListProps, ref: React_2.Ref<HTMLD
|
|
|
136
181
|
* before being passed to renderListItem_unstable.
|
|
137
182
|
*
|
|
138
183
|
* @param props - props from this instance of ListItem
|
|
139
|
-
* @param ref - reference to root HTMLLIElement |
|
|
184
|
+
* @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem
|
|
140
185
|
*/
|
|
141
186
|
export declare const useListItem_unstable: (props: ListItemProps, ref: React_2.Ref<HTMLLIElement | HTMLDivElement>) => ListItemState;
|
|
142
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Base state hook for ListItem, free of any focus or keyboard navigation runtime and of the
|
|
190
|
+
* Fluent `Checkbox` used for the selection indicator.
|
|
191
|
+
*
|
|
192
|
+
* The checkmark slot is rendered as a native `input[type="checkbox"]`, and the Tabster driven
|
|
193
|
+
* arrow key handling is layered on by the wrapping `useListItem_unstable` hook.
|
|
194
|
+
*
|
|
195
|
+
* @param props - props from this instance of ListItem
|
|
196
|
+
* @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem
|
|
197
|
+
*/
|
|
198
|
+
export declare const useListItemBase_unstable: (props: ListItemBaseProps, ref: React_2.Ref<HTMLLIElement | HTMLDivElement>) => ListItemBaseState;
|
|
199
|
+
|
|
143
200
|
/**
|
|
144
201
|
* Apply styling to the ListItem slots based on the state
|
|
145
202
|
*/
|
|
@@ -150,4 +207,51 @@ export declare const useListItemStyles_unstable: (state: ListItemState) => ListI
|
|
|
150
207
|
*/
|
|
151
208
|
export declare const useListStyles_unstable: (state: ListState) => ListState;
|
|
152
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Validates that grid cells are present in a grid list item. This is necessary for proper screen reader support.
|
|
212
|
+
* If grid cells are not present and we're not running in production mode, a warning will be logged to the console.
|
|
213
|
+
* @param listRole - The role of the list
|
|
214
|
+
* @param listItemEl - The list item element
|
|
215
|
+
* @returns
|
|
216
|
+
*/
|
|
217
|
+
export declare const validateGridCellsArePresent: (listRole: string, listItemEl: HTMLElement) => void;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Runs the development time validations for a single list item element.
|
|
221
|
+
*
|
|
222
|
+
* The focusable children detection is passed in so that callers can choose between a Tabster
|
|
223
|
+
* aware implementation and a plain DOM one.
|
|
224
|
+
*/
|
|
225
|
+
export declare const validateListItemElement: (listItemEl: HTMLElement, { listRenderedAs, listRole, hasSelection, hasFocusableChildren }: ValidateListItemElementOptions) => void;
|
|
226
|
+
|
|
227
|
+
export declare type ValidateListItemElementOptions = {
|
|
228
|
+
/** The element type the parent List renders as. */
|
|
229
|
+
listRenderedAs: string;
|
|
230
|
+
/** The resolved role of the parent List. */
|
|
231
|
+
listRole: string;
|
|
232
|
+
/** Whether the parent List has selection enabled. */
|
|
233
|
+
hasSelection: boolean;
|
|
234
|
+
/** Whether the list item contains focusable children. */
|
|
235
|
+
hasFocusableChildren: boolean;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Validates that the List and ListItem elements are compatible
|
|
240
|
+
* @param listRenderedAs - the type of the parent element
|
|
241
|
+
* @param listItemRenderedAs - the type of the child element
|
|
242
|
+
*/
|
|
243
|
+
export declare function validateProperElementTypes(listRenderedAs?: string, listItemRenderedAs?: string): void;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Validate that the proper roles are used for the given combination of roles and states.
|
|
247
|
+
* If the roles are invalid and we're not running in production mode, an warning will be logged to the console.
|
|
248
|
+
*
|
|
249
|
+
* @param role - the role of the list
|
|
250
|
+
* @param listItemRole - the role of the list item
|
|
251
|
+
* @param hasSelection - whether the list has selection enabled
|
|
252
|
+
* @param hasFocusableChildren - whether the list has focusable children
|
|
253
|
+
* @returns
|
|
254
|
+
*/
|
|
255
|
+
export declare const validateProperRolesAreUsed: (role: string, listItemRole: string, hasSelection: boolean, hasFocusableChildren: boolean) => void;
|
|
256
|
+
|
|
153
257
|
export { }
|
package/lib/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { List, listClassNames, renderList_unstable, useListStyles_unstable, useList_unstable } from "./components/List/index.js";
|
|
1
|
+
export { List, ListContextProvider, listClassNames, renderList_unstable, useListBase_unstable, useListContextValues_unstable, useListContext_unstable, useListStyles_unstable, useList_unstable } from "./components/List/index.js";
|
package/lib/List.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/List.ts"],"sourcesContent":["export type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n OnListSelectionChangeData,\n} from './components/List/index';\nexport {\n List,\n listClassNames,\n renderList_unstable,\n useListStyles_unstable,\n useList_unstable,\n} from './components/List/index';\n"],"names":["List","listClassNames","renderList_unstable","useListStyles_unstable","useList_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/List.ts"],"sourcesContent":["export type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n ListSynchronousContextValue,\n OnListSelectionChangeData,\n} from './components/List/index';\nexport {\n List,\n ListContextProvider,\n listClassNames,\n renderList_unstable,\n useListBase_unstable,\n useListContextValues_unstable,\n useListContext_unstable,\n useListStyles_unstable,\n useList_unstable,\n} from './components/List/index';\n"],"names":["List","ListContextProvider","listClassNames","renderList_unstable","useListBase_unstable","useListContextValues_unstable","useListContext_unstable","useListStyles_unstable","useList_unstable"],"mappings":"AAUA,SACEA,IAAI,EACJC,mBAAmB,EACnBC,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,6BAA6B,EAC7BC,uBAAuB,EACvBC,sBAAsB,EACtBC,gBAAgB,QACX,6BAA0B"}
|
package/lib/ListItem.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ListItem, listItemClassNames, renderListItem_unstable, useListItemStyles_unstable, useListItem_unstable } from "./components/ListItem/index.js";
|
|
1
|
+
export { ListItem, listItemClassNames, renderListItem_unstable, useListItemBase_unstable, useListItemStyles_unstable, useListItem_unstable } from "./components/ListItem/index.js";
|
package/lib/ListItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ListItem.ts"],"sourcesContent":["export type {\n ListItemActionEventData,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './components/ListItem/index';\nexport {\n ListItem,\n listItemClassNames,\n renderListItem_unstable,\n useListItemStyles_unstable,\n useListItem_unstable,\n} from './components/ListItem/index';\n"],"names":["ListItem","listItemClassNames","renderListItem_unstable","useListItemStyles_unstable","useListItem_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/ListItem.ts"],"sourcesContent":["export type {\n ListItemActionEventData,\n ListItemBaseProps,\n ListItemBaseSlots,\n ListItemBaseState,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './components/ListItem/index';\nexport {\n ListItem,\n listItemClassNames,\n renderListItem_unstable,\n useListItemBase_unstable,\n useListItemStyles_unstable,\n useListItem_unstable,\n} from './components/ListItem/index';\n"],"names":["ListItem","listItemClassNames","renderListItem_unstable","useListItemBase_unstable","useListItemStyles_unstable","useListItem_unstable"],"mappings":"AAUA,SACEA,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,wBAAwB,EACxBC,0BAA0B,EAC1BC,oBAAoB,QACf,iCAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/List/List.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useList_unstable } from './useList';\nimport { renderList_unstable } from './renderList';\nimport { useListStyles_unstable } from './useListStyles.styles';\nimport type { ListProps } from './List.types';\nimport { useListContextValues_unstable } from './useListContextValues';\n\nexport const List: ForwardRefComponent<ListProps> = React.forwardRef((props, ref) => {\n const state = useList_unstable(props, ref);\n const contextValues = useListContextValues_unstable(state);\n\n useListStyles_unstable(state);\n useCustomStyleHook_unstable('useListStyles_unstable')(state);\n\n return renderList_unstable(state, contextValues);\n});\n\nList.displayName = 'List';\n"],"names":["React","useCustomStyleHook_unstable","useList_unstable","renderList_unstable","useListStyles_unstable","useListContextValues_unstable","List","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,gBAAgB,QAAQ,eAAY;AAC7C,SAASC,mBAAmB,QAAQ,kBAAe;AACnD,SAASC,sBAAsB,QAAQ,4BAAyB;AAEhE,SAASC,6BAA6B,QAAQ,4BAAyB;AAEvE,OAAO,MAAMC,qBAAuCN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC3E,MAAMC,QAAQR,iBAAiBM,OAAOC;IACtC,MAAME,gBAAgBN,8BAA8BK;IAEpDN,uBAAuBM;IACvBT,4BAA4B,0BAA0BS;IAEtD,OAAOP,oBAAoBO,OAAOC;AACpC,GAAG;AAEHL,KAAKM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/List/List.types.ts"],"sourcesContent":["import type * as React from 'react';\n\nimport type {\n ComponentProps,\n ComponentState,\n Slot,\n SelectionMode,\n SelectionItemId,\n EventHandler,\n EventData,\n} from '@fluentui/react-utilities';\nimport type { ListSelectionState } from '../../hooks/types';\n\nexport type ListSlots = {\n root: NonNullable<Slot<'ul', 'div' | 'ol'>>;\n};\n\nexport type OnListSelectionChangeData = EventData<'change', React.SyntheticEvent> & {\n selectedItems: SelectionItemId[];\n};\n\nexport type ListNavigationMode = 'items' | 'composite';\n\n/**\n * List Props\n */\nexport type ListProps = ComponentProps<ListSlots> & {\n navigationMode?: ListNavigationMode;\n selectionMode?: SelectionMode;\n selectedItems?: SelectionItemId[];\n defaultSelectedItems?: SelectionItemId[];\n onSelectionChange?: EventHandler<OnListSelectionChangeData>;\n};\n\nexport type ListContextValue = {\n selection?: ListSelectionState;\n validateListItem: (listItemElement: HTMLElement) => void;\n};\n\nexport type ListSynchronousContextValue = {\n navigationMode: ListNavigationMode | undefined;\n listItemRole: string;\n};\n\nexport type ListContextValues = {\n listContext: ListContextValue;\n synchronousContext: ListSynchronousContextValue;\n};\n\n/**\n * State used in rendering List\n */\nexport type ListState = ComponentState<ListSlots> & ListContextValue & ListSynchronousContextValue;\n"],"names":[],"mappings":"AAiDA;;CAEC,GACD,WAAmG"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { List } from "./List.js";
|
|
2
2
|
export { renderList_unstable } from "./renderList.js";
|
|
3
|
-
export { useList_unstable } from "./useList.js";
|
|
3
|
+
export { useList_unstable, useListBase_unstable } from "./useList.js";
|
|
4
|
+
export { useListContextValues_unstable } from "./useListContextValues.js";
|
|
5
|
+
export { ListContextProvider, useListContext_unstable } from "./listContext.js";
|
|
4
6
|
export { listClassNames, useListStyles_unstable } from "./useListStyles.styles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/List/index.ts"],"sourcesContent":["export { List } from './List';\nexport type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n OnListSelectionChangeData,\n} from './List.types';\nexport { renderList_unstable } from './renderList';\nexport { useList_unstable, useListBase_unstable } from './useList';\nexport { useListContextValues_unstable } from './useListContextValues';\nexport { ListContextProvider, useListContext_unstable } from './listContext';\nexport { listClassNames, useListStyles_unstable } from './useListStyles.styles';\nexport type { ListSynchronousContextValue } from './List.types';\n"],"names":["List","renderList_unstable","useList_unstable","useListBase_unstable","useListContextValues_unstable","ListContextProvider","useListContext_unstable","listClassNames","useListStyles_unstable"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAS;AAU9B,SAASC,mBAAmB,QAAQ,kBAAe;AACnD,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,eAAY;AACnE,SAASC,6BAA6B,QAAQ,4BAAyB;AACvE,SAASC,mBAAmB,EAAEC,uBAAuB,QAAQ,mBAAgB;AAC7E,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,4BAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/List/listContext.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector } from '@fluentui/react-context-selector';\nimport type { ListSynchronousContextValue, ListContextValue } from './List.types';\nimport * as React from 'react';\n\nexport const listContextDefaultValue: ListContextValue = {\n selection: undefined,\n validateListItem: () => {\n /* noop */\n },\n};\n\nconst listContext = createContext<ListContextValue | undefined>(undefined);\n\nexport const ListContextProvider = listContext.Provider;\n\nexport const useListContext_unstable = <T>(selector: ContextSelector<ListContextValue, T>): T =>\n useContextSelector(listContext, (ctx = listContextDefaultValue) => selector(ctx));\n\n// This is a context that uses the standard, React Context API.\n// The reason why this exists is that the Fluent UI Context Provider replaces the\n// React Context Provider with a custom one that needs a layout effect to update the context value.\n// This results in issues with element/role validation, as the ListItem component has not been updated yet\n// when the validation happens.\n// https://github.com/microsoft/fluentui/issues/34467\nconst ListSynchronousContext = React.createContext<ListSynchronousContextValue | undefined>(undefined);\n\nexport const ListSynchronousContextProvider = ListSynchronousContext.Provider;\nexport const useListSynchronousContext = (): ListSynchronousContextValue =>\n React.useContext(ListSynchronousContext) || {\n navigationMode: undefined,\n listItemRole: 'listitem',\n };\n"],"names":["createContext","useContextSelector","React","listContextDefaultValue","selection","undefined","validateListItem","listContext","ListContextProvider","Provider","useListContext_unstable","selector","ctx","ListSynchronousContext","ListSynchronousContextProvider","useListSynchronousContext","useContext","navigationMode","listItemRole"],"mappings":"AAAA;AAEA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,mCAAmC;AAGrF,YAAYC,WAAW,QAAQ;AAE/B,OAAO,MAAMC,0BAA4C;IACvDC,WAAWC;IACXC,kBAAkB;IAChB,QAAQ,GACV;AACF,EAAE;AAEF,MAAMC,cAAcP,cAA4CK;AAEhE,OAAO,MAAMG,sBAAsBD,YAAYE,QAAQ,CAAC;AAExD,OAAO,MAAMC,0BAA0B,CAAIC,WACzCV,mBAAmBM,aAAa,CAACK,MAAMT,uBAAuB,GAAKQ,SAASC,MAAM;AAEpF,+DAA+D;AAC/D,iFAAiF;AACjF,mGAAmG;AACnG,0GAA0G;AAC1G,+BAA+B;AAC/B,qDAAqD;AACrD,MAAMC,yBAAyBX,MAAMF,aAAa,CAA0CK;AAE5F,OAAO,MAAMS,iCAAiCD,uBAAuBJ,QAAQ,CAAC;AAC9E,OAAO,MAAMM,4BAA4B,IACvCb,MAAMc,UAAU,CAACH,2BAA2B;QAC1CI,gBAAgBZ;QAChBa,cAAc;IAChB,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { assertSlots } from "@fluentui/react-utilities";
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
import { ListContextProvider, ListSynchronousContextProvider } from "./listContext.js";
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of List
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/List/renderList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { ListState, ListSlots, ListContextValues } from './List.types';\nimport { ListContextProvider, ListSynchronousContextProvider } from './listContext';\n\n/**\n * Render the final JSX of List\n */\nexport const renderList_unstable = (state: ListState, contextValues: ListContextValues): JSXElement => {\n assertSlots<ListSlots>(state);\n\n return (\n <ListContextProvider value={contextValues.listContext}>\n <ListSynchronousContextProvider value={contextValues.synchronousContext}>\n <state.root />\n </ListSynchronousContextProvider>\n </ListContextProvider>\n );\n};\n"],"names":["assertSlots","ListContextProvider","ListSynchronousContextProvider","renderList_unstable","state","contextValues","value","listContext","synchronousContext","root"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,mBAAmB,EAAEC,8BAA8B,QAAQ,mBAAgB;AAEpF;;CAEC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAkBC;IACpDL,YAAuBI;IAEvB,qBACE,KAACH;QAAoBK,OAAOD,cAAcE,WAAW;kBACnD,cAAA,KAACL;YAA+BI,OAAOD,cAAcG,kBAAkB;sBACrE,cAAA,KAACJ,MAAMK,IAAI;;;AAInB,EAAE"}
|