@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/esm/index.mjs
CHANGED
|
@@ -5570,7 +5570,7 @@ import { useState as useState5 } from "react";
|
|
|
5570
5570
|
import { useReducer, useEffect as useEffect2 } from "react";
|
|
5571
5571
|
|
|
5572
5572
|
// package.json
|
|
5573
|
-
var version = "0.1.106
|
|
5573
|
+
var version = "0.1.106";
|
|
5574
5574
|
|
|
5575
5575
|
// src/models/APIError.ts
|
|
5576
5576
|
var APIError = class _APIError extends Error {
|
|
@@ -7097,7 +7097,7 @@ function clampToPresentOrPast(date, cutoff = endOfDay(/* @__PURE__ */ new Date()
|
|
|
7097
7097
|
}
|
|
7098
7098
|
var RANGE_MODE_LOOKUP = {
|
|
7099
7099
|
dayPicker: {
|
|
7100
|
-
getStart: ({ start }) => start,
|
|
7100
|
+
getStart: ({ start }) => startOfMonth(start),
|
|
7101
7101
|
getEnd: ({ end }) => clampToPresentOrPast(endOfDay(end))
|
|
7102
7102
|
},
|
|
7103
7103
|
dayRangePicker: {
|
|
@@ -37268,10 +37268,10 @@ var Components = ({
|
|
|
37268
37268
|
};
|
|
37269
37269
|
|
|
37270
37270
|
// src/components/Invoices/Invoices.tsx
|
|
37271
|
-
import { useCallback as
|
|
37271
|
+
import { useCallback as useCallback59, useState as useState87 } from "react";
|
|
37272
37272
|
|
|
37273
37273
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
37274
|
-
import { useCallback as
|
|
37274
|
+
import { useCallback as useCallback55 } from "react";
|
|
37275
37275
|
|
|
37276
37276
|
// src/components/BaseDetailView/BaseDetailView.tsx
|
|
37277
37277
|
import { jsx as jsx326, jsxs as jsxs210 } from "react/jsx-runtime";
|
|
@@ -37431,11 +37431,14 @@ function formatBigDecimalToString(value, maxDecimalPlaces = 10) {
|
|
|
37431
37431
|
// src/features/forms/components/FormBigDecimalField.tsx
|
|
37432
37432
|
import { jsx as jsx331 } from "react/jsx-runtime";
|
|
37433
37433
|
var DEFAULT_MAX_INPUT_LENGTH = 10;
|
|
37434
|
-
function FormBigDecimalField({
|
|
37435
|
-
|
|
37436
|
-
|
|
37437
|
-
|
|
37438
|
-
}
|
|
37434
|
+
function FormBigDecimalField(_a) {
|
|
37435
|
+
var _b = _a, {
|
|
37436
|
+
maxInputLength = DEFAULT_MAX_INPUT_LENGTH,
|
|
37437
|
+
allowNegative = false
|
|
37438
|
+
} = _b, restProps = __objRest(_b, [
|
|
37439
|
+
"maxInputLength",
|
|
37440
|
+
"allowNegative"
|
|
37441
|
+
]);
|
|
37439
37442
|
const field = useFieldContext();
|
|
37440
37443
|
const { name, state, handleChange, handleBlur } = field;
|
|
37441
37444
|
const { value } = state;
|
|
@@ -37473,7 +37476,7 @@ function FormBigDecimalField({
|
|
|
37473
37476
|
useEffect41(() => {
|
|
37474
37477
|
setInputValue(formatBigDecimalToString(value, maxInputLength));
|
|
37475
37478
|
}, [value, maxInputLength]);
|
|
37476
|
-
return /* @__PURE__ */ jsx331(BaseFormTextField, __spreadProps(__spreadValues({},
|
|
37479
|
+
return /* @__PURE__ */ jsx331(BaseFormTextField, __spreadProps(__spreadValues({}, restProps), { inputMode: "decimal", children: /* @__PURE__ */ jsx331(InputGroup2, { children: /* @__PURE__ */ jsx331(
|
|
37477
37480
|
Input2,
|
|
37478
37481
|
{
|
|
37479
37482
|
inset: true,
|
|
@@ -37489,23 +37492,67 @@ function FormBigDecimalField({
|
|
|
37489
37492
|
) }) }));
|
|
37490
37493
|
}
|
|
37491
37494
|
|
|
37495
|
+
// src/features/forms/components/FormCheckboxField.tsx
|
|
37496
|
+
import { useCallback as useCallback49 } from "react";
|
|
37497
|
+
import classNames89 from "classnames";
|
|
37498
|
+
import { jsx as jsx332 } from "react/jsx-runtime";
|
|
37499
|
+
var FORM_CHECKBOX_FIELD_CLASSNAME = "Layer__FormCheckboxField";
|
|
37500
|
+
function FormCheckboxField({
|
|
37501
|
+
label,
|
|
37502
|
+
className,
|
|
37503
|
+
inline = false,
|
|
37504
|
+
showLabel = true,
|
|
37505
|
+
showErrorInTooltip = true
|
|
37506
|
+
}) {
|
|
37507
|
+
const field = useFieldContext();
|
|
37508
|
+
const { name, state, handleChange, handleBlur } = field;
|
|
37509
|
+
const { meta, value } = state;
|
|
37510
|
+
const { errors, isValid: isValid2 } = meta;
|
|
37511
|
+
const errorMessage = errors.length !== 0 ? errors[0] : void 0;
|
|
37512
|
+
const tooltipProps = showErrorInTooltip ? { tooltip: errorMessage } : {};
|
|
37513
|
+
const additionalAriaProps = !showLabel && { "aria-label": label };
|
|
37514
|
+
const checkboxClassNames = classNames89(
|
|
37515
|
+
FORM_CHECKBOX_FIELD_CLASSNAME,
|
|
37516
|
+
inline && `${FORM_CHECKBOX_FIELD_CLASSNAME}--inline`,
|
|
37517
|
+
className
|
|
37518
|
+
);
|
|
37519
|
+
const onChange = useCallback49((isSelected) => {
|
|
37520
|
+
handleChange(isSelected);
|
|
37521
|
+
}, [handleChange]);
|
|
37522
|
+
return /* @__PURE__ */ jsx332(
|
|
37523
|
+
CheckboxWithTooltip,
|
|
37524
|
+
__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
37525
|
+
className: checkboxClassNames,
|
|
37526
|
+
isSelected: value,
|
|
37527
|
+
isInvalid: !isValid2,
|
|
37528
|
+
onChange,
|
|
37529
|
+
onBlur: handleBlur,
|
|
37530
|
+
name,
|
|
37531
|
+
value: name,
|
|
37532
|
+
size: "lg"
|
|
37533
|
+
}, tooltipProps), additionalAriaProps), !isValid2 && { variant: "error" }), {
|
|
37534
|
+
children: showLabel && /* @__PURE__ */ jsx332(Label, { slot: "label", size: "sm", htmlFor: name, children: label })
|
|
37535
|
+
})
|
|
37536
|
+
);
|
|
37537
|
+
}
|
|
37538
|
+
|
|
37492
37539
|
// src/features/forms/components/FormCurrencyField.tsx
|
|
37493
|
-
import { useCallback as
|
|
37540
|
+
import { useCallback as useCallback50, useEffect as useEffect42, useState as useState83 } from "react";
|
|
37494
37541
|
import CurrencyInput2 from "react-currency-input-field";
|
|
37495
37542
|
import { BigDecimal as BD3, Option as Option5 } from "effect";
|
|
37496
|
-
import { jsx as
|
|
37543
|
+
import { jsx as jsx333 } from "react/jsx-runtime";
|
|
37497
37544
|
var ZERO_CENTS_INPUT_VALUE = "0.00";
|
|
37498
37545
|
var getCurrencyInputValueFromCents = (cents) => !Number.isNaN(cents) ? centsToDollarsWithoutCommas(cents) : ZERO_CENTS_INPUT_VALUE;
|
|
37499
|
-
function FormCurrencyField(
|
|
37546
|
+
function FormCurrencyField(props) {
|
|
37500
37547
|
const field = useFieldContext();
|
|
37501
|
-
const label =
|
|
37548
|
+
const { label } = props;
|
|
37502
37549
|
const { name, state, handleChange, handleBlur } = field;
|
|
37503
37550
|
const { value } = state;
|
|
37504
37551
|
const [inputValue, setInputValue] = useState83(getCurrencyInputValueFromCents(value));
|
|
37505
|
-
const onInputChange =
|
|
37552
|
+
const onInputChange = useCallback50((newValue) => {
|
|
37506
37553
|
setInputValue(newValue != null ? newValue : ZERO_CENTS_INPUT_VALUE);
|
|
37507
37554
|
}, []);
|
|
37508
|
-
const onInputBlur =
|
|
37555
|
+
const onInputBlur = useCallback50(() => {
|
|
37509
37556
|
const maybeAmount = BD3.fromString(inputValue);
|
|
37510
37557
|
const cents = Option5.match(maybeAmount, {
|
|
37511
37558
|
onNone: () => 0,
|
|
@@ -37518,7 +37565,7 @@ function FormCurrencyField({ slotProps }) {
|
|
|
37518
37565
|
useEffect42(() => {
|
|
37519
37566
|
setInputValue(getCurrencyInputValueFromCents(value));
|
|
37520
37567
|
}, [value]);
|
|
37521
|
-
return /* @__PURE__ */
|
|
37568
|
+
return /* @__PURE__ */ jsx333(BaseFormTextField, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx333(InputGroup2, { children: /* @__PURE__ */ jsx333(
|
|
37522
37569
|
CurrencyInput2,
|
|
37523
37570
|
{
|
|
37524
37571
|
name,
|
|
@@ -37541,18 +37588,18 @@ function FormCurrencyField({ slotProps }) {
|
|
|
37541
37588
|
}
|
|
37542
37589
|
|
|
37543
37590
|
// src/features/forms/components/FormTextAreaField.tsx
|
|
37544
|
-
import { useCallback as
|
|
37591
|
+
import { useCallback as useCallback51 } from "react";
|
|
37545
37592
|
|
|
37546
37593
|
// src/components/ui/Input/TextArea.tsx
|
|
37547
37594
|
import { forwardRef as forwardRef23 } from "react";
|
|
37548
37595
|
import { TextArea as ReactAriaTextArea } from "react-aria-components";
|
|
37549
|
-
import { jsx as
|
|
37596
|
+
import { jsx as jsx334 } from "react/jsx-runtime";
|
|
37550
37597
|
var TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
|
|
37551
37598
|
var TextArea = forwardRef23(
|
|
37552
37599
|
function TextArea2(_a, ref) {
|
|
37553
37600
|
var _b = _a, { resize = "none" } = _b, restProps = __objRest(_b, ["resize"]);
|
|
37554
37601
|
const dataProperties = toDataProperties({ resize });
|
|
37555
|
-
return /* @__PURE__ */
|
|
37602
|
+
return /* @__PURE__ */ jsx334(
|
|
37556
37603
|
ReactAriaTextArea,
|
|
37557
37604
|
__spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), {
|
|
37558
37605
|
className: TEXTAREA_CLASS_NAME,
|
|
@@ -37563,28 +37610,28 @@ var TextArea = forwardRef23(
|
|
|
37563
37610
|
);
|
|
37564
37611
|
|
|
37565
37612
|
// src/features/forms/components/FormTextAreaField.tsx
|
|
37566
|
-
import { jsx as
|
|
37567
|
-
function FormTextAreaField(
|
|
37613
|
+
import { jsx as jsx335 } from "react/jsx-runtime";
|
|
37614
|
+
function FormTextAreaField(props) {
|
|
37568
37615
|
const field = useFieldContext();
|
|
37569
37616
|
const { name, state, handleChange, handleBlur } = field;
|
|
37570
37617
|
const { value } = state;
|
|
37571
|
-
const onChange =
|
|
37618
|
+
const onChange = useCallback51((e) => {
|
|
37572
37619
|
handleChange(e.target.value);
|
|
37573
37620
|
}, [handleChange]);
|
|
37574
|
-
return /* @__PURE__ */
|
|
37621
|
+
return /* @__PURE__ */ jsx335(BaseFormTextField, __spreadProps(__spreadValues({}, props), { isTextArea: true, children: /* @__PURE__ */ jsx335(TextArea, { id: name, name, value, onChange, onBlur: handleBlur }) }));
|
|
37575
37622
|
}
|
|
37576
37623
|
|
|
37577
37624
|
// src/features/forms/components/FormTextField.tsx
|
|
37578
|
-
import { useCallback as
|
|
37579
|
-
import { jsx as
|
|
37580
|
-
function FormTextField(
|
|
37625
|
+
import { useCallback as useCallback52 } from "react";
|
|
37626
|
+
import { jsx as jsx336 } from "react/jsx-runtime";
|
|
37627
|
+
function FormTextField(props) {
|
|
37581
37628
|
const field = useFieldContext();
|
|
37582
37629
|
const { name, state, handleChange, handleBlur } = field;
|
|
37583
37630
|
const { value } = state;
|
|
37584
|
-
const onChange =
|
|
37631
|
+
const onChange = useCallback52((e) => {
|
|
37585
37632
|
handleChange(e.target.value);
|
|
37586
37633
|
}, [handleChange]);
|
|
37587
|
-
return /* @__PURE__ */
|
|
37634
|
+
return /* @__PURE__ */ jsx336(BaseFormTextField, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx336(InputGroup2, { children: /* @__PURE__ */ jsx336(Input2, { inset: true, id: name, name, value, onChange, onBlur: handleBlur }) }) }));
|
|
37588
37635
|
}
|
|
37589
37636
|
|
|
37590
37637
|
// src/features/forms/hooks/useForm.tsx
|
|
@@ -37593,6 +37640,7 @@ var { useAppForm, withForm } = createFormHook({
|
|
|
37593
37640
|
fieldComponents: {
|
|
37594
37641
|
BaseFormTextField,
|
|
37595
37642
|
FormBigDecimalField,
|
|
37643
|
+
FormCheckboxField,
|
|
37596
37644
|
FormCurrencyField,
|
|
37597
37645
|
FormTextAreaField,
|
|
37598
37646
|
FormTextField
|
|
@@ -37773,7 +37821,7 @@ var UpsertInvoiceSchema = Schema9.Struct({
|
|
|
37773
37821
|
});
|
|
37774
37822
|
|
|
37775
37823
|
// src/features/invoices/api/useUpsertInvoice.tsx
|
|
37776
|
-
import { useCallback as
|
|
37824
|
+
import { useCallback as useCallback53 } from "react";
|
|
37777
37825
|
import useSWRMutation26 from "swr/mutation";
|
|
37778
37826
|
import { Schema as Schema10, Effect } from "effect";
|
|
37779
37827
|
var UPSERT_INVOICES_TAG_KEY = "#upsert-invoice";
|
|
@@ -37869,7 +37917,7 @@ var useUpsertInvoice = (props) => {
|
|
|
37869
37917
|
);
|
|
37870
37918
|
const mutationResponse = new UpsertInvoiceSWRResponse(rawMutationResponse);
|
|
37871
37919
|
const originalTrigger = mutationResponse.trigger;
|
|
37872
|
-
const stableProxiedTrigger =
|
|
37920
|
+
const stableProxiedTrigger = useCallback53(
|
|
37873
37921
|
(...triggerParameters) => __async(null, null, function* () {
|
|
37874
37922
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
37875
37923
|
return triggerResult;
|
|
@@ -37893,7 +37941,8 @@ var EMPTY_LINE_ITEM = {
|
|
|
37893
37941
|
description: "",
|
|
37894
37942
|
unitPrice: 0,
|
|
37895
37943
|
quantity: BIG_DECIMAL_ONE,
|
|
37896
|
-
amount: 0
|
|
37944
|
+
amount: 0,
|
|
37945
|
+
isTaxable: false
|
|
37897
37946
|
};
|
|
37898
37947
|
var DEFAULT_FORM_VALUES = {
|
|
37899
37948
|
invoiceNumber: "",
|
|
@@ -37908,7 +37957,8 @@ var getInvoiceLineItemAmount = (lineItem) => {
|
|
|
37908
37957
|
};
|
|
37909
37958
|
var getAugmentedInvoiceFormLineItem = (lineItem) => {
|
|
37910
37959
|
return __spreadProps(__spreadValues({}, lineItem), {
|
|
37911
|
-
amount: getInvoiceLineItemAmount(lineItem)
|
|
37960
|
+
amount: getInvoiceLineItemAmount(lineItem),
|
|
37961
|
+
isTaxable: lineItem.salesTaxTotal > 0
|
|
37912
37962
|
});
|
|
37913
37963
|
};
|
|
37914
37964
|
var getInvoiceFormDefaultValues = (invoice) => {
|
|
@@ -37953,9 +38003,9 @@ import { Plus as Plus2, Trash as Trash2 } from "lucide-react";
|
|
|
37953
38003
|
import { BigDecimal as BD5 } from "effect";
|
|
37954
38004
|
|
|
37955
38005
|
// src/features/customers/components/CustomerSelector.tsx
|
|
37956
|
-
import { useCallback as
|
|
37957
|
-
import
|
|
37958
|
-
import { jsx as
|
|
38006
|
+
import { useCallback as useCallback54, useId as useId5, useMemo as useMemo72 } from "react";
|
|
38007
|
+
import classNames90 from "classnames";
|
|
38008
|
+
import { jsx as jsx337, jsxs as jsxs212 } from "react/jsx-runtime";
|
|
37959
38009
|
function getCustomerName(customer) {
|
|
37960
38010
|
var _a, _b, _c;
|
|
37961
38011
|
return (_c = (_b = (_a = customer.individualName) != null ? _a : customer.companyName) != null ? _b : customer.externalId) != null ? _c : "Unknown Customer";
|
|
@@ -37986,7 +38036,7 @@ function CustomerSelector({
|
|
|
37986
38036
|
inline,
|
|
37987
38037
|
className
|
|
37988
38038
|
}) {
|
|
37989
|
-
const combinedClassName =
|
|
38039
|
+
const combinedClassName = classNames90(
|
|
37990
38040
|
"Layer__CustomerSelector",
|
|
37991
38041
|
inline && "Layer__CustomerSelector--inline",
|
|
37992
38042
|
className
|
|
@@ -38001,7 +38051,7 @@ function CustomerSelector({
|
|
|
38001
38051
|
[data]
|
|
38002
38052
|
);
|
|
38003
38053
|
const selectedCustomerId = selectedCustomer == null ? void 0 : selectedCustomer.id;
|
|
38004
|
-
const handleSelectionChange =
|
|
38054
|
+
const handleSelectionChange = useCallback54(
|
|
38005
38055
|
(selectedOption) => {
|
|
38006
38056
|
if (selectedOption === null) {
|
|
38007
38057
|
handleInputChange("");
|
|
@@ -38035,11 +38085,11 @@ function CustomerSelector({
|
|
|
38035
38085
|
[selectedCustomer]
|
|
38036
38086
|
);
|
|
38037
38087
|
const EmptyMessage = useMemo72(
|
|
38038
|
-
() => /* @__PURE__ */
|
|
38088
|
+
() => /* @__PURE__ */ jsx337(P, { variant: "subtle", children: "No matching customer" }),
|
|
38039
38089
|
[]
|
|
38040
38090
|
);
|
|
38041
38091
|
const ErrorMessage = useMemo72(
|
|
38042
|
-
() => /* @__PURE__ */
|
|
38092
|
+
() => /* @__PURE__ */ jsx337(
|
|
38043
38093
|
P,
|
|
38044
38094
|
{
|
|
38045
38095
|
size: "xs",
|
|
@@ -38059,8 +38109,8 @@ function CustomerSelector({
|
|
|
38059
38109
|
const isLoadingWithoutFallback = isLoading && !data;
|
|
38060
38110
|
const shouldDisableComboBox = isLoadingWithoutFallback || isError;
|
|
38061
38111
|
return /* @__PURE__ */ jsxs212(VStack, { className: combinedClassName, children: [
|
|
38062
|
-
/* @__PURE__ */
|
|
38063
|
-
/* @__PURE__ */
|
|
38112
|
+
/* @__PURE__ */ jsx337(Label, { htmlFor: inputId, size: "sm", children: "Customer" }),
|
|
38113
|
+
/* @__PURE__ */ jsx337(
|
|
38064
38114
|
ComboBox,
|
|
38065
38115
|
{
|
|
38066
38116
|
selectedValue: selectedCustomerForComboBox,
|
|
@@ -38079,7 +38129,7 @@ function CustomerSelector({
|
|
|
38079
38129
|
}
|
|
38080
38130
|
|
|
38081
38131
|
// src/components/Invoices/InvoiceForm/InvoiceForm.tsx
|
|
38082
|
-
import { jsx as
|
|
38132
|
+
import { jsx as jsx338, jsxs as jsxs213 } from "react/jsx-runtime";
|
|
38083
38133
|
var INVOICE_FORM_CSS_PREFIX = "Layer__InvoiceForm";
|
|
38084
38134
|
var INVOICE_FORM_FIELD_CSS_PREFIX = `${INVOICE_FORM_CSS_PREFIX}__Field`;
|
|
38085
38135
|
var InvoiceForm = (props) => {
|
|
@@ -38089,7 +38139,7 @@ var InvoiceForm = (props) => {
|
|
|
38089
38139
|
);
|
|
38090
38140
|
return /* @__PURE__ */ jsxs213(Form, { className: INVOICE_FORM_CSS_PREFIX, children: [
|
|
38091
38141
|
/* @__PURE__ */ jsxs213(VStack, { className: `${INVOICE_FORM_CSS_PREFIX}__Metadata`, gap: "xs", children: [
|
|
38092
|
-
/* @__PURE__ */
|
|
38142
|
+
/* @__PURE__ */ jsx338(
|
|
38093
38143
|
form.Field,
|
|
38094
38144
|
{
|
|
38095
38145
|
name: "customer",
|
|
@@ -38099,7 +38149,7 @@ var InvoiceForm = (props) => {
|
|
|
38099
38149
|
form.setFieldValue("address", customer == null ? void 0 : customer.addressString);
|
|
38100
38150
|
}
|
|
38101
38151
|
},
|
|
38102
|
-
children: (field) => /* @__PURE__ */
|
|
38152
|
+
children: (field) => /* @__PURE__ */ jsx338(
|
|
38103
38153
|
CustomerSelector,
|
|
38104
38154
|
{
|
|
38105
38155
|
className: `${INVOICE_FORM_FIELD_CSS_PREFIX}__Customer`,
|
|
@@ -38110,14 +38160,14 @@ var InvoiceForm = (props) => {
|
|
|
38110
38160
|
)
|
|
38111
38161
|
}
|
|
38112
38162
|
),
|
|
38113
|
-
/* @__PURE__ */
|
|
38114
|
-
/* @__PURE__ */
|
|
38163
|
+
/* @__PURE__ */ jsx338(form.AppField, { name: "email", children: (field) => /* @__PURE__ */ jsx338(field.FormTextField, { label: "Email", inline: true, className: `${INVOICE_FORM_FIELD_CSS_PREFIX}__Email` }) }),
|
|
38164
|
+
/* @__PURE__ */ jsx338(form.AppField, { name: "address", children: (field) => /* @__PURE__ */ jsx338(field.FormTextAreaField, { label: "Billing address", inline: true, className: `${INVOICE_FORM_FIELD_CSS_PREFIX}__Address` }) })
|
|
38115
38165
|
] }),
|
|
38116
|
-
/* @__PURE__ */
|
|
38166
|
+
/* @__PURE__ */ jsx338(VStack, { className: `${INVOICE_FORM_CSS_PREFIX}__LineItems`, gap: "xs", children: /* @__PURE__ */ jsx338(form.AppField, { name: "lineItems", mode: "array", children: (field) => /* @__PURE__ */ jsxs213(VStack, { gap: "xs", align: "baseline", children: [
|
|
38117
38167
|
field.state.value.map((_, index) => /* @__PURE__ */ jsxs213(HStack, { gap: "xs", align: "end", className: `${INVOICE_FORM_CSS_PREFIX}__LineItem`, children: [
|
|
38118
|
-
/* @__PURE__ */
|
|
38119
|
-
/* @__PURE__ */
|
|
38120
|
-
/* @__PURE__ */
|
|
38168
|
+
/* @__PURE__ */ jsx338(form.AppField, { name: `lineItems[${index}].product`, children: (innerField) => /* @__PURE__ */ jsx338(innerField.FormTextField, { label: "Product", showLabel: index === 0 }) }),
|
|
38169
|
+
/* @__PURE__ */ jsx338(form.AppField, { name: `lineItems[${index}].description`, children: (innerField) => /* @__PURE__ */ jsx338(innerField.FormTextField, { label: "Description", showLabel: index === 0 }) }),
|
|
38170
|
+
/* @__PURE__ */ jsx338(
|
|
38121
38171
|
form.AppField,
|
|
38122
38172
|
{
|
|
38123
38173
|
name: `lineItems[${index}].quantity`,
|
|
@@ -38128,10 +38178,10 @@ var InvoiceForm = (props) => {
|
|
|
38128
38178
|
form.setFieldValue(`lineItems[${index}].amount`, convertBigDecimalToCents(nextAmount));
|
|
38129
38179
|
}
|
|
38130
38180
|
},
|
|
38131
|
-
children: (innerField) => /* @__PURE__ */
|
|
38181
|
+
children: (innerField) => /* @__PURE__ */ jsx338(innerField.FormBigDecimalField, { label: "Quantity", showLabel: index === 0 })
|
|
38132
38182
|
}
|
|
38133
38183
|
),
|
|
38134
|
-
/* @__PURE__ */
|
|
38184
|
+
/* @__PURE__ */ jsx338(
|
|
38135
38185
|
form.AppField,
|
|
38136
38186
|
{
|
|
38137
38187
|
name: `lineItems[${index}].unitPrice`,
|
|
@@ -38142,10 +38192,10 @@ var InvoiceForm = (props) => {
|
|
|
38142
38192
|
form.setFieldValue(`lineItems[${index}].amount`, convertBigDecimalToCents(nextAmount));
|
|
38143
38193
|
}
|
|
38144
38194
|
},
|
|
38145
|
-
children: (innerField) => /* @__PURE__ */
|
|
38195
|
+
children: (innerField) => /* @__PURE__ */ jsx338(innerField.FormCurrencyField, { label: "Rate", showLabel: index === 0 })
|
|
38146
38196
|
}
|
|
38147
38197
|
),
|
|
38148
|
-
/* @__PURE__ */
|
|
38198
|
+
/* @__PURE__ */ jsx338(
|
|
38149
38199
|
form.AppField,
|
|
38150
38200
|
{
|
|
38151
38201
|
name: `lineItems[${index}].amount`,
|
|
@@ -38160,31 +38210,32 @@ var InvoiceForm = (props) => {
|
|
|
38160
38210
|
form.setFieldValue(`lineItems[${index}].unitPrice`, convertBigDecimalToCents(nextUnitPrice));
|
|
38161
38211
|
}
|
|
38162
38212
|
},
|
|
38163
|
-
children: (innerField) => /* @__PURE__ */
|
|
38213
|
+
children: (innerField) => /* @__PURE__ */ jsx338(innerField.FormCurrencyField, { label: "Amount", showLabel: index === 0 })
|
|
38164
38214
|
}
|
|
38165
38215
|
),
|
|
38166
|
-
/* @__PURE__ */
|
|
38216
|
+
/* @__PURE__ */ jsx338(form.AppField, { name: `lineItems[${index}].isTaxable`, children: (innerField) => /* @__PURE__ */ jsx338(innerField.FormCheckboxField, { label: "Tax", showLabel: index === 0 }) }),
|
|
38217
|
+
/* @__PURE__ */ jsx338(Button2, { variant: "outlined", icon: true, "aria-label": "Delete line item", onClick: () => field.removeValue(index), children: /* @__PURE__ */ jsx338(Trash2, { size: 16 }) })
|
|
38167
38218
|
] }, `lineItems[${index}]`)),
|
|
38168
38219
|
/* @__PURE__ */ jsxs213(Button2, { variant: "outlined", onClick: () => field.pushValue(EMPTY_LINE_ITEM), children: [
|
|
38169
38220
|
"Add line item",
|
|
38170
|
-
/* @__PURE__ */
|
|
38221
|
+
/* @__PURE__ */ jsx338(Plus2, { size: 16 })
|
|
38171
38222
|
] })
|
|
38172
38223
|
] }) }) })
|
|
38173
38224
|
] });
|
|
38174
38225
|
};
|
|
38175
38226
|
|
|
38176
38227
|
// src/components/DataPoint/DataPoint.tsx
|
|
38177
|
-
import { jsx as
|
|
38228
|
+
import { jsx as jsx339, jsxs as jsxs214 } from "react/jsx-runtime";
|
|
38178
38229
|
var DataPoint = ({ label, children }) => {
|
|
38179
38230
|
return /* @__PURE__ */ jsxs214(VStack, { gap: "3xs", children: [
|
|
38180
|
-
/* @__PURE__ */
|
|
38231
|
+
/* @__PURE__ */ jsx339(Span, { variant: "subtle", size: "xs", children: label }),
|
|
38181
38232
|
children
|
|
38182
38233
|
] });
|
|
38183
38234
|
};
|
|
38184
38235
|
|
|
38185
38236
|
// src/components/Invoices/InvoiceStatusCell/InvoiceStatusCell.tsx
|
|
38186
38237
|
import pluralize6 from "pluralize";
|
|
38187
|
-
import { jsx as
|
|
38238
|
+
import { jsx as jsx340, jsxs as jsxs215 } from "react/jsx-runtime";
|
|
38188
38239
|
var getDueStatusConfig = (invoice, { inline }) => {
|
|
38189
38240
|
const badgeSize = inline ? "xs" /* EXTRA_SMALL */ : "small" /* SMALL */;
|
|
38190
38241
|
const iconSize = inline ? 10 : 12;
|
|
@@ -38198,7 +38249,7 @@ var getDueStatusConfig = (invoice, { inline }) => {
|
|
|
38198
38249
|
case "PAID" /* Paid */: {
|
|
38199
38250
|
return {
|
|
38200
38251
|
text: "Paid",
|
|
38201
|
-
badge: /* @__PURE__ */
|
|
38252
|
+
badge: /* @__PURE__ */ jsx340(Badge, { variant: "success" /* SUCCESS */, size: badgeSize, icon: /* @__PURE__ */ jsx340(CheckCircle_default, { size: iconSize }), iconOnly: true })
|
|
38202
38253
|
};
|
|
38203
38254
|
}
|
|
38204
38255
|
case "VOIDED" /* Voided */: {
|
|
@@ -38221,7 +38272,7 @@ var getDueStatusConfig = (invoice, { inline }) => {
|
|
|
38221
38272
|
return {
|
|
38222
38273
|
text: "Overdue",
|
|
38223
38274
|
subText: `Due ${pluralize6("day", Math.abs(dueDifference), true)} ago`,
|
|
38224
|
-
badge: /* @__PURE__ */
|
|
38275
|
+
badge: /* @__PURE__ */ jsx340(Badge, { variant: "warning" /* WARNING */, size: badgeSize, icon: /* @__PURE__ */ jsx340(AlertCircle_default, { size: iconSize }), iconOnly: true })
|
|
38225
38276
|
};
|
|
38226
38277
|
}
|
|
38227
38278
|
return {
|
|
@@ -38244,49 +38295,49 @@ var InvoiceStatusCell = ({ invoice, inline = false }) => {
|
|
|
38244
38295
|
return /* @__PURE__ */ jsxs215(HStack, { gap: "xs", align: "center", children: [
|
|
38245
38296
|
dueStatus.badge,
|
|
38246
38297
|
/* @__PURE__ */ jsxs215(Stack3, __spreadProps(__spreadValues({}, inline && { gap: "3xs", align: "center" }), { children: [
|
|
38247
|
-
/* @__PURE__ */
|
|
38248
|
-
subText && /* @__PURE__ */
|
|
38298
|
+
/* @__PURE__ */ jsx340(Span, { children: dueStatus.text }),
|
|
38299
|
+
subText && /* @__PURE__ */ jsx340(Span, { variant: "subtle", size: "sm", children: subText })
|
|
38249
38300
|
] }))
|
|
38250
38301
|
] });
|
|
38251
38302
|
};
|
|
38252
38303
|
|
|
38253
38304
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
38254
|
-
import { jsx as
|
|
38305
|
+
import { jsx as jsx341, jsxs as jsxs216 } from "react/jsx-runtime";
|
|
38255
38306
|
var InvoiceDetail = (props) => {
|
|
38256
38307
|
const _a = props, { onSuccess: _onSuccess, onGoBack } = _a, restProps = __objRest(_a, ["onSuccess", "onGoBack"]);
|
|
38257
|
-
const Header6 =
|
|
38258
|
-
return /* @__PURE__ */
|
|
38308
|
+
const Header6 = useCallback55(() => {
|
|
38309
|
+
return /* @__PURE__ */ jsx341(InvoiceDetailHeader, __spreadValues({}, restProps));
|
|
38259
38310
|
}, [restProps]);
|
|
38260
38311
|
return /* @__PURE__ */ jsxs216(BaseDetailView, { slots: { Header: Header6 }, name: "Invoice Detail View", onGoBack, children: [
|
|
38261
|
-
restProps.mode === "Update" /* Update */ && /* @__PURE__ */
|
|
38262
|
-
/* @__PURE__ */
|
|
38312
|
+
restProps.mode === "Update" /* Update */ && /* @__PURE__ */ jsx341(InvoiceDetailSubHeader, { invoice: restProps.invoice }),
|
|
38313
|
+
/* @__PURE__ */ jsx341(InvoiceForm, __spreadValues({}, props))
|
|
38263
38314
|
] });
|
|
38264
38315
|
};
|
|
38265
38316
|
var InvoiceDetailHeader = (props) => {
|
|
38266
38317
|
const { mode } = props;
|
|
38267
38318
|
if (mode === "Create" /* Create */) {
|
|
38268
|
-
return /* @__PURE__ */
|
|
38319
|
+
return /* @__PURE__ */ jsx341(Heading2, { children: "Create Invoice" });
|
|
38269
38320
|
}
|
|
38270
38321
|
const invoice = props.invoice;
|
|
38271
38322
|
const { invoiceNumber } = invoice;
|
|
38272
|
-
return /* @__PURE__ */
|
|
38323
|
+
return /* @__PURE__ */ jsx341(Heading2, { children: invoiceNumber ? `Invoice ${invoiceNumber}` : "View Invoice" });
|
|
38273
38324
|
};
|
|
38274
38325
|
var InvoiceDetailSubHeader = ({ invoice }) => {
|
|
38275
38326
|
const { outstandingBalance, totalAmount } = invoice;
|
|
38276
|
-
return /* @__PURE__ */
|
|
38277
|
-
/* @__PURE__ */
|
|
38278
|
-
/* @__PURE__ */
|
|
38279
|
-
/* @__PURE__ */
|
|
38327
|
+
return /* @__PURE__ */ jsx341(HStack, { className: "Layer__InvoiceDetail__SubHeader", children: /* @__PURE__ */ jsxs216(HStack, { gap: "5xl", children: [
|
|
38328
|
+
/* @__PURE__ */ jsx341(DataPoint, { label: "Balance due", children: /* @__PURE__ */ jsx341(Span, { children: convertCentsToCurrency(outstandingBalance) }) }),
|
|
38329
|
+
/* @__PURE__ */ jsx341(DataPoint, { label: "Open balance", children: /* @__PURE__ */ jsx341(Span, { children: convertCentsToCurrency(totalAmount) }) }),
|
|
38330
|
+
/* @__PURE__ */ jsx341(DataPoint, { label: "Status", children: /* @__PURE__ */ jsx341(InvoiceStatusCell, { invoice, inline: true }) })
|
|
38280
38331
|
] }) });
|
|
38281
38332
|
};
|
|
38282
38333
|
|
|
38283
38334
|
// src/components/Invoices/InvoicesTable/InvoicesTable.tsx
|
|
38284
|
-
import { useCallback as
|
|
38335
|
+
import { useCallback as useCallback58, useMemo as useMemo76, useState as useState86 } from "react";
|
|
38285
38336
|
|
|
38286
38337
|
// src/features/invoices/api/useListInvoices.tsx
|
|
38287
38338
|
import useSWRInfinite7 from "swr/infinite";
|
|
38288
38339
|
var import_lodash6 = __toESM(require_lodash2());
|
|
38289
|
-
import { useCallback as
|
|
38340
|
+
import { useCallback as useCallback56, useMemo as useMemo73 } from "react";
|
|
38290
38341
|
import { Schema as Schema13 } from "effect";
|
|
38291
38342
|
|
|
38292
38343
|
// src/types/utility/pagination.ts
|
|
@@ -38466,14 +38517,14 @@ import {
|
|
|
38466
38517
|
TableBody as ReactAriaTableBody,
|
|
38467
38518
|
TableHeader as ReactAriaTableHeader
|
|
38468
38519
|
} from "react-aria-components";
|
|
38469
|
-
import
|
|
38470
|
-
import { jsx as
|
|
38520
|
+
import classNames91 from "classnames";
|
|
38521
|
+
import { jsx as jsx342 } from "react/jsx-runtime";
|
|
38471
38522
|
var CSS_PREFIX2 = "Layer__UI__Table";
|
|
38472
|
-
var getClassName = (component, additionalClassNames) =>
|
|
38523
|
+
var getClassName = (component, additionalClassNames) => classNames91(`${CSS_PREFIX2}-${component}`, additionalClassNames);
|
|
38473
38524
|
var Table2 = forwardRef24(
|
|
38474
38525
|
(_a, ref) => {
|
|
38475
38526
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38476
|
-
return /* @__PURE__ */
|
|
38527
|
+
return /* @__PURE__ */ jsx342(
|
|
38477
38528
|
ReactAriaTable,
|
|
38478
38529
|
__spreadProps(__spreadValues({
|
|
38479
38530
|
className: getClassName("Table" /* Table */, className)
|
|
@@ -38487,7 +38538,7 @@ var Table2 = forwardRef24(
|
|
|
38487
38538
|
Table2.displayName = "Table" /* Table */;
|
|
38488
38539
|
var TableHeaderInner = (_a, ref) => {
|
|
38489
38540
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38490
|
-
return /* @__PURE__ */
|
|
38541
|
+
return /* @__PURE__ */ jsx342(
|
|
38491
38542
|
ReactAriaTableHeader,
|
|
38492
38543
|
__spreadProps(__spreadValues({
|
|
38493
38544
|
className: getClassName("TableHeader" /* TableHeader */, className)
|
|
@@ -38501,7 +38552,7 @@ var TableHeader = forwardRef24(TableHeaderInner);
|
|
|
38501
38552
|
TableHeader.displayName = "TableHeader" /* TableHeader */;
|
|
38502
38553
|
var TableBodyInner = (_a, ref) => {
|
|
38503
38554
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38504
|
-
return /* @__PURE__ */
|
|
38555
|
+
return /* @__PURE__ */ jsx342(
|
|
38505
38556
|
ReactAriaTableBody,
|
|
38506
38557
|
__spreadProps(__spreadValues({
|
|
38507
38558
|
className: getClassName("TableBody" /* TableBody */, className)
|
|
@@ -38515,7 +38566,7 @@ var TableBody2 = forwardRef24(TableBodyInner);
|
|
|
38515
38566
|
TableBody2.displayName = "TableBody" /* TableBody */;
|
|
38516
38567
|
var RowInner = (_a, ref) => {
|
|
38517
38568
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38518
|
-
return /* @__PURE__ */
|
|
38569
|
+
return /* @__PURE__ */ jsx342(
|
|
38519
38570
|
ReactAriaTableRow,
|
|
38520
38571
|
__spreadProps(__spreadValues({
|
|
38521
38572
|
className: getClassName("Row" /* Row */, className)
|
|
@@ -38531,7 +38582,7 @@ var Column = forwardRef24(
|
|
|
38531
38582
|
(_a, ref) => {
|
|
38532
38583
|
var _b = _a, { children, className, textAlign = "left" } = _b, restProps = __objRest(_b, ["children", "className", "textAlign"]);
|
|
38533
38584
|
const dataProperties = toDataProperties({ "text-align": textAlign });
|
|
38534
|
-
return /* @__PURE__ */
|
|
38585
|
+
return /* @__PURE__ */ jsx342(
|
|
38535
38586
|
ReactAriaColumn,
|
|
38536
38587
|
__spreadProps(__spreadValues(__spreadValues({
|
|
38537
38588
|
className: getClassName("Column" /* Column */, className)
|
|
@@ -38546,7 +38597,7 @@ Column.displayName = "Column" /* Column */;
|
|
|
38546
38597
|
var Cell5 = forwardRef24(
|
|
38547
38598
|
(_a, ref) => {
|
|
38548
38599
|
var _b = _a, { children, className } = _b, restProps = __objRest(_b, ["children", "className"]);
|
|
38549
|
-
return /* @__PURE__ */
|
|
38600
|
+
return /* @__PURE__ */ jsx342(
|
|
38550
38601
|
ReactAriaCell,
|
|
38551
38602
|
__spreadProps(__spreadValues({
|
|
38552
38603
|
className: getClassName("Cell" /* Cell */, className)
|
|
@@ -38560,7 +38611,7 @@ var Cell5 = forwardRef24(
|
|
|
38560
38611
|
Cell5.displayName = "Cell" /* Cell */;
|
|
38561
38612
|
|
|
38562
38613
|
// src/components/DataTable/DataTable.tsx
|
|
38563
|
-
import { jsx as
|
|
38614
|
+
import { jsx as jsx343, jsxs as jsxs217 } from "react/jsx-runtime";
|
|
38564
38615
|
var DataTable = ({
|
|
38565
38616
|
columnConfig,
|
|
38566
38617
|
data,
|
|
@@ -38575,15 +38626,15 @@ var DataTable = ({
|
|
|
38575
38626
|
const isEmptyTable = (data == null ? void 0 : data.length) === 0;
|
|
38576
38627
|
const renderTableBody = useMemo74(() => {
|
|
38577
38628
|
if (isError) {
|
|
38578
|
-
return /* @__PURE__ */
|
|
38629
|
+
return /* @__PURE__ */ jsx343(Row2, { children: /* @__PURE__ */ jsx343(Cell5, { colSpan: columns.length, children: /* @__PURE__ */ jsx343(ErrorState, {}) }) });
|
|
38579
38630
|
}
|
|
38580
38631
|
if (isLoading) {
|
|
38581
|
-
return /* @__PURE__ */
|
|
38632
|
+
return /* @__PURE__ */ jsx343(Row2, { children: /* @__PURE__ */ jsx343(Cell5, { colSpan: columns.length, children: /* @__PURE__ */ jsx343(Loader2, {}) }) });
|
|
38582
38633
|
}
|
|
38583
38634
|
if (isEmptyTable) {
|
|
38584
|
-
return /* @__PURE__ */
|
|
38635
|
+
return /* @__PURE__ */ jsx343(Row2, { children: /* @__PURE__ */ jsx343(Cell5, { colSpan: columns.length, children: /* @__PURE__ */ jsx343(EmptyState, {}) }) });
|
|
38585
38636
|
}
|
|
38586
|
-
const RowRenderer = (row) => /* @__PURE__ */
|
|
38637
|
+
const RowRenderer = (row) => /* @__PURE__ */ jsx343(Row2, { children: columns.map((col) => /* @__PURE__ */ jsx343(
|
|
38587
38638
|
Cell5,
|
|
38588
38639
|
{
|
|
38589
38640
|
className: `Layer__UI__Table-Cell__${componentName}--${col.id}`,
|
|
@@ -38595,14 +38646,14 @@ var DataTable = ({
|
|
|
38595
38646
|
return RowRenderer;
|
|
38596
38647
|
}, [isError, isLoading, isEmptyTable, columns, ErrorState, EmptyState, componentName]);
|
|
38597
38648
|
return /* @__PURE__ */ jsxs217(Table2, { "aria-label": ariaLabel, className: `Layer__UI__Table__${componentName}`, children: [
|
|
38598
|
-
/* @__PURE__ */
|
|
38599
|
-
/* @__PURE__ */
|
|
38649
|
+
/* @__PURE__ */ jsx343(TableHeader, { columns, children: ({ id, header, isRowHeader }) => /* @__PURE__ */ jsx343(Column, { isRowHeader, className: `Layer__UI__Table-Column__${componentName}--${id}`, children: header }, id) }),
|
|
38650
|
+
/* @__PURE__ */ jsx343(TableBody2, { items: data, children: renderTableBody })
|
|
38600
38651
|
] });
|
|
38601
38652
|
};
|
|
38602
38653
|
|
|
38603
38654
|
// src/components/DataTable/PaginatedTable.tsx
|
|
38604
|
-
import { useCallback as
|
|
38605
|
-
import { jsx as
|
|
38655
|
+
import { useCallback as useCallback57, useMemo as useMemo75, useState as useState85 } from "react";
|
|
38656
|
+
import { jsx as jsx344, jsxs as jsxs218 } from "react/jsx-runtime";
|
|
38606
38657
|
var EMPTY_ARRAY = [];
|
|
38607
38658
|
function PaginatedTable({
|
|
38608
38659
|
data,
|
|
@@ -38636,11 +38687,11 @@ function PaginatedTable({
|
|
|
38636
38687
|
});
|
|
38637
38688
|
const { rows } = table.getRowModel();
|
|
38638
38689
|
const rowData = useMemo75(() => rows.map((r) => r.original), [rows]);
|
|
38639
|
-
const onPageChange =
|
|
38690
|
+
const onPageChange = useCallback57((page) => {
|
|
38640
38691
|
table.setPageIndex(page - 1);
|
|
38641
38692
|
}, [table]);
|
|
38642
38693
|
return /* @__PURE__ */ jsxs218(VStack, { children: [
|
|
38643
|
-
/* @__PURE__ */
|
|
38694
|
+
/* @__PURE__ */ jsx344(
|
|
38644
38695
|
DataTable,
|
|
38645
38696
|
{
|
|
38646
38697
|
ariaLabel,
|
|
@@ -38652,7 +38703,7 @@ function PaginatedTable({
|
|
|
38652
38703
|
slots
|
|
38653
38704
|
}
|
|
38654
38705
|
),
|
|
38655
|
-
!isError && !isLoading && /* @__PURE__ */
|
|
38706
|
+
!isError && !isLoading && /* @__PURE__ */ jsx344(
|
|
38656
38707
|
Pagination,
|
|
38657
38708
|
{
|
|
38658
38709
|
currentPage: table.getState().pagination.pageIndex + 1,
|
|
@@ -38667,7 +38718,7 @@ function PaginatedTable({
|
|
|
38667
38718
|
}
|
|
38668
38719
|
|
|
38669
38720
|
// src/icons/ChevronRightFill.tsx
|
|
38670
|
-
import { jsx as
|
|
38721
|
+
import { jsx as jsx345, jsxs as jsxs219 } from "react/jsx-runtime";
|
|
38671
38722
|
var ChevronRightFill = (_a) => {
|
|
38672
38723
|
var _b = _a, { size = 18 } = _b, props = __objRest(_b, ["size"]);
|
|
38673
38724
|
return /* @__PURE__ */ jsxs219(
|
|
@@ -38680,8 +38731,8 @@ var ChevronRightFill = (_a) => {
|
|
|
38680
38731
|
width: size,
|
|
38681
38732
|
height: size,
|
|
38682
38733
|
children: [
|
|
38683
|
-
/* @__PURE__ */
|
|
38684
|
-
/* @__PURE__ */
|
|
38734
|
+
/* @__PURE__ */ jsx345("path", { d: "M6.75 4.5L11.25 9L6.75 13.5", fill: "currentColor" }),
|
|
38735
|
+
/* @__PURE__ */ jsx345(
|
|
38685
38736
|
"path",
|
|
38686
38737
|
{
|
|
38687
38738
|
d: "M6.75 4.5L11.25 9L6.75 13.5Z",
|
|
@@ -38700,7 +38751,7 @@ var ChevronRightFill_default = ChevronRightFill;
|
|
|
38700
38751
|
import { HandCoins, Search as Search2, Plus as Plus3 } from "lucide-react";
|
|
38701
38752
|
|
|
38702
38753
|
// src/components/DataTable/DataTableHeader.tsx
|
|
38703
|
-
import { jsx as
|
|
38754
|
+
import { jsx as jsx346, jsxs as jsxs220 } from "react/jsx-runtime";
|
|
38704
38755
|
var DataTableHeader = ({ name, count, slotProps = {}, slots = {} }) => {
|
|
38705
38756
|
const { showCount, totalCount } = count != null ? count : {};
|
|
38706
38757
|
const { Filters: Filters2, HeaderActions, HeaderFilters } = slots;
|
|
@@ -38708,26 +38759,26 @@ var DataTableHeader = ({ name, count, slotProps = {}, slots = {} }) => {
|
|
|
38708
38759
|
/* @__PURE__ */ jsxs220(HStack, { justify: "space-between", align: "center", className: "Layer__DataTableHeader__Header", children: [
|
|
38709
38760
|
/* @__PURE__ */ jsxs220(HStack, { pis: "md", align: "center", gap: "xl", children: [
|
|
38710
38761
|
/* @__PURE__ */ jsxs220(HStack, { align: "center", gap: "sm", children: [
|
|
38711
|
-
/* @__PURE__ */
|
|
38712
|
-
showCount && (totalCount ? /* @__PURE__ */
|
|
38762
|
+
/* @__PURE__ */ jsx346(Span, { weight: "bold", size: "lg", children: name }),
|
|
38763
|
+
showCount && (totalCount ? /* @__PURE__ */ jsx346(Badge, { variant: "default" /* DEFAULT */, size: "medium" /* MEDIUM */, children: totalCount }) : /* @__PURE__ */ jsx346(BadgeLoader, {}))
|
|
38713
38764
|
] }),
|
|
38714
|
-
HeaderFilters && /* @__PURE__ */
|
|
38765
|
+
HeaderFilters && /* @__PURE__ */ jsx346(HeaderFilters, {})
|
|
38715
38766
|
] }),
|
|
38716
38767
|
/* @__PURE__ */ jsxs220(HStack, { pie: "md", align: "center", gap: "3xs", children: [
|
|
38717
|
-
slotProps.SearchField && /* @__PURE__ */
|
|
38718
|
-
HeaderActions && /* @__PURE__ */
|
|
38768
|
+
slotProps.SearchField && /* @__PURE__ */ jsx346(SearchField, __spreadValues({}, slotProps.SearchField)),
|
|
38769
|
+
HeaderActions && /* @__PURE__ */ jsx346(HeaderActions, {})
|
|
38719
38770
|
] })
|
|
38720
38771
|
] }),
|
|
38721
38772
|
Filters2 && /* @__PURE__ */ jsxs220(HStack, { pis: "md", pie: "md", justify: "space-between", align: "center", className: "Layer__DataTableHeader__Filters", children: [
|
|
38722
|
-
/* @__PURE__ */
|
|
38723
|
-
slotProps.ClearFiltersButton && /* @__PURE__ */
|
|
38773
|
+
/* @__PURE__ */ jsx346(Filters2, {}),
|
|
38774
|
+
slotProps.ClearFiltersButton && /* @__PURE__ */ jsx346(Button2, __spreadProps(__spreadValues({ variant: "outlined" }, slotProps.ClearFiltersButton), { children: "Clear All Filters" }))
|
|
38724
38775
|
] })
|
|
38725
38776
|
] });
|
|
38726
38777
|
};
|
|
38727
38778
|
|
|
38728
38779
|
// src/components/Invoices/InvoicesTable/InvoicesTable.tsx
|
|
38729
38780
|
import { startOfToday, endOfYesterday } from "date-fns";
|
|
38730
|
-
import { jsx as
|
|
38781
|
+
import { jsx as jsx347, jsxs as jsxs221 } from "react/jsx-runtime";
|
|
38731
38782
|
var COMPONENT_NAME10 = "InvoicesTable";
|
|
38732
38783
|
var InvoiceStatusOptionConfig = {
|
|
38733
38784
|
["All" /* All */]: { label: "All", value: "All" /* All */ },
|
|
@@ -38748,11 +38799,11 @@ var AmountCell = ({ invoice }) => {
|
|
|
38748
38799
|
case "WRITTEN_OFF" /* WrittenOff */:
|
|
38749
38800
|
case "VOIDED" /* Voided */:
|
|
38750
38801
|
case "SENT" /* Sent */: {
|
|
38751
|
-
return /* @__PURE__ */
|
|
38802
|
+
return /* @__PURE__ */ jsx347(VStack, { children: /* @__PURE__ */ jsx347(Span, { align: "right", children: totalAmount }) });
|
|
38752
38803
|
}
|
|
38753
38804
|
case "PARTIALLY_PAID" /* PartiallyPaid */: {
|
|
38754
38805
|
return /* @__PURE__ */ jsxs221(VStack, { children: [
|
|
38755
|
-
/* @__PURE__ */
|
|
38806
|
+
/* @__PURE__ */ jsx347(Span, { align: "right", children: totalAmount }),
|
|
38756
38807
|
/* @__PURE__ */ jsxs221(Span, { align: "right", variant: "subtle", size: "sm", children: [
|
|
38757
38808
|
outstandingBalance,
|
|
38758
38809
|
" ",
|
|
@@ -38792,16 +38843,16 @@ var getColumnConfig = (onSelectInvoice) => ({
|
|
|
38792
38843
|
["Total" /* Total */]: {
|
|
38793
38844
|
id: "Total" /* Total */,
|
|
38794
38845
|
header: "Amount",
|
|
38795
|
-
cell: (row) => /* @__PURE__ */
|
|
38846
|
+
cell: (row) => /* @__PURE__ */ jsx347(AmountCell, { invoice: row })
|
|
38796
38847
|
},
|
|
38797
38848
|
["Status" /* Status */]: {
|
|
38798
38849
|
id: "Status" /* Status */,
|
|
38799
38850
|
header: "Status",
|
|
38800
|
-
cell: (row) => /* @__PURE__ */
|
|
38851
|
+
cell: (row) => /* @__PURE__ */ jsx347(InvoiceStatusCell, { invoice: row })
|
|
38801
38852
|
},
|
|
38802
38853
|
["Expand" /* Expand */]: {
|
|
38803
38854
|
id: "Expand" /* Expand */,
|
|
38804
|
-
cell: (row) => /* @__PURE__ */
|
|
38855
|
+
cell: (row) => /* @__PURE__ */ jsx347(Button2, { inset: true, icon: true, onPress: () => onSelectInvoice(row), "aria-label": "View invoice", variant: "ghost", children: /* @__PURE__ */ jsx347(ChevronRightFill_default, {}) })
|
|
38805
38856
|
}
|
|
38806
38857
|
});
|
|
38807
38858
|
var UNPAID_STATUSES2 = ["SENT" /* Sent */, "PARTIALLY_PAID" /* PartiallyPaid */];
|
|
@@ -38839,7 +38890,7 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38839
38890
|
const invoices = data == null ? void 0 : data.flatMap(({ data: data2 }) => data2);
|
|
38840
38891
|
const paginationMeta = data == null ? void 0 : data[data.length - 1].meta.pagination;
|
|
38841
38892
|
const hasMore = paginationMeta == null ? void 0 : paginationMeta.hasMore;
|
|
38842
|
-
const fetchMore =
|
|
38893
|
+
const fetchMore = useCallback58(() => {
|
|
38843
38894
|
if (hasMore) {
|
|
38844
38895
|
void setSize(size + 1);
|
|
38845
38896
|
}
|
|
@@ -38856,8 +38907,8 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38856
38907
|
const label = selectedInvoiceStatusOption == null ? void 0 : selectedInvoiceStatusOption.label;
|
|
38857
38908
|
return label ? `Status: ${label}` : "Status";
|
|
38858
38909
|
}, [selectedInvoiceStatusOption == null ? void 0 : selectedInvoiceStatusOption.label]);
|
|
38859
|
-
const StatusFilter =
|
|
38860
|
-
() => /* @__PURE__ */
|
|
38910
|
+
const StatusFilter = useCallback58(
|
|
38911
|
+
() => /* @__PURE__ */ jsx347(
|
|
38861
38912
|
ComboBox,
|
|
38862
38913
|
{
|
|
38863
38914
|
className: "Layer__InvoicesTable__StatusFilter",
|
|
@@ -38873,27 +38924,27 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38873
38924
|
),
|
|
38874
38925
|
[SelectedValue, options, selectedInvoiceStatusOption]
|
|
38875
38926
|
);
|
|
38876
|
-
const CreateInvoiceButton =
|
|
38927
|
+
const CreateInvoiceButton = useCallback58(
|
|
38877
38928
|
() => /* @__PURE__ */ jsxs221(Button2, { onPress: onCreateInvoice, children: [
|
|
38878
38929
|
"Create Invoice",
|
|
38879
|
-
/* @__PURE__ */
|
|
38930
|
+
/* @__PURE__ */ jsx347(Plus3, { size: 16 })
|
|
38880
38931
|
] }),
|
|
38881
38932
|
[onCreateInvoice]
|
|
38882
38933
|
);
|
|
38883
|
-
const InvoicesTableEmptyState =
|
|
38934
|
+
const InvoicesTableEmptyState = useCallback58(() => {
|
|
38884
38935
|
const isFiltered = selectedInvoiceStatusOption && selectedInvoiceStatusOption !== ALL_OPTION;
|
|
38885
|
-
return /* @__PURE__ */
|
|
38936
|
+
return /* @__PURE__ */ jsx347(
|
|
38886
38937
|
DataState,
|
|
38887
38938
|
{
|
|
38888
38939
|
status: "allDone" /* allDone */,
|
|
38889
38940
|
title: isFiltered ? "No results found" : "No invoices yet",
|
|
38890
38941
|
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.",
|
|
38891
|
-
icon: isFiltered ? /* @__PURE__ */
|
|
38942
|
+
icon: isFiltered ? /* @__PURE__ */ jsx347(Search2, {}) : /* @__PURE__ */ jsx347(HandCoins, {}),
|
|
38892
38943
|
spacing: true
|
|
38893
38944
|
}
|
|
38894
38945
|
);
|
|
38895
38946
|
}, [selectedInvoiceStatusOption]);
|
|
38896
|
-
const InvoicesTableErrorState =
|
|
38947
|
+
const InvoicesTableErrorState = useCallback58(() => /* @__PURE__ */ jsx347(
|
|
38897
38948
|
DataState,
|
|
38898
38949
|
{
|
|
38899
38950
|
status: "failed" /* failed */,
|
|
@@ -38907,7 +38958,7 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38907
38958
|
), [refetch]);
|
|
38908
38959
|
const columnConfig = useMemo76(() => getColumnConfig(onSelectInvoice), [onSelectInvoice]);
|
|
38909
38960
|
return /* @__PURE__ */ jsxs221(Container, { name: "InvoicesTable", children: [
|
|
38910
|
-
/* @__PURE__ */
|
|
38961
|
+
/* @__PURE__ */ jsx347(
|
|
38911
38962
|
DataTableHeader,
|
|
38912
38963
|
{
|
|
38913
38964
|
name: "Invoices",
|
|
@@ -38917,7 +38968,7 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38917
38968
|
}
|
|
38918
38969
|
}
|
|
38919
38970
|
),
|
|
38920
|
-
/* @__PURE__ */
|
|
38971
|
+
/* @__PURE__ */ jsx347(
|
|
38921
38972
|
PaginatedTable,
|
|
38922
38973
|
{
|
|
38923
38974
|
ariaLabel: "Invoices",
|
|
@@ -38937,38 +38988,38 @@ var InvoicesTable = ({ onCreateInvoice, onSelectInvoice }) => {
|
|
|
38937
38988
|
};
|
|
38938
38989
|
|
|
38939
38990
|
// src/components/Invoices/Invoices.tsx
|
|
38940
|
-
import { jsx as
|
|
38991
|
+
import { jsx as jsx348 } from "react/jsx-runtime";
|
|
38941
38992
|
var unstable_Invoices = ({
|
|
38942
38993
|
showTitle = true,
|
|
38943
38994
|
stringOverrides
|
|
38944
38995
|
}) => {
|
|
38945
38996
|
const [invoiceFormMode, setInvoiceFormMode] = useState87(null);
|
|
38946
|
-
const goBackToInvoicesTable =
|
|
38997
|
+
const goBackToInvoicesTable = useCallback59(() => {
|
|
38947
38998
|
setInvoiceFormMode(null);
|
|
38948
38999
|
}, []);
|
|
38949
|
-
const onCreateInvoice =
|
|
39000
|
+
const onCreateInvoice = useCallback59(() => {
|
|
38950
39001
|
setInvoiceFormMode({ mode: "Create" /* Create */ });
|
|
38951
39002
|
}, []);
|
|
38952
|
-
const onSelectInvoice =
|
|
39003
|
+
const onSelectInvoice = useCallback59((invoice) => {
|
|
38953
39004
|
setInvoiceFormMode({ mode: "Update" /* Update */, invoice });
|
|
38954
39005
|
}, []);
|
|
38955
|
-
return /* @__PURE__ */
|
|
39006
|
+
return /* @__PURE__ */ jsx348(
|
|
38956
39007
|
View,
|
|
38957
39008
|
{
|
|
38958
39009
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || "Invoices",
|
|
38959
39010
|
showHeader: showTitle,
|
|
38960
|
-
children: invoiceFormMode !== null ? /* @__PURE__ */
|
|
39011
|
+
children: invoiceFormMode !== null ? /* @__PURE__ */ jsx348(InvoiceDetail, __spreadProps(__spreadValues({}, invoiceFormMode), { onGoBack: goBackToInvoicesTable })) : /* @__PURE__ */ jsx348(InvoicesTable, { onCreateInvoice, onSelectInvoice })
|
|
38961
39012
|
}
|
|
38962
39013
|
);
|
|
38963
39014
|
};
|
|
38964
39015
|
|
|
38965
39016
|
// src/providers/BankTransactionsProvider/BankTransactionsProvider.tsx
|
|
38966
|
-
import { jsx as
|
|
39017
|
+
import { jsx as jsx349 } from "react/jsx-runtime";
|
|
38967
39018
|
var BankTransactionsProvider = ({
|
|
38968
39019
|
children
|
|
38969
39020
|
}) => {
|
|
38970
39021
|
const bankTransactionsContextData = useAugmentedBankTransactions();
|
|
38971
|
-
return /* @__PURE__ */
|
|
39022
|
+
return /* @__PURE__ */ jsx349(BankTransactionsContext.Provider, { value: bankTransactionsContextData, children });
|
|
38972
39023
|
};
|
|
38973
39024
|
export {
|
|
38974
39025
|
AccountingOverview,
|