@layerfi/components 0.1.2 → 0.1.3
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/dist/esm/index.js +339 -145
- package/dist/esm/index.js.map +4 -4
- package/dist/index.css +106 -0
- package/dist/index.css.map +7 -0
- package/dist/index.d.ts +41 -7
- package/dist/index.esm.css +106 -0
- package/dist/index.esm.css.map +7 -0
- package/dist/index.esm.js +252 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +354 -160
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +64 -1
- package/dist/styles/index.css.map +3 -3
- package/package.json +1 -1
- package/index.d.ts +0 -1309
package/dist/esm/index.js
CHANGED
|
@@ -557,7 +557,7 @@ var BalanceSheet = () => {
|
|
|
557
557
|
};
|
|
558
558
|
|
|
559
559
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
560
|
-
import
|
|
560
|
+
import React38, { useState as useState9 } from "react";
|
|
561
561
|
|
|
562
562
|
// src/hooks/useBankTransactions/useBankTransactions.tsx
|
|
563
563
|
import useSWR2 from "swr";
|
|
@@ -566,6 +566,7 @@ var useBankTransactions = () => {
|
|
|
566
566
|
const {
|
|
567
567
|
data: responseData,
|
|
568
568
|
isLoading,
|
|
569
|
+
isValidating,
|
|
569
570
|
error: responseError,
|
|
570
571
|
mutate
|
|
571
572
|
} = useSWR2(
|
|
@@ -575,12 +576,12 @@ var useBankTransactions = () => {
|
|
|
575
576
|
})
|
|
576
577
|
);
|
|
577
578
|
const {
|
|
578
|
-
data =
|
|
579
|
+
data = void 0,
|
|
579
580
|
meta: metadata = {},
|
|
580
581
|
error = void 0
|
|
581
582
|
} = responseData || {};
|
|
582
583
|
const categorize = (id, newCategory) => {
|
|
583
|
-
const foundBT = data
|
|
584
|
+
const foundBT = data?.find((x) => x.business_id === businessId && x.id === id);
|
|
584
585
|
if (foundBT) {
|
|
585
586
|
updateOneLocal({ ...foundBT, processing: true, error: void 0 });
|
|
586
587
|
}
|
|
@@ -597,7 +598,7 @@ var useBankTransactions = () => {
|
|
|
597
598
|
throw errors;
|
|
598
599
|
}
|
|
599
600
|
}).catch((err) => {
|
|
600
|
-
const newBT = data
|
|
601
|
+
const newBT = data?.find(
|
|
601
602
|
(x) => x.business_id === businessId && x.id === id
|
|
602
603
|
);
|
|
603
604
|
if (newBT) {
|
|
@@ -610,15 +611,20 @@ var useBankTransactions = () => {
|
|
|
610
611
|
});
|
|
611
612
|
};
|
|
612
613
|
const updateOneLocal = (newBankTransaction) => {
|
|
613
|
-
const updatedData = data
|
|
614
|
+
const updatedData = data?.map(
|
|
614
615
|
(bt) => bt.id === newBankTransaction.id ? newBankTransaction : bt
|
|
615
616
|
);
|
|
616
617
|
mutate({ data: updatedData }, { revalidate: false });
|
|
617
618
|
};
|
|
619
|
+
const refetch = () => {
|
|
620
|
+
mutate();
|
|
621
|
+
};
|
|
618
622
|
return {
|
|
619
623
|
data,
|
|
620
624
|
metadata,
|
|
621
625
|
isLoading,
|
|
626
|
+
isValidating,
|
|
627
|
+
refetch,
|
|
622
628
|
error: responseError || error,
|
|
623
629
|
categorize,
|
|
624
630
|
updateOneLocal
|
|
@@ -649,10 +655,10 @@ var useElementSize = (callback) => {
|
|
|
649
655
|
};
|
|
650
656
|
|
|
651
657
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
652
|
-
import React31, { useRef as
|
|
658
|
+
import React31, { useRef as useRef7, useState as useState7 } from "react";
|
|
653
659
|
|
|
654
660
|
// src/components/Button/Button.tsx
|
|
655
|
-
import React8 from "react";
|
|
661
|
+
import React8, { useRef as useRef3 } from "react";
|
|
656
662
|
import classNames from "classnames";
|
|
657
663
|
var Button = ({
|
|
658
664
|
className,
|
|
@@ -663,6 +669,7 @@ var Button = ({
|
|
|
663
669
|
iconOnly,
|
|
664
670
|
...props
|
|
665
671
|
}) => {
|
|
672
|
+
const buttonRef = useRef3(null);
|
|
666
673
|
let justify = "center";
|
|
667
674
|
if (leftIcon && rightIcon) {
|
|
668
675
|
justify = "space-between";
|
|
@@ -677,7 +684,23 @@ var Button = ({
|
|
|
677
684
|
iconOnly ? "Layer__btn--icon-only" : "",
|
|
678
685
|
className
|
|
679
686
|
);
|
|
680
|
-
|
|
687
|
+
const startAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
688
|
+
(el) => el.beginElement()
|
|
689
|
+
);
|
|
690
|
+
const stopAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
691
|
+
(el) => el.endElement()
|
|
692
|
+
);
|
|
693
|
+
return /* @__PURE__ */ React8.createElement(
|
|
694
|
+
"button",
|
|
695
|
+
{
|
|
696
|
+
...props,
|
|
697
|
+
className: baseClassName,
|
|
698
|
+
onMouseEnter: startAnimation,
|
|
699
|
+
onMouseLeave: stopAnimation,
|
|
700
|
+
ref: buttonRef
|
|
701
|
+
},
|
|
702
|
+
/* @__PURE__ */ React8.createElement("span", { className: `Layer__btn-content Layer__justify--${justify}` }, leftIcon && /* @__PURE__ */ React8.createElement("span", { className: "Layer__btn-icon Layer__btn-icon--left" }, leftIcon), !iconOnly && /* @__PURE__ */ React8.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ React8.createElement("span", { className: "Layer__btn-icon Layer__btn-icon--right" }, rightIcon))
|
|
703
|
+
);
|
|
681
704
|
};
|
|
682
705
|
|
|
683
706
|
// src/components/Button/SubmitButton.tsx
|
|
@@ -1235,66 +1258,135 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React19.createElem
|
|
|
1235
1258
|
);
|
|
1236
1259
|
var RefreshCcw_default = RefreshCcw;
|
|
1237
1260
|
|
|
1238
|
-
// src/icons/
|
|
1261
|
+
// src/icons/Scissors.tsx
|
|
1239
1262
|
import * as React20 from "react";
|
|
1240
|
-
var
|
|
1263
|
+
var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React20.createElement(
|
|
1241
1264
|
"svg",
|
|
1242
1265
|
{
|
|
1243
|
-
viewBox: "0 0
|
|
1266
|
+
viewBox: "0 0 11 11",
|
|
1244
1267
|
fill: "none",
|
|
1245
1268
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1246
1269
|
...props,
|
|
1247
1270
|
width: size,
|
|
1248
1271
|
height: size
|
|
1249
1272
|
},
|
|
1250
|
-
/* @__PURE__ */ React20.createElement(
|
|
1273
|
+
/* @__PURE__ */ React20.createElement(
|
|
1251
1274
|
"path",
|
|
1252
1275
|
{
|
|
1253
|
-
|
|
1254
|
-
d: "M3 4.5C3.82843 4.5 4.5 3.82843 4.5 3C4.5 2.17157 3.82843 1.5 3 1.5C2.17157 1.5 1.5 2.17157 1.5 3C1.5 3.82843 2.17157 4.5 3 4.5Z",
|
|
1276
|
+
d: "M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z",
|
|
1255
1277
|
stroke: "currentColor",
|
|
1256
1278
|
strokeLinecap: "round",
|
|
1257
1279
|
strokeLinejoin: "round"
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1280
|
+
},
|
|
1281
|
+
/* @__PURE__ */ React20.createElement(
|
|
1282
|
+
"animate",
|
|
1283
|
+
{
|
|
1284
|
+
attributeName: "d",
|
|
1285
|
+
className: "animateOnHover",
|
|
1286
|
+
values: "M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z;M2.50519 5.21436C3.20276 4.91424 3.52494 4.10544 3.22481 3.40788C2.92468 2.71031 2.11589 2.38813 1.41833 2.68826C0.720762 2.98839 0.398577 3.79718 0.698706 4.49474C0.998836 5.19231 1.80763 5.51449 2.50519 5.21436Z;M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z",
|
|
1287
|
+
begin: "indefinite",
|
|
1288
|
+
dur: "400ms",
|
|
1289
|
+
repeatCount: "1",
|
|
1290
|
+
fill: "freeze",
|
|
1291
|
+
calcMode: "linear",
|
|
1292
|
+
keyTimes: "0;0.5;1"
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
),
|
|
1296
|
+
/* @__PURE__ */ React20.createElement(
|
|
1260
1297
|
"path",
|
|
1261
1298
|
{
|
|
1262
|
-
|
|
1263
|
-
d: "M3 10.5C3.82843 10.5 4.5 9.82843 4.5 9C4.5 8.17157 3.82843 7.5 3 7.5C2.17157 7.5 1.5 8.17157 1.5 9C1.5 9.82843 2.17157 10.5 3 10.5Z",
|
|
1299
|
+
d: "M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z",
|
|
1264
1300
|
stroke: "currentColor",
|
|
1265
1301
|
strokeLinecap: "round",
|
|
1266
1302
|
strokeLinejoin: "round"
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1303
|
+
},
|
|
1304
|
+
/* @__PURE__ */ React20.createElement(
|
|
1305
|
+
"animate",
|
|
1306
|
+
{
|
|
1307
|
+
attributeName: "d",
|
|
1308
|
+
className: "animateOnHover",
|
|
1309
|
+
values: "M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z;M1.43277 8.38576C2.13615 8.67201 2.9384 8.33386 3.22465 7.63049C3.5109 6.92711 3.17275 6.12486 2.46937 5.83861C1.766 5.55236 0.96375 5.89051 0.6775 6.59389C0.391251 7.29726 0.729398 8.09951 1.43277 8.38576Z;M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z",
|
|
1310
|
+
begin: "indefinite",
|
|
1311
|
+
dur: "400ms",
|
|
1312
|
+
repeatCount: "1",
|
|
1313
|
+
fill: "freeze",
|
|
1314
|
+
calcMode: "linear",
|
|
1315
|
+
keyTimes: "0;0.5;1"
|
|
1316
|
+
}
|
|
1317
|
+
)
|
|
1318
|
+
),
|
|
1319
|
+
/* @__PURE__ */ React20.createElement(
|
|
1269
1320
|
"path",
|
|
1270
1321
|
{
|
|
1271
|
-
|
|
1272
|
-
d: "M10 2L4.06 7.94",
|
|
1322
|
+
d: "M9.16668 1.83325L3.72168 7.27825",
|
|
1273
1323
|
stroke: "currentColor",
|
|
1274
1324
|
strokeLinecap: "round",
|
|
1275
1325
|
strokeLinejoin: "round"
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1326
|
+
},
|
|
1327
|
+
/* @__PURE__ */ React20.createElement(
|
|
1328
|
+
"animate",
|
|
1329
|
+
{
|
|
1330
|
+
attributeName: "d",
|
|
1331
|
+
className: "animateOnHover",
|
|
1332
|
+
values: "M9.16668 1.83325L3.72168 7.27825;M10.3129 3.58763L3.21706 6.57851;M9.16668 1.83325L3.72168 7.27825",
|
|
1333
|
+
begin: "indefinite",
|
|
1334
|
+
dur: "400ms",
|
|
1335
|
+
repeatCount: "1",
|
|
1336
|
+
fill: "freeze",
|
|
1337
|
+
calcMode: "linear",
|
|
1338
|
+
keyTimes: "0;0.5;1"
|
|
1339
|
+
}
|
|
1340
|
+
)
|
|
1341
|
+
),
|
|
1342
|
+
/* @__PURE__ */ React20.createElement(
|
|
1278
1343
|
"path",
|
|
1279
1344
|
{
|
|
1280
|
-
|
|
1281
|
-
d: "M7.235 7.23999L10 9.99999",
|
|
1345
|
+
d: "M6.63232 6.63672L9.16691 9.16672",
|
|
1282
1346
|
stroke: "currentColor",
|
|
1283
1347
|
strokeLinecap: "round",
|
|
1284
1348
|
strokeLinejoin: "round"
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1349
|
+
},
|
|
1350
|
+
/* @__PURE__ */ React20.createElement(
|
|
1351
|
+
"animate",
|
|
1352
|
+
{
|
|
1353
|
+
attributeName: "d",
|
|
1354
|
+
className: "animateOnHover",
|
|
1355
|
+
values: "M6.63232 6.63672L9.16691 9.16672;M7.06396 5.9873L10.3921 7.3096;M6.63232 6.63672L9.16691 9.16672",
|
|
1356
|
+
begin: "indefinite",
|
|
1357
|
+
dur: "400ms",
|
|
1358
|
+
repeatCount: "1",
|
|
1359
|
+
fill: "freeze",
|
|
1360
|
+
calcMode: "linear",
|
|
1361
|
+
keyTimes: "0;0.5;1"
|
|
1362
|
+
}
|
|
1363
|
+
)
|
|
1364
|
+
),
|
|
1365
|
+
/* @__PURE__ */ React20.createElement(
|
|
1287
1366
|
"path",
|
|
1288
1367
|
{
|
|
1289
|
-
|
|
1290
|
-
d: "M4.06 4.06006L6 6.00006",
|
|
1368
|
+
d: "M3.72168 3.72168L5.50001 5.50001",
|
|
1291
1369
|
stroke: "currentColor",
|
|
1292
1370
|
strokeLinecap: "round",
|
|
1293
1371
|
strokeLinejoin: "round"
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1372
|
+
},
|
|
1373
|
+
/* @__PURE__ */ React20.createElement(
|
|
1374
|
+
"animate",
|
|
1375
|
+
{
|
|
1376
|
+
attributeName: "d",
|
|
1377
|
+
className: "animateOnHover",
|
|
1378
|
+
values: "M3.72168 3.72168L5.50001 5.50001;M3.23828 4.45996L5.57467 5.39067;M3.72168 3.72168L5.50001 5.50001",
|
|
1379
|
+
begin: "indefinite",
|
|
1380
|
+
dur: "400ms",
|
|
1381
|
+
repeatCount: "1",
|
|
1382
|
+
fill: "freeze",
|
|
1383
|
+
calcMode: "linear",
|
|
1384
|
+
keyTimes: "0;0.5;1"
|
|
1385
|
+
}
|
|
1386
|
+
)
|
|
1387
|
+
)
|
|
1296
1388
|
);
|
|
1297
|
-
var
|
|
1389
|
+
var Scissors_default = Scissors;
|
|
1298
1390
|
|
|
1299
1391
|
// src/components/Input/Input.tsx
|
|
1300
1392
|
import React21 from "react";
|
|
@@ -1308,7 +1400,7 @@ var Input = ({ className, ...props }) => {
|
|
|
1308
1400
|
import React24 from "react";
|
|
1309
1401
|
|
|
1310
1402
|
// src/components/Typography/Text.tsx
|
|
1311
|
-
import React22, { useRef as
|
|
1403
|
+
import React22, { useRef as useRef4, useState as useState4, useEffect } from "react";
|
|
1312
1404
|
import classNames4 from "classnames";
|
|
1313
1405
|
var Text = ({
|
|
1314
1406
|
as: Component = "p",
|
|
@@ -1349,7 +1441,7 @@ var TextWithTooltip = ({
|
|
|
1349
1441
|
tooltipOptions,
|
|
1350
1442
|
...props
|
|
1351
1443
|
}) => {
|
|
1352
|
-
const textElementRef =
|
|
1444
|
+
const textElementRef = useRef4();
|
|
1353
1445
|
const compareSize = () => {
|
|
1354
1446
|
if (textElementRef.current) {
|
|
1355
1447
|
const compare = textElementRef.current.children[0].scrollWidth > textElementRef.current.children[0].clientWidth;
|
|
@@ -1421,7 +1513,7 @@ var InputGroup = ({
|
|
|
1421
1513
|
};
|
|
1422
1514
|
|
|
1423
1515
|
// src/components/Input/FileInput.tsx
|
|
1424
|
-
import React26, { useRef as
|
|
1516
|
+
import React26, { useRef as useRef5 } from "react";
|
|
1425
1517
|
|
|
1426
1518
|
// src/icons/UploadCloud.tsx
|
|
1427
1519
|
import * as React25 from "react";
|
|
@@ -1476,7 +1568,7 @@ var UploadCloud_default = UploadCloud;
|
|
|
1476
1568
|
|
|
1477
1569
|
// src/components/Input/FileInput.tsx
|
|
1478
1570
|
var FileInput = ({ text = "Upload", onUpload }) => {
|
|
1479
|
-
const hiddenFileInput =
|
|
1571
|
+
const hiddenFileInput = useRef5(null);
|
|
1480
1572
|
const onClick = () => {
|
|
1481
1573
|
if (hiddenFileInput.current) {
|
|
1482
1574
|
hiddenFileInput.current.click();
|
|
@@ -1633,7 +1725,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1633
1725
|
bankTransaction,
|
|
1634
1726
|
isOpen = false,
|
|
1635
1727
|
asListItem = false,
|
|
1636
|
-
|
|
1728
|
+
submitBtnText = "Save"
|
|
1637
1729
|
}, ref) => {
|
|
1638
1730
|
const { categorize: categorizeBankTransaction2 } = useBankTransactions();
|
|
1639
1731
|
const [purpose, setPurpose] = useState6("categorize" /* categorize */);
|
|
@@ -1772,7 +1864,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1772
1864
|
Button,
|
|
1773
1865
|
{
|
|
1774
1866
|
onClick: addSplit,
|
|
1775
|
-
leftIcon: /* @__PURE__ */ React29.createElement(
|
|
1867
|
+
leftIcon: /* @__PURE__ */ React29.createElement(Scissors_default, { size: 14 }),
|
|
1776
1868
|
variant: "secondary" /* secondary */
|
|
1777
1869
|
},
|
|
1778
1870
|
"Split"
|
|
@@ -1795,7 +1887,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1795
1887
|
/* @__PURE__ */ React29.createElement(Textarea, { name: "description", placeholder: "Enter description" })
|
|
1796
1888
|
),
|
|
1797
1889
|
/* @__PURE__ */ React29.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React29.createElement(FileInput, { text: "Upload receipt" })),
|
|
1798
|
-
asListItem
|
|
1890
|
+
asListItem ? /* @__PURE__ */ React29.createElement("div", { className: `${className}__submit-btn` }, /* @__PURE__ */ React29.createElement(
|
|
1799
1891
|
SubmitButton,
|
|
1800
1892
|
{
|
|
1801
1893
|
onClick: () => {
|
|
@@ -1808,7 +1900,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1808
1900
|
error: bankTransaction.error,
|
|
1809
1901
|
active: true
|
|
1810
1902
|
},
|
|
1811
|
-
|
|
1903
|
+
submitBtnText
|
|
1812
1904
|
)) : null
|
|
1813
1905
|
))
|
|
1814
1906
|
);
|
|
@@ -1830,7 +1922,7 @@ var BankTransactionListItem = ({
|
|
|
1830
1922
|
toggleOpen,
|
|
1831
1923
|
editable
|
|
1832
1924
|
}) => {
|
|
1833
|
-
const expandedRowRef =
|
|
1925
|
+
const expandedRowRef = useRef7(null);
|
|
1834
1926
|
const [removed, setRemoved] = useState7(false);
|
|
1835
1927
|
const { categorize: categorizeBankTransaction2 } = useBankTransactions();
|
|
1836
1928
|
const [selectedCategory, setSelectedCategory] = useState7(
|
|
@@ -1886,7 +1978,8 @@ var BankTransactionListItem = ({
|
|
|
1886
1978
|
bankTransaction,
|
|
1887
1979
|
close: () => toggleOpen(bankTransaction.id),
|
|
1888
1980
|
isOpen,
|
|
1889
|
-
asListItem: true
|
|
1981
|
+
asListItem: true,
|
|
1982
|
+
submitBtnText: editable ? "Approve" : "Save"
|
|
1890
1983
|
}
|
|
1891
1984
|
)), /* @__PURE__ */ React31.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React31.createElement(
|
|
1892
1985
|
CategoryMenu,
|
|
@@ -1914,7 +2007,7 @@ var BankTransactionListItem = ({
|
|
|
1914
2007
|
};
|
|
1915
2008
|
|
|
1916
2009
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
1917
|
-
import React32, { useRef as
|
|
2010
|
+
import React32, { useRef as useRef8, useState as useState8 } from "react";
|
|
1918
2011
|
import classNames10 from "classnames";
|
|
1919
2012
|
import { parseISO as parseISO3, format as formatTime2 } from "date-fns";
|
|
1920
2013
|
var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
@@ -1925,7 +2018,7 @@ var BankTransactionRow = ({
|
|
|
1925
2018
|
toggleOpen,
|
|
1926
2019
|
editable
|
|
1927
2020
|
}) => {
|
|
1928
|
-
const expandedRowRef =
|
|
2021
|
+
const expandedRowRef = useRef8(null);
|
|
1929
2022
|
const [removed, setRemoved] = useState8(false);
|
|
1930
2023
|
const { categorize: categorizeBankTransaction2 } = useBankTransactions();
|
|
1931
2024
|
const [selectedCategory, setSelectedCategory] = useState8(
|
|
@@ -2019,8 +2112,8 @@ var BankTransactionRow = ({
|
|
|
2019
2112
|
disabled: bankTransaction.processing
|
|
2020
2113
|
}
|
|
2021
2114
|
) : null,
|
|
2022
|
-
!editable ? /* @__PURE__ */ React32.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction?.category?.display_name) : null,
|
|
2023
|
-
editable
|
|
2115
|
+
!editable && !isOpen ? /* @__PURE__ */ React32.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction?.category?.display_name) : null,
|
|
2116
|
+
editable || isOpen ? /* @__PURE__ */ React32.createElement(
|
|
2024
2117
|
SubmitButton,
|
|
2025
2118
|
{
|
|
2026
2119
|
onClick: () => {
|
|
@@ -2033,8 +2126,8 @@ var BankTransactionRow = ({
|
|
|
2033
2126
|
error: bankTransaction.error,
|
|
2034
2127
|
active: isOpen
|
|
2035
2128
|
},
|
|
2036
|
-
"Approve"
|
|
2037
|
-
),
|
|
2129
|
+
editable ? "Approve" : "Save"
|
|
2130
|
+
) : null,
|
|
2038
2131
|
/* @__PURE__ */ React32.createElement(
|
|
2039
2132
|
"div",
|
|
2040
2133
|
{
|
|
@@ -2056,8 +2149,7 @@ var BankTransactionRow = ({
|
|
|
2056
2149
|
ref: expandedRowRef,
|
|
2057
2150
|
bankTransaction,
|
|
2058
2151
|
close: () => toggleOpen(bankTransaction.id),
|
|
2059
|
-
isOpen
|
|
2060
|
-
showSubmitButton: !editable
|
|
2152
|
+
isOpen
|
|
2061
2153
|
}
|
|
2062
2154
|
))));
|
|
2063
2155
|
};
|
|
@@ -2084,7 +2176,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2084
2176
|
}
|
|
2085
2177
|
try {
|
|
2086
2178
|
if ("h" in color && "s" in color && "l" in color) {
|
|
2087
|
-
console.log("its hsl", color);
|
|
2088
2179
|
return {
|
|
2089
2180
|
[`--color-${colorName}-h`]: color.h,
|
|
2090
2181
|
[`--color-${colorName}-s`]: color.s,
|
|
@@ -2093,7 +2184,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2093
2184
|
}
|
|
2094
2185
|
if ("r" in color && "g" in color && "b" in color) {
|
|
2095
2186
|
const { h, s, l } = rgbToHsl(color);
|
|
2096
|
-
console.log("its rgb", h, s, l);
|
|
2097
2187
|
return {
|
|
2098
2188
|
[`--color-${colorName}-h`]: h,
|
|
2099
2189
|
[`--color-${colorName}-s`]: `${s}%`,
|
|
@@ -2101,7 +2191,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2101
2191
|
};
|
|
2102
2192
|
}
|
|
2103
2193
|
if ("hex" in color) {
|
|
2104
|
-
console.log("its hex");
|
|
2105
2194
|
const rgb = hexToRgb(color.hex);
|
|
2106
2195
|
if (!rgb) {
|
|
2107
2196
|
return {};
|
|
@@ -2111,7 +2200,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2111
2200
|
g: rgb.g.toString(),
|
|
2112
2201
|
b: rgb.b.toString()
|
|
2113
2202
|
});
|
|
2114
|
-
console.log("its hex", h, s, l);
|
|
2115
2203
|
return {
|
|
2116
2204
|
[`--color-${colorName}-h`]: h,
|
|
2117
2205
|
[`--color-${colorName}-s`]: `${s}%`,
|
|
@@ -2155,34 +2243,120 @@ var hexToRgb = (hex) => {
|
|
|
2155
2243
|
};
|
|
2156
2244
|
|
|
2157
2245
|
// src/components/Container/Container.tsx
|
|
2158
|
-
|
|
2159
|
-
|
|
2246
|
+
import classNames11 from "classnames";
|
|
2247
|
+
var Container = ({
|
|
2248
|
+
name,
|
|
2249
|
+
className,
|
|
2250
|
+
children,
|
|
2251
|
+
asWidget
|
|
2252
|
+
}) => {
|
|
2253
|
+
const baseClassName = classNames11(
|
|
2254
|
+
"Layer__component Layer__component-container",
|
|
2255
|
+
`Layer__${name}`,
|
|
2256
|
+
asWidget ? "Layer__component--as-widget" : "",
|
|
2257
|
+
className
|
|
2258
|
+
);
|
|
2160
2259
|
const { theme } = useLayerContext();
|
|
2161
2260
|
const styles = parseStylesFromThemeConfig(theme);
|
|
2162
|
-
return /* @__PURE__ */ React33.createElement(
|
|
2163
|
-
"div",
|
|
2164
|
-
{
|
|
2165
|
-
className: `Layer__component Layer__component-container ${baseClassName}`,
|
|
2166
|
-
style: { ...styles }
|
|
2167
|
-
},
|
|
2168
|
-
children
|
|
2169
|
-
);
|
|
2261
|
+
return /* @__PURE__ */ React33.createElement("div", { className: baseClassName, style: { ...styles } }, children);
|
|
2170
2262
|
};
|
|
2171
2263
|
|
|
2172
2264
|
// src/components/Container/Header.tsx
|
|
2173
2265
|
import React34, { forwardRef as forwardRef3 } from "react";
|
|
2174
|
-
import
|
|
2266
|
+
import classNames12 from "classnames";
|
|
2175
2267
|
var Header = forwardRef3(
|
|
2176
2268
|
({ className, children, style }, ref) => {
|
|
2177
|
-
const baseClassName =
|
|
2269
|
+
const baseClassName = classNames12("Layer__component-header", className);
|
|
2178
2270
|
return /* @__PURE__ */ React34.createElement("header", { ref, className: baseClassName, style }, children);
|
|
2179
2271
|
}
|
|
2180
2272
|
);
|
|
2181
2273
|
|
|
2274
|
+
// src/components/DataState/DataState.tsx
|
|
2275
|
+
import React36 from "react";
|
|
2276
|
+
|
|
2277
|
+
// src/icons/AlertOctagon.tsx
|
|
2278
|
+
import * as React35 from "react";
|
|
2279
|
+
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React35.createElement(
|
|
2280
|
+
"svg",
|
|
2281
|
+
{
|
|
2282
|
+
viewBox: "0 0 18 18",
|
|
2283
|
+
fill: "none",
|
|
2284
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2285
|
+
...props,
|
|
2286
|
+
width: size,
|
|
2287
|
+
height: size
|
|
2288
|
+
},
|
|
2289
|
+
/* @__PURE__ */ React35.createElement(
|
|
2290
|
+
"path",
|
|
2291
|
+
{
|
|
2292
|
+
d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
|
|
2293
|
+
stroke: "currentColor",
|
|
2294
|
+
strokeLinecap: "round",
|
|
2295
|
+
strokeLinejoin: "round"
|
|
2296
|
+
}
|
|
2297
|
+
),
|
|
2298
|
+
/* @__PURE__ */ React35.createElement(
|
|
2299
|
+
"path",
|
|
2300
|
+
{
|
|
2301
|
+
d: "M9 6V9",
|
|
2302
|
+
stroke: "currentColor",
|
|
2303
|
+
strokeLinecap: "round",
|
|
2304
|
+
strokeLinejoin: "round"
|
|
2305
|
+
}
|
|
2306
|
+
),
|
|
2307
|
+
/* @__PURE__ */ React35.createElement(
|
|
2308
|
+
"path",
|
|
2309
|
+
{
|
|
2310
|
+
d: "M9 12H9.0075",
|
|
2311
|
+
stroke: "currentColor",
|
|
2312
|
+
strokeLinecap: "round",
|
|
2313
|
+
strokeLinejoin: "round"
|
|
2314
|
+
}
|
|
2315
|
+
)
|
|
2316
|
+
);
|
|
2317
|
+
var AlertOctagon_default = AlertOctagon;
|
|
2318
|
+
|
|
2319
|
+
// src/components/DataState/DataState.tsx
|
|
2320
|
+
var getIcon = (status) => {
|
|
2321
|
+
switch (status) {
|
|
2322
|
+
case "failed" /* failed */:
|
|
2323
|
+
return /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React36.createElement(AlertOctagon_default, { size: 12 }));
|
|
2324
|
+
default:
|
|
2325
|
+
return /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React36.createElement(CheckCircle_default, { size: 12 }));
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
var DataState = ({
|
|
2329
|
+
status,
|
|
2330
|
+
title,
|
|
2331
|
+
description,
|
|
2332
|
+
onRefresh,
|
|
2333
|
+
isLoading
|
|
2334
|
+
}) => {
|
|
2335
|
+
return /* @__PURE__ */ React36.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React36.createElement(
|
|
2336
|
+
Text,
|
|
2337
|
+
{
|
|
2338
|
+
as: "span",
|
|
2339
|
+
size: "lg" /* lg */,
|
|
2340
|
+
weight: "bold" /* bold */,
|
|
2341
|
+
className: "Layer__data-state__title"
|
|
2342
|
+
},
|
|
2343
|
+
title
|
|
2344
|
+
), /* @__PURE__ */ React36.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React36.createElement(
|
|
2345
|
+
Button,
|
|
2346
|
+
{
|
|
2347
|
+
variant: "secondary" /* secondary */,
|
|
2348
|
+
rightIcon: isLoading ? /* @__PURE__ */ React36.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React36.createElement(RefreshCcw_default, { size: 12 }),
|
|
2349
|
+
onClick: onRefresh,
|
|
2350
|
+
disabled: isLoading
|
|
2351
|
+
},
|
|
2352
|
+
"Refresh"
|
|
2353
|
+
)));
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2182
2356
|
// src/components/Loader/Loader.tsx
|
|
2183
|
-
import
|
|
2357
|
+
import React37 from "react";
|
|
2184
2358
|
var Loader2 = ({ children }) => {
|
|
2185
|
-
return /* @__PURE__ */
|
|
2359
|
+
return /* @__PURE__ */ React37.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React37.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
|
|
2186
2360
|
};
|
|
2187
2361
|
|
|
2188
2362
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
@@ -2204,10 +2378,12 @@ var filterVisibility = (display) => (bankTransaction) => {
|
|
|
2204
2378
|
const inReview = ReviewCategories.includes(bankTransaction.categorization_status) || bankTransaction.recently_categorized;
|
|
2205
2379
|
return display === "review" /* review */ && inReview || display === "categorized" /* categorized */ && categorized;
|
|
2206
2380
|
};
|
|
2207
|
-
var BankTransactions = (
|
|
2381
|
+
var BankTransactions = ({
|
|
2382
|
+
asWidget = false
|
|
2383
|
+
}) => {
|
|
2208
2384
|
const [display, setDisplay] = useState9("review" /* review */);
|
|
2209
|
-
const { data, isLoading } = useBankTransactions();
|
|
2210
|
-
const bankTransactions = data
|
|
2385
|
+
const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
|
|
2386
|
+
const bankTransactions = data?.filter(filterVisibility(display));
|
|
2211
2387
|
const onCategorizationDisplayChange = (event) => setDisplay(
|
|
2212
2388
|
event.target.value === "categorized" /* categorized */ ? "categorized" /* categorized */ : "review" /* review */
|
|
2213
2389
|
);
|
|
@@ -2225,15 +2401,15 @@ var BankTransactions = () => {
|
|
|
2225
2401
|
}
|
|
2226
2402
|
});
|
|
2227
2403
|
const editable = display === "review" /* review */;
|
|
2228
|
-
return /* @__PURE__ */
|
|
2404
|
+
return /* @__PURE__ */ React38.createElement(Container, { name: COMPONENT_NAME, asWidget }, /* @__PURE__ */ React38.createElement(
|
|
2229
2405
|
Header,
|
|
2230
2406
|
{
|
|
2231
2407
|
ref: headerRef,
|
|
2232
2408
|
className: "Layer__bank-transactions__header",
|
|
2233
2409
|
style: { top: shiftStickyHeader }
|
|
2234
2410
|
},
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2411
|
+
/* @__PURE__ */ React38.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
|
|
2412
|
+
/* @__PURE__ */ React38.createElement(
|
|
2237
2413
|
Toggle,
|
|
2238
2414
|
{
|
|
2239
2415
|
name: "bank-transaction-display",
|
|
@@ -2245,14 +2421,14 @@ var BankTransactions = () => {
|
|
|
2245
2421
|
onChange: onCategorizationDisplayChange
|
|
2246
2422
|
}
|
|
2247
2423
|
)
|
|
2248
|
-
), /* @__PURE__ */
|
|
2424
|
+
), /* @__PURE__ */ React38.createElement(
|
|
2249
2425
|
"table",
|
|
2250
2426
|
{
|
|
2251
2427
|
width: "100%",
|
|
2252
2428
|
className: "Layer__table Layer__bank-transactions__table"
|
|
2253
2429
|
},
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2430
|
+
/* @__PURE__ */ React38.createElement("thead", null, /* @__PURE__ */ React38.createElement("tr", null, /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
|
|
2431
|
+
/* @__PURE__ */ React38.createElement("tbody", null, !isLoading && bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React38.createElement(
|
|
2256
2432
|
BankTransactionRow,
|
|
2257
2433
|
{
|
|
2258
2434
|
key: bankTransaction.id,
|
|
@@ -2263,7 +2439,7 @@ var BankTransactions = () => {
|
|
|
2263
2439
|
editable
|
|
2264
2440
|
}
|
|
2265
2441
|
)))
|
|
2266
|
-
), isLoading
|
|
2442
|
+
), isLoading && !bankTransactions ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React38.createElement(Loader2, null)) : null, !isLoading && /* @__PURE__ */ React38.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React38.createElement(
|
|
2267
2443
|
BankTransactionListItem,
|
|
2268
2444
|
{
|
|
2269
2445
|
key: bankTransaction.id,
|
|
@@ -2273,11 +2449,29 @@ var BankTransactions = () => {
|
|
|
2273
2449
|
toggleOpen,
|
|
2274
2450
|
editable
|
|
2275
2451
|
}
|
|
2276
|
-
))))
|
|
2452
|
+
))), !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React38.createElement(
|
|
2453
|
+
DataState,
|
|
2454
|
+
{
|
|
2455
|
+
status: "allDone" /* allDone */,
|
|
2456
|
+
title: "You are up to date with transactions!",
|
|
2457
|
+
description: "All uncategorized transaction will be displayed here",
|
|
2458
|
+
onRefresh: () => refetch(),
|
|
2459
|
+
isLoading: isValidating
|
|
2460
|
+
}
|
|
2461
|
+
)) : null, !isLoading && error ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React38.createElement(
|
|
2462
|
+
DataState,
|
|
2463
|
+
{
|
|
2464
|
+
status: "failed" /* failed */,
|
|
2465
|
+
title: "Something went wrong",
|
|
2466
|
+
description: "We couldn\u2019t load your data.",
|
|
2467
|
+
onRefresh: () => refetch(),
|
|
2468
|
+
isLoading: isValidating
|
|
2469
|
+
}
|
|
2470
|
+
)) : null);
|
|
2277
2471
|
};
|
|
2278
2472
|
|
|
2279
2473
|
// src/components/Hello/Hello.tsx
|
|
2280
|
-
import
|
|
2474
|
+
import React39 from "react";
|
|
2281
2475
|
import useSWR3 from "swr";
|
|
2282
2476
|
var fetcher = (url) => fetch(url).then((res) => res.json());
|
|
2283
2477
|
var Hello = ({ user }) => {
|
|
@@ -2286,11 +2480,11 @@ var Hello = ({ user }) => {
|
|
|
2286
2480
|
fetcher
|
|
2287
2481
|
);
|
|
2288
2482
|
const name = (isLoading ? "..." : data?.name) || "User";
|
|
2289
|
-
return /* @__PURE__ */
|
|
2483
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
|
|
2290
2484
|
};
|
|
2291
2485
|
|
|
2292
2486
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
2293
|
-
import
|
|
2487
|
+
import React48, { createContext as createContext2 } from "react";
|
|
2294
2488
|
|
|
2295
2489
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
2296
2490
|
import { useState as useState10 } from "react";
|
|
@@ -2339,10 +2533,10 @@ var useProfitAndLoss = ({ startDate: initialStartDate, endDate: initialEndDate }
|
|
|
2339
2533
|
};
|
|
2340
2534
|
|
|
2341
2535
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
2342
|
-
import
|
|
2536
|
+
import React41, { useContext as useContext2, useMemo, useState as useState11 } from "react";
|
|
2343
2537
|
|
|
2344
2538
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
2345
|
-
import
|
|
2539
|
+
import React40, { useEffect as useEffect3 } from "react";
|
|
2346
2540
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
2347
2541
|
var Indicator = ({
|
|
2348
2542
|
viewBox = {},
|
|
@@ -2366,7 +2560,7 @@ var Indicator = ({
|
|
|
2366
2560
|
setAnimateFrom(animateTo);
|
|
2367
2561
|
}, [animateTo]);
|
|
2368
2562
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
2369
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ React40.createElement(
|
|
2370
2564
|
"rect",
|
|
2371
2565
|
{
|
|
2372
2566
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
@@ -2498,7 +2692,7 @@ var ProfitAndLossChart = () => {
|
|
|
2498
2692
|
]
|
|
2499
2693
|
);
|
|
2500
2694
|
const [animateFrom, setAnimateFrom] = useState11(-1);
|
|
2501
|
-
return /* @__PURE__ */
|
|
2695
|
+
return /* @__PURE__ */ React41.createElement(ResponsiveContainer, { width: "100%", height: 250 }, /* @__PURE__ */ React41.createElement(
|
|
2502
2696
|
BarChart,
|
|
2503
2697
|
{
|
|
2504
2698
|
margin: { left: 24, right: 24, bottom: 24 },
|
|
@@ -2507,8 +2701,8 @@ var ProfitAndLossChart = () => {
|
|
|
2507
2701
|
barGap,
|
|
2508
2702
|
className: "Layer__profit-and-loss-chart"
|
|
2509
2703
|
},
|
|
2510
|
-
/* @__PURE__ */
|
|
2511
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ React41.createElement(CartesianGrid, { vertical: false }),
|
|
2705
|
+
/* @__PURE__ */ React41.createElement(
|
|
2512
2706
|
Legend,
|
|
2513
2707
|
{
|
|
2514
2708
|
verticalAlign: "top",
|
|
@@ -2519,8 +2713,8 @@ var ProfitAndLossChart = () => {
|
|
|
2519
2713
|
]
|
|
2520
2714
|
}
|
|
2521
2715
|
),
|
|
2522
|
-
/* @__PURE__ */
|
|
2523
|
-
/* @__PURE__ */
|
|
2716
|
+
/* @__PURE__ */ React41.createElement(XAxis, { dataKey: "name", tickLine: false }),
|
|
2717
|
+
/* @__PURE__ */ React41.createElement(
|
|
2524
2718
|
Bar,
|
|
2525
2719
|
{
|
|
2526
2720
|
dataKey: "revenue",
|
|
@@ -2529,10 +2723,10 @@ var ProfitAndLossChart = () => {
|
|
|
2529
2723
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
2530
2724
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
2531
2725
|
},
|
|
2532
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ React41.createElement(
|
|
2533
2727
|
LabelList,
|
|
2534
2728
|
{
|
|
2535
|
-
content: /* @__PURE__ */
|
|
2729
|
+
content: /* @__PURE__ */ React41.createElement(
|
|
2536
2730
|
Indicator,
|
|
2537
2731
|
{
|
|
2538
2732
|
animateFrom,
|
|
@@ -2541,7 +2735,7 @@ var ProfitAndLossChart = () => {
|
|
|
2541
2735
|
)
|
|
2542
2736
|
}
|
|
2543
2737
|
),
|
|
2544
|
-
data.map((entry) => /* @__PURE__ */
|
|
2738
|
+
data.map((entry) => /* @__PURE__ */ React41.createElement(
|
|
2545
2739
|
Cell,
|
|
2546
2740
|
{
|
|
2547
2741
|
key: entry.name,
|
|
@@ -2549,7 +2743,7 @@ var ProfitAndLossChart = () => {
|
|
|
2549
2743
|
}
|
|
2550
2744
|
))
|
|
2551
2745
|
),
|
|
2552
|
-
/* @__PURE__ */
|
|
2746
|
+
/* @__PURE__ */ React41.createElement(
|
|
2553
2747
|
Bar,
|
|
2554
2748
|
{
|
|
2555
2749
|
dataKey: "expenses",
|
|
@@ -2558,7 +2752,7 @@ var ProfitAndLossChart = () => {
|
|
|
2558
2752
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
2559
2753
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
2560
2754
|
},
|
|
2561
|
-
data.map((entry) => /* @__PURE__ */
|
|
2755
|
+
data.map((entry) => /* @__PURE__ */ React41.createElement(
|
|
2562
2756
|
Cell,
|
|
2563
2757
|
{
|
|
2564
2758
|
key: entry.name,
|
|
@@ -2570,15 +2764,15 @@ var ProfitAndLossChart = () => {
|
|
|
2570
2764
|
};
|
|
2571
2765
|
|
|
2572
2766
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
2573
|
-
import
|
|
2767
|
+
import React44, { useContext as useContext3 } from "react";
|
|
2574
2768
|
|
|
2575
2769
|
// src/icons/ChevronLeft.tsx
|
|
2576
|
-
import * as
|
|
2770
|
+
import * as React42 from "react";
|
|
2577
2771
|
var ChevronLeft = ({
|
|
2578
2772
|
strokeColor,
|
|
2579
2773
|
size,
|
|
2580
2774
|
...props
|
|
2581
|
-
}) => /* @__PURE__ */
|
|
2775
|
+
}) => /* @__PURE__ */ React42.createElement(
|
|
2582
2776
|
"svg",
|
|
2583
2777
|
{
|
|
2584
2778
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2588,7 +2782,7 @@ var ChevronLeft = ({
|
|
|
2588
2782
|
viewBox: "0 0 24 24",
|
|
2589
2783
|
...props
|
|
2590
2784
|
},
|
|
2591
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ React42.createElement(
|
|
2592
2786
|
"path",
|
|
2593
2787
|
{
|
|
2594
2788
|
stroke: strokeColor ?? "#000",
|
|
@@ -2602,8 +2796,8 @@ var ChevronLeft = ({
|
|
|
2602
2796
|
var ChevronLeft_default = ChevronLeft;
|
|
2603
2797
|
|
|
2604
2798
|
// src/icons/ChevronRight.tsx
|
|
2605
|
-
import * as
|
|
2606
|
-
var ChavronRight = ({ size, ...props }) => /* @__PURE__ */
|
|
2799
|
+
import * as React43 from "react";
|
|
2800
|
+
var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React43.createElement(
|
|
2607
2801
|
"svg",
|
|
2608
2802
|
{
|
|
2609
2803
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2613,7 +2807,7 @@ var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React41.createElement
|
|
|
2613
2807
|
viewBox: "0 0 24 24",
|
|
2614
2808
|
...props
|
|
2615
2809
|
},
|
|
2616
|
-
/* @__PURE__ */
|
|
2810
|
+
/* @__PURE__ */ React43.createElement(
|
|
2617
2811
|
"path",
|
|
2618
2812
|
{
|
|
2619
2813
|
stroke: "#000",
|
|
@@ -2641,28 +2835,28 @@ var ProfitAndLossDatePicker = () => {
|
|
|
2641
2835
|
};
|
|
2642
2836
|
const previousMonth = () => change({ months: -1 });
|
|
2643
2837
|
const nextMonth = () => change({ months: 1 });
|
|
2644
|
-
return /* @__PURE__ */
|
|
2838
|
+
return /* @__PURE__ */ React44.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React44.createElement(
|
|
2645
2839
|
"button",
|
|
2646
2840
|
{
|
|
2647
2841
|
"aria-label": "View Previous Month",
|
|
2648
2842
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
2649
2843
|
onClick: previousMonth
|
|
2650
2844
|
},
|
|
2651
|
-
/* @__PURE__ */
|
|
2845
|
+
/* @__PURE__ */ React44.createElement(
|
|
2652
2846
|
ChevronLeft_default,
|
|
2653
2847
|
{
|
|
2654
2848
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
2655
2849
|
size: 18
|
|
2656
2850
|
}
|
|
2657
2851
|
)
|
|
2658
|
-
), /* @__PURE__ */
|
|
2852
|
+
), /* @__PURE__ */ React44.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React44.createElement(
|
|
2659
2853
|
"button",
|
|
2660
2854
|
{
|
|
2661
2855
|
"aria-label": "View Next Month",
|
|
2662
2856
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
2663
2857
|
onClick: nextMonth
|
|
2664
2858
|
},
|
|
2665
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ React44.createElement(
|
|
2666
2860
|
ChevronRight_default,
|
|
2667
2861
|
{
|
|
2668
2862
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
@@ -2673,26 +2867,26 @@ var ProfitAndLossDatePicker = () => {
|
|
|
2673
2867
|
};
|
|
2674
2868
|
|
|
2675
2869
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
2676
|
-
import
|
|
2870
|
+
import React45, { useContext as useContext4 } from "react";
|
|
2677
2871
|
var ProfitAndLossSummaries = () => {
|
|
2678
2872
|
const { data: storedData } = useContext4(ProfitAndLoss.Context);
|
|
2679
2873
|
const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
|
|
2680
2874
|
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
2681
2875
|
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
2682
2876
|
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
2683
|
-
return /* @__PURE__ */
|
|
2877
|
+
return /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries" }, /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--income" }, /* @__PURE__ */ React45.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Revenue"), /* @__PURE__ */ React45.createElement(
|
|
2684
2878
|
"span",
|
|
2685
2879
|
{
|
|
2686
2880
|
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
2687
2881
|
},
|
|
2688
2882
|
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
2689
|
-
)), /* @__PURE__ */
|
|
2883
|
+
)), /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--expenses" }, /* @__PURE__ */ React45.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), /* @__PURE__ */ React45.createElement(
|
|
2690
2884
|
"span",
|
|
2691
2885
|
{
|
|
2692
2886
|
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
2693
2887
|
},
|
|
2694
2888
|
centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
|
|
2695
|
-
)), /* @__PURE__ */
|
|
2889
|
+
)), /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React45.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), /* @__PURE__ */ React45.createElement(
|
|
2696
2890
|
"span",
|
|
2697
2891
|
{
|
|
2698
2892
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -2702,10 +2896,10 @@ var ProfitAndLossSummaries = () => {
|
|
|
2702
2896
|
};
|
|
2703
2897
|
|
|
2704
2898
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
2705
|
-
import
|
|
2899
|
+
import React47, { useContext as useContext5 } from "react";
|
|
2706
2900
|
|
|
2707
2901
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
2708
|
-
import
|
|
2902
|
+
import React46, { useState as useState12 } from "react";
|
|
2709
2903
|
var ProfitAndLossRow = ({
|
|
2710
2904
|
variant,
|
|
2711
2905
|
lineItem,
|
|
@@ -2749,12 +2943,12 @@ var ProfitAndLossRow = ({
|
|
|
2749
2943
|
);
|
|
2750
2944
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
2751
2945
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
2752
|
-
return /* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement("div", { className: labelClasses.join(" "), onClick: toggleExpanded }, /* @__PURE__ */ React46.createElement(ChevronDown_default, { size: 16 }), display_name), /* @__PURE__ */ React46.createElement("div", { className: valueClasses.join(" ") }, amountString), canGoDeeper && hasChildren && /* @__PURE__ */ React46.createElement(
|
|
2753
2947
|
"div",
|
|
2754
2948
|
{
|
|
2755
2949
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
2756
2950
|
},
|
|
2757
|
-
/* @__PURE__ */
|
|
2951
|
+
/* @__PURE__ */ React46.createElement("div", { className: "Layer__balance-sheet-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React46.createElement(
|
|
2758
2952
|
ProfitAndLossRow,
|
|
2759
2953
|
{
|
|
2760
2954
|
key: line_item.display_name,
|
|
@@ -2763,7 +2957,7 @@ var ProfitAndLossRow = ({
|
|
|
2763
2957
|
maxDepth,
|
|
2764
2958
|
direction
|
|
2765
2959
|
}
|
|
2766
|
-
)), summarize && /* @__PURE__ */
|
|
2960
|
+
)), summarize && /* @__PURE__ */ React46.createElement(
|
|
2767
2961
|
ProfitAndLossRow,
|
|
2768
2962
|
{
|
|
2769
2963
|
key: display_name,
|
|
@@ -2828,13 +3022,13 @@ var empty_profit_and_loss_report_default = {
|
|
|
2828
3022
|
var ProfitAndLossTable = () => {
|
|
2829
3023
|
const { data: actualData, isLoading } = useContext5(ProfitAndLoss.Context);
|
|
2830
3024
|
const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
|
|
2831
|
-
return /* @__PURE__ */
|
|
3025
|
+
return /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement("div", { className: "Layer__profit-and-loss-table" }, /* @__PURE__ */ React47.createElement(ProfitAndLossRow, { lineItem: data.income, direction: "CREDIT" /* CREDIT */ }), /* @__PURE__ */ React47.createElement(
|
|
2832
3026
|
ProfitAndLossRow,
|
|
2833
3027
|
{
|
|
2834
3028
|
lineItem: data.cost_of_goods_sold,
|
|
2835
3029
|
direction: "DEBIT" /* DEBIT */
|
|
2836
3030
|
}
|
|
2837
|
-
), /* @__PURE__ */
|
|
3031
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2838
3032
|
ProfitAndLossRow,
|
|
2839
3033
|
{
|
|
2840
3034
|
lineItem: {
|
|
@@ -2844,13 +3038,13 @@ var ProfitAndLossTable = () => {
|
|
|
2844
3038
|
variant: "summation",
|
|
2845
3039
|
direction: "CREDIT" /* CREDIT */
|
|
2846
3040
|
}
|
|
2847
|
-
), /* @__PURE__ */
|
|
3041
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2848
3042
|
ProfitAndLossRow,
|
|
2849
3043
|
{
|
|
2850
3044
|
lineItem: data.expenses,
|
|
2851
3045
|
direction: "DEBIT" /* DEBIT */
|
|
2852
3046
|
}
|
|
2853
|
-
), /* @__PURE__ */
|
|
3047
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2854
3048
|
ProfitAndLossRow,
|
|
2855
3049
|
{
|
|
2856
3050
|
lineItem: {
|
|
@@ -2860,7 +3054,7 @@ var ProfitAndLossTable = () => {
|
|
|
2860
3054
|
variant: "summation",
|
|
2861
3055
|
direction: "CREDIT" /* CREDIT */
|
|
2862
3056
|
}
|
|
2863
|
-
), /* @__PURE__ */
|
|
3057
|
+
), /* @__PURE__ */ React47.createElement(ProfitAndLossRow, { lineItem: data.taxes, direction: "DEBIT" /* DEBIT */ }), /* @__PURE__ */ React47.createElement(
|
|
2864
3058
|
ProfitAndLossRow,
|
|
2865
3059
|
{
|
|
2866
3060
|
lineItem: {
|
|
@@ -2870,13 +3064,13 @@ var ProfitAndLossTable = () => {
|
|
|
2870
3064
|
variant: "summation",
|
|
2871
3065
|
direction: "CREDIT" /* CREDIT */
|
|
2872
3066
|
}
|
|
2873
|
-
)), /* @__PURE__ */
|
|
3067
|
+
)), /* @__PURE__ */ React47.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React47.createElement(
|
|
2874
3068
|
ProfitAndLossRow,
|
|
2875
3069
|
{
|
|
2876
3070
|
lineItem: data.other_outflows,
|
|
2877
3071
|
direction: "DEBIT" /* DEBIT */
|
|
2878
3072
|
}
|
|
2879
|
-
), /* @__PURE__ */
|
|
3073
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2880
3074
|
ProfitAndLossRow,
|
|
2881
3075
|
{
|
|
2882
3076
|
lineItem: data.personal_expenses,
|
|
@@ -2900,7 +3094,7 @@ var PNLContext = createContext2({
|
|
|
2900
3094
|
});
|
|
2901
3095
|
var ProfitAndLoss = ({ children }) => {
|
|
2902
3096
|
const contextData = useProfitAndLoss();
|
|
2903
|
-
return /* @__PURE__ */
|
|
3097
|
+
return /* @__PURE__ */ React48.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React48.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, /* @__PURE__ */ React48.createElement("h2", { className: "Layer__profit-and-loss__title" }, "Profit & Loss"), children));
|
|
2904
3098
|
};
|
|
2905
3099
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
2906
3100
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -2909,7 +3103,7 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
2909
3103
|
ProfitAndLoss.Table = ProfitAndLossTable;
|
|
2910
3104
|
|
|
2911
3105
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
2912
|
-
import
|
|
3106
|
+
import React49, { useReducer, useEffect as useEffect4 } from "react";
|
|
2913
3107
|
import { add as add2, isBefore } from "date-fns";
|
|
2914
3108
|
import useSWR5, { SWRConfig } from "swr";
|
|
2915
3109
|
var reducer = (state, action) => {
|
|
@@ -3014,11 +3208,11 @@ var LayerProvider = ({
|
|
|
3014
3208
|
type: "LayerContext.setTheme" /* setTheme */,
|
|
3015
3209
|
payload: { theme: theme2 }
|
|
3016
3210
|
});
|
|
3017
|
-
return /* @__PURE__ */
|
|
3211
|
+
return /* @__PURE__ */ React49.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React49.createElement(LayerContext.Provider, { value: { ...state, setTheme } }, children));
|
|
3018
3212
|
};
|
|
3019
3213
|
|
|
3020
3214
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
3021
|
-
import
|
|
3215
|
+
import React52, { useState as useState14 } from "react";
|
|
3022
3216
|
|
|
3023
3217
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
3024
3218
|
import useSWR6 from "swr";
|
|
@@ -3038,7 +3232,7 @@ var useChartOfAccounts = () => {
|
|
|
3038
3232
|
};
|
|
3039
3233
|
|
|
3040
3234
|
// src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
|
|
3041
|
-
import
|
|
3235
|
+
import React50, { useMemo as useMemo2, useState as useState13 } from "react";
|
|
3042
3236
|
import Select2 from "react-select";
|
|
3043
3237
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
|
|
3044
3238
|
var ChartOfAccountsNewForm = () => {
|
|
@@ -3066,21 +3260,21 @@ var ChartOfAccountsNewForm = () => {
|
|
|
3066
3260
|
description
|
|
3067
3261
|
});
|
|
3068
3262
|
};
|
|
3069
|
-
return /* @__PURE__ */
|
|
3263
|
+
return /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Name"), /* @__PURE__ */ React50.createElement(
|
|
3070
3264
|
"input",
|
|
3071
3265
|
{
|
|
3072
3266
|
name: "name",
|
|
3073
3267
|
value: name,
|
|
3074
3268
|
onChange: (event) => setName(event.target.value)
|
|
3075
3269
|
}
|
|
3076
|
-
)), /* @__PURE__ */
|
|
3270
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Description"), /* @__PURE__ */ React50.createElement(
|
|
3077
3271
|
"input",
|
|
3078
3272
|
{
|
|
3079
3273
|
name: "description",
|
|
3080
3274
|
value: description,
|
|
3081
3275
|
onChange: (event) => setDescription(event.target.value)
|
|
3082
3276
|
}
|
|
3083
|
-
)), /* @__PURE__ */
|
|
3277
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Normality"), /* @__PURE__ */ React50.createElement(
|
|
3084
3278
|
Select2,
|
|
3085
3279
|
{
|
|
3086
3280
|
isSearchable: false,
|
|
@@ -3090,7 +3284,7 @@ var ChartOfAccountsNewForm = () => {
|
|
|
3090
3284
|
{ label: "Debit", value: "DEBIT" /* DEBIT */ }
|
|
3091
3285
|
]
|
|
3092
3286
|
}
|
|
3093
|
-
)), /* @__PURE__ */
|
|
3287
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Parent Account"), /* @__PURE__ */ React50.createElement(
|
|
3094
3288
|
Select2,
|
|
3095
3289
|
{
|
|
3096
3290
|
isSearchable: true,
|
|
@@ -3100,49 +3294,49 @@ var ChartOfAccountsNewForm = () => {
|
|
|
3100
3294
|
getOptionValue: (a) => a.id,
|
|
3101
3295
|
options: accountOptions
|
|
3102
3296
|
}
|
|
3103
|
-
)), /* @__PURE__ */
|
|
3297
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ React50.createElement("button", { onClick: save }, "Save")));
|
|
3104
3298
|
};
|
|
3105
3299
|
|
|
3106
3300
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
3107
|
-
import
|
|
3301
|
+
import React51 from "react";
|
|
3108
3302
|
var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
3109
|
-
const
|
|
3303
|
+
const classNames13 = [
|
|
3110
3304
|
"Layer__chart-of-accounts-row__table-cell",
|
|
3111
3305
|
depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
|
|
3112
3306
|
];
|
|
3113
|
-
const className =
|
|
3307
|
+
const className = classNames13.filter((id) => id).join(" ");
|
|
3114
3308
|
const amountClassName = account.balance < 0 ? "Layer__chart-of-accounts-row__table-cell--amount-negative" : "Layer__chart-of-accounts-row__table-cell--amount-positive";
|
|
3115
|
-
return /* @__PURE__ */
|
|
3309
|
+
return /* @__PURE__ */ React51.createElement(React51.Fragment, null, /* @__PURE__ */ React51.createElement(
|
|
3116
3310
|
"div",
|
|
3117
3311
|
{
|
|
3118
3312
|
className: `${className} Layer__chart-of-accounts-row__table-cell--name`
|
|
3119
3313
|
},
|
|
3120
3314
|
account.name
|
|
3121
|
-
), /* @__PURE__ */
|
|
3315
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3122
3316
|
"div",
|
|
3123
3317
|
{
|
|
3124
3318
|
className: `${className} Layer__chart-of-accounts-row__table-cell--type`
|
|
3125
3319
|
},
|
|
3126
3320
|
"Assets"
|
|
3127
|
-
), /* @__PURE__ */
|
|
3321
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3128
3322
|
"div",
|
|
3129
3323
|
{
|
|
3130
3324
|
className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
|
|
3131
3325
|
},
|
|
3132
3326
|
"Cash"
|
|
3133
|
-
), /* @__PURE__ */
|
|
3327
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3134
3328
|
"div",
|
|
3135
3329
|
{
|
|
3136
3330
|
className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
|
|
3137
3331
|
},
|
|
3138
3332
|
centsToDollars(Math.abs(account.balance || 0))
|
|
3139
|
-
), /* @__PURE__ */
|
|
3333
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3140
3334
|
"div",
|
|
3141
3335
|
{
|
|
3142
3336
|
className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
|
|
3143
3337
|
},
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */
|
|
3338
|
+
/* @__PURE__ */ React51.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
|
|
3339
|
+
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React51.createElement(
|
|
3146
3340
|
ChartOfAccountsRow,
|
|
3147
3341
|
{
|
|
3148
3342
|
key: subAccount.id,
|
|
@@ -3156,14 +3350,14 @@ var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
|
3156
3350
|
var ChartOfAccounts = () => {
|
|
3157
3351
|
const { data, isLoading } = useChartOfAccounts();
|
|
3158
3352
|
const [showingForm, setShowingForm] = useState14(false);
|
|
3159
|
-
return /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ React52.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ React52.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ React52.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ React52.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ React52.createElement(
|
|
3160
3354
|
"button",
|
|
3161
3355
|
{
|
|
3162
3356
|
className: "Layer__chart-of-accounts__edit-accounts-button",
|
|
3163
3357
|
onClick: () => setShowingForm(!showingForm)
|
|
3164
3358
|
},
|
|
3165
3359
|
"Edit Accounts"
|
|
3166
|
-
))), showingForm && /* @__PURE__ */
|
|
3360
|
+
))), showingForm && /* @__PURE__ */ React52.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header Layer__chart-of-accounts__table-cell--header-balance" }, "Balance"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ React52.createElement(
|
|
3167
3361
|
ChartOfAccountsRow,
|
|
3168
3362
|
{
|
|
3169
3363
|
key: account.id,
|