Skip to content

Commit

Permalink
Support for React 19
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi6jp committed Dec 30, 2024
1 parent 3e7e8d4 commit e078d61
Showing 20 changed files with 3,702 additions and 7,534 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -43,10 +43,11 @@ To prevent TailwindCSS from purging your styles, add the following line to your

```ts
import type { Config } from "tailwindcss";
import daisyui from "daisyui";

const config: Config = {
content: ["node_modules/rsc-daisyui/dist/**/*.js"],
plugins: [require("daisyui")],
plugins: [daisyui],
};
export default config;
```
2 changes: 1 addition & 1 deletion apps/web/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
36 changes: 21 additions & 15 deletions apps/web/package.json
Original file line number Diff line number Diff line change
@@ -3,31 +3,37 @@
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "^14.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "15.1.3",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-github-btn": "^1.4.0",
"rsc-daisyui": "^1.0.3"
"rsc-daisyui": "^1.0.4"
},
"devDependencies": {
"@next/eslint-plugin-next": "^13.5.6",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^18.19.3",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"autoprefixer": "^10.4.16",
"daisyui": "^4.4.23",
"@next/eslint-plugin-next": "15.1.3",
"@tailwindcss/typography": "^0.5.15",
"@types/node": "^18.19.68",
"@types/react": "19.0.2",
"@types/react-dom": "19.0.2",
"autoprefixer": "^10.4.20",
"daisyui": "^4.12.23",
"eslint-config-custom": "workspace:*",
"postcss": "^8.4.32",
"postcss": "^8.4.49",
"tailwind-config": "workspace:*",
"tailwindcss": "^3.4.0",
"tailwindcss": "^3.4.17",
"tsconfig": "workspace:*",
"typescript": "^5.3.3"
"typescript": "^5.7.2"
},
"pnpm": {
"overrides": {
"@types/react": "19.0.2",
"@types/react-dom": "19.0.2"
}
}
}
6 changes: 3 additions & 3 deletions apps/web/src/app/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import { useRef, useCallback } from "react";
import { useRef, useCallback, type JSX } from "react";
import { Button, Modal } from "rsc-daisyui";

export function Dialog(): JSX.Element {
@@ -15,9 +15,9 @@ export function Dialog(): JSX.Element {
<Button onClick={handleClick}>open modal</Button>
<Modal ref={ref}>
<Modal.Box>
<p className="py-4">
<div className="py-4">
Press ESC key or click the button below to close
</p>
</div>
<Modal.Action>
<Button>Close</Button>
</Modal.Action>
4 changes: 3 additions & 1 deletion apps/web/src/app/info.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"use client";
"use client";;
import GitHubButton from "react-github-btn";

import type { JSX } from "react";

export function Info(): JSX.Element {
return (
<div className="flex gap-2 items-center m-4">
2 changes: 2 additions & 0 deletions apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";

import type { JSX } from "react";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
6 changes: 4 additions & 2 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ import {
import { Dialog } from "./dialog";
import { Info } from "./info";

import type { JSX } from "react";

export default function Page(): JSX.Element {
return (
<main className="m-8">
@@ -66,10 +68,10 @@ export default function Page(): JSX.Element {
</figure>
<Card.Body>
<Card.Title>DaisyUI Card</Card.Title>
<p>
<div>
Rerum reiciendis beatae tenetur excepturi aut pariatur est eos. Sit
sit necessitatibus.
</p>
</div>
</Card.Body>
</Card>
<Divider />
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -11,12 +11,12 @@
"build-storybook": "cd packages/rsc-daisyui && pnpm build-storybook"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"eslint": "^8.56.0",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.9",
"@changesets/cli": "^2.27.11",
"eslint": "^8.57.1",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.5.14",
"tsconfig": "workspace:*",
"turbo": "^2.0.14"
"turbo": "^2.3.3"
},
"packageManager": "pnpm@9.2.0",
"name": "rsc-daisyui"
4 changes: 2 additions & 2 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
"@vercel/style-guide": "^5.0.0",
"eslint-config-turbo": "^1.10.12"
"@vercel/style-guide": "^5.2.0",
"eslint-config-turbo": "^1.13.4"
}
}
1 change: 1 addition & 0 deletions packages/eslint-config-custom/react.js
Original file line number Diff line number Diff line change
@@ -41,5 +41,6 @@ module.exports = {
"react-hooks/rules-of-hooks": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"react/no-array-index-key": "off",
"@typescript-eslint/explicit-function-return-type": "off",
},
};
53 changes: 27 additions & 26 deletions packages/rsc-daisyui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rsc-daisyui",
"main": "./dist/index.js",
"version": "1.0.3",
"version": "1.0.4",
"description": "daisyUI for React Server Component",
"homepage": "https://yoshi6jp.github.io/rsc-daisyui/",
"keywords": [
@@ -44,40 +44,41 @@
"build-storybook": "storybook build"
},
"peerDependencies": {
"react": "^18.2.0"
"react": ">=16.8.0"
},
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@chromatic-com/storybook": "^1",
"@storybook/addon-essentials": "^8.2.9",
"@storybook/addon-interactions": "^8.2.9",
"@storybook/addon-links": "^8.2.9",
"@storybook/addon-onboarding": "^8.2.9",
"@storybook/addon-storysource": "^8.2.9",
"@storybook/blocks": "^8.2.9",
"@storybook/react": "^8.2.9",
"@storybook/react-vite": "^8.2.9",
"@storybook/test": "^8.2.9",
"@tailwindcss/typography": "^0.5.14",
"@changesets/cli": "^2.27.11",
"@chromatic-com/storybook": "^1.9.0",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/addon-links": "^8.4.7",
"@storybook/addon-onboarding": "^8.4.7",
"@storybook/addon-storysource": "^8.4.7",
"@storybook/blocks": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-vite": "^8.4.7",
"@storybook/test": "^8.4.7",
"@tailwindcss/typography": "^0.5.15",
"@tw-classed/core": "^1.7.0",
"@types/react": "^18.3.3",
"@types/react": "^19.0.2",
"autoprefixer": "^10.4.20",
"daisyui": "^4.12.10",
"daisyui": "^4.12.23",
"eslint": "^8.57.1",
"eslint-config-custom": "workspace:*",
"eslint-plugin-storybook": "^0.8.0",
"postcss": "^8.4.41",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"eslint-plugin-storybook": "^0.11.1",
"postcss": "^8.4.49",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-github-btn": "^1.4.0",
"storybook": "^8.2.9",
"storybook": "^8.4.7",
"tailwind-config": "workspace:*",
"tailwindcss": "^3.4.10",
"tailwindcss": "^3.4.17",
"tsconfig": "workspace:*",
"tsup": "^8.2.4",
"typescript": "^5.5.4"
"tsup": "^8.3.5",
"typescript": "^5.7.2"
},
"dependencies": {
"@tw-classed/react": "^1.7.0",
"tailwind-merge": "^2.5.2"
"@tw-classed/react": "^1.8.0",
"tailwind-merge": "^2.6.0"
}
}
2 changes: 1 addition & 1 deletion packages/rsc-daisyui/src/countdown/countdown-item.tsx
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export const CountdownItem = deriveClassed<
>(({ value, ...rest }, ref) => {
const countdownValue = Math.min(99, Math.max(0, value));
const countdownStyle: Record<string, number> = {
["--value"]: countdownValue,
"--value": countdownValue,
};
return <CountdownItemBase {...rest} ref={ref} style={countdownStyle} />;
});
6 changes: 3 additions & 3 deletions packages/rsc-daisyui/src/radial-progress/radial-progress.tsx
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@ export const RadialProgress = deriveClassed<
RadialProgressProps
>(({ children, value, size, thickness, ...rest }, ref) => {
const radialProgressStyle: Record<string, unknown> = {
["--value"]: Math.min(100, Math.max(0, value || 0)),
["--size"]: size,
["--thickness"]: thickness,
"--value": Math.min(100, Math.max(0, value || 0)),
"--size": size,
"--thickness": thickness,
};
return (
<RadialProgressBase
8 changes: 5 additions & 3 deletions packages/rsc-daisyui/src/storybook-helpers/arg-types.ts
Original file line number Diff line number Diff line change
@@ -71,9 +71,11 @@ export function toArgTypes<
([key, item]) => [key, itemToArgTypes(item)] as const
);

const propsArgs = Object.entries(props || {}).map(([key, type]) => {
return [key, propToArgTypes(type)] as const;
});
const propsArgs = Array.from(Object.entries(props || {})).flatMap(
([key, type]) => {
return type ? [[key, propToArgTypes(type)] as const] : [];
}
);
const args = [...configArgs, ...propsArgs];
return Object.fromEntries(args);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import type { ReactNode, JSX } from "react";

export function PreviewLayout({
children,
2 changes: 1 addition & 1 deletion packages/rsc-daisyui/src/textarea/textarea.stories.tsx
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ export const FormControlAndLabels: Story = {
},
render: (args) => {
return (
<FormControl vanilla>
<FormControl>
<Label>
<Label.Text>Your bio</Label.Text>
<Label.TextAlt>Alt label</Label.TextAlt>
5 changes: 3 additions & 2 deletions packages/tailwind-config/package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@
"main": "index.ts",
"types": "index.ts",
"devDependencies": {
"@tailwindcss/typography": "^0.5.10",
"tailwindcss": "^3.2.4"
"@tailwindcss/typography": "^0.5.15",
"daisyui": "^4.12.23",
"tailwindcss": "^3.4.17"
}
}
4 changes: 3 additions & 1 deletion packages/tailwind-config/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { Config } from "tailwindcss";
import typography from "@tailwindcss/typography";
import daisyui from "daisyui";

const config: Config = {
content: [
"./src/**/*.{js,ts,jsx,tsx,mdx}",
"node_modules/rsc-daisyui/dist/**/*.js",
],
plugins: [require("@tailwindcss/typography"), require("daisyui")],
plugins: [typography, daisyui],
daisyui: {
themes: true,
},
2 changes: 1 addition & 1 deletion packages/tsconfig/react-library.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"lib": ["ES2015", "DOM"],
"lib": ["ES2020", "DOM"],
"module": "ESNext",
"target": "ES6",
"jsx": "react-jsx",
Loading

0 comments on commit e078d61

Please sign in to comment.