diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea782..c86de3c1c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,4 +1,5 @@ --- + name: Bug report about: Create a report to help us improve title: '' @@ -12,6 +13,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,15 +26,17 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d6..549a88740 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,4 +1,5 @@ --- + name: Feature request about: Suggest an idea for this project title: '' diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 725ff120d..a9059ab4d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -24,4 +24,4 @@ updates: # default location of `.github/workflows` directory: "/" schedule: - interval: "weekly" \ No newline at end of file + interval: "weekly" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6741ddd5d..c9a786e5e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -20,7 +20,7 @@ - + ### Description of Proposed Changes @@ -28,23 +28,22 @@ ## Checklist - #### Create User Story(DevOps) or Issue(Github) - [ ] Describe functional requirements - [ ] Design plan/suggestion (e.g. images, link to eds design or relevant figma links, mention of eds tokens to use) -- [ ] Communication with UX *(evaluate if needed)* +- [ ] Communication with UX _(evaluate if needed)_ #### Development - [ ] Describe the component - [ ] Code funtional requirements - [ ] Create stories -- [ ] Create snapshots *(evaluate if needed)* +- [ ] Create snapshots _(evaluate if needed)_ - [ ] Remove unused imports and commented code - [ ] Lint code with Biome (and follow best practises for [code quality](https://docs.fusion-dev.net/development/frontend/code-quality/) - + #### Create Pull Request - [ ] Assign relevant reviewers in Github and Cromatic @@ -52,7 +51,7 @@ #### Review of Pull Request -- [ ] Follow up on comments from code review and implement necessary changes *(evaluate if needed)* +- [ ] Follow up on comments from code review and implement necessary changes _(evaluate if needed)_ - [ ] Review approved in github (and chromatic) #### Publish Code diff --git a/.github/workflows/actions/changeset-snapshot/action.yml b/.github/workflows/actions/changeset-snapshot/action.yml index d5362e930..7191eb345 100644 --- a/.github/workflows/actions/changeset-snapshot/action.yml +++ b/.github/workflows/actions/changeset-snapshot/action.yml @@ -6,7 +6,7 @@ inputs: required: true gh-token: description: github token - default: ${{ github.token }} + default: ${{ github.token }} runs: using: composite @@ -35,4 +35,3 @@ runs: with: name: changeset-status path: changeset.json - \ No newline at end of file diff --git a/.github/workflows/actions/node-setup/action.yml b/.github/workflows/actions/node-setup/action.yml index 5d84c7069..7f8243bde 100644 --- a/.github/workflows/actions/node-setup/action.yml +++ b/.github/workflows/actions/node-setup/action.yml @@ -2,16 +2,15 @@ name: Setup Bun description: General setup of Bun and Node inputs: bun-version: - description: 'Setting Bun version' - default: 'latest' + description: "Setting Bun version" + default: "latest" node-version: - description: 'Setting Node version (for native addons/tooling)' - default: '24' + description: "Setting Node version (for native addons/tooling)" + default: "24" runs: using: composite steps: - - uses: oven-sh/setup-bun@v2 with: bun-version: ${{ inputs.bun-version }} @@ -23,4 +22,4 @@ runs: - name: Install Dependencies shell: bash - run: bun install \ No newline at end of file + run: bun install diff --git a/.github/workflows/apm-sync.yml b/.github/workflows/apm-sync.yml index 00ee94fd4..d03c7f69c 100644 --- a/.github/workflows/apm-sync.yml +++ b/.github/workflows/apm-sync.yml @@ -2,7 +2,7 @@ name: APM Sync on: schedule: - - cron: '17 8 * * *' + - cron: "17 8 * * *" workflow_dispatch: permissions: @@ -61,8 +61,8 @@ jobs: env: GITHUB_APM_PAT_EQUINOR: ${{ secrets.APM_FUSION_SKILLS_TOKEN || github.token }} with: - apm-version: '0.33.0' - update: 'true' + apm-version: "0.33.0" + update: "true" - name: Create or update pull request env: diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 87c4f111a..f83c60791 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -1,10 +1,10 @@ # .github/workflows/chromatic.yml # Workflow name -name: 'Chromatic' +name: "Chromatic" # Event for the workflow -on: +on: pull_request: push: branches: @@ -51,4 +51,4 @@ jobs: buildScriptName: build token: ${{ secrets.GITHUB_TOKEN }} projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - autoAcceptChanges: true # 👈 Option to accept all changes \ No newline at end of file + autoAcceptChanges: true # 👈 Option to accept all changes diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d9ab1275e..5674190ac 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,12 +14,12 @@ name: "CodeQL" on: pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] paths: - - '**.ts' - - '**.tsx' + - "**.ts" + - "**.tsx" schedule: - - cron: '38 14 * * 2' + - cron: "38 14 * * 2" jobs: analyze: @@ -33,40 +33,39 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ["javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v7 + - name: Checkout repository + uses: actions/checkout@v7 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4.39.3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4.39.3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v4.39.3 - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v4.39.3 + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + #- run: | + # make bootstrap + # make release - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4.39.3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4.39.3 diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index d20b91bfa..879880ecc 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -2,7 +2,7 @@ name: Generate Docs on: workflow_dispatch: - workflow_call: + workflow_call: permissions: contents: read @@ -40,4 +40,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v5 \ No newline at end of file + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/index-eds.yml b/.github/workflows/index-eds.yml index 570f11f3c..8ceda9170 100644 --- a/.github/workflows/index-eds.yml +++ b/.github/workflows/index-eds.yml @@ -54,21 +54,21 @@ on: workflow_dispatch: inputs: eds_ref: - description: 'EDS git ref to build (tag, branch, or commit SHA)' + description: "EDS git ref to build (tag, branch, or commit SHA)" type: string default: main clean: - description: 'Delete existing embeddings before indexing' + description: "Delete existing embeddings before indexing" type: boolean default: false environment: - description: 'GitHub environment with Azure credentials' + description: "GitHub environment with Azure credentials" type: string required: true schedule: # Every Monday 06:00 UTC — check for new EDS releases - - cron: '0 6 * * 1' + - cron: "0 6 * * 1" env: EDS_REPO: equinor/design-system diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 48cf24553..6046c55ac 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,8 +1,8 @@ name: Lint project files -on: - pull_request: - types: +on: + pull_request: + types: - ready_for_review - opened - reopened @@ -24,7 +24,7 @@ jobs: - name: Build project run: bun run build - + - name: Setup Biome CLI uses: biomejs/setup-biome@v2 diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index dbc8a95a0..ec924b31c 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: tag: - description: 'Release tag (PR)' + description: "Release tag (PR)" required: true concurrency: ${{ github.workflow }}-${{ github.ref }} @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v7 with: fetch-depth: 0 - + - name: Validate pre-release configuration id: tag run: | @@ -43,7 +43,7 @@ jobs: id: changesets uses: changesets/action@v2 with: - pr-title: '🤖 Bip Bop - Fusion React Components Pre-Release' + pr-title: "🤖 Bip Bop - Fusion React Components Pre-Release" version-script: bun run changeset:version publish-script: bun run changeset:publish:pre-release env: @@ -56,4 +56,3 @@ jobs: run: gh pr ready ${{ steps.changesets.outputs.pullRequestNumber }} --undo env: GH_TOKEN: ${{ github.token }} - diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index b7fd95fe3..f2743f12b 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,10 +1,10 @@ name: Pre-release -on: +on: workflow_dispatch: inputs: tag: - description: 'Realse tag (PR)' + description: "Realse tag (PR)" required: true permissions: @@ -32,4 +32,4 @@ jobs: - name: Create snapshot uses: $/.github/workflows/actions/changeset-snapshot with: - tag: ${{ inputs.tag }} \ No newline at end of file + tag: ${{ inputs.tag }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a7041888..4f5d12973 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,9 +6,9 @@ on: branches: - main paths: - - 'packages/**' - - '.changeset/*.md' - - '.github/workflows/release.yml' + - "packages/**" + - ".changeset/*.md" + - ".github/workflows/release.yml" jobs: release-pkg: @@ -39,8 +39,8 @@ jobs: id: changesets uses: changesets/action@v2 with: - pr-title: '🤖 Bip Bop - Fusion React Components Release' - commit-message: 'chore: version packages' + pr-title: "🤖 Bip Bop - Fusion React Components Release" + commit-message: "chore: version packages" create-github-releases: true setupGitUser: false version-script: bun run changeset:version diff --git a/.gitignore b/.gitignore index 9cd9b1183..229611980 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ docs/ # Jetbrains IDEs .idea/ + +# Local scratch files +.tmp/ diff --git a/.tmp/pr-body.md b/.tmp/pr-body.md deleted file mode 100644 index ce610768b..000000000 --- a/.tmp/pr-body.md +++ /dev/null @@ -1,22 +0,0 @@ -## Skills Upgrade - -Automated run of `npx skills update` to update agent skills to their latest versions. -**Date:** 2026-10-13 08:26 UTC -**Node version:** 24 - -## Summary -- Changed / added skills: 2 - -## Updated Skills -- **fusion-skill-authoring** -
CHANGELOG additions for fusion-skill-authoring - -## 0.3.6 - 2026-09-07 -### patch -- [#227](https://github.com/equinor/fusion-skills/pull/227) [`596c9c1`](https://github.com/equinor/fusion-skills/commit/596c9c1f679dbfc536f9cd302143e350d3a23f53) - Check APM provenance before editing installed skill copies. - -
- -- **fusion-skills** - _No changelog updates found_ - diff --git a/AGENT_CONTEXT.md b/AGENT_CONTEXT.md index 13ab33a65..be7d59f35 100644 --- a/AGENT_CONTEXT.md +++ b/AGENT_CONTEXT.md @@ -93,11 +93,11 @@ remain available in Git. Reconcile that inventory before removing the lock or ol The following 26 entries are retained as explicit APM dependencies at their upstream paths: -| Upstream directory | Retained entries | -| --- | --- | -| `skills/` | `fusion`, `fusion-developer-app`, `fusion-developer-portal`, `fusion-devtools`, `fusion-help-api`, `fusion-help-docs`, `fusion-help-integration`, `fusion-infra-cli`, `fusion-issue-authoring`, `fusion-roles-cli`, `fusion-rules`, `fusion-skill-authoring`, `fusion-skills` | -| `skills/.system/` | `equinor-design-system`, `fusion-code-conventions`, `fusion-research` | -| `skills/.experimental/` | `fusion-core-services`, `fusion-dependency-review`, `fusion-design`, `fusion-framework-testing`, `fusion-github-review-resolution`, `fusion-issue-solving`, `fusion-issue-task-planning`, `fusion-mcp`, `fusion-package-scribe`, `fusion-pm-mcp` | +| Upstream directory | Retained entries | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `skills/` | `fusion`, `fusion-developer-app`, `fusion-developer-portal`, `fusion-devtools`, `fusion-help-api`, `fusion-help-docs`, `fusion-help-integration`, `fusion-infra-cli`, `fusion-issue-authoring`, `fusion-roles-cli`, `fusion-rules`, `fusion-skill-authoring`, `fusion-skills` | +| `skills/.system/` | `equinor-design-system`, `fusion-code-conventions`, `fusion-research` | +| `skills/.experimental/` | `fusion-core-services`, `fusion-dependency-review`, `fusion-design`, `fusion-framework-testing`, `fusion-github-review-resolution`, `fusion-issue-solving`, `fusion-issue-task-planning`, `fusion-mcp`, `fusion-package-scribe`, `fusion-pm-mcp` | Despite its non-Fusion name, **equinor-design-system is supplied by equinor/fusion-skills** at `skills/.system/equinor-design-system`, not by a different EDS repository. @@ -106,13 +106,13 @@ between the legacy deployment and the initial APM release. The remaining five legacy entries are intentionally mapped rather than reinstalled: -| Legacy entry | Reconciliation | -| --- | --- | -| `fusion-backend-dev` | Deprecated upstream. Its client/API-consumption role is retained through `fusion-core-services` and `fusion-research`. Backend implementation remains outside this component repository; do not add the backend development preset. | -| `fusion-framework-feature-toggling` | Already absent from deployed files. Its replacement chain ends at retained `fusion-developer-app`. | -| `fusion-issue-author-feature` | Already absent from deployed files. Retained `fusion-issue-authoring` owns feature issue authoring. | -| `fusion-issue-author-user-story` | Already absent from deployed files. Retained `fusion-issue-authoring` owns user-story authoring. | -| `fusion-rule-author` | Deprecated upstream in Fusion Skills v1.16.0 and moved out of `skills/.system/`, so the declaration no longer resolved. Retained `fusion-rules` owns rule authoring. | +| Legacy entry | Reconciliation | +| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fusion-backend-dev` | Deprecated upstream. Its client/API-consumption role is retained through `fusion-core-services` and `fusion-research`. Backend implementation remains outside this component repository; do not add the backend development preset. | +| `fusion-framework-feature-toggling` | Already absent from deployed files. Its replacement chain ends at retained `fusion-developer-app`. | +| `fusion-issue-author-feature` | Already absent from deployed files. Retained `fusion-issue-authoring` owns feature issue authoring. | +| `fusion-issue-author-user-story` | Already absent from deployed files. Retained `fusion-issue-authoring` owns user-story authoring. | +| `fusion-rule-author` | Deprecated upstream in Fusion Skills v1.16.0 and moved out of `skills/.system/`, so the declaration no longer resolved. Retained `fusion-rules` owns rule authoring. | The tracked **fusion-framework-mocking** directory is **not in the legacy lock**. It was added by the earlier discovery PR #3380 and matches the upstream diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e809188c7..20f0cb9c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ bun install ## Start Storybook -StoryBook is not handling too well composite libraries, so a clean build is needed +StoryBook is not handling too well composite libraries, so a clean build is needed ```sh bun run build @@ -91,18 +91,17 @@ bun exec tsc -w # Add a new component -+ Add a new directory under packages -+ Add `package.json` (or copy from existing project and modify) -+ Add `tsconfig.json` (or copy from existing project and modify) -+ Include package in base `tsconfig.json` +- Add a new directory under packages +- Add `package.json` (or copy from existing project and modify) +- Add `tsconfig.json` (or copy from existing project and modify) +- Include package in base `tsconfig.json` ```json { - "references": [ - { "path": "packages/MY_PACKAGE" } - ] + "references": [{ "path": "packages/MY_PACKAGE" }] } ``` -+ run `bun run clean` and then `bun install` from root + +- run `bun run clean` and then `bun install` from root ## Add a dependency @@ -113,28 +112,25 @@ bun add @SCOPE/PACKAGE ## Refer to another package -+ add the package as previously described -+ update `tsconfig.config` +- add the package as previously described +- update `tsconfig.config` ```json { - "references": [ - { "path": "../SOME_PACKAGE" } - ] + "references": [{ "path": "../SOME_PACKAGE" }] } ``` ## Update StoryBook -+ update `storybook/tsconfig.json` +- update `storybook/tsconfig.json` ```json { - "references": [ - { "path": "../packages/MY_PACKAGE" } - ] + "references": [{ "path": "../packages/MY_PACKAGE" }] } ``` -+ add infopage `storybook/src/stories/MY_PACKAGE/component.stories.mdx` + +- add infopage `storybook/src/stories/MY_PACKAGE/component.stories.mdx` ```md import { Meta, Story, Canvas, ArgsTable,Description } from '@storybook/addon-docs'; @@ -156,21 +152,21 @@ import MY_COMPONENT from '@equinor/fusion-react-MY_COMPONENT/src/MY_COMPONENT'; ## Changelog ``` > the template might change, look at other stories -+ add a stories `storybook/src/stories/MY_PACKAGE/component.stories.tsx`, add stories to the info page by refering the id to the `StoryExample` component +- add a stories `storybook/src/stories/MY_PACKAGE/component.stories.tsx`, add stories to the info page by refering the id to the `StoryExample` component -+ add component snapshots `storybook/src/stories/MY_PACKAGE/snapshots.stories.tsx|mdx` +- add component snapshots `storybook/src/stories/MY_PACKAGE/snapshots.stories.tsx|mdx` > add stories for possible states of the component > > group similar states into one story/snapshot # Creating a PR -> __DO NOT__ create a PR before code is ready for review/alpha/beta, since each push eats up story snapshots +> **DO NOT** create a PR before code is ready for review/alpha/beta, since each push eats up story snapshots - [x] make sure that the repo compiles `bun run build` - [x] make sure code is semantic correct `bun run lint` @@ -181,20 +177,22 @@ When the commit is rebased/merge into `main`, GH will deploy all affected packag ## Creating an Alpha -+ navigate to `Action` pane in GitHub -+ Select the `pre-release` action -+ Select the branch witch you want to release -+ input a unique name or the number of your pr `pr-XXX` -+ run workflow +- navigate to `Action` pane in GitHub +- Select the `pre-release` action +- Select the branch witch you want to release +- input a unique name or the number of your pr `pr-XXX` +- run workflow # Troubleshoot -__Storybook wont compile 😡__ +**Storybook wont compile 😡** + ```sh bun run clean && bun install ``` -__Watcher does not work__ +**Watcher does not work** + ```sh bun add -g typescript@latest ``` diff --git a/biome.json b/biome.json index 07523acee..6b78d8190 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.5.15/schema.json", + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "vcs": { "enabled": true, "clientKind": "git", @@ -13,7 +13,9 @@ "!packages/hanging-garden", "!.changeset", "!.agents", - "!scripts" + "!scripts", + "!apm.lock.yaml", + "!**/CHANGELOG.md" ] }, "formatter": { diff --git a/bun.lock b/bun.lock index 7f3cafb0f..28322a97f 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "": { "name": "@equinor/fusion-react-components-monorepo", "devDependencies": { - "@biomejs/biome": "2.5.15", + "@biomejs/biome": "2.6.6", "@changesets/cli": "^3.0.3", "@commitlint/cli": "^21.2.4", "@commitlint/config-conventional": "^21.2.4", @@ -688,23 +688,27 @@ "@bcoe/v8-coverage": ["@bcoe/v8-coverage@1.0.2", "", {}, "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA=="], - "@biomejs/biome": ["@biomejs/biome@2.5.15", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.15", "@biomejs/cli-darwin-x64": "2.5.15", "@biomejs/cli-linux-arm64": "2.5.15", "@biomejs/cli-linux-arm64-musl": "2.5.15", "@biomejs/cli-linux-x64": "2.5.15", "@biomejs/cli-linux-x64-musl": "2.5.15", "@biomejs/cli-win32-arm64": "2.5.15", "@biomejs/cli-win32-x64": "2.5.15" }, "bin": { "biome": "bin/biome" } }, "sha512-WZTW4slm/pdkh92K6t/3aEN++44JD1PQ7squ7RCMLI1flHGl43DVOIGXvCjHiZgBMO1V4uYxoFNtqrIA4qGuIQ=="], + "@biomejs/biome": ["@biomejs/biome@2.6.6", "", { "optionalDependencies": { "@biomejs/cli-android-arm64": "2.6.6", "@biomejs/cli-android-x64": "2.6.6", "@biomejs/cli-darwin-arm64": "2.6.6", "@biomejs/cli-darwin-x64": "2.6.6", "@biomejs/cli-linux-arm64": "2.6.6", "@biomejs/cli-linux-arm64-musl": "2.6.6", "@biomejs/cli-linux-x64": "2.6.6", "@biomejs/cli-linux-x64-musl": "2.6.6", "@biomejs/cli-win32-arm64": "2.6.6", "@biomejs/cli-win32-x64": "2.6.6" }, "bin": { "biome": "bin/biome" } }, "sha512-NCgVJRyrU1+hsW1ILNaRqNAb9fRL4n49bwyef+wjVJQ488/bXbp0BfnNqTTExkiNQT3ugkgYKR1vK8NxsjlNSQ=="], - "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.5.15", "", { "os": "darwin", "cpu": "arm64" }, "sha512-BZVzFhJ/mUvTLMYbc9x6el0o2Uv5zP7bACYyhFb6fSc1giroXm7PL0a5KqMJ9F+/BnkYRjagD/ROSDVOZ6eapg=="], + "@biomejs/cli-android-arm64": ["@biomejs/cli-android-arm64@2.6.6", "", { "os": "android", "cpu": "arm64" }, "sha512-bicnqNNxEX7pjkDQaptYvPRIWDfgXJLl/Ok7iZjC+F1AhfReor3FSS7SgPYnOvUy/jf++5U/KYN4T8OKH5rrNA=="], - "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.5.15", "", { "os": "darwin", "cpu": "x64" }, "sha512-V5Kw63V+fVGNFhFrizDxMbGXAzZCh8kYzJpy3GI6gTapWDg7bZK9oYC9CbVgQSEdTnupz0U5Efz8Ev+5vdBBXw=="], + "@biomejs/cli-android-x64": ["@biomejs/cli-android-x64@2.6.6", "", { "os": "android", "cpu": "x64" }, "sha512-N443kDSElF4kDMKjarsL+ymj/ewLA5R9VAdawA7fJ7pwgN3JVDZp0K+xhKBglH8EwsKi2+K8xC6WxXSkgziFfw=="], - "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.5.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-XaG7P7eeSLYETD3K9grfB0mQmpLQZjygdbsxekWBJAg4am79fGAtRpfRyNnTvXB2fZFNnJZG3nXm7HBat0+VUw=="], + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.6.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-/vSAqWx3by3p8w5ew+HVJDgguuaTK3U6Fb5gk/oDUH21iWOopm3gOlhT6tZfy5mTaM5R4CVc3uFWkxBtEDrKyw=="], - "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.5.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-tGzZUTcJCV7tj5Adh/Gn6nR4MycqA3iohq2LEcrarAgRBkU0h0OKd2UzCRkOsOYOuUGaUJb4YmqRqyy2feGGSw=="], + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.6.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-lLdOAJKbrAoDs+3GvTyVmMW345D9IhrIE3GgoL2eeHwO1boN4VhrSlALtFYsP0p+Jy4udUp4bTguij0qjKrH8w=="], - "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.5.15", "", { "os": "linux", "cpu": "x64" }, "sha512-xE4iEW/3LqlYj9GFgGrFsFSH51dEEpUbYWBfeOv0q87WkUDxK2o/HhreSb7qMJqck70RVM6Lg96hgedcAYcOkA=="], + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.6.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-UzJdUCg9dbEGpZOuZRyehEPrnwKjx9z4Um7sWLG5x6txu7UjeWdJZuBXVGlyAdD39w2Hx0nZeK1jKC4NFUTCNQ=="], - "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.5.15", "", { "os": "linux", "cpu": "x64" }, "sha512-IlxUcyxilVGPsE008x13pWdkTbU3nQpP2i9b5UrbOYj6goBkKsRX1XB7yJLcV+O1H9LBchIIm4adOaVLZBX0ZQ=="], + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.6.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-rw2Vsoi/WZGDyRjMXx9KZH9zsHe79LIzkdWHkLqsIkeKZm6qiGxtiIApxn7cmJSoEPaSvHaH5pRj1FhTcyL/XA=="], - "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.5.15", "", { "os": "win32", "cpu": "arm64" }, "sha512-2kPKzhNlm8C+Ru3GcO0Me2ODkCBLrVOUNuyi84RJyWDVKAA4+Kjj3jMjL938lF6BRfvltC4vB2nPY9SvN51Ovg=="], + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.6.6", "", { "os": "linux", "cpu": "x64" }, "sha512-l8/aPXc1cz8VpUyd4hb5Pm5zx+X3voQBks4aLYbp5pC8KSchuHyvqDfY5xax39qCHomI/2xn6NKEot+zebG38g=="], - "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.5.15", "", { "os": "win32", "cpu": "x64" }, "sha512-yAzh4UqEImV6Hcy0zjUqNfJAsUhoD64FBQCdTG8Md/Z2wQeVP/ZmJ3XRYAs1g8J9fjTFyl2fCtc5FB5til47+g=="], + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.6.6", "", { "os": "linux", "cpu": "x64" }, "sha512-DiKejs+GnFbOVQsBnukUpiB+T13tqUDFGwwjsTq51vatAsaflzFzVD0BOgjVUGRrqKgE0K0Xf+wNtkcmdN2chw=="], + + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.6.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-DjVXwQAQeHrO1JEZAEus54k40Tnh4glyU3VFLcDBKwoz0xnxCEnqw6TCMXoujcQMQynWd3AY8bLrbR1o0XNqow=="], + + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.6.6", "", { "os": "win32", "cpu": "x64" }, "sha512-B7KMG26A4I9lAuxwBGMmiVcjMGAeJRoz+pzFt9brRvOAsIrgOu8ptJld5rUWui6tM1uiJwxeJhhDPuAiZtxXdw=="], "@changesets/apply-release-plan": ["@changesets/apply-release-plan@8.1.1", "", { "dependencies": { "@changesets/config": "^4.0.1", "@changesets/format": "^0.1.2", "@changesets/git": "^4.0.1", "@changesets/should-skip-package": "^1.0.0", "@changesets/types": "^7.0.0", "import-meta-resolve": "^4.2.0", "jsonc-parser": "^3.3.1", "semver": "^7.8.1" } }, "sha512-nk2Hbq3M9NeHMdaIRBDvawKrQJzXB9sGyBUE5yWnIKtvdcNCPj75zBekJYr0gTT2ecJH3eFeTrc8eisPImcv0Q=="], diff --git a/components/README.md b/components/README.md index df0775f1a..bcf3e550e 100644 --- a/components/README.md +++ b/components/README.md @@ -29,7 +29,7 @@ import { PeopleViewer, type PersonInfo, type PeoplePickerProps, - type PeopleViewerProps + type PeopleViewerProps, } from '@equinor/fusion-react-components'; ``` @@ -38,10 +38,10 @@ import { Import components from specific subpaths: ```ts -import { - PeoplePicker, +import { + PeoplePicker, PeopleViewer, - type PersonInfo + type PersonInfo, } from '@equinor/fusion-react-components/person'; ``` diff --git a/eds/eval/components.md b/eds/eval/components.md index f7c336222..2d4398e98 100644 --- a/eds/eval/components.md +++ b/eds/eval/components.md @@ -4,6 +4,7 @@ These queries test whether the EDS index surfaces accurate component documentati when developers ask about EDS React component usage, props, patterns, and examples. When judging results, verify that: + - Results reference `@equinor/eds-core-react` as the component package. - Props tables include correct prop names, types, and defaults — not invented values. - Code examples use the correct import path and valid JSX patterns. diff --git a/eds/eval/foundation.md b/eds/eval/foundation.md index a2930b82d..4d5106796 100644 --- a/eds/eval/foundation.md +++ b/eds/eval/foundation.md @@ -5,6 +5,7 @@ These queries test whether the EDS index surfaces design foundation knowledge and design patterns that guide consistent interface construction. When judging results, verify that: + - Colour system results reference semantic categories (accent, neutral, success, danger, warning, info), not raw hex values alone. - Spacing results reference the 8px grid system and named spacer sizes (XX Small through XXX Large). - Typography results reference EDS heading and paragraph components or typographic guidelines. diff --git a/eds/eval/getting-started.md b/eds/eval/getting-started.md index 7bd321c04..656b01960 100644 --- a/eds/eval/getting-started.md +++ b/eds/eval/getting-started.md @@ -5,6 +5,7 @@ These queries test whether the EDS index surfaces onboarding and setup informati structure, and integrating EDS with development workflows. When judging results, verify that: + - Installation instructions use `@equinor/eds-core-react` as the primary component package. - EdsProvider is mentioned as the required wrapper for EDS components. - Package names are real published packages, not fabricated. diff --git a/eds/eval/icons.md b/eds/eval/icons.md index d91326ffd..647da3c1b 100644 --- a/eds/eval/icons.md +++ b/eds/eval/icons.md @@ -4,6 +4,7 @@ These queries test whether the EDS index surfaces useful information about EDS i — finding icons by name or purpose, importing them, and using them in React. When judging results, verify that: + - Icon names referenced are real exports from `@equinor/eds-icons`. - Import examples use the correct named export pattern. - React usage shows `Icon` component from `@equinor/eds-core-react` with `data` prop. diff --git a/eds/eval/tokens.md b/eds/eval/tokens.md index 6eb078c12..464437dbb 100644 --- a/eds/eval/tokens.md +++ b/eds/eval/tokens.md @@ -4,6 +4,7 @@ These queries test whether the EDS index surfaces accurate design token informat when developers ask about CSS variables, color values, spacing, and sizing tokens. When judging results, verify that: + - Returned CSS variable names are real `--eds-*` tokens, not invented names. - Token values match the actual theme (light vs dark) referenced in the query. - Results distinguish between light and dark theme tokens when relevant. diff --git a/package.json b/package.json index 6400192eb..9c76856b0 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ }, "homepage": "https://github.com/equinor/fusion-react-components#readme", "devDependencies": { - "@biomejs/biome": "2.5.15", + "@biomejs/biome": "2.6.6", "@changesets/cli": "^3.0.3", "@commitlint/cli": "^21.2.4", "@commitlint/config-conventional": "^21.2.4", diff --git a/packages/ag-grid-person-cell/README.md b/packages/ag-grid-person-cell/README.md index 28b58ede7..58c6c7215 100644 --- a/packages/ag-grid-person-cell/README.md +++ b/packages/ag-grid-person-cell/README.md @@ -34,7 +34,7 @@ const columnDefs = useMemo(() => { subHeading: (person) => person.mail, // Function to extract person's email as sub heading size: 'small', // Specifies the size of the component showAvatar: true, // Determines whether to show the avatar in the cell - }) + }), ]; }, []); ``` @@ -46,11 +46,11 @@ You can customize the content of the `heading` and `subHeading` in the component For example, you might want to display the **job title** in bold and the **email** as a **clickable link**. ```tsx - agGridPersonCell({ - ...agPersonCellData, - heading: (person) => `${person.jobTitle}`, // Custom HTML for heading - subHeading: (person) => `${person.mail}`, // Custom HTML for subHeading - }) +agGridPersonCell({ + ...agPersonCellData, + heading: (person) => `${person.jobTitle}`, // Custom HTML for heading + subHeading: (person) => `${person.mail}`, // Custom HTML for subHeading +}); ``` diff --git a/packages/ag-grid-utils/README.md b/packages/ag-grid-utils/README.md index b7a086e9b..63688546d 100644 --- a/packages/ag-grid-utils/README.md +++ b/packages/ag-grid-utils/README.md @@ -1,7 +1,6 @@ -# AG Grid - -## Change handler - -> utility for showing which fields has changed -[Storybook](https://equinor.github.io/fusion-react-components/?path=/docs/examples-ag-grid-utils--change-handler) - +# AG Grid + +## Change handler + +> utility for showing which fields has changed +> [Storybook](https://equinor.github.io/fusion-react-components/?path=/docs/examples-ag-grid-utils--change-handler) diff --git a/packages/errorboundary/README.md b/packages/errorboundary/README.md index 381de6f79..577d36794 100644 --- a/packages/errorboundary/README.md +++ b/packages/errorboundary/README.md @@ -2,4 +2,4 @@ Display a Error message if error is thrown in children > this component uses the `react-error-boundary` with a predefined `Fallback` -atm this component is under `@equinor/fusion-react-errorboundary/legacy` since there is a WIP to create a generic component in the future \ No newline at end of file +atm this component is under `@equinor/fusion-react-errorboundary/legacy` since there is a WIP to create a generic component in the future diff --git a/packages/filter/README.md b/packages/filter/README.md index beb9dff26..522c98a9c 100644 --- a/packages/filter/README.md +++ b/packages/filter/README.md @@ -1,10 +1,10 @@ ## `@equinor/fusion-react-filter` [![Published on npm](https://img.shields.io/npm/v/@equinor/fusion-react-filter.svg)](https://www.npmjs.com/package/@equinor/fusion-react-filter) -Adds filter functionality through the FilterProvider. -Also comes with various predefined filters and panels for building out a filter. +Adds filter functionality through the FilterProvider. +Also comes with various predefined filters and panels for building out a filter. -Consult the [Storybook](https://equinor.github.io/fusion-react-components/?path=/docs/data-filter) for more detailed examples and documentation. +Consult the [Storybook](https://equinor.github.io/fusion-react-components/?path=/docs/data-filter) for more detailed examples and documentation. ### Installation @@ -23,9 +23,9 @@ npm install @equinor/fusion-react-filter ### Properties/Attributes -Name | Type | Description --------------------- | --------- | ------- -`initialData` | `Generic*` | Dataset for filtering. *Recommended type is TData[] or Record -`initialFilters` | `Record` | Filter selection added at initiation +| Name | Type | Description | +| ---------------- | -------------------- | --------------------------------------------------------------------------- | +| `initialData` | `Generic*` | Dataset for filtering. *Recommended type is TData[] or Record | +| `initialFilters` | `Record` | Filter selection added at initiation | diff --git a/packages/filter/TODO.md b/packages/filter/TODO.md index cd0465b49..91ad59814 100644 --- a/packages/filter/TODO.md +++ b/packages/filter/TODO.md @@ -1,9 +1,9 @@ ### FilterProvider - [ ] clear all filter selection -- [ ] remove pre-selection if options are not in dataset +- [ ] remove pre-selection if options are not in dataset ## Future - [ ] searchable select filter -- [ ] range slider filter \ No newline at end of file +- [ ] range slider filter diff --git a/packages/markdown/README.md b/packages/markdown/README.md index 41d35cfeb..6d710fe7e 100644 --- a/packages/markdown/README.md +++ b/packages/markdown/README.md @@ -8,6 +8,7 @@ [Fusion Web Component](https://equinor.github.io/fusion-web-components/?path=/docs/input-markdown-editor--basic) ### Installation + ```sh npm install @equinor/fusion-react-markdown ``` @@ -19,28 +20,35 @@ npm install @equinor/fusion-react-markdown ```tsx import { MarkdownEditor } from '@equinor/fusion-react-markdown'; - - **some** markdown *text* - +**some** markdown *text*; ``` #### Usage + ```tsx import { MarkdownEditor } from '@equinor/fusion-react-markdown'; -const markdown = "# my heading here"; -{console.log(e.target._value)}} change={console.log} /> +const markdown = '# my heading here'; + { + console.log(e.target._value); + }} + change={console.log} +/>; ``` #### Properties/Attributes -| Name | Type | Default | Description -| ---- | ---- | ------- | ----------- -| `menuItems` | `Array*` | `['strong', 'em', 'bullet_list', 'ordered_list']` | List of visible menu buttons -| `minHeight` | `string` | `''` | Markdown Editor minimum height -| `value` | `string` | `''` | Markdown editors value -| `menuSize` | `MenuSizes**` | `'medium'` | Size of the menu buttons - -\* `Array` is list of showing visible menu buttons available as `MdMenuItemType`. + +| Name | Type | Default | Description | +| ----------- | ------------------------ | ------------------------------------------------- | ------------------------------ | +| `menuItems` | `Array*` | `['strong', 'em', 'bullet_list', 'ordered_list']` | List of visible menu buttons | +| `minHeight` | `string` | `''` | Markdown Editor minimum height | +| `value` | `string` | `''` | Markdown editors value | +| `menuSize` | `MenuSizes**` | `'medium'` | Size of the menu buttons | + +\* `Array` is list of showing visible menu buttons available as `MdMenuItemType`. + ```ts type MdMenuItemType = | 'strong' @@ -56,7 +64,8 @@ type MdMenuItemType = | 'tx'; ``` -\* `MenuSizes` type imported from markdown component. +\* `MenuSizes` type imported from markdown component. + ```ts type MenuSizes = 'small' | 'medium' | 'large'; ``` diff --git a/packages/side-sheet/README.md b/packages/side-sheet/README.md index b58678022..ab2700ff7 100644 --- a/packages/side-sheet/README.md +++ b/packages/side-sheet/README.md @@ -7,7 +7,6 @@ [Storybook](https://equinor.github.io/fusion-react-components/?path=/docs/examples-side-sheet--component) - ## Installation ```sh @@ -15,26 +14,27 @@ npm install @equinor/fusion-react-side-sheet ``` ## Children -| Name | Props | Description -| ---- | ---- | ----------- -| `Title` | title | Required child for displaying side sheet title. -| `SubTile` | subTitle | ... -| `Actions`| sideSheetRef | ... -| `Indicator` | color | ... -| `Content` | ReactChildElements| ... + +| Name | Props | Description | +| ----------- | ------------------ | ----------------------------------------------- | +| `Title` | title | Required child for displaying side sheet title. | +| `SubTile` | subTitle | ... | +| `Actions` | sideSheetRef | ... | +| `Indicator` | color | ... | +| `Content` | ReactChildElements | ... | ## Properties/Attributes -| Name | Type | Default | Description -| ---- | ---- | ------- | ----------- -| `enableFullScreen` | `boolean` | `true` | prop for disabling fullScreen action. -| `defaultWidth` | `number \| \`${number}${'%' \| 'vw' \| 'px' \| 'em'}\`` | `minWidth` | Initial width of the side-sheet as pixels or a supported CSS width (`%`, `vw`, `px`, or `em`). -| `minWidth` | `number` | `480` | Minimum width of the side-sheet. -| `disableResize` | `boolean` | `false` | Hides the full-height resize strip and disables resizing. When resizing is available, its 2 px subtle gray outer border stays visible. On hover or drag, the strip background uses the same subtle gray as the border. There is no inner border or shadow. At maximum width, the side sheet stops short by the strip's width so the strip remains outside it, with its outer border at the left viewport edge. The strip can also be focused and resized with Left/Right arrow keys (Home sets minimum width; End sets maximum width). -| `onClose` | `function` | - | Callback function triggered onClose button clicked. + +| Name | Type | Default | Description | +| ------------------ | ------------------------------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enableFullScreen` | `boolean` | `true` | prop for disabling fullScreen action. | +| `defaultWidth` | `number \| \`${number}${'%' \| 'vw' \| 'px' \| 'em'}\`` | `minWidth` | Initial width of the side-sheet as pixels or a supported CSS width (`%`, `vw`, `px`, or `em`). | +| `minWidth` | `number` | `480` | Minimum width of the side-sheet. | +| `disableResize` | `boolean` | `false` | Hides the full-height resize strip and disables resizing. When resizing is available, its 2 px subtle gray outer border stays visible. On hover or drag, the strip background uses the same subtle gray as the border. There is no inner border or shadow. At maximum width, the side sheet stops short by the strip's width so the strip remains outside it, with its outer border at the left viewport edge. The strip can also be focused and resized with Left/Right arrow keys (Home sets minimum width; End sets maximum width). | +| `onClose` | `function` | - | Callback function triggered onClose button clicked. | ## Keyboard resizing The focusable resize strip follows the [WAI-ARIA Window Splitter keyboard convention](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/), treating the SideSheet as the primary pane. Home sets its smallest allowed width; End sets its largest allowed width. These keys target the pane's size, not the separator's leftmost or rightmost position. Left Arrow widens the right-hand sheet and Right Arrow narrows it. - diff --git a/packages/stepper/README.md b/packages/stepper/README.md index 5d191ebb0..90dda5c2d 100644 --- a/packages/stepper/README.md +++ b/packages/stepper/README.md @@ -9,23 +9,23 @@ ### for stepper -Name | Type | Default | Description -------------------------- |-------------------------------| ----------------------------- | ----------- -`initialStepKey` | `string / undefined` | `/` | Sets the initial step key for an uncontrolled stepper component. If undefined the stepper will use the first step as initial step. -`stepKey` | `string / undefined` | `/` | Used for making the stepper a controlled component. If it is set then it is the property that decides the currentStep and initialStepKey is ignored. -`forceOrder` | `boolean` | `false` | Can't skip steps. Steps will have specific order. -`verticalSteps` | `boolean` | `false` | Change stepper layout to vertical. Vertical positioning of steps. -`hideNavButtons` | `boolean` | `false` | Show/hide next and previous navigation buttons for stepper. -`onChange` | `(stepKey: string, allSteps: StepKey[]) => void` | | onChange event for active step. +| Name | Type | Default | Description | +| ---------------- | ------------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `initialStepKey` | `string / undefined` | `/` | Sets the initial step key for an uncontrolled stepper component. If undefined the stepper will use the first step as initial step. | +| `stepKey` | `string / undefined` | `/` | Used for making the stepper a controlled component. If it is set then it is the property that decides the currentStep and initialStepKey is ignored. | +| `forceOrder` | `boolean` | `false` | Can't skip steps. Steps will have specific order. | +| `verticalSteps` | `boolean` | `false` | Change stepper layout to vertical. Vertical positioning of steps. | +| `hideNavButtons` | `boolean` | `false` | Show/hide next and previous navigation buttons for stepper. | +| `onChange` | `(stepKey: string, allSteps: StepKey[]) => void` | | onChange event for active step. | ### for step -Name | Type | Default | Description -------------------------- | ----------------------------- | ----------------------------- | ----------- -`stepKey` | `string` | `/` | Step key of step. Used for ***activeStepKey***. `required` -`title` | `string` | `/` | Title of step -`description` | `string` | `/` | Description of step -`disabled` | `boolean` | `false` | Disable step. Can't be clicked, but can manually navigate to it +| Name | Type | Default | Description | +| ------------- | --------- | ------- | --------------------------------------------------------------- | +| `stepKey` | `string` | `/` | Step key of step. Used for **_activeStepKey_**. `required` | +| `title` | `string` | `/` | Title of step | +| `description` | `string` | `/` | Description of step | +| `disabled` | `boolean` | `false` | Disable step. Can't be clicked, but can manually navigate to it | ## Example Usage @@ -44,7 +44,7 @@ import { Stepper } from '@equinor/fusion-react-stepper'; Step content 3 - +; ``` ### Controlled usage diff --git a/packages/styles/README.md b/packages/styles/README.md index e6d495b2b..18905b337 100644 --- a/packages/styles/README.md +++ b/packages/styles/README.md @@ -33,20 +33,23 @@ yarn add @equinor/fusion-react-styles ```tsx import { makeStyles, ThemeProvider, theme } from '@equinor/fusion-react-styles'; -const useStyles = makeStyles({ - root: { - color: 'blue', - padding: '16px', - }, - title: { - fontSize: '24px', - fontWeight: 'bold', +const useStyles = makeStyles( + { + root: { + color: 'blue', + padding: '16px', + }, + title: { + fontSize: '24px', + fontWeight: 'bold', + }, }, -}, { name: 'MyComponent' }); + { name: 'MyComponent' }, +); function MyComponent() { const classes = useStyles(); - + return (

Hello World

@@ -72,18 +75,21 @@ Use `makeStyles` to create a styles hook that generates CSS class names. Always ```tsx import { makeStyles } from '@equinor/fusion-react-styles'; -const useStyles = makeStyles({ - root: { - color: 'red', - padding: '16px', - }, - button: { - backgroundColor: 'blue', - '&:hover': { - backgroundColor: 'darkblue', +const useStyles = makeStyles( + { + root: { + color: 'red', + padding: '16px', + }, + button: { + backgroundColor: 'blue', + '&:hover': { + backgroundColor: 'darkblue', + }, }, }, -}, { name: 'MyComponent' }); + { name: 'MyComponent' }, +); ``` ### 2. Using Styles in Components @@ -93,7 +99,7 @@ Call the hook inside your component to get class names: ```tsx function Component() { const classes = useStyles(); - + return (
@@ -112,12 +118,15 @@ interface ComponentProps { size: 'small' | 'large'; } -const useStyles = makeStyles({ - root: (props: ComponentProps) => ({ - color: props.color, - padding: props.size === 'large' ? '24px' : '12px', - }), -}, { name: 'DynamicComponent' }); +const useStyles = makeStyles( + { + root: (props: ComponentProps) => ({ + color: props.color, + padding: props.size === 'large' ? '24px' : '12px', + }), + }, + { name: 'DynamicComponent' }, +); function Component(props: ComponentProps) { const classes = useStyles(props); @@ -132,49 +141,52 @@ Access theme values using theme functions. Theme properties are `StyleProperty` ```tsx import { makeStyles, createStyles, theme } from '@equinor/fusion-react-styles'; -const useStyles = makeStyles((themeValue) => - createStyles({ - root: { - color: themeValue.colors.text.static_icons__default.getVariable('color'), - padding: themeValue.spacing.comfortable.medium.getVariable('padding'), - backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), - }, - button: { - backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), - '&:hover': { - backgroundColor: themeValue.colors.ui.background__hover.getVariable('color'), +const useStyles = makeStyles( + (themeValue) => + createStyles({ + root: { + color: themeValue.colors.text.static_icons__default.getVariable('color'), + padding: themeValue.spacing.comfortable.medium.getVariable('padding'), + backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), }, - }, - }), - { name: 'ThemedComponent' } + button: { + backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), + '&:hover': { + backgroundColor: themeValue.colors.ui.background__hover.getVariable('color'), + }, + }, + }), + { name: 'ThemedComponent' }, ); ``` **Important:** Theme properties (colors, spacing, etc.) are `StyleProperty` instances: + - **Colors**: Use `theme.colors.*.getVariable('color')` to get the color value as a CSS variable string -- **Spacing**: Use `theme.spacing.*.getVariable('padding')` to get the spacing value as a CSS variable string +- **Spacing**: Use `theme.spacing.*.getVariable('padding')` to get the spacing value as a CSS variable string - **Typography**: Use `theme.typography.*.style.*` to access typography properties (e.g., `theme.typography.heading.h4.style.fontSize`) Example: ```tsx -const useStyles = makeStyles((themeValue) => - createStyles({ - container: { - // Color property - use getVariable('color') - backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), - color: themeValue.colors.text.static_icons__default.getVariable('color'), - - // Spacing property - use getVariable('padding') - padding: themeValue.spacing.comfortable.medium.getVariable('padding'), - marginTop: themeValue.spacing.comfortable.small.getVariable('padding'), - - // Typography - access style properties directly - fontSize: themeValue.typography.paragraph.body_short.style.fontSize, - fontWeight: themeValue.typography.heading.h4.style.fontWeight, - }, - }), - { name: 'Container' } +const useStyles = makeStyles( + (themeValue) => + createStyles({ + container: { + // Color property - use getVariable('color') + backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), + color: themeValue.colors.text.static_icons__default.getVariable('color'), + + // Spacing property - use getVariable('padding') + padding: themeValue.spacing.comfortable.medium.getVariable('padding'), + marginTop: themeValue.spacing.comfortable.small.getVariable('padding'), + + // Typography - access style properties directly + fontSize: themeValue.typography.paragraph.body_short.style.fontSize, + fontWeight: themeValue.typography.heading.h4.style.fontWeight, + }, + }), + { name: 'Container' }, ); ``` @@ -185,6 +197,7 @@ const useStyles = makeStyles((themeValue) => Creates a hook that generates CSS class names from style definitions. **Parameters:** + - `stylesOrCreator`: Style rules object or a function `(theme) => StyleRules` - `options.name`: **Required** name prefix for debugging and performance. Without it, all instances share the same cache key, causing performance issues. @@ -194,23 +207,32 @@ Creates a hook that generates CSS class names from style definitions. ```tsx // Static styles -const useStyles = makeStyles({ - root: { color: 'red' }, -}, { name: 'MyComponent' }); +const useStyles = makeStyles( + { + root: { color: 'red' }, + }, + { name: 'MyComponent' }, +); // Theme-based styles -const useStyles = makeStyles((theme) => ({ - root: { - color: theme.colors.text.static_icons__default.getVariable('color'), - }, -}), { name: 'ThemedComponent' }); +const useStyles = makeStyles( + (theme) => ({ + root: { + color: theme.colors.text.static_icons__default.getVariable('color'), + }, + }), + { name: 'ThemedComponent' }, +); // Dynamic styles with props -const useStyles = makeStyles({ - root: (props: { color: string }) => ({ - color: props.color, - }), -}, { name: 'DynamicComponent' }); +const useStyles = makeStyles( + { + root: (props: { color: string }) => ({ + color: props.color, + }), + }, + { name: 'DynamicComponent' }, +); ``` ### `createStyles(styles?)` @@ -220,16 +242,17 @@ Type-safe helper for creating style rules. Improves TypeScript inference for cla ```tsx import { createStyles, makeStyles } from '@equinor/fusion-react-styles'; -const useStyles = makeStyles((theme) => - createStyles({ - root: { - color: theme.colors.text.static_icons__default.getVariable('color'), - }, - button: { - padding: theme.spacing.comfortable.medium.getVariable('padding'), - }, - }), - { name: 'Component' } +const useStyles = makeStyles( + (theme) => + createStyles({ + root: { + color: theme.colors.text.static_icons__default.getVariable('color'), + }, + button: { + padding: theme.spacing.comfortable.medium.getVariable('padding'), + }, + }), + { name: 'Component' }, ); function Component() { @@ -240,6 +263,7 @@ function Component() { ``` **Benefits:** + - Type-safe class key access - TypeScript knows exactly which class keys exist - Better autocompletion in IDEs - Catches typos at compile time @@ -249,6 +273,7 @@ function Component() { Provides theme context to child components. Supports nested themes and theme composition. **Props:** + - `theme`: Theme object or function `(outerTheme) => theme` - `children`: React nodes @@ -286,15 +311,17 @@ import { useTheme } from '@equinor/fusion-react-styles'; function Component() { const theme = useTheme(); - + if (!theme) { return
No theme available
; } - + return ( -
+
Hello
); @@ -316,17 +343,20 @@ interface ExtendedTheme extends FusionTheme { }; } -const extendedTheme = createTheme({ - app: { - borderRadius: '12px', - sidebarWidth: '300px', +const extendedTheme = createTheme( + { + app: { + borderRadius: '12px', + sidebarWidth: '300px', + }, }, -}, theme); + theme, +); // Use in ThemeProvider - +; ``` ### `StylesProvider` @@ -334,6 +364,7 @@ const extendedTheme = createTheme({ Creates an isolated styling scope to prevent CSS class name collisions. Critical for micro-frontends and dynamically loaded modules. **Props:** + - `seed`: String prefix for class names (e.g., `"my-module"`) - `generateClassName`: Optional custom class name generator - `jss`: Optional custom JSS instance @@ -420,7 +451,7 @@ function App() { - + @@ -430,6 +461,7 @@ function App() { ``` Even though both modules use the same styles object, they'll generate different class names: + - Module A: `module-a-makeStyles-root-1` - Module B: `module-b-makeStyles-root-1` @@ -440,26 +472,29 @@ Full support for CSS-in-JS nested selectors: ```tsx import { clsx } from '@equinor/fusion-react-styles'; -const useStyles = makeStyles({ - root: { - color: 'blue', - '&:hover': { - color: 'red', - }, - '& .child': { - padding: '10px', - }, - '&$disabled': { - opacity: 0.5, +const useStyles = makeStyles( + { + root: { + color: 'blue', + '&:hover': { + color: 'red', + }, + '& .child': { + padding: '10px', + }, + '&$disabled': { + opacity: 0.5, + }, }, + disabled: {}, }, - disabled: {}, -}, { name: 'NestedComponent' }); + { name: 'NestedComponent' }, +); function Component() { const classes = useStyles(); const [disabled, setDisabled] = useState(false); - + return (
Child element
@@ -479,16 +514,17 @@ interface StyleProps { color: string; } -const useStyles = makeStyles((themeValue) => - createStyles({ - root: (props: StyleProps) => ({ - ...themeValue.typography.paragraph.body_short.style, - color: props.color, - padding: themeValue.spacing.comfortable.medium.getVariable('padding'), - backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), +const useStyles = makeStyles( + (themeValue) => + createStyles({ + root: (props: StyleProps) => ({ + ...themeValue.typography.paragraph.body_short.style, + color: props.color, + padding: themeValue.spacing.comfortable.medium.getVariable('padding'), + backgroundColor: themeValue.colors.ui.background__default.getVariable('color'), + }), }), - }), - { name: 'MyComponent' } + { name: 'MyComponent' }, ); function Component(props: StyleProps) { @@ -520,14 +556,15 @@ const extendedTheme = createTheme({ }); // Use extended theme with makeStyles -const useStyles = makeStyles((themeValue: typeof extendedTheme) => - createStyles({ - root: { - borderRadius: themeValue.app.borderRadius, - padding: themeValue.spacing.comfortable.medium.getVariable('padding'), - }, - }), - { name: 'ExtendedThemeComponent' } +const useStyles = makeStyles( + (themeValue: typeof extendedTheme) => + createStyles({ + root: { + borderRadius: themeValue.app.borderRadius, + padding: themeValue.spacing.comfortable.medium.getVariable('padding'), + }, + }), + { name: 'ExtendedThemeComponent' }, ); ``` @@ -541,23 +578,27 @@ Type inference works automatically, and using `createStyles` provides even bette ```tsx // Basic type inference - works, but ClassKey is inferred as string -const useStyles = makeStyles({ - root: { color: 'red' }, - button: { padding: '10px' }, -}, { name: 'Component' }); +const useStyles = makeStyles( + { + root: { color: 'red' }, + button: { padding: '10px' }, + }, + { name: 'Component' }, +); const classes = useStyles(); // classes: Record // With createStyles - ClassKey is inferred as literal union type -const useStyles = makeStyles((theme) => - createStyles({ - root: { - color: theme.colors.text.static_icons__default.getVariable('color'), - }, - button: { - padding: theme.spacing.comfortable.medium.getVariable('padding'), - }, - }), - { name: 'Component' } +const useStyles = makeStyles( + (theme) => + createStyles({ + root: { + color: theme.colors.text.static_icons__default.getVariable('color'), + }, + button: { + padding: theme.spacing.comfortable.medium.getVariable('padding'), + }, + }), + { name: 'Component' }, ); const classes = useStyles(); // classes: Record<'root' | 'button', string> // TypeScript will error if you try to access classes.foo - it knows the exact keys! @@ -574,12 +615,15 @@ interface MyAppTheme extends StyleDefinition { customProperty: string; } -const useStyles = makeStyles((theme: FusionTheme) => ({ - root: { - color: theme.colors.text.static_icons__default.getVariable('color'), - custom: theme.customProperty, // Fully typed! - }, -}), { name: 'Component' }); +const useStyles = makeStyles( + (theme: FusionTheme) => ({ + root: { + color: theme.colors.text.static_icons__default.getVariable('color'), + custom: theme.customProperty, // Fully typed! + }, + }), + { name: 'Component' }, +); ``` ### Type-Safe Class Access diff --git a/packages/styles/src/__tests__/README.md b/packages/styles/src/__tests__/README.md index 4e2bd430c..926601d9e 100644 --- a/packages/styles/src/__tests__/README.md +++ b/packages/styles/src/__tests__/README.md @@ -1,40 +1,38 @@ -/** - * @fileoverview Test Suite for @equinor/fusion-react-styles - * - * This test suite demonstrates what this package does and how it works. - * By reading these tests, you can understand: - * - * 1. **makeStyles** - The main API for creating styled components - * - Converts JavaScript style objects into CSS class names - * - Supports dynamic styles based on props and theme - * - Caches stylesheets for performance - * - * 2. **StylesProvider** - Creates isolated styling scopes - * - Prevents CSS class name collisions between modules - * - Critical for micro-frontends and dynamically loaded components - * - Uses "seed" prefixes to create unique namespaces - * - * 3. **ThemeProvider** - Provides theme values to components - * - Enables design system theming - * - Supports theme composition (nested themes) - * - Integrates with fwc-theme web component - * - * 4. **Utilities** - Supporting functions - * - createGenerateClassName: Creates class name generators - * - createStyles: Type-safe style helper - * - theme: Fusion design system theme - * - * KEY FEATURE: Style Isolation - * When you have nested StylesProviders with different seeds, they generate - * different class names even if they use the same styles. This prevents - * CSS collisions - critical for modular applications. - * - * Example: - * - Module A with seed "moduleA" using style "root" → "moduleA-makeStyles-root-1" - * - Module B with seed "moduleB" using style "root" → "moduleB-makeStyles-root-1" - * - No collision! Each module gets its own CSS. - */ - -// This file exists to document the test structure -// Actual tests are in individual test files +# Test Suite for @equinor/fusion-react-styles +This test suite demonstrates what this package does and how it works. +By reading these tests, you can understand: + +1. **makeStyles** - The main API for creating styled components + - Converts JavaScript style objects into CSS class names + - Supports dynamic styles based on props and theme + - Caches stylesheets for performance + +2. **StylesProvider** - Creates isolated styling scopes + - Prevents CSS class name collisions between modules + - Critical for micro-frontends and dynamically loaded components + - Uses "seed" prefixes to create unique namespaces + +3. **ThemeProvider** - Provides theme values to components + - Enables design system theming + - Supports theme composition (nested themes) + - Integrates with fwc-theme web component + +4. **Utilities** - Supporting functions + - createGenerateClassName: Creates class name generators + - createStyles: Type-safe style helper + - theme: Fusion design system theme + +## Key feature: Style isolation + +When you have nested StylesProviders with different seeds, they generate +different class names even if they use the same styles. This prevents +CSS collisions - critical for modular applications. + +Example: + +- Module A with seed "moduleA" using style "root" → "moduleA-makeStyles-root-1" +- Module B with seed "moduleB" using style "root" → "moduleB-makeStyles-root-1" +- No collision! Each module gets its own CSS. + +This file documents the test structure. The actual tests are in the individual test files. diff --git a/packages/styles/src/__tests__/StyleProvider.test.tsx b/packages/styles/src/__tests__/StyleProvider.test.tsx index d8e6fa8eb..85f2040c1 100644 --- a/packages/styles/src/__tests__/StyleProvider.test.tsx +++ b/packages/styles/src/__tests__/StyleProvider.test.tsx @@ -53,6 +53,7 @@ describe('StylesProvider - Styling scope isolation', () => { // WHAT: StylesProvider provides JSS instance and class name generator via context // WHY: Child components need this to generate styles + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const context = useContext(StylesContext); // Verify context has all required properties @@ -75,6 +76,7 @@ describe('StylesProvider - Styling scope isolation', () => { const customGenerate = createGenerateClassName('custom'); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const context = useContext(StylesContext); // Verify custom generator is used @@ -94,6 +96,7 @@ describe('StylesProvider - Styling scope isolation', () => { // WHY: Critical for preventing CSS collisions when modules share same style names // EXAMPLE: Module A and Module B both use "root" class - with seeds they become "moduleA-root-1" and "moduleB-root-1" + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const context = useContext(StylesContext); const className = context.generateClassName({ key: 'test' }); @@ -116,6 +119,7 @@ describe('StylesProvider - Styling scope isolation', () => { const { create } = await import('jss'); const customJss = create(); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const context = useContext(StylesContext); // Verify custom JSS instance is used @@ -137,6 +141,7 @@ describe('StylesProvider - Styling scope isolation', () => { const parentGenerate = createGenerateClassName('parent'); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const context = useContext(StylesContext); // Child inherits parent's generator @@ -159,6 +164,7 @@ describe('StylesProvider - Styling scope isolation', () => { const customSheetsManager = new Map(); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const context = useContext(StylesContext); // Verify custom manager is used @@ -193,6 +199,7 @@ describe('StylesProvider - Styling scope isolation', () => { const useStyles1 = makeStyles(sharedStyles, { name: 'Component1' }); const useStyles2 = makeStyles(sharedStyles, { name: 'Component2' }); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const Component1 = () => { const classes = useStyles1({}); return ( @@ -202,6 +209,7 @@ describe('StylesProvider - Styling scope isolation', () => { ); }; + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const Component2 = () => { const classes = useStyles2({}); return ( @@ -266,6 +274,7 @@ describe('StylesProvider - Styling scope isolation', () => { const useOuterStyles = makeStyles(styles, { name: 'OuterComponent' }); const useInnerStyles = makeStyles(styles, { name: 'InnerComponent' }); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const InnerComponent = () => { const classes = useInnerStyles({}); return ( @@ -275,6 +284,7 @@ describe('StylesProvider - Styling scope isolation', () => { ); }; + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const OuterComponent = () => { const classes = useOuterStyles({}); return ( @@ -336,6 +346,7 @@ describe('StylesProvider - Styling scope isolation', () => { const useBaseStyles = makeStyles(baseStyles, { name: 'BaseComponent' }); const useDynamicStyles = makeStyles(baseStyles, { name: 'DynamicComponent' }); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const BaseComponent = () => { const classes = useBaseStyles({}); return ( @@ -350,6 +361,7 @@ describe('StylesProvider - Styling scope isolation', () => { ); }; + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const DynamicComponent = () => { const classes = useDynamicStyles({}); return ( diff --git a/packages/styles/src/__tests__/ThemeProvider.test.tsx b/packages/styles/src/__tests__/ThemeProvider.test.tsx index 9b9734905..43861c01e 100644 --- a/packages/styles/src/__tests__/ThemeProvider.test.tsx +++ b/packages/styles/src/__tests__/ThemeProvider.test.tsx @@ -50,6 +50,7 @@ describe('ThemeProvider - Theme distribution', () => { // WHY: Allows components to use theme values without receiving theme as prop // EXAMPLE: Component uses theme.colors.primary instead of hardcoded color + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const theme = useContext(ThemeContext); // Verify theme from provider is available @@ -69,6 +70,7 @@ describe('ThemeProvider - Theme distribution', () => { // WHY: Components still work even if parent doesn't provide theme // EXAMPLE: Standalone components or utility components + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const theme = useContext(ThemeContext); // Verify default theme is used @@ -107,6 +109,7 @@ describe('ThemeProvider - Theme distribution', () => { { name: 'ThemeFunctionTest' }, ); + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const classes = useStyles({}); return
Test
; @@ -159,6 +162,7 @@ describe('ThemeProvider - Theme distribution', () => { ); }; + // biome-ignore lint/correctness/noComponentHookFactories: test fixture closes over per-test values const TestComponent = () => { const componentTheme = useTheme(); // Verify the merged theme is available diff --git a/packages/styles/src/make-styles.ts b/packages/styles/src/make-styles.ts index aed8dfbb5..1bf0f80bb 100644 --- a/packages/styles/src/make-styles.ts +++ b/packages/styles/src/make-styles.ts @@ -144,6 +144,7 @@ export function makeStyles< const instanceName = generateInstanceName(name); + // biome-ignore lint/correctness/noComponentHookFactories: makeStyles is a public hook factory, called once at module level by consumers const useStyles = (props: Props = {} as Props): Record => { // Get theme from context or use default const theme = useContext(ThemeContext) || optionsDefaultTheme; diff --git a/packages/tabs/README.md b/packages/tabs/README.md index b3d3791df..dd9bd7950 100644 --- a/packages/tabs/README.md +++ b/packages/tabs/README.md @@ -9,17 +9,21 @@ This package provides a simple tab router. It handles active tab state, and rend - **State Management**: Uses `@equinor/fusion-observable` for state management and actions. - **Context API**: Provides a context for accessing and manipulating router state. - ## Usage ```tsx -import { TabProvider } from '@equinor/fusion-react-components-tabs'; +import { TabProvider } from '@equinor/fusion-react-components-tabs'; const MyComponent = () => ( - - Tab 1 content - Tab 2 content - + + + {' '} + Tab 1 content + + + {' '} + Tab 2 content + + ); ``` - diff --git a/packages/textarea/README.md b/packages/textarea/README.md index bcf68f75e..959e3faba 100644 --- a/packages/textarea/README.md +++ b/packages/textarea/README.md @@ -8,6 +8,7 @@ [Fusion Web Component](https://github.com/equinor/fusion-web-components/tree/main/packages/textarea) ### Installation + ```sh npm install @equinor/fusion-react-textarea ``` @@ -15,49 +16,63 @@ npm install @equinor/fusion-react-textarea ### Example Usage ```tsx - +; ``` ### Properties/Attributes -Name | Type | Description -------------------------- | ----------------------------- | ----------- -`value` | `string` | The input control's value. -`type` | `TextInputType*` | A string specifying the type of control to render. -`variant` | `TextInputVariant**` | Input style variant to render. -`label` | `string` | Sets floating label value. -`rows` | `number` | Sets number of visible text lines. -`cols` | `number` | Sets the visible width of the textarea. -`placeholder` | `string` | Sets disappearing input placeholder. -`prefix` | `string` | Prefix text to display before the input. -`suffix` | `string` | Suffix text to display after the input. -`disabled` | `boolean` | Whether or not the input should be disabled. -`charCounter` | `boolean | TextInputCharCounter***` | **Note: requries `maxLength` to be set.** Display character counter with max length. -`helper` | `string` | Helper text to display below the input. Display default only when focused. -`helperPersistent` | `boolean` | Always show the helper text despite focus. -`required` | `boolean` | Displays error state if value is empty and input is blurred. -`maxLength` | `number` | Maximum length to accept input. -`validationMessage` | `string` | Message to show in the error color when the textarea is invalid. (Helper text will not be visible) -`pattern` | `string` | [`HTMLInputElement.prototype.pattern`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (empty string will unset attribute) -`min` | `number`\|`string` | [`HTMLInputElement.prototype.min`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (empty string will unset attribute) -`max` | `number`\|`string` | [`HTMLInputElement.prototype.max`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (empty string will unset attribute) -`size` | `number`\|`null` | [`HTMLInputElement.prototype.size`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefsize) (null will unset attribute) -`step` | `number`\|`null` | [`HTMLInputElement.prototype.step`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (null will unset attribute) -`autoValidate` | `boolean` | Reports validity on value change rather than only on blur. -`validity` | `ValidityState` (readonly) | The [`ValidityState`](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) of the textarea. -`willValidate` | `boolean` (readonly) | [`HTMLInputElement.prototype.willValidate`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#Properties) -`validityTransform` | `ValidityTransform****`\|`null` | Callback called before each validation check. See the [validation section](#Validation) for more details. -`validateOnInitialRender` | `boolean` | Runs validation check on initial render. -`name` | `string` | Sets the `name` attribute on the internal input.\*\*\* - -\* `TextInputType` is exported by `TextArea`. +| Name | Type | Description | +| ------------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `value` | `string` | The input control's value. | +| `type` | `TextInputType*` | A string specifying the type of control to render. | +| `variant` | `TextInputVariant**` | Input style variant to render. | +| `label` | `string` | Sets floating label value. | +| `rows` | `number` | Sets number of visible text lines. | +| `cols` | `number` | Sets the visible width of the textarea. | +| `placeholder` | `string` | Sets disappearing input placeholder. | +| `prefix` | `string` | Prefix text to display before the input. | +| `suffix` | `string` | Suffix text to display after the input. | +| `disabled` | `boolean` | Whether or not the input should be disabled. | +| `charCounter` | `boolean | TextInputCharCounter***` | **Note: requries `maxLength` to be set.** Display character counter with max length. | +| `helper` | `string` | Helper text to display below the input. Display default only when focused. | +| `helperPersistent` | `boolean` | Always show the helper text despite focus. | +| `required` | `boolean` | Displays error state if value is empty and input is blurred. | +| `maxLength` | `number` | Maximum length to accept input. | +| `validationMessage` | `string` | Message to show in the error color when the textarea is invalid. (Helper text will not be visible) | +| `pattern` | `string` | [`HTMLInputElement.prototype.pattern`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (empty string will unset attribute) | +| `min` | `number`\|`string` | [`HTMLInputElement.prototype.min`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (empty string will unset attribute) | +| `max` | `number`\|`string` | [`HTMLInputElement.prototype.max`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (empty string will unset attribute) | +| `size` | `number`\|`null` | [`HTMLInputElement.prototype.size`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefsize) (null will unset attribute) | +| `step` | `number`\|`null` | [`HTMLInputElement.prototype.step`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Validation-related_attributes) (null will unset attribute) | +| `autoValidate` | `boolean` | Reports validity on value change rather than only on blur. | +| `validity` | `ValidityState` (readonly) | The [`ValidityState`](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) of the textarea. | +| `willValidate` | `boolean` (readonly) | [`HTMLInputElement.prototype.willValidate`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#Properties) | +| `validityTransform` | `ValidityTransform****`\|`null` | Callback called before each validation check. See the [validation section](#Validation) for more details. | +| `validateOnInitialRender` | `boolean` | Runs validation check on initial render. | +| `name` | `string` | Sets the `name` attribute on the internal input.\*\*\* | + +\* `TextInputType` is exported by `TextArea`. ```ts -type TextInputType = 'text'|'search'|'tel'|'url'|'email'|'password'| - 'date'|'month'|'week'|'time'|'datetime-local'|'number'|'color'; +type TextInputType = + | 'text' + | 'search' + | 'tel' + | 'url' + | 'email' + | 'password' + | 'date' + | 'month' + | 'week' + | 'time' + | 'datetime-local' + | 'number' + | 'color'; ``` -\*\* `TextInputVariant` is exported by `TextArea`. +\*\* `TextInputVariant` is exported by `TextArea`. ```ts export type TextInputVariant = 'filled' | 'outlined'; @@ -72,42 +87,42 @@ type TextInputCharCounter = 'external' | 'internal'; \*\*\*\* `ValidityTransform` is exported by `TextArea`. ```ts -type ValidityTransform = (value: string, nativeValidity: ValidityState) => Partial +type ValidityTransform = (value: string, nativeValidity: ValidityState) => Partial; ``` \*\*\*\*\* The `name` property should only be used for browser autofill as webcomponent form participation does not currently consider the `name` attribute. See [#289](https://github.com/material-components/material-components-web-components/issues/289). ### Methods -| Name | Description -| -------- | ------------- -| `checkValidity() => boolean` | Returns `true` if the textarea passes validity checks. Returns `false` and fires an [`invalid`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event) event on the textarea otherwise.
**NOTE:** When accessing any property or function that checks validity at textarea initial boot up, you may have to await `