diff --git a/.changeset/angry-maps-serve.md b/.changeset/angry-maps-serve.md new file mode 100644 index 0000000000..2bfc7db03c --- /dev/null +++ b/.changeset/angry-maps-serve.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/theme": patch +--- + +move circular-progress tv to progress diff --git a/packages/core/theme/src/components/circular-progress.ts b/packages/core/theme/src/components/circular-progress.ts deleted file mode 100644 index 604a4f8bbe..0000000000 --- a/packages/core/theme/src/components/circular-progress.ts +++ /dev/null @@ -1,109 +0,0 @@ -import type {VariantProps} from "tailwind-variants"; - -import {tv} from "../utils/tv"; - -/** - * CircularProgress **Tailwind Variants** component - * - * @example - * ```js - * const {base, svgWrapper, svg, indicator, value, label} = circularProgress({...}) - * - *
- *
- * - * - * - * - * {value} - *
- * {label} - *
- * ``` - */ -const circularProgress = tv({ - slots: { - base: "flex flex-col justify-center gap-1 max-w-fit items-center", - label: "", - svgWrapper: "relative block", - svg: "z-0 relative overflow-hidden", - track: "h-full stroke-default-300/50", - indicator: "h-full stroke-current", - value: "absolute font-normal inset-0 flex items-center justify-center", - }, - variants: { - color: { - default: { - svg: "text-default-400", - }, - primary: { - svg: "text-primary", - }, - secondary: { - svg: "text-secondary", - }, - success: { - svg: "text-success", - }, - warning: { - svg: "text-warning", - }, - danger: { - svg: "text-danger", - }, - }, - size: { - sm: { - svg: "w-8 h-8", - label: "text-small", - value: "text-[0.5rem]", - }, - md: { - svg: "w-10 h-10", - label: "text-small", - value: "text-[0.55rem]", - }, - lg: { - svg: "w-12 h-12", - label: "text-medium", - value: "text-[0.6rem]", - }, - }, - isIndeterminate: { - true: { - svg: "animate-spinner-ease-spin", - }, - }, - isDisabled: { - true: { - base: "opacity-disabled cursor-not-allowed", - }, - }, - disableAnimation: { - true: {}, - false: { - indicator: "transition-all !duration-500", - }, - }, - }, - defaultVariants: { - color: "primary", - size: "md", - isDisabled: false, - }, - compoundVariants: [ - // disableAnimation && !isIndeterminate - { - disableAnimation: true, - isIndeterminate: false, - class: { - svg: "!transition-none motion-reduce:transition-none", - }, - }, - ], -}); - -export type CircularProgressVariantProps = VariantProps; -export type CircularProgressSlots = keyof ReturnType; - -export {circularProgress}; diff --git a/packages/core/theme/src/components/index.ts b/packages/core/theme/src/components/index.ts index 7776b24c52..27ebc629ca 100644 --- a/packages/core/theme/src/components/index.ts +++ b/packages/core/theme/src/components/index.ts @@ -16,7 +16,6 @@ export * from "./pagination"; export * from "./toggle"; export * from "./accordion"; export * from "./progress"; -export * from "./circular-progress"; export * from "./input"; export * from "./dropdown"; export * from "./image"; diff --git a/packages/core/theme/src/components/progress.ts b/packages/core/theme/src/components/progress.ts index cef7fb35ff..35b92a223e 100644 --- a/packages/core/theme/src/components/progress.ts +++ b/packages/core/theme/src/components/progress.ts @@ -136,7 +136,110 @@ const progress = tv( }, ); +/** + * CircularProgress **Tailwind Variants** component + * + * @example + * ```js + * const {base, svgWrapper, svg, indicator, value, label} = circularProgress({...}) + * + *
+ *
+ * + * + * + * + * {value} + *
+ * {label} + *
+ * ``` + */ +const circularProgress = tv({ + slots: { + base: "flex flex-col justify-center gap-1 max-w-fit items-center", + label: "", + svgWrapper: "relative block", + svg: "z-0 relative overflow-hidden", + track: "h-full stroke-default-300/50", + indicator: "h-full stroke-current", + value: "absolute font-normal inset-0 flex items-center justify-center", + }, + variants: { + color: { + default: { + svg: "text-default-400", + }, + primary: { + svg: "text-primary", + }, + secondary: { + svg: "text-secondary", + }, + success: { + svg: "text-success", + }, + warning: { + svg: "text-warning", + }, + danger: { + svg: "text-danger", + }, + }, + size: { + sm: { + svg: "w-8 h-8", + label: "text-small", + value: "text-[0.5rem]", + }, + md: { + svg: "w-10 h-10", + label: "text-small", + value: "text-[0.55rem]", + }, + lg: { + svg: "w-12 h-12", + label: "text-medium", + value: "text-[0.6rem]", + }, + }, + isIndeterminate: { + true: { + svg: "animate-spinner-ease-spin", + }, + }, + isDisabled: { + true: { + base: "opacity-disabled cursor-not-allowed", + }, + }, + disableAnimation: { + true: {}, + false: { + indicator: "transition-all !duration-500", + }, + }, + }, + defaultVariants: { + color: "primary", + size: "md", + isDisabled: false, + }, + compoundVariants: [ + // disableAnimation && !isIndeterminate + { + disableAnimation: true, + isIndeterminate: false, + class: { + svg: "!transition-none motion-reduce:transition-none", + }, + }, + ], +}); + export type ProgressVariantProps = VariantProps; export type ProgressSlots = keyof ReturnType; +export type CircularProgressVariantProps = VariantProps; +export type CircularProgressSlots = keyof ReturnType; -export {progress}; +export {progress, circularProgress};