@mlw-packages/react-components 1.3.18 → 1.4.2
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 +114 -53
- package/dist/index.css +103 -10
- package/dist/index.d.mts +130 -67
- package/dist/index.d.ts +130 -67
- package/dist/index.js +451 -606
- package/dist/index.mjs +435 -432
- package/package.json +104 -95
package/README.md
CHANGED
|
@@ -1,53 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
|
|
2
|
+
# @mlw-packages/react-components
|
|
3
|
+
|
|
4
|
+
Biblioteca de componentes React reutilizáveis, focada em acelerar o desenvolvimento de aplicações web modernas, acessíveis e com design consistente. Construída com Tailwind CSS para máxima customização, performance e escalabilidade.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Instalação
|
|
9
|
+
|
|
10
|
+
Instale via npm ou yarn:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @mlw-packages/react-components
|
|
14
|
+
# ou
|
|
15
|
+
yarn add @mlw-packages/react-components
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Uso Básico
|
|
21
|
+
|
|
22
|
+
Importe os componentes que precisa e use direto no JSX:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { ButtonBase, CardBase } from '@mlw-packages/react-components';
|
|
26
|
+
|
|
27
|
+
export function App() {
|
|
28
|
+
return (
|
|
29
|
+
<CardBase>
|
|
30
|
+
<ButtonBase>Meu botão</ButtonBase>
|
|
31
|
+
</CardBase>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Componentes Disponíveis
|
|
39
|
+
|
|
40
|
+
A biblioteca oferece uma gama completa de componentes UI prontos para produção, todos estilizados com Tailwind CSS e pensados para alta acessibilidade:
|
|
41
|
+
|
|
42
|
+
- **ButtonBase** — Botões com variantes e estados customizados.
|
|
43
|
+
- **CardBase** — Containers card com estrutura padrão.
|
|
44
|
+
- **InputBase**, **SelectBase**, **ComboboxBase** — Controles de formulário modernos.
|
|
45
|
+
- **CheckboxBase**, **SwitchBase** — Inputs booleanos.
|
|
46
|
+
- **TabsBase**, **TableBase**, **TooltipBase**, **DialogBase**, **DrawerBase** — Navegação e modais.
|
|
47
|
+
- **SidebarBase**, **AvatarBase**, **CalendarBase**, **CarouselBase**, **ProgressBase**, **SkeletonBase** — Componentes utilitários e visuais.
|
|
48
|
+
- **SonnerBase** — Sistema de notificações toast com feedback visual.
|
|
49
|
+
|
|
50
|
+
> Para a lista completa, confira a pasta `src/components/ui` no código fonte.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Estilos e Customização
|
|
55
|
+
|
|
56
|
+
Todos os componentes são estilizados com **Tailwind CSS**. Para que funcionem corretamente, seu projeto deve estar configurado com Tailwind.
|
|
57
|
+
|
|
58
|
+
Importe o CSS global para aplicar estilos base da biblioteca:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import '@mlw-packages/react-components/style/global.css';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
A arquitetura dos componentes segue as melhores práticas:
|
|
65
|
+
|
|
66
|
+
- **Código limpo e DRY** para facilitar manutenção e evolução.
|
|
67
|
+
- **Alta performance** com React 18 e otimizações internas.
|
|
68
|
+
- **Flexibilidade** para customizar via props, classes e hooks.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Data-testid para Testes Automatizados
|
|
73
|
+
|
|
74
|
+
Todos os componentes aceitam **props opcionais** para customizar `data-testid` nos elementos internos, garantindo que seu time de QA consiga criar testes e2e robustos e confiáveis.
|
|
75
|
+
|
|
76
|
+
Exemplo no `ComboboxBase`:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<ComboboxBase
|
|
80
|
+
items={items}
|
|
81
|
+
renderSelected={renderSelected}
|
|
82
|
+
handleSelection={handleSelection}
|
|
83
|
+
checkIsSelected={checkIsSelected}
|
|
84
|
+
searchPlaceholder="Busque uma opção"
|
|
85
|
+
testIds={{
|
|
86
|
+
root: "combobox-root",
|
|
87
|
+
trigger: "combobox-trigger",
|
|
88
|
+
popover: "combobox-popover",
|
|
89
|
+
option: (value) => `combobox-option-${value}`,
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Documentação e Exemplos
|
|
97
|
+
|
|
98
|
+
Explore exemplos completos e documentação técnica na pasta `src/pages` dentro do repositório, incluindo:
|
|
99
|
+
|
|
100
|
+
- Uso avançado de componentes.
|
|
101
|
+
- Configurações de tema e responsividade.
|
|
102
|
+
- Exemplos de integração com testes e acessibilidade.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Contribuição
|
|
107
|
+
|
|
108
|
+
Contribuições são super bem-vindas!
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Licença
|
|
113
|
+
|
|
114
|
+
MIT License — sinta-se livre para usar, modificar e distribuir.
|
package/dist/index.css
CHANGED
|
@@ -564,6 +564,10 @@ body {
|
|
|
564
564
|
margin-top: 1.25rem;
|
|
565
565
|
margin-bottom: 1.25rem;
|
|
566
566
|
}
|
|
567
|
+
.my-6 {
|
|
568
|
+
margin-top: 1.5rem;
|
|
569
|
+
margin-bottom: 1.5rem;
|
|
570
|
+
}
|
|
567
571
|
.my-8 {
|
|
568
572
|
margin-top: 2rem;
|
|
569
573
|
margin-bottom: 2rem;
|
|
@@ -839,6 +843,9 @@ body {
|
|
|
839
843
|
.min-h-0 {
|
|
840
844
|
min-height: 0px;
|
|
841
845
|
}
|
|
846
|
+
.min-h-\[220px\] {
|
|
847
|
+
min-height: 220px;
|
|
848
|
+
}
|
|
842
849
|
.min-h-\[60px\] {
|
|
843
850
|
min-height: 60px;
|
|
844
851
|
}
|
|
@@ -950,9 +957,6 @@ body {
|
|
|
950
957
|
.w-\[300px\] {
|
|
951
958
|
width: 300px;
|
|
952
959
|
}
|
|
953
|
-
.w-\[320px\] {
|
|
954
|
-
width: 320px;
|
|
955
|
-
}
|
|
956
960
|
.w-\[350px\] {
|
|
957
961
|
width: 350px;
|
|
958
962
|
}
|
|
@@ -1027,6 +1031,9 @@ body {
|
|
|
1027
1031
|
.max-w-\[--skeleton-width\] {
|
|
1028
1032
|
max-width: var(--skeleton-width);
|
|
1029
1033
|
}
|
|
1034
|
+
.max-w-\[1100px\] {
|
|
1035
|
+
max-width: 1100px;
|
|
1036
|
+
}
|
|
1030
1037
|
.max-w-\[210px\] {
|
|
1031
1038
|
max-width: 210px;
|
|
1032
1039
|
}
|
|
@@ -1043,9 +1050,6 @@ body {
|
|
|
1043
1050
|
max-width: -moz-max-content;
|
|
1044
1051
|
max-width: max-content;
|
|
1045
1052
|
}
|
|
1046
|
-
.max-w-md {
|
|
1047
|
-
max-width: 28rem;
|
|
1048
|
-
}
|
|
1049
1053
|
.max-w-sm {
|
|
1050
1054
|
max-width: 24rem;
|
|
1051
1055
|
}
|
|
@@ -1155,6 +1159,16 @@ body {
|
|
|
1155
1159
|
-moz-user-select: none;
|
|
1156
1160
|
user-select: none;
|
|
1157
1161
|
}
|
|
1162
|
+
.select-text {
|
|
1163
|
+
-webkit-user-select: text;
|
|
1164
|
+
-moz-user-select: text;
|
|
1165
|
+
user-select: text;
|
|
1166
|
+
}
|
|
1167
|
+
.select-all {
|
|
1168
|
+
-webkit-user-select: all;
|
|
1169
|
+
-moz-user-select: all;
|
|
1170
|
+
user-select: all;
|
|
1171
|
+
}
|
|
1158
1172
|
.list-none {
|
|
1159
1173
|
list-style-type: none;
|
|
1160
1174
|
}
|
|
@@ -1476,6 +1490,14 @@ body {
|
|
|
1476
1490
|
--tw-border-opacity: 1;
|
|
1477
1491
|
border-color: rgb(239 68 68 / var(--tw-border-opacity, 1));
|
|
1478
1492
|
}
|
|
1493
|
+
.border-slate-200 {
|
|
1494
|
+
--tw-border-opacity: 1;
|
|
1495
|
+
border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));
|
|
1496
|
+
}
|
|
1497
|
+
.border-slate-300 {
|
|
1498
|
+
--tw-border-opacity: 1;
|
|
1499
|
+
border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));
|
|
1500
|
+
}
|
|
1479
1501
|
.border-transparent {
|
|
1480
1502
|
border-color: transparent;
|
|
1481
1503
|
}
|
|
@@ -1560,10 +1582,6 @@ body {
|
|
|
1560
1582
|
--tw-bg-opacity: 1;
|
|
1561
1583
|
background-color: rgb(38 38 38 / var(--tw-bg-opacity, 1));
|
|
1562
1584
|
}
|
|
1563
|
-
.bg-neutral-950 {
|
|
1564
|
-
--tw-bg-opacity: 1;
|
|
1565
|
-
background-color: rgb(10 10 10 / var(--tw-bg-opacity, 1));
|
|
1566
|
-
}
|
|
1567
1585
|
.bg-popover {
|
|
1568
1586
|
background-color: hsl(var(--popover));
|
|
1569
1587
|
}
|
|
@@ -1587,6 +1605,10 @@ body {
|
|
|
1587
1605
|
--tw-bg-opacity: 1;
|
|
1588
1606
|
background-color: rgb(241 245 249 / var(--tw-bg-opacity, 1));
|
|
1589
1607
|
}
|
|
1608
|
+
.bg-slate-200 {
|
|
1609
|
+
--tw-bg-opacity: 1;
|
|
1610
|
+
background-color: rgb(226 232 240 / var(--tw-bg-opacity, 1));
|
|
1611
|
+
}
|
|
1590
1612
|
.bg-transparent {
|
|
1591
1613
|
background-color: transparent;
|
|
1592
1614
|
}
|
|
@@ -1721,6 +1743,10 @@ body {
|
|
|
1721
1743
|
padding-top: 2.5rem;
|
|
1722
1744
|
padding-bottom: 2.5rem;
|
|
1723
1745
|
}
|
|
1746
|
+
.py-12 {
|
|
1747
|
+
padding-top: 3rem;
|
|
1748
|
+
padding-bottom: 3rem;
|
|
1749
|
+
}
|
|
1724
1750
|
.py-16 {
|
|
1725
1751
|
padding-top: 4rem;
|
|
1726
1752
|
padding-bottom: 4rem;
|
|
@@ -1744,6 +1770,9 @@ body {
|
|
|
1744
1770
|
.pb-0 {
|
|
1745
1771
|
padding-bottom: 0px;
|
|
1746
1772
|
}
|
|
1773
|
+
.pb-1 {
|
|
1774
|
+
padding-bottom: 0.25rem;
|
|
1775
|
+
}
|
|
1747
1776
|
.pb-3 {
|
|
1748
1777
|
padding-bottom: 0.75rem;
|
|
1749
1778
|
}
|
|
@@ -1932,6 +1961,10 @@ body {
|
|
|
1932
1961
|
--tw-text-opacity: 1;
|
|
1933
1962
|
color: rgb(21 128 61 / var(--tw-text-opacity, 1));
|
|
1934
1963
|
}
|
|
1964
|
+
.text-indigo-600 {
|
|
1965
|
+
--tw-text-opacity: 1;
|
|
1966
|
+
color: rgb(79 70 229 / var(--tw-text-opacity, 1));
|
|
1967
|
+
}
|
|
1935
1968
|
.text-muted-foreground {
|
|
1936
1969
|
color: hsl(var(--muted-foreground));
|
|
1937
1970
|
}
|
|
@@ -1983,6 +2016,18 @@ body {
|
|
|
1983
2016
|
--tw-text-opacity: 1;
|
|
1984
2017
|
color: rgb(100 116 139 / var(--tw-text-opacity, 1));
|
|
1985
2018
|
}
|
|
2019
|
+
.text-slate-600 {
|
|
2020
|
+
--tw-text-opacity: 1;
|
|
2021
|
+
color: rgb(71 85 105 / var(--tw-text-opacity, 1));
|
|
2022
|
+
}
|
|
2023
|
+
.text-slate-700 {
|
|
2024
|
+
--tw-text-opacity: 1;
|
|
2025
|
+
color: rgb(51 65 85 / var(--tw-text-opacity, 1));
|
|
2026
|
+
}
|
|
2027
|
+
.text-slate-800 {
|
|
2028
|
+
--tw-text-opacity: 1;
|
|
2029
|
+
color: rgb(30 41 59 / var(--tw-text-opacity, 1));
|
|
2030
|
+
}
|
|
1986
2031
|
.text-slate-900 {
|
|
1987
2032
|
--tw-text-opacity: 1;
|
|
1988
2033
|
color: rgb(15 23 42 / var(--tw-text-opacity, 1));
|
|
@@ -3529,6 +3574,14 @@ body {
|
|
|
3529
3574
|
--tw-border-opacity: 1;
|
|
3530
3575
|
border-color: rgb(17 24 39 / var(--tw-border-opacity, 1));
|
|
3531
3576
|
}
|
|
3577
|
+
.dark\:border-slate-600:is(.dark *) {
|
|
3578
|
+
--tw-border-opacity: 1;
|
|
3579
|
+
border-color: rgb(71 85 105 / var(--tw-border-opacity, 1));
|
|
3580
|
+
}
|
|
3581
|
+
.dark\:border-slate-700:is(.dark *) {
|
|
3582
|
+
--tw-border-opacity: 1;
|
|
3583
|
+
border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));
|
|
3584
|
+
}
|
|
3532
3585
|
.dark\:border-transparent:is(.dark *) {
|
|
3533
3586
|
border-color: transparent;
|
|
3534
3587
|
}
|
|
@@ -3560,6 +3613,16 @@ body {
|
|
|
3560
3613
|
--tw-bg-opacity: 1;
|
|
3561
3614
|
background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));
|
|
3562
3615
|
}
|
|
3616
|
+
.dark\:bg-slate-700:is(.dark *) {
|
|
3617
|
+
--tw-bg-opacity: 1;
|
|
3618
|
+
background-color: rgb(51 65 85 / var(--tw-bg-opacity, 1));
|
|
3619
|
+
}
|
|
3620
|
+
.dark\:bg-slate-900\/30:is(.dark *) {
|
|
3621
|
+
background-color: rgb(15 23 42 / 0.3);
|
|
3622
|
+
}
|
|
3623
|
+
.dark\:bg-slate-900\/40:is(.dark *) {
|
|
3624
|
+
background-color: rgb(15 23 42 / 0.4);
|
|
3625
|
+
}
|
|
3563
3626
|
.dark\:bg-zinc-500:is(.dark *) {
|
|
3564
3627
|
--tw-bg-opacity: 1;
|
|
3565
3628
|
background-color: rgb(113 113 122 / var(--tw-bg-opacity, 1));
|
|
@@ -3583,10 +3646,26 @@ body {
|
|
|
3583
3646
|
--tw-text-opacity: 1;
|
|
3584
3647
|
color: rgb(209 213 219 / var(--tw-text-opacity, 1));
|
|
3585
3648
|
}
|
|
3649
|
+
.dark\:text-indigo-400:is(.dark *) {
|
|
3650
|
+
--tw-text-opacity: 1;
|
|
3651
|
+
color: rgb(129 140 248 / var(--tw-text-opacity, 1));
|
|
3652
|
+
}
|
|
3586
3653
|
.dark\:text-neutral-300:is(.dark *) {
|
|
3587
3654
|
--tw-text-opacity: 1;
|
|
3588
3655
|
color: rgb(212 212 212 / var(--tw-text-opacity, 1));
|
|
3589
3656
|
}
|
|
3657
|
+
.dark\:text-slate-100:is(.dark *) {
|
|
3658
|
+
--tw-text-opacity: 1;
|
|
3659
|
+
color: rgb(241 245 249 / var(--tw-text-opacity, 1));
|
|
3660
|
+
}
|
|
3661
|
+
.dark\:text-slate-200:is(.dark *) {
|
|
3662
|
+
--tw-text-opacity: 1;
|
|
3663
|
+
color: rgb(226 232 240 / var(--tw-text-opacity, 1));
|
|
3664
|
+
}
|
|
3665
|
+
.dark\:text-slate-300:is(.dark *) {
|
|
3666
|
+
--tw-text-opacity: 1;
|
|
3667
|
+
color: rgb(203 213 225 / var(--tw-text-opacity, 1));
|
|
3668
|
+
}
|
|
3590
3669
|
.dark\:text-slate-400:is(.dark *) {
|
|
3591
3670
|
--tw-text-opacity: 1;
|
|
3592
3671
|
color: rgb(148 163 184 / var(--tw-text-opacity, 1));
|
|
@@ -3651,6 +3730,9 @@ body {
|
|
|
3651
3730
|
.sm\:max-w-sm {
|
|
3652
3731
|
max-width: 24rem;
|
|
3653
3732
|
}
|
|
3733
|
+
.sm\:grid-cols-2 {
|
|
3734
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
3735
|
+
}
|
|
3654
3736
|
.sm\:flex-row {
|
|
3655
3737
|
flex-direction: row;
|
|
3656
3738
|
}
|
|
@@ -3681,6 +3763,10 @@ body {
|
|
|
3681
3763
|
.sm\:rounded-lg {
|
|
3682
3764
|
border-radius: var(--radius);
|
|
3683
3765
|
}
|
|
3766
|
+
.sm\:px-6 {
|
|
3767
|
+
padding-left: 1.5rem;
|
|
3768
|
+
padding-right: 1.5rem;
|
|
3769
|
+
}
|
|
3684
3770
|
.sm\:text-left {
|
|
3685
3771
|
text-align: left;
|
|
3686
3772
|
}
|
|
@@ -3799,9 +3885,16 @@ body {
|
|
|
3799
3885
|
.lg\:basis-1\/3 {
|
|
3800
3886
|
flex-basis: 33.333333%;
|
|
3801
3887
|
}
|
|
3888
|
+
.lg\:grid-cols-3 {
|
|
3889
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
3890
|
+
}
|
|
3802
3891
|
.lg\:grid-cols-\[\.75fr_1fr\] {
|
|
3803
3892
|
grid-template-columns: .75fr 1fr;
|
|
3804
3893
|
}
|
|
3894
|
+
.lg\:px-8 {
|
|
3895
|
+
padding-left: 2rem;
|
|
3896
|
+
padding-right: 2rem;
|
|
3897
|
+
}
|
|
3805
3898
|
}
|
|
3806
3899
|
.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button {
|
|
3807
3900
|
-webkit-appearance: none;
|