Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

Add power-apps plugin with genpage skill for generative pages (#11)

Akshay Maloob13917042ab2
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index e9d205a0c..6c1795491 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -33,6 +33,17 @@
}
}
}
+ },
+ {
+ "name": "power-apps",
+ "description": "Build and deploy Power Apps generative pages for model-driven apps.",
+ "version": "1.0.0",
+ "author": {
+ "name": "Microsoft"
+ },
+ "source": "./plugins/power-apps",
+ "category": "development",
+ "strict": false
}
]
}
diff --git a/.claude/settings.json b/.claude/settings.json
new file mode 100644
index 000000000..39fb30474
--- /dev/null
+++ b/.claude/settings.json
@@ -0,0 +1,13 @@
+{
+ "permissions": {
+ "allow": [
+ "Bash(pac *)",
+ "Bash(node *)",
+ "Bash(dotnet *)",
+ "Bash(powershell *)",
+ "Read",
+ "Write",
+ "Edit"
+ ]
+ }
+}
diff --git a/README.md b/README.md
index 01e8d8154..276ecbc8c 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,12 @@ Create and deploy Power Pages sites using modern development approaches.
**Currently supported**: Code Sites (SPAs) with React, Angular, Vue, or Astro
+### Power Apps (`plugins/power-apps`)
+
+Build and deploy Power Apps generative pages for model-driven apps.
+
+**Stack**: React + TypeScript + Fluent, deployed via PAC CLI
+
## Installation
### Add from GitHub Marketplace
diff --git a/plugins/power-apps/.claude-plugin/plugin.json b/plugins/power-apps/.claude-plugin/plugin.json
new file mode 100644
index 000000000..ce50213d8
--- /dev/null
+++ b/plugins/power-apps/.claude-plugin/plugin.json
@@ -0,0 +1,23 @@
+{
+ "name": "power-apps",
+ "version": "1.0.0",
+ "description": "Build and deploy Power Apps generative pages for model-driven apps.",
+ "author": {
+ "name": "Microsoft",
+ "url": "https://www.microsoft.com"
+ },
+ "homepage": "https://github.com/microsoft/power-platform-claude-plugins/",
+ "repository": "https://github.com/microsoft/power-platform-claude-plugins/",
+ "license": "MIT",
+ "keywords": [
+ "power-apps",
+ "generative-pages",
+ "genux",
+ "genpage",
+ "react",
+ "fluent-ui",
+ "dataverse",
+ "pac-cli",
+ "model-driven"
+ ]
+}
diff --git a/plugins/power-apps/AGENTS.md b/plugins/power-apps/AGENTS.md
new file mode 100644
index 000000000..ce2976a02
--- /dev/null
+++ b/plugins/power-apps/AGENTS.md
@@ -0,0 +1,90 @@
+# Power Apps Plugin - Development Guidelines
+
+This file provides instructions for Claude Code when working on the Power Apps plugin specifically.
+
+## Overview
+
+The Power Apps plugin helps users build and deploy Power Apps generative pages (genux pages) for model-driven apps. It provides an interactive workflow from requirements gathering through PAC CLI deployment, generating React 17 + TypeScript + Fluent UI V9 single-file components.
+
+This is a single-session workflow plugin — no memory bank is needed. Each `/genpage` invocation completes the full cycle: validate prerequisites, gather requirements, generate schema, produce code, and deploy.
+
+## Skills
+
+| Skill | Description |
+|-------|-------------|
+| `/genpage` | Build and deploy a generative page for a model-driven Power App |
+
+### Skill Structure
+
+```
+skills/<skill-name>/
+└── SKILL.md # Main skill workflow (links to shared/)
+
+../../shared/ # Shared resources (references + samples)
+├── references/
+│ ├── genux-rules-reference.md
+│ ├── pac-cli-reference.md
+│ └── troubleshooting.md
+└── samples/ # Example .tsx files
+```
+
+### Skill Header Pattern
+
+```markdown
+---
+name: genpage
+description: Does X for Y # Third person, specific, <160 chars
+user-invocable: true
+allowed-tools: [...]
+---
+
+# Skill Title
+```
+
+### Writing Clean Skills (Anti-Bloat Guidelines)
+
+Follow these rules to keep skills concise and effective:
+
+**DO:**
+- Keep SKILL.md under 500 lines total
+- Use short, descriptive `name` field (e.g., `genpage`)
+- Write descriptions in third person ("Creates X" not "This skill guides you through creating X")
+- Use numbered lists for workflows instead of ASCII diagrams
+- Trust Claude's intelligence - omit explanations of well-known concepts
+- Use progressive disclosure: SKILL.md for workflow, reference files for details
+- Link to shared references inline: `See [troubleshooting.md](../../shared/references/troubleshooting.md)`
+
+**DON'T:**
+- Start with "This skill/document guides/covers/describes..." (AI slop)
+- Include ASCII workflow diagrams (waste 50+ lines)
+- Duplicate content between summary and action sections
+- Explain obvious concepts Claude already knows
+- Add verbose tables for simple lists (use inline format instead)
+- Repeat the same information in multiple places
+
+## Key Concepts
+
+### Genux Pages
+
+Generative pages (genux) are React 17 + TypeScript single-file components that run inside model-driven Power Apps. They use Fluent UI V9 for styling and the DataAPI for Dataverse data access. Each page is a single `.tsx` file with `export default GeneratedComponent`.
+
+### Model-Driven Apps
+
+Power Apps model-driven apps are data-first applications built on Dataverse. Genux pages extend these apps with custom React-based UI pages deployed via PAC CLI.
+
+### DataAPI
+
+The DataAPI (`props.dataApi`) provides typed CRUD operations against Dataverse tables. It uses RuntimeTypes.ts (generated by `pac model genpage generate-types`) for type safety. Column names must be verified from the generated schema — never guessed.
+
+### RuntimeTypes
+
+TypeScript type definitions generated from Dataverse metadata. Contains entity types, enum registrations, and the `GeneratedComponentProps` interface. Generated via PAC CLI before code generation to ensure correct column names.
+
+## Testing Changes
+
+After modifying this plugin:
+
+1. Run `claude --debug` to see plugin loading details
+2. Test skill invocation with `/genpage`
+3. Verify tool restrictions work (should only allow pac, powershell, node commands)
+4. Test with both Dataverse entity pages and mock data pages
diff --git a/plugins/power-apps/commands/genpage.md b/plugins/power-apps/commands/genpage.md
new file mode 100644
index 000000000..bfc6ffc4c
--- /dev/null
+++ b/plugins/power-apps/commands/genpage.md
@@ -0,0 +1,12 @@
+# Build Generative Page
+
+Read and follow the instructions in `${CLAUDE_PLUGIN_ROOT}/skills/genpage/SKILL.md`.
+
+**Important**:
+
+- Do not announce steps - just execute them
+- Validate prerequisites (Node.js, PAC CLI) before proceeding
+- Generate RuntimeTypes.ts schema BEFORE writing any code for Dataverse pages
+- NEVER guess column names - always verify from generated schema
+- Ask user which app to deploy to - never assume a default
+- Use PAC CLI for all deployment operations
diff --git a/plugins/power-apps/github/copilot-instructions.md b/plugins/power-apps/github/copilot-instructions.md
new file mode 100644
index 000000000..9a2737dc9
--- /dev/null
+++ b/plugins/power-apps/github/copilot-instructions.md
@@ -0,0 +1,316 @@
+# Power Apps Generative Pages Builder
+
+You are the **GenPage** skill — an expert in building and deploying Power Apps generative pages using React + TypeScript + Fluent for model-driven apps.
+
+When the user asks you to create, generate, build, or deploy a generative page (or says "genpage", "genux", "gen page"), follow the complete workflow below.
+
+---
+
+## Prerequisites
+
+Before starting any page generation, validate:
+- **Node.js** installed (`node --version`)
+- **PAC CLI** installed (`pac --version`). If not found, instruct: `dotnet tool install --global Microsoft.PowerApps.CLI.Tool`
+- **PAC CLI authenticated** (`pac auth list`). If no active profile, guide user through `pac auth create --environment <url>`
+
+---
+
+## References
+
+- **Code generation rules**: [genux-rules-reference.md](../shared/references/genux-rules-reference.md) — Full rules, DataAPI types, layout patterns, common errors
+- **PAC CLI commands**: [pac-cli-reference.md](../shared/references/pac-cli-reference.md) — All PAC CLI commands and parameters
+- **Troubleshooting**: [troubleshooting.md](../shared/references/troubleshooting.md) — Common issues and fixes
+- **Sample pages**: [samples/](../shared/samples/)
+
+---
+
+## Workflow
+
+Follow these steps in order for every generative page request.
+
+### Step 1: Validate Prerequisites
+
+Run prerequisite checks (once per session):
+
+```powershell
+node --version
+pac --version
+pac auth list
+```
+
+If PAC CLI is not authenticated, guide the user:
+```powershell
+pac auth create --environment https://your-env.crm.dynamics.com
+```
+
+If multiple auth profiles exist, show the list and ask which environment to use:
+```powershell
+pac auth select --index <n>
+```
+
+### Step 2: Gather Requirements
+
+Ask these questions interactively:
+
+1. **"What would you like to create?"** — form, dashboard, grid, list, wizard, report, etc.
+2. **"Will this page use Dataverse entities or mock data?"**
+ - If entities: ask which entities and fields (use logical names — singular, lowercase, e.g., `"account"`)
+ - If mock data: confirm you'll generate realistic sample data
+3. **"Any specific requirements?"** — styling, features (search, filtering, sorting), accessibility, responsive behavior
+
+If the user already provided a description, acknowledge it and ask only clarifying questions.
+
+### Step 3: Plan and Confirm
+
+Present a clear plan:
+
+```
+I'll create a [page type] with:
+- Data: [entities or mock data with specifics]
+- Features: [list key features]
+- Components: [Fluent UI components to use]
+- Layout: [responsive design approach]
+
+Does this plan look good? Any changes needed?
+```
+
+Wait for confirmation. Revise if needed.
+
+### Step 4: Generate Schema and Verify Columns (Dataverse Pages Only)
+
+**CRITICAL — DO THIS BEFORE WRITING ANY CODE.** Column name hallucination is the #1 source of runtime errors. Never guess column names.
+
+If the page uses Dataverse entities, generate the TypeScript schema NOW — before code generation:
+
+```powershell
+pac model genpage generate-types --data-sources "entity1,entity2" --output-file RuntimeTypes.ts
+```
+
+After generating, **read the RuntimeTypes.ts file** and:
+1. Identify the actual column names available on each entity
+2. Note which columns are readonly vs writable
+3. Note the enum/choice set names and values
+4. Use ONLY these verified column names when generating code in the next step
+
+> **NEVER guess or assume column names.** Custom entities (e.g., `cr69c_candidate`) have unpredictable column names (e.g., `cr69c_fullname` not `cr69c_name`). The only way to know the real names is to read them from the generated schema.
+
+If schema generation fails (auth issues, entity not found), resolve the issue before proceeding to code generation. Do NOT generate code with guessed column names.
+
+**For mock data pages:** Skip this step.
+
+### Step 5: Read Code Generation Rules and Samples
+
+Before generating code, read the comprehensive rules and a relevant sample:
+
+1. **Read [genux-rules-reference.md](../shared/references/genux-rules-reference.md)** — Full code generation rules, DataAPI types, layout patterns, common errors.
+2. **Read a relevant sample** from [samples/](../shared/samples/):
+
+| Sample | Use When |
+|--------|----------|
+| [1-account-grid.tsx](../shared/samples/1-account-grid.tsx) | DataGrid with Dataverse entities |
+| [2-wizard-multi-step.tsx](../shared/samples/2-wizard-multi-step.tsx) | Multi-step wizard flow |
+| [3-poa-revocation-wizard.tsx](../shared/samples/3-poa-revocation-wizard.tsx) | Complex wizard with forms |
+| [4-account-crud-dataverse.tsx](../shared/samples/4-account-crud-dataverse.tsx) | Full CRUD operations |
+| [5-file-upload.tsx](../shared/samples/5-file-upload.tsx) | File upload pattern |
+| [6-navigation-sidebar.tsx](../shared/samples/6-navigation-sidebar.tsx) | Sidebar navigation layout |
+| [7-comprehensive-form.tsx](../shared/samples/7-comprehensive-form.tsx) | Complex form with validation |
+| [8-responsive-cards.tsx](../shared/samples/8-responsive-cards.tsx) | Card-based responsive layout |
+
+### Step 6: Generate Code
+
+Generate complete TypeScript following ALL rules in [genux-rules-reference.md](../shared/references/genux-rules-reference.md). **For Dataverse pages, use ONLY the column names verified from RuntimeTypes.ts in Step 4.** Output in this format:
+
+1. **Agent Thoughts** — step-by-step reasoning, requirements analysis, assumptions
+2. **Summary** — non-technical bulleted list of what was built
+3. **Final Code** — complete, ready-to-run TypeScript (no placeholders, no TODOs)
+
+Save the code to a `.tsx` file (e.g., `account-dashboard.tsx`).
+
+### Step 7: Deploy
+
+After generating code, ALWAYS ask:
+> "Would you like to publish this page to Power Apps?"
+
+If yes, see [pac-cli-reference.md](../shared/references/pac-cli-reference.md) for full command details.
+
+**For Dataverse entity pages** (schema already generated in Step 4):
+
+```powershell
+# List available apps
+pac model list
+```
+
+**CRITICAL:** Ask the user: "Which app would you like to publish this page to? Please provide the app-id or app name from the list above."
+- **NEVER** choose a default app or assume an app-id
+- **ACCEPT BOTH** app-id (GUID) or app name — if user provides an app name, run `pac model list` to look up the corresponding app-id
+- **WAIT** for user response before proceeding
+
+```powershell
+# Upload new page (after user provides app-id or name)
+pac model genpage upload `
+ --app-id <user-provided-app-id-or-name> `
+ --code-file page-name.tsx `
+ --name "Page Display Name" `
+ --data-sources "entity1,entity2" `
+ --prompt "User's original request summary" `
+ --add-to-sitemap
+```
+
+**For mock data pages** (skip schema generation):
+
+```powershell
+pac model list
+# Ask user for app selection, then:
+pac model genpage upload `
+ --app-id <user-provided-app-id-or-name> `
+ --code-file page-name.tsx `
+ --name "Page Display Name" `
+ --prompt "User's original request summary" `
+ --add-to-sitemap
+```
+
+**For updating existing pages** (use `--page-id`, omit `--add-to-sitemap`):
+
+```powershell
+pac model genpage upload `
+ --app-id <app-id-or-name> `
+ --page-id <page-id> `
+ --code-file page-name.tsx `
+ --data-sources "entity1,entity2" `
+ --prompt "Summary of changes"
+# --name is optional when updating; omit to keep existing name
+```
+
+### Step 8: Final Summary
+
+After deployment, provide:
+- Confirmation of successful upload
+- How to find the page in the app
+- Next steps (test in browser, share with team)
+- Offer to make updates or create additional pages
+
+---
+
+## Code Generation Rules (Quick Reference)
+
+For the full rules, see [genux-rules-reference.md](../shared/references/genux-rules-reference.md).
+
+### Critical Rules
+
+1. **React 17 + TypeScript** — all code must use React 17 (no React 18 features like `useTransition`, `createRoot`, concurrent mode)
+2. **Fluent UI V9** — use `@fluentui/react-components` exclusively (DatePicker from `@fluentui/react-datepicker-compat` with `mountNode` prop)
+3. **Single File** — all code in one `.tsx` file; each component/utility as separate top-level function (no nesting)
+4. **Limited Imports** — only React, Fluent UI V9, approved Fluent icons, and D3.js for charts
+5. **DataAPI** — ONLY use when explicit TableRegistrations provided; otherwise use mocked data
+6. **Entity Logical Names** — singular lowercase (e.g., `"account"` not `"accounts"`)
+7. **Styling** — use `makeStyles` with Fluent `tokens`; inline styles only for dynamic values
+8. **Responsive** — flexbox and relative units; NEVER use `100vh`/`100vw`
+9. **Icons** — import from `@fluentui/react-icons`, use unsized variants only
+10. **No External Libraries** — no React Router or assumptions of implicit dependencies
+11. **No FluentProvider** — already provided at root; don't add in components
+12. **Forbidden** — don't use `createTheme`, `mergeThemes`, `useTheme` (don't exist in Fluent UI V9)
+
+### Supported Libraries
+
+```
+"react": "^17.0.2"
+"uuid": "^9.0.1"
+"@fluentui/react-icons": "^2.0.292"
+"@fluentui/react-calendar-compat": "^0.2.2"
+"@fluentui/react-components": "^9.46.4"
+"@fluentui/react-datepicker-compat": "^0.5.0"
+"@fluentui/react-theme": "^9.1.24"
+"d3": "^7.9.0"
+```
+
+Do NOT use any library not in this list.
+
+### Component Template
+
+```typescript
+import {useEffect, useState} from 'react';
+import type {
+ TableRow,
+ DataColumnValue,
+ RowKeyDataColumnValue,
+ QueryTableOptions,
+ ReadableTableRow,
+ ExtractFields,
+ GeneratedComponentProps
+} from "./RuntimeTypes";
+
+// Additional imports: @fluentui/react-components, @fluentui/react-icons, d3, etc.
+
+// Utility functions as separate top-level functions
+
+// Sub-components as separate top-level functions
+
+const GeneratedComponent = (props: GeneratedComponentProps) => {
+ const { dataApi } = props;
+ // Component implementation
+}
+
+export default GeneratedComponent;
+```
+
+### DataAPI Quick Reference
+
+```typescript
+// Query with pagination
+const result = await dataApi.queryTable("account", {
+ select: ["name", "revenue"],
+ filter: `contains(name,'test')`,
+ orderBy: `name asc`,
+ pageSize: 50
+});
+
+// Load more rows
+if (result.hasMoreRows && result.loadMoreRows) {
+ const nextPage = await result.loadMoreRows();
+}
+
+// Create, Update, Retrieve
+await dataApi.createRow("account", { name: "New Account" });
+await dataApi.updateRow("account", "record-id", { name: "Updated" });
+const row = await dataApi.retrieveRow("account", { id: "record-id", select: ["name"] });
+
+// Access formatted values (for enums, lookups, dates, etc.)
+const formatted = row["[email protected]"];
+
+// Lookup fields: raw value is a GUID — use formatted value for display name
+const contactGuid = row._primarycontactid_value; // GUID — don't display this
+const contactName = row["_primarycontactid_value@OData.Community.Display.V1.FormattedValue"]; // "John Smith" — display this
+
+// Get enum choices
+const choices = await dataApi.getChoices("account-statecode");
+```
+
+**DataAPI Rules:**
+- ONLY use `dataApi` when TableRegistrations are provided — never assume tables/fields exist
+- **NEVER guess column names** — always verify from RuntimeTypes.ts generated in Step 4
+- **Lookup fields** (e.g., `_primarycontactid_value`) return a GUID, not a display name. Always use the `@OData.Community.Display.V1.FormattedValue` annotation for display
+- Use entity logical names — singular lowercase (e.g., `"account"`)
+- Only reference columns that exist in the generated schema
+- If no types provided, use mocked sample data
+- Always wrap async `dataApi` calls in try-catch with error + loading states
+- DataGrid: use `createTableColumn`, enable sorting by default
+
+### Verification Checklist
+
+Before finalizing any generated code, verify ALL:
+1. All critical rules followed (React 17, Fluent V9, single file, etc.)
+2. All user requirements implemented
+3. All UI elements fully functional
+4. Exports default React component; compiles without errors
+5. Scrolling only on content bodies, not entire page
+6. All imports present and correct; no unused imports
+7. No placeholders, ellipses, or "unchanged" comments
+8. Responsive design; accessible (ARIA, keyboard nav, WCAG AA)
+9. No undefined identifiers or hardcoded values
+10. Output format compliance (Agent Thoughts, Summary, Final Code)
+
+---
+
+For full DataAPI type definitions, see [genux-rules-reference.md](../shared/references/genux-rules-reference.md).
+For PAC CLI command details, see [pac-cli-reference.md](../shared/references/pac-cli-reference.md).
+For troubleshooting, see [troubleshooting.md](../shared/references/troubleshooting.md).
diff --git a/plugins/power-apps/shared/references/genux-rules-reference.md b/plugins/power-apps/shared/references/genux-rules-reference.md
new file mode 100644
index 000000000..32601418a
--- /dev/null
+++ b/plugins/power-apps/shared/references/genux-rules-reference.md
@@ -0,0 +1,405 @@
+# Genux Code Generation Rules Reference
+
+Comprehensive rules for generating genux page code. Read this file during code generation (Step 6).
+
+---
+
+## Critical Rules
+
+1. **React 17 + TypeScript**: All code must use React 17 with TypeScript
+2. **Fluent UI V9**: Use `@fluentui/react-components` (DatePicker from `@fluentui/react-datepicker-compat` with `mountNode` prop)
+3. **Single File**: All code (components, utilities) in one file; each as separate top-level function (no nesting)
+4. **Limited Imports**: Only React, Fluent UI V9, FluentUI icons, and D3.js for charts
+5. **DataAPI**: ONLY use when explicit TableRegistrations provided; otherwise use mocked data
+6. **Entity Logical Names**: Use singular lowercase (e.g., `"account"` not `"accounts"`)
+7. **Styling**: Use `makeStyles` with tokens; avoid inline styles except for dynamic values
+8. **Responsive Design**: Use flexbox and relative units; NEVER use `100vh`/`100vw`
+9. **Icons**: Import from `@fluentui/react-icons`; use unsized variants only (e.g., `AddRegular` not `Add24Regular`)
+10. **No External Libraries**: No routing libraries (React Router) or assumptions of implicit dependencies
+11. **No FluentProvider**: Already provided at root; don't add in components
+12. **Forbidden Functions**: Don't use `createTheme`, `mergeThemes`, `useTheme` (don't exist in Fluent UI V9)
+
+---
+
+## Supported Libraries
+
+Only these libraries are available. Do NOT use any other library.
+
+```
+"react": "^17.0.2"
+"uuid": "^9.0.1"
+"@fluentui/react-icons": "^2.0.292"
+"@fluentui/react-calendar-compat": "^0.2.2"
+"@fluentui/react-components": "^9.46.4"
+"@fluentui/react-datepicker-compat": "^0.5.0"
+"@fluentui/react-theme": "^9.1.24"
+"d3": "^7.9.0"
+```
+
+**CRITICAL**: DatePicker must be imported from `@fluentui/react-datepicker-compat` (NOT `@fluentui/react-components`)
+
+---
+
+## Component Structure
+
+Standard component pattern:
+
+```typescript
+import {useEffect, useState} from 'react';
+import type {
+ TableRow,
+ DataColumnValue,
+ RowKeyDataColumnValue,
+ QueryTableOptions,
+ ReadableTableRow,
+ ExtractFields,
+ GeneratedComponentProps
+} from "./RuntimeTypes";
+
+// Additional imports: @fluentui/react-components, @fluentui/react-icons, @fluentui/react-datepicker-compat, d3
+
+// Utility functions as separate top-level functions
+
+// Sub-components as separate top-level functions
+
+const GeneratedComponent = (props: GeneratedComponentProps) => {
+ const { dataApi } = props;
+ // Component implementation
+}
+
+export default GeneratedComponent;
+```
+
+---
+
+## Layout and Styling
+
+### Design Principles
+- Follow Microsoft Fluent Design System principles
+- Use sentence case for all text
+- Use theme tokens (e.g., `tokens.spacingVerticalXL`, `tokens.colorNeutralBackground1`)
+- `makeStyles` for styling; inline styles only for dynamic values
+- Group content in sections for visual separation
+
+### Responsive Design
+- Mobile-first; adapt to 320px, 480px, 768px, 1024px, 1440px breakpoints
+- Use relative units (%, rem, em); avoid fixed widths
+- Root container is flex column; use flex properties to fill space
+- `boxSizing: border-box`; images: `max-width: 100%, height: auto`
+- NEVER use `100vh`/`100vw`
+
+### Page Layout
+- Page-level functions (nav, search, filters) in header opposite title
+- Only scrollable bodies scroll, not entire page
+- Fix height of parent, set overflow on content area
+- Consistent padding/spacing; strong text contrast
+- Include hover/focus/active states
+
+### Scrollable Areas
+- Use fixed `maxHeight` for parent + `overflow: auto` for scrollable area
+- Calculate `maxHeight: calc(100% - [fixed element heights])`
+- Only content area scrolls, never entire page
+- Example:
+```typescript
+<div style={{ maxHeight: 'calc(100% - 100px)', overflow: 'auto' }}>
+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
+ {/* scrollable content */}
+ </div>
+</div>
+```
+
+### Navigation
+- Multiple screens: Use Fluent UI V9 Tabs/Breadcrumbs
+- Provide back/forward navigation for wizard flows
+- No React Router or hash/history API routing
+
+### User-Provided Mockups/Screenshots
+- When user provides mockups, those take precedence for layout, structure, and visual design
+- Follow the provided design closely while adapting to Fluent UI V9 components
+- Maintain all technical constraints: accessibility (ARIA, keyboard nav, WCAG AA), responsive design, proper semantic HTML
+- If the mockup conflicts with accessibility or responsive design requirements, prioritize accessibility while staying as close to the visual design as possible
+- Translate design elements to equivalent Fluent UI components (e.g., custom buttons -> Fluent Button with appropriate styling)
+
+---
+
+## Accessibility
+
+- Use semantic HTML elements (`button`, `nav`, `main`, `section`, etc.)
+- Add `aria-label` to icon-only buttons and interactive elements
+- Use `aria-labelledby`/`aria-describedby` for form sections
+- Ensure text contrast meets WCAG AA standards (use theme tokens)
+- Include keyboard navigation support (tab order, enter/space for actions)
+- Example:
+```typescript
+<Button aria-label="Delete item" icon={<DeleteRegular />} />
+<section aria-labelledby="form-title" aria-describedby="form-desc">
+ <Text id="form-title">Account Form</Text>
+</section>
+```
+
+---
+
+## Special Patterns
+
+### Charts and Visualization
+- Use D3.js for all charts
+- D3 uses `group()` not `nest()`
+- Include tooltips, hover states, click behaviors
+- Smooth transitions (300-500ms)
+
+### Image Generation
+- You CANNOT generate images or media files
+- If user requests an image, create similar visuals using SVG and CSS
+- Add styling/animations to make SVG/CSS graphics visually appealing
+- NEVER use external image URLs or libraries unless user explicitly requests it
+
+### File Upload (Fluent UI V9 has no file uploader component)
+```typescript
+const fileInputRef = useRef<HTMLInputElement>(null);
+const [uploadedFiles, setUploadedFiles] = useState<File[]>([]);
+
+const handleFileUpload = (event: React.ChangeEvent<HTMLInputElement>) => {
+ if (event.target.files) {
+ setUploadedFiles(prev => [...prev, ...Array.from(event.target.files)]);
+ }
+};
+
+return (
+ <>
+ <input
+ type="file"
+ multiple
+ ref={fileInputRef}
+ onChange={handleFileUpload}
+ style={{ display: "none" }}
+ />
+ <Button onClick={() => fileInputRef.current?.click()}>
+ Upload Files
+ </Button>
+ {/* Display uploaded files list */}
+ </>
+);
+```
+
+---
+
+## DataAPI Rules
+
+**CRITICAL - MUST FOLLOW ALL:**
+
+1. **Only use dataApi when TableRegistrations provided** - NEVER assume tables/entities/fields exist
+2. **NEVER guess column names** - Always verify from the generated RuntimeTypes.ts schema. Custom entities have unpredictable column names (e.g., `cr69c_fullname` not `cr69c_name`). Generate schema first, read it, then write code.
+3. **Entity logical names** - Singular lowercase (e.g., `"account"`)
+4. **Only defined fields** - Reference only columns that exist in the generated schema
+5. **Mocked data fallback** - If no types provided, use sample data
+6. **No placeholder CRUD** - Don't include CRUD calls without proper types
+7. **No dynamic column generation** - Don't generate DataGrid columns from assumed schemas
+8. **Preserve API signatures** - Don't rename dataApi methods/parameters
+9. **Check TableRegistrations** - Only use tables defined in TableRegistrations interface
+10. **Follow dataApi_definition** - Use the DataAPI interfaces defined below
+
+### DataGrid Requirements
+- Import `createTableColumn` from Fluent UI V9
+- Define all columns using `createTableColumn`
+- Enable column sorting by default (use `sortable: true` on columns)
+- Enable column filtering when appropriate for user data exploration
+- Don't connect to Dataverse without explicit table registrations
+- Use mocked data if no data source provided
+
+---
+
+## DataAPI Type Definitions
+
+```typescript
+// Core Types
+export type DataColumnValue = string | number | boolean | Date | null;
+export type RowKeyDataColumnValue = string;
+
+export interface DataRow {
+ [column: string]: DataColumnValue
+}
+
+export type TableRow<R extends DataRow = DataRow> = R;
+
+export interface DataTable<T> {
+ rows: T[];
+ hasMoreRows: boolean;
+ loadMoreRows?: () => Promise<DataTable<T>>;
+}
+
+export type ExtractFields<T, FieldType = DataColumnValue> = {
+ [K in keyof T as Required<T>[K] extends FieldType ? K : never]: T[K]
+};
+
+export type ExtractSelectable<E> = {
+ [K in keyof ExtractFields<E, DataColumnValue>]: E[K]
+};
+
+export type ReadableTableRow<E> = ExtractSelectable<E> & {
+ [K in keyof ExtractFields<E, DataColumnValue> as `${Extract<K, string>}@OData.Community.Display.V1.FormattedValue`]?: string
+};
+
+// Helper to exclude readonly properties
+export type ExcludeReadonly<T> = {
+ [P in keyof T as (<Q>() => Q extends { [K in P]: T[P] } ? 1 : 2) extends
+ (<Q>() => Q extends { -readonly [K in P]: T[P] } ? 1 : 2) ? P : never]: T[P]
+};
+
+export type WritableTableRow<E extends TableRow> = {
+ [K in keyof ExcludeReadonly<ExtractFields<E, DataColumnValue>>]: E[K]
+}
+
+// Query Options
+export interface QueryTableOptions<E extends TableRow> {
+ select?: (keyof ExtractSelectable<E>)[];
+ pageSize?: number;
+ filter?: string; // ODATA $filter
+ orderBy?: string; // ODATA $orderby
+}
+
+export interface RetrieveRowOptions<E extends TableRow> {
+ id: string;
+ select?: (keyof ExtractSelectable<E>)[];
+}
+
+// Registrations
+export interface BaseTableRegistrations {
+ [tableName: string]: TableRow;
+}
+
+export interface BaseEnumRegistrations {
+ [enumName: string]: number;
+}
+
+export interface EnumChoice<E extends EnumName<ER>, ER extends BaseEnumRegistrations> {
+ label: string;
+ value: ER[E];
+}
+
+// Main API Interface
+export interface BaseUxAgentDataApi<TR extends BaseTableRegistrations, ER extends BaseEnumRegistrations> {
+ createRow<T extends keyof TR>(tableName: T, row: WritableTableRow<TR[T]>): Promise<RowKeyDataColumnValue>;
+ updateRow<T extends keyof TR>(tableName: T, rowId: RowKeyDataColumnValue, row: WritableTableRow<TR[T]>): Promise<void>;
+ deleteRow<T extends keyof TR>(tableName: T, rowId: RowKeyDataColumnValue): Promise<void>;
+ retrieveRow<T extends keyof TR>(tableName: T, options: RetrieveRowOptions<TR[T]>): Promise<ReadableTableRow<TR[T]>>;
+ queryTable<T extends keyof TR>(tableName: T, query: QueryTableOptions<TR[T]>): Promise<DataTable<ReadableTableRow<TR[T]>>>;
+ getChoices<E extends EnumName<ER>>(enumName: E): Promise<EnumChoice<E, ER>[]>;
+}
+```
+
+---
+
+## DataAPI Usage Examples
+
+```typescript
+// User-provided type definitions example (when provided):
+const enum Table1Status { Active = 0, Dormant = 1 }
+
+type Table1 = TableRow<{
+ readonly id: RowKeyDataColumnValue;
+ name: string;
+ phoneNumber?: string;
+ status?: Table1Status;
+}>
+
+interface TableRegistrations extends BaseTableRegistrations {
+ "table1": Table1; // Use logical name as key
+}
+
+interface EnumRegistrations extends BaseEnumRegistrations {
+ "table1-status": Table1Status;
+}
+
+declare const dataApi: BaseUxAgentDataApi<TableRegistrations, EnumRegistrations>;
+
+// Query with pagination
+const result = await dataApi.queryTable("table1", {
+ select: ["name", "status"],
+ filter: `contains(name,'test')`,
+ orderBy: `name asc`,
+ pageSize: 50
+});
+
+// Load more pages
+if (result.hasMoreRows && result.loadMoreRows) {
+ const nextPage = await result.loadMoreRows();
+}
+
+// Create
+await dataApi.createRow("table1", {
+ name: "New Record",
+ status: Table1Status.Active
+});
+
+// Update
+await dataApi.updateRow("table1", "record-id", {
+ name: "Updated"
+});
+
+// Retrieve
+const row = await dataApi.retrieveRow("table1", {
+ id: "record-id",
+ select: ["name", "status"]
+});
+
+// Access formatted values (for enums, lookups, dates, etc.)
+const formattedStatus = row["[email protected]"];
+
+// Lookup fields: raw value is a GUID — use formatted value for display name
+const contactGuid = row._primarycontactid_value; // GUID — don't display this
+const contactName = row["_primarycontactid_value@OData.Community.Display.V1.FormattedValue"]; // "John Smith" — display this
+
+// Get enum choices
+const choices = await dataApi.getChoices("table1-status");
+```
+
+---
+
+## Common Errors
+
+### 1. Undefined Identifier
+Every identifier must be defined or imported. Don't assume implicit availability.
+```typescript
+// Error: processData not defined
+const result = processData(data);
+
+// Fix 1: Define
+function processData(data) { return data.map(x => x * 2); }
+
+// Fix 2: Import
+import { processData } from "@package";
+```
+
+### 2. Missing Error Handling
+Always wrap async dataApi calls in try-catch.
+```typescript
+// Error: Unhandled promise rejection
+const data = await dataApi.queryTable("table1", {});
+
+// Fix: Wrap in try-catch
+try {
+ const data = await dataApi.queryTable("table1", {});
+ setRecords(data.rows);
+} catch (error) {
+ console.error("Failed to load data:", error);
+ setErrorMessage("Unable to load data. Please try again.");
+}
+```
+
+### 3. Inline Styles Instead of makeStyles
+Use `makeStyles` with tokens.
+```typescript
+// Error: Using inline styles for static styling
+<div style={{ padding: "20px", gap: "16px", display: "flex" }}>
+
+// Fix: Use makeStyles
+const useStyles = makeStyles({
+ container: {
+ display: "flex",
+ gap: tokens.spacingVerticalL,
+ padding: tokens.spacingHorizontalXL
+ }
+});
+const styles = useStyles();
+<div className={styles.container}>
+```
diff --git a/plugins/power-apps/shared/references/pac-cli-reference.md b/plugins/power-apps/shared/references/pac-cli-reference.md
new file mode 100644
index 000000000..8cd267e14
--- /dev/null
+++ b/plugins/power-apps/shared/references/pac-cli-reference.md
@@ -0,0 +1,93 @@
+# PAC CLI Reference for Generative Pages
+
+Official documentation: https://learn.microsoft.com/en-us/power-platform/developer/cli/reference/model
+
+---
+
+## Authentication
+
+```powershell
+# Create new auth profile
+pac auth create --environment https://your-env.crm.dynamics.com
+
+# List auth profiles (* = active)
+pac auth list
+
+# Select active profile by index
+pac auth select --index <n>
+```
+
+---
+
+## Schema Generation
+
+Generate TypeScript types from Dataverse entity metadata. **Must be run before code generation for entity-based pages.**
+
+```powershell
+pac model genpage generate-types --data-sources "account,contact" --output-file RuntimeTypes.ts
+```
+
+---
+
+## App and Page Listing
+
+```powershell
+# List all model-driven apps in the environment
+pac model list
+
+# List all genux pages in a specific app
+pac model genpage list --app-id <app-id>
+```
+
+---
+
+## Upload New Page
+
+```powershell
+pac model genpage upload `
+ --app-id <app-id> `
+ --code-file page.tsx `
+ --name "Page Display Name" `
+ --data-sources "entity1,entity2" `
+ --prompt "Description of the page" `
+ --add-to-sitemap
+```
+
+---
+
+## Upload Update to Existing Page
+
+```powershell
+pac model genpage upload `
+ --app-id <app-id> `
+ --page-id <page-id> `
+ --code-file page.tsx `
+ --data-sources "entity1,entity2" `
+ --prompt "Summary of changes"
+# --name is optional when updating; omit to keep existing name
+```
+
+---
+
+## Download Existing Page
+
+```powershell
+pac model genpage download `
+ --app-id <app-id> `
+ --page-id <page-id> `
+ -o ./output-dir
+```
+
+---
+
+## Key Parameters
+
+| Parameter | When Required | Notes |
+|-----------|--------------|-------|
+| `--app-id` | Always | Get from `pac model list`. Use the GUID. If user gives app name, look up the GUID first. |
+| `--code-file` | Always (upload) | Path to `.tsx` file |
+| `--name` | New pages only | Display name. Optional on updates (omit to keep existing). |
+| `--page-id` | Updates only | Get from `pac model genpage list` |
+| `--data-sources` | Entity pages | Comma-separated logical names matching code + schema |
+| `--prompt` | Always (upload) | Original user request or summary. Essential for context. |
+| `--add-to-sitemap` | New pages only | Adds page to app navigation. Do NOT use on updates. |
diff --git a/plugins/power-apps/shared/references/troubleshooting.md b/plugins/power-apps/shared/references/troubleshooting.md
new file mode 100644
index 000000000..a4ef594a4
--- /dev/null
+++ b/plugins/power-apps/shared/references/troubleshooting.md
@@ -0,0 +1,59 @@
+# Troubleshooting
+
+Common issues when building and deploying generative pages.
+
+---
+
+## PAC CLI Not Found
+
+- Install: `dotnet tool install --global Microsoft.PowerApps.CLI.Tool`
+- Or download from the [Microsoft Power Platform CLI](https://learn.microsoft.com/en-us/power-platform/developer/cli/introduction) page
+- Verify: `pac --version`
+
+---
+
+## Authentication Fails
+
+- Run `pac auth create --environment <url>` and complete browser sign-in
+- Verify with `pac auth list` — look for `*` on the active profile
+- Check network connectivity to the Dataverse environment
+- If token expired, run `pac auth create` again to refresh
+
+---
+
+## Schema Generation Fails
+
+- Verify entity names are logical names (singular, lowercase: `"account"` not `"Account"`)
+- Check authentication: `pac auth list`
+- Try one entity at a time to isolate the issue
+- Ensure the entities exist in your environment
+- Check for typos in entity logical names
+
+---
+
+## Page Upload Fails
+
+- Verify app-id: run `pac model list` to get the correct GUID
+- Ensure `--name` is provided for new pages
+- Check `.tsx` file exists and has no syntax errors
+- Verify `--data-sources` matches entities used in code
+- Ensure schema was generated for entity-based pages
+- If updating, ensure `--page-id` is correct (get from `pac model genpage list`)
+
+---
+
+## Page Not Appearing in App
+
+- Verify `--add-to-sitemap` was used for new pages
+- Refresh the browser / clear cache
+- Check user permissions in Power Apps
+- Verify the app-id is correct for the target app
+
+---
+
+## RuntimeTypes Issues
+
+- Generate schema BEFORE uploading: `pac model genpage generate-types --data-sources "entity1" --output-file RuntimeTypes.ts`
+- Keep `RuntimeTypes.ts` in the same directory as the `.tsx` file
+- Regenerate schema if Dataverse metadata has changed
+- If column names don't match, re-run `generate-types` — never guess column names
diff --git a/plugins/power-apps/shared/samples/1-account-grid.tsx b/plugins/power-apps/shared/samples/1-account-grid.tsx
new file mode 100644
index 000000000..09d0a7b78
--- /dev/null
+++ b/plugins/power-apps/shared/samples/1-account-grid.tsx
@@ -0,0 +1,61 @@
+import React, { useState } from "react";
+import { DataGrid, DataGridHeader, DataGridBody, DataGridRow, DataGridCell, DataGridHeaderCell, TableCellLayout, createTableColumn, Text, Input } from "@fluentui/react-components";
+
+type Account = { id: string; name: string; address1_city: string; address1_stateorprovince: string; address1_postalcode: string; address1_country: string; telephone1: string; };
+
+const sampleAccounts: Account[] = [
+ { id: "1", name: "John Doe Corp", address1_city: "New York", address1_stateorprovince: "NY", address1_postalcode: "10001", address1_country: "USA", telephone1: "123-456-7890" },
+ { id: "2", name: "Jane Smith LLC", address1_city: "Los Angeles", address1_stateorprovince: "CA", address1_postalcode: "90001", address1_country: "USA", telephone1: "987-654-3210" },
+ { id: "3", name: "Acme Inc", address1_city: "Chicago", address1_stateorprovince: "IL", address1_postalcode: "60601", address1_country: "USA", telephone1: "555-555-5555" },
+ { id: "4", name: "Globex Corporation", address1_city: "Houston", address1_stateorprovince: "TX", address1_postalcode: "77001", address1_country: "USA", telephone1: "444-444-4444" },
+ { id: "5", name: "Initech", address1_city: "Phoenix", address1_stateorprovince: "AZ", address1_postalcode: "85001", address1_country: "USA", telephone1: "333-333-3333" },
+];
+
+const GeneratedComponent = () => {
+ const [accounts] = useState<Account[]>(sampleAccounts);
+ const [filterText, setFilterText] = useState("");
+ const filteredAccounts = accounts.filter(acc => {
+ const s = filterText.toLowerCase();
+ return [acc.name, acc.address1_city, acc.address1_stateorprovince, acc.address1_postalcode, acc.address1_country, acc.telephone1].some(f => f.toLowerCase().includes(s));
+ });
+
+ const col = (id: keyof Account, label: string) => createTableColumn<Account>({
+ columnId: id, compare: (a, b) => a[id].localeCompare(b[id]),
+ renderHeaderCell: () => <Text weight="bold" size={400} style={{ padding: 8 }}>{label}</Text>,
+ renderCell: (item) => <TableCellLayout>{item[id]}</TableCellLayout>
+ });
+
+ const columns = [
+ col("name", "Account Name"),
+ col("address1_city", "City"),
+ col("address1_stateorprovince", "State"),
+ col("address1_postalcode", "Zip"),
+ col("address1_country", "Country"),
+ col("telephone1", "Phone")
+ ];
+
+ return (
+ <div style={{ flexGrow: 1, alignSelf: "stretch", width: "100%", height: "100%", padding: 20, boxSizing: "border-box", overflow: "hidden", display: "flex", flexDirection: "column" }}>
+ <Text size={600} weight="semibold" block style={{ marginBottom: 12 }}>Account Grid</Text>
+ <Input placeholder="Filter accounts..." value={filterText} onChange={(e, d) => setFilterText(d.value)} style={{ marginBottom: 12, maxWidth: 300 }} />
+ <div style={{ flex: 1, overflow: "auto" }}>
+ <DataGrid items={filteredAccounts} columns={columns} sortable selectionMode="multiselect" getRowId={i => i.id} focusMode="composite">
+ <DataGridHeader>
+ <DataGridRow selectionCell={{ checkboxIndicator: { "aria-label": "Select all rows" } }}>
+ {({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>}
+ </DataGridRow>
+ </DataGridHeader>
+ <DataGridBody<Account>>
+ {({ item, rowId }) => (
+ <DataGridRow<Account> key={rowId} selectionCell={{ checkboxIndicator: { "aria-label": "Select row" } }}>
+ {({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
+ </DataGridRow>
+ )}
+ </DataGridBody>
+ </DataGrid>
+ </div>
+ </div>
+ );
+};
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/2-wizard-multi-step.tsx b/plugins/power-apps/shared/samples/2-wizard-multi-step.tsx
new file mode 100644
index 000000000..7e843d439
--- /dev/null
+++ b/plugins/power-apps/shared/samples/2-wizard-multi-step.tsx
@@ -0,0 +1,190 @@
+import React, { useState } from 'react';
+import { Button, Text, RadioGroup, Radio, Divider, ProgressBar } from '@fluentui/react-components';
+
+const GeneratedComponent = () => {
+ const [currentStep, setCurrentStep] = useState(0);
+ const [responses, setResponses] = useState({
+ signatureQuestion1: '',
+ signatureQuestion2: '',
+ recencyQuestion: '',
+ complianceQuestion1: '',
+ complianceQuestion2: '',
+ complianceQuestion3: '',
+ });
+
+ const steps = [
+ { content: <SignatureStep responses={responses} setResponses={setResponses} /> },
+ { content: <RecencyStep responses={responses} setResponses={setResponses} /> },
+ { content: <ComplianceStep responses={responses} setResponses={setResponses} /> },
+ { content: <ConfirmationStep responses={responses} /> },
+ ];
+
+ const totalSteps = steps.length;
+ const progress = (currentStep + 1) / totalSteps;
+
+ const handleNext = () => {
+ if (validateStep()) {
+ setCurrentStep((prevStep) => prevStep + 1);
+ }
+ };
+
+ const handleBack = () => {
+ setCurrentStep((prevStep) => prevStep - 1);
+ };
+
+ const validateStep = () => {
+ const validationMap: Record<number, boolean> = {
+ 0: Boolean(responses.signatureQuestion1 && responses.signatureQuestion2),
+ 1: Boolean(responses.recencyQuestion),
+ 2: Boolean(responses.complianceQuestion1 && responses.complianceQuestion2 && responses.complianceQuestion3),
+ };
+ return currentStep === 3 || validationMap[currentStep];
+ };
+
+ return (
+ <div style={{ width: '100%', height: '100%', padding: '0.5rem', boxSizing: 'border-box', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
+ <ProgressBar
+ value={progress}
+ thickness="large"
+ shape="rounded"
+ style={{ marginBottom: '0.75rem', width: '100%', maxWidth: '800px' }}
+ aria-valuenow={progress * 100}
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-label="Wizard progress"
+ />
+ <section
+ style={{
+ marginTop: '0.75rem',
+ padding: '0.75rem',
+ borderRadius: tokens.borderRadiusSmall,
+ boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
+ width: '100%',
+ maxWidth: '800px',
+ backgroundColor: '#fff',
+ }}
+ role="region"
+ aria-labelledby={`step-title-${currentStep}`}
+ >
+ {steps[currentStep].content}
+ </section>
+ <div style={{ marginTop: '0.75rem', display: 'flex', justifyContent: 'space-between', width: '100%', maxWidth: '800px' }}>
+ <Button appearance="secondary" disabled={currentStep === 0} onClick={handleBack} aria-label="Go to previous step">
+ Back
+ </Button>
+ {currentStep < steps.length - 1 ? (
+ <Button appearance="primary" disabled={!validateStep()} onClick={handleNext} aria-label="Go to next step">
+ Next
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ );
+};
+
+const SignatureStep = ({ responses, setResponses }: { responses: any; setResponses: any }) => (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
+ <Text id="signature-q1" size={300} block>
+ The Power of Attorney has been signed and dated by a principal:
+ </Text>
+ <RadioGroup
+ aria-labelledby="signature-q1"
+ value={responses.signatureQuestion1}
+ onChange={(e, data) => setResponses({ ...responses, signatureQuestion1: data.value })}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ <Divider />
+ <Text id="signature-q2" size={300} block>
+ The signature has been acknowledged before a notary public or individual authorized by law to take acknowledgement:
+ </Text>
+ <RadioGroup
+ aria-labelledby="signature-q2"
+ value={responses.signatureQuestion2}
+ onChange={(e, data) => setResponses({ ...responses, signatureQuestion2: data.value })}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ </div>
+);
+
+const RecencyStep = ({ responses, setResponses }: { responses: any; setResponses: any }) => (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
+ <Text id="recency-q" size={300} block>
+ The Power of Attorney has been signed less than 60 days ago:
+ </Text>
+ <RadioGroup
+ aria-labelledby="recency-q"
+ value={responses.recencyQuestion}
+ onChange={(e, data) => setResponses({ ...responses, recencyQuestion: data.value })}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ </div>
+);
+
+const ComplianceStep = ({ responses, setResponses }: { responses: any; setResponses: any }) => (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
+ <Text id="compliance-q1" size={300} block>
+ This PoA does not write a will for someone nor edit a current will:
+ </Text>
+ <RadioGroup
+ aria-labelledby="compliance-q1"
+ value={responses.complianceQuestion1}
+ onChange={(e, data) => setResponses({ ...responses, complianceQuestion1: data.value })}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ <Divider />
+ <Text id="compliance-q2" size={300} block>
+ This PoA does not take money from someone's bank account:
+ </Text>
+ <RadioGroup
+ aria-labelledby="compliance-q2"
+ value={responses.complianceQuestion2}
+ onChange={(e, data) => setResponses({ ...responses, complianceQuestion2: data.value })}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ <Divider />
+ <Text id="compliance-q3" size={300} block>
+ This PoA does not make decisions after the represented person died:
+ </Text>
+ <RadioGroup
+ aria-labelledby="compliance-q3"
+ value={responses.complianceQuestion3}
+ onChange={(e, data) => setResponses({ ...responses, complianceQuestion3: data.value })}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ </div>
+);
+
+const ConfirmationStep = ({ responses }: { responses: any }) => (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
+ <Text id="confirmation-title" size={300} block>
+ Review your responses:
+ </Text>
+ <div style={{ marginTop: '0.75rem', padding: '0.5rem', border: '1px solid #ddd', borderRadius: tokens.borderRadiusSmall }}>
+ <Text size={300}>Step 1 - Signature:</Text>
+ <Text>The Power of Attorney has been signed and dated by a principal: {responses.signatureQuestion1}</Text>
+ <Text>The signature has been acknowledged before a notary public: {responses.signatureQuestion2}</Text>
+ <Divider />
+ <Text size={300}>Step 2 - Recency:</Text>
+ <Text>The Power of Attorney has been signed less than 60 days ago: {responses.recencyQuestion}</Text>
+ <Divider />
+ <Text size={300}>Step 3 - Compliance:</Text>
+ <Text>This PoA does not write a will for someone nor edit a current will: {responses.complianceQuestion1}</Text>
+ <Text>This PoA does not take money from someone's bank account: {responses.complianceQuestion2}</Text>
+ <Text>This PoA does not make decisions after the represented person died: {responses.complianceQuestion3}</Text>
+ </div>
+ </div>
+);
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/3-poa-revocation-wizard.tsx b/plugins/power-apps/shared/samples/3-poa-revocation-wizard.tsx
new file mode 100644
index 000000000..9e7906bc7
--- /dev/null
+++ b/plugins/power-apps/shared/samples/3-poa-revocation-wizard.tsx
@@ -0,0 +1,326 @@
+import React, { useState, useRef } from "react";
+import {
+ Button,
+ Text,
+ DataGrid,
+ DataGridHeader,
+ DataGridBody,
+ DataGridRow,
+ DataGridCell,
+ DataGridHeaderCell,
+ TableCellLayout,
+ createTableColumn,
+ RadioGroup,
+ Radio,
+ ProgressBar,
+} from "@fluentui/react-components";
+
+// Mock data for POA records and accounts
+const poaRecords = [
+ { id: "1", name: "John Doe POA", type: "General", createdDate: "2023-01-01" },
+ { id: "2", name: "Jane Smith POA", type: "Limited", createdDate: "2022-12-15" },
+];
+
+const accounts = [
+ { id: "1", accountName: "Checking Account", access: "Active" },
+ { id: "2", accountName: "Savings Account", access: "Active" },
+];
+
+// ** WizardContainer ** //
+const GeneratedComponent = () => {
+ const [currentStep, setCurrentStep] = useState(0); // Tracks the current step
+ const [selectedPOARecord, setSelectedPOARecord] = useState<any>(null); // Stores selected POA record
+ const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Stores uploaded files
+ const [selectedAccounts, setSelectedAccounts] = useState<string[]>([]); // Stores selected accounts
+ const [complianceConfirmation, setComplianceConfirmation] = useState<string>(""); // Stores compliance confirmation
+
+ const steps = [
+ {
+ content: (
+ <SearchPOARecordStep
+ poaRecords={poaRecords}
+ selectedPOARecord={selectedPOARecord}
+ setSelectedPOARecord={setSelectedPOARecord}
+ />
+ ),
+ },
+ {
+ content: (
+ <DocumentationUploadStep
+ uploadedFiles={uploadedFiles}
+ setUploadedFiles={setUploadedFiles}
+ />
+ ),
+ },
+ {
+ content: (
+ <AccountAccessRemovalStep
+ accounts={accounts}
+ selectedAccounts={selectedAccounts}
+ setSelectedAccounts={setSelectedAccounts}
+ />
+ ),
+ },
+ {
+ content: (
+ <ComplianceReviewStep
+ complianceConfirmation={complianceConfirmation}
+ setComplianceConfirmation={setComplianceConfirmation}
+ />
+ ),
+ },
+ {
+ content: <ConfirmationStep />,
+ },
+ ];
+
+ const totalSteps = steps.length;
+ const progress = (currentStep + 1) / totalSteps; // Calculate progress
+
+ const handleNext = () => setCurrentStep((prevStep) => prevStep + 1);
+ const handleBack = () => setCurrentStep((prevStep) => prevStep - 1);
+
+ return (
+ <div style={{ width: "100%", height: "100%", padding: "20px", boxSizing: "border-box", display: "flex", flexDirection: "column" }}>
+ {/* Progress bar */}
+ <ProgressBar value={progress} thickness="large" shape="rounded" style={{ marginBottom: "20px" }} />
+ {/* Wizard content */}
+ <div
+ style={{
+ flex: 1,
+ marginTop: "20px",
+ padding: "20px",
+ borderRadius: tokens.borderRadiusMedium,
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)",
+ overflowY: "auto"
+ }}
+ >
+ {steps[currentStep].content}
+ </div>
+ {/* Navigation buttons */}
+ <div style={{ marginTop: "20px", display: "flex", justifyContent: "space-between" }}>
+ <Button appearance="secondary" disabled={currentStep === 0} onClick={handleBack}>
+ Back
+ </Button>
+ {currentStep < steps.length - 1 ? (
+ <Button appearance="primary" onClick={handleNext}>
+ Next
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ );
+};
+
+// ** SearchPOARecordStep ** //
+const SearchPOARecordStep = ({
+ poaRecords,
+ selectedPOARecord,
+ setSelectedPOARecord,
+}: {
+ poaRecords: any[];
+ selectedPOARecord: any;
+ setSelectedPOARecord: (record: any) => void;
+}) => {
+ const columns = [
+ createTableColumn({
+ columnId: "name",
+ renderHeaderCell: () => "POA Name",
+ renderCell: (item) => <TableCellLayout>{item.name}</TableCellLayout>,
+ }),
+ createTableColumn({
+ columnId: "type",
+ renderHeaderCell: () => "Type",
+ renderCell: (item) => <TableCellLayout>{item.type}</TableCellLayout>,
+ }),
+ createTableColumn({
+ columnId: "createdDate",
+ renderHeaderCell: () => "Created Date",
+ renderCell: (item) => <TableCellLayout>{item.createdDate}</TableCellLayout>,
+ }),
+ ];
+ return (
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
+ <Text size={400} block>
+ Select a POA record to revoke:
+ </Text>
+ <DataGrid
+ items={poaRecords}
+ columns={columns}
+ selectionMode="single"
+ aria-label="POA Records Table"
+ onRowClick={(e, data) => setSelectedPOARecord(data.item)}
+ >
+ <DataGridHeader>
+ <DataGridRow>
+ {({ renderHeaderCell }) => (
+ <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>
+ )}
+ </DataGridRow>
+ </DataGridHeader>
+ <DataGridBody>
+ {({ item }) => (
+ <DataGridRow key={item.id}>
+ {({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
+ </DataGridRow>
+ )}
+ </DataGridBody>
+ </DataGrid>
+ </div>
+ );
+};
+
+// ** DocumentationUploadStep ** //
+const DocumentationUploadStep = ({
+ uploadedFiles,
+ setUploadedFiles,
+}: {
+ uploadedFiles: File[];
+ setUploadedFiles: (files: File[]) => void;
+}) => {
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const handleFileUpload = (event: React.ChangeEvent<HTMLInputElement>) => {
+ if (event.target.files) {
+ setUploadedFiles([...uploadedFiles, ...Array.from(event.target.files)]);
+ }
+ };
+
+ const handleFileRemove = (fileName: string) => {
+ const updatedFiles = uploadedFiles.filter((file) => file.name !== fileName);
+ setUploadedFiles(updatedFiles);
+ };
+
+ const handleButtonClick = () => {
+ fileInputRef.current?.click();
+ };
+
+ return (
+ <div style={{ display: "flex", flexDirection: "column", gap: "20px" }}>
+ <Text size={400} block>
+ Upload revocation documentation:
+ </Text>
+ <div
+ style={{
+ padding: "10px",
+ border: "1px solid #ddd",
+ borderRadius: tokens.borderRadiusMedium,
+ backgroundColor: "#f9f9f9",
+ textAlign: "center",
+ }}
+ >
+ <input
+ type="file"
+ multiple
+ ref={fileInputRef}
+ onChange={handleFileUpload}
+ style={{ display: "none" }}
+ />
+ <Button appearance="primary" onClick={handleButtonClick}>
+ Upload Files
+ </Button>
+ </div>
+ {uploadedFiles.length > 0 && (
+ <div style={{ padding: "10px", border: "1px solid #ddd", borderRadius: tokens.borderRadiusMedium }}>
+ <Text size={400} weight="semibold" block>
+ Uploaded Files:
+ </Text>
+ {uploadedFiles.map((file, index) => (
+ <div key={index} style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
+ <Text size={300}>{file.name}</Text>
+ <Button appearance="subtle" onClick={() => handleFileRemove(file.name)} style={{ marginLeft: "10px" }}>
+ Remove
+ </Button>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+};
+
+// ** AccountAccessRemovalStep ** //
+const AccountAccessRemovalStep = ({
+ accounts,
+ selectedAccounts,
+ setSelectedAccounts,
+}: {
+ accounts: any[];
+ selectedAccounts: string[];
+ setSelectedAccounts: (ids: string[]) => void;
+}) => {
+ const columns = [
+ createTableColumn({
+ columnId: "accountName",
+ renderHeaderCell: () => "Account Name",
+ renderCell: (item) => <TableCellLayout>{item.accountName}</TableCellLayout>,
+ }),
+ createTableColumn({
+ columnId: "access",
+ renderHeaderCell: () => "Access",
+ renderCell: (item) => <TableCellLayout>{item.access}</TableCellLayout>,
+ }),
+ ];
+ return (
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
+ <Text size={400} block>
+ Remove POA authority from designated accounts:
+ </Text>
+ <DataGrid
+ items={accounts}
+ columns={columns}
+ selectionMode="multiselect"
+ aria-label="Accounts Table"
+ onSelectionChange={(e, data) => setSelectedAccounts([...data.selectedItems] as string[])}
+ >
+ <DataGridHeader>
+ <DataGridRow>
+ {({ renderHeaderCell }) => (
+ <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>
+ )}
+ </DataGridRow>
+ </DataGridHeader>
+ <DataGridBody>
+ {({ item }) => (
+ <DataGridRow key={item.id}>
+ {({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
+ </DataGridRow>
+ )}
+ </DataGridBody>
+ </DataGrid>
+ </div>
+ );
+};
+
+// ** ComplianceReviewStep ** //
+const ComplianceReviewStep = ({
+ complianceConfirmation,
+ setComplianceConfirmation,
+}: {
+ complianceConfirmation: string;
+ setComplianceConfirmation: (val: string) => void;
+}) => (
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
+ <Text size={400} block>
+ Confirm compliance with legal requirements:
+ </Text>
+ <RadioGroup
+ value={complianceConfirmation}
+ onChange={(e, data) => setComplianceConfirmation(data.value)}
+ >
+ <Radio value="yes" label="Yes" />
+ <Radio value="no" label="No" />
+ </RadioGroup>
+ </div>
+);
+
+// ** ConfirmationStep ** //
+const ConfirmationStep = () => (
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
+ <Text size={400} block>
+ Revocation complete! Notifications sent and audit logs updated.
+ </Text>
+ </div>
+);
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/4-account-crud-dataverse.tsx b/plugins/power-apps/shared/samples/4-account-crud-dataverse.tsx
new file mode 100644
index 000000000..9c9151373
--- /dev/null
+++ b/plugins/power-apps/shared/samples/4-account-crud-dataverse.tsx
@@ -0,0 +1,196 @@
+import React, { useEffect, useState } from "react";
+import {
+ Button,
+ Input,
+ Text,
+ DataGrid,
+ DataGridHeader,
+ DataGridBody,
+ DataGridRow,
+ DataGridCell,
+ DataGridHeaderCell,
+ TableCellLayout,
+ createTableColumn,
+} from "@fluentui/react-components";
+import type {
+ GeneratedComponentProps,
+ account,
+ ReadableTableRow,
+ WritableTableRow,
+ QueryTableOptions,
+} from "./RuntimeTypes";
+
+const GeneratedComponent = ({ dataApi }: GeneratedComponentProps) => {
+ const [accounts, setAccounts] = useState<ReadableTableRow<account>[]>([]);
+ const [selectedAccount, setSelectedAccount] = useState<ReadableTableRow<account> | null>(null);
+ const [formData, setFormData] = useState<WritableTableRow<account>>({
+ name: "",
+ address1_city: "",
+ address1_stateorprovince: "",
+ address1_postalcode: "",
+ address1_country: "",
+ telephone1: "",
+ });
+
+ // Fetch accounts from Dataverse
+ useEffect(() => {
+ const fetchAccounts = async () => {
+ const query: QueryTableOptions<account> = {
+ select: ["name", "address1_city", "address1_stateorprovince", "address1_postalcode", "address1_country", "telephone1", "accountid"],
+ pageSize: 50,
+ orderBy: "name asc",
+ };
+ const result = await dataApi.queryTable("account", query);
+ setAccounts(result.rows);
+ };
+ fetchAccounts();
+ }, [dataApi]);
+
+ const handleInputChange = (field: keyof WritableTableRow<account>, value: string) => {
+ setFormData((prev) => ({ ...prev, [field]: value }));
+ };
+
+ const handleAddOrUpdate = async () => {
+ if (selectedAccount) {
+ await dataApi.updateRow("account", selectedAccount.accountid, formData);
+ } else {
+ await dataApi.createRow("account", formData);
+ }
+ // Refresh list
+ const query: QueryTableOptions<account> = {
+ select: ["name", "address1_city", "address1_stateorprovince", "address1_postalcode", "address1_country", "telephone1", "accountid"],
+ pageSize: 50,
+ orderBy: "name asc",
+ };
+ const result = await dataApi.queryTable("account", query);
+ setAccounts(result.rows);
+ // Reset form
+ setFormData({
+ name: "",
+ address1_city: "",
+ address1_stateorprovince: "",
+ address1_postalcode: "",
+ address1_country: "",
+ telephone1: "",
+ });
+ setSelectedAccount(null);
+ };
+
+ const handleRowSelect = (account: ReadableTableRow<account>) => {
+ setSelectedAccount(account);
+ setFormData({
+ name: account.name || "",
+ address1_city: account.address1_city || "",
+ address1_stateorprovince: account.address1_stateorprovince || "",
+ address1_postalcode: account.address1_postalcode || "",
+ address1_country: account.address1_country || "",
+ telephone1: account.telephone1 || "",
+ });
+ };
+
+ const columns = [
+ createTableColumn<ReadableTableRow<account>>({
+ columnId: "name",
+ renderHeaderCell: () => "Account Name",
+ renderCell: (item) => <TableCellLayout>{item.name}</TableCellLayout>,
+ }),
+ createTableColumn<ReadableTableRow<account>>({
+ columnId: "address1_city",
+ renderHeaderCell: () => "City",
+ renderCell: (item) => <TableCellLayout>{item.address1_city}</TableCellLayout>,
+ }),
+ createTableColumn<ReadableTableRow<account>>({
+ columnId: "address1_stateorprovince",
+ renderHeaderCell: () => "State",
+ renderCell: (item) => <TableCellLayout>{item.address1_stateorprovince}</TableCellLayout>,
+ }),
+ createTableColumn<ReadableTableRow<account>>({
+ columnId: "address1_postalcode",
+ renderHeaderCell: () => "Zip",
+ renderCell: (item) => <TableCellLayout>{item.address1_postalcode}</TableCellLayout>,
+ }),
+ createTableColumn<ReadableTableRow<account>>({
+ columnId: "address1_country",
+ renderHeaderCell: () => "Country",
+ renderCell: (item) => <TableCellLayout>{item.address1_country}</TableCellLayout>,
+ }),
+ createTableColumn<ReadableTableRow<account>>({
+ columnId: "telephone1",
+ renderHeaderCell: () => "Phone",
+ renderCell: (item) => <TableCellLayout>{item.telephone1}</TableCellLayout>,
+ }),
+ ];
+
+ return (
+ <div style={{ width: "100%", margin: "0 auto", minHeight: "100%", display: "flex", flexDirection: "column", boxSizing: "border-box", padding: "10px" }}>
+ {/* Header */}
+ <header style={{ padding: "10px", textAlign: "center" }}>
+ <Text as="h1" size={800} weight="semibold">
+ Accounts List
+ </Text>
+ </header>
+
+ {/* Content */}
+ <div
+ style={{
+ flex: 1,
+ display: "flex",
+ flexDirection: "row",
+ alignItems: "flex-start",
+ gap: "20px",
+ padding: "10px",
+ flexWrap: "wrap",
+ }}
+ >
+ {/* Form */}
+ <section style={{ flex: "1 1 300px", minWidth: "280px", display: "flex", flexDirection: "column", gap: "8px" }} aria-label="Account form section">
+ <Text as="h2" size={500} block weight="semibold">
+ Account Form
+ </Text>
+ <Input aria-label="Account Name" placeholder="Enter account name" value={formData.name || ""} onChange={(e, data) => handleInputChange("name", data.value)} />
+ <Input aria-label="City" placeholder="Enter city" value={formData.address1_city || ""} onChange={(e, data) => handleInputChange("address1_city", data.value)} />
+ <Input aria-label="State" placeholder="Enter state" value={formData.address1_stateorprovince || ""} onChange={(e, data) => handleInputChange("address1_stateorprovince", data.value)} />
+ <Input aria-label="Zip" placeholder="Enter zip code" value={formData.address1_postalcode || ""} onChange={(e, data) => handleInputChange("address1_postalcode", data.value)} />
+ <Input aria-label="Country" placeholder="Enter country" value={formData.address1_country || ""} onChange={(e, data) => handleInputChange("address1_country", data.value)} />
+ <Input aria-label="Phone" placeholder="Enter phone number" value={formData.telephone1 || ""} onChange={(e, data) => handleInputChange("telephone1", data.value)} />
+ <Button style={{ width: "100%", marginTop: "12px" }} appearance="primary" onClick={handleAddOrUpdate}>
+ {selectedAccount ? "Update Account" : "Add Account"}
+ </Button>
+ </section>
+
+ {/* Grid */}
+ <section style={{ flex: "2 1 400px", minWidth: "300px", display: "flex", flexDirection: "column" }} aria-label="Accounts data grid section">
+ <div style={{ flex: 1, minHeight: 0 }}>
+ <DataGrid
+ items={accounts}
+ columns={columns}
+ selectionMode="single"
+ aria-label="Accounts data grid"
+ style={{ height: "100%" }}
+ onRowClick={(e, data) => handleRowSelect(data.item)}
+ >
+ <DataGridHeader>
+ <DataGridRow>
+ {({ renderHeaderCell }) => (
+ <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>
+ )}
+ </DataGridRow>
+ </DataGridHeader>
+ <DataGridBody<ReadableTableRow<account>>>
+ {({ item }) => (
+ <DataGridRow key={item.accountid}>
+ {({ renderCell }) => (
+ <DataGridCell>{renderCell(item)}</DataGridCell>
+ )}
+ </DataGridRow>
+ )}
+ </DataGridBody>
+ </DataGrid>
+ </div>
+ </section>
+ </div>
+ </div>
+ );
+};
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/5-file-upload.tsx b/plugins/power-apps/shared/samples/5-file-upload.tsx
new file mode 100644
index 000000000..cb8184f13
--- /dev/null
+++ b/plugins/power-apps/shared/samples/5-file-upload.tsx
@@ -0,0 +1,82 @@
+import React, { useRef, useState } from "react";
+import { Button, Text } from "@fluentui/react-components";
+
+const GeneratedComponent = () => {
+ const fileInputRef = useRef<HTMLInputElement>(null); // Ref for hidden file input
+ const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // State for uploaded files
+
+ const handleFileUpload = (event: React.ChangeEvent<HTMLInputElement>) => {
+ if (event.target.files) {
+ setUploadedFiles((prevFiles) => [...prevFiles, ...Array.from(event.target.files)]);
+ }
+ };
+
+ const handleFileRemove = (fileName: string) => {
+ setUploadedFiles((prevFiles) => prevFiles.filter((file) => file.name !== fileName));
+ };
+
+ const handleButtonClick = () => {
+ fileInputRef.current?.click();
+ };
+
+ return (
+ <div style={{ display: "flex", flexDirection: "column", gap: "20px" }}>
+ <Text size={400} block>
+ Upload revocation documentation:
+ </Text>
+
+ {/* Upload Button */}
+ <div
+ style={{
+ padding: "10px",
+ border: "1px solid #ddd",
+ borderRadius: tokens.borderRadiusMedium,
+ backgroundColor: "#f9f9f9",
+ textAlign: "center",
+ }}
+ >
+ <input
+ type="file"
+ multiple
+ ref={fileInputRef}
+ onChange={handleFileUpload}
+ style={{ display: "none" }}
+ />
+ <Button appearance="primary" onClick={handleButtonClick}>
+ Upload Files
+ </Button>
+ </div>
+
+ {/* Uploaded Files List */}
+ {uploadedFiles.length > 0 && (
+ <div style={{ padding: "10px", border: "1px solid #ddd", borderRadius: tokens.borderRadiusMedium }}>
+ <Text size={400} weight="semibold" block>
+ Uploaded Files:
+ </Text>
+ {uploadedFiles.map((file, index) => (
+ <div
+ key={index}
+ style={{
+ display: "flex",
+ justifyContent: "space-between",
+ alignItems: "center",
+ marginTop: "8px",
+ }}
+ >
+ <Text size={300}>{file.name}</Text>
+ <Button
+ appearance="subtle"
+ onClick={() => handleFileRemove(file.name)}
+ style={{ marginLeft: "10px" }}
+ >
+ Remove
+ </Button>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/6-navigation-sidebar.tsx b/plugins/power-apps/shared/samples/6-navigation-sidebar.tsx
new file mode 100644
index 000000000..bf9fca008
--- /dev/null
+++ b/plugins/power-apps/shared/samples/6-navigation-sidebar.tsx
@@ -0,0 +1,139 @@
+import React, { useState } from 'react';
+import { Button, Text } from '@fluentui/react-components';
+
+const sections = ['Home', 'About', 'Contact'];
+const subsectionsMap: Record<string, string[]> = {
+ Home: ['Home Subsection 1', 'Home Subsection 2', 'Home Subsection 3'],
+ About: ['About Subsection 1', 'About Subsection 2', 'About Subsection 3'],
+ Contact: ['Contact Subsection 1', 'Contact Subsection 2', 'Contact Subsection 3'],
+};
+
+const GeneratedComponent = () => {
+ const [activeSection, setActiveSection] = useState('Home');
+ const [activeSubsection, setActiveSubsection] = useState('');
+
+ const renderContent = () => {
+ if (activeSubsection) return <Text size={400}>You are viewing: {activeSubsection}</Text>;
+ switch (activeSection) {
+ case 'Home':
+ return <Text size={400}>Welcome to the Home Page!</Text>;
+ case 'About':
+ return <Text size={400}>Learn more about us on the About Page.</Text>;
+ case 'Contact':
+ return <Text size={400}>Reach out to us via the Contact Page.</Text>;
+ default:
+ return null;
+ }
+ };
+
+ const renderLeftNav = () => (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
+ {subsectionsMap[activeSection]?.map((sub) => (
+ <Button
+ key={sub}
+ appearance="subtle"
+ onClick={() => setActiveSubsection(sub)}
+ style={{ justifyContent: 'flex-start' }}
+ >
+ {sub}
+ </Button>
+ ))}
+ </div>
+ );
+
+ return (
+ <div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column' }}>
+ <style>
+ {`
+ @media (max-width: 768px) {
+ .main-content { flex-direction: column; }
+ .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
+ }
+ `}
+ </style>
+ {/* Navbar */}
+ <div
+ style={{
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ backgroundColor: '#0078D4',
+ padding: '10px 20px',
+ color: 'white',
+ height: '60px',
+ boxSizing: 'border-box',
+ }}
+ >
+ <Text size={600} weight="semibold" style={{ color: 'white' }}>
+ Website Title
+ </Text>
+ <div style={{ display: 'flex', gap: '20px', flexWrap: 'wrap' }}>
+ {sections.map((sec) => (
+ <Button
+ key={sec}
+ appearance="transparent"
+ style={{ color: 'white' }}
+ onClick={() => {
+ setActiveSection(sec);
+ setActiveSubsection('');
+ }}
+ >
+ {sec}
+ </Button>
+ ))}
+ </div>
+ </div>
+ {/* Main Content Area */}
+ <div className="main-content" style={{ flex: 1, display: 'flex', boxSizing: 'border-box' }}>
+ {/* Left Sidebar */}
+ <div
+ className="sidebar"
+ style={{
+ width: '200px',
+ backgroundColor: '#F3F2F1',
+ padding: '20px',
+ boxSizing: 'border-box',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '10px',
+ }}
+ >
+ {renderLeftNav()}
+ </div>
+ {/* Content Area */}
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', padding: '20px' }}>
+ <div
+ style={{
+ backgroundColor: '#E1DFDD',
+ padding: '20px',
+ borderRadius: tokens.borderRadiusMedium,
+ marginBottom: '20px',
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
+ }}
+ >
+ <Text size={500} weight="semibold">
+ {activeSubsection || activeSection}
+ </Text>
+ </div>
+ <div
+ style={{
+ flex: 1,
+ padding: '20px',
+ borderRadius: tokens.borderRadiusMedium,
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
+ backgroundColor: '#FFFFFF',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ textAlign: 'center',
+ }}
+ >
+ {renderContent()}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+};
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/7-comprehensive-form.tsx b/plugins/power-apps/shared/samples/7-comprehensive-form.tsx
new file mode 100644
index 000000000..821bdeca6
--- /dev/null
+++ b/plugins/power-apps/shared/samples/7-comprehensive-form.tsx
@@ -0,0 +1,168 @@
+import React, { useEffect, useState, useCallback, useRef } from 'react';
+import { Checkbox, Combobox, Field, Input, makeStyles, Option, Radio, RadioGroup, Slider, SpinButton, Switch, Textarea, tokens, Button, Text, Caption1, Subtitle1, Body1, MessageBar, useId as useFluentId, mergeClasses } from "@fluentui/react-components";
+import { DatePicker } from "@fluentui/react-datepicker-compat";
+import { TimePicker } from "@fluentui/react-timepicker-compat";
+import { CheckmarkCircle20Filled, ErrorCircle20Filled } from "@fluentui/react-icons";
+
+const useStyles = makeStyles({
+ container: { display: "flex", flexDirection: "column", gap: tokens.spacingVerticalXL, padding: tokens.spacingHorizontalM, maxWidth: "800px", margin: "0 auto", width: "100%", boxSizing: "border-box", height: '100%', overflowY: 'auto' },
+ formSection: { display: "flex", flexDirection: "column", gap: tokens.spacingVerticalL, padding: tokens.spacingHorizontalL, borderRadius: tokens.borderRadiusMedium, border: `1px solid ${tokens.colorNeutralStroke2}`, backgroundColor: tokens.colorNeutralBackground1 },
+ sectionHeader: { marginBottom: tokens.spacingVerticalM, paddingBottom: tokens.spacingVerticalS, borderBottom: `1px solid ${tokens.colorNeutralStroke2}` },
+ formGrid: { display: "grid", gridTemplateColumns: "1fr", gap: tokens.spacingVerticalL, width: "100%" },
+ twoColumnGrid: { gridTemplateColumns: "1fr 1fr", gap: tokens.spacingHorizontalL },
+ radioGroupContainer: { display: "flex", flexDirection: "column", gap: tokens.spacingVerticalS },
+ radioGroupHorizontal: { flexDirection: "row", flexWrap: "wrap", gap: tokens.spacingHorizontalL },
+ sliderContainer: { display: "flex", flexDirection: "column", gap: tokens.spacingVerticalXS, width: "100%" },
+ sliderValue: { color: tokens.colorNeutralForeground2, fontSize: tokens.fontSizeBase200, textAlign: "right" },
+ buttonGroup: { display: "flex", gap: tokens.spacingHorizontalM, justifyContent: "flex-end", alignItems: "center", marginTop: tokens.spacingVerticalL, paddingTop: tokens.spacingVerticalM, borderTop: `1px solid ${tokens.colorNeutralStroke2}` },
+ messageContainer: { marginBottom: tokens.spacingVerticalM },
+ validationSummary: { padding: tokens.spacingHorizontalM, borderRadius: tokens.borderRadiusSmall, backgroundColor: tokens.colorPaletteRedBackground1, border: `1px solid ${tokens.colorPaletteRedBorder1}` },
+ comboboxListbox: { backgroundColor: tokens.colorNeutralBackground1, border: `1px solid ${tokens.colorNeutralStroke1}` },
+ "@media (max-width: 768px)": { container: { padding: tokens.spacingHorizontalS, gap: tokens.spacingVerticalL }, formSection: { padding: tokens.spacingHorizontalM }, twoColumnGrid: { gridTemplateColumns: "1fr", gap: tokens.spacingVerticalL }, radioGroupHorizontal: { flexDirection: "column", gap: tokens.spacingVerticalS }, buttonGroup: { flexDirection: "column-reverse", gap: tokens.spacingVerticalS } },
+ "@media (max-width: 480px)": { container: { padding: tokens.spacingHorizontalXS }, formSection: { padding: tokens.spacingHorizontalS } }
+});
+
+interface FormData { textInput: string; textArea: string; comboboxValue: string; spinButtonValue: number; checkboxChecked: boolean; sliderValue: number; switchEnabled: boolean; radioSelection: string; email: string; phone: string; dateOfBirth: Date | null; preferredContactTime: string; }
+interface ValidationErrors { [key: string]: string; }
+interface FormSectionProps { title: string; description?: string; children: React.ReactNode; titleId: string; descriptionId?: string; }
+
+const FormSection: React.FC<FormSectionProps> = ({ title, description, children, titleId, descriptionId }) => {
+ const styles = useStyles();
+ return (
+ <section className={styles.formSection} aria-labelledby={titleId} aria-describedby={descriptionId}>
+ <header className={styles.sectionHeader}>
+ <Subtitle1 as="h2" block>{title}</Subtitle1>
+ {description && <Body1 id={descriptionId} style={{ color: tokens.colorNeutralForeground2 }} block>{description}</Body1>}
+ </header>
+ {children}
+ </section>
+ );
+};
+
+const GeneratedComponent: React.FC = () => {
+ const styles = useStyles();
+ const containerRef = useRef<HTMLDivElement>(null);
+ const [formData, setFormData] = useState<FormData>({ textInput: "", textArea: "", comboboxValue: "", spinButtonValue: 0, checkboxChecked: false, sliderValue: 25, switchEnabled: false, radioSelection: "", email: "", phone: "", dateOfBirth: null, preferredContactTime: "" });
+ const [errors, setErrors] = useState<ValidationErrors>({});
+ const [isSubmitting, setIsSubmitting] = useState(false);
+ const [submitMessage, setSubmitMessage] = useState<{ type: "success" | "error"; content: string } | null>(null);
+ const basicInfoTitleId = useFluentId('basic-info-title'), basicInfoDescId = useFluentId('basic-info-desc'), contactTitleId = useFluentId('contact-title'), contactDescId = useFluentId('contact-desc'), preferencesTitleId = useFluentId('preferences-title'), preferencesDescId = useFluentId('preferences-desc');
+ const [mountNode, setMountNode] = useState<HTMLElement | null>(null);
+
+ const validateForm = useCallback((): ValidationErrors => {
+ const newErrors: ValidationErrors = {};
+ if (!formData.textInput.trim()) newErrors.textInput = "Name is required"; else if (formData.textInput.length < 2) newErrors.textInput = "Name must be at least 2 characters";
+ if (!formData.email.trim()) newErrors.email = "Email is required"; else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) newErrors.email = "Please enter a valid email address";
+ if (!formData.phone.trim()) newErrors.phone = "Phone number is required"; else if (!/^\+?[\d\s\-\(\)]{10,}$/.test(formData.phone)) newErrors.phone = "Please enter a valid phone number";
+ if (!formData.radioSelection) newErrors.radioSelection = "Please select a contact preference";
+ if (formData.textArea.length > 500) newErrors.textArea = "Message must be 500 characters or less";
+ if (!formData.dateOfBirth) newErrors.dateOfBirth = "Date of birth is required";
+ else if (formData.dateOfBirth > new Date()) newErrors.dateOfBirth = "Date of birth cannot be in the future";
+ else if (formData.dateOfBirth < new Date(1900, 0, 1)) newErrors.dateOfBirth = "Please enter a valid date of birth";
+ return newErrors;
+ }, [formData]);
+
+ useEffect(() => { setErrors(validateForm()); }, [formData, validateForm]);
+ const updateField = useCallback((field: keyof FormData, value: any) => { setFormData(prev => ({ ...prev, [field]: value })); if (submitMessage) setSubmitMessage(null); }, [submitMessage]);
+
+ const handleSubmit = useCallback(async () => {
+ const validationErrors = validateForm();
+ if (Object.keys(validationErrors).length > 0) { setErrors(validationErrors); setSubmitMessage({ type: "error", content: "Please correct the errors below before submitting." }); const firstErrorField = Object.keys(validationErrors)[0]; const errorElement = document.querySelector(`[data-field="${firstErrorField}"]`) as HTMLElement; errorElement?.focus(); return; }
+ setIsSubmitting(true);
+ try { await new Promise(resolve => setTimeout(resolve, 2000)); setSubmitMessage({ type: "success", content: "Form submitted successfully! Thank you for your information." }); setFormData({ textInput: "", textArea: "", comboboxValue: "", spinButtonValue: 0, checkboxChecked: false, sliderValue: 25, switchEnabled: false, radioSelection: "", email: "", phone: "", dateOfBirth: null, preferredContactTime: "" }); }
+ catch { setSubmitMessage({ type: "error", content: "Failed to submit form. Please try again." }); }
+ finally { setIsSubmitting(false); }
+ }, [validateForm]);
+
+ const resetForm = useCallback(() => { setFormData({ textInput: "", textArea: "", comboboxValue: "", spinButtonValue: 0, checkboxChecked: false, sliderValue: 25, switchEnabled: false, radioSelection: "", email: "", phone: "", dateOfBirth: null, preferredContactTime: "" }); setErrors({}); setSubmitMessage(null); }, []);
+
+ // This is required for DatePicker and TimePicker components
+ useEffect(() => {
+ if (containerRef.current) {
+ setMountNode(containerRef.current);
+ }
+ }, []);
+
+ return (
+ <div className={styles.container}>
+ <header>
+ <Subtitle1 as="h1" block>User Information Form</Subtitle1>
+ <Body1 style={{ color: tokens.colorNeutralForeground2, marginTop: tokens.spacingVerticalXS }} block>Please fill out all required fields. Fields marked with * are mandatory.</Body1>
+ </header>
+ {submitMessage && <div className={styles.messageContainer}><MessageBar intent={submitMessage.type === "success" ? "success" : "error"} icon={submitMessage.type === "success" ? <CheckmarkCircle20Filled /> : <ErrorCircle20Filled />}>{submitMessage.content}</MessageBar></div>}
+ <form onSubmit={(e) => { e.preventDefault(); handleSubmit(); }} noValidate aria-label="User information form">
+ <FormSection title="Basic Information" description="Tell us about yourself" titleId={basicInfoTitleId} descriptionId={basicInfoDescId}>
+ <div className={mergeClasses(styles.formGrid, styles.twoColumnGrid)}>
+ <Field label="Full Name *" validationState={errors.textInput ? "error" : "none"} validationMessage={errors.textInput} required><Input data-field="textInput" value={formData.textInput} onChange={(_, data) => updateField("textInput", data.value)} placeholder="Enter your full name" aria-invalid={!!errors.textInput} /></Field>
+ <Field label="Date of Birth *" validationState={errors.dateOfBirth ? "error" : "none"} validationMessage={errors.dateOfBirth} required>
+ <DatePicker
+ data-field="dateOfBirth"
+ value={formData.dateOfBirth}
+ onSelectDate={(date) => updateField("dateOfBirth", date)}
+ placeholder="Select date of birth"
+ aria-invalid={!!errors.dateOfBirth}
+ maxDate={new Date()}
+ formatDate={(date) => date ? date.toLocaleDateString() : ""}
+ className={styles.datePicker}
+ // All Date Pickers must have this prop
+ mountNode={mountNode}
+ />
+ </Field>
+ <Field label="Department" hint="Select your department or team">
+ <Combobox value={formData.comboboxValue} onOptionSelect={(_, data) => updateField("comboboxValue", data.optionValue || "")} placeholder="Choose department" positioning="below" inlinePopup={false} listbox={{ className: styles.comboboxListbox }}>
+ <Option value="engineering">Engineering</Option><Option value="design">Design</Option><Option value="product">Product Management</Option><Option value="marketing">Marketing</Option><Option value="sales">Sales</Option><Option value="support">Customer Support</Option>
+ </Combobox>
+ </Field>
+ </div>
+ <Field label="Experience Level" hint="Years of experience in your field">
+ <div className={styles.sliderContainer}><div className={styles.sliderValue}>{formData.spinButtonValue} years</div><SpinButton value={formData.spinButtonValue} onChange={(_, data) => updateField("spinButtonValue", data.value || 0)} min={0} max={50} step={1} /></div>
+ </Field>
+ <Field label="About You" validationState={errors.textArea ? "error" : "none"} validationMessage={errors.textArea} hint={`${formData.textArea.length}/500 characters`}><Textarea value={formData.textArea} onChange={(_, data) => updateField("textArea", data.value)} placeholder="Tell us about your background..." rows={4} resize="vertical" aria-invalid={!!errors.textArea} /></Field>
+ </FormSection>
+ <FormSection title="Contact Information" description="How can we reach you?" titleId={contactTitleId} descriptionId={contactDescId}>
+ <div className={mergeClasses(styles.formGrid, styles.twoColumnGrid)}>
+ <Field label="Email Address *" validationState={errors.email ? "error" : "none"} validationMessage={errors.email} required><Input data-field="email" type="email" value={formData.email} onChange={(_, data) => updateField("email", data.value)} placeholder="[email protected]" aria-invalid={!!errors.email} /></Field>
+ <Field label="Phone Number *" validationState={errors.phone ? "error" : "none"} validationMessage={errors.phone} required><Input data-field="phone" type="tel" value={formData.phone} onChange={(_, data) => updateField("phone", data.value)} placeholder="+1 (555) 123-4567" aria-invalid={!!errors.phone} /></Field>
+ </div>
+ <div className={styles.formGrid}>
+ <Field label="Preferred Contact Time" hint="What time of day would you prefer to be contacted?">
+ <TimePicker
+ data-field="preferredContactTime"
+ value={formData.preferredContactTime}
+ onTimeChange={(_, data) => updateField("preferredContactTime", data.selectedTime || "")}
+ placeholder="Select preferred contact time"
+ freeform={false}
+ showSeconds={false}
+ // All Time Pickers must have this prop
+ mountNode={mountNode}
+ />
+ </Field>
+ </div>
+ </FormSection>
+ <FormSection title="Preferences" description="Customize your experience" titleId={preferencesTitleId} descriptionId={preferencesDescId}>
+ <div className={styles.formGrid}>
+ <Field label="Preferred Contact Method *" validationState={errors.radioSelection ? "error" : "none"} validationMessage={errors.radioSelection} required>
+ <RadioGroup value={formData.radioSelection} onChange={(_, data) => updateField("radioSelection", data.value)} className={mergeClasses(styles.radioGroupContainer, styles.radioGroupHorizontal)} aria-invalid={!!errors.radioSelection}>
+ <Radio label="Email" value="email" /><Radio label="Phone" value="phone" /><Radio label="Text Message" value="sms" /><Radio label="Teams/Slack" value="chat" />
+ </RadioGroup>
+ </Field>
+ <Field label="Communication Frequency" hint="How often would you like to receive updates?">
+ <div className={styles.sliderContainer}>
+ <div className={styles.sliderValue}>{formData.sliderValue === 0 && "Never"}{formData.sliderValue > 0 && formData.sliderValue <= 25 && "Rarely"}{formData.sliderValue > 25 && formData.sliderValue <= 50 && "Sometimes"}{formData.sliderValue > 50 && formData.sliderValue <= 75 && "Often"}{formData.sliderValue > 75 && "Frequently"}</div>
+ <Slider value={formData.sliderValue} onChange={(_, data) => updateField("sliderValue", data.value)} min={0} max={100} step={5} />
+ </div>
+ </Field>
+ <div className={mergeClasses(styles.formGrid, styles.twoColumnGrid)}>
+ <Field hint="Receive newsletter and product updates"><Checkbox label="Subscribe to Newsletter" checked={formData.checkboxChecked} onChange={(_, data) => updateField("checkboxChecked", data.checked)} /></Field>
+ <Field hint="Enable push notifications for important updates"><Switch label="Push Notifications" checked={formData.switchEnabled} onChange={(_, data) => updateField("switchEnabled", data.checked)} /></Field>
+ </div>
+ </div>
+ </FormSection>
+ <div className={styles.buttonGroup}><Button appearance="secondary" onClick={resetForm} disabled={isSubmitting}>Reset Form</Button><Button appearance="primary" type="submit" disabled={isSubmitting || Object.keys(errors).length > 0}>{isSubmitting ? "Submitting..." : "Submit Form"}</Button></div>
+ </form>
+ {Object.keys(errors).length > 0 && <div className={styles.validationSummary} role="alert" aria-live="polite" aria-label="Form validation errors"><Text weight="semibold" style={{ color: tokens.colorPaletteRedForeground1 }}>Please correct the following errors:</Text><ul style={{ margin: `${tokens.spacingVerticalXS} 0`, paddingLeft: tokens.spacingHorizontalM }}>{Object.entries(errors).map(([field, error]) => (<li key={field} style={{ color: tokens.colorPaletteRedForeground1 }}><Caption1>{error}</Caption1></li>))}</ul></div>}
+ </div>
+ );
+};
+
+export default GeneratedComponent;
diff --git a/plugins/power-apps/shared/samples/8-responsive-cards.tsx b/plugins/power-apps/shared/samples/8-responsive-cards.tsx
new file mode 100644
index 000000000..3e6188121
--- /dev/null
+++ b/plugins/power-apps/shared/samples/8-responsive-cards.tsx
@@ -0,0 +1,65 @@
+import React from 'react';
+import { makeStyles, tokens, Button, Text, Caption1, Subtitle1, Body1, mergeClasses, Card, CardHeader, useId } from '@fluentui/react-components';
+import { MoreHorizontal20Regular } from '@fluentui/react-icons';
+
+const useStyles = makeStyles({
+ container: { display: 'flex', flexDirection: 'column', gap: tokens.spacingVerticalXXL, padding: tokens.spacingHorizontalM, width: '100%', boxSizing: 'border-box' },
+ cardsGrid: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: tokens.spacingVerticalL, width: '100%' },
+ card: { width: '100%', maxWidth: '480px', height: 'fit-content', cursor: 'pointer', transition: 'transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out', '&:hover': { transform: 'translateY(-2px)', boxShadow: tokens.shadow8 }, '&:focus-visible': { outline: `2px solid ${tokens.colorBrandBackground}`, outlineOffset: '2px' } },
+ sectionHeader: { marginBottom: tokens.spacingVerticalM },
+ sectionTitle: { marginBottom: tokens.spacingVerticalXS, display: 'block' },
+ sectionDescription: { color: tokens.colorNeutralForeground2, marginBottom: tokens.spacingVerticalM, display: 'block' },
+ cardContent: { padding: tokens.spacingHorizontalM, lineHeight: tokens.lineHeightBase300 },
+ logo: { borderRadius: tokens.borderRadiusSmall, width: '48px', height: '48px', backgroundColor: tokens.colorNeutralBackground3, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '24px' },
+ cardHeader: { margin: 0, fontWeight: tokens.fontWeightSemibold },
+ cardCaption: { color: tokens.colorNeutralForeground3, display: 'block' },
+ '@media (max-width: 768px)': { container: { padding: tokens.spacingHorizontalS }, cardsGrid: { gridTemplateColumns: '1fr', gap: tokens.spacingVerticalM }, card: { maxWidth: '100%' } }
+});
+
+const SectionHeader: React.FC<{ title: string; description: string; titleId: string; descriptionId: string; }> = ({ title, description, titleId, descriptionId }) => {
+ const styles = useStyles();
+ return (
+ <header className={styles.sectionHeader}>
+ <Subtitle1 as="h2" id={titleId} className={styles.sectionTitle} block>{title}</Subtitle1>
+ <Body1 as="p" id={descriptionId} className={styles.sectionDescription} block>{description}</Body1>
+ </header>
+ );
+};
+
+const ResponsiveCard: React.FC<{ appearance?: 'filled' | 'filled-alternative' | 'outline' | 'subtle'; className?: string; 'aria-labelledby'?: string; 'aria-describedby'?: string; }> = ({ appearance = 'filled', className, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy }) => {
+ const styles = useStyles(); const cardId = useId('card');
+ const handleCardClick = React.useCallback(() => { console.log('Card clicked - navigate or perform action'); }, []);
+ const handleKeyDown = React.useCallback((e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); handleCardClick(); } }, [handleCardClick]);
+ return (
+ <Card appearance={appearance} className={mergeClasses(styles.card, className)} onClick={handleCardClick} onKeyDown={handleKeyDown} tabIndex={0} role="button" aria-labelledby={ariaLabelledBy} aria-describedby={ariaDescribedBy} id={cardId}>
+ <CardHeader image={<div className={styles.logo} role="img" aria-label="Application logo">📱</div>} header={<Text as="h3" className={styles.cardHeader} block>Mobile App</Text>} description={<Caption1 className={styles.cardCaption} block>Development Team</Caption1>} action={<Button appearance="transparent" icon={<MoreHorizontal20Regular />} aria-label="More options for Mobile App" onClick={(e) => { e.stopPropagation(); console.log('More options clicked'); }} />} />
+ <div className={styles.cardContent}><Text block>A comprehensive mobile application that provides seamless user experience across all devices with responsive design and accessibility features built-in.</Text></div>
+ </Card>
+ );
+};
+
+const ResponsiveCardShowcase: React.FC = () => {
+ const styles = useStyles();
+ const sections = [
+ { id: 'filled', title: 'Filled Cards (Default)', description: 'Standard card style with filled background. Use for most card designs with clear visual separation.', appearance: 'filled' as const },
+ { id: 'filled-alt', title: 'Filled Alternative', description: 'Enhanced contrast for light backgrounds. Ensures adequate visual distinction on white or gray surfaces.', appearance: 'filled-alternative' as const },
+ { id: 'outline', title: 'Outline Cards', description: 'Bordered cards without background fill. Perfect when you need definition without heavy visual weight.', appearance: 'outline' as const },
+ { id: 'subtle', title: 'Subtle Cards', description: 'Minimal styling with hover states. Ideal for clean layouts where content takes priority.', appearance: 'subtle' as const }
+ ];
+ return (
+ <div className={styles.container}>
+ <Subtitle1 as="h1" block>Responsive Card Components</Subtitle1>
+ {sections.map(s => {
+ const titleId = useId(`${s.id}-title`), descriptionId = useId(`${s.id}-description`);
+ return (
+ <section key={s.id} aria-labelledby={titleId} aria-describedby={descriptionId}>
+ <SectionHeader title={s.title} description={s.description} titleId={titleId} descriptionId={descriptionId} />
+ <div className={styles.cardsGrid}><ResponsiveCard appearance={s.appearance} aria-labelledby={titleId} aria-describedby={descriptionId} /></div>
+ </section>
+ );
+ })}
+ </div>
+ );
+};
+
+export default ResponsiveCardShowcase;
diff --git a/plugins/power-apps/skills/genpage/SKILL.md b/plugins/power-apps/skills/genpage/SKILL.md
new file mode 100644
index 000000000..75ffa817c
--- /dev/null
+++ b/plugins/power-apps/skills/genpage/SKILL.md
@@ -0,0 +1,344 @@
+---
+name: genpage
+version: 1.0.0
+description: Creates, updates, and deploys Power Apps generative pages for model-driven apps using React v17, TypeScript, and Fluent UI V9. Completes workflow from requirements to deployment. Uses PAC CLI to deploy the page code. Use it when user asks to build, retrieve, or update a page in an existing Microsoft Power Apps model-driven app. Use it when user mentions "generative page", "page in a model-driven", or "genux".
+author: Microsoft Corporation
+argument-hint: "[optional: page description or 'deploy' or 'update']"
+user-invocable: true
+allowed-tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep", "WebFetch", "AskUserQuestion", "EnterPlanMode"]
+---
+
+# Power Apps Generative Pages Builder
+
+**Triggers:** genpage, generative page, create genpage, genux page, build genux, power apps page, model page
+**Keywords:** power apps, generative pages, genux, model-driven, dataverse, react, fluent ui, pac cli
+**Aliases:** /genpage, /gen-page, /genux
+
+## References
+
+- **Code generation rules**: [genux-rules-reference.md](../../shared/references/genux-rules-reference.md)
+- **PAC CLI commands**: [pac-cli-reference.md](../../shared/references/pac-cli-reference.md)
+- **Troubleshooting**: [troubleshooting.md](../../shared/references/troubleshooting.md)
+- **Sample pages**: [samples/](../../shared/samples/)
+
+## What This Skill Does
+
+You are the **GenPage** skill — an expert in building and deploying Power Apps generative pages (genux pages) using React 17 + TypeScript + Fluent UI V9. You guide users through an interactive workflow:
+
+1. Validate prerequisites (Node.js, PAC CLI, authentication)
+2. Gather requirements interactively
+3. Plan and confirm the implementation
+4. Generate schema from Dataverse (if entity-based)
+5. Read code generation rules and relevant samples
+6. Generate complete, production-ready TypeScript code
+7. Save and deploy to Power Apps via PAC CLI
+
+---
+
+## Prerequisites
+
+Before starting, verify:
+- **Node.js** installed on the system
+- **PAC CLI** installed on the system (run `pac --version` to confirm)
+- **Dataverse environment** access for deployment
+
+> **PAC CLI is assumed to be installed on the user's system.** If `pac` is not found, instruct the user to install it via `dotnet tool install --global Microsoft.PowerApps.CLI.Tool` or download from Microsoft.
+
+---
+
+## Development Standards
+
+- **React 17 + TypeScript** — all generated code
+- **Fluent UI V9** — `@fluentui/react-components` exclusively (DatePicker from `@fluentui/react-datepicker-compat`)
+- **Single file architecture** — all components, utilities, styles in one `.tsx` file
+- **No external libraries** — only React, Fluent UI V9, approved Fluent icons, D3.js for charts
+- **Type-safe DataAPI** — use RuntimeTypes when Dataverse entities are involved
+- **Responsive design** — flexbox, relative units, never `100vh`/`100vw`
+- **Accessibility** — WCAG AA, ARIA labels, keyboard navigation, semantic HTML
+- **Complete code** — no placeholders, TODOs, or ellipses in final output
+
+---
+
+## Planning Policy
+
+Before implementing major changes, enter plan mode first. Planning is required for new features, multi-file changes, schema/API changes, or UI additions. Not required for single-line fixes, docs updates, or diagnostic commands.
+
+When entering plan mode, request these permissions:
+
+```
+allowedPrompts:
+ - tool: Bash, prompt: "run pac cli commands"
+ - tool: Bash, prompt: "run powershell commands"
+ - tool: Bash, prompt: "run node commands"
+```
+
+---
+
+## Instructions
+
+Follow these steps in order for every `/genpage` invocation.
+
+### Step 1: Validate Prerequisites
+
+Run these checks (first invocation per session only):
+
+```powershell
+node --version
+pac --version
+```
+
+If either fails, inform the user and provide installation instructions. Do NOT proceed until prerequisites are met. See [troubleshooting.md](../../shared/references/troubleshooting.md) if issues arise.
+
+### Step 2: Authenticate and Select Environment
+
+Check PAC CLI authentication:
+
+```powershell
+pac auth list
+```
+
+**If no profiles:** Ask user to authenticate:
+```powershell
+pac auth create --environment https://your-env.crm.dynamics.com
+```
+Wait for user to complete browser sign-in, then re-verify.
+
+**If one profile:** Confirm it's active (has `*` marker). If not, activate it:
+```powershell
+pac auth select --index 1
+```
+
+**If multiple profiles:** Show the list, ask which environment to use, then:
+```powershell
+pac auth select --index <user-chosen-index>
+```
+
+Report: "Working with environment: [name]" and proceed.
+
+### Step 3: Gather Requirements (Interactive)
+
+Ask these questions in order:
+
+1. **"What would you like to create?"** — form, dashboard, grid, list, wizard, report, etc.
+2. **"Will this page use Dataverse entities or mock data?"**
+ - If entities: ask which entities and fields (use logical names — singular, lowercase)
+ - If mock data: confirm you'll generate realistic sample data
+3. **"Any specific requirements?"** — styling, features (search, filtering, sorting), accessibility, responsive behavior, interactions
+
+If the user provided a description with the `/genpage` command, acknowledge it and ask only clarifying questions.
+
+### Step 4: Plan and Confirm
+
+Present a clear plan:
+
+```
+I'll create a [page type] with:
+- Data: [entities or mock data with specifics]
+- Features: [list key features]
+- Components: [Fluent UI components to use]
+- Layout: [responsive design approach]
+
+Does this plan look good? Any changes needed?
+```
+
+Wait for confirmation before proceeding. If changes requested, revise and re-confirm.
+
+### Step 5: Generate Schema and Verify Columns (Dataverse Pages Only)
+
+**CRITICAL — DO THIS BEFORE WRITING ANY CODE.** Column name hallucination is the #1 source of runtime errors. Never guess column names.
+
+If the page uses Dataverse entities, generate the TypeScript schema NOW:
+
+```powershell
+pac model genpage generate-types --data-sources "entity1,entity2" --output-file RuntimeTypes.ts
+```
+
+After generating, **read the RuntimeTypes.ts file** and:
+1. Identify the actual column names available on each entity
+2. Note which columns are readonly vs writable
+3. Note the enum/choice set names and values
+4. Use ONLY these verified column names when generating code in the next step
+
+> **NEVER guess or assume column names.** Custom entities (e.g., `cr69c_candidate`) have unpredictable column names (e.g., `cr69c_fullname` not `cr69c_name`). The only way to know the real names is to read them from the generated schema.
+
+If schema generation fails, see [troubleshooting.md](../../shared/references/troubleshooting.md). Do NOT generate code with guessed column names.
+
+**For mock data pages:** Skip this step.
+
+### Step 6: Read Code Generation Rules and Samples
+
+Before generating code, read the comprehensive rules reference:
+
+**[genux-rules-reference.md](../../shared/references/genux-rules-reference.md)** — Full code generation rules, DataAPI types, layout patterns, common errors.
+
+Also read a relevant sample for reference:
+
+| Sample | Use When |
+|--------|----------|
+| [1-account-grid.tsx](../../shared/samples/1-account-grid.tsx) | DataGrid with Dataverse entities |
+| [2-wizard-multi-step.tsx](../../shared/samples/2-wizard-multi-step.tsx) | Multi-step wizard flow |
+| [3-poa-revocation-wizard.tsx](../../shared/samples/3-poa-revocation-wizard.tsx) | Complex wizard with forms |
+| [4-account-crud-dataverse.tsx](../../shared/samples/4-account-crud-dataverse.tsx) | Full CRUD operations |
+| [5-file-upload.tsx](../../shared/samples/5-file-upload.tsx) | File upload pattern |
+| [6-navigation-sidebar.tsx](../../shared/samples/6-navigation-sidebar.tsx) | Sidebar navigation layout |
+| [7-comprehensive-form.tsx](../../shared/samples/7-comprehensive-form.tsx) | Complex form with validation |
+| [8-responsive-cards.tsx](../../shared/samples/8-responsive-cards.tsx) | Card-based responsive layout |
+
+### Step 7: Generate Code
+
+Generate complete TypeScript following ALL rules in [genux-rules-reference.md](../../shared/references/genux-rules-reference.md). **For Dataverse pages, use ONLY the column names verified from RuntimeTypes.ts in Step 5.** Output in this format:
+
+**Agent Thoughts:** Step-by-step reasoning and approach
+**Summary:** Non-technical bulleted list of what was built
+**Final Code:** Complete, ready-to-run TypeScript (no placeholders)
+
+Save the code to a `.tsx` file (e.g., `account-dashboard.tsx`).
+
+### Component Template
+
+```typescript
+import {useEffect, useState} from 'react';
+import type {
+ TableRow,
+ DataColumnValue,
+ RowKeyDataColumnValue,
+ QueryTableOptions,
+ ReadableTableRow,
+ ExtractFields,
+ GeneratedComponentProps
+} from "./RuntimeTypes";
+
+// Additional imports: @fluentui/react-components, @fluentui/react-icons, d3, etc.
+
+// Utility functions as separate top-level functions
+
+// Sub-components as separate top-level functions
+
+const GeneratedComponent = (props: GeneratedComponentProps) => {
+ const { dataApi } = props;
+ // Component implementation
+}
+
+export default GeneratedComponent;
+```
+
+### DataAPI Quick Reference
+
+```typescript
+// Query with pagination
+const result = await dataApi.queryTable("account", {
+ select: ["name", "revenue"],
+ filter: `contains(name,'test')`,
+ orderBy: `name asc`,
+ pageSize: 50
+});
+
+// Load more rows
+if (result.hasMoreRows && result.loadMoreRows) {
+ const nextPage = await result.loadMoreRows();
+}
+
+// Create, Update, Retrieve
+await dataApi.createRow("account", { name: "New Account" });
+await dataApi.updateRow("account", "record-id", { name: "Updated" });
+const row = await dataApi.retrieveRow("account", { id: "record-id", select: ["name"] });
+
+// Access formatted values (for enums, lookups, dates, etc.)
+const formatted = row["[email protected]"];
+
+// Lookup fields: raw value is a GUID — use formatted value for display name
+const contactGuid = row._primarycontactid_value; // GUID
+const contactName = row["_primarycontactid_value@OData.Community.Display.V1.FormattedValue"]; // Display name
+
+// Get enum choices
+const choices = await dataApi.getChoices("account-statecode");
+```
+
+**DataAPI Rules:**
+- ONLY use `dataApi` when TableRegistrations are provided — never assume tables/fields exist
+- **NEVER guess column names** — always verify from RuntimeTypes.ts generated in Step 5
+- **Lookup fields** (e.g., `_primarycontactid_value`) return a GUID. Always use the `@OData.Community.Display.V1.FormattedValue` annotation for display
+- Use entity logical names — singular lowercase (e.g., `"account"`)
+- Only reference columns that exist in the generated schema
+- If no types provided, use mocked sample data
+- Always wrap async `dataApi` calls in try-catch
+- DataGrid: use `createTableColumn`, enable sorting by default
+
+See [genux-rules-reference.md](../../shared/references/genux-rules-reference.md) for full DataAPI type definitions and examples.
+
+### Step 8: Save and Deploy
+
+After showing code, ALWAYS ask:
+> "Would you like to publish this page to Power Apps?"
+
+If yes, follow this deployment workflow. See [pac-cli-reference.md](../../shared/references/pac-cli-reference.md) for full command details.
+
+**For Dataverse entity pages** (schema already generated in Step 5):
+
+```powershell
+pac model list
+```
+
+**CRITICAL:** Ask the user: "Which app would you like to publish this page to? Please provide the app-id or app name from the list above."
+- **NEVER** choose a default app or assume an app-id
+- **ACCEPT BOTH** app-id (GUID) or app name — if user provides an app name, run `pac model list` to look up the corresponding app-id
+- **WAIT** for user response before proceeding
+
+```powershell
+pac model genpage upload `
+ --app-id <user-provided-app-id-or-name> `
+ --code-file page-name.tsx `
+ --name "Page Display Name" `
+ --data-sources "entity1,entity2" `
+ --prompt "User's original request summary" `
+ --add-to-sitemap
+```
+
+**For mock data pages** (skip schema generation):
+
+```powershell
+pac model list
+# Ask user for app selection, then:
+pac model genpage upload `
+ --app-id <user-provided-app-id-or-name> `
+ --code-file page-name.tsx `
+ --name "Page Display Name" `
+ --prompt "User's original request summary" `
+ --add-to-sitemap
+```
+
+**For updating existing pages** (use `--page-id`, omit `--add-to-sitemap`):
+
+```powershell
+pac model genpage upload `
+ --app-id <app-id-or-name> `
+ --page-id <page-id> `
+ --code-file page-name.tsx `
+ --data-sources "entity1,entity2" `
+ --prompt "Summary of changes"
+```
+
+### Step 9: Final Summary
+
+After deployment, provide:
+- Confirmation of successful upload
+- How to find the page in the app
+- Next steps (test in browser, share with team)
+- Offer to make updates or create additional pages
+
+---
+
+## Verification Checklist
+
+Before finalizing code, verify ALL:
+
+1. All critical rules followed (React 17, Fluent V9, single file, etc.)
+2. All user requirements implemented
+3. All UI elements fully functional
+4. Exports default React component; compiles without errors
+5. Scrolling only on content bodies, not entire page
+6. All imports present and correct; no unused imports
+7. No placeholders, ellipses, or "unchanged" comments
+8. Responsive design; accessible (ARIA, keyboard nav, WCAG AA)
+9. No undefined identifiers or hardcoded values
+10. Output format compliance (Agent Thoughts, Summary, Final Code)