Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const config = async (): Promise<KnipConfig> => {
const baseProject = knip.project ?? ['src/**/*'];
const project = knip.extraProject ? [...baseProject, ...knip.extraProject] : baseProject;

const ignoreDependencies: string[] = [];
const ignoreDependencies: string[] = knip.ignoreDependencies ?? [];

return [
relativePath,
Expand Down
19 changes: 17 additions & 2 deletions lage.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const config = {
// which doesn't exist, so lage silently drops the edge. Point at the
// specific root target with the packageName#task syntax so every
// package's tests wait for the whole-repo build to finish.
dependsOn: ['@fluentui-react-native/root#build'],
dependsOn: ['@fluentui-react-native/root#root-build'],
inputs: [],
outputs: [],
},
Expand All @@ -44,10 +44,25 @@ const config = {
'lint-repo': {
cache: false,
},
prebuild: {
/**
* Prebuild is a pre-build step that can either modify the source code or generate additional files in the project.
*/
dependsOn: ['^prebuild'],
inputs: ['**/*', '!node_modules/**/*', '!dist/**/*', '!lib/**/*', '!lib-commonjs/**/*'],
outputs: ['lib/**/*', 'src/**/*'],
},
'root-prebuild': {
cache: false,
},
'root-build': {
dependsOn: ['@fluentui-react-native/root#root-prebuild'],
cache: false,
},

// ── Pipeline aliases ───────────────────────────────────────────────────
'repo-checks': ['lint-repo', 'check-publishing'],
buildci: ['lint-repo', 'check-publishing', 'build', 'test', 'lint'],
buildci: ['lint-repo', 'check-publishing', '@fluentui-react-native/root#root-build', 'test', 'lint'],

// ── Worker tasks ───────────────────────────────────────────────────────
'test-links': {
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
"scripts"
],
"scripts": {
"build": "tsgo -b",
"clean-all": "node ./scripts/src/preinstall/clean-all.ts",
"build": "lage root-build",
"docs": "yarn workspace fluent-rn-website start",
"bundle:repo": "lage bundle",
"clean": "lage clean",
"clean": "tsgo -b --clean && lage clean",
"clean-all": "node ./scripts/src/preinstall/clean-all.ts",
Comment thread
JasonVMo marked this conversation as resolved.
"change": "node .github/scripts/change.mts",
"changeset:version": "node .github/scripts/changeset-version-with-postbump.mts",
"change:check": "node .github/scripts/change.mts --check",
"check-publishing": "node ./scripts/src/cli.ts check-publishing",
"lint-fix": "cross-env FURN_FIX_MODE=true lage lint",
"root-build": "tsgo -b",
"root-prebuild": "lage prebuild",
"preinstall": "node ./scripts/src/preinstall/use-yarn-please.ts",
"format": "oxfmt",
"format:check": "oxfmt --check",
Expand Down
1 change: 1 addition & 0 deletions packages/agentic-components/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@fluentui-react-native/scripts/jest-config');
77 changes: 77 additions & 0 deletions packages/agentic-components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "@fluentui-react-native/agentic-components",
"version": "0.1.0",
"private": true,
"description": "A library of agent-generated FluentUI React Native components",
"license": "MIT",
"author": "",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/fluentui-react-native.git",
"directory": "packages/agentic-components"
},
"type": "module",
"main": "lib/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"react-native": "./src/index.ts",
"import": "./lib/index.js",
"default": "./src/index.ts"
}
},
"scripts": {
"build": "tsgo -b",
"clean": "fluentui-scripts clean",
"depcheck": "fluentui-scripts depcheck",
"format": "fluentui-scripts format",
"lint": "fluentui-scripts lint",
"test": "fluentui-scripts jest",
"update-snapshots": "fluentui-scripts jest -u"
},
"devDependencies": {
"@babel/core": "catalog:",
"@fluentui-react-native/scripts": "workspace:*",
"@react-native-community/cli": "^20.0.0",
"@react-native-community/cli-platform-android": "^20.0.0",
"@react-native-community/cli-platform-ios": "^20.0.0",
"@react-native/babel-preset": "^0.81.0",
"@react-native/metro-config": "^0.81.0",
"@types/react": "~19.1.4",
"@types/react-test-renderer": "^19.1.0",
"react": "19.1.4",
"react-native": "^0.81.6",
"react-native-macos": "^0.81.0",
"react-test-renderer": "19.1.4"
},
"peerDependencies": {
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.4",
"react": "18.2.0 || 19.0.0 || 19.1.4",
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.6",
"react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"react-native-macos": {
"optional": true
}
},
"furn": {
"jestPlatform": "macos"
},
"rnx-kit": {
"kitType": "library",
"alignDeps": {
"capabilities": [
"core",
"core-macos",
"react-test-renderer"
]
},
"extends": "@fluentui-react-native/scripts/kit-config"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Button component tests renders in a disabled state 1`] = `
<View
acceptsFirstMouse={false}
accessibilityRole="button"
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": true,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
enableFocusRing={false}
focusable={false}
keyDownEvents={
[
{
"key": " ",
},
{
"key": "Enter",
},
]
}
mouseDownCanMoveWindow={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
[
{
"alignItems": "center",
"backgroundColor": "#0078d4",
"borderRadius": 4,
"justifyContent": "center",
"paddingHorizontal": 16,
"paddingVertical": 8,
},
false,
{
"backgroundColor": "#c8c8c8",
},
undefined,
]
}
>
<Text
style={
[
{
"color": "#ffffff",
"fontSize": 14,
"fontWeight": "600",
},
{
"color": "#888888",
},
]
}
>
Disabled
</Text>
</View>
`;

exports[`Button component tests renders with a title 1`] = `
<View
acceptsFirstMouse={true}
accessibilityRole="button"
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": false,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={true}
collapsable={false}
enableFocusRing={true}
focusable={true}
keyDownEvents={
[
{
"key": " ",
},
{
"key": "Enter",
},
]
}
mouseDownCanMoveWindow={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
[
{
"alignItems": "center",
"backgroundColor": "#0078d4",
"borderRadius": 4,
"justifyContent": "center",
"paddingHorizontal": 16,
"paddingVertical": 8,
},
false,
undefined,
undefined,
]
}
>
<Text
style={
[
{
"color": "#ffffff",
"fontSize": 14,
"fontWeight": "600",
},
undefined,
]
}
>
Click me
</Text>
</View>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { Meta, StoryObj } from '@storybook/react-native';
import { Button } from './button';

/**
* Storybook stories for the {@link Button} component. These are loaded by the storybook app in
* `packages/agentic-components/storybook` via its `.storybook/main` stories glob.
*/
const meta: Meta<typeof Button> = {
title: 'Components/Button',
component: Button,
args: {
title: 'Button',
disabled: false,
},
};

export default meta;

type Story = StoryObj<typeof Button>;

export const Default: Story = {};

export const Disabled: Story = {
args: {
title: 'Disabled',
disabled: true,
},
};
34 changes: 34 additions & 0 deletions packages/agentic-components/src/components/button/button.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as React from 'react';
import * as renderer from 'react-test-renderer';
import { Button } from './button';

describe('Button component tests', () => {
it('renders with a title', () => {
let component: renderer.ReactTestRenderer;
renderer.act(() => {
component = renderer.create(React.createElement(Button, { title: 'Click me' }));
});
expect(component!.toJSON()).toMatchSnapshot();
});

it('renders in a disabled state', () => {
let component: renderer.ReactTestRenderer;
renderer.act(() => {
component = renderer.create(React.createElement(Button, { title: 'Disabled', disabled: true }));
});
expect(component!.toJSON()).toMatchSnapshot();
});

it('fires onPress when pressed', () => {
const onPress = jest.fn();
let component: renderer.ReactTestRenderer;
renderer.act(() => {
component = renderer.create(React.createElement(Button, { title: 'Press', onPress }));
});
const pressable = component!.root.findByProps({ accessibilityRole: 'button' });
renderer.act(() => {
pressable.props.onPress({});
});
expect(onPress).toHaveBeenCalledTimes(1);
});
});
Loading
Loading