business-obligations-ui 0.4.0 → 0.5.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/README.md CHANGED
@@ -106,11 +106,12 @@ const [choices] = useProfileChoices(); // { entityType, naics, employeeCount, se
106
106
 
107
107
  ## Conditionally applicable obligations
108
108
 
109
- `ObligationsList` takes an optional `conditional` list and shows it in its own section after the others: items that are
109
+ `ObligationsList` takes an optional `conditional` list and shows each of them inside the group of the level that requires it (city, county, state or federal), after the items
110
+ that do apply, dimmed and with what would bring it in: items that are
110
111
  not in `items` now, but would be if a detail that was left blank turned out a certain way. Each is a `ConditionalItem`,
111
112
  `{ item, when: [{ field, values }] }`, and its card says what would bring it in ("Applies if number of employees: 1, 2,
112
113
  3 …"). The package does not compute them; the playground does, from `analyzeInputs` and `evaluate`
113
- (`conditionalItems` in `apps/web/src/lib/plan.ts`). The list's filters apply to the section too.
114
+ (`conditionalItems` in `apps/web/src/lib/plan.ts`). The list's filters apply to them too. Groups run from the most local level to the widest: city, county, state, federal.
114
115
 
115
116
  ## Bundle size
116
117
 
package/dist/index.cjs CHANGED
@@ -739,6 +739,7 @@ function Collapse({
739
739
  }
740
740
 
741
741
  // src/shared/Select.tsx
742
+ var import_react2 = require("react");
742
743
  var import_tamagui5 = require("tamagui");
743
744
 
744
745
  // src/shared/ClearButton.tsx
@@ -788,6 +789,17 @@ var visuallyHidden = {
788
789
 
789
790
  // src/shared/Select.tsx
790
791
  var import_jsx_runtime4 = require("react/jsx-runtime");
792
+ var COARSE = "(pointer: coarse)";
793
+ var onCoarseChange = (notify) => {
794
+ const query = window.matchMedia(COARSE);
795
+ query.addEventListener("change", notify);
796
+ return () => query.removeEventListener("change", notify);
797
+ };
798
+ var useCoarsePointer = () => (0, import_react2.useSyncExternalStore)(
799
+ onCoarseChange,
800
+ () => window.matchMedia(COARSE).matches,
801
+ () => false
802
+ );
791
803
  function Select({
792
804
  id,
793
805
  value,
@@ -800,8 +812,57 @@ function Select({
800
812
  describedBy
801
813
  }) {
802
814
  const controlProps = useControlProps();
815
+ const touch = useCoarsePointer();
803
816
  const chosen = options.find((option) => option.value === value);
804
817
  const clearable = Boolean(onClear && chosen);
818
+ if (touch) {
819
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", width: "100%" }, children: [
820
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
821
+ "select",
822
+ {
823
+ id,
824
+ value,
825
+ onChange: (event) => onChange(event.target.value),
826
+ "aria-invalid": invalid || void 0,
827
+ "aria-describedby": describedBy,
828
+ style: {
829
+ width: "100%",
830
+ height: controlProps.height,
831
+ appearance: "none",
832
+ WebkitAppearance: "none",
833
+ borderRadius: 8,
834
+ border: `1px solid ${invalid ? "var(--red-600, #dc2626)" : "var(--border-color)"}`,
835
+ backgroundColor: "var(--background)",
836
+ color: chosen ? "var(--color)" : "var(--placeholder-color)",
837
+ // 16px stops iOS zooming on focus; the end padding leaves room for the chevron and the ✕
838
+ fontSize: Math.max(16, controlProps.fontSize),
839
+ padding: `0 ${clearable ? 56 : 32}px 0 12px`
840
+ },
841
+ children: [
842
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", disabled: !onClear, hidden: !onClear, children: placeholder }),
843
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: option.value, children: option.label }, option.value))
844
+ ]
845
+ }
846
+ ),
847
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
848
+ "svg",
849
+ {
850
+ "aria-hidden": true,
851
+ width: "12",
852
+ height: "12",
853
+ viewBox: "0 0 12 12",
854
+ fill: "none",
855
+ stroke: "var(--placeholder-color)",
856
+ strokeWidth: "1.5",
857
+ strokeLinecap: "round",
858
+ strokeLinejoin: "round",
859
+ style: { position: "absolute", right: 12, top: "50%", marginTop: -6, pointerEvents: "none" },
860
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M2.5 4.5 6 8l3.5-3.5" })
861
+ }
862
+ ),
863
+ clearable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton, { label: clearLabel, right: 26, onClear }) : null
864
+ ] });
865
+ }
805
866
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", width: "100%" }, children: [
806
867
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_tamagui5.Select, { value, onValueChange: onChange, children: [
807
868
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
@@ -859,7 +920,7 @@ function Select({
859
920
  var import_tamagui6 = require("tamagui");
860
921
 
861
922
  // src/i18n/context.tsx
862
- var import_react2 = require("react");
923
+ var import_react3 = require("react");
863
924
  var import_jsx_runtime5 = require("react/jsx-runtime");
864
925
  function createI18n(locale = "en", custom) {
865
926
  return {
@@ -870,14 +931,14 @@ function createI18n(locale = "en", custom) {
870
931
  relativeDays: (value, from) => relativeDays(value, from, locale)
871
932
  };
872
933
  }
873
- var I18nContext = /* @__PURE__ */ (0, import_react2.createContext)(/* @__PURE__ */ createI18n());
874
- var useI18n = () => (0, import_react2.useContext)(I18nContext);
934
+ var I18nContext = /* @__PURE__ */ (0, import_react3.createContext)(/* @__PURE__ */ createI18n());
935
+ var useI18n = () => (0, import_react3.useContext)(I18nContext);
875
936
  function WithLocale({
876
937
  locale,
877
938
  messages: messages2,
878
939
  children
879
940
  }) {
880
- const i18n = (0, import_react2.useMemo)(() => createI18n(locale, messages2), [locale, messages2]);
941
+ const i18n = (0, import_react3.useMemo)(() => createI18n(locale, messages2), [locale, messages2]);
881
942
  if (locale === void 0 && messages2 === void 0) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
882
943
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(I18nContext.Provider, { value: i18n, children });
883
944
  }
@@ -1166,7 +1227,7 @@ function describeWhen(m, { field, values }) {
1166
1227
  }
1167
1228
 
1168
1229
  // src/plan/filters.ts
1169
- var JURISDICTIONS = ["federal", "state", "county", "city"];
1230
+ var JURISDICTIONS = ["city", "county", "state", "federal"];
1170
1231
  var NO_OBLIGATION_FILTERS = {
1171
1232
  jurisdiction: "all",
1172
1233
  category: "all",
@@ -1197,6 +1258,7 @@ function ObligationsListBody({ items, conditional = [], asOf, filters, onFilters
1197
1258
  const shownConditional = conditional.filter(({ item }) => itemMatches(item, filters));
1198
1259
  const titleById = new Map(items.map((item) => [item.id, item.title]));
1199
1260
  const count = (jurisdiction) => items.filter((item) => itemMatches(item, { ...filters, jurisdiction })).length;
1261
+ const conditionalCount = (jurisdiction) => shownConditional.filter(({ item }) => item.jurisdiction === jurisdiction).length;
1200
1262
  const categoryCount = (category) => items.filter((item) => itemMatches(item, { ...filters, category })).length;
1201
1263
  const hasFilters = filters.jurisdiction !== "all" || filters.category !== "all" || filters.query !== "" || filters.trust !== "all";
1202
1264
  const clearFilters = () => onFilters({ ...NO_OBLIGATION_FILTERS });
@@ -1260,7 +1322,7 @@ function ObligationsListBody({ items, conditional = [], asOf, filters, onFilters
1260
1322
  {
1261
1323
  size: "sm",
1262
1324
  theme: filters.jurisdiction === key ? "accent" : void 0,
1263
- disabled: count(key) === 0 && key !== "all",
1325
+ disabled: count(key) + conditionalCount(key) === 0 && key !== "all",
1264
1326
  onPress: () => onFilters({ ...filters, jurisdiction: key }),
1265
1327
  "aria-pressed": filters.jurisdiction === key,
1266
1328
  children: [
@@ -1271,34 +1333,37 @@ function ObligationsListBody({ items, conditional = [], asOf, filters, onFilters
1271
1333
  },
1272
1334
  key
1273
1335
  )) }),
1336
+ shownConditional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.Text, { fontSize: "sm", color: "placeholder-color", children: m.conditionalNote }),
1274
1337
  filtered.length === 0 && shownConditional.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.Text, { color: "placeholder-color", children: m.noMatch }) : JURISDICTIONS.map((jurisdiction) => {
1275
- const group = filtered.filter((item) => item.jurisdiction === jurisdiction).sort((a, b) => (a.nextDue ?? "9999-12-31").localeCompare(b.nextDue ?? "9999-12-31"));
1276
- if (!group.length) return null;
1338
+ const byDue = (a, b) => (a.nextDue ?? "9999-12-31").localeCompare(b.nextDue ?? "9999-12-31");
1339
+ const group = filtered.filter((item) => item.jurisdiction === jurisdiction).sort(byDue);
1340
+ const maybe = shownConditional.filter(({ item }) => item.jurisdiction === jurisdiction).sort((a, b) => byDue(a.item, b.item));
1341
+ if (!group.length && !maybe.length) return null;
1277
1342
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_tamagui8.YStack, { children: [
1278
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_tamagui8.XStack, { gap: "2", alignItems: "center", paddingTop: "3", paddingBottom: "1", children: [
1343
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_tamagui8.XStack, { gap: "2", alignItems: "center", paddingTop: "3", paddingBottom: "1", flexWrap: "wrap", children: [
1279
1344
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.Text, { render: "h2", fontSize: "lg", fontWeight: "600", margin: 0, children: m.jurisdictions[jurisdiction] }),
1280
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chip, { tone: "info", children: group.length })
1345
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chip, { tone: "info", children: group.length }),
1346
+ maybe.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Chip, { tone: "warn", outline: true, children: [
1347
+ "+",
1348
+ maybe.length,
1349
+ " ",
1350
+ m.conditionalHeading.toLowerCase()
1351
+ ] })
1281
1352
  ] }),
1282
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.YStack, { gap: "3", children: group.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ObligationCard, { item, asOf, titleOf: (id) => titleById.get(id) }, item.id)) })
1353
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_tamagui8.YStack, { gap: "3", children: [
1354
+ group.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ObligationCard, { item, asOf, titleOf: (id) => titleById.get(id) }, item.id)),
1355
+ maybe.map(({ item, when }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.YStack, { opacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1356
+ ObligationCard,
1357
+ {
1358
+ item,
1359
+ asOf,
1360
+ titleOf: (id) => titleById.get(id),
1361
+ note: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.XStack, { gap: "1.5", flexWrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chip, { tone: "warn", outline: true, children: m.appliesIf(when.map((condition) => describeWhen(m, condition)).join("; ")) }) })
1362
+ }
1363
+ ) }, item.id))
1364
+ ] })
1283
1365
  ] }, jurisdiction);
1284
- }),
1285
- shownConditional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_tamagui8.YStack, { children: [
1286
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_tamagui8.XStack, { gap: "2", alignItems: "center", paddingTop: "3", paddingBottom: "1", children: [
1287
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.Text, { render: "h2", fontSize: "lg", fontWeight: "600", margin: 0, children: m.conditionalHeading }),
1288
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chip, { tone: "info", children: shownConditional.length })
1289
- ] }),
1290
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.Text, { fontSize: "sm", color: "placeholder-color", paddingBottom: "2", children: m.conditionalNote }),
1291
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.YStack, { gap: "3", children: shownConditional.map(({ item, when }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1292
- ObligationCard,
1293
- {
1294
- item,
1295
- asOf,
1296
- titleOf: (id) => titleById.get(id),
1297
- note: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tamagui8.XStack, { gap: "1.5", flexWrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Chip, { tone: "warn", outline: true, children: m.appliesIf(when.map((condition) => describeWhen(m, condition)).join("; ")) }) })
1298
- },
1299
- item.id
1300
- )) })
1301
- ] })
1366
+ })
1302
1367
  ] });
1303
1368
  }
1304
1369
 
@@ -1460,7 +1525,7 @@ function writeProfileQuery(search, choices, defaults = PROFILE_DEFAULTS) {
1460
1525
  }
1461
1526
 
1462
1527
  // src/profile/store.tsx
1463
- var import_react3 = require("react");
1528
+ var import_react4 = require("react");
1464
1529
 
1465
1530
  // src/profile/place.ts
1466
1531
  var import_business_obligations2 = require("business-obligations");
@@ -1517,7 +1582,7 @@ function setProfileQuery(patch, defaults = PROFILE_DEFAULTS) {
1517
1582
  window.history.replaceState(window.history.state, "", `${pathname}${next}${hash}`);
1518
1583
  window.dispatchEvent(new Event(CHANGE_EVENT));
1519
1584
  }
1520
- var Context = /* @__PURE__ */ (0, import_react3.createContext)({
1585
+ var Context = /* @__PURE__ */ (0, import_react4.createContext)({
1521
1586
  defaults: PROFILE_DEFAULTS,
1522
1587
  fixed: {},
1523
1588
  place: {}
@@ -1527,44 +1592,44 @@ function ProfileQueryProvider({
1527
1592
  values,
1528
1593
  children
1529
1594
  }) {
1530
- const parent = (0, import_react3.useContext)(Context);
1531
- const merged = (0, import_react3.useMemo)(() => ({ ...parent.defaults, ...defaults }), [parent.defaults, defaults]);
1532
- const given = (0, import_react3.useMemo)(
1595
+ const parent = (0, import_react4.useContext)(Context);
1596
+ const merged = (0, import_react4.useMemo)(() => ({ ...parent.defaults, ...defaults }), [parent.defaults, defaults]);
1597
+ const given = (0, import_react4.useMemo)(
1533
1598
  () => Object.entries(values ?? {}).filter(([, value]) => value !== void 0),
1534
1599
  [values]
1535
1600
  );
1536
- const fixed = (0, import_react3.useMemo)(
1601
+ const fixed = (0, import_react4.useMemo)(
1537
1602
  () => ({
1538
1603
  ...parent.fixed,
1539
1604
  ...Object.fromEntries(given.filter(([key]) => !PLACE_KEYS.includes(key)))
1540
1605
  }),
1541
1606
  [parent.fixed, given]
1542
1607
  );
1543
- const place = (0, import_react3.useMemo)(
1608
+ const place = (0, import_react4.useMemo)(
1544
1609
  () => ({
1545
1610
  ...parent.place,
1546
1611
  ...Object.fromEntries(given.filter(([key]) => PLACE_KEYS.includes(key)))
1547
1612
  }),
1548
1613
  [parent.place, given]
1549
1614
  );
1550
- const context = (0, import_react3.useMemo)(() => ({ defaults: merged, fixed, place }), [merged, fixed, place]);
1615
+ const context = (0, import_react4.useMemo)(() => ({ defaults: merged, fixed, place }), [merged, fixed, place]);
1551
1616
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Context.Provider, { value: context, children });
1552
1617
  }
1553
1618
  var hasPlace = (place) => PLACE_KEYS.every((key) => place[key]);
1554
1619
  function useFixedChoices() {
1555
- const { fixed, place } = (0, import_react3.useContext)(Context);
1556
- return (0, import_react3.useMemo)(() => {
1620
+ const { fixed, place } = (0, import_react4.useContext)(Context);
1621
+ return (0, import_react4.useMemo)(() => {
1557
1622
  const keys = new Set(Object.keys(fixed));
1558
1623
  if (PLACE_KEYS.some((key) => place[key])) keys.add("zip");
1559
1624
  return keys;
1560
1625
  }, [fixed, place]);
1561
1626
  }
1562
1627
  function useProfilePlace() {
1563
- const { place: fixedPlace } = (0, import_react3.useContext)(Context);
1628
+ const { place: fixedPlace } = (0, import_react4.useContext)(Context);
1564
1629
  const [{ zip }] = useProfileChoices();
1565
- const [found, setFound] = (0, import_react3.useState)();
1630
+ const [found, setFound] = (0, import_react4.useState)();
1566
1631
  const complete = hasPlace(fixedPlace);
1567
- (0, import_react3.useEffect)(() => {
1632
+ (0, import_react4.useEffect)(() => {
1568
1633
  if (complete || !/^\d{5}$/.test(zip)) {
1569
1634
  setFound(void 0);
1570
1635
  return;
@@ -1575,20 +1640,20 @@ function useProfilePlace() {
1575
1640
  current = false;
1576
1641
  };
1577
1642
  }, [zip, complete]);
1578
- return (0, import_react3.useMemo)(() => {
1643
+ return (0, import_react4.useMemo)(() => {
1579
1644
  if (complete) return fixedPlace;
1580
1645
  if (!found) return found;
1581
1646
  return { ...found, ...fixedPlace };
1582
1647
  }, [complete, fixedPlace, found]);
1583
1648
  }
1584
1649
  function useProfileChoices() {
1585
- const { defaults, fixed } = (0, import_react3.useContext)(Context);
1586
- const search = (0, import_react3.useSyncExternalStore)(subscribe, currentSearch, serverSearch);
1587
- const choices = (0, import_react3.useMemo)(
1650
+ const { defaults, fixed } = (0, import_react4.useContext)(Context);
1651
+ const search = (0, import_react4.useSyncExternalStore)(subscribe, currentSearch, serverSearch);
1652
+ const choices = (0, import_react4.useMemo)(
1588
1653
  () => ({ ...readProfileQuery(search, defaults), ...fixed }),
1589
1654
  [search, defaults, fixed]
1590
1655
  );
1591
- const set = (0, import_react3.useCallback)(
1656
+ const set = (0, import_react4.useCallback)(
1592
1657
  (patch) => {
1593
1658
  const open = Object.fromEntries(Object.entries(patch).filter(([key]) => !(key in fixed)));
1594
1659
  setProfileQuery(open, defaults);
@@ -1599,7 +1664,7 @@ function useProfileChoices() {
1599
1664
  }
1600
1665
 
1601
1666
  // src/profile/ProfileForm.tsx
1602
- var import_react10 = require("react");
1667
+ var import_react11 = require("react");
1603
1668
  var import_business_obligations4 = require("business-obligations");
1604
1669
  var import_tamagui15 = require("tamagui");
1605
1670
 
@@ -1644,7 +1709,7 @@ function ChoiceField({
1644
1709
  }
1645
1710
 
1646
1711
  // src/profile/fields/DateField.tsx
1647
- var import_react4 = require("react");
1712
+ var import_react5 = require("react");
1648
1713
  var import_tamagui10 = require("tamagui");
1649
1714
  var import_jsx_runtime13 = require("react/jsx-runtime");
1650
1715
  var pad = (n) => String(n).padStart(2, "0");
@@ -1667,7 +1732,7 @@ function Calendar({
1667
1732
  }) {
1668
1733
  const { m, tag, date } = useI18n();
1669
1734
  const start = /^\d{4}-\d{2}-\d{2}$/.test(value) ? value : min ?? todayIso();
1670
- const [view, setView] = (0, import_react4.useState)({ year: Number(start.slice(0, 4)), month: Number(start.slice(5, 7)) - 1 });
1735
+ const [view, setView] = (0, import_react5.useState)({ year: Number(start.slice(0, 4)), month: Number(start.slice(5, 7)) - 1 });
1671
1736
  const shift = (by) => setView(({ year, month }) => {
1672
1737
  const d = new Date(Date.UTC(year, month + by, 1));
1673
1738
  return { year: d.getUTCFullYear(), month: d.getUTCMonth() };
@@ -1715,7 +1780,7 @@ function DateField({
1715
1780
  clearable = false
1716
1781
  }) {
1717
1782
  const { m, date } = useI18n();
1718
- const [open, setOpen] = (0, import_react4.useState)(false);
1783
+ const [open, setOpen] = (0, import_react5.useState)(false);
1719
1784
  const controlProps = useControlProps();
1720
1785
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Labeled, { id, label, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_tamagui10.Popover, { open, onOpenChange: setOpen, placement: "top-start", children: [
1721
1786
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_tamagui10.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -1761,7 +1826,7 @@ function DateField({
1761
1826
  }
1762
1827
 
1763
1828
  // src/profile/fields/DetailsField.tsx
1764
- var import_react5 = require("react");
1829
+ var import_react6 = require("react");
1765
1830
  var import_tamagui11 = require("tamagui");
1766
1831
  var import_jsx_runtime14 = require("react/jsx-runtime");
1767
1832
  var S_ELECTION_TYPES = ["pc", "benefit_corp"];
@@ -1772,8 +1837,8 @@ function AnswerBox({
1772
1837
  onAnswer
1773
1838
  }) {
1774
1839
  const { m } = useI18n();
1775
- const [mounted, setMounted] = (0, import_react5.useState)(false);
1776
- (0, import_react5.useEffect)(() => setMounted(true), []);
1840
+ const [mounted, setMounted] = (0, import_react6.useState)(false);
1841
+ (0, import_react6.useEffect)(() => setMounted(true), []);
1777
1842
  const shown = answer2 === true && !mounted ? void 0 : answer2;
1778
1843
  const next = answer2 === void 0 ? true : answer2 ? false : void 0;
1779
1844
  const status = answer2 === void 0 ? m.profile.answers.unanswered : answer2 ? m.profile.answers.yes : m.profile.answers.no;
@@ -1809,8 +1874,8 @@ function AnswerBox({
1809
1874
  function NotFormedBox({ id }) {
1810
1875
  const { m } = useI18n();
1811
1876
  const [choices, set] = useProfileChoices();
1812
- const [mounted, setMounted] = (0, import_react5.useState)(false);
1813
- (0, import_react5.useEffect)(() => setMounted(true), []);
1877
+ const [mounted, setMounted] = (0, import_react6.useState)(false);
1878
+ (0, import_react6.useEffect)(() => setMounted(true), []);
1814
1879
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_tamagui11.XStack, { gap: "3", alignItems: "flex-start", paddingVertical: "1", children: [
1815
1880
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1816
1881
  import_tamagui11.Checkbox,
@@ -1828,7 +1893,7 @@ function NotFormedBox({ id }) {
1828
1893
  }
1829
1894
  function DetailChecks({ legend }) {
1830
1895
  const { m } = useI18n();
1831
- const prefix = (0, import_react5.useId)();
1896
+ const prefix = (0, import_react6.useId)();
1832
1897
  const [choices, set] = useProfileChoices();
1833
1898
  const fixed = useFixedChoices();
1834
1899
  const shown = DETAIL_FIELDS.filter(
@@ -1879,7 +1944,7 @@ function DetailsField({ locale, messages: messages2, legend = true }) {
1879
1944
  }
1880
1945
 
1881
1946
  // src/profile/fields/IndustryField.tsx
1882
- var import_react6 = require("react");
1947
+ var import_react7 = require("react");
1883
1948
  var import_tamagui12 = require("tamagui");
1884
1949
 
1885
1950
  // src/profile/validation.ts
@@ -1942,11 +2007,11 @@ function IndustryControl({ id }) {
1942
2007
  const controlProps = useControlProps();
1943
2008
  const listId = `${id}-list`;
1944
2009
  const value = choices.naics;
1945
- const [text2, setText] = (0, import_react6.useState)(value);
1946
- const [results, setResults] = (0, import_react6.useState)();
1947
- const [active, setActive] = (0, import_react6.useState)(0);
1948
- const [title, setTitle] = (0, import_react6.useState)("");
1949
- const [unknown, setUnknown] = (0, import_react6.useState)(false);
2010
+ const [text2, setText] = (0, import_react7.useState)(value);
2011
+ const [results, setResults] = (0, import_react7.useState)();
2012
+ const [active, setActive] = (0, import_react7.useState)(0);
2013
+ const [title, setTitle] = (0, import_react7.useState)("");
2014
+ const [unknown, setUnknown] = (0, import_react7.useState)(false);
1950
2015
  const open = results !== void 0;
1951
2016
  const error2 = firstError(naicsTextSchema, text2.trim()) ?? (unknown ? "naicsUnknown" : void 0);
1952
2017
  const errorId = `${id}-error`;
@@ -1957,10 +2022,10 @@ function IndustryControl({ id }) {
1957
2022
  "aria-autocomplete": "list",
1958
2023
  "aria-activedescendant": open && results.length > 0 ? `${listId}-${active}` : void 0
1959
2024
  };
1960
- (0, import_react6.useEffect)(() => {
2025
+ (0, import_react7.useEffect)(() => {
1961
2026
  setText((current) => /^\d*$/.test(current) && current !== value ? value : current);
1962
2027
  }, [value]);
1963
- (0, import_react6.useEffect)(() => {
2028
+ (0, import_react7.useEffect)(() => {
1964
2029
  let current = true;
1965
2030
  if (value.length !== 6) {
1966
2031
  setTitle("");
@@ -2067,13 +2132,13 @@ function IndustryControl({ id }) {
2067
2132
  ] });
2068
2133
  }
2069
2134
  function IndustryField({ locale, messages: messages2, id }) {
2070
- const generated = (0, import_react6.useId)();
2135
+ const generated = (0, import_react7.useId)();
2071
2136
  if (useFixedChoices().has("naics")) return null;
2072
2137
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WithLocale, { locale, messages: messages2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IndustryControl, { id: id ?? generated }) });
2073
2138
  }
2074
2139
 
2075
2140
  // src/profile/fields/NumberField.tsx
2076
- var import_react7 = require("react");
2141
+ var import_react8 = require("react");
2077
2142
  var import_tamagui13 = require("tamagui");
2078
2143
  var import_jsx_runtime16 = require("react/jsx-runtime");
2079
2144
  var kindSpec = (kind) => kind === "employees" ? { schema: employeesTextSchema, strip: /\D/g, length: String(MAX_EMPLOYEES).length } : kind === "owners" ? { schema: ownersTextSchema, strip: /\D/g, length: 9 } : kind === "whole" ? { schema: wholeTextSchema, strip: /\D/g, length: 9 } : { schema: amountTextSchema, strip: /[^\d.]/g, length: 15 };
@@ -2091,8 +2156,8 @@ function NumberControl({
2091
2156
  const { schema, strip, length } = kindSpec(kind);
2092
2157
  const value = choices[field];
2093
2158
  const shown = value === void 0 ? "" : String(value);
2094
- const [draft, setDraft] = (0, import_react7.useState)(shown);
2095
- (0, import_react7.useEffect)(
2159
+ const [draft, setDraft] = (0, import_react8.useState)(shown);
2160
+ (0, import_react8.useEffect)(
2096
2161
  // Keep what is being typed ("012", "12.") while it means the same number; otherwise follow the address.
2097
2162
  () => setDraft((current) => current !== "" && Number(current) === value ? current : shown),
2098
2163
  [value, shown]
@@ -2178,13 +2243,13 @@ function EmployeesField({
2178
2243
  id,
2179
2244
  placeholder
2180
2245
  }) {
2181
- const generated = (0, import_react7.useId)();
2246
+ const generated = (0, import_react8.useId)();
2182
2247
  if (useFixedChoices().has("employeeCount")) return null;
2183
2248
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WithLocale, { locale, messages: messages2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EmployeesControl, { id: id ?? generated, placeholder }) });
2184
2249
  }
2185
2250
 
2186
2251
  // src/profile/fields/TypeField.tsx
2187
- var import_react8 = require("react");
2252
+ var import_react9 = require("react");
2188
2253
  var import_business_obligations3 = require("business-obligations");
2189
2254
  var import_jsx_runtime17 = require("react/jsx-runtime");
2190
2255
  function TypeControl({ id }) {
@@ -2204,13 +2269,13 @@ function TypeControl({ id }) {
2204
2269
  ) });
2205
2270
  }
2206
2271
  function TypeField({ locale, messages: messages2, id }) {
2207
- const generated = (0, import_react8.useId)();
2272
+ const generated = (0, import_react9.useId)();
2208
2273
  if (useFixedChoices().has("entityType")) return null;
2209
2274
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WithLocale, { locale, messages: messages2, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypeControl, { id: id ?? generated }) });
2210
2275
  }
2211
2276
 
2212
2277
  // src/profile/fields/ZipField.tsx
2213
- var import_react9 = require("react");
2278
+ var import_react10 = require("react");
2214
2279
  var import_tamagui14 = require("tamagui");
2215
2280
  var import_jsx_runtime18 = require("react/jsx-runtime");
2216
2281
  function ZipField({ id }) {
@@ -2218,9 +2283,9 @@ function ZipField({ id }) {
2218
2283
  const [choices, set] = useProfileChoices();
2219
2284
  const controlProps = useControlProps();
2220
2285
  const zip = choices.zip;
2221
- const [place, setPlace] = (0, import_react9.useState)("");
2222
- const [unknown, setUnknown] = (0, import_react9.useState)(false);
2223
- (0, import_react9.useEffect)(() => {
2286
+ const [place, setPlace] = (0, import_react10.useState)("");
2287
+ const [unknown, setUnknown] = (0, import_react10.useState)(false);
2288
+ (0, import_react10.useEffect)(() => {
2224
2289
  setUnknown(false);
2225
2290
  if (zip.length !== 5) {
2226
2291
  setPlace("");
@@ -2312,13 +2377,13 @@ function Full({ children }) {
2312
2377
  function ProfileFormBody({ today, onFieldUsed }) {
2313
2378
  const { m, tag } = useI18n();
2314
2379
  const f = m.profileForm;
2315
- const prefix = (0, import_react10.useId)();
2380
+ const prefix = (0, import_react11.useId)();
2316
2381
  const [choices, set] = useProfileChoices();
2317
2382
  const fixed = useFixedChoices();
2318
2383
  const now = today ?? todayIso();
2319
2384
  const asOf = choices.asOf || now;
2320
- const before = (0, import_react10.useRef)(void 0);
2321
- (0, import_react10.useEffect)(() => {
2385
+ const before = (0, import_react11.useRef)(void 0);
2386
+ (0, import_react11.useEffect)(() => {
2322
2387
  const previous = before.current;
2323
2388
  before.current = choices;
2324
2389
  if (!previous || !onFieldUsed) return;