karsten-design-system 1.2.48 → 1.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -207
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/stories/components/header.d.ts +3 -1
- package/dist/stories/components/sidebar.d.ts +3 -1
- package/dist/types/stories/components/header.d.ts +3 -1
- package/dist/types/stories/components/sidebar.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,207 +1,207 @@
|
|
|
1
|
-
# Karsten Design System
|
|
2
|
-
|
|
3
|
-
Uma biblioteca de componentes React estilizados para projetos da Karsten, construída sobre o PrimeReact.
|
|
4
|
-
|
|
5
|
-
## Instalação
|
|
6
|
-
|
|
7
|
-
Com npm:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install karsten-design-system
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Com yarn:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
yarn add karsten-design-system
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Configuração do PrimeReact
|
|
20
|
-
|
|
21
|
-
No main.tsx adicione:
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
import { StrictMode } from "react";
|
|
25
|
-
import { createRoot } from "react-dom/client";
|
|
26
|
-
import "./index.css";
|
|
27
|
-
import App from "./App.tsx";
|
|
28
|
-
|
|
29
|
-
import { PrimeReactProvider } from 'primereact/api'; // Adicione o PrimeReactProvider
|
|
30
|
-
import Tailwind from 'primereact/passthrough/tailwind'; // Importe o Tailwind
|
|
31
|
-
import './index.css';
|
|
32
|
-
|
|
33
|
-
createRoot(document.getElementById("root")!).render(
|
|
34
|
-
<StrictMode>
|
|
35
|
-
<PrimeReactProvider value={{ pt: Tailwind }}> {/* Envolva o app no Provider do PrimeReact */}
|
|
36
|
-
<App />
|
|
37
|
-
</PrimeReactProvider>
|
|
38
|
-
</StrictMode>
|
|
39
|
-
);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Pré-requisitos
|
|
43
|
-
|
|
44
|
-
Esta biblioteca requer as seguintes dependências:
|
|
45
|
-
|
|
46
|
-
- React 18 ou superior
|
|
47
|
-
- React DOM 18 ou superior
|
|
48
|
-
- React Router DOM 7 ou superior
|
|
49
|
-
- Tailwind 3.4.0 ou superior
|
|
50
|
-
- @types/date-fns 2 ou superior
|
|
51
|
-
- Chart.js 4 ou superior
|
|
52
|
-
- clsx 2 ou superior
|
|
53
|
-
- date-fns 1 ou superior
|
|
54
|
-
- Primeicons 7 ou superior
|
|
55
|
-
- Primereact 10 ou superior
|
|
56
|
-
- Postcss 8 ou superior
|
|
57
|
-
- Autoprefixer 10 ou superior
|
|
58
|
-
|
|
59
|
-
## Como usar
|
|
60
|
-
|
|
61
|
-
1. Importe o componente desejado da biblioteca:
|
|
62
|
-
|
|
63
|
-
```jsx
|
|
64
|
-
import { Button } from 'karsten-design-system'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
2. Use o componente em seu projeto:
|
|
68
|
-
|
|
69
|
-
```jsx
|
|
70
|
-
function App() {
|
|
71
|
-
return <Button label="Clique aqui" />
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Componentes Disponíveis
|
|
76
|
-
|
|
77
|
-
- `Accordion` - Componente para exibir conteúdo em seções expansíveis e colapsáveis.
|
|
78
|
-
- `AutoComplete` - Campo de entrada com sugestões automáticas baseadas no texto digitado.
|
|
79
|
-
- `Breadcrumb` - Navegação hierárquica para indicar a localização atual do usuário.
|
|
80
|
-
- `Button` - Botão estilizado com variantes primária e secundária.
|
|
81
|
-
- `Card` - Contêiner estilizado para exibir informações agrupadas.
|
|
82
|
-
- `Chart` - Gráficos para visualização de dados em diferentes formatos.
|
|
83
|
-
- `DateInput` - Campo de entrada para seleção de datas.
|
|
84
|
-
- `Dialog` - Modal para exibição de mensagens ou ações secundárias.
|
|
85
|
-
- `Divider` - Linha divisória para separação visual de conteúdo.
|
|
86
|
-
- `Header` - Cabeçalho estilizado para títulos ou menus.
|
|
87
|
-
- `IconButton` - Botão com ícone, ideal para ações rápidas.
|
|
88
|
-
- `InfoCard` - Cartão informativo para exibir alertas ou dados destacados.
|
|
89
|
-
- `Input` - Campo de entrada para texto.
|
|
90
|
-
- `InternalMenu` - Menu de navegação interna, útil para dashboards.
|
|
91
|
-
- `Link` - Link estilizado para navegação.
|
|
92
|
-
- `MegaMenu` - Menu expandido com múltiplas opções organizadas.
|
|
93
|
-
- `Notification` - Notificação para exibir alertas e mensagens.
|
|
94
|
-
- `Paginator` - Paginação para navegação em listas ou tabelas.
|
|
95
|
-
- `RadioButton` - Botões de seleção única dentro de um grupo.
|
|
96
|
-
- `Select` - Componente para seleção de opções em um menu suspenso.
|
|
97
|
-
- `Sidebar` - Barra lateral para navegação ou exibição de conteúdo adicional.
|
|
98
|
-
- `Skeleton` - Elementos de carregamento em estilo esqueleto.
|
|
99
|
-
- `Spinner` - Indicador de carregamento animado.
|
|
100
|
-
- `Table` - Tabela para exibição de dados estruturados.
|
|
101
|
-
- `Toast` - Mensagens temporárias exibidas no canto da tela.
|
|
102
|
-
|
|
103
|
-
## Desenvolvimento
|
|
104
|
-
|
|
105
|
-
Para contribuir com o projeto:
|
|
106
|
-
|
|
107
|
-
1. Clone o repositório:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
git clone https://github.com/KarstenSA/karsten-design-system.git
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
2. Instale as dependências:
|
|
114
|
-
|
|
115
|
-
Com npm:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
npm install
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Com yarn:
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
yarn
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
3. Execute o Storybook para desenvolvimento:
|
|
128
|
-
|
|
129
|
-
Com npm:
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
npm run storybook
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Com yarn:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
yarn storybook
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Scripts Disponíveis
|
|
142
|
-
|
|
143
|
-
Com npm:
|
|
144
|
-
|
|
145
|
-
- `npm run storybook` - Inicia o ambiente de desenvolvimento do Storybook
|
|
146
|
-
- `npm run build-storybook` - Gera o build da biblioteca para hospedagem
|
|
147
|
-
- `npm run build` - Gera o build da biblioteca para publicação no npm
|
|
148
|
-
|
|
149
|
-
Com yarn:
|
|
150
|
-
|
|
151
|
-
- `yarn storybook` - Inicia o ambiente de desenvolvimento do Storybook
|
|
152
|
-
- `yarn build-storybook` - Gera o build do Storybook para hospedagem
|
|
153
|
-
- `yarn build` - Gera o build da biblioteca para publicação no npm
|
|
154
|
-
|
|
155
|
-
## Publicando uma Nova Versão no NPM
|
|
156
|
-
|
|
157
|
-
1. Atualizar a Versão
|
|
158
|
-
|
|
159
|
-
Antes de publicar, aumente a versão no `package.json` e `package-lock.json`.
|
|
160
|
-
|
|
161
|
-
2. Fazer o Build
|
|
162
|
-
|
|
163
|
-
Com npm:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
npm run build
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Com yarn:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
yarn build
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
3. Login no NPM
|
|
176
|
-
|
|
177
|
-
Se ainda não estiver autenticado, faça login:
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
npm login
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
4. Publicar
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
npm publish --access public
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Resolução de Problemas
|
|
190
|
-
|
|
191
|
-
Se você encontrar o erro "peer dependencies missing", instale as dependências necessárias:
|
|
192
|
-
|
|
193
|
-
Com npm:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
npm install react@^18 react-dom@^18 tailwindcss@^3.4.0 @types/date-fns@^2 chart.js@^4 clsx@^2 date-fns@^1 primeicons@^7 primereact@^10 postcss@^8 autoprefixer@^10
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Com yarn:
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
yarn add react@^18 react-dom@^18 tailwindcss@^3.4.0 @types/date-fns@^2 chart.js@^4 clsx@^2 date-fns@^1 primeicons@^7 primereact@^10 postcss@^8 autoprefixer@^10
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
## Licença
|
|
206
|
-
|
|
207
|
-
Este projeto está licenciado sob a licença MIT.
|
|
1
|
+
# Karsten Design System
|
|
2
|
+
|
|
3
|
+
Uma biblioteca de componentes React estilizados para projetos da Karsten, construída sobre o PrimeReact.
|
|
4
|
+
|
|
5
|
+
## Instalação
|
|
6
|
+
|
|
7
|
+
Com npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install karsten-design-system
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Com yarn:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add karsten-design-system
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configuração do PrimeReact
|
|
20
|
+
|
|
21
|
+
No main.tsx adicione:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { StrictMode } from "react";
|
|
25
|
+
import { createRoot } from "react-dom/client";
|
|
26
|
+
import "./index.css";
|
|
27
|
+
import App from "./App.tsx";
|
|
28
|
+
|
|
29
|
+
import { PrimeReactProvider } from 'primereact/api'; // Adicione o PrimeReactProvider
|
|
30
|
+
import Tailwind from 'primereact/passthrough/tailwind'; // Importe o Tailwind
|
|
31
|
+
import './index.css';
|
|
32
|
+
|
|
33
|
+
createRoot(document.getElementById("root")!).render(
|
|
34
|
+
<StrictMode>
|
|
35
|
+
<PrimeReactProvider value={{ pt: Tailwind }}> {/* Envolva o app no Provider do PrimeReact */}
|
|
36
|
+
<App />
|
|
37
|
+
</PrimeReactProvider>
|
|
38
|
+
</StrictMode>
|
|
39
|
+
);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Pré-requisitos
|
|
43
|
+
|
|
44
|
+
Esta biblioteca requer as seguintes dependências:
|
|
45
|
+
|
|
46
|
+
- React 18 ou superior
|
|
47
|
+
- React DOM 18 ou superior
|
|
48
|
+
- React Router DOM 7 ou superior
|
|
49
|
+
- Tailwind 3.4.0 ou superior
|
|
50
|
+
- @types/date-fns 2 ou superior
|
|
51
|
+
- Chart.js 4 ou superior
|
|
52
|
+
- clsx 2 ou superior
|
|
53
|
+
- date-fns 1 ou superior
|
|
54
|
+
- Primeicons 7 ou superior
|
|
55
|
+
- Primereact 10 ou superior
|
|
56
|
+
- Postcss 8 ou superior
|
|
57
|
+
- Autoprefixer 10 ou superior
|
|
58
|
+
|
|
59
|
+
## Como usar
|
|
60
|
+
|
|
61
|
+
1. Importe o componente desejado da biblioteca:
|
|
62
|
+
|
|
63
|
+
```jsx
|
|
64
|
+
import { Button } from 'karsten-design-system'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. Use o componente em seu projeto:
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
function App() {
|
|
71
|
+
return <Button label="Clique aqui" />
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Componentes Disponíveis
|
|
76
|
+
|
|
77
|
+
- `Accordion` - Componente para exibir conteúdo em seções expansíveis e colapsáveis.
|
|
78
|
+
- `AutoComplete` - Campo de entrada com sugestões automáticas baseadas no texto digitado.
|
|
79
|
+
- `Breadcrumb` - Navegação hierárquica para indicar a localização atual do usuário.
|
|
80
|
+
- `Button` - Botão estilizado com variantes primária e secundária.
|
|
81
|
+
- `Card` - Contêiner estilizado para exibir informações agrupadas.
|
|
82
|
+
- `Chart` - Gráficos para visualização de dados em diferentes formatos.
|
|
83
|
+
- `DateInput` - Campo de entrada para seleção de datas.
|
|
84
|
+
- `Dialog` - Modal para exibição de mensagens ou ações secundárias.
|
|
85
|
+
- `Divider` - Linha divisória para separação visual de conteúdo.
|
|
86
|
+
- `Header` - Cabeçalho estilizado para títulos ou menus.
|
|
87
|
+
- `IconButton` - Botão com ícone, ideal para ações rápidas.
|
|
88
|
+
- `InfoCard` - Cartão informativo para exibir alertas ou dados destacados.
|
|
89
|
+
- `Input` - Campo de entrada para texto.
|
|
90
|
+
- `InternalMenu` - Menu de navegação interna, útil para dashboards.
|
|
91
|
+
- `Link` - Link estilizado para navegação.
|
|
92
|
+
- `MegaMenu` - Menu expandido com múltiplas opções organizadas.
|
|
93
|
+
- `Notification` - Notificação para exibir alertas e mensagens.
|
|
94
|
+
- `Paginator` - Paginação para navegação em listas ou tabelas.
|
|
95
|
+
- `RadioButton` - Botões de seleção única dentro de um grupo.
|
|
96
|
+
- `Select` - Componente para seleção de opções em um menu suspenso.
|
|
97
|
+
- `Sidebar` - Barra lateral para navegação ou exibição de conteúdo adicional.
|
|
98
|
+
- `Skeleton` - Elementos de carregamento em estilo esqueleto.
|
|
99
|
+
- `Spinner` - Indicador de carregamento animado.
|
|
100
|
+
- `Table` - Tabela para exibição de dados estruturados.
|
|
101
|
+
- `Toast` - Mensagens temporárias exibidas no canto da tela.
|
|
102
|
+
|
|
103
|
+
## Desenvolvimento
|
|
104
|
+
|
|
105
|
+
Para contribuir com o projeto:
|
|
106
|
+
|
|
107
|
+
1. Clone o repositório:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git clone https://github.com/KarstenSA/karsten-design-system.git
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
2. Instale as dependências:
|
|
114
|
+
|
|
115
|
+
Com npm:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm install
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Com yarn:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
yarn
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
3. Execute o Storybook para desenvolvimento:
|
|
128
|
+
|
|
129
|
+
Com npm:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm run storybook
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Com yarn:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
yarn storybook
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Scripts Disponíveis
|
|
142
|
+
|
|
143
|
+
Com npm:
|
|
144
|
+
|
|
145
|
+
- `npm run storybook` - Inicia o ambiente de desenvolvimento do Storybook
|
|
146
|
+
- `npm run build-storybook` - Gera o build da biblioteca para hospedagem
|
|
147
|
+
- `npm run build` - Gera o build da biblioteca para publicação no npm
|
|
148
|
+
|
|
149
|
+
Com yarn:
|
|
150
|
+
|
|
151
|
+
- `yarn storybook` - Inicia o ambiente de desenvolvimento do Storybook
|
|
152
|
+
- `yarn build-storybook` - Gera o build do Storybook para hospedagem
|
|
153
|
+
- `yarn build` - Gera o build da biblioteca para publicação no npm
|
|
154
|
+
|
|
155
|
+
## Publicando uma Nova Versão no NPM
|
|
156
|
+
|
|
157
|
+
1. Atualizar a Versão
|
|
158
|
+
|
|
159
|
+
Antes de publicar, aumente a versão no `package.json` e `package-lock.json`.
|
|
160
|
+
|
|
161
|
+
2. Fazer o Build
|
|
162
|
+
|
|
163
|
+
Com npm:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm run build
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Com yarn:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
yarn build
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
3. Login no NPM
|
|
176
|
+
|
|
177
|
+
Se ainda não estiver autenticado, faça login:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm login
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
4. Publicar
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm publish --access public
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Resolução de Problemas
|
|
190
|
+
|
|
191
|
+
Se você encontrar o erro "peer dependencies missing", instale as dependências necessárias:
|
|
192
|
+
|
|
193
|
+
Com npm:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npm install react@^18 react-dom@^18 tailwindcss@^3.4.0 @types/date-fns@^2 chart.js@^4 clsx@^2 date-fns@^1 primeicons@^7 primereact@^10 postcss@^8 autoprefixer@^10
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Com yarn:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
yarn add react@^18 react-dom@^18 tailwindcss@^3.4.0 @types/date-fns@^2 chart.js@^4 clsx@^2 date-fns@^1 primeicons@^7 primereact@^10 postcss@^8 autoprefixer@^10
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Licença
|
|
206
|
+
|
|
207
|
+
Este projeto está licenciado sob a licença MIT.
|
package/dist/index.js
CHANGED
|
@@ -205,14 +205,14 @@ function Card({ children, className, ariaLabel = 'Card de informação', }) {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
function CardButton({ label, description, onClick }) {
|
|
208
|
-
return (jsxs("div", { className: "cursor-pointer rounded-2xl p-4 h-[160px] w-full bg-gradient-to-br hover:shadow-md transition-shadow duration-200 border from-[#f3f4f6] to-light-500 border-[#f3f4f6]\
|
|
208
|
+
return (jsxs("div", { className: "cursor-pointer rounded-2xl p-4 h-[160px] w-full bg-gradient-to-br hover:shadow-md transition-shadow duration-200 border from-[#f3f4f6] to-light-500 border-[#f3f4f6]\n dark:from-dark-400 dark:to-dark-100 dark:border-dark-400 dark:bg-dark-100 dark:shadow-dark-400", onClick: () => {
|
|
209
209
|
if (onClick)
|
|
210
210
|
onClick();
|
|
211
211
|
}, children: [jsx("h3", { className: "text-lg font-bold text-primary dark:text-light-500", children: label }), description && (jsx("p", { className: "text-sm mt-2 line-clamp-3 text-primary dark:text-light-500", children: description }))] }));
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
function CardIconsButton({ label, leftIcon, onClick, }) {
|
|
215
|
-
return (jsxs("div", { className: "cursor-pointer rounded-xl p-4 w-full min-h-[60px] bg-gradient-to-br hover:shadow-md transition-shadow duration-200 border flex items-center justify-between gap-4 from-[#f3f4f6] to-light-500 border-[#f3f4f6]\
|
|
215
|
+
return (jsxs("div", { className: "cursor-pointer rounded-xl p-4 w-full min-h-[60px] bg-gradient-to-br hover:shadow-md transition-shadow duration-200 border flex items-center justify-between gap-4 from-[#f3f4f6] to-light-500 border-[#f3f4f6]\n dark:from-dark-400 dark:to-dark-100 dark:border-dark-400 dark:bg-dark-100 dark:shadow-dark-400", onClick: () => {
|
|
216
216
|
if (onClick)
|
|
217
217
|
onClick();
|
|
218
218
|
}, "aria-label": `Botão de navegação para ${label}`, children: [jsxs("div", { className: "flex items-center gap-3 flex-grow overflow-hidden", children: [leftIcon && (jsx("div", { className: "text-xl flex-shrink-0 flex items-center dark:text-light-500 text-primary", children: leftIcon })), jsx("h3", { className: "text-base font-semibold break-words dark:text-light-500 text-primary", children: label })] }), jsx("div", { className: "flex items-center justify-center h-full", children: jsx("i", { className: "pi pi-angle-right text-xl flex-shrink-0 dark:text-light-500 text-primary" }) })] }));
|
|
@@ -443,15 +443,15 @@ function Tooltip({ text, children }) {
|
|
|
443
443
|
}, children: text }), document.body)] }));
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
function Sidebar({ item, onClose, topItem }) {
|
|
447
|
-
return (jsx("div", { className: "fixed h-[calc(100vh_-_64px)] bottom-0 w-72 bg-light-500 dark:bg-dark-100 z-50 shadow-container dark:border dark:border-dark-500 dark:shadow-dark-400", children: jsxs("div", { className: "overflow-hidden flex flex-col h-full", children: [jsxs("div", { className: "shrink-0", children: [jsx("div", { className: "cursor-pointer flex flex-row gap-3 items-center border-b pl-6 px-2 py-2 border-b-light-200 hover:bg-light-300 hover:font-bold dark:bg-dark-100 dark:hover:bg-dark-400", children: jsx(Link$1, { to: "/", className: "font-roboto text-base text-light-900 hover:font-bold dark:text-light-500 dark:hover:bg-dark-400", onClick: onClose, "aria-label": "Ir para o in\u00EDcio", children:
|
|
446
|
+
function Sidebar({ item, onClose, topItem, homeTranslation = 'Início', favoritesTranslation = 'Favoritos', }) {
|
|
447
|
+
return (jsx("div", { className: "fixed h-[calc(100vh_-_64px)] bottom-0 w-72 bg-light-500 dark:bg-dark-100 z-50 shadow-container dark:border dark:border-dark-500 dark:shadow-dark-400", children: jsxs("div", { className: "overflow-hidden flex flex-col h-full", children: [jsxs("div", { className: "shrink-0", children: [jsx("div", { className: "cursor-pointer flex flex-row gap-3 items-center border-b pl-6 px-2 py-2 border-b-light-200 hover:bg-light-300 hover:font-bold dark:bg-dark-100 dark:hover:bg-dark-400", children: jsx(Link$1, { to: "/", className: "font-roboto text-base text-light-900 hover:font-bold dark:text-light-500 dark:hover:bg-dark-400", onClick: onClose, "aria-label": "Ir para o in\u00EDcio", children: homeTranslation }) }), topItem?.map((item) => (jsx("div", { className: "cursor-pointer flex flex-row gap-3 items-center border-b pl-6 px-2 py-2 border-b-light-200 hover:bg-light-300 hover:font-bold dark:bg-dark-100 dark:text-light-500 dark:hover:bg-dark-400", children: item.isWindowOpen ? (jsx("button", { className: "font-roboto text-base text-light-900 hover:font-bold dark:text-light-500 dark:hover:bg-dark-400", onClick: () => {
|
|
448
448
|
if (onClose)
|
|
449
449
|
onClose();
|
|
450
450
|
window?.open(item.path, '_blank');
|
|
451
|
-
}, "aria-label": `Ir para ${item.title}`, children: jsx(Tooltip, { text: item.tooltipText, children: item.title }) })) : (jsx(Link$1, { to: item.path || '', className: "font-roboto text-base text-light-900 hover:font-bold dark:text-light-500 dark:hover:bg-dark-400", onClick: onClose, "aria-label": `Ir para ${item.title}`, children: jsx(Tooltip, { text: item.tooltipText, children: item.title }) })) }, `top-item-${item.id ?? item.title}`))), jsxs("div", { className: "flex flex-row gap-3 items-center pl-6 pt-8 pb-4", children: [jsx("i", { className: "pi pi-star text-light-900 !font-bold text-lg dark:text-light-500" }), jsx("p", { className: "text-light-900 font-bold text-lg dark:text-light-500", children:
|
|
451
|
+
}, "aria-label": `Ir para ${item.title}`, children: jsx(Tooltip, { text: item.tooltipText, children: item.title }) })) : (jsx(Link$1, { to: item.path || '', className: "font-roboto text-base text-light-900 hover:font-bold dark:text-light-500 dark:hover:bg-dark-400", onClick: onClose, "aria-label": `Ir para ${item.title}`, children: jsx(Tooltip, { text: item.tooltipText, children: item.title }) })) }, `top-item-${item.id ?? item.title}`))), jsxs("div", { className: "flex flex-row gap-3 items-center pl-6 pt-8 pb-4", children: [jsx("i", { className: "pi pi-star text-light-900 !font-bold text-lg dark:text-light-500" }), jsx("p", { className: "text-light-900 font-bold text-lg dark:text-light-500", children: favoritesTranslation })] })] }), jsx("div", { className: "flex-1 overflow-y-auto overflow-x-hidden px-0 pb-4 pr-1 custom-scrollbar", children: item?.map((item) => (jsx(Link$1, { className: "flex flex-row items-center pl-6 gap-2 border-b border-b-light-200 hover:bg-light-300 hover:font-bold dark:bg-dark-100 dark:text-light-500 dark:hover:bg-dark-400", to: item.path || '', onClick: onClose, "aria-label": `Ir para ${item.title}`, children: jsx("span", { className: "font-roboto text-base py-2 text-light-900 hover:font-bold dark:text-light-500 dark:hover:bg-dark-400", children: jsx(Tooltip, { text: item.tooltipText, children: item.title }) }) }, item.id))) })] }) }));
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
-
function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, isRenderNotifications = false, rightActions, redirect = '/', }) {
|
|
454
|
+
function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, isRenderNotifications = false, rightActions, redirect = '/', helloTranslation = 'Olá', favoritesTranslation = 'Favoritos', }) {
|
|
455
455
|
const [openSidebar, setOpenSidebar] = useState(false);
|
|
456
456
|
const [openUserConfig, setOpenUserConfig] = useState(false);
|
|
457
457
|
const userConfigRef = useRef(null);
|
|
@@ -472,13 +472,13 @@ function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setO
|
|
|
472
472
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
473
473
|
};
|
|
474
474
|
}, [openUserConfig]);
|
|
475
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: "w-100 min-h-16 border-b border-b-light-200 flex flex-row justify-between items-center px-8 shadow-header dark:bg-dark-100 dark:border-b-dark-400", children: [jsxs("div", { className: "flex flex-row items-center gap-4", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenSidebar(!openSidebar), "aria-label": "Abrir menu lateral", children: jsx("i", { className: `${openSidebar ? 'pi pi-list' : 'pi pi-bars'} text-light-950 cursor-pointer hover:text-light-900 text-xl mt-1 }` }) }), jsx(Link$1, { className: "cursor-pointer", to: redirect, "aria-label": "Ir para p\u00E1gina inicial", children: jsx(LogoSmall, {}) }, "logo-link")] }), jsxs("div", { className: "relative flex flex-row gap-4 items-center", children: [isRenderNotifications && (jsx("button", { className: "bg-transparent border-none mt-1", onClick: () => setOpenNotifications(true), "aria-label": "Abrir notifica\u00E7\u00E3o", children: jsx("i", { className: "pi pi-bell text-light-950 cursor-pointer hover:text-light-900" }) })), jsxs("div", { ref: userConfigRef, className: "relative", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenUserConfig(!openUserConfig), "aria-label": "Abrir menu de configura\u00E7\u00F5es do usu\u00E1rio", children: jsxs("p", { className: "text-light-950 hover:text-light-900 font-roboto font-bold cursor-pointer transition-colors duration-200", children: ["
|
|
475
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "w-100 min-h-16 border-b border-b-light-200 flex flex-row justify-between items-center px-8 shadow-header dark:bg-dark-100 dark:border-b-dark-400", children: [jsxs("div", { className: "flex flex-row items-center gap-4", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenSidebar(!openSidebar), "aria-label": "Abrir menu lateral", children: jsx("i", { className: `${openSidebar ? 'pi pi-list' : 'pi pi-bars'} text-light-950 cursor-pointer hover:text-light-900 text-xl mt-1 }` }) }), jsx(Link$1, { className: "cursor-pointer", to: redirect, "aria-label": "Ir para p\u00E1gina inicial", children: jsx(LogoSmall, {}) }, "logo-link")] }), jsxs("div", { className: "relative flex flex-row gap-4 items-center", children: [isRenderNotifications && (jsx("button", { className: "bg-transparent border-none mt-1", onClick: () => setOpenNotifications(true), "aria-label": "Abrir notifica\u00E7\u00E3o", children: jsx("i", { className: "pi pi-bell text-light-950 cursor-pointer hover:text-light-900" }) })), jsxs("div", { ref: userConfigRef, className: "relative", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenUserConfig(!openUserConfig), "aria-label": "Abrir menu de configura\u00E7\u00F5es do usu\u00E1rio", children: jsxs("p", { className: "text-light-950 hover:text-light-900 font-roboto font-bold cursor-pointer transition-colors duration-200", children: [helloTranslation, ", ", username] }) }), openUserConfig && (jsx("div", { className: `absolute w-100 bg-light-500 shadow-md border border-light-400 z-20 rounded-md p-2 -bottom-1 translate-y-full dark:bg-dark-100`, children: jsx("ul", { children: userConfigItems.map(({ id, title, onClick, path }) => (jsx("li", { className: "p-2 hover:bg-light-300 dark:bg-dark-100 dark:text-light-500 dark:hover:bg-dark-400", children: jsx("a", { onClick: () => {
|
|
476
476
|
if (onClick)
|
|
477
477
|
onClick();
|
|
478
478
|
setOpenUserConfig(false);
|
|
479
479
|
}, href: path, className: "block w-full font-base font-roboto text-light-900 cursor-pointer hover:font-bold dark:text-light-500", "aria-label": "Op\u00E7\u00F5es de configura\u00E7\u00F5es do usu\u00E1rio", children: title }) }, id))) }) }))] }), rightActions && rightActions] })] }), openSidebar && (jsx(Sidebar, { topItem: sidebarTopItems, item: sidebarItems, onClose: () => {
|
|
480
480
|
setOpenSidebar(false);
|
|
481
|
-
} }))] }));
|
|
481
|
+
}, favoritesTranslation: favoritesTranslation }))] }));
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
const variants$2 = {
|