chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

chore(clerk-js): Add API Keys component descriptors - #6095

Merged
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors
Jun 18, 2025
Merged

chore(clerk-js): Add API Keys component descriptors#6095
wobsoriano merged 113 commits into
mainfrom
rob/api-keys-element-descriptors

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 10, 2025

Copy link
Copy Markdown
Member

Description

This PR adds element descriptors to the <APIKeys /> AIO component for customization.

Coverage:

  • Top-level container
  • Header
    • Search input box
      • Search input
    • Add button
  • Table
    • Rows
    • Cells
    • Copy/reveal buttons
    • Spinner
  • Form container
    • name field
    • description field
    • expiration field
    • submit button
  • Revoke modal
    • Input
    • Submit button

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced the API Keys management interface with new element descriptors, enabling improved customization and theming of UI components related to API keys.
    • Added default descriptors for table components to improve UI consistency and customization.
  • Style
    • Added structured metadata to API Keys UI elements, supporting more granular styling and accessibility.
  • Chores
    • Minor formatting improvements for consistency.
    • Updated bundle size limit for UI common files.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2025

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6095

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6095

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6095

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6095

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6095

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6095

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6095

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6095

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6095

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6095

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6095

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6095

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6095

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6095

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6095

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6095

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6095

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6095

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6095

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6095

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6095

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6095

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6095

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6095

commit: 8e38cd6

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)

3-3: Import list is getting long – consider multi-line formatting

The utilities import now spans many identifiers; for readability consider:

-import { Box, Button, Col, descriptors, Flex, FormLabel, localizationKeys, Text } from '@/ui/customizables';+import {+ Box,+ Button,+ Col,+ descriptors,+ Flex,+ FormLabel,+ localizationKeys,+ Text,+} from '@/ui/customizables';
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)

462-482: Manual list maintenance is error-prone

The API-keys keys are appended in three places:

  1. ElementsConfig
  2. APPEARANCE_KEYS (here)
  3. Component usage

A single source of truth (e.g. generating APPEARANCE_KEYS from ElementsConfig at build-time) would prevent future omissions & cut review overhead.

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (2)

84-87: Consider adding a row-specific elementId for stronger selector granularity

Card.Root gains an elementDescriptor, which is great, but without a complementary elementId the selector will match every revoke-modal in the DOM.
If multiple revoke modals can coexist (e.g. in tests or storybook), distinguishing them becomes impossible.

- <Card.Root- role='alertdialog'- elementDescriptor={descriptors.apiKeysRevokeModal}- >+ <Card.Root+ role='alertdialog'+ elementDescriptor={descriptors.apiKeysRevokeModal}+ elementId={descriptors.apiKeysRevokeModal.setId(apiKeyId ?? 'revoke-modal')}+ >

46-55: Make the confirmation check case-insensitive

Users frequently type revoke in lowercase; failing the check feels unnecessarily strict.

-const canSubmit = revokeField.value === 'Revoke';+const canSubmit = revokeField.value.trim().toLowerCase() === 'revoke';
packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (2)

54-56: aria-label not updated when state changes

You already added descriptor metadata to CopySecretButton; while you’re touching this block, consider toggling the aria-label after the copy operation so screen-reader users know the button’s new purpose.

-aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}+aria-label={hasCopied ? 'Copied API key to clipboard' : 'Copy API key'}

(You may instead expose the string through localizationKeys like the rest of the UI.)


98-100: Show key label becomes stale after reveal

When revealed toggles, the button continues to say Show key. Swap the label to Hide key (and localise) for accurate accessibility.

-aria-label={'Show key'}+aria-label={revealed ? 'Hide key' : 'Show key'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3fa15d and b9b994f.

📒 Files selected for processing (8)
  • .changeset/chilly-pears-film.md (1 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (8 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (4 hunks)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts (0 hunks)
  • packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1 hunks)
  • packages/types/src/appearance.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/ApiKeys/useApiKeys.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
packages/clerk-js/src/ui/customizables/elementDescriptors.ts (1)
  • descriptors (545-545)
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 13)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)

589-609: API-keys descriptors correctly wired into ElementsConfig

The new apiKeys* entries are all declared with the proper WithOptions signature (WithOptions<string> for id-based parts, plain WithOptions for the rest) and the naming matches the keys used elsewhere (elementDescriptors.ts, components). No functional issues spotted.

packages/clerk-js/src/ui/components/ApiKeys/CreateApiKeyForm.tsx (2)

100-106: Good: FormContainer is now targettable

Supplying elementDescriptor={descriptors.apiKeysCreateForm} ensures the form container can be themed or queried in tests – nice.


196-202: ```shell
#!/bin/bash

Locate the definition of SubmitButton in Form.tsx to check supported props

rg -n --context 5 "SubmitButton" packages/clerk-js/src/ui/elements/Form.tsx


</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (4)</summary>
`8-18`: **Import keeps file-local barrel pattern consistent**
Including `descriptors` in the barrel import keeps consistency with other pages. Looks good.
---
`94-108`: **Root & header containers now descriptor-enabled**
Adding `elementDescriptor` on the main `<Col>` and header `<Flex>` gives users fine-grained styling hooks – nice improvement.
---
`118-129`: **Search input and “Add” button descriptors**
These are the primary interactive controls; descriptor coverage here is valuable for e2e tests.
---
`144-148`: **Table descriptor wired through**
`ApiKeysTable` now receives `elementDescriptor={descriptors.apiKeysTable}` — make sure `ApiKeysTableProps` includes this optional prop (it was marked optional in the PR description).
</details>
<details>
<summary>.changeset/chilly-pears-film.md (1)</summary>
`1-7`: **Changeset OK**
Version bumps & summary look correct.
</details>
<details>
<summary>packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx (1)</summary>
`99-103`: **`Form.ControlRow` lacks an `elementId`; localisation fallback still hard-coded**
1. As with the modal root, adding an `elementId` would allow tests/themes to target the exact input when several modals are open.
2. The label/placeholder text (`"Revoke"`) remains hard-coded and English-only. There is already a TODO for localisation – consider wiring `localizationKeys` now so this PR is fully i18n-ready.
```diff
- <Form.ControlRow
- elementId={revokeField.id}
- elementDescriptor={descriptors.apiKeysRevokeModalInput}
- >
+ <Form.ControlRow
+ elementId={descriptors.apiKeysRevokeModalInput.setId(revokeField.id)}
+ elementDescriptor={descriptors.apiKeysRevokeModalInput}
+ >

Likely an incorrect or invalid review comment.

packages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx (1)

125-127: Passing a possibly undefinedelementDescriptor is fine—guard inside Table to avoid prop-bleed

If Table spreads incoming props onto a DOM element, undefined is harmless in React but can leak into data- attributes if not filtered. Ensure the Table component strips falsy descriptors internally. No action required here if that guard already exists.

@alexcarpenteralexcarpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I do think we should remove the id usage. There is also a handful of elements with internal only classNames.

}}
elementDescriptor={descriptors.apiKeysHeader}
>
<Box>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box should also include a descriptor here.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks!

Comment threadpackages/clerk-js/src/ui/components/ApiKeys/ApiKeysTable.tsx Outdated
Comment on lines 61 to 62
export const Th = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Th)));
export const Td = makeCustomizable(makeLocalizable(sanitizeDomProps(Primitives.Td)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also include defaultDescriptors for th and td below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

@wobsoriano
wobsoriano enabled auto-merge (squash) June 18, 2025 15:05
@wobsoriano
wobsoriano merged commit b495279 into mainJun 18, 2025
@wobsoriano
wobsoriano deleted the rob/api-keys-element-descriptors branch June 18, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@wobsoriano@alexcarpenter@clerk-cookie@brkalow