@tipp/ui 1.6.34 → 1.6.35

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.
@@ -0,0 +1,69 @@
1
+ import {
2
+ Heading
3
+ } from "./chunk-HJB3AASV.js";
4
+ import {
5
+ Card
6
+ } from "./chunk-2ZQK7NTN.js";
7
+ import {
8
+ Box
9
+ } from "./chunk-4Y5BEXVN.js";
10
+ import {
11
+ Typo
12
+ } from "./chunk-52MVZ6AN.js";
13
+ import {
14
+ Flex
15
+ } from "./chunk-25HMMI7R.js";
16
+ import {
17
+ Button
18
+ } from "./chunk-Q5AFRGVP.js";
19
+ import {
20
+ DownloadIcon
21
+ } from "./chunk-HLFG5ZTU.js";
22
+
23
+ // src/app/platform/report-card.tsx
24
+ import { useCallback } from "react";
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ function ReportCard(props) {
27
+ const { title, file, status, subtitle } = props;
28
+ const onClickDownload = useCallback(() => {
29
+ if (!file)
30
+ return;
31
+ const { url, fileName } = file;
32
+ const link = document.createElement("a");
33
+ link.href = url;
34
+ link.download = fileName;
35
+ link.target = "_blank";
36
+ document.body.appendChild(link);
37
+ link.click();
38
+ document.body.removeChild(link);
39
+ }, [file]);
40
+ if (status) {
41
+ return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", children: [
42
+ /* @__PURE__ */ jsx(Heading, { variant: "heading4", children: title }),
43
+ status
44
+ ] }) });
45
+ }
46
+ return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(
47
+ Flex,
48
+ {
49
+ direction: { initial: "column", xs: "row" },
50
+ gapY: "2",
51
+ justify: "between",
52
+ children: [
53
+ /* @__PURE__ */ jsxs(Box, { children: [
54
+ /* @__PURE__ */ jsx(Heading, { variant: "heading4", children: title }),
55
+ subtitle ? /* @__PURE__ */ jsx(Typo, { color: "gray", children: subtitle }) : null
56
+ ] }),
57
+ /* @__PURE__ */ jsx(Button, { onClick: onClickDownload, variant: "surface", children: /* @__PURE__ */ jsxs(Flex, { gap: "2", width: "100%", children: [
58
+ /* @__PURE__ */ jsx(DownloadIcon, {}),
59
+ file == null ? void 0 : file.buttonName
60
+ ] }) }, file == null ? void 0 : file.url)
61
+ ]
62
+ }
63
+ ) });
64
+ }
65
+
66
+ export {
67
+ ReportCard
68
+ };
69
+ //# sourceMappingURL=chunk-5WRWSILW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/app/platform/report-card.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport { Box, Button, Card, Flex, Heading, Typo } from '@/atoms';\nimport type { Attachment } from '@/molecules';\nimport { DownloadIcon } from '@/icon';\n\ntype File = Attachment & { buttonName: string };\nexport interface ReportCardProps {\n title?: string;\n file?: File;\n status?: React.ReactNode;\n subtitle?: string;\n}\n\nexport function ReportCard(props: ReportCardProps): React.ReactElement {\n const { title, file, status, subtitle } = props;\n\n const onClickDownload = useCallback(() => {\n if (!file) return;\n const { url, fileName } = file;\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.target = '_blank';\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n }, [file]);\n\n if (status) {\n return (\n <Card>\n <Flex align=\"center\" justify=\"between\">\n <Heading variant=\"heading4\">{title}</Heading>\n {status}\n </Flex>\n </Card>\n );\n }\n\n return (\n <Card>\n <Flex\n direction={{ initial: 'column', xs: 'row' }}\n gapY=\"2\"\n justify=\"between\"\n >\n <Box>\n <Heading variant=\"heading4\">{title}</Heading>\n {subtitle ? <Typo color=\"gray\">{subtitle}</Typo> : null}\n </Box>\n <Button key={file?.url} onClick={onClickDownload} variant=\"surface\">\n <Flex gap=\"2\" width=\"100%\">\n <DownloadIcon />\n {file?.buttonName}\n </Flex>\n </Button>\n </Flex>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAgB,mBAAmB;AAgC3B,SACE,KADF;AAnBD,SAAS,WAAW,OAA4C;AACrE,QAAM,EAAE,OAAO,MAAM,QAAQ,SAAS,IAAI;AAE1C,QAAM,kBAAkB,YAAY,MAAM;AACxC,QAAI,CAAC;AAAM;AACX,UAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,UAAM,OAAO,SAAS,cAAc,GAAG;AACvC,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,SAAS;AAEd,aAAS,KAAK,YAAY,IAAI;AAC9B,SAAK,MAAM;AACX,aAAS,KAAK,YAAY,IAAI;AAAA,EAChC,GAAG,CAAC,IAAI,CAAC;AAET,MAAI,QAAQ;AACV,WACE,oBAAC,QACC,+BAAC,QAAK,OAAM,UAAS,SAAQ,WAC3B;AAAA,0BAAC,WAAQ,SAAQ,YAAY,iBAAM;AAAA,MAClC;AAAA,OACH,GACF;AAAA,EAEJ;AAEA,SACE,oBAAC,QACC;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,EAAE,SAAS,UAAU,IAAI,MAAM;AAAA,MAC1C,MAAK;AAAA,MACL,SAAQ;AAAA,MAER;AAAA,6BAAC,OACC;AAAA,8BAAC,WAAQ,SAAQ,YAAY,iBAAM;AAAA,UAClC,WAAW,oBAAC,QAAK,OAAM,QAAQ,oBAAS,IAAU;AAAA,WACrD;AAAA,QACA,oBAAC,UAAuB,SAAS,iBAAiB,SAAQ,WACxD,+BAAC,QAAK,KAAI,KAAI,OAAM,QAClB;AAAA,8BAAC,gBAAa;AAAA,UACb,6BAAM;AAAA,WACT,KAJW,6BAAM,GAKnB;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
package/dist/index.cjs CHANGED
@@ -4247,7 +4247,7 @@ function SessionUserInfoDetail({
4247
4247
  var import_react36 = require("react");
4248
4248
  var import_jsx_runtime64 = require("react/jsx-runtime");
4249
4249
  function ReportCard(props) {
4250
- const { title, file, status } = props;
4250
+ const { title, file, status, subtitle } = props;
4251
4251
  const onClickDownload = (0, import_react36.useCallback)(() => {
4252
4252
  if (!file)
4253
4253
  return;
@@ -4273,7 +4273,10 @@ function ReportCard(props) {
4273
4273
  gapY: "2",
4274
4274
  justify: "between",
4275
4275
  children: [
4276
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Heading2, { variant: "heading4", children: title }),
4276
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_themes6.Box, { children: [
4277
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Heading2, { variant: "heading4", children: title }),
4278
+ subtitle ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Typo, { color: "gray", children: subtitle }) : null
4279
+ ] }),
4277
4280
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { onClick: onClickDownload, variant: "surface", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_themes22.Flex, { gap: "2", width: "100%", children: [
4278
4281
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_icons2.DownloadIcon, {}),
4279
4282
  file == null ? void 0 : file.buttonName