chakra-ui / panda

🐼 Universal, Type-Safe, CSS-in-JS Framework for Product Teams ⚡️
https://panda-css.com
MIT License
5.23k stars 236 forks source link

TS for sva is not working #1227

Closed elite174 closed 1 year ago

elite174 commented 1 year ago

Description

import { sva } from "../../../styled-system/css";

export const chipRecipe = sva({
  slots: ["root", "icon"],
  base: {
    root: {
      display: "flex",
      alignItems: "center",
      gap: "10px",
      width: "fit-content",
      height: "24px",
      paddingInline: "8px",
      borderRadius: "8px",
      cursor: "default",
    },
    icon: {
      width: "24px",
      height: "24px",
    },
  },
  variants: {
    view: {
      red: {
        root: {
          backgroundColor: "red",
        },
      },
    },
  },
});

panda config:

import { defineConfig } from "@pandacss/dev";

import { chipRecipe } from "./src/design-system/components/chip";

export default defineConfig({
  // Whether to use css reset
  preflight: true,

  // Where to look for your css declarations
  include: ["./src/**/*.{ts,tsx}"],

  // Files to exclude
  exclude: [],

  // Useful for theme customization
  theme: {
    extend: {
      slotRecipes: {
        chip: chipRecipe,
      },
    },
  },

  // The output directory for your css system
  outdir: "styled-system",
  outExtension: "js",
});

I get: image

Link to Reproduction

-

Steps to reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error

JS Framework

No response

Panda CSS Version

0.11

Browser

No response

Operating System

Additional Information

No response

elite174 commented 1 year ago

There are also infinite reloads for solid-js project (SPA)

elite174 commented 1 year ago

image

segunadebayo commented 1 year ago

Thanks for raising this issue.

This shows we need to improve the docs somewhere.

In this case, replace sva with defineSlotRecipe and provide a className property.

t should work as expected.