Skip to content

Commit

Permalink
Merge pull request #142 from omnifed/141-bug-update-react-styled-syst…
Browse files Browse the repository at this point in the history
…em-paths

fix(react): use .mjs styled-system imports
  • Loading branch information
caseybaggz committed Jun 5, 2024
2 parents 1ab8194 + c9b4bae commit 9f7b133
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
15 changes: 8 additions & 7 deletions docs/app/preset/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ const poppins = Poppins({
})
```

### Using the Cerberus React package (Not JSR compatible yet)
### Using Cerberus React (Not JSR compatible yet)

If you are interested in using the Cerberus React, install it now:

```bash
pnpm add @cerberus-design/react
```

### Using the Cerberus Icons package (optional)
### Using the Cerberus Icons (optional)

If you are interested in using the Cerberus Icons, install it now:

Expand All @@ -113,7 +113,7 @@ To help make maintaining a breeze, add this new script to your `package.json` to

```json title="package.json"
"scripts": {
"up:cerberus": "pnpm up @cerberus-design/{react} && pnpm dlx jsr add @cerberus/{panda-preset,styled-system,icons}"
"up:cerberus": "pnpm up @cerberus-design/react@latest && pnpm dlx jsr add @cerberus/{panda-preset,styled-system,icons}@latest"
}
```

Expand All @@ -140,24 +140,25 @@ This will map the JSR styled-system to the NPM expected location.
### Step 2 - Add a `global.d.ts` file

```ts title="global.d.ts"
declare module '@cerberus/styled-system/css' {
declare module '@cerberus/styled-system/css/index.mjs' {
export * from '@cerberus-design/styled-system/css'
}

declare module '@cerberus/styled-system/recipes' {
declare module '@cerberus/styled-system/recipes/index.mjs' {
export * from '@cerberus-design/styled-system/recipes'
}

declare module '@cerberus/styled-system/types' {
export * from '@cerberus-design/styled-system/types'
}

declare module '@cerberus/styled-system/utils' {
declare module '@cerberus/styled-system/utils/index.mjs' {
export * from '@cerberus-design/styled-system/utils'
}

declare module '@cerberus/styled-system/patterns' {
declare module '@cerberus/styled-system/patterns/index.mjs' {
export * from '@cerberus-design/styled-system/patterns'
}

```
This will map the JSR styled-system to the NPM expected location.
4 changes: 2 additions & 2 deletions packages/react/src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ButtonHTMLAttributes } from 'react'
import { cx } from '@cerberus/styled-system/css'
import { button } from '@cerberus/styled-system/recipes'
import { cx } from '@cerberus/styled-system/css/index.mjs'
import { button } from '@cerberus/styled-system/recipes/index.mjs'

/**
* This module contains the Button component.
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ButtonHTMLAttributes } from 'react'
import { cx } from '@cerberus/styled-system/css'
import { iconButton } from '@cerberus/styled-system/recipes'
import { cx } from '@cerberus/styled-system/css/index.mjs'
import { iconButton } from '@cerberus/styled-system/recipes/index.mjs'
import type { ButtonProps } from './Button'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/NavMenuLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AnchorHTMLAttributes, ElementType } from 'react'
import { css, cx } from '@cerberus/styled-system/css/index.mjs'
import { Show } from './Show'
import { css, cx } from '@cerberus/styled-system/css'

export interface NavMenuLinkProps
extends AnchorHTMLAttributes<HTMLAnchorElement> {
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/NavMenuList.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use client'

import { useMemo, type HTMLAttributes } from 'react'
import { cx } from '@cerberus/styled-system/css/index.mjs'
import { vstack } from '@cerberus/styled-system/patterns/index.mjs'
import { useNavMenuContext } from '../context/navMenu'
import { Show } from './Show'
import type { Positions } from '../types'
import { cx } from '@cerberus/styled-system/css'
import { vstack } from '@cerberus/styled-system/patterns'
import { Show } from './Show'

interface GetPositionResult {
left: string
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/components/NavMenuTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
type ElementType,
type MouseEvent,
} from 'react'
import { cx } from '@cerberus/styled-system/css'
import { button } from '@cerberus/styled-system/recipes'
import { cx } from '@cerberus/styled-system/css/index.mjs'
import { button } from '@cerberus/styled-system/recipes/index.mjs'
import {
createNavTriggerProps,
type NavTriggerAriaValues,
} from '../aria-helpers/nav-menu.aria'
import { Show } from './Show'
import type { ButtonProps } from './Button'
import { useNavMenuContext } from '../context/navMenu'
import type { ButtonProps } from './Button'
import { Show } from './Show'

export interface NavMenuTriggerProps
extends ButtonHTMLAttributes<HTMLButtonElement>,
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
declare module '@cerberus/styled-system/css' {
declare module '@cerberus/styled-system/css/index.mjs' {
export * from '@cerberus-design/styled-system/css'
}

declare module '@cerberus/styled-system/recipes' {
declare module '@cerberus/styled-system/recipes/index.mjs' {
export * from '@cerberus-design/styled-system/recipes'
}

declare module '@cerberus/styled-system/types' {
export * from '@cerberus-design/styled-system/types'
}

declare module '@cerberus/styled-system/utils' {
declare module '@cerberus/styled-system/utils/index.mjs' {
export * from '@cerberus-design/styled-system/utils'
}

declare module '@cerberus/styled-system/patterns' {
declare module '@cerberus/styled-system/patterns/index.mjs' {
export * from '@cerberus-design/styled-system/patterns'
}

0 comments on commit 9f7b133

Please sign in to comment.