business-obligations-ui 0.6.0 → 0.7.0
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/index.cjs +43 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +50 -28
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -145,6 +145,7 @@ var en = {
|
|
|
145
145
|
annual: "Annual",
|
|
146
146
|
biennial: "Every 2 years",
|
|
147
147
|
every_five_years: "Every 5 years",
|
|
148
|
+
semiannual: "Twice a year",
|
|
148
149
|
quarterly: "Quarterly",
|
|
149
150
|
monthly: "Monthly",
|
|
150
151
|
per_event: "Per event",
|
|
@@ -380,6 +381,7 @@ var es = {
|
|
|
380
381
|
annual: "Anual",
|
|
381
382
|
biennial: "Cada 2 a\xF1os",
|
|
382
383
|
every_five_years: "Cada 5 a\xF1os",
|
|
384
|
+
semiannual: "Dos veces al a\xF1o",
|
|
383
385
|
quarterly: "Trimestral",
|
|
384
386
|
monthly: "Mensual",
|
|
385
387
|
per_event: "Por evento",
|
|
@@ -860,8 +862,23 @@ function Select({
|
|
|
860
862
|
const controlProps = useControlProps();
|
|
861
863
|
const touch = useCoarsePointer();
|
|
862
864
|
const [controlWidth, setControlWidth] = (0, import_react2.useState)(0);
|
|
865
|
+
const triggerRef = (0, import_react2.useRef)(null);
|
|
863
866
|
const chosen = options.find((option) => option.value === value);
|
|
864
867
|
const clearable = Boolean(onClear && chosen);
|
|
868
|
+
(0, import_react2.useEffect)(() => {
|
|
869
|
+
if (touch) return;
|
|
870
|
+
const trigger = triggerRef.current;
|
|
871
|
+
if (!trigger) return;
|
|
872
|
+
const update = () => setControlWidth(trigger.getBoundingClientRect().width);
|
|
873
|
+
update();
|
|
874
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
875
|
+
const observer = new ResizeObserver(update);
|
|
876
|
+
observer.observe(trigger);
|
|
877
|
+
return () => observer.disconnect();
|
|
878
|
+
}
|
|
879
|
+
window.addEventListener("resize", update);
|
|
880
|
+
return () => window.removeEventListener("resize", update);
|
|
881
|
+
}, [touch]);
|
|
865
882
|
if (touch) {
|
|
866
883
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", width: "100%" }, children: [
|
|
867
884
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -924,7 +941,7 @@ function Select({
|
|
|
924
941
|
"aria-invalid": invalid || void 0,
|
|
925
942
|
"aria-describedby": describedBy,
|
|
926
943
|
paddingRight: 8,
|
|
927
|
-
|
|
944
|
+
ref: triggerRef,
|
|
928
945
|
children: [
|
|
929
946
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
930
947
|
import_tamagui5.Select.Value,
|
|
@@ -1002,6 +1019,7 @@ function WithLocale({
|
|
|
1002
1019
|
}
|
|
1003
1020
|
|
|
1004
1021
|
// src/plan/chips.tsx
|
|
1022
|
+
var import_business_obligations = require("business-obligations");
|
|
1005
1023
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1006
1024
|
function Confidence({ item }) {
|
|
1007
1025
|
const { m, date } = useI18n();
|
|
@@ -1016,7 +1034,9 @@ function Confidence({ item }) {
|
|
|
1016
1034
|
}
|
|
1017
1035
|
function Fee({ item }) {
|
|
1018
1036
|
const { m, money } = useI18n();
|
|
1019
|
-
|
|
1037
|
+
if (!item.cost) return null;
|
|
1038
|
+
const amount = item.cost.amount !== void 0 ? money(item.cost.amount) : (0, import_business_obligations.describeFee)(item.cost);
|
|
1039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Chip, { children: m.fee(amount) });
|
|
1020
1040
|
}
|
|
1021
1041
|
|
|
1022
1042
|
// src/plan/items.ts
|
|
@@ -1343,6 +1363,9 @@ function ObligationsListBody({ items, conditional = [], asOf, filters, onFilters
|
|
|
1343
1363
|
const titleById = new Map(items.map((item) => [item.id, item.title]));
|
|
1344
1364
|
const count = (jurisdiction) => items.filter((item) => itemMatches(item, { ...filters, jurisdiction })).length;
|
|
1345
1365
|
const conditionalCount = (jurisdiction) => shownConditional.filter(({ item }) => item.jurisdiction === jurisdiction).length;
|
|
1366
|
+
const availableJurisdictions = JURISDICTIONS.filter(
|
|
1367
|
+
(jurisdiction) => items.some((item) => item.jurisdiction === jurisdiction) || conditional.some(({ item }) => item.jurisdiction === jurisdiction)
|
|
1368
|
+
);
|
|
1346
1369
|
const categoryCount = (category) => items.filter((item) => itemMatches(item, { ...filters, category })).length;
|
|
1347
1370
|
const hasFilters = filters.jurisdiction !== "all" || filters.category !== "all" || filters.query !== "" || filters.trust !== "all";
|
|
1348
1371
|
const clearFilters = () => onFilters({ ...NO_OBLIGATION_FILTERS });
|
|
@@ -1401,7 +1424,7 @@ function ObligationsListBody({ items, conditional = [], asOf, filters, onFilters
|
|
|
1401
1424
|
)
|
|
1402
1425
|
] })
|
|
1403
1426
|
] }),
|
|
1404
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.XStack, { gap: "1.5", flexWrap: "wrap", children: ["all", ...
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.XStack, { gap: "1.5", flexWrap: "wrap", children: ["all", ...availableJurisdictions].map((key) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1405
1428
|
import_tamagui8.Button,
|
|
1406
1429
|
{
|
|
1407
1430
|
size: "sm",
|
|
@@ -1452,7 +1475,7 @@ function ObligationsListBody({ items, conditional = [], asOf, filters, onFilters
|
|
|
1452
1475
|
}
|
|
1453
1476
|
|
|
1454
1477
|
// src/profile/choices.ts
|
|
1455
|
-
var
|
|
1478
|
+
var import_business_obligations2 = require("business-obligations");
|
|
1456
1479
|
var MAX_EMPLOYEES = 1e4;
|
|
1457
1480
|
var ISO_DATE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
1458
1481
|
var AMOUNT = /^\d{1,12}(\.\d{1,2})?$/;
|
|
@@ -1519,11 +1542,11 @@ var flag = (param, initial) => ({
|
|
|
1519
1542
|
var SPECS = {
|
|
1520
1543
|
zip: zipCode("zip"),
|
|
1521
1544
|
/** `undefined` means none chosen. */
|
|
1522
|
-
entityType: oneOf("type",
|
|
1545
|
+
entityType: oneOf("type", import_business_obligations2.ENTITY_TYPES),
|
|
1523
1546
|
/** NAICS code of the business, 2 to 6 digits (fewer while it is being typed), or "" for none. */
|
|
1524
1547
|
naics: text("naics", (raw) => /^\d{1,6}$/.test(raw) ? raw : void 0),
|
|
1525
|
-
profession: oneOf("profession",
|
|
1526
|
-
llcTaxClassification: oneOf("llcTax",
|
|
1548
|
+
profession: oneOf("profession", import_business_obligations2.PROFESSIONS),
|
|
1549
|
+
llcTaxClassification: oneOf("llcTax", import_business_obligations2.LLC_TAX_CLASSIFICATIONS),
|
|
1527
1550
|
/** False for a business that has not been formed yet (the default). */
|
|
1528
1551
|
isFormed: flag("formed", false),
|
|
1529
1552
|
/** ISO date, or "". Only meaningful for a business that is formed. */
|
|
@@ -1612,14 +1635,14 @@ function writeProfileQuery(search, choices, defaults = PROFILE_DEFAULTS) {
|
|
|
1612
1635
|
var import_react4 = require("react");
|
|
1613
1636
|
|
|
1614
1637
|
// src/profile/place.ts
|
|
1615
|
-
var
|
|
1638
|
+
var import_business_obligations3 = require("business-obligations");
|
|
1616
1639
|
var zipModule;
|
|
1617
1640
|
async function lookupPlace(zip) {
|
|
1618
1641
|
zipModule ??= import("business-obligations/zip");
|
|
1619
1642
|
const info = (await zipModule).lookupZip(zip);
|
|
1620
1643
|
return info ? { city: info.city, county: info.county, state: info.state } : void 0;
|
|
1621
1644
|
}
|
|
1622
|
-
var needsProfession = (choices) => ["pllc", "pc", "llp"].includes(choices.entityType ?? "") || (0,
|
|
1645
|
+
var needsProfession = (choices) => ["pllc", "pc", "llp"].includes(choices.entityType ?? "") || (0, import_business_obligations3.industryFromNaics)(choices.naics)?.industry === "professional_services";
|
|
1623
1646
|
function profileFromChoices(choices, place) {
|
|
1624
1647
|
const entityType = choices.entityType ?? "llc";
|
|
1625
1648
|
const profile = {
|
|
@@ -1749,7 +1772,7 @@ function useProfileChoices() {
|
|
|
1749
1772
|
|
|
1750
1773
|
// src/profile/ProfileForm.tsx
|
|
1751
1774
|
var import_react12 = require("react");
|
|
1752
|
-
var
|
|
1775
|
+
var import_business_obligations5 = require("business-obligations");
|
|
1753
1776
|
var import_tamagui16 = require("tamagui");
|
|
1754
1777
|
|
|
1755
1778
|
// src/profile/fields/controls.tsx
|
|
@@ -2423,7 +2446,7 @@ function EmployeesField({
|
|
|
2423
2446
|
|
|
2424
2447
|
// src/profile/fields/TypeField.tsx
|
|
2425
2448
|
var import_react10 = require("react");
|
|
2426
|
-
var
|
|
2449
|
+
var import_business_obligations4 = require("business-obligations");
|
|
2427
2450
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2428
2451
|
function TypeControl({ id }) {
|
|
2429
2452
|
const { m } = useI18n();
|
|
@@ -2433,7 +2456,7 @@ function TypeControl({ id }) {
|
|
|
2433
2456
|
{
|
|
2434
2457
|
id,
|
|
2435
2458
|
value: choices.entityType ?? "",
|
|
2436
|
-
options:
|
|
2459
|
+
options: import_business_obligations4.ENTITY_TYPES.map((type) => ({ value: type, label: m.profile.entityTypes[type] })),
|
|
2437
2460
|
placeholder: m.profile.entityTypePlaceholder,
|
|
2438
2461
|
clearLabel: m.profile.clear,
|
|
2439
2462
|
onChange: (type) => set({ entityType: type }),
|
|
@@ -2591,7 +2614,7 @@ function ProfileFormBody({ today, onFieldUsed }) {
|
|
|
2591
2614
|
label: f.profession,
|
|
2592
2615
|
value: choices.profession ?? "",
|
|
2593
2616
|
blank: f.professionPlaceholder,
|
|
2594
|
-
options:
|
|
2617
|
+
options: import_business_obligations5.PROFESSIONS.map((profession) => [profession, f.professions[profession]]),
|
|
2595
2618
|
onChange: (value) => set({ profession: value || void 0 })
|
|
2596
2619
|
}
|
|
2597
2620
|
) })
|
|
@@ -2630,19 +2653,18 @@ function ProfileFormBody({ today, onFieldUsed }) {
|
|
|
2630
2653
|
"priorYearPayrollTaxLiability"
|
|
2631
2654
|
) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SectionLabel, { children: f.money }),
|
|
2632
2655
|
MONEY_FIELDS.some((field) => shows(field)) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Group, { min: 130, end: true, children: [
|
|
2633
|
-
["annualPayroll", f.payroll, f.
|
|
2634
|
-
["annualRevenue", f.revenue, f.
|
|
2635
|
-
["annualNetIncome", f.netIncome, f.
|
|
2636
|
-
["largestContractorPaymentUsd", f.contractor, f.
|
|
2637
|
-
["priorYearPayrollTaxLiability", f.priorTax, f.
|
|
2656
|
+
["annualPayroll", f.payroll, f.examples.payroll],
|
|
2657
|
+
["annualRevenue", f.revenue, f.examples.revenue],
|
|
2658
|
+
["annualNetIncome", f.netIncome, f.examples.netIncome],
|
|
2659
|
+
["largestContractorPaymentUsd", f.contractor, f.examples.contractor],
|
|
2660
|
+
["priorYearPayrollTaxLiability", f.priorTax, f.examples.priorTax]
|
|
2638
2661
|
].map(
|
|
2639
|
-
([field, label,
|
|
2662
|
+
([field, label, example]) => shows(field) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2640
2663
|
NumberControl,
|
|
2641
2664
|
{
|
|
2642
2665
|
id: `${prefix}-${field}`,
|
|
2643
2666
|
field,
|
|
2644
2667
|
label,
|
|
2645
|
-
hint,
|
|
2646
2668
|
placeholder: example,
|
|
2647
2669
|
kind: "amount",
|
|
2648
2670
|
prefix: "$"
|
|
@@ -2671,7 +2693,7 @@ function ProfileFormBody({ today, onFieldUsed }) {
|
|
|
2671
2693
|
hint: f.hints.llcTax,
|
|
2672
2694
|
value: choices.llcTaxClassification ?? "",
|
|
2673
2695
|
blank: f.notSure,
|
|
2674
|
-
options:
|
|
2696
|
+
options: import_business_obligations5.LLC_TAX_CLASSIFICATIONS.map((kind) => [kind, f.llcTaxClassifications[kind]]),
|
|
2675
2697
|
onChange: (value) => set({
|
|
2676
2698
|
llcTaxClassification: value || void 0
|
|
2677
2699
|
})
|