Skip to content

Commit

Permalink
fix(elements): Remove "use client" and mark packages as client-only i…
Browse files Browse the repository at this point in the history
…nstead (#3014)

* chore(elements): Add package

* fix(elements): Remove directives, add import to entrypoints

* chore(elements): Bump version
  • Loading branch information
LekoArts authored Mar 20, 2024
1 parent e4c0ae0 commit 1a6937b
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .changeset/real-flowers-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/elements/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clerk/elements",
"version": "0.1.24",
"version": "0.1.25",
"description": "Clerk Elements",
"keywords": [
"clerk",
Expand Down Expand Up @@ -72,6 +72,7 @@
"@radix-ui/react-slot": "^1.0.2",
"@statelyai/inspect": "^0.1.0",
"@xstate/react": "^4.1.0",
"client-only": "^0.0.1",
"xstate": "^5.7.1"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions packages/elements/src/react/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Mark as a client-only package. This will error if you try to import it in a React Server Component.
import 'client-only';

export { Field, FieldError, FieldState, GlobalError, Input, Label, Submit } from '~/react/common/form';
export { ProviderIcon } from '~/react/common/providers';

Expand Down
1 change: 0 additions & 1 deletion packages/elements/src/react/router/react.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use client';
import { createContext, useContext } from 'react';

import type { ClerkHostRouter, ClerkRouter } from './router';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-in/choose-strategy.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { SignInFactor, SignInFirstFactor, SignInStrategy as TSignInStrategy } from '@clerk/types';
import { Slot } from '@radix-ui/react-slot';
import { useSelector } from '@xstate/react';
Expand Down
3 changes: 2 additions & 1 deletion packages/elements/src/react/sign-in/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use client';
// Mark as a client-only package. This will error if you try to import it in a React Server Component.
import 'client-only';

import { SignInRouterCtx } from './context';

Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-in/navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { Slot } from '@radix-ui/react-slot';
import * as React from 'react';

Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-in/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { OAuthProvider, Web3Provider } from '@clerk/types';

import type { ProviderProps } from '~/react/common/providers';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-in/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { ClerkLoaded, useClerk } from '@clerk/clerk-react';
import { useEffect } from 'react';
import { createActor } from 'xstate';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-in/start.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { TSignInStartMachine } from '~/internals/machines/sign-in/machines';
import { SignInStartMachine } from '~/internals/machines/sign-in/machines';
import type { FormProps } from '~/react/common/form';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-in/verifications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { SignInStrategy as ClerkSignInStrategy } from '@clerk/types';
import { useSelector } from '@xstate/react';
import { useCallback } from 'react';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-up/continue.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { SignUpContinueMachine, type TSignUpContinueMachine } from '~/internals/machines/sign-up/machines';
import type { FormProps } from '~/react/common/form';
import { Form } from '~/react/common/form';
Expand Down
3 changes: 2 additions & 1 deletion packages/elements/src/react/sign-up/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use client';
// Mark as a client-only package. This will error if you try to import it in a React Server Component.
import 'client-only';

import { SignUpRouterCtx } from '~/react/sign-up/context';

Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-up/navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { Slot } from '@radix-ui/react-slot';
import * as React from 'react';

Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-up/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { OAuthProvider, Web3Provider } from '@clerk/types';

import type { ProviderProps } from '~/react/common/providers';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-up/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { ClerkLoaded, useClerk } from '@clerk/clerk-react';
import { useSelector } from '@xstate/react';
import { useEffect } from 'react';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-up/start.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { TSignUpStartMachine } from '~/internals/machines/sign-up/machines';
import { SignUpStartMachine } from '~/internals/machines/sign-up/machines';
import type { FormProps } from '~/react/common/form';
Expand Down
2 changes: 0 additions & 2 deletions packages/elements/src/react/sign-up/verifications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import type { TSignUpVerificationMachine } from '~/internals/machines/sign-up/machines';
import { SignUpVerificationMachine } from '~/internals/machines/sign-up/machines';
import type { SignUpVerificationFriendlyTags, SignUpVerificationTags } from '~/internals/machines/sign-up/types';
Expand Down

0 comments on commit 1a6937b

Please sign in to comment.