Skip to content

Commit fb37054

Browse files
committed
chore(clerk-js,clerk-react): Share createContextAndHook
1 parent 262499e commit fb37054

21 files changed

Lines changed: 31 additions & 46 deletions

packages/clerk-js/src/ui/customizables/AppearanceContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { createContextAndHook } from '@clerk/shared';
12
import React from 'react';
23

34
import { useDeepEqualMemo } from '../hooks';
4-
import { createContextAndHook } from '../utils';
55
import { AppearanceCascade, parseAppearance, ParsedAppearance } from './parseAppearance';
66

77
type AppearanceContextValue = ParsedAppearance;

packages/clerk-js/src/ui/elements/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { Button, descriptors, Flex, Form as FormPrim, localizationKeys } from '../customizables';
44
import { useLoadingStatus } from '../hooks';
55
import { PropsOfComponent } from '../styledSystem';
6-
import { createContextAndHook } from '../utils';
6+
import { createContextAndHook } from '@clerk/shared';
77
import { useCardState } from './contexts';
88
import { FormControl } from './FormControl';
99

packages/clerk-js/src/ui/elements/Menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { cloneElement, isValidElement, PropsWithChildren, useEffect, useRef } from 'react';
22

3-
import { createContextAndHook } from '../../ui/utils';
3+
import { createContextAndHook } from '@clerk/shared';
44
import { Button, Col } from '../customizables';
55
import { usePopover, UsePopoverReturn } from '../hooks';
66
import { animations, PropsOfComponent } from '../styledSystem';

packages/clerk-js/src/ui/elements/Navbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { createContextAndHook } from '@clerk/shared';
12
import React from 'react';
23

34
import { useNavigateToFlowStart } from '../components/UserProfile/NavigateToFlowStartButton';
@@ -15,7 +16,7 @@ import { ElementDescriptor, ElementId } from '../customizables/elementDescriptor
1516
import { useNavigate, usePopover, useSafeLayoutEffect } from '../hooks';
1617
import { Menu } from '../icons';
1718
import { animations, mqu, PropsOfComponent } from '../styledSystem';
18-
import { colors, createContextAndHook } from '../utils';
19+
import { colors } from '../utils';
1920

2021
type NavbarContextValue = { isOpen: boolean; open: () => void; close: () => void };
2122
export const [NavbarContext, useNavbarContext] = createContextAndHook<NavbarContextValue>('NavbarContext');

packages/clerk-js/src/ui/elements/Select.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React, { isValidElement, PropsWithChildren, useState } from 'react';
1+
import { createContextAndHook } from '@clerk/shared';
2+
import React, { PropsWithChildren, useState } from 'react';
23

34
import { usePopover, useSearchInput } from '../../ui/hooks';
45
import { Button, Flex, Icon, Text } from '../customizables';
56
import { Caret, MagnifyingGlass } from '../icons';
67
import { animations, common, PropsOfComponent, ThemableCssProp } from '../styledSystem';
7-
import { colors, createContextAndHook } from '../utils';
8+
import { colors } from '../utils';
89
import { InputWithIcon } from './InputWithIcon';
910

1011
type UsePopoverReturn = ReturnType<typeof usePopover>;

packages/clerk-js/src/ui/elements/Tabs.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { createContextAndHook } from '@clerk/shared';
12
import React from 'react';
23

34
import { Button, Col, Flex } from '../customizables';
45
import { PropsOfComponent } from '../styledSystem';
5-
import { createContextAndHook, getValidChildren } from '../utils';
6+
import { getValidChildren } from '../utils';
67

78
type TabsContextValue = {
89
selectedIndex: number;

packages/clerk-js/src/ui/elements/contexts/CardStateContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { createContextAndHook } from '@clerk/shared';
12
import { ClerkAPIError } from '@clerk/types';
23
import React from 'react';
34

45
import { useLocalizations } from '../../customizables';
56
import { useSafeState } from '../../hooks';
6-
import { createContextAndHook } from '../../utils';
77

88
type Status = 'idle' | 'loading' | 'error';
99
type Metadata = string | undefined;

packages/clerk-js/src/ui/elements/contexts/FlowMetadataContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { createContextAndHook } from '../../utils';
3+
import { createContextAndHook } from '@clerk/shared';
44

55
type FlowMetadata = {
66
flow: 'signIn' | 'signUp' | 'userButton' | 'userProfile' | 'organizationProfile' | 'organizationSwitcher';

packages/clerk-js/src/ui/primitives/hooks/useFormControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { createContextAndHook } from '../../utils';
3+
import { createContextAndHook } from '@clerk/shared';
44

55
export type FormControlProps = {
66
/**

packages/clerk-js/src/ui/utils/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from './fromEntries';
22
export * from './containsAllOf';
3-
export * from './createContextAndHook';
43
export * from './createInfiniteAccessProxy';
54
export * from './fastDeepMerge';
65
export * from './colors';

0 commit comments

Comments
 (0)