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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/mosaic-component-props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Comment on lines +1 to +2

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== changeset file =="
cat -n .changeset/mosaic-component-props.md || true

echo
echo "== changeset files =="
find .changeset -maxdepth 1 -type f -print | sort | sed -n '1,80p'

echo
echo "== package manifests mentioning `@clerk/ui` / packages/ui =="
rg -n '"`@clerk/ui`"|packages/ui|`@clerk/ui`' package.json packages .changeset --glob '!pnpm-lock.yaml' --glob '!node_modules/**' | sed -n '1,200p'

echo
echo "== recent diff stat =="
git diff --stat HEAD~1 HEAD || true

Repository: clerk/javascript

Length of output: 26894


Make the changeset intentional.

.changeset/mosaic-component-props.md only has empty Changeset delimiters, so it does not version or document @clerk/ui. Add the appropriate package entry/release note for the public Mosaic prop type changes, or remove the no-op file if this change is intentionally excluded from the release.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/mosaic-component-props.md around lines 1 - 2, Make
.changeset/mosaic-component-props.md intentional: either add the appropriate
`@clerk/ui` package entry and release note describing the public Mosaic prop type
changes, or remove the empty changeset file when this change should not be
released.

Source: Coding guidelines

6 changes: 3 additions & 3 deletions packages/ui/src/mosaic/components/badge/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { type ComponentProps, type RenderProp, useRender } from '@clerk/headless/utils';
import { useRender } from '@clerk/headless/utils';
import * as stylex from '@stylexjs/stylex';
import React from 'react';

import type { MosaicComponentProps } from '../../props';
import { mergeStyleProps, themeProps } from '../../props';
import { colors, styles } from './badge.styles';

export type BadgeProps = Omit<ComponentProps<'span'>, 'render'> & {
export type BadgeProps = MosaicComponentProps<'span'> & {
color?: 'primary' | 'neutral' | 'warning' | 'negative' | 'positive';
render?: RenderProp<React.ComponentPropsWithRef<'span'>> | React.ReactElement;
};

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/ui/src/mosaic/components/heading/heading.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import type { RenderPropOrElement } from '@clerk/headless/utils';
import { useRender } from '@clerk/headless/utils';
import * as stylex from '@stylexjs/stylex';
import React from 'react';

import type { MosaicComponentProps } from '../../props';
import { mergeStyleProps, themeProps } from '../../props';
import { useContextProps } from '../../utils/context';
import type { TypographyColor, TypographySize } from '../typography.styles';
import { colors, sizes } from '../typography.styles';
import { styles } from './heading.styles';

// `color` replaces the legacy HTML `color` attribute, whose `string` type would widen the variant.
export interface HeadingProps extends Omit<React.ComponentPropsWithRef<'h2'>, 'color'> {
export interface HeadingProps extends MosaicComponentProps<'h2'> {
size?: TypographySize;
color?: TypographyColor;
render?: RenderPropOrElement<'h2'>;
}

export const HeadingContext = React.createContext<Partial<HeadingProps> | null>(null);
Expand Down
6 changes: 2 additions & 4 deletions packages/ui/src/mosaic/components/text/text.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import type { RenderPropOrElement } from '@clerk/headless/utils';
import { useRender } from '@clerk/headless/utils';
import * as stylex from '@stylexjs/stylex';
import React from 'react';

import type { MosaicComponentProps } from '../../props';
import { mergeStyleProps, themeProps } from '../../props';
import { useContextProps } from '../../utils/context';
import type { TypographyColor, TypographySize } from '../typography.styles';
import { colors, sizes } from '../typography.styles';

// `color` replaces the legacy HTML `color` attribute, whose `string` type would widen the variant.
export interface TextProps extends Omit<React.ComponentPropsWithRef<'p'>, 'color'> {
export interface TextProps extends MosaicComponentProps<'p'> {
size?: TypographySize;
color?: TypographyColor;
render?: RenderPropOrElement<'p'>;
}

export const TextContext = React.createContext<Partial<TextProps> | null>(null);
Expand Down
16 changes: 16 additions & 0 deletions packages/ui/src/mosaic/props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import type { RenderPropOrElement } from '@clerk/headless/utils';
import type React from 'react';

/**
* The base props every Mosaic component accepts: the native props for its default
* tag, plus the `render` escape hatch that swaps the rendered element.
*
* `color` is omitted because it is a non-standard HTML attribute typed `string`,
* which would widen any component that exposes `color` as a variant. Omitting it
* here rather than per component means a new component inherits the narrowing.
*/
export type MosaicComponentProps<Tag extends keyof React.JSX.IntrinsicElements> = Omit<
React.ComponentPropsWithRef<Tag>,
'color'
> & {
render?: RenderPropOrElement<Tag>;
};

// The public styling contract, emitted onto a component's root element:
// 1. `--cl-*` vars — from `tokens.stylex.ts` (`:root { --cl-color-primary: … }`)
// 2. `.cl-<slot>` class — from `themeProps` (`.cl-button { … }`)
Expand Down
Loading