Skip to content

Commit

Permalink
chore: manual fixes and other dep updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chanceaclark committed Dec 9, 2024
1 parent 7e8eb3c commit a2052bc
Show file tree
Hide file tree
Showing 18 changed files with 586 additions and 685 deletions.
20 changes: 14 additions & 6 deletions core/components/link/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { useLocale } from 'next-intl';
import { ComponentPropsWithRef, ElementRef, forwardRef, useReducer } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef, useReducer } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -26,7 +26,7 @@ type Props = NextLinkProps & PrefetchOptions;
* prefetch behavior and 'auto' for prefetch kind. This approach provides a balance between optimizing
* page load performance and resource usage. https://nextjs.org/docs/app/api-reference/components/link#prefetch
*/
export const Link = forwardRef<ElementRef<'a'>, Props>(
export const Link = forwardRef<ComponentRef<'a'>, Props>(
(
{ href, prefetch = 'hover', prefetchKind = 'auto', children, className, locale, ...rest },
ref,
Expand All @@ -42,10 +42,18 @@ export const Link = forwardRef<ElementRef<'a'>, Props>(
return;
}

// PrefetchKind enum is not exported
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
router.prefetch(String(href), { kind: prefetchKind });
if (typeof href === 'string') {
// PrefetchKind enum is not exported
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
router.prefetch(String(href), { kind: prefetchKind });
} else {
// PrefetchKind enum is not exported
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
router.prefetch(href.href, { kind: prefetchKind });
}

setPrefetched();
};

Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/button/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Slot } from '@radix-ui/react-slot';
import { Loader2 as Spinner } from 'lucide-react';
import { ComponentPropsWithRef, ElementRef, forwardRef } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -11,7 +11,7 @@ interface Props extends ComponentPropsWithRef<'button'> {
variant?: 'primary' | 'secondary' | 'subtle';
}

const Button = forwardRef<ElementRef<'button'>, Props>(
const Button = forwardRef<ComponentRef<'button'>, Props>(
(
{
asChild = false,
Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
import { Check } from 'lucide-react';
import { ComponentPropsWithRef, ElementRef, forwardRef } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef } from 'react';

import { cn } from '~/lib/utils';

interface Props extends ComponentPropsWithRef<typeof CheckboxPrimitive.Root> {
error?: boolean;
}

const Checkbox = forwardRef<ElementRef<typeof CheckboxPrimitive.Root>, Props>(
const Checkbox = forwardRef<ComponentRef<typeof CheckboxPrimitive.Root>, Props>(
({ className, defaultChecked, error = false, onCheckedChange, ...props }, ref) => {
return (
<CheckboxPrimitive.Root
Expand Down
6 changes: 3 additions & 3 deletions core/components/ui/form/counter/counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChevronDown, ChevronUp } from 'lucide-react';
import { useTranslations } from 'next-intl';
import {
ComponentPropsWithRef,
ElementRef,
ComponentRef,
forwardRef,
useImperativeHandle,
useRef,
Expand Down Expand Up @@ -34,9 +34,9 @@ const getDefaultValue = (defaultValue: number | '', min: number, max: number) =>
return defaultValue;
};

type CounterRef = ElementRef<'input'> | null;
type CounterRef = ComponentRef<'input'> | null;

const Counter = forwardRef<ElementRef<'input'>, Props>(
const Counter = forwardRef<ComponentRef<'input'>, Props>(
(
{
children,
Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
import {
ComponentPropsWithoutRef,
ComponentPropsWithRef,
ElementRef,
ComponentRef,
forwardRef,
useState,
} from 'react';
Expand Down Expand Up @@ -52,7 +52,7 @@ interface Props extends Omit<ComponentPropsWithRef<'input'>, 'defaultValue' | 'o
disabledDays?: DayPickerSingleProps['disabled'];
}

const DatePicker = forwardRef<ElementRef<'input'>, Props>(
const DatePicker = forwardRef<ComponentRef<'input'>, Props>(
(
{
defaultValue,
Expand Down
18 changes: 8 additions & 10 deletions core/components/ui/form/form.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as FormPrimitive from '@radix-ui/react-form';
import { ComponentPropsWithRef, ElementRef, forwardRef } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -21,12 +21,10 @@ type ValidationFunction =
| ((value: string, formData: FormData) => boolean)
| ((value: string, formData: FormData) => Promise<boolean>);
type ControlValidationPatterns = ValidationPattern | ValidationFunction;
type BuiltInValidityState = {
[pattern in ValidationPattern]: boolean;
};
type BuiltInValidityState = Record<ValidationPattern, boolean>;

const Form = forwardRef<
ElementRef<typeof FormPrimitive.Root>,
ComponentRef<typeof FormPrimitive.Root>,
ComponentPropsWithRef<typeof FormPrimitive.Root>
>(({ className, ...props }, ref) => (
<FormPrimitive.Root className={cn('text-base', className)} ref={ref} {...props} />
Expand All @@ -35,7 +33,7 @@ const Form = forwardRef<
Form.displayName = FormPrimitive.Form.displayName;

const Field = forwardRef<
ElementRef<typeof FormPrimitive.Field>,
ComponentRef<typeof FormPrimitive.Field>,
ComponentPropsWithRef<typeof FormPrimitive.Field>
>(({ className, children, ...props }, ref) => (
<FormPrimitive.Field className={cn(className)} ref={ref} {...props}>
Expand All @@ -46,7 +44,7 @@ const Field = forwardRef<
Field.displayName = 'Field';

const FieldMessage = forwardRef<
ElementRef<typeof FormPrimitive.Message>,
ComponentRef<typeof FormPrimitive.Message>,
ComponentPropsWithRef<typeof FormPrimitive.Message>
>(({ className, children, ...props }, ref) => (
<FormPrimitive.Message className={cn(className)} ref={ref} {...props}>
Expand All @@ -60,7 +58,7 @@ interface FieldLabelProps extends ComponentPropsWithRef<typeof Label> {
isRequired?: boolean;
}

const FieldLabel = forwardRef<ElementRef<typeof Label>, FieldLabelProps>(
const FieldLabel = forwardRef<ComponentRef<typeof Label>, FieldLabelProps>(
({ className, children, isRequired, ...props }, ref) => (
<Label
className={cn('inline-flex w-full items-center justify-between', className)}
Expand All @@ -78,7 +76,7 @@ const FieldLabel = forwardRef<ElementRef<typeof Label>, FieldLabelProps>(
FieldLabel.displayName = 'FieldLabel';

const FieldControl = forwardRef<
ElementRef<typeof FormPrimitive.Control>,
ComponentRef<typeof FormPrimitive.Control>,
ComponentPropsWithRef<typeof FormPrimitive.Control>
>(({ className, children, ...props }, ref) => (
<FormPrimitive.Control className={cn(className)} ref={ref} {...props}>
Expand All @@ -89,7 +87,7 @@ const FieldControl = forwardRef<
FieldControl.displayName = 'FieldControl';

const FormSubmit = forwardRef<
ElementRef<typeof FormPrimitive.Submit>,
ComponentRef<typeof FormPrimitive.Submit>,
ComponentPropsWithRef<typeof FormPrimitive.Submit>
>(({ className, children, ...props }, ref) => (
<FormPrimitive.Submit className={cn(className)} ref={ref} {...props}>
Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/input/input.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AlertCircle } from 'lucide-react';
import { ComponentPropsWithRef, ElementRef, forwardRef, ReactNode } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef, ReactNode } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -8,7 +8,7 @@ interface Props extends ComponentPropsWithRef<'input'> {
icon?: ReactNode;
}

const Input = forwardRef<ElementRef<'input'>, Props>(
const Input = forwardRef<ComponentRef<'input'>, Props>(
({ className, children, error = false, icon, type = 'text', ...props }, ref) => (
<div className={cn('relative', className)}>
<input
Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/pick-list/pick-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
import { ComponentPropsWithRef, ElementRef, forwardRef, useId } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef, useId } from 'react';

import { Image } from '~/components/image';
import { cn } from '~/lib/utils';
Expand All @@ -23,7 +23,7 @@ interface Props extends ComponentPropsWithRef<typeof RadioGroupPrimitive.Root> {
items: Item[];
}

const PickList = forwardRef<ElementRef<typeof RadioGroupPrimitive.Root>, Props>(
const PickList = forwardRef<ComponentRef<typeof RadioGroupPrimitive.Root>, Props>(
({ children, error = false, items, className, ...props }, ref) => {
const id = useId();

Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/rectangle-list/rectangle-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
import { ComponentPropsWithRef, ElementRef, forwardRef, useId } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef, useId } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -13,7 +13,7 @@ interface Props extends ComponentPropsWithRef<typeof RadioGroupPrimitive.Root> {
items: Item[];
}

const RectangleList = forwardRef<ElementRef<typeof RadioGroupPrimitive.Root>, Props>(
const RectangleList = forwardRef<ComponentRef<typeof RadioGroupPrimitive.Root>, Props>(
({ children, className, error = false, items, ...props }, ref) => {
const id = useId();

Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/select/select.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as SelectPrimitive from '@radix-ui/react-select';
import { Check, ChevronDown, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
import { ComponentPropsWithRef, ElementRef, forwardRef, ReactNode, useId } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef, ReactNode, useId } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -17,7 +17,7 @@ interface Props extends ComponentPropsWithRef<typeof SelectPrimitive.Root> {
placeholder?: string | ReactNode;
}

const Select = forwardRef<ElementRef<typeof SelectPrimitive.Trigger>, Props>(
const Select = forwardRef<ComponentRef<typeof SelectPrimitive.Trigger>, Props>(
({ children, id: triggerId, label, options, placeholder, error = false, ...props }, ref) => {
const id = useId();

Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/swatch/swatch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
import { ComponentPropsWithRef, ElementRef, forwardRef, useId } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef, useId } from 'react';

import { cn } from '~/lib/utils';

Expand All @@ -14,7 +14,7 @@ interface Props extends ComponentPropsWithRef<typeof RadioGroupPrimitive.Root> {
swatches: Swatch[];
}

const Swatch = forwardRef<ElementRef<typeof RadioGroupPrimitive.Root>, Props>(
const Swatch = forwardRef<ComponentRef<typeof RadioGroupPrimitive.Root>, Props>(
({ children, className, error = false, swatches, ...props }, ref) => {
const id = useId();

Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/form/text-area/text-area.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ComponentPropsWithRef, ElementRef, forwardRef } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef } from 'react';

import { cn } from '~/lib/utils';

interface Props extends ComponentPropsWithRef<'textarea'> {
error?: boolean;
}

const TextArea = forwardRef<ElementRef<'textarea'>, Props>(
const TextArea = forwardRef<ComponentRef<'textarea'>, Props>(
({ className, error = false, ...props }, ref) => {
return (
<textarea
Expand Down
4 changes: 2 additions & 2 deletions core/components/ui/header/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Search, Loader2 as Spinner, X } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { ComponentPropsWithRef, ElementRef, forwardRef } from 'react';
import { ComponentPropsWithRef, ComponentRef, forwardRef } from 'react';

import { Button } from '../button';

Expand All @@ -13,7 +13,7 @@ interface Props extends ComponentPropsWithRef<'input'> {
showClear?: boolean;
}

export const Input = forwardRef<ElementRef<'input'>, Props>(
export const Input = forwardRef<ComponentRef<'input'>, Props>(
({ className, pending, showClear, onClickClear, ...props }, ref) => {
const t = useTranslations('Components.Header');

Expand Down
2 changes: 1 addition & 1 deletion core/lib/bodl/bodl-events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ declare module '@bigcommerce/bodl-events' {
private eventEmitter;
private historyManager?;
private updateBodl;
constructor(eventEmitter: EventEmitter, historyManager?: HistoryManager | undefined);
constructor(eventEmitter: EventEmitter, historyManager?: HistoryManager);
emit(eventName: string, payload: BoldEventPayload): boolean;
on(eventName: string, callback: (payload: BoldEventPayload) => void): this;
off(eventName: string, callback: (payload: BoldEventPayload) => void): this;
Expand Down
1 change: 0 additions & 1 deletion core/lib/kv/adapters/bc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Kv {
return value;
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
async mget<T extends unknown[]>(keys: string[]): Promise<{ [K in keyof T]: T[K] | null }> {
const normalizedKeys = Array.isArray(keys) ? keys : [keys];

Expand Down
8 changes: 4 additions & 4 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"next": "15.0.4",
"next-auth": "5.0.0-beta.25",
"next-intl": "^3.26.0",
"react": "19.0.0-rc-5c56b873-20241107",
"react": "^19.0.0",
"react-day-picker": "^8.10.0",
"react-dom": "19.0.0-rc-5c56b873-20241107",
"react-dom": "^19.0.0",
"react-google-recaptcha": "^3.1.0",
"react-hook-form": "^7.54.0",
"react-hot-toast": "^2.4.1",
Expand All @@ -71,8 +71,8 @@
"@types/gtag.js": "^0.0.20",
"@types/lodash.debounce": "^4.0.9",
"@types/node": "^20.17.9",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.1",
"@types/react-google-recaptcha": "^2.1.9",
"@types/uuid": "^10.0.0",
"autoprefixer": "^10.4.20",
Expand Down
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "MIT",
"version": "0.1.0",
"private": true,
"packageManager": "pnpm@9.7.0",
"packageManager": "pnpm@9.15.0",
"scripts": {
"dev": "dotenv -e .env.local -- turbo run dev",
"build": "dotenv -e .env.local -- turbo run build",
Expand All @@ -25,11 +25,5 @@
"dotenv-cli": "^7.4.4",
"turbo": "^2.3.3",
"typescript": "^5.7.2"
},
"pnpm": {
"overrides": {
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]"
}
}
}
Loading

0 comments on commit a2052bc

Please sign in to comment.