@credithub/harlan-components 1.47.0 → 1.48.0

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.
@@ -21,12 +21,15 @@ var Title = styled.h2(templateObject_4 || (templateObject_4 = __makeTemplateObje
21
21
  var theme = _a.theme;
22
22
  return theme.colors.azulCredithub;
23
23
  });
24
- var CloseButton = styled.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: absolute;\n top: 16px;\n right: 16px;\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"], ["\n position: absolute;\n top: 16px;\n right: 16px;\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"])), function (_a) {
24
+ var CloseButton = styled.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n all: unset;\n position: absolute;\n top: 12px;\n right: 12px;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n font-weight: bold;\n cursor: pointer;\n color: ", ";\n border-radius: 50%;\n transition:\n background 0.3s ease,\n color 0.3s ease;\n\n &:hover {\n background: ", ";\n color: ", ";\n }\n"], ["\n all: unset;\n position: absolute;\n top: 12px;\n right: 12px;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n font-weight: bold;\n cursor: pointer;\n color: ", ";\n border-radius: 50%;\n transition:\n background 0.3s ease,\n color 0.3s ease;\n\n &:hover {\n background: ", ";\n color: ", ";\n }\n"])), function (_a) {
25
25
  var theme = _a.theme;
26
26
  return theme.colors.cinzaEscuro;
27
27
  }, function (_a) {
28
28
  var theme = _a.theme;
29
- return theme.colors.azulApoio;
29
+ return theme.colors.cinzaBase;
30
+ }, function (_a) {
31
+ var theme = _a.theme;
32
+ return theme.colors.azulCredithub;
30
33
  });
31
34
  var Message = styled.p(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n color: ", ";\n line-height: 1.6;\n text-align: center;\n margin-top: 16px;\n margin-bottom: 24px;\n"], ["\n ", ";\n color: ", ";\n line-height: 1.6;\n text-align: center;\n margin-top: 16px;\n margin-bottom: 24px;\n"])), function (_a) {
32
35
  var theme = _a.theme;
@@ -30,6 +30,7 @@ import AddItem from '../common/addItem';
30
30
  import Button from '../common/button';
31
31
  import { Result, ResultContent } from '../interface/result';
32
32
  import EnvolvidosList from './envolvidosList';
33
+ import { sortProcessosByDate } from '../../utils/sortProcessosByDate';
33
34
  var AddProcessoJuridicoField = function (_a) {
34
35
  var value = _a.value, props = __rest(_a, ["value"]);
35
36
  return (React.createElement(AddItem, __assign({}, props, { value: value || 'Não Informado' })));
@@ -56,7 +57,8 @@ var ResultList = styled(Result)(templateObject_4 || (templateObject_4 = __makeTe
56
57
  });
57
58
  var ProcessosJuridicosList = function (_a) {
58
59
  var processos = _a.processos, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
59
- return (React.createElement(ResultList, { resultContentStriped: false }, processos.map(function (processo, i) { return (React.createElement("div", { key: i },
60
+ var sortedProcessos = sortProcessosByDate(processos);
61
+ return (React.createElement(ResultList, { resultContentStriped: false }, sortedProcessos.map(function (processo, i) { return (React.createElement("div", { key: i },
60
62
  React.createElement(ProcessoJuridicoItem, { processo: processo },
61
63
  React.createElement(ConsultarProcessoBtn, { onClick: onClickConsultarProcessoJuridico
62
64
  ? function () { return onClickConsultarProcessoJuridico(processo.id); }
@@ -0,0 +1,4 @@
1
+ export declare const extractDateFromCNJ: (cnj: string) => Date | null;
2
+ export declare const sortProcessosByDate: <T extends {
3
+ numero_novo: string;
4
+ }>(processos: T[]) => T[];
@@ -0,0 +1,33 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ export var extractDateFromCNJ = function (cnj) {
11
+ var dateRegex = /\b(\d{4})\.(\d{1,2})\.(\d{1,2})\b/;
12
+ var match = cnj.match(dateRegex);
13
+ if (match) {
14
+ var _1 = match[0], year = match[1], month = match[2], day = match[3];
15
+ return new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
16
+ }
17
+ return null;
18
+ };
19
+ export var sortProcessosByDate = function (processos) {
20
+ try {
21
+ return __spreadArray([], processos, true).sort(function (a, b) {
22
+ var dateA = extractDateFromCNJ(a.numero_novo);
23
+ var dateB = extractDateFromCNJ(b.numero_novo);
24
+ if (!dateA || !dateB)
25
+ return 0;
26
+ return dateB.getTime() - dateA.getTime();
27
+ });
28
+ }
29
+ catch (error) {
30
+ console.error('Erro ao ordenar processos por data:', error);
31
+ return processos;
32
+ }
33
+ };