business-obligations-ui 0.4.0 → 0.4.1
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 +115 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +63 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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,
|
|
874
|
-
var useI18n = () => (0,
|
|
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,
|
|
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
|
}
|
|
@@ -1460,7 +1521,7 @@ function writeProfileQuery(search, choices, defaults = PROFILE_DEFAULTS) {
|
|
|
1460
1521
|
}
|
|
1461
1522
|
|
|
1462
1523
|
// src/profile/store.tsx
|
|
1463
|
-
var
|
|
1524
|
+
var import_react4 = require("react");
|
|
1464
1525
|
|
|
1465
1526
|
// src/profile/place.ts
|
|
1466
1527
|
var import_business_obligations2 = require("business-obligations");
|
|
@@ -1517,7 +1578,7 @@ function setProfileQuery(patch, defaults = PROFILE_DEFAULTS) {
|
|
|
1517
1578
|
window.history.replaceState(window.history.state, "", `${pathname}${next}${hash}`);
|
|
1518
1579
|
window.dispatchEvent(new Event(CHANGE_EVENT));
|
|
1519
1580
|
}
|
|
1520
|
-
var Context = /* @__PURE__ */ (0,
|
|
1581
|
+
var Context = /* @__PURE__ */ (0, import_react4.createContext)({
|
|
1521
1582
|
defaults: PROFILE_DEFAULTS,
|
|
1522
1583
|
fixed: {},
|
|
1523
1584
|
place: {}
|
|
@@ -1527,44 +1588,44 @@ function ProfileQueryProvider({
|
|
|
1527
1588
|
values,
|
|
1528
1589
|
children
|
|
1529
1590
|
}) {
|
|
1530
|
-
const parent = (0,
|
|
1531
|
-
const merged = (0,
|
|
1532
|
-
const given = (0,
|
|
1591
|
+
const parent = (0, import_react4.useContext)(Context);
|
|
1592
|
+
const merged = (0, import_react4.useMemo)(() => ({ ...parent.defaults, ...defaults }), [parent.defaults, defaults]);
|
|
1593
|
+
const given = (0, import_react4.useMemo)(
|
|
1533
1594
|
() => Object.entries(values ?? {}).filter(([, value]) => value !== void 0),
|
|
1534
1595
|
[values]
|
|
1535
1596
|
);
|
|
1536
|
-
const fixed = (0,
|
|
1597
|
+
const fixed = (0, import_react4.useMemo)(
|
|
1537
1598
|
() => ({
|
|
1538
1599
|
...parent.fixed,
|
|
1539
1600
|
...Object.fromEntries(given.filter(([key]) => !PLACE_KEYS.includes(key)))
|
|
1540
1601
|
}),
|
|
1541
1602
|
[parent.fixed, given]
|
|
1542
1603
|
);
|
|
1543
|
-
const place = (0,
|
|
1604
|
+
const place = (0, import_react4.useMemo)(
|
|
1544
1605
|
() => ({
|
|
1545
1606
|
...parent.place,
|
|
1546
1607
|
...Object.fromEntries(given.filter(([key]) => PLACE_KEYS.includes(key)))
|
|
1547
1608
|
}),
|
|
1548
1609
|
[parent.place, given]
|
|
1549
1610
|
);
|
|
1550
|
-
const context = (0,
|
|
1611
|
+
const context = (0, import_react4.useMemo)(() => ({ defaults: merged, fixed, place }), [merged, fixed, place]);
|
|
1551
1612
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Context.Provider, { value: context, children });
|
|
1552
1613
|
}
|
|
1553
1614
|
var hasPlace = (place) => PLACE_KEYS.every((key) => place[key]);
|
|
1554
1615
|
function useFixedChoices() {
|
|
1555
|
-
const { fixed, place } = (0,
|
|
1556
|
-
return (0,
|
|
1616
|
+
const { fixed, place } = (0, import_react4.useContext)(Context);
|
|
1617
|
+
return (0, import_react4.useMemo)(() => {
|
|
1557
1618
|
const keys = new Set(Object.keys(fixed));
|
|
1558
1619
|
if (PLACE_KEYS.some((key) => place[key])) keys.add("zip");
|
|
1559
1620
|
return keys;
|
|
1560
1621
|
}, [fixed, place]);
|
|
1561
1622
|
}
|
|
1562
1623
|
function useProfilePlace() {
|
|
1563
|
-
const { place: fixedPlace } = (0,
|
|
1624
|
+
const { place: fixedPlace } = (0, import_react4.useContext)(Context);
|
|
1564
1625
|
const [{ zip }] = useProfileChoices();
|
|
1565
|
-
const [found, setFound] = (0,
|
|
1626
|
+
const [found, setFound] = (0, import_react4.useState)();
|
|
1566
1627
|
const complete = hasPlace(fixedPlace);
|
|
1567
|
-
(0,
|
|
1628
|
+
(0, import_react4.useEffect)(() => {
|
|
1568
1629
|
if (complete || !/^\d{5}$/.test(zip)) {
|
|
1569
1630
|
setFound(void 0);
|
|
1570
1631
|
return;
|
|
@@ -1575,20 +1636,20 @@ function useProfilePlace() {
|
|
|
1575
1636
|
current = false;
|
|
1576
1637
|
};
|
|
1577
1638
|
}, [zip, complete]);
|
|
1578
|
-
return (0,
|
|
1639
|
+
return (0, import_react4.useMemo)(() => {
|
|
1579
1640
|
if (complete) return fixedPlace;
|
|
1580
1641
|
if (!found) return found;
|
|
1581
1642
|
return { ...found, ...fixedPlace };
|
|
1582
1643
|
}, [complete, fixedPlace, found]);
|
|
1583
1644
|
}
|
|
1584
1645
|
function useProfileChoices() {
|
|
1585
|
-
const { defaults, fixed } = (0,
|
|
1586
|
-
const search = (0,
|
|
1587
|
-
const choices = (0,
|
|
1646
|
+
const { defaults, fixed } = (0, import_react4.useContext)(Context);
|
|
1647
|
+
const search = (0, import_react4.useSyncExternalStore)(subscribe, currentSearch, serverSearch);
|
|
1648
|
+
const choices = (0, import_react4.useMemo)(
|
|
1588
1649
|
() => ({ ...readProfileQuery(search, defaults), ...fixed }),
|
|
1589
1650
|
[search, defaults, fixed]
|
|
1590
1651
|
);
|
|
1591
|
-
const set = (0,
|
|
1652
|
+
const set = (0, import_react4.useCallback)(
|
|
1592
1653
|
(patch) => {
|
|
1593
1654
|
const open = Object.fromEntries(Object.entries(patch).filter(([key]) => !(key in fixed)));
|
|
1594
1655
|
setProfileQuery(open, defaults);
|
|
@@ -1599,7 +1660,7 @@ function useProfileChoices() {
|
|
|
1599
1660
|
}
|
|
1600
1661
|
|
|
1601
1662
|
// src/profile/ProfileForm.tsx
|
|
1602
|
-
var
|
|
1663
|
+
var import_react11 = require("react");
|
|
1603
1664
|
var import_business_obligations4 = require("business-obligations");
|
|
1604
1665
|
var import_tamagui15 = require("tamagui");
|
|
1605
1666
|
|
|
@@ -1644,7 +1705,7 @@ function ChoiceField({
|
|
|
1644
1705
|
}
|
|
1645
1706
|
|
|
1646
1707
|
// src/profile/fields/DateField.tsx
|
|
1647
|
-
var
|
|
1708
|
+
var import_react5 = require("react");
|
|
1648
1709
|
var import_tamagui10 = require("tamagui");
|
|
1649
1710
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1650
1711
|
var pad = (n) => String(n).padStart(2, "0");
|
|
@@ -1667,7 +1728,7 @@ function Calendar({
|
|
|
1667
1728
|
}) {
|
|
1668
1729
|
const { m, tag, date } = useI18n();
|
|
1669
1730
|
const start = /^\d{4}-\d{2}-\d{2}$/.test(value) ? value : min ?? todayIso();
|
|
1670
|
-
const [view, setView] = (0,
|
|
1731
|
+
const [view, setView] = (0, import_react5.useState)({ year: Number(start.slice(0, 4)), month: Number(start.slice(5, 7)) - 1 });
|
|
1671
1732
|
const shift = (by) => setView(({ year, month }) => {
|
|
1672
1733
|
const d = new Date(Date.UTC(year, month + by, 1));
|
|
1673
1734
|
return { year: d.getUTCFullYear(), month: d.getUTCMonth() };
|
|
@@ -1715,7 +1776,7 @@ function DateField({
|
|
|
1715
1776
|
clearable = false
|
|
1716
1777
|
}) {
|
|
1717
1778
|
const { m, date } = useI18n();
|
|
1718
|
-
const [open, setOpen] = (0,
|
|
1779
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
1719
1780
|
const controlProps = useControlProps();
|
|
1720
1781
|
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
1782
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_tamagui10.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1761,7 +1822,7 @@ function DateField({
|
|
|
1761
1822
|
}
|
|
1762
1823
|
|
|
1763
1824
|
// src/profile/fields/DetailsField.tsx
|
|
1764
|
-
var
|
|
1825
|
+
var import_react6 = require("react");
|
|
1765
1826
|
var import_tamagui11 = require("tamagui");
|
|
1766
1827
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1767
1828
|
var S_ELECTION_TYPES = ["pc", "benefit_corp"];
|
|
@@ -1772,8 +1833,8 @@ function AnswerBox({
|
|
|
1772
1833
|
onAnswer
|
|
1773
1834
|
}) {
|
|
1774
1835
|
const { m } = useI18n();
|
|
1775
|
-
const [mounted, setMounted] = (0,
|
|
1776
|
-
(0,
|
|
1836
|
+
const [mounted, setMounted] = (0, import_react6.useState)(false);
|
|
1837
|
+
(0, import_react6.useEffect)(() => setMounted(true), []);
|
|
1777
1838
|
const shown = answer2 === true && !mounted ? void 0 : answer2;
|
|
1778
1839
|
const next = answer2 === void 0 ? true : answer2 ? false : void 0;
|
|
1779
1840
|
const status = answer2 === void 0 ? m.profile.answers.unanswered : answer2 ? m.profile.answers.yes : m.profile.answers.no;
|
|
@@ -1809,8 +1870,8 @@ function AnswerBox({
|
|
|
1809
1870
|
function NotFormedBox({ id }) {
|
|
1810
1871
|
const { m } = useI18n();
|
|
1811
1872
|
const [choices, set] = useProfileChoices();
|
|
1812
|
-
const [mounted, setMounted] = (0,
|
|
1813
|
-
(0,
|
|
1873
|
+
const [mounted, setMounted] = (0, import_react6.useState)(false);
|
|
1874
|
+
(0, import_react6.useEffect)(() => setMounted(true), []);
|
|
1814
1875
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_tamagui11.XStack, { gap: "3", alignItems: "flex-start", paddingVertical: "1", children: [
|
|
1815
1876
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1816
1877
|
import_tamagui11.Checkbox,
|
|
@@ -1828,7 +1889,7 @@ function NotFormedBox({ id }) {
|
|
|
1828
1889
|
}
|
|
1829
1890
|
function DetailChecks({ legend }) {
|
|
1830
1891
|
const { m } = useI18n();
|
|
1831
|
-
const prefix = (0,
|
|
1892
|
+
const prefix = (0, import_react6.useId)();
|
|
1832
1893
|
const [choices, set] = useProfileChoices();
|
|
1833
1894
|
const fixed = useFixedChoices();
|
|
1834
1895
|
const shown = DETAIL_FIELDS.filter(
|
|
@@ -1879,7 +1940,7 @@ function DetailsField({ locale, messages: messages2, legend = true }) {
|
|
|
1879
1940
|
}
|
|
1880
1941
|
|
|
1881
1942
|
// src/profile/fields/IndustryField.tsx
|
|
1882
|
-
var
|
|
1943
|
+
var import_react7 = require("react");
|
|
1883
1944
|
var import_tamagui12 = require("tamagui");
|
|
1884
1945
|
|
|
1885
1946
|
// src/profile/validation.ts
|
|
@@ -1942,11 +2003,11 @@ function IndustryControl({ id }) {
|
|
|
1942
2003
|
const controlProps = useControlProps();
|
|
1943
2004
|
const listId = `${id}-list`;
|
|
1944
2005
|
const value = choices.naics;
|
|
1945
|
-
const [text2, setText] = (0,
|
|
1946
|
-
const [results, setResults] = (0,
|
|
1947
|
-
const [active, setActive] = (0,
|
|
1948
|
-
const [title, setTitle] = (0,
|
|
1949
|
-
const [unknown, setUnknown] = (0,
|
|
2006
|
+
const [text2, setText] = (0, import_react7.useState)(value);
|
|
2007
|
+
const [results, setResults] = (0, import_react7.useState)();
|
|
2008
|
+
const [active, setActive] = (0, import_react7.useState)(0);
|
|
2009
|
+
const [title, setTitle] = (0, import_react7.useState)("");
|
|
2010
|
+
const [unknown, setUnknown] = (0, import_react7.useState)(false);
|
|
1950
2011
|
const open = results !== void 0;
|
|
1951
2012
|
const error2 = firstError(naicsTextSchema, text2.trim()) ?? (unknown ? "naicsUnknown" : void 0);
|
|
1952
2013
|
const errorId = `${id}-error`;
|
|
@@ -1957,10 +2018,10 @@ function IndustryControl({ id }) {
|
|
|
1957
2018
|
"aria-autocomplete": "list",
|
|
1958
2019
|
"aria-activedescendant": open && results.length > 0 ? `${listId}-${active}` : void 0
|
|
1959
2020
|
};
|
|
1960
|
-
(0,
|
|
2021
|
+
(0, import_react7.useEffect)(() => {
|
|
1961
2022
|
setText((current) => /^\d*$/.test(current) && current !== value ? value : current);
|
|
1962
2023
|
}, [value]);
|
|
1963
|
-
(0,
|
|
2024
|
+
(0, import_react7.useEffect)(() => {
|
|
1964
2025
|
let current = true;
|
|
1965
2026
|
if (value.length !== 6) {
|
|
1966
2027
|
setTitle("");
|
|
@@ -2067,13 +2128,13 @@ function IndustryControl({ id }) {
|
|
|
2067
2128
|
] });
|
|
2068
2129
|
}
|
|
2069
2130
|
function IndustryField({ locale, messages: messages2, id }) {
|
|
2070
|
-
const generated = (0,
|
|
2131
|
+
const generated = (0, import_react7.useId)();
|
|
2071
2132
|
if (useFixedChoices().has("naics")) return null;
|
|
2072
2133
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WithLocale, { locale, messages: messages2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IndustryControl, { id: id ?? generated }) });
|
|
2073
2134
|
}
|
|
2074
2135
|
|
|
2075
2136
|
// src/profile/fields/NumberField.tsx
|
|
2076
|
-
var
|
|
2137
|
+
var import_react8 = require("react");
|
|
2077
2138
|
var import_tamagui13 = require("tamagui");
|
|
2078
2139
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2079
2140
|
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 +2152,8 @@ function NumberControl({
|
|
|
2091
2152
|
const { schema, strip, length } = kindSpec(kind);
|
|
2092
2153
|
const value = choices[field];
|
|
2093
2154
|
const shown = value === void 0 ? "" : String(value);
|
|
2094
|
-
const [draft, setDraft] = (0,
|
|
2095
|
-
(0,
|
|
2155
|
+
const [draft, setDraft] = (0, import_react8.useState)(shown);
|
|
2156
|
+
(0, import_react8.useEffect)(
|
|
2096
2157
|
// Keep what is being typed ("012", "12.") while it means the same number; otherwise follow the address.
|
|
2097
2158
|
() => setDraft((current) => current !== "" && Number(current) === value ? current : shown),
|
|
2098
2159
|
[value, shown]
|
|
@@ -2178,13 +2239,13 @@ function EmployeesField({
|
|
|
2178
2239
|
id,
|
|
2179
2240
|
placeholder
|
|
2180
2241
|
}) {
|
|
2181
|
-
const generated = (0,
|
|
2242
|
+
const generated = (0, import_react8.useId)();
|
|
2182
2243
|
if (useFixedChoices().has("employeeCount")) return null;
|
|
2183
2244
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WithLocale, { locale, messages: messages2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EmployeesControl, { id: id ?? generated, placeholder }) });
|
|
2184
2245
|
}
|
|
2185
2246
|
|
|
2186
2247
|
// src/profile/fields/TypeField.tsx
|
|
2187
|
-
var
|
|
2248
|
+
var import_react9 = require("react");
|
|
2188
2249
|
var import_business_obligations3 = require("business-obligations");
|
|
2189
2250
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2190
2251
|
function TypeControl({ id }) {
|
|
@@ -2204,13 +2265,13 @@ function TypeControl({ id }) {
|
|
|
2204
2265
|
) });
|
|
2205
2266
|
}
|
|
2206
2267
|
function TypeField({ locale, messages: messages2, id }) {
|
|
2207
|
-
const generated = (0,
|
|
2268
|
+
const generated = (0, import_react9.useId)();
|
|
2208
2269
|
if (useFixedChoices().has("entityType")) return null;
|
|
2209
2270
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WithLocale, { locale, messages: messages2, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypeControl, { id: id ?? generated }) });
|
|
2210
2271
|
}
|
|
2211
2272
|
|
|
2212
2273
|
// src/profile/fields/ZipField.tsx
|
|
2213
|
-
var
|
|
2274
|
+
var import_react10 = require("react");
|
|
2214
2275
|
var import_tamagui14 = require("tamagui");
|
|
2215
2276
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2216
2277
|
function ZipField({ id }) {
|
|
@@ -2218,9 +2279,9 @@ function ZipField({ id }) {
|
|
|
2218
2279
|
const [choices, set] = useProfileChoices();
|
|
2219
2280
|
const controlProps = useControlProps();
|
|
2220
2281
|
const zip = choices.zip;
|
|
2221
|
-
const [place, setPlace] = (0,
|
|
2222
|
-
const [unknown, setUnknown] = (0,
|
|
2223
|
-
(0,
|
|
2282
|
+
const [place, setPlace] = (0, import_react10.useState)("");
|
|
2283
|
+
const [unknown, setUnknown] = (0, import_react10.useState)(false);
|
|
2284
|
+
(0, import_react10.useEffect)(() => {
|
|
2224
2285
|
setUnknown(false);
|
|
2225
2286
|
if (zip.length !== 5) {
|
|
2226
2287
|
setPlace("");
|
|
@@ -2312,13 +2373,13 @@ function Full({ children }) {
|
|
|
2312
2373
|
function ProfileFormBody({ today, onFieldUsed }) {
|
|
2313
2374
|
const { m, tag } = useI18n();
|
|
2314
2375
|
const f = m.profileForm;
|
|
2315
|
-
const prefix = (0,
|
|
2376
|
+
const prefix = (0, import_react11.useId)();
|
|
2316
2377
|
const [choices, set] = useProfileChoices();
|
|
2317
2378
|
const fixed = useFixedChoices();
|
|
2318
2379
|
const now = today ?? todayIso();
|
|
2319
2380
|
const asOf = choices.asOf || now;
|
|
2320
|
-
const before = (0,
|
|
2321
|
-
(0,
|
|
2381
|
+
const before = (0, import_react11.useRef)(void 0);
|
|
2382
|
+
(0, import_react11.useEffect)(() => {
|
|
2322
2383
|
const previous = before.current;
|
|
2323
2384
|
before.current = choices;
|
|
2324
2385
|
if (!previous || !onFieldUsed) return;
|