diff --git a/change/@fluentui-react-provider-00d3963a-2192-4b99-8510-42654e1f70e6.json b/change/@fluentui-react-provider-00d3963a-2192-4b99-8510-42654e1f70e6.json new file mode 100644 index 00000000000000..ca777541929d7d --- /dev/null +++ b/change/@fluentui-react-provider-00d3963a-2192-4b99-8510-42654e1f70e6.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: Add API for List", + "packageName": "@fluentui/react-provider", + "email": "jirivyhnalek@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-shared-contexts-a90c0c59-c89a-4a52-ac24-166ddb03e14c.json b/change/@fluentui-react-shared-contexts-a90c0c59-c89a-4a52-ac24-166ddb03e14c.json new file mode 100644 index 00000000000000..c39b5c483a2cb9 --- /dev/null +++ b/change/@fluentui-react-shared-contexts-a90c0c59-c89a-4a52-ac24-166ddb03e14c.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: Add custom style hook types for List", + "packageName": "@fluentui/react-shared-contexts", + "email": "jirivyhnalek@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-list-preview/.babelrc.json b/packages/react-components/react-list-preview/.babelrc.json new file mode 100644 index 00000000000000..45fb71ca16d2c3 --- /dev/null +++ b/packages/react-components/react-list-preview/.babelrc.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../.babelrc-v9.json", + "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] +} diff --git a/packages/react-components/react-list-preview/.eslintrc.json b/packages/react-components/react-list-preview/.eslintrc.json new file mode 100644 index 00000000000000..ceea884c70dccc --- /dev/null +++ b/packages/react-components/react-list-preview/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": ["plugin:@fluentui/eslint-plugin/react"], + "root": true +} diff --git a/packages/react-components/react-list-preview/.storybook/main.js b/packages/react-components/react-list-preview/.storybook/main.js new file mode 100644 index 00000000000000..26536b61b387f6 --- /dev/null +++ b/packages/react-components/react-list-preview/.storybook/main.js @@ -0,0 +1,14 @@ +const rootMain = require('../../../../.storybook/main'); + +module.exports = /** @type {Omit} */ ({ + ...rootMain, + stories: [...rootMain.stories, '../stories/**/*.stories.mdx', '../stories/**/index.stories.@(ts|tsx)'], + addons: [...rootMain.addons], + webpackFinal: (config, options) => { + const localConfig = { ...rootMain.webpackFinal(config, options) }; + + // add your own webpack tweaks if needed + + return localConfig; + }, +}); diff --git a/packages/react-components/react-list-preview/.storybook/preview.js b/packages/react-components/react-list-preview/.storybook/preview.js new file mode 100644 index 00000000000000..1939500a3d18c7 --- /dev/null +++ b/packages/react-components/react-list-preview/.storybook/preview.js @@ -0,0 +1,7 @@ +import * as rootPreview from '../../../../.storybook/preview'; + +/** @type {typeof rootPreview.decorators} */ +export const decorators = [...rootPreview.decorators]; + +/** @type {typeof rootPreview.parameters} */ +export const parameters = { ...rootPreview.parameters }; diff --git a/packages/react-components/react-list-preview/.storybook/tsconfig.json b/packages/react-components/react-list-preview/.storybook/tsconfig.json new file mode 100644 index 00000000000000..ea89218a3d916f --- /dev/null +++ b/packages/react-components/react-list-preview/.storybook/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "", + "allowJs": true, + "checkJs": true, + "types": ["static-assets", "environment", "storybook__addons"] + }, + "include": ["../stories/**/*.stories.ts", "../stories/**/*.stories.tsx", "*.js"] +} diff --git a/packages/react-components/react-list-preview/.swcrc b/packages/react-components/react-list-preview/.swcrc new file mode 100644 index 00000000000000..b4ffa86dee3067 --- /dev/null +++ b/packages/react-components/react-list-preview/.swcrc @@ -0,0 +1,30 @@ +{ + "$schema": "https://json.schemastore.org/swcrc", + "exclude": [ + "/testing", + "/**/*.cy.ts", + "/**/*.cy.tsx", + "/**/*.spec.ts", + "/**/*.spec.tsx", + "/**/*.test.ts", + "/**/*.test.tsx" + ], + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": true, + "decorators": false, + "dynamicImport": false + }, + "externalHelpers": true, + "transform": { + "react": { + "runtime": "classic", + "useSpread": true + } + }, + "target": "es2019" + }, + "minify": false, + "sourceMaps": true +} diff --git a/packages/react-components/react-list-preview/LICENSE b/packages/react-components/react-list-preview/LICENSE new file mode 100644 index 00000000000000..1a85f39e0650b8 --- /dev/null +++ b/packages/react-components/react-list-preview/LICENSE @@ -0,0 +1,15 @@ +@fluentui/react-list-preview + +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license diff --git a/packages/react-components/react-list-preview/README.md b/packages/react-components/react-list-preview/README.md new file mode 100644 index 00000000000000..839279aca3d3b6 --- /dev/null +++ b/packages/react-components/react-list-preview/README.md @@ -0,0 +1,5 @@ +# @fluentui/react-list-preview + +**React List components for [Fluent UI React](https://react.fluentui.dev/)** + +These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release. diff --git a/packages/react-components/react-list-preview/config/api-extractor.json b/packages/react-components/react-list-preview/config/api-extractor.json new file mode 100644 index 00000000000000..e533bf30b48a2b --- /dev/null +++ b/packages/react-components/react-list-preview/config/api-extractor.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "@fluentui/scripts-api-extractor/api-extractor.common.v-next.json" +} diff --git a/packages/react-components/react-list-preview/config/tests.js b/packages/react-components/react-list-preview/config/tests.js new file mode 100644 index 00000000000000..2e211ae9e21420 --- /dev/null +++ b/packages/react-components/react-list-preview/config/tests.js @@ -0,0 +1 @@ +/** Jest test setup file. */ diff --git a/packages/react-components/react-list-preview/docs/Spec.md b/packages/react-components/react-list-preview/docs/Spec.md new file mode 100644 index 00000000000000..a3a755a6aa0de6 --- /dev/null +++ b/packages/react-components/react-list-preview/docs/Spec.md @@ -0,0 +1,63 @@ +# @fluentui/react-list-preview Spec + +## Background + +_Description and use cases of this component_ + +## Prior Art + +_Include background research done for this component_ + +- _Link to Open UI research_ +- _Link to comparison of v7 and v0_ +- _Link to GitHub epic issue for the converged component_ + +## Sample Code + +_Provide some representative example code that uses the proposed API for the component_ + +## Variants + +_Describe visual or functional variants of this control, if applicable. For example, a slider could have a 2D variant._ + +## API + +_List the **Props** and **Slots** proposed for the component. Ideally this would just be a link to the component's `.types.ts` file_ + +## Structure + +- _**Public**_ +- _**Internal**_ +- _**DOM** - how the component will be rendered as HTML elements_ + +## Migration + +_Describe what will need to be done to upgrade from the existing implementations:_ + +- _Migration from v8_ +- _Migration from v0_ + +## Behaviors + +_Explain how the component will behave in use, including:_ + +- _Component States_ +- _Interaction_ + - _Keyboard_ + - _Cursor_ + - _Touch_ + - _Screen readers_ + +## Accessibility + +Base accessibility information is included in the design document. After the spec is filled and review, outcomes from it need to be communicated to design and incorporated in the design document. + +- Decide whether to use **native element** or folow **ARIA** and provide reasons +- Identify the **[ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/) pattern** and, if the component is listed there, follow its specification as possible. +- Identify accessibility **variants**, the `role` ([ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions)) of the component, its `slots` and `aria-*` props. +- Describe the **keyboard navigation**: Tab Oder and Arrow Key Navigation. Describe any other keyboard **shortcuts** used +- Specify texts for **state change announcements** - [ARIA live regions + ](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) (number of available items in dropdown, error messages, confirmations, ...) +- Identify UI parts that appear on **hover or focus** and specify keyboard and screen reader interaction with them +- List cases when **focus** needs to be **trapped** in sections of the UI (for dialogs and popups or for hierarchical navigation) +- List cases when **focus** needs to be **moved programatically** (if parts of the UI are appearing/disappearing or other cases) diff --git a/packages/react-components/react-list-preview/etc/react-list-preview.api.md b/packages/react-components/react-list-preview/etc/react-list-preview.api.md new file mode 100644 index 00000000000000..b065e9f82f8d88 --- /dev/null +++ b/packages/react-components/react-list-preview/etc/react-list-preview.api.md @@ -0,0 +1,94 @@ +## API Report File for "@fluentui/react-list-preview" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { ComponentProps } from '@fluentui/react-utilities'; +import type { ComponentState } from '@fluentui/react-utilities'; +import type { ForwardRefComponent } from '@fluentui/react-utilities'; +import * as React_2 from 'react'; +import type { Slot } from '@fluentui/react-utilities'; +import type { SlotClassNames } from '@fluentui/react-utilities'; + +// @public +export const List: ForwardRefComponent; + +// @public (undocumented) +export const listClassNames: SlotClassNames; + +// @public +export const ListItem: ForwardRefComponent; + +// @public +export const ListItemButton: ForwardRefComponent; + +// @public (undocumented) +export const listItemButtonClassNames: SlotClassNames; + +// @public +export type ListItemButtonProps = ComponentProps & {}; + +// @public (undocumented) +export type ListItemButtonSlots = { + root: Slot<'div'>; +}; + +// @public +export type ListItemButtonState = ComponentState; + +// @public (undocumented) +export const listItemClassNames: SlotClassNames; + +// @public +export type ListItemProps = ComponentProps & {}; + +// @public (undocumented) +export type ListItemSlots = { + root: Slot<'div'>; +}; + +// @public +export type ListItemState = ComponentState; + +// @public +export type ListProps = ComponentProps & {}; + +// @public (undocumented) +export type ListSlots = { + root: Slot<'div'>; +}; + +// @public +export type ListState = ComponentState; + +// @public +export const renderList_unstable: (state: ListState) => JSX.Element; + +// @public +export const renderListItem_unstable: (state: ListItemState) => JSX.Element; + +// @public +export const renderListItemButton_unstable: (state: ListItemButtonState) => JSX.Element; + +// @public +export const useList_unstable: (props: ListProps, ref: React_2.Ref) => ListState; + +// @public +export const useListItem_unstable: (props: ListItemProps, ref: React_2.Ref) => ListItemState; + +// @public +export const useListItemButton_unstable: (props: ListItemButtonProps, ref: React_2.Ref) => ListItemButtonState; + +// @public +export const useListItemButtonStyles_unstable: (state: ListItemButtonState) => ListItemButtonState; + +// @public +export const useListItemStyles_unstable: (state: ListItemState) => ListItemState; + +// @public +export const useListStyles_unstable: (state: ListState) => ListState; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/react-components/react-list-preview/jest.config.js b/packages/react-components/react-list-preview/jest.config.js new file mode 100644 index 00000000000000..49a746ffcd03ee --- /dev/null +++ b/packages/react-components/react-list-preview/jest.config.js @@ -0,0 +1,21 @@ +// @ts-check + +/** + * @type {import('@jest/types').Config.InitialOptions} + */ +module.exports = { + displayName: 'react-list-preview', + preset: '../../../jest.preset.js', + transform: { + '^.+\\.tsx?$': [ + 'ts-jest', + { + tsconfig: '/tsconfig.spec.json', + isolatedModules: true, + }, + ], + }, + coverageDirectory: './coverage', + setupFilesAfterEnv: ['./config/tests.js'], + snapshotSerializers: ['@griffel/jest-serializer'], +}; diff --git a/packages/react-components/react-list-preview/just.config.ts b/packages/react-components/react-list-preview/just.config.ts new file mode 100644 index 00000000000000..b7b2c9a33bf435 --- /dev/null +++ b/packages/react-components/react-list-preview/just.config.ts @@ -0,0 +1,5 @@ +import { preset, task } from '@fluentui/scripts-tasks'; + +preset(); + +task('build', 'build:react-components').cached?.(); diff --git a/packages/react-components/react-list-preview/package.json b/packages/react-components/react-list-preview/package.json new file mode 100644 index 00000000000000..7a622eb0723490 --- /dev/null +++ b/packages/react-components/react-list-preview/package.json @@ -0,0 +1,67 @@ +{ + "name": "@fluentui/react-list-preview", + "version": "0.0.0", + "private": true, + "description": "New fluentui react package", + "main": "lib-commonjs/index.js", + "module": "lib/index.js", + "typings": "./dist/index.d.ts", + "sideEffects": false, + "files": [ + "lib", + "lib-commonjs", + "dist/*.d.ts" + ], + "repository": { + "type": "git", + "url": "https://github.com/microsoft/fluentui" + }, + "license": "MIT", + "scripts": { + "build": "just-scripts build", + "clean": "just-scripts clean", + "generate-api": "just-scripts generate-api", + "lint": "just-scripts lint", + "start": "yarn storybook", + "storybook": "start-storybook", + "test": "jest --passWithNoTests", + "test-ssr": "test-ssr \"./stories/**/*.stories.tsx\"", + "type-check": "tsc -b tsconfig.json" + }, + "devDependencies": { + "@fluentui/eslint-plugin": "*", + "@fluentui/react-conformance": "*", + "@fluentui/react-conformance-griffel": "*", + "@fluentui/scripts-api-extractor": "*", + "@fluentui/scripts-tasks": "*" + }, + "dependencies": { + "@fluentui/react-jsx-runtime": "^9.0.18", + "@fluentui/react-theme": "^9.1.15", + "@fluentui/react-utilities": "^9.15.1", + "@fluentui/react-shared-contexts": "^9.11.1", + "@griffel/react": "^1.5.14", + "@swc/helpers": "^0.5.1" + }, + "peerDependencies": { + "@types/react": ">=16.8.0 <19.0.0", + "@types/react-dom": ">=16.8.0 <19.0.0", + "react": ">=16.8.0 <19.0.0", + "react-dom": ">=16.8.0 <19.0.0" + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "node": "./lib-commonjs/index.js", + "import": "./lib/index.js", + "require": "./lib-commonjs/index.js" + }, + "./package.json": "./package.json" + }, + "beachball": { + "disallowedChangeTypes": [ + "major", + "prerelease" + ] + } +} diff --git a/packages/react-components/react-list-preview/project.json b/packages/react-components/react-list-preview/project.json new file mode 100644 index 00000000000000..47497ab9de6df0 --- /dev/null +++ b/packages/react-components/react-list-preview/project.json @@ -0,0 +1,8 @@ +{ + "name": "@fluentui/react-list-preview", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "sourceRoot": "packages/react-components/react-list-preview/src", + "tags": ["platform:web", "vNext"], + "implicitDependencies": [] +} diff --git a/packages/react-components/react-list-preview/src/List.ts b/packages/react-components/react-list-preview/src/List.ts new file mode 100644 index 00000000000000..038abd3e740ea4 --- /dev/null +++ b/packages/react-components/react-list-preview/src/List.ts @@ -0,0 +1 @@ +export * from './components/List/index'; diff --git a/packages/react-components/react-list-preview/src/ListItem.ts b/packages/react-components/react-list-preview/src/ListItem.ts new file mode 100644 index 00000000000000..d846474af071ad --- /dev/null +++ b/packages/react-components/react-list-preview/src/ListItem.ts @@ -0,0 +1 @@ +export * from './components/ListItem/index'; diff --git a/packages/react-components/react-list-preview/src/ListItemButton.ts b/packages/react-components/react-list-preview/src/ListItemButton.ts new file mode 100644 index 00000000000000..3737c764d3713b --- /dev/null +++ b/packages/react-components/react-list-preview/src/ListItemButton.ts @@ -0,0 +1 @@ +export * from './components/ListItemButton/index'; diff --git a/packages/react-components/react-list-preview/src/components/List/List.test.tsx b/packages/react-components/react-list-preview/src/components/List/List.test.tsx new file mode 100644 index 00000000000000..91866c402c08d3 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/List.test.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import { render } from '@testing-library/react'; +import { isConformant } from '../../testing/isConformant'; +import { List } from './List'; + +describe('List', () => { + isConformant({ + Component: List, + displayName: 'List', + }); + + // TODO add more tests here, and create visual regression tests in /apps/vr-tests + + it('renders a default state', () => { + const result = render(Default List); + expect(result.container).toMatchSnapshot(); + }); +}); diff --git a/packages/react-components/react-list-preview/src/components/List/List.tsx b/packages/react-components/react-list-preview/src/components/List/List.tsx new file mode 100644 index 00000000000000..7f1f75c8e429ee --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/List.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; +import type { ForwardRefComponent } from '@fluentui/react-utilities'; +import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts'; +import { useList_unstable } from './useList'; +import { renderList_unstable } from './renderList'; +import { useListStyles_unstable } from './useListStyles.styles'; +import type { ListProps } from './List.types'; + +/** + * List component - TODO: add more docs + */ +export const List: ForwardRefComponent = React.forwardRef((props, ref) => { + const state = useList_unstable(props, ref); + + useListStyles_unstable(state); + + // TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts + // https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md + useCustomStyleHook_unstable('useListStyles_unstable')(state); + return renderList_unstable(state); +}); + +List.displayName = 'List'; diff --git a/packages/react-components/react-list-preview/src/components/List/List.types.ts b/packages/react-components/react-list-preview/src/components/List/List.types.ts new file mode 100644 index 00000000000000..2bd3e77ab99a3b --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/List.types.ts @@ -0,0 +1,17 @@ +import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; + +export type ListSlots = { + root: Slot<'div'>; +}; + +/** + * List Props + */ +export type ListProps = ComponentProps & {}; + +/** + * State used in rendering List + */ +export type ListState = ComponentState; +// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from ListProps. +// & Required> diff --git a/packages/react-components/react-list-preview/src/components/List/__snapshots__/List.test.tsx.snap b/packages/react-components/react-list-preview/src/components/List/__snapshots__/List.test.tsx.snap new file mode 100644 index 00000000000000..c7e02b09599b43 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/__snapshots__/List.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`List renders a default state 1`] = ` +
+
+ Default List +
+
+`; diff --git a/packages/react-components/react-list-preview/src/components/List/index.ts b/packages/react-components/react-list-preview/src/components/List/index.ts new file mode 100644 index 00000000000000..edd6a0bf1be045 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/index.ts @@ -0,0 +1,5 @@ +export * from './List'; +export * from './List.types'; +export * from './renderList'; +export * from './useList'; +export * from './useListStyles.styles'; diff --git a/packages/react-components/react-list-preview/src/components/List/renderList.tsx b/packages/react-components/react-list-preview/src/components/List/renderList.tsx new file mode 100644 index 00000000000000..435304774c0063 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/renderList.tsx @@ -0,0 +1,15 @@ +/** @jsxRuntime automatic */ +/** @jsxImportSource @fluentui/react-jsx-runtime */ + +import { assertSlots } from '@fluentui/react-utilities'; +import type { ListState, ListSlots } from './List.types'; + +/** + * Render the final JSX of List + */ +export const renderList_unstable = (state: ListState) => { + assertSlots(state); + + // TODO Add additional slots in the appropriate place + return ; +}; diff --git a/packages/react-components/react-list-preview/src/components/List/useList.ts b/packages/react-components/react-list-preview/src/components/List/useList.ts new file mode 100644 index 00000000000000..4f197513bb26d6 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/useList.ts @@ -0,0 +1,31 @@ +import * as React from 'react'; +import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities'; +import type { ListProps, ListState } from './List.types'; + +/** + * Create the state required to render List. + * + * The returned state can be modified with hooks such as useListStyles_unstable, + * before being passed to renderList_unstable. + * + * @param props - props from this instance of List + * @param ref - reference to root HTMLDivElement of List + */ +export const useList_unstable = (props: ListProps, ref: React.Ref): ListState => { + return { + // TODO add appropriate props/defaults + components: { + // TODO add each slot's element type or component + root: 'div', + }, + // TODO add appropriate slots, for example: + // mySlot: resolveShorthand(props.mySlot), + root: slot.always( + getIntrinsicElementProps('div', { + ref, + ...props, + }), + { elementType: 'div' }, + ), + }; +}; diff --git a/packages/react-components/react-list-preview/src/components/List/useListStyles.styles.ts b/packages/react-components/react-list-preview/src/components/List/useListStyles.styles.ts new file mode 100644 index 00000000000000..19986555d581bc --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/List/useListStyles.styles.ts @@ -0,0 +1,33 @@ +import { makeStyles, mergeClasses } from '@griffel/react'; +import type { SlotClassNames } from '@fluentui/react-utilities'; +import type { ListSlots, ListState } from './List.types'; + +export const listClassNames: SlotClassNames = { + root: 'fui-List', + // TODO: add class names for all slots on ListSlots. + // Should be of the form `: 'fui-List__` +}; + +/** + * Styles for the root slot + */ +const useStyles = makeStyles({ + root: { + // TODO Add default styles for the root element + }, + + // TODO add additional classes for different states and/or slots +}); + +/** + * Apply styling to the List slots based on the state + */ +export const useListStyles_unstable = (state: ListState): ListState => { + const styles = useStyles(); + state.root.className = mergeClasses(listClassNames.root, styles.root, state.root.className); + + // TODO Add class names to slots, for example: + // state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className); + + return state; +}; diff --git a/packages/react-components/react-list-preview/src/components/ListItem/ListItem.test.tsx b/packages/react-components/react-list-preview/src/components/ListItem/ListItem.test.tsx new file mode 100644 index 00000000000000..0b23f1dc97ad24 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/ListItem.test.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import { render } from '@testing-library/react'; +import { isConformant } from '../../testing/isConformant'; +import { ListItem } from './ListItem'; + +describe('ListItem', () => { + isConformant({ + Component: ListItem, + displayName: 'ListItem', + }); + + // TODO add more tests here, and create visual regression tests in /apps/vr-tests + + it('renders a default state', () => { + const result = render(Default ListItem); + expect(result.container).toMatchSnapshot(); + }); +}); diff --git a/packages/react-components/react-list-preview/src/components/ListItem/ListItem.tsx b/packages/react-components/react-list-preview/src/components/ListItem/ListItem.tsx new file mode 100644 index 00000000000000..e850346d78f47b --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/ListItem.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; +import type { ForwardRefComponent } from '@fluentui/react-utilities'; +import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts'; +import { useListItem_unstable } from './useListItem'; +import { renderListItem_unstable } from './renderListItem'; +import { useListItemStyles_unstable } from './useListItemStyles.styles'; +import type { ListItemProps } from './ListItem.types'; + +/** + * ListItem component - TODO: add more docs + */ +export const ListItem: ForwardRefComponent = React.forwardRef((props, ref) => { + const state = useListItem_unstable(props, ref); + + useListItemStyles_unstable(state); + + // TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts + // https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md + useCustomStyleHook_unstable('useListItemStyles_unstable')(state); + return renderListItem_unstable(state); +}); + +ListItem.displayName = 'ListItem'; diff --git a/packages/react-components/react-list-preview/src/components/ListItem/ListItem.types.ts b/packages/react-components/react-list-preview/src/components/ListItem/ListItem.types.ts new file mode 100644 index 00000000000000..aa6539c260648a --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/ListItem.types.ts @@ -0,0 +1,17 @@ +import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; + +export type ListItemSlots = { + root: Slot<'div'>; +}; + +/** + * ListItem Props + */ +export type ListItemProps = ComponentProps & {}; + +/** + * State used in rendering ListItem + */ +export type ListItemState = ComponentState; +// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from ListItemProps. +// & Required> diff --git a/packages/react-components/react-list-preview/src/components/ListItem/__snapshots__/ListItem.test.tsx.snap b/packages/react-components/react-list-preview/src/components/ListItem/__snapshots__/ListItem.test.tsx.snap new file mode 100644 index 00000000000000..21a24d5f673ba6 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/__snapshots__/ListItem.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ListItem renders a default state 1`] = ` +
+
+ Default ListItem +
+
+`; diff --git a/packages/react-components/react-list-preview/src/components/ListItem/index.ts b/packages/react-components/react-list-preview/src/components/ListItem/index.ts new file mode 100644 index 00000000000000..08dc684b19814a --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/index.ts @@ -0,0 +1,5 @@ +export * from './ListItem'; +export * from './ListItem.types'; +export * from './renderListItem'; +export * from './useListItem'; +export * from './useListItemStyles.styles'; diff --git a/packages/react-components/react-list-preview/src/components/ListItem/renderListItem.tsx b/packages/react-components/react-list-preview/src/components/ListItem/renderListItem.tsx new file mode 100644 index 00000000000000..62c3e1e8a07f38 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/renderListItem.tsx @@ -0,0 +1,15 @@ +/** @jsxRuntime automatic */ +/** @jsxImportSource @fluentui/react-jsx-runtime */ + +import { assertSlots } from '@fluentui/react-utilities'; +import type { ListItemState, ListItemSlots } from './ListItem.types'; + +/** + * Render the final JSX of ListItem + */ +export const renderListItem_unstable = (state: ListItemState) => { + assertSlots(state); + + // TODO Add additional slots in the appropriate place + return ; +}; diff --git a/packages/react-components/react-list-preview/src/components/ListItem/useListItem.ts b/packages/react-components/react-list-preview/src/components/ListItem/useListItem.ts new file mode 100644 index 00000000000000..9130a31345c752 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/useListItem.ts @@ -0,0 +1,31 @@ +import * as React from 'react'; +import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities'; +import type { ListItemProps, ListItemState } from './ListItem.types'; + +/** + * Create the state required to render ListItem. + * + * The returned state can be modified with hooks such as useListItemStyles_unstable, + * before being passed to renderListItem_unstable. + * + * @param props - props from this instance of ListItem + * @param ref - reference to root HTMLDivElement of ListItem + */ +export const useListItem_unstable = (props: ListItemProps, ref: React.Ref): ListItemState => { + return { + // TODO add appropriate props/defaults + components: { + // TODO add each slot's element type or component + root: 'div', + }, + // TODO add appropriate slots, for example: + // mySlot: resolveShorthand(props.mySlot), + root: slot.always( + getIntrinsicElementProps('div', { + ref, + ...props, + }), + { elementType: 'div' }, + ), + }; +}; diff --git a/packages/react-components/react-list-preview/src/components/ListItem/useListItemStyles.styles.ts b/packages/react-components/react-list-preview/src/components/ListItem/useListItemStyles.styles.ts new file mode 100644 index 00000000000000..302e8cfffeae16 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItem/useListItemStyles.styles.ts @@ -0,0 +1,33 @@ +import { makeStyles, mergeClasses } from '@griffel/react'; +import type { SlotClassNames } from '@fluentui/react-utilities'; +import type { ListItemSlots, ListItemState } from './ListItem.types'; + +export const listItemClassNames: SlotClassNames = { + root: 'fui-ListItem', + // TODO: add class names for all slots on ListItemSlots. + // Should be of the form `: 'fui-ListItem__` +}; + +/** + * Styles for the root slot + */ +const useStyles = makeStyles({ + root: { + // TODO Add default styles for the root element + }, + + // TODO add additional classes for different states and/or slots +}); + +/** + * Apply styling to the ListItem slots based on the state + */ +export const useListItemStyles_unstable = (state: ListItemState): ListItemState => { + const styles = useStyles(); + state.root.className = mergeClasses(listItemClassNames.root, styles.root, state.root.className); + + // TODO Add class names to slots, for example: + // state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className); + + return state; +}; diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.test.tsx b/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.test.tsx new file mode 100644 index 00000000000000..7889695b1cf03c --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.test.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import { render } from '@testing-library/react'; +import { isConformant } from '../../testing/isConformant'; +import { ListItemButton } from './ListItemButton'; + +describe('ListItemButton', () => { + isConformant({ + Component: ListItemButton, + displayName: 'ListItemButton', + }); + + // TODO add more tests here, and create visual regression tests in /apps/vr-tests + + it('renders a default state', () => { + const result = render(Default ListItemButton); + expect(result.container).toMatchSnapshot(); + }); +}); diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.tsx b/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.tsx new file mode 100644 index 00000000000000..b293377c115c60 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; +import type { ForwardRefComponent } from '@fluentui/react-utilities'; +import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts'; +import { useListItemButton_unstable } from './useListItemButton'; +import { renderListItemButton_unstable } from './renderListItemButton'; +import { useListItemButtonStyles_unstable } from './useListItemButtonStyles.styles'; +import type { ListItemButtonProps } from './ListItemButton.types'; + +/** + * ListItemButton component - TODO: add more docs + */ +export const ListItemButton: ForwardRefComponent = React.forwardRef((props, ref) => { + const state = useListItemButton_unstable(props, ref); + + useListItemButtonStyles_unstable(state); + + // TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts + // https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md + useCustomStyleHook_unstable('useListItemButtonStyles_unstable')(state); + return renderListItemButton_unstable(state); +}); + +ListItemButton.displayName = 'ListItemButton'; diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.types.ts b/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.types.ts new file mode 100644 index 00000000000000..f1ede327f93bdd --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/ListItemButton.types.ts @@ -0,0 +1,17 @@ +import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; + +export type ListItemButtonSlots = { + root: Slot<'div'>; +}; + +/** + * ListItemButton Props + */ +export type ListItemButtonProps = ComponentProps & {}; + +/** + * State used in rendering ListItemButton + */ +export type ListItemButtonState = ComponentState; +// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from ListItemButtonProps. +// & Required> diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/__snapshots__/ListItemButton.test.tsx.snap b/packages/react-components/react-list-preview/src/components/ListItemButton/__snapshots__/ListItemButton.test.tsx.snap new file mode 100644 index 00000000000000..2345bfffaad677 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/__snapshots__/ListItemButton.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ListItemButton renders a default state 1`] = ` +
+
+ Default ListItemButton +
+
+`; diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/index.ts b/packages/react-components/react-list-preview/src/components/ListItemButton/index.ts new file mode 100644 index 00000000000000..d0e6b911f3b00f --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/index.ts @@ -0,0 +1,5 @@ +export * from './ListItemButton'; +export * from './ListItemButton.types'; +export * from './renderListItemButton'; +export * from './useListItemButton'; +export * from './useListItemButtonStyles.styles'; diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/renderListItemButton.tsx b/packages/react-components/react-list-preview/src/components/ListItemButton/renderListItemButton.tsx new file mode 100644 index 00000000000000..2dc4e639cc5336 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/renderListItemButton.tsx @@ -0,0 +1,15 @@ +/** @jsxRuntime automatic */ +/** @jsxImportSource @fluentui/react-jsx-runtime */ + +import { assertSlots } from '@fluentui/react-utilities'; +import type { ListItemButtonState, ListItemButtonSlots } from './ListItemButton.types'; + +/** + * Render the final JSX of ListItemButton + */ +export const renderListItemButton_unstable = (state: ListItemButtonState) => { + assertSlots(state); + + // TODO Add additional slots in the appropriate place + return ; +}; diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/useListItemButton.ts b/packages/react-components/react-list-preview/src/components/ListItemButton/useListItemButton.ts new file mode 100644 index 00000000000000..859a19a3abbde8 --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/useListItemButton.ts @@ -0,0 +1,34 @@ +import * as React from 'react'; +import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities'; +import type { ListItemButtonProps, ListItemButtonState } from './ListItemButton.types'; + +/** + * Create the state required to render ListItemButton. + * + * The returned state can be modified with hooks such as useListItemButtonStyles_unstable, + * before being passed to renderListItemButton_unstable. + * + * @param props - props from this instance of ListItemButton + * @param ref - reference to root HTMLDivElement of ListItemButton + */ +export const useListItemButton_unstable = ( + props: ListItemButtonProps, + ref: React.Ref, +): ListItemButtonState => { + return { + // TODO add appropriate props/defaults + components: { + // TODO add each slot's element type or component + root: 'div', + }, + // TODO add appropriate slots, for example: + // mySlot: resolveShorthand(props.mySlot), + root: slot.always( + getIntrinsicElementProps('div', { + ref, + ...props, + }), + { elementType: 'div' }, + ), + }; +}; diff --git a/packages/react-components/react-list-preview/src/components/ListItemButton/useListItemButtonStyles.styles.ts b/packages/react-components/react-list-preview/src/components/ListItemButton/useListItemButtonStyles.styles.ts new file mode 100644 index 00000000000000..3d02534c60488c --- /dev/null +++ b/packages/react-components/react-list-preview/src/components/ListItemButton/useListItemButtonStyles.styles.ts @@ -0,0 +1,33 @@ +import { makeStyles, mergeClasses } from '@griffel/react'; +import type { SlotClassNames } from '@fluentui/react-utilities'; +import type { ListItemButtonSlots, ListItemButtonState } from './ListItemButton.types'; + +export const listItemButtonClassNames: SlotClassNames = { + root: 'fui-ListItemButton', + // TODO: add class names for all slots on ListItemButtonSlots. + // Should be of the form `: 'fui-ListItemButton__` +}; + +/** + * Styles for the root slot + */ +const useStyles = makeStyles({ + root: { + // TODO Add default styles for the root element + }, + + // TODO add additional classes for different states and/or slots +}); + +/** + * Apply styling to the ListItemButton slots based on the state + */ +export const useListItemButtonStyles_unstable = (state: ListItemButtonState): ListItemButtonState => { + const styles = useStyles(); + state.root.className = mergeClasses(listItemButtonClassNames.root, styles.root, state.root.className); + + // TODO Add class names to slots, for example: + // state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className); + + return state; +}; diff --git a/packages/react-components/react-list-preview/src/index.ts b/packages/react-components/react-list-preview/src/index.ts new file mode 100644 index 00000000000000..a7c3bc4e86c036 --- /dev/null +++ b/packages/react-components/react-list-preview/src/index.ts @@ -0,0 +1,18 @@ +export { List, listClassNames, renderList_unstable, useListStyles_unstable, useList_unstable } from './List'; +export type { ListProps, ListSlots, ListState } from './List'; +export { + ListItem, + listItemClassNames, + renderListItem_unstable, + useListItemStyles_unstable, + useListItem_unstable, +} from './ListItem'; +export type { ListItemProps, ListItemSlots, ListItemState } from './ListItem'; +export { + ListItemButton, + listItemButtonClassNames, + renderListItemButton_unstable, + useListItemButtonStyles_unstable, + useListItemButton_unstable, +} from './ListItemButton'; +export type { ListItemButtonProps, ListItemButtonSlots, ListItemButtonState } from './ListItemButton'; diff --git a/packages/react-components/react-list-preview/src/testing/isConformant.ts b/packages/react-components/react-list-preview/src/testing/isConformant.ts new file mode 100644 index 00000000000000..a3d988f29a1728 --- /dev/null +++ b/packages/react-components/react-list-preview/src/testing/isConformant.ts @@ -0,0 +1,15 @@ +import { isConformant as baseIsConformant } from '@fluentui/react-conformance'; +import type { IsConformantOptions, TestObject } from '@fluentui/react-conformance'; +import griffelTests from '@fluentui/react-conformance-griffel'; + +export function isConformant( + testInfo: Omit, 'componentPath'> & { componentPath?: string }, +) { + const defaultOptions: Partial> = { + tsConfig: { configName: 'tsconfig.spec.json' }, + componentPath: require.main?.filename.replace('.test', ''), + extraTests: griffelTests as TestObject, + }; + + baseIsConformant(defaultOptions, testInfo); +} diff --git a/packages/react-components/react-list-preview/stories/List/ListBestPractices.md b/packages/react-components/react-list-preview/stories/List/ListBestPractices.md new file mode 100644 index 00000000000000..08ff8ddeeb5f86 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/List/ListBestPractices.md @@ -0,0 +1,5 @@ +## Best practices + +### Do + +### Don't diff --git a/packages/react-components/react-list-preview/stories/List/ListDefault.stories.tsx b/packages/react-components/react-list-preview/stories/List/ListDefault.stories.tsx new file mode 100644 index 00000000000000..0169f28c0a3808 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/List/ListDefault.stories.tsx @@ -0,0 +1,4 @@ +import * as React from 'react'; +import { List, ListProps } from '@fluentui/react-list-preview'; + +export const Default = (props: Partial) => ; diff --git a/packages/react-components/react-list-preview/stories/List/ListDescription.md b/packages/react-components/react-list-preview/stories/List/ListDescription.md new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/packages/react-components/react-list-preview/stories/List/index.stories.tsx b/packages/react-components/react-list-preview/stories/List/index.stories.tsx new file mode 100644 index 00000000000000..bda361cec97ed7 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/List/index.stories.tsx @@ -0,0 +1,18 @@ +import { List } from '@fluentui/react-list-preview'; + +import descriptionMd from './ListDescription.md'; +import bestPracticesMd from './ListBestPractices.md'; + +export { Default } from './ListDefault.stories'; + +export default { + title: 'Preview Components/List', + component: List, + parameters: { + docs: { + description: { + component: [descriptionMd, bestPracticesMd].join('\n'), + }, + }, + }, +}; diff --git a/packages/react-components/react-list-preview/stories/ListItem/ListItemBestPractices.md b/packages/react-components/react-list-preview/stories/ListItem/ListItemBestPractices.md new file mode 100644 index 00000000000000..08ff8ddeeb5f86 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/ListItem/ListItemBestPractices.md @@ -0,0 +1,5 @@ +## Best practices + +### Do + +### Don't diff --git a/packages/react-components/react-list-preview/stories/ListItem/ListItemDefault.stories.tsx b/packages/react-components/react-list-preview/stories/ListItem/ListItemDefault.stories.tsx new file mode 100644 index 00000000000000..e38a36d8cbcfcb --- /dev/null +++ b/packages/react-components/react-list-preview/stories/ListItem/ListItemDefault.stories.tsx @@ -0,0 +1,4 @@ +import * as React from 'react'; +import { ListItem, ListItemProps } from '@fluentui/react-list-preview'; + +export const Default = (props: Partial) => ; diff --git a/packages/react-components/react-list-preview/stories/ListItem/ListItemDescription.md b/packages/react-components/react-list-preview/stories/ListItem/ListItemDescription.md new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/packages/react-components/react-list-preview/stories/ListItem/index.stories.tsx b/packages/react-components/react-list-preview/stories/ListItem/index.stories.tsx new file mode 100644 index 00000000000000..fdd4db71031fff --- /dev/null +++ b/packages/react-components/react-list-preview/stories/ListItem/index.stories.tsx @@ -0,0 +1,18 @@ +import { ListItem } from '@fluentui/react-list-preview'; + +import descriptionMd from './ListItemDescription.md'; +import bestPracticesMd from './ListItemBestPractices.md'; + +export { Default } from './ListItemDefault.stories'; + +export default { + title: 'Preview Components/ListItem', + component: ListItem, + parameters: { + docs: { + description: { + component: [descriptionMd, bestPracticesMd].join('\n'), + }, + }, + }, +}; diff --git a/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonBestPractices.md b/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonBestPractices.md new file mode 100644 index 00000000000000..08ff8ddeeb5f86 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonBestPractices.md @@ -0,0 +1,5 @@ +## Best practices + +### Do + +### Don't diff --git a/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonDefault.stories.tsx b/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonDefault.stories.tsx new file mode 100644 index 00000000000000..7ab8767f6cdcf1 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonDefault.stories.tsx @@ -0,0 +1,4 @@ +import * as React from 'react'; +import { ListItemButton, ListItemButtonProps } from '@fluentui/react-list-preview'; + +export const Default = (props: Partial) => ; diff --git a/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonDescription.md b/packages/react-components/react-list-preview/stories/ListItemButton/ListItemButtonDescription.md new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/packages/react-components/react-list-preview/stories/ListItemButton/index.stories.tsx b/packages/react-components/react-list-preview/stories/ListItemButton/index.stories.tsx new file mode 100644 index 00000000000000..21996d5ecd6c91 --- /dev/null +++ b/packages/react-components/react-list-preview/stories/ListItemButton/index.stories.tsx @@ -0,0 +1,18 @@ +import { ListItemButton } from '@fluentui/react-list-preview'; + +import descriptionMd from './ListItemButtonDescription.md'; +import bestPracticesMd from './ListItemButtonBestPractices.md'; + +export { Default } from './ListItemButtonDefault.stories'; + +export default { + title: 'Preview Components/ListItemButton', + component: ListItemButton, + parameters: { + docs: { + description: { + component: [descriptionMd, bestPracticesMd].join('\n'), + }, + }, + }, +}; diff --git a/packages/react-components/react-list-preview/tsconfig.json b/packages/react-components/react-list-preview/tsconfig.json new file mode 100644 index 00000000000000..1941a041d46c19 --- /dev/null +++ b/packages/react-components/react-list-preview/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2019", + "noEmit": true, + "isolatedModules": true, + "importHelpers": true, + "jsx": "react", + "noUnusedLocals": true, + "preserveConstEnums": true + }, + "include": [], + "files": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./.storybook/tsconfig.json" + } + ] +} diff --git a/packages/react-components/react-list-preview/tsconfig.lib.json b/packages/react-components/react-list-preview/tsconfig.lib.json new file mode 100644 index 00000000000000..6f90cf95c005bd --- /dev/null +++ b/packages/react-components/react-list-preview/tsconfig.lib.json @@ -0,0 +1,22 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "lib": ["ES2019", "dom"], + "declaration": true, + "declarationDir": "../../../dist/out-tsc/types", + "outDir": "../../../dist/out-tsc", + "inlineSources": true, + "types": ["static-assets", "environment"] + }, + "exclude": [ + "./src/testing/**", + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.stories.ts", + "**/*.stories.tsx" + ], + "include": ["./src/**/*.ts", "./src/**/*.tsx"] +} diff --git a/packages/react-components/react-list-preview/tsconfig.spec.json b/packages/react-components/react-list-preview/tsconfig.spec.json new file mode 100644 index 00000000000000..911456fe4b4d91 --- /dev/null +++ b/packages/react-components/react-list-preview/tsconfig.spec.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.d.ts", + "./src/testing/**/*.ts", + "./src/testing/**/*.tsx" + ] +} diff --git a/packages/react-components/react-provider/etc/react-provider.api.md b/packages/react-components/react-provider/etc/react-provider.api.md index fb3d21fb48d3ed..f6e1b8b9a45762 100644 --- a/packages/react-components/react-provider/etc/react-provider.api.md +++ b/packages/react-components/react-provider/etc/react-provider.api.md @@ -52,6 +52,9 @@ export const FluentProvider: React_2.ForwardRefExoticComponent void; useDropdownStyles_unstable: (state: unknown) => void; useListboxStyles_unstable: (state: unknown) => void; + useListStyles_unstable: (state: unknown) => void; + useListItemStyles_unstable: (state: unknown) => void; + useListItemButtonStyles_unstable: (state: unknown) => void; useOptionStyles_unstable: (state: unknown) => void; useOptionGroupStyles_unstable: (state: unknown) => void; useDividerStyles_unstable: (state: unknown) => void; diff --git a/packages/react-components/react-shared-contexts/etc/react-shared-contexts.api.md b/packages/react-components/react-shared-contexts/etc/react-shared-contexts.api.md index 5e8dedfa99ce76..589cb6ad16d4f2 100644 --- a/packages/react-components/react-shared-contexts/etc/react-shared-contexts.api.md +++ b/packages/react-components/react-shared-contexts/etc/react-shared-contexts.api.md @@ -47,6 +47,9 @@ export const CustomStyleHooksContext_unstable: React_2.Context