wca-designsystem 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.16",
2
+ "version": "0.0.18",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -88,10 +88,10 @@
88
88
  "typescript": "^5.4.5"
89
89
  },
90
90
  "dependencies": {
91
- "@mantine/core": "7.10.1",
92
- "@mantine/dates": "^7.10.1",
93
- "@mantine/form": "^7.9.2",
94
- "@mantine/hooks": "7.10.1",
91
+ "@mantine/core": "7.12.2",
92
+ "@mantine/dates": "^7.12.2",
93
+ "@mantine/form": "^7.12.2",
94
+ "@mantine/hooks": "7.12.2",
95
95
  "@tanstack/query-sync-storage-persister": "^5.40.0",
96
96
  "@tanstack/react-query": "^5.40.1",
97
97
  "@tanstack/react-query-persist-client": "^5.40.1",
@@ -25,6 +25,7 @@ describe('AppShelCollapsed rendering', () => {
25
25
 
26
26
  const { getByTestId } = render(
27
27
  <ConchaAplicacao
28
+ activeLink=""
28
29
  isNavHover={true}
29
30
  modulo="exemplo"
30
31
  notificacoes={mockNotifications}
@@ -15,12 +15,14 @@ type ConchaAplicacaolType = {
15
15
  isNavHover: boolean;
16
16
  navbarRef?: React.RefObject<HTMLDivElement>;
17
17
  temNotificacoes?: boolean;
18
+ activeLink: string;
18
19
  };
19
20
  export function ConchaAplicacao({
20
21
  children,
21
22
  modulo,
22
23
  temNotificacoes,
23
24
  isNavHover,
25
+ activeLink,
24
26
  notificacoes,
25
27
  links,
26
28
  navbarRef,
@@ -40,7 +42,12 @@ export function ConchaAplicacao({
40
42
  transitionDuration={3}
41
43
  >
42
44
  <S.ConchaAplicacaoNavbarWrapper ref={navbarRef} data-active={isNavHover}>
43
- <Navbar modulo={modulo} isHover={isNavHover} links={links} />
45
+ <Navbar
46
+ activeLink={activeLink}
47
+ modulo={modulo}
48
+ isHover={isNavHover}
49
+ links={links}
50
+ />
44
51
  </S.ConchaAplicacaoNavbarWrapper>
45
52
  <S.ConchaAplicacaoMainWrapper>
46
53
  <Container fluid>
@@ -12,6 +12,7 @@ const props = {
12
12
  isHover: true,
13
13
  links: LinksDinamicosMock,
14
14
  module: 'Exemplo',
15
+ activeLink: 'Usuários',
15
16
  };
16
17
 
17
18
  const Template: any = (args: NavbarType) => (
@@ -7,14 +7,24 @@ import { LinksDinamicosMock } from './mocks';
7
7
  describe('Navbar está renderizando corretamente', () => {
8
8
  test('Renderizando todos componentes internos', () => {
9
9
  const { getByTestId } = render(
10
- <Navbar modulo="exemplo" isHover={false} links={LinksDinamicosMock} />
10
+ <Navbar
11
+ activeLink=""
12
+ modulo="exemplo"
13
+ isHover={false}
14
+ links={LinksDinamicosMock}
15
+ />
11
16
  );
12
17
  expect(getByTestId('navbar')).toBeDefined();
13
18
  });
14
19
 
15
20
  test('Abre o navbar com hover', () => {
16
21
  const { getByTestId, queryByText } = render(
17
- <Navbar modulo="exemplo" isHover={true} links={LinksDinamicosMock} />
22
+ <Navbar
23
+ activeLink=""
24
+ modulo="exemplo"
25
+ isHover={true}
26
+ links={LinksDinamicosMock}
27
+ />
18
28
  );
19
29
 
20
30
  const FooterNavbar = queryByText('Precisa de ajuda');
@@ -18,8 +18,9 @@ export type NavbarType = {
18
18
  isHover: boolean;
19
19
  modulo: string;
20
20
  links?: LinksProps[];
21
+ activeLink: string;
21
22
  };
22
- const Navbar = ({ isHover, links, modulo }: NavbarType) => {
23
+ const Navbar = ({ isHover, links, modulo, activeLink }: NavbarType) => {
23
24
  const LogoHeader = useMemo(() => (isHover ? Logo : LogoInitial), [isHover]);
24
25
 
25
26
  return (
@@ -60,7 +61,11 @@ const Navbar = ({ isHover, links, modulo }: NavbarType) => {
60
61
  modulo={modulo}
61
62
  icon={CiclosEncerrados}
62
63
  />
63
- <GrupoDeLinks links={links} isNavHover={isHover} />
64
+ <GrupoDeLinks
65
+ activeLink={activeLink}
66
+ links={links}
67
+ isNavHover={isHover}
68
+ />
64
69
  </S.NabarBody>
65
70
  </FadingComponent>
66
71
 
@@ -6,7 +6,7 @@ import { render } from '../../../test/render';
6
6
  describe('LinkGroup está renderizando corretamente', () => {
7
7
  test('Renderizando todos Links internos', () => {
8
8
  const { getByText } = render(
9
- <LinkGroup isNavHover={true} links={LinksDinamicosMock} />
9
+ <LinkGroup activeLink="" isNavHover={true} links={LinksDinamicosMock} />
10
10
  );
11
11
  expect(getByText('Usuários')).toBeDefined();
12
12
  });
@@ -1,7 +1,6 @@
1
1
  import React, { memo, useState } from 'react';
2
2
  import * as S from './styles';
3
3
  import LinkNavbar from '../../atomos/LinkNavbar';
4
- import { FadingComponent } from '../../atomos/FadeAnimacao';
5
4
 
6
5
  export interface LinksProps {
7
6
  label: string;
@@ -12,11 +11,12 @@ export interface LinksProps {
12
11
  }
13
12
  interface GrupoDeLinksProps {
14
13
  isNavHover: boolean;
14
+ activeLink: string;
15
15
  links?: LinksProps[];
16
16
  }
17
17
 
18
- const GrupoDeLinks = ({ links, isNavHover }: GrupoDeLinksProps) => {
19
- const [selected, setSelected] = useState(links![0].label ?? '');
18
+ const GrupoDeLinks = ({ links, isNavHover, activeLink }: GrupoDeLinksProps) => {
19
+ const [selected, setSelected] = useState(activeLink);
20
20
 
21
21
  const LinkToRender = links?.map((item) => (
22
22
  <S.LinkActive
@@ -29,11 +29,7 @@ const GrupoDeLinks = ({ links, isNavHover }: GrupoDeLinksProps) => {
29
29
  </S.LinkActive>
30
30
  ));
31
31
 
32
- return (
33
- <S.LinkGroupWrapper>
34
- <FadingComponent duration={500}>{LinkToRender}</FadingComponent>
35
- </S.LinkGroupWrapper>
36
- );
32
+ return <S.LinkGroupWrapper>{LinkToRender}</S.LinkGroupWrapper>;
37
33
  };
38
34
 
39
35
  export default memo(GrupoDeLinks);
@@ -8,6 +8,7 @@ describe('Tabela Header', () => {
8
8
  it('Renderiza corretamente', () => {
9
9
  const { getByText } = render(
10
10
  <TabelaHeader
11
+ setSimples={() => console.log('auqi')}
11
12
  setPagination={() => console.log('auqi')}
12
13
  toogleBuscarColuna={false}
13
14
  setToogleBuscarColuna={() => console.log('aqui')}
@@ -29,6 +30,7 @@ describe('Tabela Header', () => {
29
30
 
30
31
  const { getByText } = render(
31
32
  <TabelaHeader
33
+ setSimples={() => console.log('auqi')}
32
34
  setPagination={() => console.log('auqi')}
33
35
  toogleBuscarColuna={false}
34
36
  setToogleBuscarColuna={() => console.log('aqui')}
@@ -38,6 +38,7 @@ export type TabelaHeaderProps<T extends MRT_RowData> = {
38
38
  toogleBuscarColuna: boolean;
39
39
  table?: MRT_TableInstance<T>;
40
40
  setPagination: React.Dispatch<React.SetStateAction<MRT_PaginationState>>;
41
+ setSimples: React.Dispatch<React.SetStateAction<boolean>>;
41
42
  };
42
43
  const TabelaHeader = <T extends MRT_RowData>({
43
44
  tituloTabela,
@@ -46,6 +47,7 @@ const TabelaHeader = <T extends MRT_RowData>({
46
47
  filtrosPor,
47
48
  setFiltrosPor,
48
49
  setPagination,
50
+ setSimples,
49
51
  exportarXlsx,
50
52
  handleAdicionar,
51
53
  filtrosPelaTabela,
@@ -68,6 +70,7 @@ const TabelaHeader = <T extends MRT_RowData>({
68
70
  tipo="table"
69
71
  leftSection={<Icone fill={theme.colors.blue} svg={buscar} />}
70
72
  onChange={(e) => {
73
+ setSimples(true);
71
74
  setPagination({ pageIndex: 0, pageSize: 10 });
72
75
  setGlobalFilter(e.currentTarget.value);
73
76
  }}
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Table } from '@mantine/core';
3
3
  import * as S from './styles';
4
- import {
5
- MRT_PaginationState,
6
- MRT_RowData,
7
- MRT_TableInstance,
8
- } from 'mantine-react-table';
4
+ import { MRT_RowData, MRT_TableInstance } from 'mantine-react-table';
9
5
  import { theme } from '../../../styles/theme';
10
6
  import Icone from '../../atomos/Icone';
11
7
  import InputDeTexto from '../../atomos/InputDeTexto';
@@ -231,6 +231,7 @@ function Tabela<T extends MRT_RowData>({
231
231
  <S.TabelaWrapper>
232
232
  {/* Filtros e titulo */}
233
233
  <TabelaHeader<T>
234
+ setSimples={() => console.log('aqui')}
234
235
  setPagination={setPagination}
235
236
  table={table}
236
237
  toogleBuscarColuna={toogleBuscarColuna}