@layerfi/components 0.1.65 → 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 +250 -204
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +43 -7
- package/dist/index.js +235 -189
- 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/index.js
CHANGED
|
@@ -348,6 +348,9 @@ var getProfitAndLossCsv = get(
|
|
|
348
348
|
moneyFormat
|
|
349
349
|
}) => `/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}` : ""}`
|
|
350
350
|
);
|
|
351
|
+
var profitAndLossComparisonCsv = post(
|
|
352
|
+
({ businessId, moneyFormat }) => `/v1/businesses/${businessId}/reports/profit-and-loss/exports/comparison-csv?money_format=${moneyFormat ? moneyFormat : "DOLLAR_STRING"}`
|
|
353
|
+
);
|
|
351
354
|
|
|
352
355
|
// src/api/layer/quickbooks.ts
|
|
353
356
|
var syncFromQuickbooks = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/sync-from`);
|
|
@@ -404,6 +407,7 @@ var Layer = {
|
|
|
404
407
|
getLinkedAccounts,
|
|
405
408
|
getJournal,
|
|
406
409
|
compareProfitAndLoss,
|
|
410
|
+
profitAndLossComparisonCsv,
|
|
407
411
|
createJournalEntries,
|
|
408
412
|
getPlaidLinkToken,
|
|
409
413
|
getPlaidUpdateModeLinkToken,
|
|
@@ -2477,7 +2481,7 @@ var ChevronRight = ({ ...props }) => /* @__PURE__ */ React16.createElement(
|
|
|
2477
2481
|
var ChevronRight_default = ChevronRight;
|
|
2478
2482
|
|
|
2479
2483
|
// src/components/Button/Button.tsx
|
|
2480
|
-
var
|
|
2484
|
+
var import_react24 = __toESM(require("react"));
|
|
2481
2485
|
|
|
2482
2486
|
// src/icons/Loader.tsx
|
|
2483
2487
|
var React17 = __toESM(require("react"));
|
|
@@ -2566,6 +2570,134 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React17.createElement(
|
|
|
2566
2570
|
);
|
|
2567
2571
|
var Loader_default = Loader;
|
|
2568
2572
|
|
|
2573
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
2574
|
+
var import_react22 = __toESM(require("react"));
|
|
2575
|
+
|
|
2576
|
+
// src/components/Tooltip/useTooltip.ts
|
|
2577
|
+
var import_react20 = __toESM(require("react"));
|
|
2578
|
+
var import_react21 = require("@floating-ui/react");
|
|
2579
|
+
var TooltipContext = import_react20.default.createContext(null);
|
|
2580
|
+
var useTooltipContext = () => {
|
|
2581
|
+
const context = import_react20.default.useContext(TooltipContext);
|
|
2582
|
+
if (context == null) {
|
|
2583
|
+
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
2584
|
+
}
|
|
2585
|
+
return context;
|
|
2586
|
+
};
|
|
2587
|
+
var useTooltip = ({
|
|
2588
|
+
initialOpen = false,
|
|
2589
|
+
placement = "top",
|
|
2590
|
+
open: controlledOpen,
|
|
2591
|
+
onOpenChange: setControlledOpen,
|
|
2592
|
+
disabled,
|
|
2593
|
+
offset: offsetProp = 5,
|
|
2594
|
+
shift: shiftProp = { padding: 5 }
|
|
2595
|
+
} = {}) => {
|
|
2596
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react20.useState)(initialOpen);
|
|
2597
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
2598
|
+
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
2599
|
+
const data = (0, import_react21.useFloating)({
|
|
2600
|
+
placement,
|
|
2601
|
+
open: disabled ? false : open,
|
|
2602
|
+
onOpenChange: setOpen,
|
|
2603
|
+
whileElementsMounted: import_react21.autoUpdate,
|
|
2604
|
+
middleware: [
|
|
2605
|
+
(0, import_react21.offset)(offsetProp),
|
|
2606
|
+
(0, import_react21.flip)({
|
|
2607
|
+
crossAxis: placement.includes("-"),
|
|
2608
|
+
fallbackAxisSideDirection: "start",
|
|
2609
|
+
padding: shiftProp?.padding ?? 5
|
|
2610
|
+
}),
|
|
2611
|
+
(0, import_react21.shift)(shiftProp)
|
|
2612
|
+
]
|
|
2613
|
+
});
|
|
2614
|
+
const context = data.context;
|
|
2615
|
+
const hover = (0, import_react21.useHover)(context, {
|
|
2616
|
+
move: false,
|
|
2617
|
+
enabled: controlledOpen == null
|
|
2618
|
+
});
|
|
2619
|
+
const focus = (0, import_react21.useFocus)(context, {
|
|
2620
|
+
enabled: controlledOpen == null
|
|
2621
|
+
});
|
|
2622
|
+
const dismiss = (0, import_react21.useDismiss)(context);
|
|
2623
|
+
const role = (0, import_react21.useRole)(context, { role: "tooltip" });
|
|
2624
|
+
const interactions = (0, import_react21.useInteractions)([hover, focus, dismiss, role]);
|
|
2625
|
+
const { isMounted, styles } = (0, import_react21.useTransitionStyles)(context, {
|
|
2626
|
+
initial: {
|
|
2627
|
+
opacity: 0,
|
|
2628
|
+
transform: "scale(0.7)",
|
|
2629
|
+
color: "transparent"
|
|
2630
|
+
},
|
|
2631
|
+
duration: 300
|
|
2632
|
+
});
|
|
2633
|
+
return import_react20.default.useMemo(
|
|
2634
|
+
() => ({
|
|
2635
|
+
open,
|
|
2636
|
+
setOpen,
|
|
2637
|
+
isMounted,
|
|
2638
|
+
styles,
|
|
2639
|
+
disabled,
|
|
2640
|
+
...interactions,
|
|
2641
|
+
...data
|
|
2642
|
+
}),
|
|
2643
|
+
[open, setOpen, interactions, data, styles, disabled]
|
|
2644
|
+
);
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2647
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
2648
|
+
var import_react23 = require("@floating-ui/react");
|
|
2649
|
+
var Tooltip = ({
|
|
2650
|
+
children,
|
|
2651
|
+
...options
|
|
2652
|
+
}) => {
|
|
2653
|
+
const tooltip = useTooltip(options);
|
|
2654
|
+
return /* @__PURE__ */ import_react22.default.createElement(TooltipContext.Provider, { value: tooltip }, children);
|
|
2655
|
+
};
|
|
2656
|
+
var TooltipTrigger = (0, import_react22.forwardRef)(function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
|
|
2657
|
+
const context = useTooltipContext();
|
|
2658
|
+
const childrenRef = children.ref;
|
|
2659
|
+
const ref = (0, import_react23.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
2660
|
+
if (asChild && (0, import_react22.isValidElement)(children)) {
|
|
2661
|
+
return (0, import_react22.cloneElement)(
|
|
2662
|
+
children,
|
|
2663
|
+
context.getReferenceProps({
|
|
2664
|
+
ref,
|
|
2665
|
+
...props,
|
|
2666
|
+
...children.props,
|
|
2667
|
+
"data-state": context.open ? "open" : "closed"
|
|
2668
|
+
})
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2671
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
2672
|
+
"span",
|
|
2673
|
+
{
|
|
2674
|
+
ref,
|
|
2675
|
+
"data-state": context.open ? "open" : "closed",
|
|
2676
|
+
className: `Layer__tooltip-trigger Layer__tooltip-trigger--${context.open ? "open" : "closed"}`,
|
|
2677
|
+
...context.getReferenceProps(props)
|
|
2678
|
+
},
|
|
2679
|
+
children
|
|
2680
|
+
);
|
|
2681
|
+
});
|
|
2682
|
+
var TooltipContent = (0, import_react22.forwardRef)(function TooltipContent2({ style, className, ...props }, propRef) {
|
|
2683
|
+
const context = useTooltipContext();
|
|
2684
|
+
const ref = (0, import_react23.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
2685
|
+
if (!context.open || context.disabled)
|
|
2686
|
+
return null;
|
|
2687
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_react23.FloatingPortal, null, /* @__PURE__ */ import_react22.default.createElement(
|
|
2688
|
+
"div",
|
|
2689
|
+
{
|
|
2690
|
+
ref,
|
|
2691
|
+
className,
|
|
2692
|
+
style: {
|
|
2693
|
+
...context.floatingStyles
|
|
2694
|
+
},
|
|
2695
|
+
...context.getFloatingProps(props)
|
|
2696
|
+
},
|
|
2697
|
+
/* @__PURE__ */ import_react22.default.createElement("div", { className: "Layer__tooltip-content", style: { ...context.styles } }, props.children)
|
|
2698
|
+
));
|
|
2699
|
+
});
|
|
2700
|
+
|
|
2569
2701
|
// src/components/Button/Button.tsx
|
|
2570
2702
|
var import_classnames4 = __toESM(require("classnames"));
|
|
2571
2703
|
var Button = ({
|
|
@@ -2579,9 +2711,10 @@ var Button = ({
|
|
|
2579
2711
|
justify = "center",
|
|
2580
2712
|
fullWidth,
|
|
2581
2713
|
isProcessing,
|
|
2714
|
+
tooltip,
|
|
2582
2715
|
...props
|
|
2583
2716
|
}) => {
|
|
2584
|
-
const buttonRef = (0,
|
|
2717
|
+
const buttonRef = (0, import_react24.useRef)(null);
|
|
2585
2718
|
let justifyContent = "center";
|
|
2586
2719
|
if (justify) {
|
|
2587
2720
|
justifyContent = justify;
|
|
@@ -2598,6 +2731,7 @@ var Button = ({
|
|
|
2598
2731
|
iconOnly ? "Layer__btn--icon-only" : "",
|
|
2599
2732
|
iconAsPrimary && "Layer__btn--with-primary-icon",
|
|
2600
2733
|
fullWidth && "Layer__btn--full-width",
|
|
2734
|
+
tooltip && "Layer__btn--with-tooltip",
|
|
2601
2735
|
className
|
|
2602
2736
|
);
|
|
2603
2737
|
const startAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
@@ -2606,7 +2740,26 @@ var Button = ({
|
|
|
2606
2740
|
const stopAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
2607
2741
|
(el) => el.endElement()
|
|
2608
2742
|
);
|
|
2609
|
-
|
|
2743
|
+
const content = /* @__PURE__ */ import_react24.default.createElement("span", { className: `Layer__btn-content Layer__justify--${justifyContent}` }, leftIcon && /* @__PURE__ */ import_react24.default.createElement(
|
|
2744
|
+
"span",
|
|
2745
|
+
{
|
|
2746
|
+
className: (0, import_classnames4.default)(
|
|
2747
|
+
"Layer__btn-icon Layer__btn-icon--left",
|
|
2748
|
+
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2749
|
+
)
|
|
2750
|
+
},
|
|
2751
|
+
isProcessing ? /* @__PURE__ */ import_react24.default.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : leftIcon
|
|
2752
|
+
), !iconOnly && /* @__PURE__ */ import_react24.default.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ import_react24.default.createElement(
|
|
2753
|
+
"span",
|
|
2754
|
+
{
|
|
2755
|
+
className: (0, import_classnames4.default)(
|
|
2756
|
+
"Layer__btn-icon Layer__btn-icon--right",
|
|
2757
|
+
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2758
|
+
)
|
|
2759
|
+
},
|
|
2760
|
+
isProcessing ? /* @__PURE__ */ import_react24.default.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : rightIcon
|
|
2761
|
+
));
|
|
2762
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
2610
2763
|
"button",
|
|
2611
2764
|
{
|
|
2612
2765
|
...props,
|
|
@@ -2615,30 +2768,12 @@ var Button = ({
|
|
|
2615
2768
|
onMouseLeave: stopAnimation,
|
|
2616
2769
|
ref: buttonRef
|
|
2617
2770
|
},
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
"span",
|
|
2620
|
-
{
|
|
2621
|
-
className: (0, import_classnames4.default)(
|
|
2622
|
-
"Layer__btn-icon Layer__btn-icon--left",
|
|
2623
|
-
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2624
|
-
)
|
|
2625
|
-
},
|
|
2626
|
-
isProcessing ? /* @__PURE__ */ import_react20.default.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : leftIcon
|
|
2627
|
-
), !iconOnly && /* @__PURE__ */ import_react20.default.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ import_react20.default.createElement(
|
|
2628
|
-
"span",
|
|
2629
|
-
{
|
|
2630
|
-
className: (0, import_classnames4.default)(
|
|
2631
|
-
"Layer__btn-icon Layer__btn-icon--right",
|
|
2632
|
-
iconAsPrimary && "Layer__btn-icon--primary"
|
|
2633
|
-
)
|
|
2634
|
-
},
|
|
2635
|
-
isProcessing ? /* @__PURE__ */ import_react20.default.createElement(Loader_default, { size: 12, className: "Layer__anim--rotating" }) : rightIcon
|
|
2636
|
-
))
|
|
2771
|
+
tooltip ? /* @__PURE__ */ import_react24.default.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ import_react24.default.createElement(TooltipTrigger, null, content), tooltip && /* @__PURE__ */ import_react24.default.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip)) : content
|
|
2637
2772
|
);
|
|
2638
2773
|
};
|
|
2639
2774
|
|
|
2640
2775
|
// src/components/Button/IconButton.tsx
|
|
2641
|
-
var
|
|
2776
|
+
var import_react25 = __toESM(require("react"));
|
|
2642
2777
|
var import_classnames5 = __toESM(require("classnames"));
|
|
2643
2778
|
var IconButton = ({
|
|
2644
2779
|
className,
|
|
@@ -2654,15 +2789,15 @@ var IconButton = ({
|
|
|
2654
2789
|
withBorder && "Layer__icon-btn--border",
|
|
2655
2790
|
className
|
|
2656
2791
|
);
|
|
2657
|
-
return /* @__PURE__ */
|
|
2792
|
+
return /* @__PURE__ */ import_react25.default.createElement("button", { ...props, className: baseClassName }, icon);
|
|
2658
2793
|
};
|
|
2659
2794
|
|
|
2660
2795
|
// src/components/Button/RetryButton.tsx
|
|
2661
|
-
var
|
|
2796
|
+
var import_react26 = __toESM(require("react"));
|
|
2662
2797
|
|
|
2663
2798
|
// src/icons/RefreshCcw.tsx
|
|
2664
|
-
var
|
|
2665
|
-
var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2799
|
+
var React22 = __toESM(require("react"));
|
|
2800
|
+
var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createElement(
|
|
2666
2801
|
"svg",
|
|
2667
2802
|
{
|
|
2668
2803
|
viewBox: "0 0 18 18",
|
|
@@ -2672,7 +2807,7 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React20.createElem
|
|
|
2672
2807
|
width: size,
|
|
2673
2808
|
height: size
|
|
2674
2809
|
},
|
|
2675
|
-
/* @__PURE__ */
|
|
2810
|
+
/* @__PURE__ */ React22.createElement(
|
|
2676
2811
|
"path",
|
|
2677
2812
|
{
|
|
2678
2813
|
d: "M0.75 3V7.5H5.25",
|
|
@@ -2681,7 +2816,7 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React20.createElem
|
|
|
2681
2816
|
strokeLinejoin: "round"
|
|
2682
2817
|
}
|
|
2683
2818
|
),
|
|
2684
|
-
/* @__PURE__ */
|
|
2819
|
+
/* @__PURE__ */ React22.createElement(
|
|
2685
2820
|
"path",
|
|
2686
2821
|
{
|
|
2687
2822
|
d: "M17.25 15V10.5H12.75",
|
|
@@ -2690,7 +2825,7 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React20.createElem
|
|
|
2690
2825
|
strokeLinejoin: "round"
|
|
2691
2826
|
}
|
|
2692
2827
|
),
|
|
2693
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ React22.createElement(
|
|
2694
2829
|
"path",
|
|
2695
2830
|
{
|
|
2696
2831
|
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",
|
|
@@ -2717,14 +2852,14 @@ var RetryButton = ({
|
|
|
2717
2852
|
processing ? "Layer__btn--processing" : "",
|
|
2718
2853
|
className
|
|
2719
2854
|
);
|
|
2720
|
-
return /* @__PURE__ */
|
|
2855
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2721
2856
|
Button,
|
|
2722
2857
|
{
|
|
2723
2858
|
...props,
|
|
2724
2859
|
className: baseClassName,
|
|
2725
2860
|
variant: "secondary" /* secondary */,
|
|
2726
2861
|
disabled: processing || disabled,
|
|
2727
|
-
rightIcon: /* @__PURE__ */
|
|
2862
|
+
rightIcon: /* @__PURE__ */ import_react26.default.createElement(RefreshCcw_default, { size: 12 }),
|
|
2728
2863
|
justify: "center"
|
|
2729
2864
|
},
|
|
2730
2865
|
children
|
|
@@ -2735,8 +2870,8 @@ var RetryButton = ({
|
|
|
2735
2870
|
var import_react27 = __toESM(require("react"));
|
|
2736
2871
|
|
|
2737
2872
|
// src/icons/AlertCircle.tsx
|
|
2738
|
-
var
|
|
2739
|
-
var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2873
|
+
var React24 = __toESM(require("react"));
|
|
2874
|
+
var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
2740
2875
|
"svg",
|
|
2741
2876
|
{
|
|
2742
2877
|
viewBox: "0 0 18 18",
|
|
@@ -2746,7 +2881,7 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2746
2881
|
width: size,
|
|
2747
2882
|
height: size
|
|
2748
2883
|
},
|
|
2749
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ React24.createElement(
|
|
2750
2885
|
"path",
|
|
2751
2886
|
{
|
|
2752
2887
|
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",
|
|
@@ -2755,7 +2890,7 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2755
2890
|
strokeLinejoin: "round"
|
|
2756
2891
|
}
|
|
2757
2892
|
),
|
|
2758
|
-
/* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ React24.createElement(
|
|
2759
2894
|
"path",
|
|
2760
2895
|
{
|
|
2761
2896
|
d: "M9 6V9",
|
|
@@ -2764,7 +2899,7 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2764
2899
|
strokeLinejoin: "round"
|
|
2765
2900
|
}
|
|
2766
2901
|
),
|
|
2767
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ React24.createElement(
|
|
2768
2903
|
"path",
|
|
2769
2904
|
{
|
|
2770
2905
|
d: "M9 12H9.0075",
|
|
@@ -2777,8 +2912,8 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
2777
2912
|
var AlertCircle_default = AlertCircle;
|
|
2778
2913
|
|
|
2779
2914
|
// src/icons/CheckCircle.tsx
|
|
2780
|
-
var
|
|
2781
|
-
var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2915
|
+
var React25 = __toESM(require("react"));
|
|
2916
|
+
var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React25.createElement(
|
|
2782
2917
|
"svg",
|
|
2783
2918
|
{
|
|
2784
2919
|
viewBox: "0 0 18 18",
|
|
@@ -2788,7 +2923,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createEle
|
|
|
2788
2923
|
width: size,
|
|
2789
2924
|
height: size
|
|
2790
2925
|
},
|
|
2791
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ React25.createElement(
|
|
2792
2927
|
"path",
|
|
2793
2928
|
{
|
|
2794
2929
|
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",
|
|
@@ -2797,7 +2932,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createEle
|
|
|
2797
2932
|
strokeLinejoin: "round"
|
|
2798
2933
|
}
|
|
2799
2934
|
),
|
|
2800
|
-
/* @__PURE__ */
|
|
2935
|
+
/* @__PURE__ */ React25.createElement(
|
|
2801
2936
|
"path",
|
|
2802
2937
|
{
|
|
2803
2938
|
d: "M16.5 3L9 10.5075L6.75 8.2575",
|
|
@@ -2810,8 +2945,8 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createEle
|
|
|
2810
2945
|
var CheckCircle_default = CheckCircle;
|
|
2811
2946
|
|
|
2812
2947
|
// src/icons/Save.tsx
|
|
2813
|
-
var
|
|
2814
|
-
var Save = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2948
|
+
var React26 = __toESM(require("react"));
|
|
2949
|
+
var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React26.createElement(
|
|
2815
2950
|
"svg",
|
|
2816
2951
|
{
|
|
2817
2952
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2821,7 +2956,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2821
2956
|
width: size,
|
|
2822
2957
|
height: size
|
|
2823
2958
|
},
|
|
2824
|
-
/* @__PURE__ */
|
|
2959
|
+
/* @__PURE__ */ React26.createElement(
|
|
2825
2960
|
"path",
|
|
2826
2961
|
{
|
|
2827
2962
|
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",
|
|
@@ -2830,7 +2965,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2830
2965
|
strokeLinejoin: "round"
|
|
2831
2966
|
}
|
|
2832
2967
|
),
|
|
2833
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ React26.createElement(
|
|
2834
2969
|
"path",
|
|
2835
2970
|
{
|
|
2836
2971
|
d: "M12.75 15.75V9.75H5.25V15.75",
|
|
@@ -2839,7 +2974,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2839
2974
|
strokeLinejoin: "round"
|
|
2840
2975
|
}
|
|
2841
2976
|
),
|
|
2842
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ React26.createElement(
|
|
2843
2978
|
"path",
|
|
2844
2979
|
{
|
|
2845
2980
|
d: "M5.25 2.25V6H11.25",
|
|
@@ -2851,134 +2986,6 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
2851
2986
|
);
|
|
2852
2987
|
var Save_default = Save;
|
|
2853
2988
|
|
|
2854
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
2855
|
-
var import_react25 = __toESM(require("react"));
|
|
2856
|
-
|
|
2857
|
-
// src/components/Tooltip/useTooltip.ts
|
|
2858
|
-
var import_react23 = __toESM(require("react"));
|
|
2859
|
-
var import_react24 = require("@floating-ui/react");
|
|
2860
|
-
var TooltipContext = import_react23.default.createContext(null);
|
|
2861
|
-
var useTooltipContext = () => {
|
|
2862
|
-
const context = import_react23.default.useContext(TooltipContext);
|
|
2863
|
-
if (context == null) {
|
|
2864
|
-
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
2865
|
-
}
|
|
2866
|
-
return context;
|
|
2867
|
-
};
|
|
2868
|
-
var useTooltip = ({
|
|
2869
|
-
initialOpen = false,
|
|
2870
|
-
placement = "top",
|
|
2871
|
-
open: controlledOpen,
|
|
2872
|
-
onOpenChange: setControlledOpen,
|
|
2873
|
-
disabled,
|
|
2874
|
-
offset: offsetProp = 5,
|
|
2875
|
-
shift: shiftProp = { padding: 5 }
|
|
2876
|
-
} = {}) => {
|
|
2877
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react23.useState)(initialOpen);
|
|
2878
|
-
const open = controlledOpen ?? uncontrolledOpen;
|
|
2879
|
-
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
2880
|
-
const data = (0, import_react24.useFloating)({
|
|
2881
|
-
placement,
|
|
2882
|
-
open: disabled ? false : open,
|
|
2883
|
-
onOpenChange: setOpen,
|
|
2884
|
-
whileElementsMounted: import_react24.autoUpdate,
|
|
2885
|
-
middleware: [
|
|
2886
|
-
(0, import_react24.offset)(offsetProp),
|
|
2887
|
-
(0, import_react24.flip)({
|
|
2888
|
-
crossAxis: placement.includes("-"),
|
|
2889
|
-
fallbackAxisSideDirection: "start",
|
|
2890
|
-
padding: shiftProp?.padding ?? 5
|
|
2891
|
-
}),
|
|
2892
|
-
(0, import_react24.shift)(shiftProp)
|
|
2893
|
-
]
|
|
2894
|
-
});
|
|
2895
|
-
const context = data.context;
|
|
2896
|
-
const hover = (0, import_react24.useHover)(context, {
|
|
2897
|
-
move: false,
|
|
2898
|
-
enabled: controlledOpen == null
|
|
2899
|
-
});
|
|
2900
|
-
const focus = (0, import_react24.useFocus)(context, {
|
|
2901
|
-
enabled: controlledOpen == null
|
|
2902
|
-
});
|
|
2903
|
-
const dismiss = (0, import_react24.useDismiss)(context);
|
|
2904
|
-
const role = (0, import_react24.useRole)(context, { role: "tooltip" });
|
|
2905
|
-
const interactions = (0, import_react24.useInteractions)([hover, focus, dismiss, role]);
|
|
2906
|
-
const { isMounted, styles } = (0, import_react24.useTransitionStyles)(context, {
|
|
2907
|
-
initial: {
|
|
2908
|
-
opacity: 0,
|
|
2909
|
-
transform: "scale(0.7)",
|
|
2910
|
-
color: "transparent"
|
|
2911
|
-
},
|
|
2912
|
-
duration: 300
|
|
2913
|
-
});
|
|
2914
|
-
return import_react23.default.useMemo(
|
|
2915
|
-
() => ({
|
|
2916
|
-
open,
|
|
2917
|
-
setOpen,
|
|
2918
|
-
isMounted,
|
|
2919
|
-
styles,
|
|
2920
|
-
disabled,
|
|
2921
|
-
...interactions,
|
|
2922
|
-
...data
|
|
2923
|
-
}),
|
|
2924
|
-
[open, setOpen, interactions, data, styles, disabled]
|
|
2925
|
-
);
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
2929
|
-
var import_react26 = require("@floating-ui/react");
|
|
2930
|
-
var Tooltip = ({
|
|
2931
|
-
children,
|
|
2932
|
-
...options
|
|
2933
|
-
}) => {
|
|
2934
|
-
const tooltip = useTooltip(options);
|
|
2935
|
-
return /* @__PURE__ */ import_react25.default.createElement(TooltipContext.Provider, { value: tooltip }, children);
|
|
2936
|
-
};
|
|
2937
|
-
var TooltipTrigger = (0, import_react25.forwardRef)(function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
|
|
2938
|
-
const context = useTooltipContext();
|
|
2939
|
-
const childrenRef = children.ref;
|
|
2940
|
-
const ref = (0, import_react26.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
2941
|
-
if (asChild && (0, import_react25.isValidElement)(children)) {
|
|
2942
|
-
return (0, import_react25.cloneElement)(
|
|
2943
|
-
children,
|
|
2944
|
-
context.getReferenceProps({
|
|
2945
|
-
ref,
|
|
2946
|
-
...props,
|
|
2947
|
-
...children.props,
|
|
2948
|
-
"data-state": context.open ? "open" : "closed"
|
|
2949
|
-
})
|
|
2950
|
-
);
|
|
2951
|
-
}
|
|
2952
|
-
return /* @__PURE__ */ import_react25.default.createElement(
|
|
2953
|
-
"span",
|
|
2954
|
-
{
|
|
2955
|
-
ref,
|
|
2956
|
-
"data-state": context.open ? "open" : "closed",
|
|
2957
|
-
className: `Layer__tooltip-trigger Layer__tooltip-trigger--${context.open ? "open" : "closed"}`,
|
|
2958
|
-
...context.getReferenceProps(props)
|
|
2959
|
-
},
|
|
2960
|
-
children
|
|
2961
|
-
);
|
|
2962
|
-
});
|
|
2963
|
-
var TooltipContent = (0, import_react25.forwardRef)(function TooltipContent2({ style, className, ...props }, propRef) {
|
|
2964
|
-
const context = useTooltipContext();
|
|
2965
|
-
const ref = (0, import_react26.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
2966
|
-
if (!context.open || context.disabled)
|
|
2967
|
-
return null;
|
|
2968
|
-
return /* @__PURE__ */ import_react25.default.createElement(import_react26.FloatingPortal, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
2969
|
-
"div",
|
|
2970
|
-
{
|
|
2971
|
-
ref,
|
|
2972
|
-
className,
|
|
2973
|
-
style: {
|
|
2974
|
-
...context.floatingStyles
|
|
2975
|
-
},
|
|
2976
|
-
...context.getFloatingProps(props)
|
|
2977
|
-
},
|
|
2978
|
-
/* @__PURE__ */ import_react25.default.createElement("div", { className: "Layer__tooltip-content", style: { ...context.styles } }, props.children)
|
|
2979
|
-
));
|
|
2980
|
-
});
|
|
2981
|
-
|
|
2982
2989
|
// src/components/Button/SubmitButton.tsx
|
|
2983
2990
|
var import_classnames7 = __toESM(require("classnames"));
|
|
2984
2991
|
var buildRightIcon = ({
|
|
@@ -3274,6 +3281,7 @@ var DownloadButton = ({
|
|
|
3274
3281
|
onClick,
|
|
3275
3282
|
isDownloading,
|
|
3276
3283
|
requestFailed,
|
|
3284
|
+
tooltip,
|
|
3277
3285
|
text = "Download",
|
|
3278
3286
|
retryText = "Retry",
|
|
3279
3287
|
errorText = "Download failed. Check connection and retry in few seconds."
|
|
@@ -3300,7 +3308,8 @@ var DownloadButton = ({
|
|
|
3300
3308
|
disabled: isDownloading,
|
|
3301
3309
|
iconAsPrimary: iconOnly,
|
|
3302
3310
|
iconOnly,
|
|
3303
|
-
isProcessing: isDownloading
|
|
3311
|
+
isProcessing: isDownloading,
|
|
3312
|
+
tooltip
|
|
3304
3313
|
},
|
|
3305
3314
|
text
|
|
3306
3315
|
);
|
|
@@ -5026,7 +5035,8 @@ var getAssignedValue = (bankTransaction) => {
|
|
|
5026
5035
|
// src/components/BankTransactionMobileList/BusinessCategories.tsx
|
|
5027
5036
|
var BusinessCategories = ({
|
|
5028
5037
|
select,
|
|
5029
|
-
selectedId
|
|
5038
|
+
selectedId,
|
|
5039
|
+
showTooltips
|
|
5030
5040
|
}) => {
|
|
5031
5041
|
const { categories } = useLayerContext();
|
|
5032
5042
|
const categoryOptions = flattenCategories(
|
|
@@ -5054,7 +5064,8 @@ var BusinessCategories = ({
|
|
|
5054
5064
|
{
|
|
5055
5065
|
options: optionsToShow,
|
|
5056
5066
|
onClick: onCategorySelect,
|
|
5057
|
-
selectedId
|
|
5067
|
+
selectedId,
|
|
5068
|
+
showDescriptions: showTooltips
|
|
5058
5069
|
}
|
|
5059
5070
|
));
|
|
5060
5071
|
};
|
|
@@ -5063,7 +5074,8 @@ var BusinessCategories = ({
|
|
|
5063
5074
|
var import_classnames24 = __toESM(require("classnames"));
|
|
5064
5075
|
var CategorySelectDrawer = ({
|
|
5065
5076
|
onSelect,
|
|
5066
|
-
selected
|
|
5077
|
+
selected,
|
|
5078
|
+
showTooltips
|
|
5067
5079
|
}) => {
|
|
5068
5080
|
const { setContent, close } = (0, import_react57.useContext)(DrawerContext);
|
|
5069
5081
|
const onDrawerCategorySelect = (value) => {
|
|
@@ -5083,7 +5095,8 @@ var CategorySelectDrawer = ({
|
|
|
5083
5095
|
CategorySelectDrawerContent,
|
|
5084
5096
|
{
|
|
5085
5097
|
selected,
|
|
5086
|
-
onSelect: onDrawerCategorySelect
|
|
5098
|
+
onSelect: onDrawerCategorySelect,
|
|
5099
|
+
showTooltips: true
|
|
5087
5100
|
}
|
|
5088
5101
|
)
|
|
5089
5102
|
)
|
|
@@ -5100,7 +5113,8 @@ var CategorySelectDrawer = ({
|
|
|
5100
5113
|
};
|
|
5101
5114
|
var CategorySelectDrawerContent = ({
|
|
5102
5115
|
onSelect,
|
|
5103
|
-
selected
|
|
5116
|
+
selected,
|
|
5117
|
+
showTooltips
|
|
5104
5118
|
}) => /* @__PURE__ */ import_react57.default.createElement(
|
|
5105
5119
|
BusinessCategories,
|
|
5106
5120
|
{
|
|
@@ -5112,7 +5126,8 @@ var CategorySelectDrawerContent = ({
|
|
|
5112
5126
|
}
|
|
5113
5127
|
});
|
|
5114
5128
|
},
|
|
5115
|
-
selectedId: selected?.payload?.id
|
|
5129
|
+
selectedId: selected?.payload?.id,
|
|
5130
|
+
showTooltips
|
|
5116
5131
|
}
|
|
5117
5132
|
);
|
|
5118
5133
|
|
|
@@ -5285,7 +5300,14 @@ var CategorySelect = ({
|
|
|
5285
5300
|
const selected = value ? value : !excludeMatches && matchOptions?.length === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
|
|
5286
5301
|
const placeholder = matchOptions?.length === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
|
|
5287
5302
|
if (asDrawer) {
|
|
5288
|
-
return /* @__PURE__ */ import_react58.default.createElement(
|
|
5303
|
+
return /* @__PURE__ */ import_react58.default.createElement(
|
|
5304
|
+
CategorySelectDrawer,
|
|
5305
|
+
{
|
|
5306
|
+
onSelect: onChange,
|
|
5307
|
+
selected: value,
|
|
5308
|
+
showTooltips
|
|
5309
|
+
}
|
|
5310
|
+
);
|
|
5289
5311
|
}
|
|
5290
5312
|
return /* @__PURE__ */ import_react58.default.createElement(
|
|
5291
5313
|
import_react_select.default,
|
|
@@ -7207,7 +7229,8 @@ var BusinessForm = ({
|
|
|
7207
7229
|
BusinessCategories,
|
|
7208
7230
|
{
|
|
7209
7231
|
selectedId: selectedCategory?.id,
|
|
7210
|
-
select: onDrawerCategorySelect
|
|
7232
|
+
select: onDrawerCategorySelect,
|
|
7233
|
+
showTooltips
|
|
7211
7234
|
}
|
|
7212
7235
|
)
|
|
7213
7236
|
);
|
|
@@ -9212,6 +9235,9 @@ var PNLComparisonContext = (0, import_react102.createContext)({
|
|
|
9212
9235
|
},
|
|
9213
9236
|
refetch: function() {
|
|
9214
9237
|
throw new Error("Function not implemented.");
|
|
9238
|
+
},
|
|
9239
|
+
getProfitAndLossComparisonCsv: function() {
|
|
9240
|
+
throw new Error("Function not implemented.");
|
|
9215
9241
|
}
|
|
9216
9242
|
});
|
|
9217
9243
|
|
|
@@ -9784,6 +9810,21 @@ var useProfitAndLossComparison = ({
|
|
|
9784
9810
|
reportingBasis
|
|
9785
9811
|
]
|
|
9786
9812
|
);
|
|
9813
|
+
const getProfitAndLossComparisonCsv = (dateRange, moneyFormat) => {
|
|
9814
|
+
const periods = preparePeriodsBody(dateRange, compareMonths);
|
|
9815
|
+
const tagFilters = prepareFiltersBody(compareOptions);
|
|
9816
|
+
return Layer.profitAndLossComparisonCsv(apiUrl, auth.access_token, {
|
|
9817
|
+
params: {
|
|
9818
|
+
businessId,
|
|
9819
|
+
moneyFormat
|
|
9820
|
+
},
|
|
9821
|
+
body: {
|
|
9822
|
+
periods,
|
|
9823
|
+
tag_filters: tagFilters,
|
|
9824
|
+
reporting_basis: reportingBasis
|
|
9825
|
+
}
|
|
9826
|
+
});
|
|
9827
|
+
};
|
|
9787
9828
|
return {
|
|
9788
9829
|
data: data?.pnls,
|
|
9789
9830
|
isLoading,
|
|
@@ -9795,7 +9836,8 @@ var useProfitAndLossComparison = ({
|
|
|
9795
9836
|
setCompareMonths,
|
|
9796
9837
|
compareOptions,
|
|
9797
9838
|
setCompareOptions,
|
|
9798
|
-
refetch
|
|
9839
|
+
refetch,
|
|
9840
|
+
getProfitAndLossComparisonCsv
|
|
9799
9841
|
};
|
|
9800
9842
|
};
|
|
9801
9843
|
|
|
@@ -11558,10 +11600,14 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
11558
11600
|
var import_react117 = __toESM(require("react"));
|
|
11559
11601
|
var ProfitAndLossDownloadButton = ({
|
|
11560
11602
|
stringOverrides,
|
|
11603
|
+
useComparisonPnl = false,
|
|
11561
11604
|
moneyFormat,
|
|
11562
11605
|
view
|
|
11563
11606
|
}) => {
|
|
11564
11607
|
const { dateRange } = (0, import_react117.useContext)(ProfitAndLoss.Context);
|
|
11608
|
+
const { getProfitAndLossComparisonCsv } = (0, import_react117.useContext)(
|
|
11609
|
+
ProfitAndLoss.ComparisonContext
|
|
11610
|
+
);
|
|
11565
11611
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
11566
11612
|
const [requestFailed, setRequestFailed] = (0, import_react117.useState)(false);
|
|
11567
11613
|
const [isDownloading, setIsDownloading] = (0, import_react117.useState)(false);
|
|
@@ -11582,7 +11628,7 @@ var ProfitAndLossDownloadButton = ({
|
|
|
11582
11628
|
}
|
|
11583
11629
|
);
|
|
11584
11630
|
try {
|
|
11585
|
-
const result = await getProfitAndLossCsv2();
|
|
11631
|
+
const result = useComparisonPnl ? await getProfitAndLossComparisonCsv(dateRange, moneyFormat) : await getProfitAndLossCsv2();
|
|
11586
11632
|
if (result?.data?.presignedUrl) {
|
|
11587
11633
|
window.location.href = result.data.presignedUrl;
|
|
11588
11634
|
setRequestFailed(false);
|
|
@@ -11792,6 +11838,7 @@ var ProfitAndLossReport = ({
|
|
|
11792
11838
|
ProfitAndLoss.DownloadButton,
|
|
11793
11839
|
{
|
|
11794
11840
|
stringOverrides: stringOverrides?.downloadButton,
|
|
11841
|
+
useComparisonPnl: !!comparisonConfig,
|
|
11795
11842
|
moneyFormat: csvMoneyFormat,
|
|
11796
11843
|
view
|
|
11797
11844
|
}
|
|
@@ -14195,8 +14242,6 @@ var ChartOfAccountsTableContent = ({
|
|
|
14195
14242
|
const renderChartOfAccountsDesktopRow = (account, index, rowKey, depth) => {
|
|
14196
14243
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
14197
14244
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
14198
|
-
const editButton = /* @__PURE__ */ import_react159.default.createElement(Edit2_default, { size: 12 });
|
|
14199
|
-
const disabledEditButtonWithTooltip = /* @__PURE__ */ import_react159.default.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ import_react159.default.createElement(TooltipTrigger, null, /* @__PURE__ */ import_react159.default.createElement(Edit2_default, { size: 12 })), /* @__PURE__ */ import_react159.default.createElement(TooltipContent, { className: "Layer__tooltip" }, "System accounts cannot be modified"));
|
|
14200
14245
|
return /* @__PURE__ */ import_react159.default.createElement(import_react159.default.Fragment, { key: rowKey + "-" + index }, /* @__PURE__ */ import_react159.default.createElement(
|
|
14201
14246
|
TableRow,
|
|
14202
14247
|
{
|
|
@@ -14227,14 +14272,15 @@ var ChartOfAccountsTableContent = ({
|
|
|
14227
14272
|
Button,
|
|
14228
14273
|
{
|
|
14229
14274
|
variant: "secondary" /* secondary */,
|
|
14230
|
-
rightIcon:
|
|
14275
|
+
rightIcon: /* @__PURE__ */ import_react159.default.createElement(Edit2_default, { size: 12 }),
|
|
14231
14276
|
iconOnly: true,
|
|
14232
14277
|
disabled: !templateAccountsEditable && !!account.stable_name,
|
|
14233
14278
|
onClick: (e) => {
|
|
14234
14279
|
e.preventDefault();
|
|
14235
14280
|
e.stopPropagation();
|
|
14236
14281
|
editAccount(account.id);
|
|
14237
|
-
}
|
|
14282
|
+
},
|
|
14283
|
+
tooltip: !templateAccountsEditable && account.stable_name ? "System accounts cannot be modified" : void 0
|
|
14238
14284
|
},
|
|
14239
14285
|
"Edit"
|
|
14240
14286
|
)))
|