@layerfi/components 0.1.106-alpha.1 → 0.1.106
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 +237 -186
- package/dist/esm/index.mjs +186 -135
- package/dist/index.css +54 -39
- package/dist/index.d.ts +85 -26
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -5603,7 +5603,7 @@ var import_react12 = require("react");
|
|
|
5603
5603
|
var import_react10 = require("react");
|
|
5604
5604
|
|
|
5605
5605
|
// package.json
|
|
5606
|
-
var version = "0.1.106
|
|
5606
|
+
var version = "0.1.106";
|
|
5607
5607
|
|
|
5608
5608
|
// src/models/APIError.ts
|
|
5609
5609
|
var APIError = class _APIError extends Error {
|
|
@@ -7123,7 +7123,7 @@ function clampToPresentOrPast(date, cutoff = (0, import_date_fns3.endOfDay)(/* @
|
|
|
7123
7123
|
}
|
|
7124
7124
|
var RANGE_MODE_LOOKUP = {
|
|
7125
7125
|
dayPicker: {
|
|
7126
|
-
getStart: ({ start }) => start,
|
|
7126
|
+
getStart: ({ start }) => (0, import_date_fns3.startOfMonth)(start),
|
|
7127
7127
|
getEnd: ({ end }) => clampToPresentOrPast((0, import_date_fns3.endOfDay)(end))
|
|
7128
7128
|
},
|
|
7129
7129
|
dayRangePicker: {
|
|
@@ -37171,10 +37171,10 @@ var Components = ({
|
|
|
37171
37171
|
};
|
|
37172
37172
|
|
|
37173
37173
|
// src/components/Invoices/Invoices.tsx
|
|
37174
|
-
var
|
|
37174
|
+
var import_react238 = require("react");
|
|
37175
37175
|
|
|
37176
37176
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
37177
|
-
var
|
|
37177
|
+
var import_react232 = require("react");
|
|
37178
37178
|
|
|
37179
37179
|
// src/components/BaseDetailView/BaseDetailView.tsx
|
|
37180
37180
|
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
@@ -37190,7 +37190,7 @@ var BaseDetailView = ({ name, onGoBack, slots, children }) => {
|
|
|
37190
37190
|
};
|
|
37191
37191
|
|
|
37192
37192
|
// src/components/Invoices/InvoiceForm/useInvoiceForm.ts
|
|
37193
|
-
var
|
|
37193
|
+
var import_react230 = require("react");
|
|
37194
37194
|
var import_react_form7 = require("@tanstack/react-form");
|
|
37195
37195
|
|
|
37196
37196
|
// src/features/forms/hooks/useForm.tsx
|
|
@@ -37328,11 +37328,14 @@ function formatBigDecimalToString(value, maxDecimalPlaces = 10) {
|
|
|
37328
37328
|
// src/features/forms/components/FormBigDecimalField.tsx
|
|
37329
37329
|
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
37330
37330
|
var DEFAULT_MAX_INPUT_LENGTH = 10;
|
|
37331
|
-
function FormBigDecimalField({
|
|
37332
|
-
|
|
37333
|
-
|
|
37334
|
-
|
|
37335
|
-
}
|
|
37331
|
+
function FormBigDecimalField(_a) {
|
|
37332
|
+
var _b = _a, {
|
|
37333
|
+
maxInputLength = DEFAULT_MAX_INPUT_LENGTH,
|
|
37334
|
+
allowNegative = false
|
|
37335
|
+
} = _b, restProps = __objRest(_b, [
|
|
37336
|
+
"maxInputLength",
|
|
37337
|
+
"allowNegative"
|
|
37338
|
+
]);
|
|
37336
37339
|
const field = useFieldContext();
|
|
37337
37340
|
const { name, state, handleChange, handleBlur } = field;
|
|
37338
37341
|
const { value } = state;
|
|
@@ -37370,7 +37373,7 @@ function FormBigDecimalField({
|
|
|
37370
37373
|
(0, import_react223.useEffect)(() => {
|
|
37371
37374
|
setInputValue(formatBigDecimalToString(value, maxInputLength));
|
|
37372
37375
|
}, [value, maxInputLength]);
|
|
37373
|
-
return /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(BaseFormTextField, __spreadProps(__spreadValues({},
|
|
37376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(BaseFormTextField, __spreadProps(__spreadValues({}, restProps), { inputMode: "decimal", children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(InputGroup2, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
37374
37377
|
Input2,
|
|
37375
37378
|
{
|
|
37376
37379
|
inset: true,
|
|
@@ -37386,23 +37389,67 @@ function FormBigDecimalField({
|
|
|
37386
37389
|
) }) }));
|
|
37387
37390
|
}
|
|
37388
37391
|
|
|
37389
|
-
// src/features/forms/components/
|
|
37392
|
+
// src/features/forms/components/FormCheckboxField.tsx
|
|
37390
37393
|
var import_react224 = require("react");
|
|
37394
|
+
var import_classnames89 = __toESM(require("classnames"));
|
|
37395
|
+
var import_jsx_runtime333 = require("react/jsx-runtime");
|
|
37396
|
+
var FORM_CHECKBOX_FIELD_CLASSNAME = "Layer__FormCheckboxField";
|
|
37397
|
+
function FormCheckboxField({
|
|
37398
|
+
label,
|
|
37399
|
+
className,
|
|
37400
|
+
inline = false,
|
|
37401
|
+
showLabel = true,
|
|
37402
|
+
showErrorInTooltip = true
|
|
37403
|
+
}) {
|
|
37404
|
+
const field = useFieldContext();
|
|
37405
|
+
const { name, state, handleChange, handleBlur } = field;
|
|
37406
|
+
const { meta, value } = state;
|
|
37407
|
+
const { errors, isValid: isValid2 } = meta;
|
|
37408
|
+
const errorMessage = errors.length !== 0 ? errors[0] : void 0;
|
|
37409
|
+
const tooltipProps = showErrorInTooltip ? { tooltip: errorMessage } : {};
|
|
37410
|
+
const additionalAriaProps = !showLabel && { "aria-label": label };
|
|
37411
|
+
const checkboxClassNames = (0, import_classnames89.default)(
|
|
37412
|
+
FORM_CHECKBOX_FIELD_CLASSNAME,
|
|
37413
|
+
inline && `${FORM_CHECKBOX_FIELD_CLASSNAME}--inline`,
|
|
37414
|
+
className
|
|
37415
|
+
);
|
|
37416
|
+
const onChange = (0, import_react224.useCallback)((isSelected) => {
|
|
37417
|
+
handleChange(isSelected);
|
|
37418
|
+
}, [handleChange]);
|
|
37419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(
|
|
37420
|
+
CheckboxWithTooltip,
|
|
37421
|
+
__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
37422
|
+
className: checkboxClassNames,
|
|
37423
|
+
isSelected: value,
|
|
37424
|
+
isInvalid: !isValid2,
|
|
37425
|
+
onChange,
|
|
37426
|
+
onBlur: handleBlur,
|
|
37427
|
+
name,
|
|
37428
|
+
value: name,
|
|
37429
|
+
size: "lg"
|
|
37430
|
+
}, tooltipProps), additionalAriaProps), !isValid2 && { variant: "error" }), {
|
|
37431
|
+
children: showLabel && /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(Label, { slot: "label", size: "sm", htmlFor: name, children: label })
|
|
37432
|
+
})
|
|
37433
|
+
);
|
|
37434
|
+
}
|
|
37435
|
+
|
|
37436
|
+
// src/features/forms/components/FormCurrencyField.tsx
|
|
37437
|
+
var import_react225 = require("react");
|
|
37391
37438
|
var import_react_currency_input_field2 = __toESM(require("react-currency-input-field"));
|
|
37392
37439
|
var import_effect11 = require("effect");
|
|
37393
|
-
var
|
|
37440
|
+
var import_jsx_runtime334 = require("react/jsx-runtime");
|
|
37394
37441
|
var ZERO_CENTS_INPUT_VALUE = "0.00";
|
|
37395
37442
|
var getCurrencyInputValueFromCents = (cents) => !Number.isNaN(cents) ? centsToDollarsWithoutCommas(cents) : ZERO_CENTS_INPUT_VALUE;
|
|
37396
|
-
function FormCurrencyField(
|
|
37443
|
+
function FormCurrencyField(props) {
|
|
37397
37444
|
const field = useFieldContext();
|
|
37398
|
-
const label =
|
|
37445
|
+
const { label } = props;
|
|
37399
37446
|
const { name, state, handleChange, handleBlur } = field;
|
|
37400
37447
|
const { value } = state;
|
|
37401
|
-
const [inputValue, setInputValue] = (0,
|
|
37402
|
-
const onInputChange = (0,
|
|
37448
|
+
const [inputValue, setInputValue] = (0, import_react225.useState)(getCurrencyInputValueFromCents(value));
|
|
37449
|
+
const onInputChange = (0, import_react225.useCallback)((newValue) => {
|
|
37403
37450
|
setInputValue(newValue != null ? newValue : ZERO_CENTS_INPUT_VALUE);
|
|
37404
37451
|
}, []);
|
|
37405
|
-
const onInputBlur = (0,
|
|
37452
|
+
const onInputBlur = (0, import_react225.useCallback)(() => {
|
|
37406
37453
|
const maybeAmount = import_effect11.BigDecimal.fromString(inputValue);
|
|
37407
37454
|
const cents = import_effect11.Option.match(maybeAmount, {
|
|
37408
37455
|
onNone: () => 0,
|
|
@@ -37412,10 +37459,10 @@ function FormCurrencyField({ slotProps }) {
|
|
|
37412
37459
|
handleBlur();
|
|
37413
37460
|
setInputValue(getCurrencyInputValueFromCents(cents));
|
|
37414
37461
|
}, [inputValue, handleChange, handleBlur]);
|
|
37415
|
-
(0,
|
|
37462
|
+
(0, import_react225.useEffect)(() => {
|
|
37416
37463
|
setInputValue(getCurrencyInputValueFromCents(value));
|
|
37417
37464
|
}, [value]);
|
|
37418
|
-
return /* @__PURE__ */ (0,
|
|
37465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(BaseFormTextField, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(InputGroup2, { children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
37419
37466
|
import_react_currency_input_field2.default,
|
|
37420
37467
|
{
|
|
37421
37468
|
name,
|
|
@@ -37438,18 +37485,18 @@ function FormCurrencyField({ slotProps }) {
|
|
|
37438
37485
|
}
|
|
37439
37486
|
|
|
37440
37487
|
// src/features/forms/components/FormTextAreaField.tsx
|
|
37441
|
-
var
|
|
37488
|
+
var import_react227 = require("react");
|
|
37442
37489
|
|
|
37443
37490
|
// src/components/ui/Input/TextArea.tsx
|
|
37444
|
-
var
|
|
37491
|
+
var import_react226 = require("react");
|
|
37445
37492
|
var import_react_aria_components17 = require("react-aria-components");
|
|
37446
|
-
var
|
|
37493
|
+
var import_jsx_runtime335 = require("react/jsx-runtime");
|
|
37447
37494
|
var TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
|
|
37448
|
-
var TextArea = (0,
|
|
37495
|
+
var TextArea = (0, import_react226.forwardRef)(
|
|
37449
37496
|
function TextArea2(_a, ref) {
|
|
37450
37497
|
var _b = _a, { resize = "none" } = _b, restProps = __objRest(_b, ["resize"]);
|
|
37451
37498
|
const dataProperties = toDataProperties({ resize });
|
|
37452
|
-
return /* @__PURE__ */ (0,
|
|
37499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
|
|
37453
37500
|
import_react_aria_components17.TextArea,
|
|
37454
37501
|
__spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), {
|
|
37455
37502
|
className: TEXTAREA_CLASS_NAME,
|
|
@@ -37460,28 +37507,28 @@ var TextArea = (0, import_react225.forwardRef)(
|
|
|
37460
37507
|
);
|
|
37461
37508
|
|
|
37462
37509
|
// src/features/forms/components/FormTextAreaField.tsx
|
|
37463
|
-
var
|
|
37464
|
-
function FormTextAreaField(
|
|
37510
|
+
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
37511
|
+
function FormTextAreaField(props) {
|
|
37465
37512
|
const field = useFieldContext();
|
|
37466
37513
|
const { name, state, handleChange, handleBlur } = field;
|
|
37467
37514
|
const { value } = state;
|
|
37468
|
-
const onChange = (0,
|
|
37515
|
+
const onChange = (0, import_react227.useCallback)((e) => {
|
|
37469
37516
|
handleChange(e.target.value);
|
|
37470
37517
|
}, [handleChange]);
|
|
37471
|
-
return /* @__PURE__ */ (0,
|
|
37518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(BaseFormTextField, __spreadProps(__spreadValues({}, props), { isTextArea: true, children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(TextArea, { id: name, name, value, onChange, onBlur: handleBlur }) }));
|
|
37472
37519
|
}
|
|
37473
37520
|
|
|
37474
37521
|
// src/features/forms/components/FormTextField.tsx
|
|
37475
|
-
var
|
|
37476
|
-
var
|
|
37477
|
-
function FormTextField(
|
|
37522
|
+
var import_react228 = require("react");
|
|
37523
|
+
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
37524
|
+
function FormTextField(props) {
|
|
37478
37525
|
const field = useFieldContext();
|
|
37479
37526
|
const { name, state, handleChange, handleBlur } = field;
|
|
37480
37527
|
const { value } = state;
|
|
37481
|
-
const onChange = (0,
|
|
37528
|
+
const onChange = (0, import_react228.useCallback)((e) => {
|
|
37482
37529
|
handleChange(e.target.value);
|
|
37483
37530
|
}, [handleChange]);
|
|
37484
|
-
return /* @__PURE__ */ (0,
|
|
37531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(BaseFormTextField, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(InputGroup2, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Input2, { inset: true, id: name, name, value, onChange, onBlur: handleBlur }) }) }));
|
|
37485
37532
|
}
|
|
37486
37533
|
|
|
37487
37534
|
// src/features/forms/hooks/useForm.tsx
|
|
@@ -37490,6 +37537,7 @@ var { useAppForm, withForm } = (0, import_react_form6.createFormHook)({
|
|
|
37490
37537
|
fieldComponents: {
|
|
37491
37538
|
BaseFormTextField,
|
|
37492
37539
|
FormBigDecimalField,
|
|
37540
|
+
FormCheckboxField,
|
|
37493
37541
|
FormCurrencyField,
|
|
37494
37542
|
FormTextAreaField,
|
|
37495
37543
|
FormTextField
|
|
@@ -37670,7 +37718,7 @@ var UpsertInvoiceSchema = import_effect12.Schema.Struct({
|
|
|
37670
37718
|
});
|
|
37671
37719
|
|
|
37672
37720
|
// src/features/invoices/api/useUpsertInvoice.tsx
|
|
37673
|
-
var
|
|
37721
|
+
var import_react229 = require("react");
|
|
37674
37722
|
var import_mutation26 = __toESM(require("swr/mutation"));
|
|
37675
37723
|
var import_effect13 = require("effect");
|
|
37676
37724
|
var UPSERT_INVOICES_TAG_KEY = "#upsert-invoice";
|
|
@@ -37766,7 +37814,7 @@ var useUpsertInvoice = (props) => {
|
|
|
37766
37814
|
);
|
|
37767
37815
|
const mutationResponse = new UpsertInvoiceSWRResponse(rawMutationResponse);
|
|
37768
37816
|
const originalTrigger = mutationResponse.trigger;
|
|
37769
|
-
const stableProxiedTrigger = (0,
|
|
37817
|
+
const stableProxiedTrigger = (0, import_react229.useCallback)(
|
|
37770
37818
|
(...triggerParameters) => __async(null, null, function* () {
|
|
37771
37819
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
37772
37820
|
return triggerResult;
|
|
@@ -37790,7 +37838,8 @@ var EMPTY_LINE_ITEM = {
|
|
|
37790
37838
|
description: "",
|
|
37791
37839
|
unitPrice: 0,
|
|
37792
37840
|
quantity: BIG_DECIMAL_ONE,
|
|
37793
|
-
amount: 0
|
|
37841
|
+
amount: 0,
|
|
37842
|
+
isTaxable: false
|
|
37794
37843
|
};
|
|
37795
37844
|
var DEFAULT_FORM_VALUES = {
|
|
37796
37845
|
invoiceNumber: "",
|
|
@@ -37805,7 +37854,8 @@ var getInvoiceLineItemAmount = (lineItem) => {
|
|
|
37805
37854
|
};
|
|
37806
37855
|
var getAugmentedInvoiceFormLineItem = (lineItem) => {
|
|
37807
37856
|
return __spreadProps(__spreadValues({}, lineItem), {
|
|
37808
|
-
amount: getInvoiceLineItemAmount(lineItem)
|
|
37857
|
+
amount: getInvoiceLineItemAmount(lineItem),
|
|
37858
|
+
isTaxable: lineItem.salesTaxTotal > 0
|
|
37809
37859
|
});
|
|
37810
37860
|
};
|
|
37811
37861
|
var getInvoiceFormDefaultValues = (invoice) => {
|
|
@@ -37819,7 +37869,7 @@ var getInvoiceFormDefaultValues = (invoice) => {
|
|
|
37819
37869
|
};
|
|
37820
37870
|
};
|
|
37821
37871
|
var useInvoiceForm = (props) => {
|
|
37822
|
-
const [submitError, setSubmitError] = (0,
|
|
37872
|
+
const [submitError, setSubmitError] = (0, import_react230.useState)(void 0);
|
|
37823
37873
|
const { onSuccess, mode } = props;
|
|
37824
37874
|
const upsertInvoiceProps = mode === "Update" /* Update */ ? { mode, invoiceId: props.invoice.id } : { mode };
|
|
37825
37875
|
const { trigger: upsertInvoice } = useUpsertInvoice(upsertInvoiceProps);
|
|
@@ -37850,9 +37900,9 @@ var import_lucide_react16 = require("lucide-react");
|
|
|
37850
37900
|
var import_effect15 = require("effect");
|
|
37851
37901
|
|
|
37852
37902
|
// src/features/customers/components/CustomerSelector.tsx
|
|
37853
|
-
var
|
|
37854
|
-
var
|
|
37855
|
-
var
|
|
37903
|
+
var import_react231 = require("react");
|
|
37904
|
+
var import_classnames90 = __toESM(require("classnames"));
|
|
37905
|
+
var import_jsx_runtime338 = require("react/jsx-runtime");
|
|
37856
37906
|
function getCustomerName(customer) {
|
|
37857
37907
|
var _a, _b, _c;
|
|
37858
37908
|
return (_c = (_b = (_a = customer.individualName) != null ? _a : customer.companyName) != null ? _b : customer.externalId) != null ? _c : "Unknown Customer";
|
|
@@ -37883,7 +37933,7 @@ function CustomerSelector({
|
|
|
37883
37933
|
inline,
|
|
37884
37934
|
className
|
|
37885
37935
|
}) {
|
|
37886
|
-
const combinedClassName = (0,
|
|
37936
|
+
const combinedClassName = (0, import_classnames90.default)(
|
|
37887
37937
|
"Layer__CustomerSelector",
|
|
37888
37938
|
inline && "Layer__CustomerSelector--inline",
|
|
37889
37939
|
className
|
|
@@ -37893,12 +37943,12 @@ function CustomerSelector({
|
|
|
37893
37943
|
});
|
|
37894
37944
|
const effectiveSearchQuery = searchQuery === "" ? void 0 : searchQuery;
|
|
37895
37945
|
const { data, isLoading, isError } = useListCustomers({ query: effectiveSearchQuery });
|
|
37896
|
-
const options = (0,
|
|
37946
|
+
const options = (0, import_react231.useMemo)(
|
|
37897
37947
|
() => (data == null ? void 0 : data.flatMap(({ data: data2 }) => data2).map((customer) => new CustomerAsOption(customer))) || [],
|
|
37898
37948
|
[data]
|
|
37899
37949
|
);
|
|
37900
37950
|
const selectedCustomerId = selectedCustomer == null ? void 0 : selectedCustomer.id;
|
|
37901
|
-
const handleSelectionChange = (0,
|
|
37951
|
+
const handleSelectionChange = (0, import_react231.useCallback)(
|
|
37902
37952
|
(selectedOption) => {
|
|
37903
37953
|
if (selectedOption === null) {
|
|
37904
37954
|
handleInputChange("");
|
|
@@ -37919,7 +37969,7 @@ function CustomerSelector({
|
|
|
37919
37969
|
},
|
|
37920
37970
|
[options, handleInputChange, selectedCustomerId, onSelectedCustomerChange]
|
|
37921
37971
|
);
|
|
37922
|
-
const selectedCustomerForComboBox = (0,
|
|
37972
|
+
const selectedCustomerForComboBox = (0, import_react231.useMemo)(
|
|
37923
37973
|
() => {
|
|
37924
37974
|
if (selectedCustomer === null) {
|
|
37925
37975
|
return null;
|
|
@@ -37931,12 +37981,12 @@ function CustomerSelector({
|
|
|
37931
37981
|
},
|
|
37932
37982
|
[selectedCustomer]
|
|
37933
37983
|
);
|
|
37934
|
-
const EmptyMessage = (0,
|
|
37935
|
-
() => /* @__PURE__ */ (0,
|
|
37984
|
+
const EmptyMessage = (0, import_react231.useMemo)(
|
|
37985
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(P, { variant: "subtle", children: "No matching customer" }),
|
|
37936
37986
|
[]
|
|
37937
37987
|
);
|
|
37938
|
-
const ErrorMessage = (0,
|
|
37939
|
-
() => /* @__PURE__ */ (0,
|
|
37988
|
+
const ErrorMessage = (0, import_react231.useMemo)(
|
|
37989
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
37940
37990
|
P,
|
|
37941
37991
|
{
|
|
37942
37992
|
size: "xs",
|
|
@@ -37946,7 +37996,7 @@ function CustomerSelector({
|
|
|
37946
37996
|
),
|
|
37947
37997
|
[]
|
|
37948
37998
|
);
|
|
37949
|
-
const inputId = (0,
|
|
37999
|
+
const inputId = (0, import_react231.useId)();
|
|
37950
38000
|
const isFiltered = effectiveSearchQuery !== void 0;
|
|
37951
38001
|
const noCustomersExist = !isLoading && !isFiltered && data !== void 0 && data.every(({ data: data2 }) => data2.length === 0);
|
|
37952
38002
|
const shouldHideComponent = noCustomersExist || isReadOnly && selectedCustomer === null;
|
|
@@ -37955,9 +38005,9 @@ function CustomerSelector({
|
|
|
37955
38005
|
}
|
|
37956
38006
|
const isLoadingWithoutFallback = isLoading && !data;
|
|
37957
38007
|
const shouldDisableComboBox = isLoadingWithoutFallback || isError;
|
|
37958
|
-
return /* @__PURE__ */ (0,
|
|
37959
|
-
/* @__PURE__ */ (0,
|
|
37960
|
-
/* @__PURE__ */ (0,
|
|
38008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)(VStack, { className: combinedClassName, children: [
|
|
38009
|
+
/* @__PURE__ */ (0, import_jsx_runtime338.jsx)(Label, { htmlFor: inputId, size: "sm", children: "Customer" }),
|
|
38010
|
+
/* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
37961
38011
|
ComboBox,
|
|
37962
38012
|
{
|
|
37963
38013
|
selectedValue: selectedCustomerForComboBox,
|
|
@@ -37976,7 +38026,7 @@ function CustomerSelector({
|
|
|
37976
38026
|
}
|
|
37977
38027
|
|
|
37978
38028
|
// src/components/Invoices/InvoiceForm/InvoiceForm.tsx
|
|
37979
|
-
var
|
|
38029
|
+
var import_jsx_runtime339 = require("react/jsx-runtime");
|
|
37980
38030
|
var INVOICE_FORM_CSS_PREFIX = "Layer__InvoiceForm";
|
|
37981
38031
|
var INVOICE_FORM_FIELD_CSS_PREFIX = `${INVOICE_FORM_CSS_PREFIX}__Field`;
|
|
37982
38032
|
var InvoiceForm = (props) => {
|
|
@@ -37984,9 +38034,9 @@ var InvoiceForm = (props) => {
|
|
|
37984
38034
|
const { form } = useInvoiceForm(
|
|
37985
38035
|
__spreadValues({ onSuccess }, mode === "Update" /* Update */ ? { mode, invoice: props.invoice } : { mode })
|
|
37986
38036
|
);
|
|
37987
|
-
return /* @__PURE__ */ (0,
|
|
37988
|
-
/* @__PURE__ */ (0,
|
|
37989
|
-
/* @__PURE__ */ (0,
|
|
38037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime339.jsxs)(Form, { className: INVOICE_FORM_CSS_PREFIX, children: [
|
|
38038
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsxs)(VStack, { className: `${INVOICE_FORM_CSS_PREFIX}__Metadata`, gap: "xs", children: [
|
|
38039
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
37990
38040
|
form.Field,
|
|
37991
38041
|
{
|
|
37992
38042
|
name: "customer",
|
|
@@ -37996,7 +38046,7 @@ var InvoiceForm = (props) => {
|
|
|
37996
38046
|
form.setFieldValue("address", customer == null ? void 0 : customer.addressString);
|
|
37997
38047
|
}
|
|
37998
38048
|
},
|
|
37999
|
-
children: (field) => /* @__PURE__ */ (0,
|
|
38049
|
+
children: (field) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
38000
38050
|
CustomerSelector,
|
|
38001
38051
|
{
|
|
38002
38052
|
className: `${INVOICE_FORM_FIELD_CSS_PREFIX}__Customer`,
|
|
@@ -38007,14 +38057,14 @@ var InvoiceForm = (props) => {
|
|
|
38007
38057
|
)
|
|
38008
38058
|
}
|
|
38009
38059
|
),
|
|
38010
|
-
/* @__PURE__ */ (0,
|
|
38011
|
-
/* @__PURE__ */ (0,
|
|
38060
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(form.AppField, { name: "email", children: (field) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(field.FormTextField, { label: "Email", inline: true, className: `${INVOICE_FORM_FIELD_CSS_PREFIX}__Email` }) }),
|
|
38061
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(form.AppField, { name: "address", children: (field) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(field.FormTextAreaField, { label: "Billing address", inline: true, className: `${INVOICE_FORM_FIELD_CSS_PREFIX}__Address` }) })
|
|
38012
38062
|
] }),
|
|
38013
|
-
/* @__PURE__ */ (0,
|
|
38014
|
-
field.state.value.map((_, index) => /* @__PURE__ */ (0,
|
|
38015
|
-
/* @__PURE__ */ (0,
|
|
38016
|
-
/* @__PURE__ */ (0,
|
|
38017
|
-
/* @__PURE__ */ (0,
|
|
38063
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(VStack, { className: `${INVOICE_FORM_CSS_PREFIX}__LineItems`, gap: "xs", children: /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(form.AppField, { name: "lineItems", mode: "array", children: (field) => /* @__PURE__ */ (0, import_jsx_runtime339.jsxs)(VStack, { gap: "xs", align: "baseline", children: [
|
|
38064
|
+
field.state.value.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime339.jsxs)(HStack, { gap: "xs", align: "end", className: `${INVOICE_FORM_CSS_PREFIX}__LineItem`, children: [
|
|
38065
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(form.AppField, { name: `lineItems[${index}].product`, children: (innerField) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(innerField.FormTextField, { label: "Product", showLabel: index === 0 }) }),
|
|
38066
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(form.AppField, { name: `lineItems[${index}].description`, children: (innerField) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(innerField.FormTextField, { label: "Description", showLabel: index === 0 }) }),
|
|
38067
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
38018
38068
|
form.AppField,
|
|
38019
38069
|
{
|
|
38020
38070
|
name: `lineItems[${index}].quantity`,
|
|
@@ -38025,10 +38075,10 @@ var InvoiceForm = (props) => {
|
|
|
38025
38075
|
form.setFieldValue(`lineItems[${index}].amount`, convertBigDecimalToCents(nextAmount));
|
|
38026
38076
|
}
|
|
38027
38077
|
},
|
|
38028
|
-
children: (innerField) => /* @__PURE__ */ (0,
|
|
38078
|
+
children: (innerField) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(innerField.FormBigDecimalField, { label: "Quantity", showLabel: index === 0 })
|
|
38029
38079
|
}
|
|
38030
38080
|
),
|
|
38031
|
-
/* @__PURE__ */ (0,
|
|
38081
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
38032
38082
|
form.AppField,
|
|
38033
38083
|
{
|
|
38034
38084
|
name: `lineItems[${index}].unitPrice`,
|
|
@@ -38039,10 +38089,10 @@ var InvoiceForm = (props) => {
|
|
|
38039
38089
|
form.setFieldValue(`lineItems[${index}].amount`, convertBigDecimalToCents(nextAmount));
|
|
38040
38090
|
}
|
|
38041
38091
|
},
|
|
38042
|
-
children: (innerField) => /* @__PURE__ */ (0,
|
|
38092
|
+
children: (innerField) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(innerField.FormCurrencyField, { label: "Rate", showLabel: index === 0 })
|
|
38043
38093
|
}
|
|
38044
38094
|
),
|
|
38045
|
-
/* @__PURE__ */ (0,
|
|
38095
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
38046
38096
|
form.AppField,
|
|
38047
38097
|
{
|
|
38048
38098
|
name: `lineItems[${index}].amount`,
|
|
@@ -38057,31 +38107,32 @@ var InvoiceForm = (props) => {
|
|
|
38057
38107
|
form.setFieldValue(`lineItems[${index}].unitPrice`, convertBigDecimalToCents(nextUnitPrice));
|
|
38058
38108
|
}
|
|
38059
38109
|
},
|
|
38060
|
-
children: (innerField) => /* @__PURE__ */ (0,
|
|
38110
|
+
children: (innerField) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(innerField.FormCurrencyField, { label: "Amount", showLabel: index === 0 })
|
|
38061
38111
|
}
|
|
38062
38112
|
),
|
|
38063
|
-
/* @__PURE__ */ (0,
|
|
38113
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(form.AppField, { name: `lineItems[${index}].isTaxable`, children: (innerField) => /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(innerField.FormCheckboxField, { label: "Tax", showLabel: index === 0 }) }),
|
|
38114
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(Button2, { variant: "outlined", icon: true, "aria-label": "Delete line item", onClick: () => field.removeValue(index), children: /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(import_lucide_react16.Trash, { size: 16 }) })
|
|
38064
38115
|
] }, `lineItems[${index}]`)),
|
|
38065
|
-
/* @__PURE__ */ (0,
|
|
38116
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsxs)(Button2, { variant: "outlined", onClick: () => field.pushValue(EMPTY_LINE_ITEM), children: [
|
|
38066
38117
|
"Add line item",
|
|
38067
|
-
/* @__PURE__ */ (0,
|
|
38118
|
+
/* @__PURE__ */ (0, import_jsx_runtime339.jsx)(import_lucide_react16.Plus, { size: 16 })
|
|
38068
38119
|
] })
|
|
38069
38120
|
] }) }) })
|
|
38070
38121
|
] });
|
|
38071
38122
|
};
|
|
38072
38123
|
|
|
38073
38124
|
// src/components/DataPoint/DataPoint.tsx
|
|
38074
|
-
var
|
|
38125
|
+
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
38075
38126
|
var DataPoint = ({ label, children }) => {
|
|
38076
|
-
return /* @__PURE__ */ (0,
|
|
38077
|
-
/* @__PURE__ */ (0,
|
|
38127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime340.jsxs)(VStack, { gap: "3xs", children: [
|
|
38128
|
+
/* @__PURE__ */ (0, import_jsx_runtime340.jsx)(Span, { variant: "subtle", size: "xs", children: label }),
|
|
38078
38129
|
children
|
|
38079
38130
|
] });
|
|
38080
38131
|
};
|
|
38081
38132
|
|
|
38082
38133
|
// src/components/Invoices/InvoiceStatusCell/InvoiceStatusCell.tsx
|
|
38083
38134
|
var import_pluralize6 = __toESM(require("pluralize"));
|
|
38084
|
-
var
|
|
38135
|
+
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
38085
38136
|
var getDueStatusConfig = (invoice, { inline }) => {
|
|
38086
38137
|
const badgeSize = inline ? "xs" /* EXTRA_SMALL */ : "small" /* SMALL */;
|
|
38087
38138
|
const iconSize = inline ? 10 : 12;
|
|
@@ -38095,7 +38146,7 @@ var getDueStatusConfig = (invoice, { inline }) => {
|
|
|
38095
38146
|
case "PAID" /* Paid */: {
|
|
38096
38147
|
return {
|
|
38097
38148
|
text: "Paid",
|
|
38098
|
-
badge: /* @__PURE__ */ (0,
|
|
38149
|
+
badge: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(Badge, { variant: "success" /* SUCCESS */, size: badgeSize, icon: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(CheckCircle_default, { size: iconSize }), iconOnly: true })
|
|
38099
38150
|
};
|
|
38100
38151
|
}
|
|
38101
38152
|
case "VOIDED" /* Voided */: {
|
|
@@ -38118,7 +38169,7 @@ var getDueStatusConfig = (invoice, { inline }) => {
|
|
|
38118
38169
|
return {
|
|
38119
38170
|
text: "Overdue",
|
|
38120
38171
|
subText: `Due ${(0, import_pluralize6.default)("day", Math.abs(dueDifference), true)} ago`,
|
|
38121
|
-
badge: /* @__PURE__ */ (0,
|
|
38172
|
+
badge: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(Badge, { variant: "warning" /* WARNING */, size: badgeSize, icon: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(AlertCircle_default, { size: iconSize }), iconOnly: true })
|
|
38122
38173
|
};
|
|
38123
38174
|
}
|
|
38124
38175
|
return {
|
|
@@ -38138,51 +38189,51 @@ var InvoiceStatusCell = ({ invoice, inline = false }) => {
|
|
|
38138
38189
|
const dueStatus = getDueStatusConfig(invoice, { inline });
|
|
38139
38190
|
const Stack3 = inline ? HStack : VStack;
|
|
38140
38191
|
const subText = inline && dueStatus.subText ? `(${dueStatus.subText})` : dueStatus.subText;
|
|
38141
|
-
return /* @__PURE__ */ (0,
|
|
38192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime341.jsxs)(HStack, { gap: "xs", align: "center", children: [
|
|
38142
38193
|
dueStatus.badge,
|
|
38143
|
-
/* @__PURE__ */ (0,
|
|
38144
|
-
/* @__PURE__ */ (0,
|
|
38145
|
-
subText && /* @__PURE__ */ (0,
|
|
38194
|
+
/* @__PURE__ */ (0, import_jsx_runtime341.jsxs)(Stack3, __spreadProps(__spreadValues({}, inline && { gap: "3xs", align: "center" }), { children: [
|
|
38195
|
+
/* @__PURE__ */ (0, import_jsx_runtime341.jsx)(Span, { children: dueStatus.text }),
|
|
38196
|
+
subText && /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(Span, { variant: "subtle", size: "sm", children: subText })
|
|
38146
38197
|
] }))
|
|
38147
38198
|
] });
|
|
38148
38199
|
};
|
|
38149
38200
|
|
|
38150
38201
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
38151
|
-
var
|
|
38202
|
+
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
38152
38203
|
var InvoiceDetail = (props) => {
|
|
38153
38204
|
const _a = props, { onSuccess: _onSuccess, onGoBack } = _a, restProps = __objRest(_a, ["onSuccess", "onGoBack"]);
|
|
38154
|
-
const Header6 = (0,
|
|
38155
|
-
return /* @__PURE__ */ (0,
|
|
38205
|
+
const Header6 = (0, import_react232.useCallback)(() => {
|
|
38206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(InvoiceDetailHeader, __spreadValues({}, restProps));
|
|
38156
38207
|
}, [restProps]);
|
|
38157
|
-
return /* @__PURE__ */ (0,
|
|
38158
|
-
restProps.mode === "Update" /* Update */ && /* @__PURE__ */ (0,
|
|
38159
|
-
/* @__PURE__ */ (0,
|
|
38208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(BaseDetailView, { slots: { Header: Header6 }, name: "Invoice Detail View", onGoBack, children: [
|
|
38209
|
+
restProps.mode === "Update" /* Update */ && /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(InvoiceDetailSubHeader, { invoice: restProps.invoice }),
|
|
38210
|
+
/* @__PURE__ */ (0, import_jsx_runtime342.jsx)(InvoiceForm, __spreadValues({}, props))
|
|
38160
38211
|
] });
|
|
38161
38212
|
};
|
|
38162
38213
|
var InvoiceDetailHeader = (props) => {
|
|
38163
38214
|
const { mode } = props;
|
|
38164
38215
|
if (mode === "Create" /* Create */) {
|
|
38165
|
-
return /* @__PURE__ */ (0,
|
|
38216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(Heading2, { children: "Create Invoice" });
|
|
38166
38217
|
}
|
|
38167
38218
|
const invoice = props.invoice;
|
|
38168
38219
|
const { invoiceNumber } = invoice;
|
|
38169
|
-
return /* @__PURE__ */ (0,
|
|
38220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(Heading2, { children: invoiceNumber ? `Invoice ${invoiceNumber}` : "View Invoice" });
|
|
38170
38221
|
};
|
|
38171
38222
|
var InvoiceDetailSubHeader = ({ invoice }) => {
|
|
38172
38223
|
const { outstandingBalance, totalAmount } = invoice;
|
|
38173
|
-
return /* @__PURE__ */ (0,
|
|
38174
|
-
/* @__PURE__ */ (0,
|
|
38175
|
-
/* @__PURE__ */ (0,
|
|
38176
|
-
/* @__PURE__ */ (0,
|
|
38224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(HStack, { className: "Layer__InvoiceDetail__SubHeader", children: /* @__PURE__ */ (0, import_jsx_runtime342.jsxs)(HStack, { gap: "5xl", children: [
|
|
38225
|
+
/* @__PURE__ */ (0, import_jsx_runtime342.jsx)(DataPoint, { label: "Balance due", children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(Span, { children: convertCentsToCurrency(outstandingBalance) }) }),
|
|
38226
|
+
/* @__PURE__ */ (0, import_jsx_runtime342.jsx)(DataPoint, { label: "Open balance", children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(Span, { children: convertCentsToCurrency(totalAmount) }) }),
|
|
38227
|
+
/* @__PURE__ */ (0, import_jsx_runtime342.jsx)(DataPoint, { label: "Status", children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(InvoiceStatusCell, { invoice, inline: true }) })
|
|
38177
38228
|
] }) });
|
|
38178
38229
|
};
|
|
38179
38230
|
|
|
38180
38231
|
// src/components/Invoices/InvoicesTable/InvoicesTable.tsx
|
|
38181
|
-
var
|
|
38232
|
+
var import_react237 = require("react");
|
|
38182
38233
|
|
|
38183
38234
|
// src/features/invoices/api/useListInvoices.tsx
|
|
38184
38235
|
var import_infinite7 = __toESM(require("swr/infinite"));
|
|
38185
|
-
var
|
|
38236
|
+
var import_react233 = require("react");
|
|
38186
38237
|
var import_lodash6 = __toESM(require_lodash());
|
|
38187
38238
|
var import_effect17 = require("effect");
|
|
38188
38239
|
|
|
@@ -38346,19 +38397,19 @@ function useListInvoices({
|
|
|
38346
38397
|
var import_react_table2 = require("@tanstack/react-table");
|
|
38347
38398
|
|
|
38348
38399
|
// src/components/DataTable/DataTable.tsx
|
|
38349
|
-
var
|
|
38400
|
+
var import_react235 = require("react");
|
|
38350
38401
|
|
|
38351
38402
|
// src/components/ui/Table/Table.tsx
|
|
38352
|
-
var
|
|
38403
|
+
var import_react234 = require("react");
|
|
38353
38404
|
var import_react_aria_components18 = require("react-aria-components");
|
|
38354
|
-
var
|
|
38355
|
-
var
|
|
38405
|
+
var import_classnames91 = __toESM(require("classnames"));
|
|
38406
|
+
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
38356
38407
|
var CSS_PREFIX2 = "Layer__UI__Table";
|
|
38357
|
-
var getClassName = (component, additionalClassNames) => (0,
|
|
38358
|
-
var Table2 = (0,
|
|
38408
|
+
var getClassName = (component, additionalClassNames) => (0, import_classnames91.default)(`${CSS_PREFIX2}-${component}`, additionalClassNames);
|
|
38409
|
+
var Table2 = (0, import_react234.forwardRef)(
|
|
38359
38410
|
(_a, ref) => {
|
|
38360
38411
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38361
|
-
return /* @__PURE__ */ (0,
|
|
38412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
38362
38413
|
import_react_aria_components18.Table,
|
|
38363
38414
|
__spreadProps(__spreadValues({
|
|
38364
38415
|
className: getClassName("Table" /* Table */, className)
|
|
@@ -38372,7 +38423,7 @@ var Table2 = (0, import_react233.forwardRef)(
|
|
|
38372
38423
|
Table2.displayName = "Table" /* Table */;
|
|
38373
38424
|
var TableHeaderInner = (_a, ref) => {
|
|
38374
38425
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38375
|
-
return /* @__PURE__ */ (0,
|
|
38426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
38376
38427
|
import_react_aria_components18.TableHeader,
|
|
38377
38428
|
__spreadProps(__spreadValues({
|
|
38378
38429
|
className: getClassName("TableHeader" /* TableHeader */, className)
|
|
@@ -38382,11 +38433,11 @@ var TableHeaderInner = (_a, ref) => {
|
|
|
38382
38433
|
})
|
|
38383
38434
|
);
|
|
38384
38435
|
};
|
|
38385
|
-
var TableHeader = (0,
|
|
38436
|
+
var TableHeader = (0, import_react234.forwardRef)(TableHeaderInner);
|
|
38386
38437
|
TableHeader.displayName = "TableHeader" /* TableHeader */;
|
|
38387
38438
|
var TableBodyInner = (_a, ref) => {
|
|
38388
38439
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38389
|
-
return /* @__PURE__ */ (0,
|
|
38440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
38390
38441
|
import_react_aria_components18.TableBody,
|
|
38391
38442
|
__spreadProps(__spreadValues({
|
|
38392
38443
|
className: getClassName("TableBody" /* TableBody */, className)
|
|
@@ -38396,11 +38447,11 @@ var TableBodyInner = (_a, ref) => {
|
|
|
38396
38447
|
})
|
|
38397
38448
|
);
|
|
38398
38449
|
};
|
|
38399
|
-
var TableBody2 = (0,
|
|
38450
|
+
var TableBody2 = (0, import_react234.forwardRef)(TableBodyInner);
|
|
38400
38451
|
TableBody2.displayName = "TableBody" /* TableBody */;
|
|
38401
38452
|
var RowInner = (_a, ref) => {
|
|
38402
38453
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38403
|
-
return /* @__PURE__ */ (0,
|
|
38454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
38404
38455
|
import_react_aria_components18.Row,
|
|
38405
38456
|
__spreadProps(__spreadValues({
|
|
38406
38457
|
className: getClassName("Row" /* Row */, className)
|
|
@@ -38410,13 +38461,13 @@ var RowInner = (_a, ref) => {
|
|
|
38410
38461
|
})
|
|
38411
38462
|
);
|
|
38412
38463
|
};
|
|
38413
|
-
var Row2 = (0,
|
|
38464
|
+
var Row2 = (0, import_react234.forwardRef)(RowInner);
|
|
38414
38465
|
Row2.displayName = "Row" /* Row */;
|
|
38415
|
-
var Column = (0,
|
|
38466
|
+
var Column = (0, import_react234.forwardRef)(
|
|
38416
38467
|
(_a, ref) => {
|
|
38417
38468
|
var _b = _a, { children, className, textAlign = "left" } = _b, restProps = __objRest(_b, ["children", "className", "textAlign"]);
|
|
38418
38469
|
const dataProperties = toDataProperties({ "text-align": textAlign });
|
|
38419
|
-
return /* @__PURE__ */ (0,
|
|
38470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
38420
38471
|
import_react_aria_components18.Column,
|
|
38421
38472
|
__spreadProps(__spreadValues(__spreadValues({
|
|
38422
38473
|
className: getClassName("Column" /* Column */, className)
|
|
@@ -38428,10 +38479,10 @@ var Column = (0, import_react233.forwardRef)(
|
|
|
38428
38479
|
}
|
|
38429
38480
|
);
|
|
38430
38481
|
Column.displayName = "Column" /* Column */;
|
|
38431
|
-
var Cell5 = (0,
|
|
38482
|
+
var Cell5 = (0, import_react234.forwardRef)(
|
|
38432
38483
|
(_a, ref) => {
|
|
38433
38484
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38434
|
-
return /* @__PURE__ */ (0,
|
|
38485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(
|
|
38435
38486
|
import_react_aria_components18.Cell,
|
|
38436
38487
|
__spreadProps(__spreadValues({
|
|
38437
38488
|
className: getClassName("Cell" /* Cell */, className)
|
|
@@ -38445,7 +38496,7 @@ var Cell5 = (0, import_react233.forwardRef)(
|
|
|
38445
38496
|
Cell5.displayName = "Cell" /* Cell */;
|
|
38446
38497
|
|
|
38447
38498
|
// src/components/DataTable/DataTable.tsx
|
|
38448
|
-
var
|
|
38499
|
+
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
38449
38500
|
var DataTable = ({
|
|
38450
38501
|
columnConfig,
|
|
38451
38502
|
data,
|
|
@@ -38458,17 +38509,17 @@ var DataTable = ({
|
|
|
38458
38509
|
const columns = Object.values(columnConfig);
|
|
38459
38510
|
const { EmptyState, ErrorState } = slots;
|
|
38460
38511
|
const isEmptyTable = (data == null ? void 0 : data.length) === 0;
|
|
38461
|
-
const renderTableBody = (0,
|
|
38512
|
+
const renderTableBody = (0, import_react235.useMemo)(() => {
|
|
38462
38513
|
if (isError) {
|
|
38463
|
-
return /* @__PURE__ */ (0,
|
|
38514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Row2, { children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Cell5, { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(ErrorState, {}) }) });
|
|
38464
38515
|
}
|
|
38465
38516
|
if (isLoading) {
|
|
38466
|
-
return /* @__PURE__ */ (0,
|
|
38517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Row2, { children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Cell5, { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Loader2, {}) }) });
|
|
38467
38518
|
}
|
|
38468
38519
|
if (isEmptyTable) {
|
|
38469
|
-
return /* @__PURE__ */ (0,
|
|
38520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Row2, { children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Cell5, { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(EmptyState, {}) }) });
|
|
38470
38521
|
}
|
|
38471
|
-
const RowRenderer = (row) => /* @__PURE__ */ (0,
|
|
38522
|
+
const RowRenderer = (row) => /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Row2, { children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
38472
38523
|
Cell5,
|
|
38473
38524
|
{
|
|
38474
38525
|
className: `Layer__UI__Table-Cell__${componentName}--${col.id}`,
|
|
@@ -38479,15 +38530,15 @@ var DataTable = ({
|
|
|
38479
38530
|
RowRenderer.displayName = "Row";
|
|
38480
38531
|
return RowRenderer;
|
|
38481
38532
|
}, [isError, isLoading, isEmptyTable, columns, ErrorState, EmptyState, componentName]);
|
|
38482
|
-
return /* @__PURE__ */ (0,
|
|
38483
|
-
/* @__PURE__ */ (0,
|
|
38484
|
-
/* @__PURE__ */ (0,
|
|
38533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(Table2, { "aria-label": ariaLabel, className: `Layer__UI__Table__${componentName}`, children: [
|
|
38534
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(TableHeader, { columns, children: ({ id, header, isRowHeader }) => /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(Column, { isRowHeader, className: `Layer__UI__Table-Column__${componentName}--${id}`, children: header }, id) }),
|
|
38535
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(TableBody2, { items: data, children: renderTableBody })
|
|
38485
38536
|
] });
|
|
38486
38537
|
};
|
|
38487
38538
|
|
|
38488
38539
|
// src/components/DataTable/PaginatedTable.tsx
|
|
38489
|
-
var
|
|
38490
|
-
var
|
|
38540
|
+
var import_react236 = require("react");
|
|
38541
|
+
var import_jsx_runtime345 = require("react/jsx-runtime");
|
|
38491
38542
|
var EMPTY_ARRAY = [];
|
|
38492
38543
|
function PaginatedTable({
|
|
38493
38544
|
data,
|
|
@@ -38500,7 +38551,7 @@ function PaginatedTable({
|
|
|
38500
38551
|
slots
|
|
38501
38552
|
}) {
|
|
38502
38553
|
const { pageSize = 20, hasMore, fetchMore } = paginationProps;
|
|
38503
|
-
const [pagination, setPagination] = (0,
|
|
38554
|
+
const [pagination, setPagination] = (0, import_react236.useState)({ pageIndex: 0, pageSize });
|
|
38504
38555
|
const columnHelper = (0, import_react_table2.createColumnHelper)();
|
|
38505
38556
|
const columns = Object.values(columnConfig);
|
|
38506
38557
|
const columnDefs = columns.map((col) => {
|
|
@@ -38520,12 +38571,12 @@ function PaginatedTable({
|
|
|
38520
38571
|
autoResetPageIndex: false
|
|
38521
38572
|
});
|
|
38522
38573
|
const { rows } = table.getRowModel();
|
|
38523
|
-
const rowData = (0,
|
|
38524
|
-
const onPageChange = (0,
|
|
38574
|
+
const rowData = (0, import_react236.useMemo)(() => rows.map((r) => r.original), [rows]);
|
|
38575
|
+
const onPageChange = (0, import_react236.useCallback)((page) => {
|
|
38525
38576
|
table.setPageIndex(page - 1);
|
|
38526
38577
|
}, [table]);
|
|
38527
|
-
return /* @__PURE__ */ (0,
|
|
38528
|
-
/* @__PURE__ */ (0,
|
|
38578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(VStack, { children: [
|
|
38579
|
+
/* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
|
|
38529
38580
|
DataTable,
|
|
38530
38581
|
{
|
|
38531
38582
|
ariaLabel,
|
|
@@ -38537,7 +38588,7 @@ function PaginatedTable({
|
|
|
38537
38588
|
slots
|
|
38538
38589
|
}
|
|
38539
38590
|
),
|
|
38540
|
-
!isError && !isLoading && /* @__PURE__ */ (0,
|
|
38591
|
+
!isError && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
|
|
38541
38592
|
Pagination,
|
|
38542
38593
|
{
|
|
38543
38594
|
currentPage: table.getState().pagination.pageIndex + 1,
|
|
@@ -38552,10 +38603,10 @@ function PaginatedTable({
|
|
|
38552
38603
|
}
|
|
38553
38604
|
|
|
38554
38605
|
// src/icons/ChevronRightFill.tsx
|
|
38555
|
-
var
|
|
38606
|
+
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
38556
38607
|
var ChevronRightFill = (_a) => {
|
|
38557
38608
|
var _b = _a, { size = 18 } = _b, props = __objRest(_b, ["size"]);
|
|
38558
|
-
return /* @__PURE__ */ (0,
|
|
38609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(
|
|
38559
38610
|
"svg",
|
|
38560
38611
|
__spreadProps(__spreadValues({
|
|
38561
38612
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -38565,8 +38616,8 @@ var ChevronRightFill = (_a) => {
|
|
|
38565
38616
|
width: size,
|
|
38566
38617
|
height: size,
|
|
38567
38618
|
children: [
|
|
38568
|
-
/* @__PURE__ */ (0,
|
|
38569
|
-
/* @__PURE__ */ (0,
|
|
38619
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("path", { d: "M6.75 4.5L11.25 9L6.75 13.5", fill: "currentColor" }),
|
|
38620
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
|
|
38570
38621
|
"path",
|
|
38571
38622
|
{
|
|
38572
38623
|
d: "M6.75 4.5L11.25 9L6.75 13.5Z",
|
|
@@ -38585,34 +38636,34 @@ var ChevronRightFill_default = ChevronRightFill;
|
|
|
38585
38636
|
var import_lucide_react17 = require("lucide-react");
|
|
38586
38637
|
|
|
38587
38638
|
// src/components/DataTable/DataTableHeader.tsx
|
|
38588
|
-
var
|
|
38639
|
+
var import_jsx_runtime347 = require("react/jsx-runtime");
|
|
38589
38640
|
var DataTableHeader = ({ name, count, slotProps = {}, slots = {} }) => {
|
|
38590
38641
|
const { showCount, totalCount } = count != null ? count : {};
|
|
38591
38642
|
const { Filters: Filters2, HeaderActions, HeaderFilters } = slots;
|
|
38592
|
-
return /* @__PURE__ */ (0,
|
|
38593
|
-
/* @__PURE__ */ (0,
|
|
38594
|
-
/* @__PURE__ */ (0,
|
|
38595
|
-
/* @__PURE__ */ (0,
|
|
38596
|
-
/* @__PURE__ */ (0,
|
|
38597
|
-
showCount && (totalCount ? /* @__PURE__ */ (0,
|
|
38643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(VStack, { children: [
|
|
38644
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(HStack, { justify: "space-between", align: "center", className: "Layer__DataTableHeader__Header", children: [
|
|
38645
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(HStack, { pis: "md", align: "center", gap: "xl", children: [
|
|
38646
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(HStack, { align: "center", gap: "sm", children: [
|
|
38647
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(Span, { weight: "bold", size: "lg", children: name }),
|
|
38648
|
+
showCount && (totalCount ? /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(Badge, { variant: "default" /* DEFAULT */, size: "medium" /* MEDIUM */, children: totalCount }) : /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(BadgeLoader, {}))
|
|
38598
38649
|
] }),
|
|
38599
|
-
HeaderFilters && /* @__PURE__ */ (0,
|
|
38650
|
+
HeaderFilters && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(HeaderFilters, {})
|
|
38600
38651
|
] }),
|
|
38601
|
-
/* @__PURE__ */ (0,
|
|
38602
|
-
slotProps.SearchField && /* @__PURE__ */ (0,
|
|
38603
|
-
HeaderActions && /* @__PURE__ */ (0,
|
|
38652
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(HStack, { pie: "md", align: "center", gap: "3xs", children: [
|
|
38653
|
+
slotProps.SearchField && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(SearchField, __spreadValues({}, slotProps.SearchField)),
|
|
38654
|
+
HeaderActions && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(HeaderActions, {})
|
|
38604
38655
|
] })
|
|
38605
38656
|
] }),
|
|
38606
|
-
Filters2 && /* @__PURE__ */ (0,
|
|
38607
|
-
/* @__PURE__ */ (0,
|
|
38608
|
-
slotProps.ClearFiltersButton && /* @__PURE__ */ (0,
|
|
38657
|
+
Filters2 && /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(HStack, { pis: "md", pie: "md", justify: "space-between", align: "center", className: "Layer__DataTableHeader__Filters", children: [
|
|
38658
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(Filters2, {}),
|
|
38659
|
+
slotProps.ClearFiltersButton && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(Button2, __spreadProps(__spreadValues({ variant: "outlined" }, slotProps.ClearFiltersButton), { children: "Clear All Filters" }))
|
|
38609
38660
|
] })
|
|
38610
38661
|
] });
|
|
38611
38662
|
};
|
|
38612
38663
|
|
|
38613
38664
|
// src/components/Invoices/InvoicesTable/InvoicesTable.tsx
|
|
38614
38665
|
var import_date_fns51 = require("date-fns");
|
|
38615
|
-
var
|
|
38666
|
+
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
38616
38667
|
var COMPONENT_NAME10 = "InvoicesTable";
|
|
38617
38668
|
var InvoiceStatusOptionConfig = {
|
|
38618
38669
|
["All" /* All */]: { label: "All", value: "All" /* All */ },
|
|
@@ -38633,12 +38684,12 @@ var AmountCell = ({ invoice }) => {
|
|
|
38633
38684
|
case "WRITTEN_OFF" /* WrittenOff */:
|
|
38634
38685
|
case "VOIDED" /* Voided */:
|
|
38635
38686
|
case "SENT" /* Sent */: {
|
|
38636
|
-
return /* @__PURE__ */ (0,
|
|
38687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(VStack, { children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(Span, { align: "right", children: totalAmount }) });
|
|
38637
38688
|
}
|
|
38638
38689
|
case "PARTIALLY_PAID" /* PartiallyPaid */: {
|
|
38639
|
-
return /* @__PURE__ */ (0,
|
|
38640
|
-
/* @__PURE__ */ (0,
|
|
38641
|
-
/* @__PURE__ */ (0,
|
|
38690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(VStack, { children: [
|
|
38691
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(Span, { align: "right", children: totalAmount }),
|
|
38692
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(Span, { align: "right", variant: "subtle", size: "sm", children: [
|
|
38642
38693
|
outstandingBalance,
|
|
38643
38694
|
" ",
|
|
38644
38695
|
"outstanding"
|
|
@@ -38677,16 +38728,16 @@ var getColumnConfig = (onSelectInvoice) => ({
|
|
|
38677
38728
|
["Total" /* Total */]: {
|
|
38678
38729
|
id: "Total" /* Total */,
|
|
38679
38730
|
header: "Amount",
|
|
38680
|
-
cell: (row) => /* @__PURE__ */ (0,
|
|
38731
|
+
cell: (row) => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(AmountCell, { invoice: row })
|
|
38681
38732
|
},
|
|
38682
38733
|
["Status" /* Status */]: {
|
|
38683
38734
|
id: "Status" /* Status */,
|
|
38684
38735
|
header: "Status",
|
|
38685
|
-
cell: (row) => /* @__PURE__ */ (0,
|
|
38736
|
+
cell: (row) => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(InvoiceStatusCell, { invoice: row })
|
|
38686
38737
|
},
|
|
38687
38738
|
["Expand" /* Expand */]: {
|
|
38688
38739
|
id: "Expand" /* Expand */,
|
|
38689
|
-
cell: (row) => /* @__PURE__ */ (0,
|
|
38740
|
+
cell: (row) => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(Button2, { inset: true, icon: true, onPress: () => onSelectInvoice(row), "aria-label": "View invoice", variant: "ghost", children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(ChevronRightFill_default, {}) })
|
|
38690
38741
|
}
|
|
38691
38742
|
});
|
|
38692
38743
|
var UNPAID_STATUSES2 = ["SENT" /* Sent */, "PARTIALLY_PAID" /* PartiallyPaid */];
|
|
@@ -38715,8 +38766,8 @@ var getListInvoiceParams = ({ statusFilter }) => {
|
|
|
38715
38766
|
}
|
|
38716
38767
|
};
|
|
38717
38768
|
var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
38718
|
-
const [selectedInvoiceStatusOption, setSelectedInvoiceStatusOption] = (0,
|
|
38719
|
-
const listInvoiceParams = (0,
|
|
38769
|
+
const [selectedInvoiceStatusOption, setSelectedInvoiceStatusOption] = (0, import_react237.useState)(ALL_OPTION);
|
|
38770
|
+
const listInvoiceParams = (0, import_react237.useMemo)(
|
|
38720
38771
|
() => getListInvoiceParams({ statusFilter: selectedInvoiceStatusOption == null ? void 0 : selectedInvoiceStatusOption.value }),
|
|
38721
38772
|
[selectedInvoiceStatusOption == null ? void 0 : selectedInvoiceStatusOption.value]
|
|
38722
38773
|
);
|
|
@@ -38724,25 +38775,25 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38724
38775
|
const invoices = data == null ? void 0 : data.flatMap(({ data: data2 }) => data2);
|
|
38725
38776
|
const paginationMeta = data == null ? void 0 : data[data.length - 1].meta.pagination;
|
|
38726
38777
|
const hasMore = paginationMeta == null ? void 0 : paginationMeta.hasMore;
|
|
38727
|
-
const fetchMore = (0,
|
|
38778
|
+
const fetchMore = (0, import_react237.useCallback)(() => {
|
|
38728
38779
|
if (hasMore) {
|
|
38729
38780
|
void setSize(size + 1);
|
|
38730
38781
|
}
|
|
38731
38782
|
}, [hasMore, setSize, size]);
|
|
38732
|
-
const paginationProps = (0,
|
|
38783
|
+
const paginationProps = (0, import_react237.useMemo)(() => {
|
|
38733
38784
|
return {
|
|
38734
38785
|
pageSize: 10,
|
|
38735
38786
|
hasMore,
|
|
38736
38787
|
fetchMore
|
|
38737
38788
|
};
|
|
38738
38789
|
}, [fetchMore, hasMore]);
|
|
38739
|
-
const options = (0,
|
|
38740
|
-
const SelectedValue = (0,
|
|
38790
|
+
const options = (0, import_react237.useMemo)(() => Object.values(InvoiceStatusOptionConfig), []);
|
|
38791
|
+
const SelectedValue = (0, import_react237.useMemo)(() => {
|
|
38741
38792
|
const label = selectedInvoiceStatusOption == null ? void 0 : selectedInvoiceStatusOption.label;
|
|
38742
38793
|
return label ? `Status: ${label}` : "Status";
|
|
38743
38794
|
}, [selectedInvoiceStatusOption == null ? void 0 : selectedInvoiceStatusOption.label]);
|
|
38744
|
-
const StatusFilter = (0,
|
|
38745
|
-
() => /* @__PURE__ */ (0,
|
|
38795
|
+
const StatusFilter = (0, import_react237.useCallback)(
|
|
38796
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
38746
38797
|
ComboBox,
|
|
38747
38798
|
{
|
|
38748
38799
|
className: "Layer__InvoicesTable__StatusFilter",
|
|
@@ -38758,27 +38809,27 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38758
38809
|
),
|
|
38759
38810
|
[SelectedValue, options, selectedInvoiceStatusOption]
|
|
38760
38811
|
);
|
|
38761
|
-
const CreateInvoiceButton = (0,
|
|
38762
|
-
() => /* @__PURE__ */ (0,
|
|
38812
|
+
const CreateInvoiceButton = (0, import_react237.useCallback)(
|
|
38813
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(Button2, { onPress: onCreateInvoice, children: [
|
|
38763
38814
|
"Create Invoice",
|
|
38764
|
-
/* @__PURE__ */ (0,
|
|
38815
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(import_lucide_react17.Plus, { size: 16 })
|
|
38765
38816
|
] }),
|
|
38766
38817
|
[onCreateInvoice]
|
|
38767
38818
|
);
|
|
38768
|
-
const InvoicesTableEmptyState = (0,
|
|
38819
|
+
const InvoicesTableEmptyState = (0, import_react237.useCallback)(() => {
|
|
38769
38820
|
const isFiltered = selectedInvoiceStatusOption && selectedInvoiceStatusOption !== ALL_OPTION;
|
|
38770
|
-
return /* @__PURE__ */ (0,
|
|
38821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
38771
38822
|
DataState,
|
|
38772
38823
|
{
|
|
38773
38824
|
status: "allDone" /* allDone */,
|
|
38774
38825
|
title: isFiltered ? "No results found" : "No invoices yet",
|
|
38775
38826
|
description: isFiltered ? "We couldn\u2019t find any invoices with the current filters. Try changing or clearing them to see more results." : "Add your first invoice to start tracking what your customers owe you.",
|
|
38776
|
-
icon: isFiltered ? /* @__PURE__ */ (0,
|
|
38827
|
+
icon: isFiltered ? /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(import_lucide_react17.Search, {}) : /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(import_lucide_react17.HandCoins, {}),
|
|
38777
38828
|
spacing: true
|
|
38778
38829
|
}
|
|
38779
38830
|
);
|
|
38780
38831
|
}, [selectedInvoiceStatusOption]);
|
|
38781
|
-
const InvoicesTableErrorState = (0,
|
|
38832
|
+
const InvoicesTableErrorState = (0, import_react237.useCallback)(() => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
38782
38833
|
DataState,
|
|
38783
38834
|
{
|
|
38784
38835
|
status: "failed" /* failed */,
|
|
@@ -38790,9 +38841,9 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38790
38841
|
spacing: true
|
|
38791
38842
|
}
|
|
38792
38843
|
), [refetch]);
|
|
38793
|
-
const columnConfig = (0,
|
|
38794
|
-
return /* @__PURE__ */ (0,
|
|
38795
|
-
/* @__PURE__ */ (0,
|
|
38844
|
+
const columnConfig = (0, import_react237.useMemo)(() => getColumnConfig(onSelectInvoice), [onSelectInvoice]);
|
|
38845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(Container, { name: "InvoicesTable", children: [
|
|
38846
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
38796
38847
|
DataTableHeader,
|
|
38797
38848
|
{
|
|
38798
38849
|
name: "Invoices",
|
|
@@ -38802,7 +38853,7 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38802
38853
|
}
|
|
38803
38854
|
}
|
|
38804
38855
|
),
|
|
38805
|
-
/* @__PURE__ */ (0,
|
|
38856
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
38806
38857
|
PaginatedTable,
|
|
38807
38858
|
{
|
|
38808
38859
|
ariaLabel: "Invoices",
|
|
@@ -38822,38 +38873,38 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38822
38873
|
};
|
|
38823
38874
|
|
|
38824
38875
|
// src/components/Invoices/Invoices.tsx
|
|
38825
|
-
var
|
|
38876
|
+
var import_jsx_runtime349 = require("react/jsx-runtime");
|
|
38826
38877
|
var unstable_Invoices = ({
|
|
38827
38878
|
showTitle = true,
|
|
38828
38879
|
stringOverrides
|
|
38829
38880
|
}) => {
|
|
38830
|
-
const [invoiceFormMode, setInvoiceFormMode] = (0,
|
|
38831
|
-
const goBackToInvoicesTable = (0,
|
|
38881
|
+
const [invoiceFormMode, setInvoiceFormMode] = (0, import_react238.useState)(null);
|
|
38882
|
+
const goBackToInvoicesTable = (0, import_react238.useCallback)(() => {
|
|
38832
38883
|
setInvoiceFormMode(null);
|
|
38833
38884
|
}, []);
|
|
38834
|
-
const onCreateInvoice = (0,
|
|
38885
|
+
const onCreateInvoice = (0, import_react238.useCallback)(() => {
|
|
38835
38886
|
setInvoiceFormMode({ mode: "Create" /* Create */ });
|
|
38836
38887
|
}, []);
|
|
38837
|
-
const onSelectInvoice = (0,
|
|
38888
|
+
const onSelectInvoice = (0, import_react238.useCallback)((invoice) => {
|
|
38838
38889
|
setInvoiceFormMode({ mode: "Update" /* Update */, invoice });
|
|
38839
38890
|
}, []);
|
|
38840
|
-
return /* @__PURE__ */ (0,
|
|
38891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(
|
|
38841
38892
|
View,
|
|
38842
38893
|
{
|
|
38843
38894
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || "Invoices",
|
|
38844
38895
|
showHeader: showTitle,
|
|
38845
|
-
children: invoiceFormMode !== null ? /* @__PURE__ */ (0,
|
|
38896
|
+
children: invoiceFormMode !== null ? /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(InvoiceDetail, __spreadProps(__spreadValues({}, invoiceFormMode), { onGoBack: goBackToInvoicesTable })) : /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(InvoicesTable, { onCreateInvoice, onSelectInvoice })
|
|
38846
38897
|
}
|
|
38847
38898
|
);
|
|
38848
38899
|
};
|
|
38849
38900
|
|
|
38850
38901
|
// src/providers/BankTransactionsProvider/BankTransactionsProvider.tsx
|
|
38851
|
-
var
|
|
38902
|
+
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
38852
38903
|
var BankTransactionsProvider = ({
|
|
38853
38904
|
children
|
|
38854
38905
|
}) => {
|
|
38855
38906
|
const bankTransactionsContextData = useAugmentedBankTransactions();
|
|
38856
|
-
return /* @__PURE__ */ (0,
|
|
38907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(BankTransactionsContext.Provider, { value: bankTransactionsContextData, children });
|
|
38857
38908
|
};
|
|
38858
38909
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38859
38910
|
0 && (module.exports = {
|