@fluentui/react-migration-v0-v9 9.0.54 → 9.1.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 +20 -4
- package/dist/index.d.ts +181 -0
- package/lib/components/List/List/List.js +14 -0
- package/lib/components/List/List/List.js.map +1 -0
- package/lib/components/List/List/List.types.js +1 -0
- package/lib/components/List/List/List.types.js.map +1 -0
- package/lib/components/List/List/index.js +5 -0
- package/lib/components/List/List/index.js.map +1 -0
- package/lib/components/List/List/listContext.js +9 -0
- package/lib/components/List/List/listContext.js.map +1 -0
- package/lib/components/List/List/renderList.js +12 -0
- package/lib/components/List/List/renderList.js.map +1 -0
- package/lib/components/List/List/useList.js +65 -0
- package/lib/components/List/List/useList.js.map +1 -0
- package/lib/components/List/List/useListContextValues.js +13 -0
- package/lib/components/List/List/useListContextValues.js.map +1 -0
- package/lib/components/List/List/useListStyles.styles.js +33 -0
- package/lib/components/List/List/useListStyles.styles.js.map +1 -0
- package/lib/components/List/ListItem/ListItem.js +12 -0
- package/lib/components/List/ListItem/ListItem.js.map +1 -0
- package/lib/components/List/ListItem/ListItem.types.js +1 -0
- package/lib/components/List/ListItem/ListItem.types.js.map +1 -0
- package/lib/components/List/ListItem/index.js +5 -0
- package/lib/components/List/ListItem/index.js.map +1 -0
- package/lib/components/List/ListItem/renderListItem.js +19 -0
- package/lib/components/List/ListItem/renderListItem.js.map +1 -0
- package/lib/components/List/ListItem/useListItem.js +118 -0
- package/lib/components/List/ListItem/useListItem.js.map +1 -0
- package/lib/components/List/ListItem/useListItemStyles.styles.js +58 -0
- package/lib/components/List/ListItem/useListItemStyles.styles.js.map +1 -0
- package/lib/components/List/hooks/index.js +1 -0
- package/lib/components/List/hooks/index.js.map +1 -0
- package/lib/components/List/hooks/types.js +1 -0
- package/lib/components/List/hooks/types.js.map +1 -0
- package/lib/components/List/hooks/useListSelection.js +41 -0
- package/lib/components/List/hooks/useListSelection.js.map +1 -0
- package/lib/components/List/index.js +3 -0
- package/lib/components/List/index.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/List/List/List.js +25 -0
- package/lib-commonjs/components/List/List/List.js.map +1 -0
- package/lib-commonjs/components/List/List/List.types.js +6 -0
- package/lib-commonjs/components/List/List/List.types.js.map +1 -0
- package/lib-commonjs/components/List/List/index.js +10 -0
- package/lib-commonjs/components/List/List/index.js.map +1 -0
- package/lib-commonjs/components/List/List/listContext.js +30 -0
- package/lib-commonjs/components/List/List/listContext.js.map +1 -0
- package/lib-commonjs/components/List/List/renderList.js +20 -0
- package/lib-commonjs/components/List/List/renderList.js.map +1 -0
- package/lib-commonjs/components/List/List/useList.js +68 -0
- package/lib-commonjs/components/List/List/useList.js.map +1 -0
- package/lib-commonjs/components/List/List/useListContextValues.js +23 -0
- package/lib-commonjs/components/List/List/useListContextValues.js.map +1 -0
- package/lib-commonjs/components/List/List/useListStyles.styles.js +51 -0
- package/lib-commonjs/components/List/List/useListStyles.styles.js.map +1 -0
- package/lib-commonjs/components/List/ListItem/ListItem.js +23 -0
- package/lib-commonjs/components/List/ListItem/ListItem.js.map +1 -0
- package/lib-commonjs/components/List/ListItem/ListItem.types.js +6 -0
- package/lib-commonjs/components/List/ListItem/ListItem.types.js.map +1 -0
- package/lib-commonjs/components/List/ListItem/index.js +10 -0
- package/lib-commonjs/components/List/ListItem/index.js.map +1 -0
- package/lib-commonjs/components/List/ListItem/renderListItem.js +27 -0
- package/lib-commonjs/components/List/ListItem/renderListItem.js.map +1 -0
- package/lib-commonjs/components/List/ListItem/useListItem.js +121 -0
- package/lib-commonjs/components/List/ListItem/useListItem.js.map +1 -0
- package/lib-commonjs/components/List/ListItem/useListItemStyles.styles.js +85 -0
- package/lib-commonjs/components/List/ListItem/useListItemStyles.styles.js.map +1 -0
- package/lib-commonjs/components/List/hooks/index.js +6 -0
- package/lib-commonjs/components/List/hooks/index.js.map +1 -0
- package/lib-commonjs/components/List/hooks/types.js +6 -0
- package/lib-commonjs/components/List/hooks/types.js.map +1 -0
- package/lib-commonjs/components/List/hooks/useListSelection.js +52 -0
- package/lib-commonjs/components/List/hooks/useListSelection.js.map +1 -0
- package/lib-commonjs/components/List/index.js +48 -0
- package/lib-commonjs/components/List/index.js.map +1 -0
- package/lib-commonjs/index.js +34 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-migration-v0-v9
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 14 Dec 2023 09:51:34 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.1.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-migration-v0-v9_v9.1.0)
|
|
8
|
+
|
|
9
|
+
Thu, 14 Dec 2023 09:51:34 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-migration-v0-v9_v9.0.54..@fluentui/react-migration-v0-v9_v9.1.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: List v0 migration shim ([PR #29975](https://github.com/microsoft/fluentui/pull/29975) by jirivyhnalek@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-aria to v9.5.0 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
16
|
+
- Bump @fluentui/react-components to v9.43.0 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
17
|
+
- Bump @fluentui/react-context-selector to v9.1.43 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
18
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.21 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
19
|
+
- Bump @fluentui/react-shared-contexts to v9.13.1 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
20
|
+
- Bump @fluentui/react-tabster to v9.15.1 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
21
|
+
- Bump @fluentui/react-utilities to v9.15.3 ([commit](https://github.com/microsoft/fluentui/commit/80a1b02be2fbbdde916ac87fbf760e442a2295c4) by beachball)
|
|
22
|
+
|
|
7
23
|
## [9.0.54](https://github.com/microsoft/fluentui/tree/@fluentui/react-migration-v0-v9_v9.0.54)
|
|
8
24
|
|
|
9
|
-
Thu, 30 Nov 2023 13:
|
|
25
|
+
Thu, 30 Nov 2023 13:42:08 GMT
|
|
10
26
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-migration-v0-v9_v9.0.53..@fluentui/react-migration-v0-v9_v9.0.54)
|
|
11
27
|
|
|
12
28
|
### Patches
|
|
13
29
|
|
|
14
|
-
- Bump @fluentui/react-jsx-runtime to v9.0.20 ([PR #
|
|
15
|
-
- Bump @fluentui/react-components to v9.42.0 ([PR #
|
|
30
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.20 ([PR #29929](https://github.com/microsoft/fluentui/pull/29929) by beachball)
|
|
31
|
+
- Bump @fluentui/react-components to v9.42.0 ([PR #29929](https://github.com/microsoft/fluentui/pull/29929) by beachball)
|
|
16
32
|
|
|
17
33
|
## [9.0.53](https://github.com/microsoft/fluentui/tree/@fluentui/react-migration-v0-v9_v9.0.53)
|
|
18
34
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
1
3
|
import { ComponentProps } from '@fluentui/react-components';
|
|
4
|
+
import type { ComponentProps as ComponentProps_2 } from '@fluentui/react-utilities';
|
|
5
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
6
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
2
7
|
import { GriffelStyle } from '@fluentui/react-components';
|
|
3
8
|
import { ObjectOf } from '@fluentui/react-northstar';
|
|
4
9
|
import type { ObjectShorthandValue } from '@fluentui/react-northstar';
|
|
5
10
|
import * as React_2 from 'react';
|
|
11
|
+
import { SelectionHookParams } from '@fluentui/react-utilities';
|
|
12
|
+
import { SelectionItemId } from '@fluentui/react-utilities';
|
|
13
|
+
import type { SelectionMode as SelectionMode_2 } from '@fluentui/react-utilities';
|
|
6
14
|
import { Slot } from '@fluentui/react-components';
|
|
7
15
|
import { Slot as Slot_2 } from '@fluentui/react-utilities';
|
|
16
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
8
17
|
import { SlotRenderFunction } from '@fluentui/react-utilities';
|
|
9
18
|
|
|
10
19
|
export declare const Flex: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLElement> & FlexProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -125,6 +134,134 @@ declare type ItemLayoutSlots = {
|
|
|
125
134
|
endMedia?: Slot_2<'div'>;
|
|
126
135
|
};
|
|
127
136
|
|
|
137
|
+
export declare const List: ForwardRefComponent<ListProps>;
|
|
138
|
+
|
|
139
|
+
export declare const listClassNames: SlotClassNames<ListSlots>;
|
|
140
|
+
|
|
141
|
+
declare type ListContextValue = {
|
|
142
|
+
navigable: boolean;
|
|
143
|
+
selection?: ListSelectionState;
|
|
144
|
+
as?: 'div' | 'ol' | 'ul';
|
|
145
|
+
truncateHeader?: ListProps['truncateHeader'];
|
|
146
|
+
truncateContent?: ListProps['truncateContent'];
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
declare type ListContextValues = {
|
|
150
|
+
listContext: ListContextValue;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export declare const ListItem: ForwardRefComponent<ListItemProps>;
|
|
154
|
+
|
|
155
|
+
export declare const listItemClassNames: SlotClassNames<ListItemSlots>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* ListItem Props
|
|
159
|
+
*/
|
|
160
|
+
export declare type ListItemProps = ComponentProps_2<ListItemSlots> & {
|
|
161
|
+
value?: string | number;
|
|
162
|
+
truncateHeader?: boolean;
|
|
163
|
+
truncateContent?: boolean;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export declare type ListItemSlots = {
|
|
167
|
+
root: NonNullable<Slot_2<'li', 'div'>>;
|
|
168
|
+
media?: React_2.ComponentProps<typeof ItemLayout>['startMedia'];
|
|
169
|
+
header?: React_2.ComponentProps<typeof ItemLayout>['header'];
|
|
170
|
+
contentWrapper?: React_2.ComponentProps<typeof ItemLayout>['contentWrapper'];
|
|
171
|
+
headerMedia?: React_2.ComponentProps<typeof ItemLayout>['headerMedia'];
|
|
172
|
+
contentMedia?: React_2.ComponentProps<typeof ItemLayout>['contentMedia'];
|
|
173
|
+
endMedia?: React_2.ComponentProps<typeof ItemLayout>['endMedia'];
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* State used in rendering ListItem
|
|
178
|
+
*/
|
|
179
|
+
export declare type ListItemState = ComponentState<ListItemSlots> & {
|
|
180
|
+
selectable?: boolean;
|
|
181
|
+
selected?: boolean;
|
|
182
|
+
navigable?: boolean;
|
|
183
|
+
truncateHeader?: boolean;
|
|
184
|
+
truncateContent?: boolean;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
declare type ListLayout = 'horizontal' | 'vertical' | 'grid';
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* List Props
|
|
191
|
+
*/
|
|
192
|
+
export declare type ListProps = ComponentProps_2<ListSlots> & {
|
|
193
|
+
/**
|
|
194
|
+
* Defines the layout orientation.
|
|
195
|
+
*
|
|
196
|
+
* @default vertical
|
|
197
|
+
*/
|
|
198
|
+
layout?: ListLayout;
|
|
199
|
+
/**
|
|
200
|
+
* Defines if the list should be navigable. Set this to true when adding an `onClick` handler.
|
|
201
|
+
*
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
navigable?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Defines if the List items should be selectable.
|
|
207
|
+
*
|
|
208
|
+
* @default false
|
|
209
|
+
*/
|
|
210
|
+
selectable?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Defines selection mode for the List.
|
|
213
|
+
*
|
|
214
|
+
* @default single
|
|
215
|
+
*/
|
|
216
|
+
selectionMode?: SelectionMode_2;
|
|
217
|
+
/**
|
|
218
|
+
* For controlled selection - defines selected items
|
|
219
|
+
*/
|
|
220
|
+
selectedItems?: SelectionItemId[];
|
|
221
|
+
/**
|
|
222
|
+
* For uncontrolled selection - defines default selected items
|
|
223
|
+
*/
|
|
224
|
+
defaultSelectedItems?: SelectionItemId[];
|
|
225
|
+
/**
|
|
226
|
+
* Callback for selection change events, used for both controlled and uncontrolled (as notification)
|
|
227
|
+
*/
|
|
228
|
+
onSelectionChange?: (event: React_2.SyntheticEvent, data: {
|
|
229
|
+
selectedItems: SelectionItemId[];
|
|
230
|
+
}) => void;
|
|
231
|
+
/**
|
|
232
|
+
* Truncates header
|
|
233
|
+
*
|
|
234
|
+
* @default false
|
|
235
|
+
*/
|
|
236
|
+
truncateHeader?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Truncates content
|
|
239
|
+
*
|
|
240
|
+
* @default false
|
|
241
|
+
*/
|
|
242
|
+
truncateContent?: boolean;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare type ListSelectionState = {
|
|
246
|
+
isSelected: (item: string | number) => boolean;
|
|
247
|
+
toggleItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
248
|
+
deselectItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
249
|
+
selectItem: (e: React_2.SyntheticEvent, id: string | number) => void;
|
|
250
|
+
clearSelection: (e: React_2.SyntheticEvent) => void;
|
|
251
|
+
toggleAllItems: (e: React_2.SyntheticEvent, itemIds: string[] | number[]) => void;
|
|
252
|
+
setSelectedItems: React_2.Dispatch<React_2.SetStateAction<Iterable<SelectionItemId>>>;
|
|
253
|
+
selectedItems: SelectionItemId[];
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export declare type ListSlots = {
|
|
257
|
+
root: NonNullable<Slot_2<'ul', 'div' | 'ol'>>;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* State used in rendering List
|
|
262
|
+
*/
|
|
263
|
+
export declare type ListState = ComponentState<ListSlots> & Required<Pick<ListProps, 'layout'>> & ListContextValue;
|
|
264
|
+
|
|
128
265
|
export declare const Primitive: PrimitiveComponent;
|
|
129
266
|
|
|
130
267
|
export declare const primitiveClassName = "fui-Primitive";
|
|
@@ -140,6 +277,16 @@ declare interface PrimitiveComponent {
|
|
|
140
277
|
displayName: string;
|
|
141
278
|
}
|
|
142
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Render the final JSX of List
|
|
282
|
+
*/
|
|
283
|
+
export declare const renderList_unstable: (state: ListState, contextValues: ListContextValues) => JSX.Element;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Render the final JSX of ListItem
|
|
287
|
+
*/
|
|
288
|
+
export declare const renderListItem_unstable: (state: ListItemState) => JSX.Element;
|
|
289
|
+
|
|
143
290
|
export declare const Segment: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLElement> & React_2.RefAttributes<HTMLDivElement>>;
|
|
144
291
|
|
|
145
292
|
export declare const slider: {
|
|
@@ -219,6 +366,40 @@ export declare const useGridStyles: () => Record<"grid" | "onlyRows" | "rows1" |
|
|
|
219
366
|
|
|
220
367
|
export declare const useItemLayoutStyles: () => Record<"header" | "root" | "contentMedia" | "contentWrapper" | "headerMedia" | "startMedia" | "endMedia", string>;
|
|
221
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Create the state required to render List.
|
|
371
|
+
*
|
|
372
|
+
* The returned state can be modified with hooks such as useListStyles_unstable,
|
|
373
|
+
* before being passed to renderList_unstable.
|
|
374
|
+
*
|
|
375
|
+
* @param props - props from this instance of List
|
|
376
|
+
* @param ref - reference to root HTMLElement of List
|
|
377
|
+
*/
|
|
378
|
+
export declare const useList_unstable: (props: ListProps, ref: React_2.Ref<HTMLDivElement | HTMLUListElement>) => ListState;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Create the state required to render ListItem.
|
|
382
|
+
*
|
|
383
|
+
* The returned state can be modified with hooks such as useListItemStyles_unstable,
|
|
384
|
+
* before being passed to renderListItem_unstable.
|
|
385
|
+
*
|
|
386
|
+
* @param props - props from this instance of ListItem
|
|
387
|
+
* @param ref - reference to root HTMLLIElement | HTMLDivElementof ListItem
|
|
388
|
+
*/
|
|
389
|
+
export declare const useListItem_unstable: (props: ListItemProps, ref: React_2.Ref<HTMLLIElement | HTMLDivElement>) => ListItemState;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Apply styling to the ListItem slots based on the state
|
|
393
|
+
*/
|
|
394
|
+
export declare const useListItemStyles_unstable: (state: ListItemState) => ListItemState;
|
|
395
|
+
|
|
396
|
+
export declare function useListSelection(options?: SelectionHookParams): ListSelectionState;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Apply styling to the List slots based on the state
|
|
400
|
+
*/
|
|
401
|
+
export declare const useListStyles_unstable: (state: ListState) => ListState;
|
|
402
|
+
|
|
222
403
|
export declare const v0Icon: () => GriffelStyle;
|
|
223
404
|
|
|
224
405
|
export declare const v9CustomSizeIcon: () => GriffelStyle;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
3
|
+
import { useList_unstable } from './useList';
|
|
4
|
+
import { renderList_unstable } from './renderList';
|
|
5
|
+
import { useListStyles_unstable } from './useListStyles.styles';
|
|
6
|
+
import { useListContextValues_unstable } from './useListContextValues';
|
|
7
|
+
export const List = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
8
|
+
const state = useList_unstable(props, ref);
|
|
9
|
+
const contextValues = useListContextValues_unstable(state);
|
|
10
|
+
useListStyles_unstable(state);
|
|
11
|
+
useCustomStyleHook_unstable('useListStyles_unstable')(state);
|
|
12
|
+
return renderList_unstable(state, contextValues);
|
|
13
|
+
});
|
|
14
|
+
List.displayName = 'List';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["List.tsx"],"sourcesContent":["import * 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,YAAYA,WAAW,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,yBAAyB;AAEhE,SAASC,6BAA6B,QAAQ,yBAAyB;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["List.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot, SelectionMode, SelectionItemId } from '@fluentui/react-utilities';\nimport type { ListSelectionState } from '../hooks/types';\n\ntype ListLayout = 'horizontal' | 'vertical' | 'grid';\n\nexport type ListSlots = {\n root: NonNullable<Slot<'ul', 'div' | 'ol'>>;\n};\n\n/**\n * List Props\n */\nexport type ListProps = ComponentProps<ListSlots> & {\n /**\n * Defines the layout orientation.\n *\n * @default vertical\n */\n layout?: ListLayout;\n\n /**\n * Defines if the list should be navigable. Set this to true when adding an `onClick` handler.\n *\n * @default false\n */\n navigable?: boolean;\n\n /**\n * Defines if the List items should be selectable.\n *\n * @default false\n */\n selectable?: boolean;\n\n /**\n * Defines selection mode for the List.\n *\n * @default single\n */\n selectionMode?: SelectionMode;\n\n /**\n * For controlled selection - defines selected items\n */\n selectedItems?: SelectionItemId[];\n\n /**\n * For uncontrolled selection - defines default selected items\n */\n defaultSelectedItems?: SelectionItemId[];\n\n /**\n * Callback for selection change events, used for both controlled and uncontrolled (as notification)\n */\n onSelectionChange?: (event: React.SyntheticEvent, data: { selectedItems: SelectionItemId[] }) => void;\n\n /**\n * Truncates header\n *\n * @default false\n */\n truncateHeader?: boolean;\n\n /**\n * Truncates content\n *\n * @default false\n */\n truncateContent?: boolean;\n};\n\nexport type ListContextValue = {\n navigable: boolean;\n selection?: ListSelectionState;\n as?: 'div' | 'ol' | 'ul';\n truncateHeader?: ListProps['truncateHeader'];\n truncateContent?: ListProps['truncateContent'];\n};\n\nexport type ListContextValues = {\n listContext: ListContextValue;\n};\n\n/**\n * State used in rendering List\n */\nexport type ListState = ComponentState<ListSlots> & Required<Pick<ListProps, 'layout'>> & ListContextValue;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './List';\nexport * from './List.types';\nexport * from './renderList';\nexport * from './useList';\nexport * from './useListStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,yBAAyB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
|
2
|
+
export const listContextDefaultValue = {
|
|
3
|
+
navigable: false,
|
|
4
|
+
selection: undefined,
|
|
5
|
+
as: undefined
|
|
6
|
+
};
|
|
7
|
+
const listContext = createContext(undefined);
|
|
8
|
+
export const ListContextProvider = listContext.Provider;
|
|
9
|
+
export const useListContext_unstable = (selector)=>useContextSelector(listContext, (ctx = listContextDefaultValue)=>selector(ctx));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["listContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector } from '@fluentui/react-context-selector';\nimport { ListContextValue } from './List.types';\n\nexport const listContextDefaultValue: ListContextValue = {\n navigable: false,\n selection: undefined,\n as: undefined,\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"],"names":["createContext","useContextSelector","listContextDefaultValue","navigable","selection","undefined","as","listContext","ListContextProvider","Provider","useListContext_unstable","selector","ctx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,mCAAmC;AAIrF,OAAO,MAAMC,0BAA4C;IACvDC,WAAW;IACXC,WAAWC;IACXC,IAAID;AACN,EAAE;AAEF,MAAME,cAAcP,cAA4CK;AAEhE,OAAO,MAAMG,sBAAsBD,YAAYE,QAAQ,CAAC;AAExD,OAAO,MAAMC,0BAA0B,CAAIC,WACzCV,mBAAmBM,aAAa,CAACK,MAAMV,uBAAuB,GAAKS,SAASC,MAAM"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
|
+
import { ListContextProvider } from './listContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of List
|
|
6
|
+
*/ export const renderList_unstable = (state, contextValues)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/ _jsx(ListContextProvider, {
|
|
9
|
+
value: contextValues.listContext,
|
|
10
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ListState, ListSlots, ListContextValues } from './List.types';\nimport { ListContextProvider } from './listContext';\n\n/**\n * Render the final JSX of List\n */\nexport const renderList_unstable = (state: ListState, contextValues: ListContextValues) => {\n assertSlots<ListSlots>(state);\n\n return (\n <ListContextProvider value={contextValues.listContext}>\n <state.root />\n </ListContextProvider>\n );\n};\n"],"names":["assertSlots","ListContextProvider","renderList_unstable","state","contextValues","value","listContext","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD;;CAEC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAkBC;IACpDJ,YAAuBG;IAEvB,qBACE,KAACF;QAAoBI,OAAOD,cAAcE,WAAW;kBACnD,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getIntrinsicElementProps, slot, useControllableState, useEventCallback } from '@fluentui/react-utilities';
|
|
3
|
+
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
4
|
+
import { useListSelection } from '../hooks/useListSelection';
|
|
5
|
+
const DEFAULT_ROOT_EL_TYPE = 'ul';
|
|
6
|
+
/**
|
|
7
|
+
* Create the state required to render List.
|
|
8
|
+
*
|
|
9
|
+
* The returned state can be modified with hooks such as useListStyles_unstable,
|
|
10
|
+
* before being passed to renderList_unstable.
|
|
11
|
+
*
|
|
12
|
+
* @param props - props from this instance of List
|
|
13
|
+
* @param ref - reference to root HTMLElement of List
|
|
14
|
+
*/ export const useList_unstable = (props, ref)=>{
|
|
15
|
+
const { layout = 'vertical', navigable = false, selectable = false, selectionMode = 'single', selectedItems, defaultSelectedItems, as, onSelectionChange, truncateContent = false, truncateHeader = false } = props;
|
|
16
|
+
const arrowNavigationAttributes = useArrowNavigationGroup({
|
|
17
|
+
axis: layout === 'grid' ? 'grid-linear' : 'both',
|
|
18
|
+
memorizeCurrent: true
|
|
19
|
+
});
|
|
20
|
+
const [selectionState, setSelectionState] = useControllableState({
|
|
21
|
+
state: selectedItems,
|
|
22
|
+
defaultState: defaultSelectedItems,
|
|
23
|
+
initialState: []
|
|
24
|
+
});
|
|
25
|
+
const onChange = useEventCallback((e, data)=>{
|
|
26
|
+
const selectedItemsAsArray = Array.from(data.selectedItems);
|
|
27
|
+
setSelectionState(selectedItemsAsArray);
|
|
28
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e, {
|
|
29
|
+
selectedItems: selectedItemsAsArray
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
const selection = useListSelection({
|
|
33
|
+
onSelectionChange: onChange,
|
|
34
|
+
selectionMode,
|
|
35
|
+
selectedItems: selectionState,
|
|
36
|
+
defaultSelectedItems
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
components: {
|
|
40
|
+
root: DEFAULT_ROOT_EL_TYPE
|
|
41
|
+
},
|
|
42
|
+
root: slot.always(getIntrinsicElementProps(DEFAULT_ROOT_EL_TYPE, {
|
|
43
|
+
ref,
|
|
44
|
+
...navigable && {
|
|
45
|
+
role: 'menu'
|
|
46
|
+
},
|
|
47
|
+
...selectable && {
|
|
48
|
+
role: 'listbox',
|
|
49
|
+
'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined
|
|
50
|
+
},
|
|
51
|
+
...arrowNavigationAttributes,
|
|
52
|
+
...props
|
|
53
|
+
}), {
|
|
54
|
+
elementType: DEFAULT_ROOT_EL_TYPE
|
|
55
|
+
}),
|
|
56
|
+
layout,
|
|
57
|
+
// context:
|
|
58
|
+
navigable,
|
|
59
|
+
as: as || DEFAULT_ROOT_EL_TYPE,
|
|
60
|
+
truncateContent,
|
|
61
|
+
truncateHeader,
|
|
62
|
+
// only pass down selection state if its handled internally, otherwise just report the events
|
|
63
|
+
selection: selectable ? selection : undefined
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n OnSelectionChangeData,\n slot,\n useControllableState,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ListProps, ListState } from './List.types';\nimport { useListSelection } from '../hooks/useListSelection';\n\nconst DEFAULT_ROOT_EL_TYPE = 'ul';\n\n/**\n * Create the state required to render List.\n *\n * The returned state can be modified with hooks such as useListStyles_unstable,\n * before being passed to renderList_unstable.\n *\n * @param props - props from this instance of List\n * @param ref - reference to root HTMLElement of List\n */\nexport const useList_unstable = (props: ListProps, ref: React.Ref<HTMLDivElement | HTMLUListElement>): ListState => {\n const {\n layout = 'vertical',\n navigable = false,\n selectable = false,\n selectionMode = 'single',\n selectedItems,\n defaultSelectedItems,\n as,\n onSelectionChange,\n truncateContent = false,\n truncateHeader = false,\n } = props;\n\n const arrowNavigationAttributes = useArrowNavigationGroup({\n axis: layout === 'grid' ? 'grid-linear' : 'both',\n memorizeCurrent: true,\n });\n\n const [selectionState, setSelectionState] = useControllableState({\n state: selectedItems,\n defaultState: defaultSelectedItems,\n initialState: [],\n });\n\n const onChange = useEventCallback((e: React.SyntheticEvent, data: OnSelectionChangeData) => {\n const selectedItemsAsArray = Array.from(data.selectedItems);\n setSelectionState(selectedItemsAsArray);\n onSelectionChange?.(e, { selectedItems: selectedItemsAsArray });\n });\n\n const selection = useListSelection({\n onSelectionChange: onChange,\n selectionMode,\n selectedItems: selectionState,\n defaultSelectedItems,\n });\n\n return {\n components: {\n root: DEFAULT_ROOT_EL_TYPE,\n },\n root: slot.always(\n getIntrinsicElementProps(DEFAULT_ROOT_EL_TYPE, {\n ref,\n ...(navigable && { role: 'menu' }),\n ...(selectable && {\n role: 'listbox',\n 'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined,\n }),\n ...arrowNavigationAttributes,\n ...props,\n }),\n { elementType: DEFAULT_ROOT_EL_TYPE },\n ),\n layout,\n // context:\n navigable,\n as: as || DEFAULT_ROOT_EL_TYPE,\n truncateContent,\n truncateHeader,\n // only pass down selection state if its handled internally, otherwise just report the events\n selection: selectable ? selection : undefined,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useControllableState","useEventCallback","useArrowNavigationGroup","useListSelection","DEFAULT_ROOT_EL_TYPE","useList_unstable","props","ref","layout","navigable","selectable","selectionMode","selectedItems","defaultSelectedItems","as","onSelectionChange","truncateContent","truncateHeader","arrowNavigationAttributes","axis","memorizeCurrent","selectionState","setSelectionState","state","defaultState","initialState","onChange","e","data","selectedItemsAsArray","Array","from","selection","components","root","always","role","undefined","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EAExBC,IAAI,EACJC,oBAAoB,EACpBC,gBAAgB,QACX,4BAA4B;AACnC,SAASC,uBAAuB,QAAQ,0BAA0B;AAElE,SAASC,gBAAgB,QAAQ,4BAA4B;AAE7D,MAAMC,uBAAuB;AAE7B;;;;;;;;CAQC,GACD,OAAO,MAAMC,mBAAmB,CAACC,OAAkBC;IACjD,MAAM,EACJC,SAAS,UAAU,EACnBC,YAAY,KAAK,EACjBC,aAAa,KAAK,EAClBC,gBAAgB,QAAQ,EACxBC,aAAa,EACbC,oBAAoB,EACpBC,EAAE,EACFC,iBAAiB,EACjBC,kBAAkB,KAAK,EACvBC,iBAAiB,KAAK,EACvB,GAAGX;IAEJ,MAAMY,4BAA4BhB,wBAAwB;QACxDiB,MAAMX,WAAW,SAAS,gBAAgB;QAC1CY,iBAAiB;IACnB;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGtB,qBAAqB;QAC/DuB,OAAOX;QACPY,cAAcX;QACdY,cAAc,EAAE;IAClB;IAEA,MAAMC,WAAWzB,iBAAiB,CAAC0B,GAAyBC;QAC1D,MAAMC,uBAAuBC,MAAMC,IAAI,CAACH,KAAKhB,aAAa;QAC1DU,kBAAkBO;QAClBd,8BAAAA,wCAAAA,kBAAoBY,GAAG;YAAEf,eAAeiB;QAAqB;IAC/D;IAEA,MAAMG,YAAY7B,iBAAiB;QACjCY,mBAAmBW;QACnBf;QACAC,eAAeS;QACfR;IACF;IAEA,OAAO;QACLoB,YAAY;YACVC,MAAM9B;QACR;QACA8B,MAAMnC,KAAKoC,MAAM,CACfrC,yBAAyBM,sBAAsB;YAC7CG;YACA,GAAIE,aAAa;gBAAE2B,MAAM;YAAO,CAAC;YACjC,GAAI1B,cAAc;gBAChB0B,MAAM;gBACN,wBAAwBzB,kBAAkB,gBAAgB,OAAO0B;YACnE,CAAC;YACD,GAAGnB,yBAAyB;YAC5B,GAAGZ,KAAK;QACV,IACA;YAAEgC,aAAalC;QAAqB;QAEtCI;QACA,WAAW;QACXC;QACAK,IAAIA,MAAMV;QACVY;QACAC;QACA,6FAA6F;QAC7Fe,WAAWtB,aAAasB,YAAYK;IACtC;AACF,EAAE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function useListContextValues_unstable(state) {
|
|
2
|
+
const { navigable, selection, as, truncateContent, truncateHeader } = state;
|
|
3
|
+
const listContext = {
|
|
4
|
+
navigable,
|
|
5
|
+
selection,
|
|
6
|
+
as,
|
|
7
|
+
truncateContent,
|
|
8
|
+
truncateHeader
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
listContext
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useListContextValues.ts"],"sourcesContent":["import { ListContextValues, ListState } from './List.types';\n\nexport function useListContextValues_unstable(state: ListState): ListContextValues {\n const { navigable, selection, as, truncateContent, truncateHeader } = state;\n\n const listContext = {\n navigable,\n selection,\n as,\n truncateContent,\n truncateHeader,\n };\n\n return {\n listContext,\n };\n}\n"],"names":["useListContextValues_unstable","state","navigable","selection","as","truncateContent","truncateHeader","listContext"],"mappings":"AAEA,OAAO,SAASA,8BAA8BC,KAAgB;IAC5D,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,EAAE,EAAEC,eAAe,EAAEC,cAAc,EAAE,GAAGL;IAEtE,MAAMM,cAAc;QAClBL;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,OAAO;QACLC;IACF;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __styles, __resetStyles, mergeClasses } from '@griffel/react';
|
|
2
|
+
export const listClassNames = {
|
|
3
|
+
root: 'fui-List'
|
|
4
|
+
};
|
|
5
|
+
const useRootBaseStyles = /*#__PURE__*/__resetStyles("r1m6yby2", null, [".r1m6yby2{padding:0;margin:0;text-indent:0;list-style-type:none;}"]);
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/
|
|
9
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
10
|
+
rootHorizontal: {
|
|
11
|
+
mc9l5x: "f22iagw"
|
|
12
|
+
},
|
|
13
|
+
rootGrid: {
|
|
14
|
+
mc9l5x: "f13qh94s"
|
|
15
|
+
}
|
|
16
|
+
}, {
|
|
17
|
+
d: [".f22iagw{display:flex;}", ".f13qh94s{display:grid;}"]
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Apply styling to the List slots based on the state
|
|
21
|
+
*/
|
|
22
|
+
export const useListStyles_unstable = state => {
|
|
23
|
+
const rootStyles = useRootBaseStyles();
|
|
24
|
+
const styles = useStyles();
|
|
25
|
+
const layoutToStyles = {
|
|
26
|
+
['horizontal']: styles.rootHorizontal,
|
|
27
|
+
['grid']: styles.rootGrid,
|
|
28
|
+
['vertical']: undefined
|
|
29
|
+
};
|
|
30
|
+
state.root.className = mergeClasses(listClassNames.root, rootStyles, layoutToStyles[state.layout], state.root.className);
|
|
31
|
+
return state;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useListStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","__resetStyles","mergeClasses","listClassNames","root","useRootBaseStyles","useStyles","rootHorizontal","mc9l5x","rootGrid","d","useListStyles_unstable","state","rootStyles","styles","layoutToStyles","undefined","className","layout"],"sources":["useListStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nexport const listClassNames = {\n root: 'fui-List'\n};\nconst useRootBaseStyles = makeResetStyles({\n padding: 0,\n margin: 0,\n textIndent: 0,\n listStyleType: 'none'\n});\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n rootHorizontal: {\n display: 'flex'\n },\n rootGrid: {\n display: 'grid'\n }\n});\n/**\n * Apply styling to the List slots based on the state\n */ export const useListStyles_unstable = (state)=>{\n const rootStyles = useRootBaseStyles();\n const styles = useStyles();\n const layoutToStyles = {\n ['horizontal']: styles.rootHorizontal,\n ['grid']: styles.rootGrid,\n ['vertical']: undefined\n };\n state.root.className = mergeClasses(listClassNames.root, rootStyles, layoutToStyles[state.layout], state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,OAAO,MAAMC,cAAc,GAAG;EAC1BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,iBAAiB,gBAAGJ,aAAA,wFAKzB,CAAC;AACF;AACA;AACA;AAAI,MAAMK,SAAS,gBAAGN,QAAA;EAAAO,cAAA;IAAAC,MAAA;EAAA;EAAAC,QAAA;IAAAD,MAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,CAOrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,sBAAsB,GAAIC,KAAK,IAAG;EAC/C,MAAMC,UAAU,GAAGR,iBAAiB,CAAC,CAAC;EACtC,MAAMS,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1B,MAAMS,cAAc,GAAG;IACnB,CAAC,YAAY,GAAGD,MAAM,CAACP,cAAc;IACrC,CAAC,MAAM,GAAGO,MAAM,CAACL,QAAQ;IACzB,CAAC,UAAU,GAAGO;EAClB,CAAC;EACDJ,KAAK,CAACR,IAAI,CAACa,SAAS,GAAGf,YAAY,CAACC,cAAc,CAACC,IAAI,EAAES,UAAU,EAAEE,cAAc,CAACH,KAAK,CAACM,MAAM,CAAC,EAAEN,KAAK,CAACR,IAAI,CAACa,SAAS,CAAC;EACxH,OAAOL,KAAK;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
3
|
+
import { useListItem_unstable } from './useListItem';
|
|
4
|
+
import { renderListItem_unstable } from './renderListItem';
|
|
5
|
+
import { useListItemStyles_unstable } from './useListItemStyles.styles';
|
|
6
|
+
export const ListItem = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
7
|
+
const state = useListItem_unstable(props, ref);
|
|
8
|
+
useListItemStyles_unstable(state);
|
|
9
|
+
useCustomStyleHook_unstable('useListItemStyles_unstable')(state);
|
|
10
|
+
return renderListItem_unstable(state);
|
|
11
|
+
});
|
|
12
|
+
ListItem.displayName = 'ListItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ListItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useListItem_unstable } from './useListItem';\nimport { renderListItem_unstable } from './renderListItem';\nimport { useListItemStyles_unstable } from './useListItemStyles.styles';\nimport type { ListItemProps } from './ListItem.types';\n\nexport const ListItem: ForwardRefComponent<ListItemProps> = React.forwardRef<HTMLLIElement | HTMLDivElement>(\n (props, ref) => {\n const state = useListItem_unstable(props, ref);\n\n useListItemStyles_unstable(state);\n useCustomStyleHook_unstable('useListItemStyles_unstable')(state);\n return renderListItem_unstable(state);\n },\n);\n\nListItem.displayName = 'ListItem';\n"],"names":["React","useCustomStyleHook_unstable","useListItem_unstable","renderListItem_unstable","useListItemStyles_unstable","ListItem","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,6BAA6B;AAGxE,OAAO,MAAMC,yBAA+CL,MAAMM,UAAU,CAC1E,CAACC,OAAOC;IACN,MAAMC,QAAQP,qBAAqBK,OAAOC;IAE1CJ,2BAA2BK;IAC3BR,4BAA4B,8BAA8BQ;IAC1D,OAAON,wBAAwBM;AACjC,GACA;AAEFJ,SAASK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ListItem.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { ItemLayout } from '../../ItemLayout';\n\nexport type ListItemSlots = {\n root: NonNullable<Slot<'li', 'div'>>;\n media?: React.ComponentProps<typeof ItemLayout>['startMedia'];\n header?: React.ComponentProps<typeof ItemLayout>['header'];\n contentWrapper?: React.ComponentProps<typeof ItemLayout>['contentWrapper'];\n headerMedia?: React.ComponentProps<typeof ItemLayout>['headerMedia'];\n contentMedia?: React.ComponentProps<typeof ItemLayout>['contentMedia'];\n endMedia?: React.ComponentProps<typeof ItemLayout>['endMedia'];\n};\n\n/**\n * ListItem Props\n */\nexport type ListItemProps = ComponentProps<ListItemSlots> & {\n value?: string | number;\n truncateHeader?: boolean;\n truncateContent?: boolean;\n};\n\n/**\n * State used in rendering ListItem\n */\nexport type ListItemState = ComponentState<ListItemSlots> & {\n selectable?: boolean;\n selected?: boolean;\n navigable?: boolean;\n truncateHeader?: boolean;\n truncateContent?: boolean;\n};\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ListItem';\nexport * from './ListItem.types';\nexport * from './renderListItem';\nexport * from './useListItem';\nexport * from './useListItemStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,6BAA6B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { ItemLayout } from '../../ItemLayout';
|
|
3
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of ListItem
|
|
6
|
+
*/ export const renderListItem_unstable = (state)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/ _jsx(state.root, {
|
|
9
|
+
children: /*#__PURE__*/ _jsx(ItemLayout, {
|
|
10
|
+
startMedia: state.media,
|
|
11
|
+
header: state.header,
|
|
12
|
+
headerMedia: state.headerMedia,
|
|
13
|
+
contentWrapper: state.contentWrapper,
|
|
14
|
+
contentMedia: state.contentMedia,
|
|
15
|
+
endMedia: state.endMedia,
|
|
16
|
+
children: state.root.children
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderListItem.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { ItemLayout } from '../../ItemLayout';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ListItemSlots, ListItemState } from './ListItem.types';\n/**\n * Render the final JSX of ListItem\n */\nexport const renderListItem_unstable = (state: ListItemState) => {\n assertSlots<ListItemSlots>(state);\n\n return (\n <state.root>\n <ItemLayout\n startMedia={state.media}\n header={state.header}\n headerMedia={state.headerMedia}\n contentWrapper={state.contentWrapper}\n contentMedia={state.contentMedia}\n endMedia={state.endMedia}\n >\n {state.root.children}\n </ItemLayout>\n </state.root>\n );\n};\n"],"names":["ItemLayout","assertSlots","renderListItem_unstable","state","root","startMedia","media","header","headerMedia","contentWrapper","contentMedia","endMedia","children"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,WAAW,QAAQ,4BAA4B;AAExD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtCF,YAA2BE;IAE3B,qBACE,KAACA,MAAMC,IAAI;kBACT,cAAA,KAACJ;YACCK,YAAYF,MAAMG,KAAK;YACvBC,QAAQJ,MAAMI,MAAM;YACpBC,aAAaL,MAAMK,WAAW;YAC9BC,gBAAgBN,MAAMM,cAAc;YACpCC,cAAcP,MAAMO,YAAY;YAChCC,UAAUR,MAAMQ,QAAQ;sBAEvBR,MAAMC,IAAI,CAACQ,QAAQ;;;AAI5B,EAAE"}
|