@layerfi/components 0.1.114-alpha.5 → 0.1.114-alpha.6
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/cjs/index.cjs +200 -202
- package/dist/esm/index.mjs +202 -204
- package/dist/index.css +57 -57
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -202,7 +202,7 @@ class ErrorHandlerClass {
|
|
|
202
202
|
}
|
|
203
203
|
const errorHandler = new ErrorHandlerClass();
|
|
204
204
|
const reportError = (payload) => errorHandler.onError(payload);
|
|
205
|
-
const version = "0.1.114-alpha.
|
|
205
|
+
const version = "0.1.114-alpha.6";
|
|
206
206
|
const pkg = {
|
|
207
207
|
version
|
|
208
208
|
};
|
|
@@ -13344,6 +13344,37 @@ const MonthPicker = ({
|
|
|
13344
13344
|
) }) })
|
|
13345
13345
|
] });
|
|
13346
13346
|
};
|
|
13347
|
+
const NewToggleOption = ({
|
|
13348
|
+
label,
|
|
13349
|
+
value
|
|
13350
|
+
}) => {
|
|
13351
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactAriaComponents.ToggleButton, { id: value, className: "Layer__NewToggleOption", children: [
|
|
13352
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.SelectionIndicator, { className: "Layer__NewToggleOption-SelectionIndicator" }),
|
|
13353
|
+
/* @__PURE__ */ jsxRuntime.jsx(Span, { className: "Layer__NewToggle-Option-Content", children: /* @__PURE__ */ jsxRuntime.jsx(Span, { noWrap: true, children: label }) })
|
|
13354
|
+
] });
|
|
13355
|
+
};
|
|
13356
|
+
const NewToggle = ({
|
|
13357
|
+
options: options2,
|
|
13358
|
+
selectedKey,
|
|
13359
|
+
onSelectionChange
|
|
13360
|
+
}) => {
|
|
13361
|
+
const selectedKeys = selectedKey !== void 0 ? /* @__PURE__ */ new Set([selectedKey]) : /* @__PURE__ */ new Set();
|
|
13362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13363
|
+
reactAriaComponents.ToggleButtonGroup,
|
|
13364
|
+
{
|
|
13365
|
+
className: "Layer__NewToggle",
|
|
13366
|
+
selectionMode: "single",
|
|
13367
|
+
selectedKeys,
|
|
13368
|
+
onSelectionChange: (keys2) => {
|
|
13369
|
+
const selectedKeysArray = Array.from(keys2);
|
|
13370
|
+
if (selectedKeysArray.length > 0 && onSelectionChange) {
|
|
13371
|
+
onSelectionChange(selectedKeysArray[0]);
|
|
13372
|
+
}
|
|
13373
|
+
},
|
|
13374
|
+
children: options2.map((option) => /* @__PURE__ */ jsxRuntime.jsx(NewToggleOption, __spreadValues({}, option), option.value))
|
|
13375
|
+
}
|
|
13376
|
+
);
|
|
13377
|
+
};
|
|
13347
13378
|
const SmallLoader = ({ size = 28 }) => {
|
|
13348
13379
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13349
13380
|
"span",
|
|
@@ -13388,169 +13419,6 @@ const SyncingComponent = ({
|
|
|
13388
13419
|
}
|
|
13389
13420
|
);
|
|
13390
13421
|
};
|
|
13391
|
-
var ToggleSize = /* @__PURE__ */ ((ToggleSize2) => {
|
|
13392
|
-
ToggleSize2["medium"] = "medium";
|
|
13393
|
-
ToggleSize2["small"] = "small";
|
|
13394
|
-
ToggleSize2["xsmall"] = "xsmall";
|
|
13395
|
-
return ToggleSize2;
|
|
13396
|
-
})(ToggleSize || {});
|
|
13397
|
-
const Toggle = ({
|
|
13398
|
-
name,
|
|
13399
|
-
options: options2,
|
|
13400
|
-
selected,
|
|
13401
|
-
onChange,
|
|
13402
|
-
size = "medium"
|
|
13403
|
-
/* medium */
|
|
13404
|
-
}) => {
|
|
13405
|
-
const [currentWidth, setCurrentWidth] = react.useState(0);
|
|
13406
|
-
const [thumbPos, setThumbPos] = react.useState({ left: 0, width: 0 });
|
|
13407
|
-
const [initialized, setInitialized] = react.useState(false);
|
|
13408
|
-
const activeOption = react.useMemo(() => {
|
|
13409
|
-
return selected ? selected : options2.length > 0 ? options2[0].value : void 0;
|
|
13410
|
-
}, [selected, options2]);
|
|
13411
|
-
const toggleRef = useElementSize((_a, _b, c) => {
|
|
13412
|
-
if (c.width && (c == null ? void 0 : c.width) !== currentWidth) {
|
|
13413
|
-
setCurrentWidth(c.width);
|
|
13414
|
-
}
|
|
13415
|
-
});
|
|
13416
|
-
const baseClassName2 = classNames(
|
|
13417
|
-
"Layer__toggle",
|
|
13418
|
-
`Layer__toggle--${size}`,
|
|
13419
|
-
initialized ? "Layer__toggle--initialized" : ""
|
|
13420
|
-
);
|
|
13421
|
-
const handleChange = (e) => {
|
|
13422
|
-
var _a;
|
|
13423
|
-
updateThumbPosition(Number((_a = e.target.getAttribute("data-idx")) != null ? _a : 0));
|
|
13424
|
-
onChange(e);
|
|
13425
|
-
};
|
|
13426
|
-
const updateThumbPosition = (active) => {
|
|
13427
|
-
if (!(toggleRef == null ? void 0 : toggleRef.current)) {
|
|
13428
|
-
return;
|
|
13429
|
-
}
|
|
13430
|
-
const optionsNodes = [...toggleRef.current.children].map((x) => {
|
|
13431
|
-
if (x.className.includes("Layer__tooltip-trigger") && x.children && x.children.length > 0) {
|
|
13432
|
-
return x.children[0];
|
|
13433
|
-
}
|
|
13434
|
-
return x;
|
|
13435
|
-
}).filter((c) => c.className.includes("Layer__toggle-option"));
|
|
13436
|
-
let shift = 0;
|
|
13437
|
-
let width = thumbPos.width;
|
|
13438
|
-
optionsNodes.forEach((c, i) => {
|
|
13439
|
-
if (i < active) {
|
|
13440
|
-
shift = shift + c.offsetWidth;
|
|
13441
|
-
} else if (i === active) {
|
|
13442
|
-
width = c.offsetWidth;
|
|
13443
|
-
}
|
|
13444
|
-
});
|
|
13445
|
-
shift = shift + (size === "medium" ? 2 : 1.5);
|
|
13446
|
-
setThumbPos({ left: shift, width });
|
|
13447
|
-
};
|
|
13448
|
-
react.useEffect(() => {
|
|
13449
|
-
const selectedIndex = getSelectedIndex();
|
|
13450
|
-
updateThumbPosition(selectedIndex);
|
|
13451
|
-
setTimeout(() => {
|
|
13452
|
-
setInitialized(true);
|
|
13453
|
-
}, 400);
|
|
13454
|
-
}, []);
|
|
13455
|
-
react.useEffect(() => {
|
|
13456
|
-
const selectedIndex = getSelectedIndex();
|
|
13457
|
-
updateThumbPosition(selectedIndex);
|
|
13458
|
-
}, [currentWidth]);
|
|
13459
|
-
const getSelectedIndex = () => {
|
|
13460
|
-
const selectedIndex = options2.findIndex(
|
|
13461
|
-
(option) => option.value === activeOption
|
|
13462
|
-
);
|
|
13463
|
-
if (selectedIndex === -1) {
|
|
13464
|
-
return 0;
|
|
13465
|
-
}
|
|
13466
|
-
return selectedIndex;
|
|
13467
|
-
};
|
|
13468
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: baseClassName2, ref: toggleRef, children: [
|
|
13469
|
-
options2.map((option, index2) => {
|
|
13470
|
-
var _a;
|
|
13471
|
-
return /* @__PURE__ */ react.createElement(
|
|
13472
|
-
ToggleOption,
|
|
13473
|
-
__spreadProps(__spreadValues({}, option), {
|
|
13474
|
-
size,
|
|
13475
|
-
key: option.value,
|
|
13476
|
-
name,
|
|
13477
|
-
checked: activeOption === option.value,
|
|
13478
|
-
onChange: handleChange,
|
|
13479
|
-
disabled: (_a = option.disabled) != null ? _a : false,
|
|
13480
|
-
disabledMessage: option.disabledMessage,
|
|
13481
|
-
index: index2
|
|
13482
|
-
})
|
|
13483
|
-
);
|
|
13484
|
-
}),
|
|
13485
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__toggle__thumb", style: __spreadValues({}, thumbPos) })
|
|
13486
|
-
] });
|
|
13487
|
-
};
|
|
13488
|
-
const ToggleOption = ({
|
|
13489
|
-
checked,
|
|
13490
|
-
label,
|
|
13491
|
-
name,
|
|
13492
|
-
onChange,
|
|
13493
|
-
value,
|
|
13494
|
-
size: _size,
|
|
13495
|
-
leftIcon,
|
|
13496
|
-
disabled,
|
|
13497
|
-
disabledMessage = "Disabled",
|
|
13498
|
-
style,
|
|
13499
|
-
index: index2
|
|
13500
|
-
}) => {
|
|
13501
|
-
const optionClassName = classNames("Layer__toggle-option", {
|
|
13502
|
-
"Layer__toggle-option--active": checked
|
|
13503
|
-
});
|
|
13504
|
-
if (disabled) {
|
|
13505
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DeprecatedTooltip, { children: [
|
|
13506
|
-
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13507
|
-
"label",
|
|
13508
|
-
{
|
|
13509
|
-
className: optionClassName,
|
|
13510
|
-
"data-checked": checked,
|
|
13511
|
-
style,
|
|
13512
|
-
children: [
|
|
13513
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13514
|
-
"input",
|
|
13515
|
-
{
|
|
13516
|
-
type: "radio",
|
|
13517
|
-
checked,
|
|
13518
|
-
name,
|
|
13519
|
-
onChange,
|
|
13520
|
-
value,
|
|
13521
|
-
disabled,
|
|
13522
|
-
"data-idx": index2
|
|
13523
|
-
}
|
|
13524
|
-
),
|
|
13525
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
13526
|
-
leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
13527
|
-
/* @__PURE__ */ jsxRuntime.jsx(Span, { noWrap: true, children: label })
|
|
13528
|
-
] })
|
|
13529
|
-
]
|
|
13530
|
-
}
|
|
13531
|
-
) }),
|
|
13532
|
-
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
|
|
13533
|
-
] });
|
|
13534
|
-
}
|
|
13535
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
|
|
13536
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13537
|
-
"input",
|
|
13538
|
-
{
|
|
13539
|
-
type: "radio",
|
|
13540
|
-
checked,
|
|
13541
|
-
name,
|
|
13542
|
-
onChange,
|
|
13543
|
-
value,
|
|
13544
|
-
disabled,
|
|
13545
|
-
"data-idx": index2
|
|
13546
|
-
}
|
|
13547
|
-
),
|
|
13548
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
13549
|
-
leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
13550
|
-
/* @__PURE__ */ jsxRuntime.jsx(Span, { noWrap: true, children: label })
|
|
13551
|
-
] })
|
|
13552
|
-
] });
|
|
13553
|
-
};
|
|
13554
13422
|
var HeadingSize = /* @__PURE__ */ ((HeadingSize2) => {
|
|
13555
13423
|
HeadingSize2["primary"] = "primary";
|
|
13556
13424
|
HeadingSize2["secondary"] = "secondary";
|
|
@@ -13737,9 +13605,9 @@ const BankTransactionsHeader = ({
|
|
|
13737
13605
|
stringOverrides == null ? void 0 : stringOverrides.header,
|
|
13738
13606
|
withDatePicker
|
|
13739
13607
|
]);
|
|
13740
|
-
const onCategorizationDisplayChange = (
|
|
13608
|
+
const onCategorizationDisplayChange = (value) => {
|
|
13741
13609
|
setFilters({
|
|
13742
|
-
categorizationStatus:
|
|
13610
|
+
categorizationStatus: value === "categorized" ? DisplayState.categorized : value === "all" ? DisplayState.all : DisplayState.review
|
|
13743
13611
|
});
|
|
13744
13612
|
};
|
|
13745
13613
|
const headerMenuActions = react.useMemo(() => {
|
|
@@ -13775,16 +13643,14 @@ const BankTransactionsHeader = ({
|
|
|
13775
13643
|
) : /* @__PURE__ */ jsxRuntime.jsxs(HStack, { slot: "toggle", justify: "center", gap: "xs", children: [
|
|
13776
13644
|
collapseHeader && headerTopRow,
|
|
13777
13645
|
!categorizedOnly && categorizeView && showStatusToggle && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13778
|
-
|
|
13646
|
+
NewToggle,
|
|
13779
13647
|
{
|
|
13780
|
-
name: "bank-transaction-display",
|
|
13781
|
-
size: mobileComponent === "mobileList" ? ToggleSize.small : ToggleSize.medium,
|
|
13782
13648
|
options: [
|
|
13783
13649
|
{ label: "To Review", value: DisplayState.review },
|
|
13784
13650
|
{ label: "Categorized", value: DisplayState.categorized }
|
|
13785
13651
|
],
|
|
13786
|
-
|
|
13787
|
-
|
|
13652
|
+
selectedKey: display,
|
|
13653
|
+
onSelectionChange: onCategorizationDisplayChange
|
|
13788
13654
|
}
|
|
13789
13655
|
)
|
|
13790
13656
|
] }),
|
|
@@ -16098,6 +15964,169 @@ const MatchForm = ({
|
|
|
16098
15964
|
matchFormError && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: matchFormError })
|
|
16099
15965
|
] });
|
|
16100
15966
|
};
|
|
15967
|
+
var ToggleSize = /* @__PURE__ */ ((ToggleSize2) => {
|
|
15968
|
+
ToggleSize2["medium"] = "medium";
|
|
15969
|
+
ToggleSize2["small"] = "small";
|
|
15970
|
+
ToggleSize2["xsmall"] = "xsmall";
|
|
15971
|
+
return ToggleSize2;
|
|
15972
|
+
})(ToggleSize || {});
|
|
15973
|
+
const Toggle = ({
|
|
15974
|
+
name,
|
|
15975
|
+
options: options2,
|
|
15976
|
+
selected,
|
|
15977
|
+
onChange,
|
|
15978
|
+
size = "medium"
|
|
15979
|
+
/* medium */
|
|
15980
|
+
}) => {
|
|
15981
|
+
const [currentWidth, setCurrentWidth] = react.useState(0);
|
|
15982
|
+
const [thumbPos, setThumbPos] = react.useState({ left: 0, width: 0 });
|
|
15983
|
+
const [initialized, setInitialized] = react.useState(false);
|
|
15984
|
+
const activeOption = react.useMemo(() => {
|
|
15985
|
+
return selected ? selected : options2.length > 0 ? options2[0].value : void 0;
|
|
15986
|
+
}, [selected, options2]);
|
|
15987
|
+
const toggleRef = useElementSize((_a, _b, c) => {
|
|
15988
|
+
if (c.width && (c == null ? void 0 : c.width) !== currentWidth) {
|
|
15989
|
+
setCurrentWidth(c.width);
|
|
15990
|
+
}
|
|
15991
|
+
});
|
|
15992
|
+
const baseClassName2 = classNames(
|
|
15993
|
+
"Layer__toggle",
|
|
15994
|
+
`Layer__toggle--${size}`,
|
|
15995
|
+
initialized ? "Layer__toggle--initialized" : ""
|
|
15996
|
+
);
|
|
15997
|
+
const handleChange = (e) => {
|
|
15998
|
+
var _a;
|
|
15999
|
+
updateThumbPosition(Number((_a = e.target.getAttribute("data-idx")) != null ? _a : 0));
|
|
16000
|
+
onChange(e);
|
|
16001
|
+
};
|
|
16002
|
+
const updateThumbPosition = (active) => {
|
|
16003
|
+
if (!(toggleRef == null ? void 0 : toggleRef.current)) {
|
|
16004
|
+
return;
|
|
16005
|
+
}
|
|
16006
|
+
const optionsNodes = [...toggleRef.current.children].map((x) => {
|
|
16007
|
+
if (x.className.includes("Layer__tooltip-trigger") && x.children && x.children.length > 0) {
|
|
16008
|
+
return x.children[0];
|
|
16009
|
+
}
|
|
16010
|
+
return x;
|
|
16011
|
+
}).filter((c) => c.className.includes("Layer__toggle-option"));
|
|
16012
|
+
let shift = 0;
|
|
16013
|
+
let width = thumbPos.width;
|
|
16014
|
+
optionsNodes.forEach((c, i) => {
|
|
16015
|
+
if (i < active) {
|
|
16016
|
+
shift = shift + c.offsetWidth;
|
|
16017
|
+
} else if (i === active) {
|
|
16018
|
+
width = c.offsetWidth;
|
|
16019
|
+
}
|
|
16020
|
+
});
|
|
16021
|
+
shift = shift + (size === "medium" ? 2 : 1.5);
|
|
16022
|
+
setThumbPos({ left: shift, width });
|
|
16023
|
+
};
|
|
16024
|
+
react.useEffect(() => {
|
|
16025
|
+
const selectedIndex = getSelectedIndex();
|
|
16026
|
+
updateThumbPosition(selectedIndex);
|
|
16027
|
+
setTimeout(() => {
|
|
16028
|
+
setInitialized(true);
|
|
16029
|
+
}, 400);
|
|
16030
|
+
}, []);
|
|
16031
|
+
react.useEffect(() => {
|
|
16032
|
+
const selectedIndex = getSelectedIndex();
|
|
16033
|
+
updateThumbPosition(selectedIndex);
|
|
16034
|
+
}, [currentWidth]);
|
|
16035
|
+
const getSelectedIndex = () => {
|
|
16036
|
+
const selectedIndex = options2.findIndex(
|
|
16037
|
+
(option) => option.value === activeOption
|
|
16038
|
+
);
|
|
16039
|
+
if (selectedIndex === -1) {
|
|
16040
|
+
return 0;
|
|
16041
|
+
}
|
|
16042
|
+
return selectedIndex;
|
|
16043
|
+
};
|
|
16044
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: baseClassName2, ref: toggleRef, children: [
|
|
16045
|
+
options2.map((option, index2) => {
|
|
16046
|
+
var _a;
|
|
16047
|
+
return /* @__PURE__ */ react.createElement(
|
|
16048
|
+
ToggleOption,
|
|
16049
|
+
__spreadProps(__spreadValues({}, option), {
|
|
16050
|
+
size,
|
|
16051
|
+
key: option.value,
|
|
16052
|
+
name,
|
|
16053
|
+
checked: activeOption === option.value,
|
|
16054
|
+
onChange: handleChange,
|
|
16055
|
+
disabled: (_a = option.disabled) != null ? _a : false,
|
|
16056
|
+
disabledMessage: option.disabledMessage,
|
|
16057
|
+
index: index2
|
|
16058
|
+
})
|
|
16059
|
+
);
|
|
16060
|
+
}),
|
|
16061
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__toggle__thumb", style: __spreadValues({}, thumbPos) })
|
|
16062
|
+
] });
|
|
16063
|
+
};
|
|
16064
|
+
const ToggleOption = ({
|
|
16065
|
+
checked,
|
|
16066
|
+
label,
|
|
16067
|
+
name,
|
|
16068
|
+
onChange,
|
|
16069
|
+
value,
|
|
16070
|
+
size: _size,
|
|
16071
|
+
leftIcon,
|
|
16072
|
+
disabled,
|
|
16073
|
+
disabledMessage = "Disabled",
|
|
16074
|
+
style,
|
|
16075
|
+
index: index2
|
|
16076
|
+
}) => {
|
|
16077
|
+
const optionClassName = classNames("Layer__toggle-option", {
|
|
16078
|
+
"Layer__toggle-option--active": checked
|
|
16079
|
+
});
|
|
16080
|
+
if (disabled) {
|
|
16081
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DeprecatedTooltip, { children: [
|
|
16082
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16083
|
+
"label",
|
|
16084
|
+
{
|
|
16085
|
+
className: optionClassName,
|
|
16086
|
+
"data-checked": checked,
|
|
16087
|
+
style,
|
|
16088
|
+
children: [
|
|
16089
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16090
|
+
"input",
|
|
16091
|
+
{
|
|
16092
|
+
type: "radio",
|
|
16093
|
+
checked,
|
|
16094
|
+
name,
|
|
16095
|
+
onChange,
|
|
16096
|
+
value,
|
|
16097
|
+
disabled,
|
|
16098
|
+
"data-idx": index2
|
|
16099
|
+
}
|
|
16100
|
+
),
|
|
16101
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
16102
|
+
leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
16103
|
+
/* @__PURE__ */ jsxRuntime.jsx(Span, { noWrap: true, children: label })
|
|
16104
|
+
] })
|
|
16105
|
+
]
|
|
16106
|
+
}
|
|
16107
|
+
) }),
|
|
16108
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
|
|
16109
|
+
] });
|
|
16110
|
+
}
|
|
16111
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
|
|
16112
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16113
|
+
"input",
|
|
16114
|
+
{
|
|
16115
|
+
type: "radio",
|
|
16116
|
+
checked,
|
|
16117
|
+
name,
|
|
16118
|
+
onChange,
|
|
16119
|
+
value,
|
|
16120
|
+
disabled,
|
|
16121
|
+
"data-idx": index2
|
|
16122
|
+
}
|
|
16123
|
+
),
|
|
16124
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
16125
|
+
leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
16126
|
+
/* @__PURE__ */ jsxRuntime.jsx(Span, { noWrap: true, children: label })
|
|
16127
|
+
] })
|
|
16128
|
+
] });
|
|
16129
|
+
};
|
|
16101
16130
|
const GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
|
|
16102
16131
|
function buildKey$I({
|
|
16103
16132
|
access_token: accessToken,
|
|
@@ -19282,37 +19311,6 @@ const BankTransactionsMobileForms = ({
|
|
|
19282
19311
|
};
|
|
19283
19312
|
return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: getContent() });
|
|
19284
19313
|
};
|
|
19285
|
-
const NewToggleOption = ({
|
|
19286
|
-
label,
|
|
19287
|
-
value
|
|
19288
|
-
}) => {
|
|
19289
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactAriaComponents.ToggleButton, { id: value, className: "Layer__NewToggleOption", children: [
|
|
19290
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.SelectionIndicator, { className: "Layer__NewToggleOption-SelectionIndicator" }),
|
|
19291
|
-
/* @__PURE__ */ jsxRuntime.jsx(Span, { className: "Layer__NewToggle-Option-Content", children: /* @__PURE__ */ jsxRuntime.jsx(Span, { noWrap: true, children: label }) })
|
|
19292
|
-
] });
|
|
19293
|
-
};
|
|
19294
|
-
const NewToggle = ({
|
|
19295
|
-
options: options2,
|
|
19296
|
-
selectedKey,
|
|
19297
|
-
onSelectionChange
|
|
19298
|
-
}) => {
|
|
19299
|
-
const selectedKeys = selectedKey !== void 0 ? /* @__PURE__ */ new Set([selectedKey]) : /* @__PURE__ */ new Set();
|
|
19300
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19301
|
-
reactAriaComponents.ToggleButtonGroup,
|
|
19302
|
-
{
|
|
19303
|
-
className: "Layer__NewToggle",
|
|
19304
|
-
selectionMode: "single",
|
|
19305
|
-
selectedKeys,
|
|
19306
|
-
onSelectionChange: (keys2) => {
|
|
19307
|
-
const selectedKeysArray = Array.from(keys2);
|
|
19308
|
-
if (selectedKeysArray.length > 0 && onSelectionChange) {
|
|
19309
|
-
onSelectionChange(selectedKeysArray[0]);
|
|
19310
|
-
}
|
|
19311
|
-
},
|
|
19312
|
-
children: options2.map((option) => /* @__PURE__ */ jsxRuntime.jsx(NewToggleOption, __spreadValues({}, option), option.value))
|
|
19313
|
-
}
|
|
19314
|
-
);
|
|
19315
|
-
};
|
|
19316
19314
|
const PURPOSE_TOGGLE_OPTIONS = [
|
|
19317
19315
|
{
|
|
19318
19316
|
value: "business",
|
package/dist/esm/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
54
|
-
import { createContext, useState, useContext, useMemo, useEffect, forwardRef, useCallback, useRef, isValidElement, cloneElement, useLayoutEffect, useId, Children,
|
|
54
|
+
import { createContext, useState, useContext, useMemo, useEffect, forwardRef, useCallback, useRef, isValidElement, cloneElement, useLayoutEffect, useId, Children, useImperativeHandle, createElement, Component, Fragment as Fragment$1, useReducer } from "react";
|
|
55
55
|
import { createStore, useStore } from "zustand";
|
|
56
56
|
import { usePlaidLink } from "react-plaid-link";
|
|
57
57
|
import { formatISO, differenceInDays, isWithinInterval, parseISO, endOfDay, startOfMonth, endOfMonth, min, max, differenceInCalendarMonths, format, isValid, startOfYear, subMonths, getYear, getMonth, subYears, differenceInCalendarYears, sub, differenceInMonths, add, startOfDay, endOfToday, isEqual, addYears, endOfYear, subQuarters, addQuarters, endOfQuarter, startOfQuarter, addMonths, set, startOfToday, endOfYesterday, formatDate as formatDate$1 } from "date-fns";
|
|
@@ -65,7 +65,7 @@ import useSWRInfinite from "swr/infinite";
|
|
|
65
65
|
import useSWRMutation from "swr/mutation";
|
|
66
66
|
import { useStoreWithEqualityFn } from "zustand/traditional";
|
|
67
67
|
import { useFloating, offset, flip, shift, autoUpdate, useHover, useFocus, useDismiss, useRole, useInteractions, useTransitionStyles, useMergeRefs, FloatingPortal } from "@floating-ui/react";
|
|
68
|
-
import { Button as Button$2, Header as Header$3, Label as Label$1, Text as Text$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Group, SearchField as SearchField$1, Input as Input$2, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, Checkbox as Checkbox$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, NumberField as NumberField$1, TextArea as TextArea$1, MenuTrigger, Popover as Popover$1, Menu as Menu$1, MenuItem as MenuItem$2, GridList, GridListItem, DialogTrigger, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Switch as Switch$1,
|
|
68
|
+
import { Button as Button$2, Header as Header$3, Label as Label$1, Text as Text$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Group, SearchField as SearchField$1, Input as Input$2, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, Checkbox as Checkbox$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, NumberField as NumberField$1, TextArea as TextArea$1, MenuTrigger, Popover as Popover$1, Menu as Menu$1, MenuItem as MenuItem$2, GridList, GridListItem, DialogTrigger, ToggleButton, SelectionIndicator, ToggleButtonGroup, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Switch as Switch$1, Calendar as Calendar$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, Meter as Meter$1, Link as Link$3 } from "react-aria-components";
|
|
69
69
|
import { LoaderCircle, X as X$1, ChevronDown as ChevronDown$1, Layers2Icon, UploadCloud as UploadCloud$1, Search, ChevronLeft as ChevronLeft$1, CopyIcon, FileSpreadsheet, FileDownIcon, Minus, Check as Check$1, RefreshCcw as RefreshCcw$1, MenuIcon, ChevronRight as ChevronRight$1, PencilRuler, SearchX, Trash2, CheckIcon, AlertCircle as AlertCircle$1, TriangleAlert, List, AlertTriangle, Save as Save$1, Plus as Plus$1, HandCoins, Menu as Menu$2, Trash as Trash$1, Send, Calendar as Calendar$2, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, Car } from "lucide-react";
|
|
70
70
|
import pluralize from "pluralize";
|
|
71
71
|
import { mergeRefs } from "react-merge-refs";
|
|
@@ -202,7 +202,7 @@ class ErrorHandlerClass {
|
|
|
202
202
|
}
|
|
203
203
|
const errorHandler = new ErrorHandlerClass();
|
|
204
204
|
const reportError = (payload) => errorHandler.onError(payload);
|
|
205
|
-
const version = "0.1.114-alpha.
|
|
205
|
+
const version = "0.1.114-alpha.6";
|
|
206
206
|
const pkg = {
|
|
207
207
|
version
|
|
208
208
|
};
|
|
@@ -11868,6 +11868,37 @@ const MonthPicker = ({
|
|
|
11868
11868
|
) }) })
|
|
11869
11869
|
] });
|
|
11870
11870
|
};
|
|
11871
|
+
const NewToggleOption = ({
|
|
11872
|
+
label,
|
|
11873
|
+
value
|
|
11874
|
+
}) => {
|
|
11875
|
+
return /* @__PURE__ */ jsxs(ToggleButton, { id: value, className: "Layer__NewToggleOption", children: [
|
|
11876
|
+
/* @__PURE__ */ jsx(SelectionIndicator, { className: "Layer__NewToggleOption-SelectionIndicator" }),
|
|
11877
|
+
/* @__PURE__ */ jsx(Span, { className: "Layer__NewToggle-Option-Content", children: /* @__PURE__ */ jsx(Span, { noWrap: true, children: label }) })
|
|
11878
|
+
] });
|
|
11879
|
+
};
|
|
11880
|
+
const NewToggle = ({
|
|
11881
|
+
options: options2,
|
|
11882
|
+
selectedKey,
|
|
11883
|
+
onSelectionChange
|
|
11884
|
+
}) => {
|
|
11885
|
+
const selectedKeys = selectedKey !== void 0 ? /* @__PURE__ */ new Set([selectedKey]) : /* @__PURE__ */ new Set();
|
|
11886
|
+
return /* @__PURE__ */ jsx(
|
|
11887
|
+
ToggleButtonGroup,
|
|
11888
|
+
{
|
|
11889
|
+
className: "Layer__NewToggle",
|
|
11890
|
+
selectionMode: "single",
|
|
11891
|
+
selectedKeys,
|
|
11892
|
+
onSelectionChange: (keys) => {
|
|
11893
|
+
const selectedKeysArray = Array.from(keys);
|
|
11894
|
+
if (selectedKeysArray.length > 0 && onSelectionChange) {
|
|
11895
|
+
onSelectionChange(selectedKeysArray[0]);
|
|
11896
|
+
}
|
|
11897
|
+
},
|
|
11898
|
+
children: options2.map((option) => /* @__PURE__ */ jsx(NewToggleOption, __spreadValues({}, option), option.value))
|
|
11899
|
+
}
|
|
11900
|
+
);
|
|
11901
|
+
};
|
|
11871
11902
|
const SmallLoader = ({ size = 28 }) => {
|
|
11872
11903
|
return /* @__PURE__ */ jsx(
|
|
11873
11904
|
"span",
|
|
@@ -11912,169 +11943,6 @@ const SyncingComponent = ({
|
|
|
11912
11943
|
}
|
|
11913
11944
|
);
|
|
11914
11945
|
};
|
|
11915
|
-
var ToggleSize = /* @__PURE__ */ ((ToggleSize2) => {
|
|
11916
|
-
ToggleSize2["medium"] = "medium";
|
|
11917
|
-
ToggleSize2["small"] = "small";
|
|
11918
|
-
ToggleSize2["xsmall"] = "xsmall";
|
|
11919
|
-
return ToggleSize2;
|
|
11920
|
-
})(ToggleSize || {});
|
|
11921
|
-
const Toggle = ({
|
|
11922
|
-
name,
|
|
11923
|
-
options: options2,
|
|
11924
|
-
selected,
|
|
11925
|
-
onChange,
|
|
11926
|
-
size = "medium"
|
|
11927
|
-
/* medium */
|
|
11928
|
-
}) => {
|
|
11929
|
-
const [currentWidth, setCurrentWidth] = useState(0);
|
|
11930
|
-
const [thumbPos, setThumbPos] = useState({ left: 0, width: 0 });
|
|
11931
|
-
const [initialized, setInitialized] = useState(false);
|
|
11932
|
-
const activeOption = useMemo(() => {
|
|
11933
|
-
return selected ? selected : options2.length > 0 ? options2[0].value : void 0;
|
|
11934
|
-
}, [selected, options2]);
|
|
11935
|
-
const toggleRef = useElementSize((_a, _b, c) => {
|
|
11936
|
-
if (c.width && (c == null ? void 0 : c.width) !== currentWidth) {
|
|
11937
|
-
setCurrentWidth(c.width);
|
|
11938
|
-
}
|
|
11939
|
-
});
|
|
11940
|
-
const baseClassName2 = classNames(
|
|
11941
|
-
"Layer__toggle",
|
|
11942
|
-
`Layer__toggle--${size}`,
|
|
11943
|
-
initialized ? "Layer__toggle--initialized" : ""
|
|
11944
|
-
);
|
|
11945
|
-
const handleChange = (e) => {
|
|
11946
|
-
var _a;
|
|
11947
|
-
updateThumbPosition(Number((_a = e.target.getAttribute("data-idx")) != null ? _a : 0));
|
|
11948
|
-
onChange(e);
|
|
11949
|
-
};
|
|
11950
|
-
const updateThumbPosition = (active) => {
|
|
11951
|
-
if (!(toggleRef == null ? void 0 : toggleRef.current)) {
|
|
11952
|
-
return;
|
|
11953
|
-
}
|
|
11954
|
-
const optionsNodes = [...toggleRef.current.children].map((x) => {
|
|
11955
|
-
if (x.className.includes("Layer__tooltip-trigger") && x.children && x.children.length > 0) {
|
|
11956
|
-
return x.children[0];
|
|
11957
|
-
}
|
|
11958
|
-
return x;
|
|
11959
|
-
}).filter((c) => c.className.includes("Layer__toggle-option"));
|
|
11960
|
-
let shift2 = 0;
|
|
11961
|
-
let width = thumbPos.width;
|
|
11962
|
-
optionsNodes.forEach((c, i) => {
|
|
11963
|
-
if (i < active) {
|
|
11964
|
-
shift2 = shift2 + c.offsetWidth;
|
|
11965
|
-
} else if (i === active) {
|
|
11966
|
-
width = c.offsetWidth;
|
|
11967
|
-
}
|
|
11968
|
-
});
|
|
11969
|
-
shift2 = shift2 + (size === "medium" ? 2 : 1.5);
|
|
11970
|
-
setThumbPos({ left: shift2, width });
|
|
11971
|
-
};
|
|
11972
|
-
useEffect(() => {
|
|
11973
|
-
const selectedIndex = getSelectedIndex();
|
|
11974
|
-
updateThumbPosition(selectedIndex);
|
|
11975
|
-
setTimeout(() => {
|
|
11976
|
-
setInitialized(true);
|
|
11977
|
-
}, 400);
|
|
11978
|
-
}, []);
|
|
11979
|
-
useEffect(() => {
|
|
11980
|
-
const selectedIndex = getSelectedIndex();
|
|
11981
|
-
updateThumbPosition(selectedIndex);
|
|
11982
|
-
}, [currentWidth]);
|
|
11983
|
-
const getSelectedIndex = () => {
|
|
11984
|
-
const selectedIndex = options2.findIndex(
|
|
11985
|
-
(option) => option.value === activeOption
|
|
11986
|
-
);
|
|
11987
|
-
if (selectedIndex === -1) {
|
|
11988
|
-
return 0;
|
|
11989
|
-
}
|
|
11990
|
-
return selectedIndex;
|
|
11991
|
-
};
|
|
11992
|
-
return /* @__PURE__ */ jsxs("div", { className: baseClassName2, ref: toggleRef, children: [
|
|
11993
|
-
options2.map((option, index) => {
|
|
11994
|
-
var _a;
|
|
11995
|
-
return /* @__PURE__ */ createElement(
|
|
11996
|
-
ToggleOption,
|
|
11997
|
-
__spreadProps(__spreadValues({}, option), {
|
|
11998
|
-
size,
|
|
11999
|
-
key: option.value,
|
|
12000
|
-
name,
|
|
12001
|
-
checked: activeOption === option.value,
|
|
12002
|
-
onChange: handleChange,
|
|
12003
|
-
disabled: (_a = option.disabled) != null ? _a : false,
|
|
12004
|
-
disabledMessage: option.disabledMessage,
|
|
12005
|
-
index
|
|
12006
|
-
})
|
|
12007
|
-
);
|
|
12008
|
-
}),
|
|
12009
|
-
/* @__PURE__ */ jsx("span", { className: "Layer__toggle__thumb", style: __spreadValues({}, thumbPos) })
|
|
12010
|
-
] });
|
|
12011
|
-
};
|
|
12012
|
-
const ToggleOption = ({
|
|
12013
|
-
checked,
|
|
12014
|
-
label,
|
|
12015
|
-
name,
|
|
12016
|
-
onChange,
|
|
12017
|
-
value,
|
|
12018
|
-
size: _size,
|
|
12019
|
-
leftIcon,
|
|
12020
|
-
disabled,
|
|
12021
|
-
disabledMessage = "Disabled",
|
|
12022
|
-
style,
|
|
12023
|
-
index
|
|
12024
|
-
}) => {
|
|
12025
|
-
const optionClassName = classNames("Layer__toggle-option", {
|
|
12026
|
-
"Layer__toggle-option--active": checked
|
|
12027
|
-
});
|
|
12028
|
-
if (disabled) {
|
|
12029
|
-
return /* @__PURE__ */ jsxs(DeprecatedTooltip, { children: [
|
|
12030
|
-
/* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxs(
|
|
12031
|
-
"label",
|
|
12032
|
-
{
|
|
12033
|
-
className: optionClassName,
|
|
12034
|
-
"data-checked": checked,
|
|
12035
|
-
style,
|
|
12036
|
-
children: [
|
|
12037
|
-
/* @__PURE__ */ jsx(
|
|
12038
|
-
"input",
|
|
12039
|
-
{
|
|
12040
|
-
type: "radio",
|
|
12041
|
-
checked,
|
|
12042
|
-
name,
|
|
12043
|
-
onChange,
|
|
12044
|
-
value,
|
|
12045
|
-
disabled,
|
|
12046
|
-
"data-idx": index
|
|
12047
|
-
}
|
|
12048
|
-
),
|
|
12049
|
-
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
12050
|
-
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
12051
|
-
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
12052
|
-
] })
|
|
12053
|
-
]
|
|
12054
|
-
}
|
|
12055
|
-
) }),
|
|
12056
|
-
/* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
|
|
12057
|
-
] });
|
|
12058
|
-
}
|
|
12059
|
-
return /* @__PURE__ */ jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
|
|
12060
|
-
/* @__PURE__ */ jsx(
|
|
12061
|
-
"input",
|
|
12062
|
-
{
|
|
12063
|
-
type: "radio",
|
|
12064
|
-
checked,
|
|
12065
|
-
name,
|
|
12066
|
-
onChange,
|
|
12067
|
-
value,
|
|
12068
|
-
disabled,
|
|
12069
|
-
"data-idx": index
|
|
12070
|
-
}
|
|
12071
|
-
),
|
|
12072
|
-
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
12073
|
-
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
12074
|
-
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
12075
|
-
] })
|
|
12076
|
-
] });
|
|
12077
|
-
};
|
|
12078
11946
|
var HeadingSize = /* @__PURE__ */ ((HeadingSize2) => {
|
|
12079
11947
|
HeadingSize2["primary"] = "primary";
|
|
12080
11948
|
HeadingSize2["secondary"] = "secondary";
|
|
@@ -12261,9 +12129,9 @@ const BankTransactionsHeader = ({
|
|
|
12261
12129
|
stringOverrides == null ? void 0 : stringOverrides.header,
|
|
12262
12130
|
withDatePicker
|
|
12263
12131
|
]);
|
|
12264
|
-
const onCategorizationDisplayChange = (
|
|
12132
|
+
const onCategorizationDisplayChange = (value) => {
|
|
12265
12133
|
setFilters({
|
|
12266
|
-
categorizationStatus:
|
|
12134
|
+
categorizationStatus: value === "categorized" ? DisplayState.categorized : value === "all" ? DisplayState.all : DisplayState.review
|
|
12267
12135
|
});
|
|
12268
12136
|
};
|
|
12269
12137
|
const headerMenuActions = useMemo(() => {
|
|
@@ -12299,16 +12167,14 @@ const BankTransactionsHeader = ({
|
|
|
12299
12167
|
) : /* @__PURE__ */ jsxs(HStack, { slot: "toggle", justify: "center", gap: "xs", children: [
|
|
12300
12168
|
collapseHeader && headerTopRow,
|
|
12301
12169
|
!categorizedOnly && categorizeView && showStatusToggle && /* @__PURE__ */ jsx(
|
|
12302
|
-
|
|
12170
|
+
NewToggle,
|
|
12303
12171
|
{
|
|
12304
|
-
name: "bank-transaction-display",
|
|
12305
|
-
size: mobileComponent === "mobileList" ? ToggleSize.small : ToggleSize.medium,
|
|
12306
12172
|
options: [
|
|
12307
12173
|
{ label: "To Review", value: DisplayState.review },
|
|
12308
12174
|
{ label: "Categorized", value: DisplayState.categorized }
|
|
12309
12175
|
],
|
|
12310
|
-
|
|
12311
|
-
|
|
12176
|
+
selectedKey: display,
|
|
12177
|
+
onSelectionChange: onCategorizationDisplayChange
|
|
12312
12178
|
}
|
|
12313
12179
|
)
|
|
12314
12180
|
] }),
|
|
@@ -14622,6 +14488,169 @@ const MatchForm = ({
|
|
|
14622
14488
|
matchFormError && /* @__PURE__ */ jsx(ErrorText, { children: matchFormError })
|
|
14623
14489
|
] });
|
|
14624
14490
|
};
|
|
14491
|
+
var ToggleSize = /* @__PURE__ */ ((ToggleSize2) => {
|
|
14492
|
+
ToggleSize2["medium"] = "medium";
|
|
14493
|
+
ToggleSize2["small"] = "small";
|
|
14494
|
+
ToggleSize2["xsmall"] = "xsmall";
|
|
14495
|
+
return ToggleSize2;
|
|
14496
|
+
})(ToggleSize || {});
|
|
14497
|
+
const Toggle = ({
|
|
14498
|
+
name,
|
|
14499
|
+
options: options2,
|
|
14500
|
+
selected,
|
|
14501
|
+
onChange,
|
|
14502
|
+
size = "medium"
|
|
14503
|
+
/* medium */
|
|
14504
|
+
}) => {
|
|
14505
|
+
const [currentWidth, setCurrentWidth] = useState(0);
|
|
14506
|
+
const [thumbPos, setThumbPos] = useState({ left: 0, width: 0 });
|
|
14507
|
+
const [initialized, setInitialized] = useState(false);
|
|
14508
|
+
const activeOption = useMemo(() => {
|
|
14509
|
+
return selected ? selected : options2.length > 0 ? options2[0].value : void 0;
|
|
14510
|
+
}, [selected, options2]);
|
|
14511
|
+
const toggleRef = useElementSize((_a, _b, c) => {
|
|
14512
|
+
if (c.width && (c == null ? void 0 : c.width) !== currentWidth) {
|
|
14513
|
+
setCurrentWidth(c.width);
|
|
14514
|
+
}
|
|
14515
|
+
});
|
|
14516
|
+
const baseClassName2 = classNames(
|
|
14517
|
+
"Layer__toggle",
|
|
14518
|
+
`Layer__toggle--${size}`,
|
|
14519
|
+
initialized ? "Layer__toggle--initialized" : ""
|
|
14520
|
+
);
|
|
14521
|
+
const handleChange = (e) => {
|
|
14522
|
+
var _a;
|
|
14523
|
+
updateThumbPosition(Number((_a = e.target.getAttribute("data-idx")) != null ? _a : 0));
|
|
14524
|
+
onChange(e);
|
|
14525
|
+
};
|
|
14526
|
+
const updateThumbPosition = (active) => {
|
|
14527
|
+
if (!(toggleRef == null ? void 0 : toggleRef.current)) {
|
|
14528
|
+
return;
|
|
14529
|
+
}
|
|
14530
|
+
const optionsNodes = [...toggleRef.current.children].map((x) => {
|
|
14531
|
+
if (x.className.includes("Layer__tooltip-trigger") && x.children && x.children.length > 0) {
|
|
14532
|
+
return x.children[0];
|
|
14533
|
+
}
|
|
14534
|
+
return x;
|
|
14535
|
+
}).filter((c) => c.className.includes("Layer__toggle-option"));
|
|
14536
|
+
let shift2 = 0;
|
|
14537
|
+
let width = thumbPos.width;
|
|
14538
|
+
optionsNodes.forEach((c, i) => {
|
|
14539
|
+
if (i < active) {
|
|
14540
|
+
shift2 = shift2 + c.offsetWidth;
|
|
14541
|
+
} else if (i === active) {
|
|
14542
|
+
width = c.offsetWidth;
|
|
14543
|
+
}
|
|
14544
|
+
});
|
|
14545
|
+
shift2 = shift2 + (size === "medium" ? 2 : 1.5);
|
|
14546
|
+
setThumbPos({ left: shift2, width });
|
|
14547
|
+
};
|
|
14548
|
+
useEffect(() => {
|
|
14549
|
+
const selectedIndex = getSelectedIndex();
|
|
14550
|
+
updateThumbPosition(selectedIndex);
|
|
14551
|
+
setTimeout(() => {
|
|
14552
|
+
setInitialized(true);
|
|
14553
|
+
}, 400);
|
|
14554
|
+
}, []);
|
|
14555
|
+
useEffect(() => {
|
|
14556
|
+
const selectedIndex = getSelectedIndex();
|
|
14557
|
+
updateThumbPosition(selectedIndex);
|
|
14558
|
+
}, [currentWidth]);
|
|
14559
|
+
const getSelectedIndex = () => {
|
|
14560
|
+
const selectedIndex = options2.findIndex(
|
|
14561
|
+
(option) => option.value === activeOption
|
|
14562
|
+
);
|
|
14563
|
+
if (selectedIndex === -1) {
|
|
14564
|
+
return 0;
|
|
14565
|
+
}
|
|
14566
|
+
return selectedIndex;
|
|
14567
|
+
};
|
|
14568
|
+
return /* @__PURE__ */ jsxs("div", { className: baseClassName2, ref: toggleRef, children: [
|
|
14569
|
+
options2.map((option, index) => {
|
|
14570
|
+
var _a;
|
|
14571
|
+
return /* @__PURE__ */ createElement(
|
|
14572
|
+
ToggleOption,
|
|
14573
|
+
__spreadProps(__spreadValues({}, option), {
|
|
14574
|
+
size,
|
|
14575
|
+
key: option.value,
|
|
14576
|
+
name,
|
|
14577
|
+
checked: activeOption === option.value,
|
|
14578
|
+
onChange: handleChange,
|
|
14579
|
+
disabled: (_a = option.disabled) != null ? _a : false,
|
|
14580
|
+
disabledMessage: option.disabledMessage,
|
|
14581
|
+
index
|
|
14582
|
+
})
|
|
14583
|
+
);
|
|
14584
|
+
}),
|
|
14585
|
+
/* @__PURE__ */ jsx("span", { className: "Layer__toggle__thumb", style: __spreadValues({}, thumbPos) })
|
|
14586
|
+
] });
|
|
14587
|
+
};
|
|
14588
|
+
const ToggleOption = ({
|
|
14589
|
+
checked,
|
|
14590
|
+
label,
|
|
14591
|
+
name,
|
|
14592
|
+
onChange,
|
|
14593
|
+
value,
|
|
14594
|
+
size: _size,
|
|
14595
|
+
leftIcon,
|
|
14596
|
+
disabled,
|
|
14597
|
+
disabledMessage = "Disabled",
|
|
14598
|
+
style,
|
|
14599
|
+
index
|
|
14600
|
+
}) => {
|
|
14601
|
+
const optionClassName = classNames("Layer__toggle-option", {
|
|
14602
|
+
"Layer__toggle-option--active": checked
|
|
14603
|
+
});
|
|
14604
|
+
if (disabled) {
|
|
14605
|
+
return /* @__PURE__ */ jsxs(DeprecatedTooltip, { children: [
|
|
14606
|
+
/* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxs(
|
|
14607
|
+
"label",
|
|
14608
|
+
{
|
|
14609
|
+
className: optionClassName,
|
|
14610
|
+
"data-checked": checked,
|
|
14611
|
+
style,
|
|
14612
|
+
children: [
|
|
14613
|
+
/* @__PURE__ */ jsx(
|
|
14614
|
+
"input",
|
|
14615
|
+
{
|
|
14616
|
+
type: "radio",
|
|
14617
|
+
checked,
|
|
14618
|
+
name,
|
|
14619
|
+
onChange,
|
|
14620
|
+
value,
|
|
14621
|
+
disabled,
|
|
14622
|
+
"data-idx": index
|
|
14623
|
+
}
|
|
14624
|
+
),
|
|
14625
|
+
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
14626
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
14627
|
+
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
14628
|
+
] })
|
|
14629
|
+
]
|
|
14630
|
+
}
|
|
14631
|
+
) }),
|
|
14632
|
+
/* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
|
|
14633
|
+
] });
|
|
14634
|
+
}
|
|
14635
|
+
return /* @__PURE__ */ jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
|
|
14636
|
+
/* @__PURE__ */ jsx(
|
|
14637
|
+
"input",
|
|
14638
|
+
{
|
|
14639
|
+
type: "radio",
|
|
14640
|
+
checked,
|
|
14641
|
+
name,
|
|
14642
|
+
onChange,
|
|
14643
|
+
value,
|
|
14644
|
+
disabled,
|
|
14645
|
+
"data-idx": index
|
|
14646
|
+
}
|
|
14647
|
+
),
|
|
14648
|
+
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
14649
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
14650
|
+
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
14651
|
+
] })
|
|
14652
|
+
] });
|
|
14653
|
+
};
|
|
14625
14654
|
const GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
|
|
14626
14655
|
function buildKey$I({
|
|
14627
14656
|
access_token: accessToken,
|
|
@@ -17806,37 +17835,6 @@ const BankTransactionsMobileForms = ({
|
|
|
17806
17835
|
};
|
|
17807
17836
|
return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: getContent() });
|
|
17808
17837
|
};
|
|
17809
|
-
const NewToggleOption = ({
|
|
17810
|
-
label,
|
|
17811
|
-
value
|
|
17812
|
-
}) => {
|
|
17813
|
-
return /* @__PURE__ */ jsxs(ToggleButton, { id: value, className: "Layer__NewToggleOption", children: [
|
|
17814
|
-
/* @__PURE__ */ jsx(SelectionIndicator, { className: "Layer__NewToggleOption-SelectionIndicator" }),
|
|
17815
|
-
/* @__PURE__ */ jsx(Span, { className: "Layer__NewToggle-Option-Content", children: /* @__PURE__ */ jsx(Span, { noWrap: true, children: label }) })
|
|
17816
|
-
] });
|
|
17817
|
-
};
|
|
17818
|
-
const NewToggle = ({
|
|
17819
|
-
options: options2,
|
|
17820
|
-
selectedKey,
|
|
17821
|
-
onSelectionChange
|
|
17822
|
-
}) => {
|
|
17823
|
-
const selectedKeys = selectedKey !== void 0 ? /* @__PURE__ */ new Set([selectedKey]) : /* @__PURE__ */ new Set();
|
|
17824
|
-
return /* @__PURE__ */ jsx(
|
|
17825
|
-
ToggleButtonGroup,
|
|
17826
|
-
{
|
|
17827
|
-
className: "Layer__NewToggle",
|
|
17828
|
-
selectionMode: "single",
|
|
17829
|
-
selectedKeys,
|
|
17830
|
-
onSelectionChange: (keys) => {
|
|
17831
|
-
const selectedKeysArray = Array.from(keys);
|
|
17832
|
-
if (selectedKeysArray.length > 0 && onSelectionChange) {
|
|
17833
|
-
onSelectionChange(selectedKeysArray[0]);
|
|
17834
|
-
}
|
|
17835
|
-
},
|
|
17836
|
-
children: options2.map((option) => /* @__PURE__ */ jsx(NewToggleOption, __spreadValues({}, option), option.value))
|
|
17837
|
-
}
|
|
17838
|
-
);
|
|
17839
|
-
};
|
|
17840
17838
|
const PURPOSE_TOGGLE_OPTIONS = [
|
|
17841
17839
|
{
|
|
17842
17840
|
value: "business",
|
package/dist/index.css
CHANGED
|
@@ -8374,6 +8374,63 @@ header.Layer__profit-and-loss-detailed-charts__header--tablet {
|
|
|
8374
8374
|
|
|
8375
8375
|
.Layer__MonthPicker__InputGroup {
|
|
8376
8376
|
inline-size: 12rem;
|
|
8377
|
+
}.Layer__NewToggle {
|
|
8378
|
+
box-sizing: border-box;
|
|
8379
|
+
position: relative;
|
|
8380
|
+
display: flex;
|
|
8381
|
+
align-items: center;
|
|
8382
|
+
height: 36px;
|
|
8383
|
+
width: max-content;
|
|
8384
|
+
padding: 2px;
|
|
8385
|
+
border-radius: 6px;
|
|
8386
|
+
box-shadow: 0 0 0 1px var(--color-base-300);
|
|
8387
|
+
background: var(--color-base-100);
|
|
8388
|
+
cursor: pointer;
|
|
8389
|
+
user-select: none;
|
|
8390
|
+
isolation: isolate;
|
|
8391
|
+
-webkit-tap-highlight-color: transparent;
|
|
8392
|
+
-webkit-touch-callout: none;
|
|
8393
|
+
}.Layer__NewToggleOption {
|
|
8394
|
+
box-sizing: border-box;
|
|
8395
|
+
position: relative;
|
|
8396
|
+
display: flex;
|
|
8397
|
+
align-items: center;
|
|
8398
|
+
justify-content: center;
|
|
8399
|
+
height: 32px;
|
|
8400
|
+
padding: 8px 16px;
|
|
8401
|
+
border-radius: 6px;
|
|
8402
|
+
border: none;
|
|
8403
|
+
background: transparent;
|
|
8404
|
+
color: var(--text-color-secondary);
|
|
8405
|
+
}
|
|
8406
|
+
.Layer__NewToggleOption::before {
|
|
8407
|
+
position: absolute;
|
|
8408
|
+
z-index: -2;
|
|
8409
|
+
inset: 0;
|
|
8410
|
+
border-radius: 6px;
|
|
8411
|
+
background: transparent;
|
|
8412
|
+
content: "";
|
|
8413
|
+
transition: background-color 150ms;
|
|
8414
|
+
}
|
|
8415
|
+
.Layer__NewToggleOption[data-hovered]:not([data-disabled], [data-selected]) {
|
|
8416
|
+
color: var(--text-color-primary);
|
|
8417
|
+
}
|
|
8418
|
+
.Layer__NewToggleOption[data-hovered]:not([data-disabled], [data-selected])::before {
|
|
8419
|
+
background-color: var(--color-base-200);
|
|
8420
|
+
}
|
|
8421
|
+
|
|
8422
|
+
.Layer__NewToggleOption-SelectionIndicator {
|
|
8423
|
+
position: absolute;
|
|
8424
|
+
z-index: -1;
|
|
8425
|
+
top: 0;
|
|
8426
|
+
left: 0;
|
|
8427
|
+
height: 100%;
|
|
8428
|
+
width: 100%;
|
|
8429
|
+
border-radius: 6px;
|
|
8430
|
+
box-shadow: 0 0 0 1px var(--color-base-300), 0 1px 1px 0 rgba(0, 0, 0, 0.04), 0 2px 3px 0 rgba(0, 0, 0, 0.04), 0 3px 4px 0 rgba(0, 0, 0, 0.02), 0 4px 5px 0 rgba(0, 0, 0, 0.01);
|
|
8431
|
+
background: var(--color-white);
|
|
8432
|
+
transition-property: translate, width;
|
|
8433
|
+
transition-duration: 200ms;
|
|
8377
8434
|
}.Layer__InvisibleDownload {
|
|
8378
8435
|
display: none;
|
|
8379
8436
|
}.Layer__UI__Table-Table {
|
|
@@ -8745,63 +8802,6 @@ header.Layer__profit-and-loss-detailed-charts__header--tablet {
|
|
|
8745
8802
|
padding-inline-end: var(--spacing-md);
|
|
8746
8803
|
}.Layer__BankTransactionsMobileSplitForm__AmountInput {
|
|
8747
8804
|
inline-size: 6rem;
|
|
8748
|
-
}.Layer__NewToggle {
|
|
8749
|
-
box-sizing: border-box;
|
|
8750
|
-
position: relative;
|
|
8751
|
-
display: flex;
|
|
8752
|
-
align-items: center;
|
|
8753
|
-
height: 36px;
|
|
8754
|
-
width: max-content;
|
|
8755
|
-
padding: 2px;
|
|
8756
|
-
border-radius: 6px;
|
|
8757
|
-
box-shadow: 0 0 0 1px var(--color-base-300);
|
|
8758
|
-
background: var(--color-base-100);
|
|
8759
|
-
cursor: pointer;
|
|
8760
|
-
user-select: none;
|
|
8761
|
-
isolation: isolate;
|
|
8762
|
-
-webkit-tap-highlight-color: transparent;
|
|
8763
|
-
-webkit-touch-callout: none;
|
|
8764
|
-
}.Layer__NewToggleOption {
|
|
8765
|
-
box-sizing: border-box;
|
|
8766
|
-
position: relative;
|
|
8767
|
-
display: flex;
|
|
8768
|
-
align-items: center;
|
|
8769
|
-
justify-content: center;
|
|
8770
|
-
height: 32px;
|
|
8771
|
-
padding: 8px 16px;
|
|
8772
|
-
border-radius: 6px;
|
|
8773
|
-
border: none;
|
|
8774
|
-
background: transparent;
|
|
8775
|
-
color: var(--text-color-secondary);
|
|
8776
|
-
}
|
|
8777
|
-
.Layer__NewToggleOption::before {
|
|
8778
|
-
position: absolute;
|
|
8779
|
-
z-index: -2;
|
|
8780
|
-
inset: 0;
|
|
8781
|
-
border-radius: 6px;
|
|
8782
|
-
background: transparent;
|
|
8783
|
-
content: "";
|
|
8784
|
-
transition: background-color 150ms;
|
|
8785
|
-
}
|
|
8786
|
-
.Layer__NewToggleOption[data-hovered]:not([data-disabled], [data-selected]) {
|
|
8787
|
-
color: var(--text-color-primary);
|
|
8788
|
-
}
|
|
8789
|
-
.Layer__NewToggleOption[data-hovered]:not([data-disabled], [data-selected])::before {
|
|
8790
|
-
background-color: var(--color-base-200);
|
|
8791
|
-
}
|
|
8792
|
-
|
|
8793
|
-
.Layer__NewToggleOption-SelectionIndicator {
|
|
8794
|
-
position: absolute;
|
|
8795
|
-
z-index: -1;
|
|
8796
|
-
top: 0;
|
|
8797
|
-
left: 0;
|
|
8798
|
-
height: 100%;
|
|
8799
|
-
width: 100%;
|
|
8800
|
-
border-radius: 6px;
|
|
8801
|
-
box-shadow: 0 0 0 1px var(--color-base-300), 0 1px 1px 0 rgba(0, 0, 0, 0.04), 0 2px 3px 0 rgba(0, 0, 0, 0.04), 0 3px 4px 0 rgba(0, 0, 0, 0.02), 0 4px 5px 0 rgba(0, 0, 0, 0.01);
|
|
8802
|
-
background: var(--color-white);
|
|
8803
|
-
transition-property: translate, width;
|
|
8804
|
-
transition-duration: 200ms;
|
|
8805
8805
|
}.Layer__BankTransactionsMobileListItem__CategorizedValue {
|
|
8806
8806
|
color: var(--color-base-500);
|
|
8807
8807
|
}
|