analytica-frontend-lib 1.0.14 → 1.0.16
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 +25 -0
- package/dist/index.css +59 -1
- package/dist/index.d.mts +74 -1
- package/dist/index.d.ts +74 -1
- package/dist/index.js +54 -0
- package/dist/index.mjs +53 -0
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -14,6 +14,27 @@ Instale a biblioteca em seu projeto com o comando:
|
|
|
14
14
|
yarn add analytica-frontend-lib
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
### Importe os componentes
|
|
18
|
+
|
|
19
|
+
Para usar os componentes, basta importá-los no seu projeto:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Text } from 'analytica-frontend-lib'
|
|
23
|
+
|
|
24
|
+
const MyComponent = () => {
|
|
25
|
+
return <Text>Olá mundo!</Text>
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Importando Estilos CSS
|
|
30
|
+
|
|
31
|
+
Para usar os estilos e variáveis CSS da lib, importe o arquivo de estilos:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
// No seu arquivo layout.tsx (Next.js) ou main.tsx (Vite)
|
|
35
|
+
import 'analytica-frontend-lib/styles.css';
|
|
36
|
+
```
|
|
37
|
+
|
|
17
38
|
---
|
|
18
39
|
|
|
19
40
|
## Etapas para criar um novo componente
|
|
@@ -33,6 +54,10 @@ yarn add analytica-frontend-lib
|
|
|
33
54
|
- Os componentes devem ser totalmente compatíveis com Next.js versão 15+.
|
|
34
55
|
- Testes unitários são obrigatórios, com coverage mínimo de 80%.
|
|
35
56
|
- Siga o princípio da responsabilidade única (`single responsibility`): construa componentes compostos por componentes menores.
|
|
57
|
+
- No arquivo `package.json` da biblioteca temos:
|
|
58
|
+
- `peerDependencies`: Framework core (React, Next.js)
|
|
59
|
+
- `dependencies`: Bibliotecas específicas usadas pelos componentes
|
|
60
|
+
- `devDependencies`: Ferramentas de build, testes, linting
|
|
36
61
|
|
|
37
62
|
## Ladle
|
|
38
63
|
|
package/dist/index.css
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:root,
|
|
6
6
|
:host {
|
|
7
7
|
--font-sans:
|
|
8
|
+
"Roboto",
|
|
8
9
|
ui-sans-serif,
|
|
9
10
|
system-ui,
|
|
10
11
|
sans-serif,
|
|
@@ -26,6 +27,8 @@
|
|
|
26
27
|
--text-xs--line-height: calc(1 / 0.75);
|
|
27
28
|
--text-sm: 0.875rem;
|
|
28
29
|
--text-sm--line-height: calc(1.25 / 0.875);
|
|
30
|
+
--text-base: 1rem;
|
|
31
|
+
--text-base--line-height: calc(1.5 / 1);
|
|
29
32
|
--text-lg: 1.125rem;
|
|
30
33
|
--text-lg--line-height: calc(1.75 / 1.125);
|
|
31
34
|
--text-xl: 1.25rem;
|
|
@@ -49,12 +52,14 @@
|
|
|
49
52
|
--font-weight-black: 900;
|
|
50
53
|
--radius-sm: 0.25rem;
|
|
51
54
|
--radius-md: 0.375rem;
|
|
55
|
+
--radius-lg: 0.5rem;
|
|
52
56
|
--radius-xl: 0.75rem;
|
|
53
57
|
--default-transition-duration: 150ms;
|
|
54
58
|
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
55
59
|
--default-font-family: var(--font-sans);
|
|
56
60
|
--default-mono-font-family: var(--font-mono);
|
|
57
61
|
--color-primary-50: #999999;
|
|
62
|
+
--color-primary-100: #808080;
|
|
58
63
|
--color-primary-400: #525252;
|
|
59
64
|
--color-primary-500: #333333;
|
|
60
65
|
--color-primary-600: #292929;
|
|
@@ -310,6 +315,9 @@
|
|
|
310
315
|
.absolute {
|
|
311
316
|
position: absolute;
|
|
312
317
|
}
|
|
318
|
+
.fixed {
|
|
319
|
+
position: fixed;
|
|
320
|
+
}
|
|
313
321
|
.relative {
|
|
314
322
|
position: relative;
|
|
315
323
|
}
|
|
@@ -331,6 +339,24 @@
|
|
|
331
339
|
.z-50 {
|
|
332
340
|
z-index: 50;
|
|
333
341
|
}
|
|
342
|
+
.container {
|
|
343
|
+
width: 100%;
|
|
344
|
+
@media (width >= 40rem) {
|
|
345
|
+
max-width: 40rem;
|
|
346
|
+
}
|
|
347
|
+
@media (width >= 48rem) {
|
|
348
|
+
max-width: 48rem;
|
|
349
|
+
}
|
|
350
|
+
@media (width >= 64rem) {
|
|
351
|
+
max-width: 64rem;
|
|
352
|
+
}
|
|
353
|
+
@media (width >= 80rem) {
|
|
354
|
+
max-width: 80rem;
|
|
355
|
+
}
|
|
356
|
+
@media (width >= 96rem) {
|
|
357
|
+
max-width: 96rem;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
334
360
|
.mx-2 {
|
|
335
361
|
margin-inline: calc(var(--spacing) * 2);
|
|
336
362
|
}
|
|
@@ -343,6 +369,9 @@
|
|
|
343
369
|
.mt-2 {
|
|
344
370
|
margin-top: calc(var(--spacing) * 2);
|
|
345
371
|
}
|
|
372
|
+
.mt-4 {
|
|
373
|
+
margin-top: calc(var(--spacing) * 4);
|
|
374
|
+
}
|
|
346
375
|
.mr-2 {
|
|
347
376
|
margin-right: calc(var(--spacing) * 2);
|
|
348
377
|
}
|
|
@@ -352,6 +381,9 @@
|
|
|
352
381
|
.mb-3 {
|
|
353
382
|
margin-bottom: calc(var(--spacing) * 3);
|
|
354
383
|
}
|
|
384
|
+
.mb-4 {
|
|
385
|
+
margin-bottom: calc(var(--spacing) * 4);
|
|
386
|
+
}
|
|
355
387
|
.ml-2 {
|
|
356
388
|
margin-left: calc(var(--spacing) * 2);
|
|
357
389
|
}
|
|
@@ -388,6 +420,9 @@
|
|
|
388
420
|
.w-8 {
|
|
389
421
|
width: calc(var(--spacing) * 8);
|
|
390
422
|
}
|
|
423
|
+
.w-10 {
|
|
424
|
+
width: calc(var(--spacing) * 10);
|
|
425
|
+
}
|
|
391
426
|
.w-full {
|
|
392
427
|
width: 100%;
|
|
393
428
|
}
|
|
@@ -452,6 +487,9 @@
|
|
|
452
487
|
.rounded-full {
|
|
453
488
|
border-radius: calc(infinity * 1px);
|
|
454
489
|
}
|
|
490
|
+
.rounded-lg {
|
|
491
|
+
border-radius: var(--radius-lg);
|
|
492
|
+
}
|
|
455
493
|
.rounded-md {
|
|
456
494
|
border-radius: var(--radius-md);
|
|
457
495
|
}
|
|
@@ -510,6 +548,9 @@
|
|
|
510
548
|
.border-success-500 {
|
|
511
549
|
border-color: var(--color-success-500);
|
|
512
550
|
}
|
|
551
|
+
.\!bg-primary-50 {
|
|
552
|
+
background-color: var(--color-primary-50) !important;
|
|
553
|
+
}
|
|
513
554
|
.bg-background {
|
|
514
555
|
background-color: var(--color-background);
|
|
515
556
|
}
|
|
@@ -621,6 +662,10 @@
|
|
|
621
662
|
font-size: var(--text-6xl);
|
|
622
663
|
line-height: var(--tw-leading, var(--text-6xl--line-height));
|
|
623
664
|
}
|
|
665
|
+
.text-base {
|
|
666
|
+
font-size: var(--text-base);
|
|
667
|
+
line-height: var(--tw-leading, var(--text-base--line-height));
|
|
668
|
+
}
|
|
624
669
|
.text-lg {
|
|
625
670
|
font-size: var(--text-lg);
|
|
626
671
|
line-height: var(--tw-leading, var(--text-lg--line-height));
|
|
@@ -676,6 +721,9 @@
|
|
|
676
721
|
.whitespace-nowrap {
|
|
677
722
|
white-space: nowrap;
|
|
678
723
|
}
|
|
724
|
+
.\!text-primary-950 {
|
|
725
|
+
color: var(--color-primary-950) !important;
|
|
726
|
+
}
|
|
679
727
|
.text-error-500 {
|
|
680
728
|
color: var(--color-error-500);
|
|
681
729
|
}
|
|
@@ -709,6 +757,9 @@
|
|
|
709
757
|
.capitalize {
|
|
710
758
|
text-transform: capitalize;
|
|
711
759
|
}
|
|
760
|
+
.italic {
|
|
761
|
+
font-style: italic;
|
|
762
|
+
}
|
|
712
763
|
.opacity-50 {
|
|
713
764
|
opacity: 50%;
|
|
714
765
|
}
|
|
@@ -825,6 +876,13 @@
|
|
|
825
876
|
}
|
|
826
877
|
}
|
|
827
878
|
}
|
|
879
|
+
.hover\:\!bg-primary-100 {
|
|
880
|
+
&:hover {
|
|
881
|
+
@media (hover: hover) {
|
|
882
|
+
background-color: var(--color-primary-100) !important;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
828
886
|
.hover\:bg-background-50 {
|
|
829
887
|
&:hover {
|
|
830
888
|
@media (hover: hover) {
|
|
@@ -1551,4 +1609,4 @@
|
|
|
1551
1609
|
}
|
|
1552
1610
|
}
|
|
1553
1611
|
}
|
|
1554
|
-
/*! tailwindcss v4.1.
|
|
1612
|
+
/*! tailwindcss v4.1.10 | MIT License | https://tailwindcss.com */
|
package/dist/index.d.mts
CHANGED
|
@@ -275,4 +275,77 @@ declare const NavButton: react.ForwardRefExoticComponent<{
|
|
|
275
275
|
className?: string;
|
|
276
276
|
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
/**
|
|
279
|
+
* IconButton component props interface
|
|
280
|
+
*/
|
|
281
|
+
type IconButtonProps = {
|
|
282
|
+
/** Ícone a ser exibido no botão */
|
|
283
|
+
icon: ReactNode;
|
|
284
|
+
/** Tamanho do botão */
|
|
285
|
+
size?: 'sm' | 'md';
|
|
286
|
+
/** Estado de seleção/ativo do botão - permanece ativo até ser clicado novamente ou outro botão ser ativado */
|
|
287
|
+
active?: boolean;
|
|
288
|
+
/** Additional CSS classes to apply */
|
|
289
|
+
className?: string;
|
|
290
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
291
|
+
/**
|
|
292
|
+
* IconButton component for Analytica Ensino platforms
|
|
293
|
+
*
|
|
294
|
+
* Um botão compacto apenas com ícone, ideal para menus dropdown,
|
|
295
|
+
* barras de ferramentas e ações secundárias.
|
|
296
|
+
* Oferece dois tamanhos com estilo consistente.
|
|
297
|
+
* Estado ativo permanece até ser clicado novamente ou outro botão ser ativado.
|
|
298
|
+
* Compatível com Next.js 15 e React 19.
|
|
299
|
+
* Suporta forwardRef para acesso programático ao elemento DOM.
|
|
300
|
+
*
|
|
301
|
+
* @param icon - O ícone a ser exibido no botão
|
|
302
|
+
* @param size - Tamanho do botão (sm, md)
|
|
303
|
+
* @param active - Estado ativo/selecionado do botão
|
|
304
|
+
* @param className - Classes CSS adicionais
|
|
305
|
+
* @param props - Todos os outros atributos HTML padrão de button
|
|
306
|
+
* @returns Um elemento button compacto estilizado apenas com ícone
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```tsx
|
|
310
|
+
* <IconButton
|
|
311
|
+
* icon={<MoreVerticalIcon />}
|
|
312
|
+
* size="sm"
|
|
313
|
+
* onClick={() => openMenu()}
|
|
314
|
+
* />
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```tsx
|
|
319
|
+
* // Botão ativo em uma barra de ferramentas - permanece ativo até outro clique
|
|
320
|
+
* <IconButton
|
|
321
|
+
* icon={<BoldIcon />}
|
|
322
|
+
* active={isBold}
|
|
323
|
+
* onClick={toggleBold}
|
|
324
|
+
* />
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```tsx
|
|
329
|
+
* // Usando ref para controle programático
|
|
330
|
+
* const buttonRef = useRef<HTMLButtonElement>(null);
|
|
331
|
+
*
|
|
332
|
+
* <IconButton
|
|
333
|
+
* ref={buttonRef}
|
|
334
|
+
* icon={<EditIcon />}
|
|
335
|
+
* size="md"
|
|
336
|
+
* onClick={() => startEditing()}
|
|
337
|
+
* />
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
declare const IconButton: react.ForwardRefExoticComponent<{
|
|
341
|
+
/** Ícone a ser exibido no botão */
|
|
342
|
+
icon: ReactNode;
|
|
343
|
+
/** Tamanho do botão */
|
|
344
|
+
size?: "sm" | "md";
|
|
345
|
+
/** Estado de seleção/ativo do botão - permanece ativo até ser clicado novamente ou outro botão ser ativado */
|
|
346
|
+
active?: boolean;
|
|
347
|
+
/** Additional CSS classes to apply */
|
|
348
|
+
className?: string;
|
|
349
|
+
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
350
|
+
|
|
351
|
+
export { Button, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text };
|
package/dist/index.d.ts
CHANGED
|
@@ -275,4 +275,77 @@ declare const NavButton: react.ForwardRefExoticComponent<{
|
|
|
275
275
|
className?: string;
|
|
276
276
|
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
/**
|
|
279
|
+
* IconButton component props interface
|
|
280
|
+
*/
|
|
281
|
+
type IconButtonProps = {
|
|
282
|
+
/** Ícone a ser exibido no botão */
|
|
283
|
+
icon: ReactNode;
|
|
284
|
+
/** Tamanho do botão */
|
|
285
|
+
size?: 'sm' | 'md';
|
|
286
|
+
/** Estado de seleção/ativo do botão - permanece ativo até ser clicado novamente ou outro botão ser ativado */
|
|
287
|
+
active?: boolean;
|
|
288
|
+
/** Additional CSS classes to apply */
|
|
289
|
+
className?: string;
|
|
290
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
291
|
+
/**
|
|
292
|
+
* IconButton component for Analytica Ensino platforms
|
|
293
|
+
*
|
|
294
|
+
* Um botão compacto apenas com ícone, ideal para menus dropdown,
|
|
295
|
+
* barras de ferramentas e ações secundárias.
|
|
296
|
+
* Oferece dois tamanhos com estilo consistente.
|
|
297
|
+
* Estado ativo permanece até ser clicado novamente ou outro botão ser ativado.
|
|
298
|
+
* Compatível com Next.js 15 e React 19.
|
|
299
|
+
* Suporta forwardRef para acesso programático ao elemento DOM.
|
|
300
|
+
*
|
|
301
|
+
* @param icon - O ícone a ser exibido no botão
|
|
302
|
+
* @param size - Tamanho do botão (sm, md)
|
|
303
|
+
* @param active - Estado ativo/selecionado do botão
|
|
304
|
+
* @param className - Classes CSS adicionais
|
|
305
|
+
* @param props - Todos os outros atributos HTML padrão de button
|
|
306
|
+
* @returns Um elemento button compacto estilizado apenas com ícone
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```tsx
|
|
310
|
+
* <IconButton
|
|
311
|
+
* icon={<MoreVerticalIcon />}
|
|
312
|
+
* size="sm"
|
|
313
|
+
* onClick={() => openMenu()}
|
|
314
|
+
* />
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```tsx
|
|
319
|
+
* // Botão ativo em uma barra de ferramentas - permanece ativo até outro clique
|
|
320
|
+
* <IconButton
|
|
321
|
+
* icon={<BoldIcon />}
|
|
322
|
+
* active={isBold}
|
|
323
|
+
* onClick={toggleBold}
|
|
324
|
+
* />
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```tsx
|
|
329
|
+
* // Usando ref para controle programático
|
|
330
|
+
* const buttonRef = useRef<HTMLButtonElement>(null);
|
|
331
|
+
*
|
|
332
|
+
* <IconButton
|
|
333
|
+
* ref={buttonRef}
|
|
334
|
+
* icon={<EditIcon />}
|
|
335
|
+
* size="md"
|
|
336
|
+
* onClick={() => startEditing()}
|
|
337
|
+
* />
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
declare const IconButton: react.ForwardRefExoticComponent<{
|
|
341
|
+
/** Ícone a ser exibido no botão */
|
|
342
|
+
icon: ReactNode;
|
|
343
|
+
/** Tamanho do botão */
|
|
344
|
+
size?: "sm" | "md";
|
|
345
|
+
/** Estado de seleção/ativo do botão - permanece ativo até ser clicado novamente ou outro botão ser ativado */
|
|
346
|
+
active?: boolean;
|
|
347
|
+
/** Additional CSS classes to apply */
|
|
348
|
+
className?: string;
|
|
349
|
+
} & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
350
|
+
|
|
351
|
+
export { Button, DropdownMenu, DropdownMenuTrigger, IconButton, type IconButtonProps, IconRoundedButton, MenuContent, MenuItem, MenuLabel, MenuSeparator, NavButton, SelectionButton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Text };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
Button: () => Button,
|
|
24
24
|
DropdownMenu: () => DropdownMenu,
|
|
25
25
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
26
|
+
IconButton: () => IconButton,
|
|
26
27
|
IconRoundedButton: () => IconRoundedButton,
|
|
27
28
|
MenuContent: () => MenuContent,
|
|
28
29
|
MenuItem: () => MenuItem,
|
|
@@ -596,11 +597,64 @@ var NavButton = (0, import_react4.forwardRef)(
|
|
|
596
597
|
}
|
|
597
598
|
);
|
|
598
599
|
NavButton.displayName = "NavButton";
|
|
600
|
+
|
|
601
|
+
// src/components/IconButton/IconButton.tsx
|
|
602
|
+
var import_react5 = require("react");
|
|
603
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
604
|
+
var IconButton = (0, import_react5.forwardRef)(
|
|
605
|
+
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
606
|
+
const baseClasses = [
|
|
607
|
+
"inline-flex",
|
|
608
|
+
"items-center",
|
|
609
|
+
"justify-center",
|
|
610
|
+
"rounded-lg",
|
|
611
|
+
"font-medium",
|
|
612
|
+
"bg-transparent",
|
|
613
|
+
"text-text-950",
|
|
614
|
+
"cursor-pointer",
|
|
615
|
+
"hover:bg-primary-600",
|
|
616
|
+
"hover:text-text",
|
|
617
|
+
"focus-visible:outline-none",
|
|
618
|
+
"focus-visible:ring-2",
|
|
619
|
+
"focus-visible:ring-offset-0",
|
|
620
|
+
"focus-visible:ring-indicator-info",
|
|
621
|
+
"disabled:opacity-50",
|
|
622
|
+
"disabled:cursor-not-allowed",
|
|
623
|
+
"disabled:pointer-events-none"
|
|
624
|
+
];
|
|
625
|
+
const sizeClasses = {
|
|
626
|
+
sm: ["w-6", "h-6", "text-sm"],
|
|
627
|
+
md: ["w-10", "h-10", "text-base"]
|
|
628
|
+
};
|
|
629
|
+
const activeClasses = active ? ["!bg-primary-50", "!text-primary-950", "hover:!bg-primary-100"] : [];
|
|
630
|
+
const allClasses = [
|
|
631
|
+
...baseClasses,
|
|
632
|
+
...sizeClasses[size],
|
|
633
|
+
...activeClasses
|
|
634
|
+
].join(" ");
|
|
635
|
+
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
637
|
+
"button",
|
|
638
|
+
{
|
|
639
|
+
ref,
|
|
640
|
+
type: "button",
|
|
641
|
+
className: `${allClasses} ${className}`,
|
|
642
|
+
disabled,
|
|
643
|
+
"aria-pressed": active,
|
|
644
|
+
"aria-label": ariaLabel,
|
|
645
|
+
...props,
|
|
646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
IconButton.displayName = "IconButton";
|
|
599
652
|
// Annotate the CommonJS export names for ESM import in node:
|
|
600
653
|
0 && (module.exports = {
|
|
601
654
|
Button,
|
|
602
655
|
DropdownMenu,
|
|
603
656
|
DropdownMenuTrigger,
|
|
657
|
+
IconButton,
|
|
604
658
|
IconRoundedButton,
|
|
605
659
|
MenuContent,
|
|
606
660
|
MenuItem,
|
package/dist/index.mjs
CHANGED
|
@@ -561,10 +561,63 @@ var NavButton = forwardRef4(
|
|
|
561
561
|
}
|
|
562
562
|
);
|
|
563
563
|
NavButton.displayName = "NavButton";
|
|
564
|
+
|
|
565
|
+
// src/components/IconButton/IconButton.tsx
|
|
566
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
567
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
568
|
+
var IconButton = forwardRef5(
|
|
569
|
+
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
570
|
+
const baseClasses = [
|
|
571
|
+
"inline-flex",
|
|
572
|
+
"items-center",
|
|
573
|
+
"justify-center",
|
|
574
|
+
"rounded-lg",
|
|
575
|
+
"font-medium",
|
|
576
|
+
"bg-transparent",
|
|
577
|
+
"text-text-950",
|
|
578
|
+
"cursor-pointer",
|
|
579
|
+
"hover:bg-primary-600",
|
|
580
|
+
"hover:text-text",
|
|
581
|
+
"focus-visible:outline-none",
|
|
582
|
+
"focus-visible:ring-2",
|
|
583
|
+
"focus-visible:ring-offset-0",
|
|
584
|
+
"focus-visible:ring-indicator-info",
|
|
585
|
+
"disabled:opacity-50",
|
|
586
|
+
"disabled:cursor-not-allowed",
|
|
587
|
+
"disabled:pointer-events-none"
|
|
588
|
+
];
|
|
589
|
+
const sizeClasses = {
|
|
590
|
+
sm: ["w-6", "h-6", "text-sm"],
|
|
591
|
+
md: ["w-10", "h-10", "text-base"]
|
|
592
|
+
};
|
|
593
|
+
const activeClasses = active ? ["!bg-primary-50", "!text-primary-950", "hover:!bg-primary-100"] : [];
|
|
594
|
+
const allClasses = [
|
|
595
|
+
...baseClasses,
|
|
596
|
+
...sizeClasses[size],
|
|
597
|
+
...activeClasses
|
|
598
|
+
].join(" ");
|
|
599
|
+
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
600
|
+
return /* @__PURE__ */ jsx8(
|
|
601
|
+
"button",
|
|
602
|
+
{
|
|
603
|
+
ref,
|
|
604
|
+
type: "button",
|
|
605
|
+
className: `${allClasses} ${className}`,
|
|
606
|
+
disabled,
|
|
607
|
+
"aria-pressed": active,
|
|
608
|
+
"aria-label": ariaLabel,
|
|
609
|
+
...props,
|
|
610
|
+
children: /* @__PURE__ */ jsx8("span", { className: "flex items-center justify-center", children: icon })
|
|
611
|
+
}
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
IconButton.displayName = "IconButton";
|
|
564
616
|
export {
|
|
565
617
|
Button,
|
|
566
618
|
DropdownMenu,
|
|
567
619
|
DropdownMenuTrigger,
|
|
620
|
+
IconButton,
|
|
568
621
|
IconRoundedButton,
|
|
569
622
|
MenuContent,
|
|
570
623
|
MenuItem,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "analytica-frontend-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"require": "./dist/index.cjs"
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"./styles.css": "./dist/index.css"
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
18
19
|
"lint": "npx eslint \"{src,app}/**/*.{js,jsx,ts,tsx}\" --fix",
|
|
@@ -47,11 +48,6 @@
|
|
|
47
48
|
"publishConfig": {
|
|
48
49
|
"access": "public"
|
|
49
50
|
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"next": ">=15.0.0",
|
|
52
|
-
"react": ">=19.0.0",
|
|
53
|
-
"react-dom": ">=19.0.0"
|
|
54
|
-
},
|
|
55
51
|
"author": "Analytica Ensino LTDA",
|
|
56
52
|
"license": "MIT",
|
|
57
53
|
"repository": {
|
|
@@ -62,10 +58,13 @@
|
|
|
62
58
|
"bugs": {
|
|
63
59
|
"url": "https://github.com/analytica-ensino/analytica-frontend-lib/issues"
|
|
64
60
|
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"next": ">=15.0.0",
|
|
63
|
+
"react": ">=19.0.0",
|
|
64
|
+
"react-dom": ">=19.0.0"
|
|
65
|
+
},
|
|
65
66
|
"dependencies": {
|
|
66
|
-
"phosphor-react": "^1.4.1"
|
|
67
|
-
"react": "^19.1.0",
|
|
68
|
-
"react-dom": "^19.1.0"
|
|
67
|
+
"phosphor-react": "^1.4.1"
|
|
69
68
|
},
|
|
70
69
|
"devDependencies": {
|
|
71
70
|
"@eslint/eslintrc": "^3.3.1",
|
|
@@ -95,6 +94,8 @@
|
|
|
95
94
|
"polished": "^4.3.1",
|
|
96
95
|
"postcss": "^8.5.4",
|
|
97
96
|
"prettier": "^3.5.3",
|
|
97
|
+
"react": "^19.1.0",
|
|
98
|
+
"react-dom": "^19.1.0",
|
|
98
99
|
"sonarqube-scanner": "^4.3.0",
|
|
99
100
|
"tailwindcss": "^4.1.8",
|
|
100
101
|
"ts-jest": "^29.3.4",
|