@credithub/harlan-components 1.103.0 → 1.103.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.
@@ -22,18 +22,26 @@ var TooltipTitle = styled.div(templateObject_6 || (templateObject_6 = __makeTemp
22
22
  var theme = _a.theme;
23
23
  return theme.colors.azulCredithub;
24
24
  });
25
- var TooltipMessage = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 13px;\n line-height: 1.4;\n"], ["\n font-size: 13px;\n line-height: 1.4;\n"])));
25
+ var TooltipMessage = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 13px;\n line-height: 1.4;\n color: ", ";\n opacity: 0.85;\n"], ["\n font-size: 13px;\n line-height: 1.4;\n color: ", ";\n opacity: 0.85;\n"])), function (_a) {
26
+ var theme = _a.theme;
27
+ return theme.colors.cinzaEscuro;
28
+ });
29
+ var SkipButton = styled.button(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin-top: 8px;\n padding: 8px 16px;\n background-color: ", ";\n color: white;\n border: none;\n border-radius: 4px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s ease;\n white-space: nowrap;\n\n &:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n }\n\n &:active {\n transform: translateY(0);\n }\n"], ["\n margin-top: 8px;\n padding: 8px 16px;\n background-color: ", ";\n color: white;\n border: none;\n border-radius: 4px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s ease;\n white-space: nowrap;\n\n &:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n }\n\n &:active {\n transform: translateY(0);\n }\n"])), function (_a) {
30
+ var theme = _a.theme;
31
+ return theme.colors.azulCredithub;
32
+ });
26
33
  var PrintButton = function (_a) {
27
- var onClick = _a.onClick, _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, _c = _a.tooltipMessage, tooltipMessage = _c === void 0 ? 'Aguardando consultas finalizarem...' : _c;
34
+ var onClick = _a.onClick, _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, _c = _a.tooltipMessage, tooltipMessage = _c === void 0 ? 'Carregando dados das consultas...' : _c;
28
35
  var button = (React.createElement(BtnWrapper, { onClick: !isLoading ? onClick : undefined },
29
36
  React.createElement(IconContainer, null, isLoading ? React.createElement(Spinner, null) : React.createElement(PrintIcon, null))));
30
37
  if (isLoading) {
31
38
  return (React.createElement(TooltipWrapper, null,
32
39
  React.createElement(Tooltip, { placement: "left", content: React.createElement(TooltipContent, null,
33
- React.createElement(TooltipTitle, null, "\u23F3 Aguardando estabiliza\u00E7\u00E3o"),
34
- React.createElement(TooltipMessage, null, tooltipMessage)), icon: button })));
40
+ React.createElement(TooltipTitle, null, "\uD83D\uDCC4 Preparando impress\u00E3o"),
41
+ React.createElement(TooltipMessage, null, tooltipMessage),
42
+ onClick && (React.createElement(SkipButton, { onClick: onClick }, "Imprimir agora"))), icon: button })));
35
43
  }
36
44
  return button;
37
45
  };
38
46
  export default PrintButton;
39
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
47
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -48,7 +48,7 @@ var ConsultaSimplesSection = function (_a) {
48
48
  var ctx = useContext(Queries.Finder);
49
49
  var data = useGlobalData().data;
50
50
  var posthog = usePostHog().posthog;
51
- // Hook para observar mutações no DOM e imprimir quando estável
51
+ // Hook para observar mutações no DOM e chamar callback quando estável
52
52
  var _s = usePrintWhenStable({
53
53
  debounceTime: 500,
54
54
  maxWaitTime: 30000,
@@ -56,7 +56,8 @@ var ConsultaSimplesSection = function (_a) {
56
56
  console.log('ConsultaSimples: Aguardando DOM estabilizar para impressão...');
57
57
  },
58
58
  onStable: function () {
59
- console.log('ConsultaSimples: DOM estável, iniciando impressão');
59
+ console.log('ConsultaSimples: DOM estável, pronto para imprimir');
60
+ // Chama o callback externo (Harlan decide como imprimir)
60
61
  onClickPrint === null || onClickPrint === void 0 ? void 0 : onClickPrint();
61
62
  }
62
63
  }), printWhenStable = _s.printWhenStable, isWaiting = _s.isWaiting;
@@ -28,8 +28,9 @@ export var usePrintWhenStable = function (options) {
28
28
  }, []);
29
29
  var triggerPrint = useCallback(function () {
30
30
  cleanup();
31
+ // Chama o callback informando que o DOM está estável
32
+ // O consumidor (ex: Harlan) decide como imprimir
31
33
  onStable === null || onStable === void 0 ? void 0 : onStable();
32
- window.print();
33
34
  }, [cleanup, onStable]);
34
35
  var startObserving = useCallback(function () {
35
36
  // Limpa observadores anteriores