@layerfi/components 0.1.66 → 0.1.67
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 +228 -196
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +39 -5
- package/dist/index.js +213 -181
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +8 -0
- package/dist/styles/index.css.map +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -289,6 +289,9 @@ var getProfitAndLossCsv = get(
|
|
|
289
289
|
moneyFormat
|
|
290
290
|
}) => `/v1/businesses/${businessId}/reports/profit-and-loss/exports/csv?${startDate ? `start_date=${encodeURIComponent(startDate)}` : ""}${endDate ? `&end_date=${encodeURIComponent(endDate)}` : ""}${month ? `&month=${month}` : ""}${year ? `&year=${year}` : ""}${reportingBasis ? `&reporting_basis=${reportingBasis}` : ""}${tagKey ? `&tag_key=${tagKey}` : ""}${tagValues ? `&tag_values=${tagValues}` : ""}${moneyFormat ? `&money_format=${moneyFormat}` : ""}`
|
|
291
291
|
);
|
|
292
|
+
var profitAndLossComparisonCsv = post(
|
|
293
|
+
({ businessId, moneyFormat }) => `/v1/businesses/${businessId}/reports/profit-and-loss/exports/comparison-csv?money_format=${moneyFormat ? moneyFormat : "DOLLAR_STRING"}`
|
|
294
|
+
);
|
|
292
295
|
|
|
293
296
|
// src/api/layer/quickbooks.ts
|
|
294
297
|
var syncFromQuickbooks = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/sync-from`);
|
|
@@ -345,6 +348,7 @@ var Layer = {
|
|
|
345
348
|
getLinkedAccounts,
|
|
346
349
|
getJournal,
|
|
347
350
|
compareProfitAndLoss,
|
|
351
|
+
profitAndLossComparisonCsv,
|
|
348
352
|
createJournalEntries,
|
|
349
353
|
getPlaidLinkToken,
|
|
350
354
|
getPlaidUpdateModeLinkToken,
|
|
@@ -2418,7 +2422,7 @@ var ChevronRight = ({ ...props }) => /* @__PURE__ */ React16.createElement(
|
|
|
2418
2422
|
var ChevronRight_default = ChevronRight;
|
|
2419
2423
|
|
|
2420
2424
|
// src/components/Button/Button.tsx
|
|
2421
|
-
import
|
|
2425
|
+
import React20, { useRef as useRef2 } from "react";
|
|
2422
2426
|
|
|
2423
2427
|
// src/icons/Loader.tsx
|
|
2424
2428
|
import * as React17 from "react";
|
|
@@ -2507,6 +2511,150 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React17.createElement(
|
|
|
2507
2511
|
);
|
|
2508
2512
|
var Loader_default = Loader;
|
|
2509
2513
|
|
|
2514
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
2515
|
+
import React19, {
|
|
2516
|
+
forwardRef as forwardRef4,
|
|
2517
|
+
isValidElement,
|
|
2518
|
+
cloneElement
|
|
2519
|
+
} from "react";
|
|
2520
|
+
|
|
2521
|
+
// src/components/Tooltip/useTooltip.ts
|
|
2522
|
+
import React18, { useState as useState6 } from "react";
|
|
2523
|
+
import {
|
|
2524
|
+
useFloating,
|
|
2525
|
+
autoUpdate,
|
|
2526
|
+
offset,
|
|
2527
|
+
flip,
|
|
2528
|
+
shift,
|
|
2529
|
+
useHover,
|
|
2530
|
+
useFocus,
|
|
2531
|
+
useDismiss,
|
|
2532
|
+
useRole,
|
|
2533
|
+
useInteractions,
|
|
2534
|
+
useTransitionStyles
|
|
2535
|
+
} from "@floating-ui/react";
|
|
2536
|
+
var TooltipContext = React18.createContext(null);
|
|
2537
|
+
var useTooltipContext = () => {
|
|
2538
|
+
const context = React18.useContext(TooltipContext);
|
|
2539
|
+
if (context == null) {
|
|
2540
|
+
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
2541
|
+
}
|
|
2542
|
+
return context;
|
|
2543
|
+
};
|
|
2544
|
+
var useTooltip = ({
|
|
2545
|
+
initialOpen = false,
|
|
2546
|
+
placement = "top",
|
|
2547
|
+
open: controlledOpen,
|
|
2548
|
+
onOpenChange: setControlledOpen,
|
|
2549
|
+
disabled,
|
|
2550
|
+
offset: offsetProp = 5,
|
|
2551
|
+
shift: shiftProp = { padding: 5 }
|
|
2552
|
+
} = {}) => {
|
|
2553
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState6(initialOpen);
|
|
2554
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
2555
|
+
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
2556
|
+
const data = useFloating({
|
|
2557
|
+
placement,
|
|
2558
|
+
open: disabled ? false : open,
|
|
2559
|
+
onOpenChange: setOpen,
|
|
2560
|
+
whileElementsMounted: autoUpdate,
|
|
2561
|
+
middleware: [
|
|
2562
|
+
offset(offsetProp),
|
|
2563
|
+
flip({
|
|
2564
|
+
crossAxis: placement.includes("-"),
|
|
2565
|
+
fallbackAxisSideDirection: "start",
|
|
2566
|
+
padding: shiftProp?.padding ?? 5
|
|
2567
|
+
}),
|
|
2568
|
+
shift(shiftProp)
|
|
2569
|
+
]
|
|
2570
|
+
});
|
|
2571
|
+
const context = data.context;
|
|
2572
|
+
const hover = useHover(context, {
|
|
2573
|
+
move: false,
|
|
2574
|
+
enabled: controlledOpen == null
|
|
2575
|
+
});
|
|
2576
|
+
const focus = useFocus(context, {
|
|
2577
|
+
enabled: controlledOpen == null
|
|
2578
|
+
});
|
|
2579
|
+
const dismiss = useDismiss(context);
|
|
2580
|
+
const role = useRole(context, { role: "tooltip" });
|
|
2581
|
+
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
2582
|
+
const { isMounted, styles } = useTransitionStyles(context, {
|
|
2583
|
+
initial: {
|
|
2584
|
+
opacity: 0,
|
|
2585
|
+
transform: "scale(0.7)",
|
|
2586
|
+
color: "transparent"
|
|
2587
|
+
},
|
|
2588
|
+
duration: 300
|
|
2589
|
+
});
|
|
2590
|
+
return React18.useMemo(
|
|
2591
|
+
() => ({
|
|
2592
|
+
open,
|
|
2593
|
+
setOpen,
|
|
2594
|
+
isMounted,
|
|
2595
|
+
styles,
|
|
2596
|
+
disabled,
|
|
2597
|
+
...interactions,
|
|
2598
|
+
...data
|
|
2599
|
+
}),
|
|
2600
|
+
[open, setOpen, interactions, data, styles, disabled]
|
|
2601
|
+
);
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2604
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
2605
|
+
import { useMergeRefs, FloatingPortal } from "@floating-ui/react";
|
|
2606
|
+
var Tooltip = ({
|
|
2607
|
+
children,
|
|
2608
|
+
...options
|
|
2609
|
+
}) => {
|
|
2610
|
+
const tooltip = useTooltip(options);
|
|
2611
|
+
return /* @__PURE__ */ React19.createElement(TooltipContext.Provider, { value: tooltip }, children);
|
|
2612
|
+
};
|
|
2613
|
+
var TooltipTrigger = forwardRef4(function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
|
|
2614
|
+
const context = useTooltipContext();
|
|
2615
|
+
const childrenRef = children.ref;
|
|
2616
|
+
const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
2617
|
+
if (asChild && isValidElement(children)) {
|
|
2618
|
+
return cloneElement(
|
|
2619
|
+
children,
|
|
2620
|
+
context.getReferenceProps({
|
|
2621
|
+
ref,
|
|
2622
|
+
...props,
|
|
2623
|
+
...children.props,
|
|
2624
|
+
"data-state": context.open ? "open" : "closed"
|
|
2625
|
+
})
|
|
2626
|
+
);
|
|
2627
|
+
}
|
|
2628
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2629
|
+
"span",
|
|
2630
|
+
{
|
|
2631
|
+
ref,
|
|
2632
|
+
"data-state": context.open ? "open" : "closed",
|
|
2633
|
+
className: `Layer__tooltip-trigger Layer__tooltip-trigger--${context.open ? "open" : "closed"}`,
|
|
2634
|
+
...context.getReferenceProps(props)
|
|
2635
|
+
},
|
|
2636
|
+
children
|
|
2637
|
+
);
|
|
2638
|
+
});
|
|
2639
|
+
var TooltipContent = forwardRef4(function TooltipContent2({ style, className, ...props }, propRef) {
|
|
2640
|
+
const context = useTooltipContext();
|
|
2641
|
+
const ref = useMergeRefs([context.refs.setFloating, propRef]);
|
|
2642
|
+
if (!context.open || context.disabled)
|
|
2643
|
+
return null;
|
|
2644
|
+
return /* @__PURE__ */ React19.createElement(FloatingPortal, null, /* @__PURE__ */ React19.createElement(
|
|
2645
|
+
"div",
|
|
2646
|
+
{
|
|
2647
|
+
ref,
|
|
2648
|
+
className,
|
|
2649
|
+
style: {
|
|
2650
|
+
...context.floatingStyles
|
|
2651
|
+
},
|
|
2652
|
+
...context.getFloatingProps(props)
|
|
2653
|
+
},
|
|
2654
|
+
/* @__PURE__ */ React19.createElement("div", { className: "Layer__tooltip-content", style: { ...context.styles } }, props.children)
|
|
2655
|
+
));
|
|
2656
|
+
});
|
|
2657
|
+
|
|
2510
2658
|
// src/components/Button/Button.tsx
|
|
2511
2659
|
import classNames4 from "classnames";
|
|
2512
2660
|
var Button = ({
|
|
@@ -2520,6 +2668,7 @@ var Button = ({
|
|
|
2520
2668
|
justify = "center",
|
|
2521
2669
|
fullWidth,
|
|
2522
2670
|
isProcessing,
|
|
2671
|
+
tooltip,
|
|
2523
2672
|
...props
|
|
2524
2673
|
}) => {
|
|
2525
2674
|
const buttonRef = useRef2(null);
|
|
@@ -2539,6 +2688,7 @@ var Button = ({
|
|
|
2539
2688
|
iconOnly ? "Layer__btn--icon-only" : "",
|
|
2540
2689
|
iconAsPrimary && "Layer__btn--with-primary-icon",
|
|
2541
2690
|
fullWidth && "Layer__btn--full-width",
|
|
2691
|
+
tooltip && "Layer__btn--with-tooltip",
|
|
2542
2692
|
className
|
|
2543
2693
|
);
|
|
2544
2694
|
const startAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
@@ -2547,7 +2697,26 @@ var Button = ({
|
|
|
2547
2697
|
const stopAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
2548
2698
|
(el) => el.endElement()
|
|
2549
2699
|
);
|
|
2550
|
-
|
|
2700
|
+
const content = /* @__PURE__ */ React20.createElement("span", { className: `Layer__btn-content Layer__justify--${justifyContent}` }, leftIcon && /* @__PURE__ */ React20.createElement(
|
|
2701
|
+
"span",
|
|
2702
|
+
{
|
|
2703
|
+
className: classNames4(
|
|
2704
|
+
"Layer__btn-icon Layer__btn-icon--left",
|
|
2705
|
+
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2706
|
+
)
|
|
2707
|
+
},
|
|
2708
|
+
isProcessing ? /* @__PURE__ */ React20.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : leftIcon
|
|
2709
|
+
), !iconOnly && /* @__PURE__ */ React20.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ React20.createElement(
|
|
2710
|
+
"span",
|
|
2711
|
+
{
|
|
2712
|
+
className: classNames4(
|
|
2713
|
+
"Layer__btn-icon Layer__btn-icon--right",
|
|
2714
|
+
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2715
|
+
)
|
|
2716
|
+
},
|
|
2717
|
+
isProcessing ? /* @__PURE__ */ React20.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : rightIcon
|
|
2718
|
+
));
|
|
2719
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2551
2720
|
"button",
|
|
2552
2721
|
{
|
|
2553
2722
|
...props,
|
|
@@ -2556,30 +2725,12 @@ var Button = ({
|
|
|
2556
2725
|
onMouseLeave: stopAnimation,
|
|
2557
2726
|
ref: buttonRef
|
|
2558
2727
|
},
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
"span",
|
|
2561
|
-
{
|
|
2562
|
-
className: classNames4(
|
|
2563
|
-
"Layer__btn-icon Layer__btn-icon--left",
|
|
2564
|
-
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2565
|
-
)
|
|
2566
|
-
},
|
|
2567
|
-
isProcessing ? /* @__PURE__ */ React18.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : leftIcon
|
|
2568
|
-
), !iconOnly && /* @__PURE__ */ React18.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ React18.createElement(
|
|
2569
|
-
"span",
|
|
2570
|
-
{
|
|
2571
|
-
className: classNames4(
|
|
2572
|
-
"Layer__btn-icon Layer__btn-icon--right",
|
|
2573
|
-
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2574
|
-
)
|
|
2575
|
-
},
|
|
2576
|
-
isProcessing ? /* @__PURE__ */ React18.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : rightIcon
|
|
2577
|
-
))
|
|
2728
|
+
tooltip ? /* @__PURE__ */ React20.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React20.createElement(TooltipTrigger, null, content), tooltip && /* @__PURE__ */ React20.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip)) : content
|
|
2578
2729
|
);
|
|
2579
2730
|
};
|
|
2580
2731
|
|
|
2581
2732
|
// src/components/Button/IconButton.tsx
|
|
2582
|
-
import
|
|
2733
|
+
import React21 from "react";
|
|
2583
2734
|
import classNames5 from "classnames";
|
|
2584
2735
|
var IconButton = ({
|
|
2585
2736
|
className,
|
|
@@ -2595,15 +2746,15 @@ var IconButton = ({
|
|
|
2595
2746
|
withBorder && "Layer__icon-btn--border",
|
|
2596
2747
|
className
|
|
2597
2748
|
);
|
|
2598
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ React21.createElement("button", { ...props, className: baseClassName }, icon);
|
|
2599
2750
|
};
|
|
2600
2751
|
|
|
2601
2752
|
// src/components/Button/RetryButton.tsx
|
|
2602
|
-
import
|
|
2753
|
+
import React23 from "react";
|
|
2603
2754
|
|
|
2604
2755
|
// src/icons/RefreshCcw.tsx
|
|
2605
|
-
import * as
|
|
2606
|
-
var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2756
|
+
import * as React22 from "react";
|
|
2757
|
+
var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createElement(
|
|
2607
2758
|
"svg",
|
|
2608
2759
|
{
|
|
2609
2760
|
viewBox: "0 0 18 18",
|
|
@@ -2613,7 +2764,7 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React20.createElem
|
|
|
2613
2764
|
width: size,
|
|
2614
2765
|
height: size
|
|
2615
2766
|
},
|
|
2616
|
-
/* @__PURE__ */
|
|
2767
|
+
/* @__PURE__ */ React22.createElement(
|
|
2617
2768
|
"path",
|
|
2618
2769
|
{
|
|
2619
2770
|
d: "M0.75 3V7.5H5.25",
|
|
@@ -2622,7 +2773,7 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React20.createElem
|
|
|
2622
2773
|
strokeLinejoin: "round"
|
|
2623
2774
|
}
|
|
2624
2775
|
),
|
|
2625
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ React22.createElement(
|
|
2626
2777
|
"path",
|
|
2627
2778
|
{
|
|
2628
2779
|
d: "M17.25 15V10.5H12.75",
|
|
@@ -2631,7 +2782,7 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React20.createElem
|
|
|
2631
2782
|
strokeLinejoin: "round"
|
|
2632
2783
|
}
|
|
2633
2784
|
),
|
|
2634
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ React22.createElement(
|
|
2635
2786
|
"path",
|
|
2636
2787
|
{
|
|
2637
2788
|
d: "M15.3675 6.75C14.9871 5.67508 14.3407 4.71405 13.4884 3.95656C12.6361 3.19907 11.6059 2.66982 10.4938 2.41819C9.38167 2.16656 8.22393 2.20075 7.12861 2.51758C6.03328 2.8344 5.03606 3.42353 4.23 4.23L0.75 7.5M17.25 10.5L13.77 13.77C12.9639 14.5765 11.9667 15.1656 10.8714 15.4824C9.77607 15.7992 8.61833 15.8334 7.50621 15.5818C6.3941 15.3302 5.36385 14.8009 4.5116 14.0434C3.65935 13.2859 3.01288 12.3249 2.6325 11.25",
|
|
@@ -2658,14 +2809,14 @@ var RetryButton = ({
|
|
|
2658
2809
|
processing ? "Layer__btn--processing" : "",
|
|
2659
2810
|
className
|
|
2660
2811
|
);
|
|
2661
|
-
return /* @__PURE__ */
|
|
2812
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2662
2813
|
Button,
|
|
2663
2814
|
{
|
|
2664
2815
|
...props,
|
|
2665
2816
|
className: baseClassName,
|
|
2666
2817
|
variant: "secondary" /* secondary */,
|
|
2667
2818
|
disabled: processing || disabled,
|
|
2668
|
-
rightIcon: /* @__PURE__ */
|
|
2819
|
+
rightIcon: /* @__PURE__ */ React23.createElement(RefreshCcw_default, { size: 12 }),
|
|
2669
2820
|
justify: "center"
|
|
2670
2821
|
},
|
|
2671
2822
|
children
|
|
@@ -2676,8 +2827,8 @@ var RetryButton = ({
|
|
|
2676
2827
|
import React27 from "react";
|
|
2677
2828
|
|
|
2678
2829
|
// src/icons/AlertCircle.tsx
|
|
2679
|
-
import * as
|
|
2680
|
-
var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2830
|
+
import * as React24 from "react";
|
|
2831
|
+
var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
2681
2832
|
"svg",
|
|
2682
2833
|
{
|
|
2683
2834
|
viewBox: "0 0 18 18",
|
|
@@ -2687,7 +2838,7 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2687
2838
|
width: size,
|
|
2688
2839
|
height: size
|
|
2689
2840
|
},
|
|
2690
|
-
/* @__PURE__ */
|
|
2841
|
+
/* @__PURE__ */ React24.createElement(
|
|
2691
2842
|
"path",
|
|
2692
2843
|
{
|
|
2693
2844
|
d: "M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z",
|
|
@@ -2696,7 +2847,7 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2696
2847
|
strokeLinejoin: "round"
|
|
2697
2848
|
}
|
|
2698
2849
|
),
|
|
2699
|
-
/* @__PURE__ */
|
|
2850
|
+
/* @__PURE__ */ React24.createElement(
|
|
2700
2851
|
"path",
|
|
2701
2852
|
{
|
|
2702
2853
|
d: "M9 6V9",
|
|
@@ -2705,7 +2856,7 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2705
2856
|
strokeLinejoin: "round"
|
|
2706
2857
|
}
|
|
2707
2858
|
),
|
|
2708
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ React24.createElement(
|
|
2709
2860
|
"path",
|
|
2710
2861
|
{
|
|
2711
2862
|
d: "M9 12H9.0075",
|
|
@@ -2718,8 +2869,8 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2718
2869
|
var AlertCircle_default = AlertCircle;
|
|
2719
2870
|
|
|
2720
2871
|
// src/icons/CheckCircle.tsx
|
|
2721
|
-
import * as
|
|
2722
|
-
var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2872
|
+
import * as React25 from "react";
|
|
2873
|
+
var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React25.createElement(
|
|
2723
2874
|
"svg",
|
|
2724
2875
|
{
|
|
2725
2876
|
viewBox: "0 0 18 18",
|
|
@@ -2729,7 +2880,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createEle
|
|
|
2729
2880
|
width: size,
|
|
2730
2881
|
height: size
|
|
2731
2882
|
},
|
|
2732
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ React25.createElement(
|
|
2733
2884
|
"path",
|
|
2734
2885
|
{
|
|
2735
2886
|
d: "M16.5 8.30999V8.99999C16.4991 10.6173 15.9754 12.191 15.007 13.4864C14.0386 14.7817 12.6775 15.7293 11.1265 16.1879C9.57557 16.6465 7.91794 16.5914 6.40085 16.0309C4.88375 15.4704 3.58848 14.4346 2.70821 13.0778C1.82794 11.721 1.40984 10.116 1.51625 8.50223C1.62266 6.88841 2.2479 5.35223 3.2987 4.12279C4.34951 2.89335 5.76958 2.03653 7.34713 1.6801C8.92469 1.32367 10.5752 1.48674 12.0525 2.14499",
|
|
@@ -2738,7 +2889,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createEle
|
|
|
2738
2889
|
strokeLinejoin: "round"
|
|
2739
2890
|
}
|
|
2740
2891
|
),
|
|
2741
|
-
/* @__PURE__ */
|
|
2892
|
+
/* @__PURE__ */ React25.createElement(
|
|
2742
2893
|
"path",
|
|
2743
2894
|
{
|
|
2744
2895
|
d: "M16.5 3L9 10.5075L6.75 8.2575",
|
|
@@ -2751,8 +2902,8 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createEle
|
|
|
2751
2902
|
var CheckCircle_default = CheckCircle;
|
|
2752
2903
|
|
|
2753
2904
|
// src/icons/Save.tsx
|
|
2754
|
-
import * as
|
|
2755
|
-
var Save = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2905
|
+
import * as React26 from "react";
|
|
2906
|
+
var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React26.createElement(
|
|
2756
2907
|
"svg",
|
|
2757
2908
|
{
|
|
2758
2909
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2762,7 +2913,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2762
2913
|
width: size,
|
|
2763
2914
|
height: size
|
|
2764
2915
|
},
|
|
2765
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ React26.createElement(
|
|
2766
2917
|
"path",
|
|
2767
2918
|
{
|
|
2768
2919
|
d: "M14.25 15.75H3.75C3.35218 15.75 2.97064 15.592 2.68934 15.3107C2.40804 15.0294 2.25 14.6478 2.25 14.25V3.75C2.25 3.35218 2.40804 2.97064 2.68934 2.68934C2.97064 2.40804 3.35218 2.25 3.75 2.25H12L15.75 6V14.25C15.75 14.6478 15.592 15.0294 15.3107 15.3107C15.0294 15.592 14.6478 15.75 14.25 15.75Z",
|
|
@@ -2771,7 +2922,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2771
2922
|
strokeLinejoin: "round"
|
|
2772
2923
|
}
|
|
2773
2924
|
),
|
|
2774
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ React26.createElement(
|
|
2775
2926
|
"path",
|
|
2776
2927
|
{
|
|
2777
2928
|
d: "M12.75 15.75V9.75H5.25V15.75",
|
|
@@ -2780,7 +2931,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2780
2931
|
strokeLinejoin: "round"
|
|
2781
2932
|
}
|
|
2782
2933
|
),
|
|
2783
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ React26.createElement(
|
|
2784
2935
|
"path",
|
|
2785
2936
|
{
|
|
2786
2937
|
d: "M5.25 2.25V6H11.25",
|
|
@@ -2792,150 +2943,6 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2792
2943
|
);
|
|
2793
2944
|
var Save_default = Save;
|
|
2794
2945
|
|
|
2795
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
2796
|
-
import React26, {
|
|
2797
|
-
forwardRef as forwardRef4,
|
|
2798
|
-
isValidElement,
|
|
2799
|
-
cloneElement
|
|
2800
|
-
} from "react";
|
|
2801
|
-
|
|
2802
|
-
// src/components/Tooltip/useTooltip.ts
|
|
2803
|
-
import React25, { useState as useState6 } from "react";
|
|
2804
|
-
import {
|
|
2805
|
-
useFloating,
|
|
2806
|
-
autoUpdate,
|
|
2807
|
-
offset,
|
|
2808
|
-
flip,
|
|
2809
|
-
shift,
|
|
2810
|
-
useHover,
|
|
2811
|
-
useFocus,
|
|
2812
|
-
useDismiss,
|
|
2813
|
-
useRole,
|
|
2814
|
-
useInteractions,
|
|
2815
|
-
useTransitionStyles
|
|
2816
|
-
} from "@floating-ui/react";
|
|
2817
|
-
var TooltipContext = React25.createContext(null);
|
|
2818
|
-
var useTooltipContext = () => {
|
|
2819
|
-
const context = React25.useContext(TooltipContext);
|
|
2820
|
-
if (context == null) {
|
|
2821
|
-
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
2822
|
-
}
|
|
2823
|
-
return context;
|
|
2824
|
-
};
|
|
2825
|
-
var useTooltip = ({
|
|
2826
|
-
initialOpen = false,
|
|
2827
|
-
placement = "top",
|
|
2828
|
-
open: controlledOpen,
|
|
2829
|
-
onOpenChange: setControlledOpen,
|
|
2830
|
-
disabled,
|
|
2831
|
-
offset: offsetProp = 5,
|
|
2832
|
-
shift: shiftProp = { padding: 5 }
|
|
2833
|
-
} = {}) => {
|
|
2834
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState6(initialOpen);
|
|
2835
|
-
const open = controlledOpen ?? uncontrolledOpen;
|
|
2836
|
-
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
2837
|
-
const data = useFloating({
|
|
2838
|
-
placement,
|
|
2839
|
-
open: disabled ? false : open,
|
|
2840
|
-
onOpenChange: setOpen,
|
|
2841
|
-
whileElementsMounted: autoUpdate,
|
|
2842
|
-
middleware: [
|
|
2843
|
-
offset(offsetProp),
|
|
2844
|
-
flip({
|
|
2845
|
-
crossAxis: placement.includes("-"),
|
|
2846
|
-
fallbackAxisSideDirection: "start",
|
|
2847
|
-
padding: shiftProp?.padding ?? 5
|
|
2848
|
-
}),
|
|
2849
|
-
shift(shiftProp)
|
|
2850
|
-
]
|
|
2851
|
-
});
|
|
2852
|
-
const context = data.context;
|
|
2853
|
-
const hover = useHover(context, {
|
|
2854
|
-
move: false,
|
|
2855
|
-
enabled: controlledOpen == null
|
|
2856
|
-
});
|
|
2857
|
-
const focus = useFocus(context, {
|
|
2858
|
-
enabled: controlledOpen == null
|
|
2859
|
-
});
|
|
2860
|
-
const dismiss = useDismiss(context);
|
|
2861
|
-
const role = useRole(context, { role: "tooltip" });
|
|
2862
|
-
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
2863
|
-
const { isMounted, styles } = useTransitionStyles(context, {
|
|
2864
|
-
initial: {
|
|
2865
|
-
opacity: 0,
|
|
2866
|
-
transform: "scale(0.7)",
|
|
2867
|
-
color: "transparent"
|
|
2868
|
-
},
|
|
2869
|
-
duration: 300
|
|
2870
|
-
});
|
|
2871
|
-
return React25.useMemo(
|
|
2872
|
-
() => ({
|
|
2873
|
-
open,
|
|
2874
|
-
setOpen,
|
|
2875
|
-
isMounted,
|
|
2876
|
-
styles,
|
|
2877
|
-
disabled,
|
|
2878
|
-
...interactions,
|
|
2879
|
-
...data
|
|
2880
|
-
}),
|
|
2881
|
-
[open, setOpen, interactions, data, styles, disabled]
|
|
2882
|
-
);
|
|
2883
|
-
};
|
|
2884
|
-
|
|
2885
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
2886
|
-
import { useMergeRefs, FloatingPortal } from "@floating-ui/react";
|
|
2887
|
-
var Tooltip = ({
|
|
2888
|
-
children,
|
|
2889
|
-
...options
|
|
2890
|
-
}) => {
|
|
2891
|
-
const tooltip = useTooltip(options);
|
|
2892
|
-
return /* @__PURE__ */ React26.createElement(TooltipContext.Provider, { value: tooltip }, children);
|
|
2893
|
-
};
|
|
2894
|
-
var TooltipTrigger = forwardRef4(function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
|
|
2895
|
-
const context = useTooltipContext();
|
|
2896
|
-
const childrenRef = children.ref;
|
|
2897
|
-
const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
2898
|
-
if (asChild && isValidElement(children)) {
|
|
2899
|
-
return cloneElement(
|
|
2900
|
-
children,
|
|
2901
|
-
context.getReferenceProps({
|
|
2902
|
-
ref,
|
|
2903
|
-
...props,
|
|
2904
|
-
...children.props,
|
|
2905
|
-
"data-state": context.open ? "open" : "closed"
|
|
2906
|
-
})
|
|
2907
|
-
);
|
|
2908
|
-
}
|
|
2909
|
-
return /* @__PURE__ */ React26.createElement(
|
|
2910
|
-
"span",
|
|
2911
|
-
{
|
|
2912
|
-
ref,
|
|
2913
|
-
"data-state": context.open ? "open" : "closed",
|
|
2914
|
-
className: `Layer__tooltip-trigger Layer__tooltip-trigger--${context.open ? "open" : "closed"}`,
|
|
2915
|
-
...context.getReferenceProps(props)
|
|
2916
|
-
},
|
|
2917
|
-
children
|
|
2918
|
-
);
|
|
2919
|
-
});
|
|
2920
|
-
var TooltipContent = forwardRef4(function TooltipContent2({ style, className, ...props }, propRef) {
|
|
2921
|
-
const context = useTooltipContext();
|
|
2922
|
-
const ref = useMergeRefs([context.refs.setFloating, propRef]);
|
|
2923
|
-
if (!context.open || context.disabled)
|
|
2924
|
-
return null;
|
|
2925
|
-
return /* @__PURE__ */ React26.createElement(FloatingPortal, null, /* @__PURE__ */ React26.createElement(
|
|
2926
|
-
"div",
|
|
2927
|
-
{
|
|
2928
|
-
ref,
|
|
2929
|
-
className,
|
|
2930
|
-
style: {
|
|
2931
|
-
...context.floatingStyles
|
|
2932
|
-
},
|
|
2933
|
-
...context.getFloatingProps(props)
|
|
2934
|
-
},
|
|
2935
|
-
/* @__PURE__ */ React26.createElement("div", { className: "Layer__tooltip-content", style: { ...context.styles } }, props.children)
|
|
2936
|
-
));
|
|
2937
|
-
});
|
|
2938
|
-
|
|
2939
2946
|
// src/components/Button/SubmitButton.tsx
|
|
2940
2947
|
import classNames7 from "classnames";
|
|
2941
2948
|
var buildRightIcon = ({
|
|
@@ -3233,6 +3240,7 @@ var DownloadButton = ({
|
|
|
3233
3240
|
onClick,
|
|
3234
3241
|
isDownloading,
|
|
3235
3242
|
requestFailed,
|
|
3243
|
+
tooltip,
|
|
3236
3244
|
text = "Download",
|
|
3237
3245
|
retryText = "Retry",
|
|
3238
3246
|
errorText = "Download failed. Check connection and retry in few seconds."
|
|
@@ -3259,7 +3267,8 @@ var DownloadButton = ({
|
|
|
3259
3267
|
disabled: isDownloading,
|
|
3260
3268
|
iconAsPrimary: iconOnly,
|
|
3261
3269
|
iconOnly,
|
|
3262
|
-
isProcessing: isDownloading
|
|
3270
|
+
isProcessing: isDownloading,
|
|
3271
|
+
tooltip
|
|
3263
3272
|
},
|
|
3264
3273
|
text
|
|
3265
3274
|
);
|
|
@@ -9211,6 +9220,9 @@ var PNLComparisonContext = createContext6({
|
|
|
9211
9220
|
},
|
|
9212
9221
|
refetch: function() {
|
|
9213
9222
|
throw new Error("Function not implemented.");
|
|
9223
|
+
},
|
|
9224
|
+
getProfitAndLossComparisonCsv: function() {
|
|
9225
|
+
throw new Error("Function not implemented.");
|
|
9214
9226
|
}
|
|
9215
9227
|
});
|
|
9216
9228
|
|
|
@@ -9783,6 +9795,21 @@ var useProfitAndLossComparison = ({
|
|
|
9783
9795
|
reportingBasis
|
|
9784
9796
|
]
|
|
9785
9797
|
);
|
|
9798
|
+
const getProfitAndLossComparisonCsv = (dateRange, moneyFormat) => {
|
|
9799
|
+
const periods = preparePeriodsBody(dateRange, compareMonths);
|
|
9800
|
+
const tagFilters = prepareFiltersBody(compareOptions);
|
|
9801
|
+
return Layer.profitAndLossComparisonCsv(apiUrl, auth.access_token, {
|
|
9802
|
+
params: {
|
|
9803
|
+
businessId,
|
|
9804
|
+
moneyFormat
|
|
9805
|
+
},
|
|
9806
|
+
body: {
|
|
9807
|
+
periods,
|
|
9808
|
+
tag_filters: tagFilters,
|
|
9809
|
+
reporting_basis: reportingBasis
|
|
9810
|
+
}
|
|
9811
|
+
});
|
|
9812
|
+
};
|
|
9786
9813
|
return {
|
|
9787
9814
|
data: data?.pnls,
|
|
9788
9815
|
isLoading,
|
|
@@ -9794,7 +9821,8 @@ var useProfitAndLossComparison = ({
|
|
|
9794
9821
|
setCompareMonths,
|
|
9795
9822
|
compareOptions,
|
|
9796
9823
|
setCompareOptions,
|
|
9797
|
-
refetch
|
|
9824
|
+
refetch,
|
|
9825
|
+
getProfitAndLossComparisonCsv
|
|
9798
9826
|
};
|
|
9799
9827
|
};
|
|
9800
9828
|
|
|
@@ -11585,10 +11613,14 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
11585
11613
|
import React130, { useContext as useContext16, useState as useState35 } from "react";
|
|
11586
11614
|
var ProfitAndLossDownloadButton = ({
|
|
11587
11615
|
stringOverrides,
|
|
11616
|
+
useComparisonPnl = false,
|
|
11588
11617
|
moneyFormat,
|
|
11589
11618
|
view
|
|
11590
11619
|
}) => {
|
|
11591
11620
|
const { dateRange } = useContext16(ProfitAndLoss.Context);
|
|
11621
|
+
const { getProfitAndLossComparisonCsv } = useContext16(
|
|
11622
|
+
ProfitAndLoss.ComparisonContext
|
|
11623
|
+
);
|
|
11592
11624
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
11593
11625
|
const [requestFailed, setRequestFailed] = useState35(false);
|
|
11594
11626
|
const [isDownloading, setIsDownloading] = useState35(false);
|
|
@@ -11609,7 +11641,7 @@ var ProfitAndLossDownloadButton = ({
|
|
|
11609
11641
|
}
|
|
11610
11642
|
);
|
|
11611
11643
|
try {
|
|
11612
|
-
const result = await getProfitAndLossCsv2();
|
|
11644
|
+
const result = useComparisonPnl ? await getProfitAndLossComparisonCsv(dateRange, moneyFormat) : await getProfitAndLossCsv2();
|
|
11613
11645
|
if (result?.data?.presignedUrl) {
|
|
11614
11646
|
window.location.href = result.data.presignedUrl;
|
|
11615
11647
|
setRequestFailed(false);
|
|
@@ -11821,6 +11853,7 @@ var ProfitAndLossReport = ({
|
|
|
11821
11853
|
ProfitAndLoss.DownloadButton,
|
|
11822
11854
|
{
|
|
11823
11855
|
stringOverrides: stringOverrides?.downloadButton,
|
|
11856
|
+
useComparisonPnl: !!comparisonConfig,
|
|
11824
11857
|
moneyFormat: csvMoneyFormat,
|
|
11825
11858
|
view
|
|
11826
11859
|
}
|
|
@@ -14224,8 +14257,6 @@ var ChartOfAccountsTableContent = ({
|
|
|
14224
14257
|
const renderChartOfAccountsDesktopRow = (account, index, rowKey, depth) => {
|
|
14225
14258
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
14226
14259
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
14227
|
-
const editButton = /* @__PURE__ */ React164.createElement(Edit2_default, { size: 12 });
|
|
14228
|
-
const disabledEditButtonWithTooltip = /* @__PURE__ */ React164.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React164.createElement(TooltipTrigger, null, /* @__PURE__ */ React164.createElement(Edit2_default, { size: 12 })), /* @__PURE__ */ React164.createElement(TooltipContent, { className: "Layer__tooltip" }, "System accounts cannot be modified"));
|
|
14229
14260
|
return /* @__PURE__ */ React164.createElement(React164.Fragment, { key: rowKey + "-" + index }, /* @__PURE__ */ React164.createElement(
|
|
14230
14261
|
TableRow,
|
|
14231
14262
|
{
|
|
@@ -14256,14 +14287,15 @@ var ChartOfAccountsTableContent = ({
|
|
|
14256
14287
|
Button,
|
|
14257
14288
|
{
|
|
14258
14289
|
variant: "secondary" /* secondary */,
|
|
14259
|
-
rightIcon:
|
|
14290
|
+
rightIcon: /* @__PURE__ */ React164.createElement(Edit2_default, { size: 12 }),
|
|
14260
14291
|
iconOnly: true,
|
|
14261
14292
|
disabled: !templateAccountsEditable && !!account.stable_name,
|
|
14262
14293
|
onClick: (e) => {
|
|
14263
14294
|
e.preventDefault();
|
|
14264
14295
|
e.stopPropagation();
|
|
14265
14296
|
editAccount(account.id);
|
|
14266
|
-
}
|
|
14297
|
+
},
|
|
14298
|
+
tooltip: !templateAccountsEditable && account.stable_name ? "System accounts cannot be modified" : void 0
|
|
14267
14299
|
},
|
|
14268
14300
|
"Edit"
|
|
14269
14301
|
)))
|