From 53c333829456de576af49f6e06153e70070f7912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D5=A1=D3=84=D5=A1?= Date: Sat, 30 Nov 2024 02:35:34 +0800 Subject: [PATCH] fix(docs): typecheck errors (#4171) * fix(docs): remove duplicate import * fix(docs): update type for onChange in range-calendar page * fix(docs): add missing `@react-types/calendar` * fix(docs): broken syntax * fix(docs): typecheck issues * fix(docs): add missing `@react-types/datepicker` * fix(docs): typecheck issues --- .../components/docs/components/codeblock.tsx | 2 +- .../components/alert/custom-styles.raw.tsx | 103 ++++++++---------- .../autocomplete/async-loading-items.raw.tsx | 3 + .../autocomplete/fully-controlled.raw.tsx | 2 +- .../content/components/modal/overflow.raw.tsx | 5 +- .../range-calendar/controlled.raw.tsx | 2 +- .../range-calendar/invalid-date.raw.tsx | 5 +- .../components/range-calendar/presets.raw.tsx | 2 +- .../select/async-loading-items.raw.tsx | 1 + .../select/custom-render-value.raw.tsx | 8 +- .../docs/components/range-calendar.mdx | 6 +- apps/docs/package.json | 2 + .../stories/range-calendar.stories.tsx | 2 +- pnpm-lock.yaml | 6 + 14 files changed, 78 insertions(+), 71 deletions(-) diff --git a/apps/docs/components/docs/components/codeblock.tsx b/apps/docs/components/docs/components/codeblock.tsx index 57bd680f7e..e68b99f943 100644 --- a/apps/docs/components/docs/components/codeblock.tsx +++ b/apps/docs/components/docs/components/codeblock.tsx @@ -3,7 +3,7 @@ import type {TransformTokensTypes} from "./helper"; import React, {forwardRef, useEffect} from "react"; import {clsx, dataAttr, getUniqueID} from "@nextui-org/shared-utils"; -import BaseHighlight, {Language, PrismTheme, defaultProps} from "prism-react-renderer"; +import BaseHighlight, {defaultProps} from "prism-react-renderer"; import {debounce, omit} from "@nextui-org/shared-utils"; import {cn} from "@nextui-org/react"; diff --git a/apps/docs/content/components/alert/custom-styles.raw.tsx b/apps/docs/content/components/alert/custom-styles.raw.tsx index 9056bf91c8..6ef55f3ea8 100644 --- a/apps/docs/content/components/alert/custom-styles.raw.tsx +++ b/apps/docs/content/components/alert/custom-styles.raw.tsx @@ -3,65 +3,58 @@ import type {AlertProps} from "@nextui-org/react"; import React from "react"; import {Alert, Button, cn} from "@nextui-org/react"; -const CustomAlert = React.forwardRef( - ( - {title, children, variant = "faded", color = "secondary", className, classNames, ...props}, - ref, - ) => { - const colorClass = React.useMemo(() => { - switch (color) { - case "default": - return "before:bg-default-300"; - case "primary": - return "before:bg-primary"; - case "secondary": - return "before:bg-secondary"; - case "success": - return "before:bg-success"; - case "warning": - return "before:bg-warning"; - case "danger": - return "before:bg-danger"; - default: - return "before:bg-default-200"; - } - }, []); +const CustomAlert = ({children, variant, color, className, classNames, ...props}: AlertProps) => { + const colorClass = React.useMemo(() => { + switch (color) { + case "default": + return "before:bg-default-300"; + case "primary": + return "before:bg-primary"; + case "secondary": + return "before:bg-secondary"; + case "success": + return "before:bg-success"; + case "warning": + return "before:bg-warning"; + case "danger": + return "before:bg-danger"; + default: + return "before:bg-default-200"; + } + }, []); - return ( - - {children} - - ); - }, -); + return ( + + {children} + + ); +}; CustomAlert.displayName = "CustomAlert"; export default function App() { - const colors = ["default", "primary", "secondary", "success", "warning", "danger"]; + const colors = ["default", "primary", "secondary", "success", "warning", "danger"] as any; return (
@@ -69,7 +62,7 @@ export default function App() {