1.1.26 • Published 6 months ago

@kaue-thums/web-ui-components v1.1.26

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

Componentes Web Baseados em Shadcn/UI

Biblioteca de componentes construída com Shadcn/UI e Tailwind CSS para um desenvolvimento ágil e estilizado.

Instalação

Para instalar a biblioteca de componentes, inicie um projeto React com Vite e execute um dos seguintes comandos:

npm install @kaue-thums/web-ui-components react-hook-form@7.54.2

Configuração do Tailwind CSS

A biblioteca depende da instalação e configuração do Tailwind CSS, garantindo que os componentes recebam os estilos e temas corretamente.

Instale as dependências:

npm install tailwindcss @tailwindcss/vite

Substitua o conteúdo em seu arquivo CSS principal (src/index.css):

@import "tailwindcss";
@plugin "tailwindcss-animate";
@custom-variant dark (&:is(.dark *));
@source "../node_modules/@kaue-thums/web-ui-components/dist";

:root {
  --background: #ffffff;
  --foreground: #1c1917;
  --card: #ffffff;
  --card-foreground: #1c1917;
  --popover: #ffffff;
  --popover-foreground: #1c1917;
  --primary: #60b565;
  --primary-foreground: #ffffff;
  --secondary: #eaf5eb;
  --secondary-foreground: #1c1917;
  --muted: #eaf5eb;
  --muted-foreground: #4a5b4d;
  --accent: #eaf5eb;
  --accent-foreground: #1c1917;
  --destructive: #d72638;
  --destructive-foreground: #ffffff;
  --border: #d6e7d9;
  --input: #d6e7d9;
  --ring: #60b565;
  --radius: 0.6rem;
  --sidebar: #f8faf9;
  --sidebar-foreground: #3f3f46;
  --sidebar-primary: #60b565;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #e1efe3;
  --sidebar-accent-foreground: #1c1917;
  --sidebar-border: #d6e7d9;
  --sidebar-ring: #60b565;
}

.dark {
  --background: #1c1917;
  --foreground: #eaf5eb;
  --card: #1c1917;
  --card-foreground: #eaf5eb;
  --popover: #1c1917;
  --popover-foreground: #eaf5eb;
  --primary: #60b565;
  --primary-foreground: #1c1917;
  --secondary: #28312b;
  --secondary-foreground: #eaf5eb;
  --muted: #28312b;
  --muted-foreground: #9eada0;
  --accent: #28312b;
  --accent-foreground: #eaf5eb;
  --destructive: #5a1b1b;
  --destructive-foreground: #eaf5eb;
  --border: #28312b;
  --input: #28312b;
  --ring: #60b565;
  --sidebar: #181818;
  --sidebar-foreground: #eaf5eb;
  --sidebar-primary: #60b565;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #262626;
  --sidebar-accent-foreground: #eaf5eb;
  --sidebar-border: #262626;
  --sidebar-ring: #60b565;
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);

  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;

  @keyframes accordion-down {
    from {
      height: 0;
    }
    to {
      height: var(--radix-accordion-content-height);
    }
  }

  @keyframes accordion-up {
    from {
      height: var(--radix-accordion-content-height);
    }
    to {
      height: 0;
    }
  }
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

Configuração do Tailwind no Vite (vite.config.ts):

Adicione o plugin tailwindcss do pacote @tailwindcss/vite nas configurações do vite

import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

// https://vite.dev/config/
export default defineConfig({
  plugins: [react(), tailwindcss()],
});