@innspel/react-native 0.10.0 → 0.10.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 +206 -173
- 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 +219 -186
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -920,7 +920,10 @@ var tekst = {
|
|
|
920
920
|
lagtTil: "Lagt til",
|
|
921
921
|
tilleggTak: "Du har lagt til tre ganger. Har du mer, send et nytt innspill.",
|
|
922
922
|
tilleggLukket: "Saken er avsluttet \u2014 send et nytt innspill.",
|
|
923
|
+
/** F34: serverens egen setning (InnspelApiError) — aldri en rå feil. */
|
|
923
924
|
tilleggFeil: (arsak) => `Kunne ikke legge til: ${arsak} Teksten din er beholdt.`,
|
|
925
|
+
tilleggIngenNett: "Ingen nett. Teksten din er beholdt \u2014 pr\xF8v igjen n\xE5r du er p\xE5 nett.",
|
|
926
|
+
tilleggFeilGenerisk: "Kunne ikke legge til. Teksten din er beholdt \u2014 pr\xF8v igjen.",
|
|
924
927
|
sendNytt: "Send nytt innspill",
|
|
925
928
|
/** Tom tilstand: det finnes ikke noe «nytt» å sende når ingenting er sendt. */
|
|
926
929
|
sendForste: "Send innspill",
|
|
@@ -1597,7 +1600,7 @@ async function markerSvarSett(storage, n\u00E5 = Date.now()) {
|
|
|
1597
1600
|
|
|
1598
1601
|
// src/widget/MineInnspill.tsx
|
|
1599
1602
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1600
|
-
|
|
1603
|
+
var MineInnspill = (0, import_react9.forwardRef)(function MineInnspill2({
|
|
1601
1604
|
rader,
|
|
1602
1605
|
laster,
|
|
1603
1606
|
tenantName,
|
|
@@ -1606,8 +1609,9 @@ function MineInnspill({
|
|
|
1606
1609
|
leggTil,
|
|
1607
1610
|
onOppdatert,
|
|
1608
1611
|
minTextLength,
|
|
1609
|
-
textMaxLength
|
|
1610
|
-
|
|
1612
|
+
textMaxLength,
|
|
1613
|
+
utkastLager
|
|
1614
|
+
}, ref) {
|
|
1611
1615
|
const tema = useTema();
|
|
1612
1616
|
const min = minTextLength ?? 10;
|
|
1613
1617
|
const maks = textMaxLength ?? 280;
|
|
@@ -1616,6 +1620,35 @@ function MineInnspill({
|
|
|
1616
1620
|
const [sender, setSender] = (0, import_react9.useState)(false);
|
|
1617
1621
|
const [feil, setFeil] = (0, import_react9.useState)();
|
|
1618
1622
|
const [lagtTil, setLagtTil] = (0, import_react9.useState)();
|
|
1623
|
+
const egetLager = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
|
|
1624
|
+
const lager = utkastLager ?? egetLager.current;
|
|
1625
|
+
const rulleRef = (0, import_react9.useRef)(null);
|
|
1626
|
+
const kortY = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
|
|
1627
|
+
const apneFelt = (id) => {
|
|
1628
|
+
setApen(id);
|
|
1629
|
+
setUtkast(lager.get(id) ?? "");
|
|
1630
|
+
setFeil(void 0);
|
|
1631
|
+
setLagtTil(void 0);
|
|
1632
|
+
const y = kortY.current.get(id);
|
|
1633
|
+
if (y !== void 0) rulleRef.current?.scrollTo({ y, animated: true });
|
|
1634
|
+
};
|
|
1635
|
+
const lukkFelt = () => {
|
|
1636
|
+
if (apen === null) return false;
|
|
1637
|
+
import_react_native7.Keyboard.dismiss();
|
|
1638
|
+
if (utkast.trim()) lager.set(apen, utkast);
|
|
1639
|
+
else lager.delete(apen);
|
|
1640
|
+
setApen(null);
|
|
1641
|
+
setUtkast("");
|
|
1642
|
+
setFeil(void 0);
|
|
1643
|
+
return true;
|
|
1644
|
+
};
|
|
1645
|
+
const avbryt = () => {
|
|
1646
|
+
if (apen !== null) lager.delete(apen);
|
|
1647
|
+
setApen(null);
|
|
1648
|
+
setUtkast("");
|
|
1649
|
+
setFeil(void 0);
|
|
1650
|
+
};
|
|
1651
|
+
(0, import_react9.useImperativeHandle)(ref, () => ({ lukkFelt }));
|
|
1619
1652
|
const send = async (id) => {
|
|
1620
1653
|
if (!leggTil) return;
|
|
1621
1654
|
setSender(true);
|
|
@@ -1623,12 +1656,13 @@ function MineInnspill({
|
|
|
1623
1656
|
try {
|
|
1624
1657
|
const sak = await leggTil(id, utkast.trim());
|
|
1625
1658
|
onOppdatert?.(sak);
|
|
1659
|
+
lager.delete(id);
|
|
1626
1660
|
setApen(null);
|
|
1627
1661
|
setUtkast("");
|
|
1628
1662
|
setLagtTil(id);
|
|
1629
1663
|
} catch (e) {
|
|
1630
1664
|
const kode = e instanceof import_core.InnspelApiError ? e.code : void 0;
|
|
1631
|
-
const tekstFeil = kode === "addendum_limit_reached" ? tekst.tilleggTak : kode === "submission_closed" ? tekst.tilleggLukket :
|
|
1665
|
+
const tekstFeil = kode === "addendum_limit_reached" ? tekst.tilleggTak : kode === "submission_closed" ? tekst.tilleggLukket : e instanceof import_core.InnspelApiError && e.message ? tekst.tilleggFeil(e.message) : e instanceof import_core.NettverksFeil ? tekst.tilleggIngenNett : tekst.tilleggFeilGenerisk;
|
|
1632
1666
|
setFeil({ id, tekst: tekstFeil });
|
|
1633
1667
|
} finally {
|
|
1634
1668
|
setSender(false);
|
|
@@ -1651,7 +1685,7 @@ function MineInnspill({
|
|
|
1651
1685
|
}, [storage, laster, rader]);
|
|
1652
1686
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { flex: 1, gap: tema.space.md }, children: [
|
|
1653
1687
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(H, { sub: tekst.mineUnder, children: tekst.mineTittel }),
|
|
1654
|
-
laster ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.ActivityIndicator, { accessibilityLabel: "Henter innspillene dine", color: tema.color.textSecondary }) : rader.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.mineTom }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.ScrollView, { style: { flex: 1 }, contentContainerStyle: { gap: tema.space.sm }, children: visning.map(({ rad, nytt }) => {
|
|
1688
|
+
laster ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.ActivityIndicator, { accessibilityLabel: "Henter innspillene dine", color: tema.color.textSecondary }) : rader.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.mineTom }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.ScrollView, { ref: rulleRef, style: { flex: 1 }, contentContainerStyle: { gap: tema.space.sm }, keyboardShouldPersistTaps: "handled", children: visning.map(({ rad, nytt }) => {
|
|
1655
1689
|
const venter = rad.pending === true;
|
|
1656
1690
|
const v = venter ? venterVisning : statusVisning(rad.status, rad.type, rad.deadlineAt);
|
|
1657
1691
|
const nokkel = venter ? rad.clientRef : rad.id;
|
|
@@ -1662,190 +1696,184 @@ function MineInnspill({
|
|
|
1662
1696
|
const taketN\u00E5dd = !venter && rad.canAddAddendum === false && tillegg.length >= 3;
|
|
1663
1697
|
const feltApent = sakId !== void 0 && apen === sakId;
|
|
1664
1698
|
const brukt = utkast.length;
|
|
1665
|
-
const forKort = brukt < min;
|
|
1666
1699
|
const full = brukt >= maks;
|
|
1667
1700
|
const visTeller = brukt >= maks * 0.8;
|
|
1668
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
{
|
|
1674
|
-
testID: "nytt-svar",
|
|
1675
|
-
style: {
|
|
1676
|
-
color: tema.color.info,
|
|
1677
|
-
backgroundColor: tema.color.infoBg,
|
|
1678
|
-
fontSize: tema.font.tiny,
|
|
1679
|
-
fontWeight: tema.weight.semibold,
|
|
1680
|
-
borderRadius: tema.radius.pill,
|
|
1681
|
-
paddingHorizontal: tema.space.sm
|
|
1682
|
-
},
|
|
1683
|
-
children: tekst.nyttSvar
|
|
1684
|
-
}
|
|
1685
|
-
) : null
|
|
1686
|
-
] }),
|
|
1687
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1688
|
-
import_react_native7.Text,
|
|
1689
|
-
{
|
|
1690
|
-
style: {
|
|
1691
|
-
color: tema.color.textPrimary,
|
|
1692
|
-
fontSize: tema.font.body,
|
|
1693
|
-
lineHeight: tema.lineHeight.body
|
|
1694
|
-
},
|
|
1695
|
-
children: rad.text
|
|
1696
|
-
}
|
|
1697
|
-
),
|
|
1698
|
-
tillegg.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.View, { testID: `tillegg-${sakId}`, style: { gap: tema.space.xs }, children: tillegg.map((a) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1699
|
-
import_react_native7.View,
|
|
1700
|
-
{
|
|
1701
|
-
style: {
|
|
1702
|
-
borderLeftWidth: tema.hairline * 2,
|
|
1703
|
-
borderLeftColor: tema.color.border,
|
|
1704
|
-
paddingLeft: tema.space.sm,
|
|
1705
|
-
gap: tema.space.xs
|
|
1706
|
-
},
|
|
1707
|
-
children: [
|
|
1708
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { flexDirection: "row", alignItems: "center", gap: tema.space.xs }, children: [
|
|
1709
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ikon, { navn: "add-outline", storrelse: "minste", farge: tema.color.textSecondary }),
|
|
1710
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: tekst.duLaTil(formaterFrist(a.createdAt)) })
|
|
1711
|
-
] }),
|
|
1712
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textPrimary, fontSize: tema.font.small, lineHeight: tema.lineHeight.small }, children: a.text })
|
|
1713
|
-
]
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1702
|
+
import_react_native7.View,
|
|
1703
|
+
{
|
|
1704
|
+
onLayout: (e) => {
|
|
1705
|
+
if (sakId !== void 0) kortY.current.set(sakId, e.nativeEvent.layout.y);
|
|
1714
1706
|
},
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
autoFocus: true,
|
|
1735
|
-
placeholder: tekst.leggTilMerPlaceholder,
|
|
1736
|
-
placeholderTextColor: tema.color.textMuted,
|
|
1737
|
-
style: {
|
|
1738
|
-
backgroundColor: tema.color.surfaceRaised,
|
|
1739
|
-
borderWidth: tema.hairline,
|
|
1740
|
-
borderColor: full ? tema.color.warning : tema.color.borderStrong,
|
|
1741
|
-
borderRadius: tema.radius.md,
|
|
1742
|
-
padding: tema.space.md,
|
|
1743
|
-
color: tema.color.textPrimary,
|
|
1744
|
-
fontSize: tema.font.body,
|
|
1745
|
-
lineHeight: tema.lineHeight.body,
|
|
1746
|
-
minHeight: tema.touch * 2,
|
|
1747
|
-
textAlignVertical: "top"
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
),
|
|
1751
|
-
visTeller ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1752
|
-
import_react_native7.Text,
|
|
1753
|
-
{
|
|
1754
|
-
testID: "tillegg-teller",
|
|
1755
|
-
accessibilityLiveRegion: full ? "assertive" : "polite",
|
|
1756
|
-
style: { alignSelf: "flex-end", color: full ? tema.color.warning : tema.color.textMuted, fontSize: tema.font.small },
|
|
1757
|
-
children: [
|
|
1758
|
-
brukt,
|
|
1759
|
-
" / ",
|
|
1760
|
-
maks,
|
|
1761
|
-
full ? tekst.tellerFull : ""
|
|
1762
|
-
]
|
|
1763
|
-
}
|
|
1764
|
-
) : null,
|
|
1765
|
-
feil?.id === sakId ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { accessibilityLiveRegion: "assertive", testID: `tillegg-feil-${sakId}`, style: { color: tema.color.danger, fontSize: tema.font.small, lineHeight: tema.lineHeight.small }, children: feil.tekst }) : null,
|
|
1766
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { flexDirection: "row", gap: tema.space.sm }, children: [
|
|
1707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Card, { dashed: venter, children: [
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { flexDirection: "row", alignItems: "center", gap: tema.space.xs, flexWrap: "wrap" }, children: [
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: venter ? `${tekst.mineIkkeSendt} \xB7 ${rad.type === "onske" ? tekst.onske : tekst.feil}` : tekst.sakHode(rad.type === "onske" ? tekst.onske : tekst.feil, rad.id) }),
|
|
1710
|
+
nytt ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1711
|
+
import_react_native7.Text,
|
|
1712
|
+
{
|
|
1713
|
+
testID: "nytt-svar",
|
|
1714
|
+
style: {
|
|
1715
|
+
color: tema.color.info,
|
|
1716
|
+
backgroundColor: tema.color.infoBg,
|
|
1717
|
+
fontSize: tema.font.tiny,
|
|
1718
|
+
fontWeight: tema.weight.semibold,
|
|
1719
|
+
borderRadius: tema.radius.pill,
|
|
1720
|
+
paddingHorizontal: tema.space.sm
|
|
1721
|
+
},
|
|
1722
|
+
children: tekst.nyttSvar
|
|
1723
|
+
}
|
|
1724
|
+
) : null
|
|
1725
|
+
] }),
|
|
1767
1726
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1768
|
-
|
|
1727
|
+
import_react_native7.Text,
|
|
1769
1728
|
{
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
grow: true
|
|
1729
|
+
style: {
|
|
1730
|
+
color: tema.color.textPrimary,
|
|
1731
|
+
fontSize: tema.font.body,
|
|
1732
|
+
lineHeight: tema.lineHeight.body
|
|
1733
|
+
},
|
|
1734
|
+
children: rad.text
|
|
1777
1735
|
}
|
|
1778
1736
|
),
|
|
1779
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1780
|
-
|
|
1737
|
+
tillegg.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.View, { testID: `tillegg-${sakId}`, style: { gap: tema.space.xs }, children: tillegg.map((a) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1738
|
+
import_react_native7.View,
|
|
1781
1739
|
{
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
setUtkast("");
|
|
1788
|
-
setFeil(void 0);
|
|
1740
|
+
style: {
|
|
1741
|
+
borderLeftWidth: tema.hairline * 2,
|
|
1742
|
+
borderLeftColor: tema.color.border,
|
|
1743
|
+
paddingLeft: tema.space.sm,
|
|
1744
|
+
gap: tema.space.xs
|
|
1789
1745
|
},
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
},
|
|
1808
|
-
style: { alignSelf: "flex-start", minHeight: tema.touch, flexDirection: "row", alignItems: "center", gap: tema.space.xs, paddingHorizontal: tema.space.sm },
|
|
1809
|
-
children: [
|
|
1810
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ikon, { navn: "add-outline", storrelse: "minste", farge: tema.color.actionSecondaryText }),
|
|
1811
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.actionSecondaryText, fontSize: tema.font.body, fontWeight: tema.weight.semibold }, children: tekst.leggTilMer })
|
|
1812
|
-
]
|
|
1813
|
-
}
|
|
1814
|
-
) : taketN\u00E5dd ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.tilleggTak }) : null,
|
|
1815
|
-
!venter && rad.attachmentRemoved ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { testID: `bilde-fjernet-${rad.id}`, style: { flexDirection: "row", gap: tema.space.xs, alignItems: "center" }, children: [
|
|
1816
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ikon, { navn: "trash-outline", storrelse: "minste", farge: tema.color.textMuted }),
|
|
1817
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.bildeFjernet })
|
|
1818
|
-
] }) : null,
|
|
1819
|
-
svar ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1820
|
-
import_react_native7.View,
|
|
1821
|
-
{
|
|
1822
|
-
style: {
|
|
1823
|
-
borderLeftWidth: tema.hairline * 2,
|
|
1824
|
-
borderLeftColor: tema.color.brand,
|
|
1825
|
-
paddingLeft: tema.space.sm,
|
|
1826
|
-
gap: tema.space.xs
|
|
1827
|
-
},
|
|
1828
|
-
children: [
|
|
1829
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: tenantName ? tekst.svarFra(tenantName) : tekst.svarFraGenerisk }),
|
|
1746
|
+
children: [
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { flexDirection: "row", alignItems: "center", gap: tema.space.xs }, children: [
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ikon, { navn: "add-outline", storrelse: "minste", farge: tema.color.textSecondary }),
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: tekst.duLaTil(formaterFrist(a.createdAt)) })
|
|
1750
|
+
] }),
|
|
1751
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textPrimary, fontSize: tema.font.small, lineHeight: tema.lineHeight.small }, children: a.text })
|
|
1752
|
+
]
|
|
1753
|
+
},
|
|
1754
|
+
a.id
|
|
1755
|
+
)) }) : null,
|
|
1756
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { gap: tema.space.xs }, children: [
|
|
1757
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatusPill, { ikon: v.ikon, etikett: v.etikett, fg: v.fg, bg: v.bg }),
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: v.lofte })
|
|
1759
|
+
] }),
|
|
1760
|
+
sakId !== void 0 && lagtTil === sakId ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { accessibilityLiveRegion: "polite", testID: `lagt-til-${sakId}`, style: { color: tema.color.success, fontSize: tema.font.small }, children: tekst.lagtTil }) : null,
|
|
1761
|
+
feltApent ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { testID: `tillegg-felt-${sakId}`, style: { gap: tema.space.sm }, children: [
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: tekst.leggTilMerLabel }),
|
|
1830
1763
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1831
|
-
import_react_native7.
|
|
1764
|
+
import_react_native7.TextInput,
|
|
1832
1765
|
{
|
|
1766
|
+
testID: "tillegg-tekst",
|
|
1767
|
+
accessibilityLabel: tekst.leggTilMerLabel,
|
|
1768
|
+
value: utkast,
|
|
1769
|
+
onChangeText: setUtkast,
|
|
1770
|
+
maxLength: maks,
|
|
1771
|
+
multiline: true,
|
|
1772
|
+
numberOfLines: 3,
|
|
1773
|
+
autoFocus: true,
|
|
1774
|
+
placeholder: tekst.leggTilMerPlaceholder,
|
|
1775
|
+
placeholderTextColor: tema.color.textMuted,
|
|
1833
1776
|
style: {
|
|
1777
|
+
backgroundColor: tema.color.surfaceRaised,
|
|
1778
|
+
borderWidth: tema.hairline,
|
|
1779
|
+
borderColor: full ? tema.color.warning : tema.color.borderStrong,
|
|
1780
|
+
borderRadius: tema.radius.md,
|
|
1781
|
+
padding: tema.space.md,
|
|
1834
1782
|
color: tema.color.textPrimary,
|
|
1835
|
-
fontSize: tema.font.
|
|
1836
|
-
lineHeight: tema.lineHeight.
|
|
1837
|
-
|
|
1838
|
-
|
|
1783
|
+
fontSize: tema.font.body,
|
|
1784
|
+
lineHeight: tema.lineHeight.body,
|
|
1785
|
+
minHeight: tema.touch * 2,
|
|
1786
|
+
textAlignVertical: "top"
|
|
1787
|
+
}
|
|
1839
1788
|
}
|
|
1840
|
-
)
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1789
|
+
),
|
|
1790
|
+
visTeller ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1791
|
+
import_react_native7.Text,
|
|
1792
|
+
{
|
|
1793
|
+
testID: "tillegg-teller",
|
|
1794
|
+
accessibilityLiveRegion: full ? "assertive" : "polite",
|
|
1795
|
+
style: { alignSelf: "flex-end", color: full ? tema.color.warning : tema.color.textMuted, fontSize: tema.font.small },
|
|
1796
|
+
children: [
|
|
1797
|
+
brukt,
|
|
1798
|
+
" / ",
|
|
1799
|
+
maks,
|
|
1800
|
+
full ? tekst.tellerFull : ""
|
|
1801
|
+
]
|
|
1802
|
+
}
|
|
1803
|
+
) : null,
|
|
1804
|
+
feil?.id === sakId ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { accessibilityLiveRegion: "assertive", testID: `tillegg-feil-${sakId}`, style: { color: tema.color.danger, fontSize: tema.font.small, lineHeight: tema.lineHeight.small }, children: feil.tekst }) : null
|
|
1805
|
+
] }) : kanLeggeTil ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1806
|
+
import_react_native7.Pressable,
|
|
1807
|
+
{
|
|
1808
|
+
testID: `legg-til-mer-${sakId}`,
|
|
1809
|
+
accessibilityRole: "button",
|
|
1810
|
+
accessibilityLabel: tekst.leggTilMerLabel,
|
|
1811
|
+
onPress: () => sakId !== void 0 && apneFelt(sakId),
|
|
1812
|
+
style: { alignSelf: "flex-start", minHeight: tema.touch, flexDirection: "row", alignItems: "center", gap: tema.space.xs, paddingHorizontal: tema.space.sm },
|
|
1813
|
+
children: [
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ikon, { navn: "add-outline", storrelse: "minste", farge: tema.color.actionSecondaryText }),
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.actionSecondaryText, fontSize: tema.font.body, fontWeight: tema.weight.semibold }, children: tekst.leggTilMer })
|
|
1816
|
+
]
|
|
1817
|
+
}
|
|
1818
|
+
) : taketN\u00E5dd ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.tilleggTak }) : null,
|
|
1819
|
+
!venter && rad.attachmentRemoved ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { testID: `bilde-fjernet-${rad.id}`, style: { flexDirection: "row", gap: tema.space.xs, alignItems: "center" }, children: [
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Ikon, { navn: "trash-outline", storrelse: "minste", farge: tema.color.textMuted }),
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.bildeFjernet })
|
|
1822
|
+
] }) : null,
|
|
1823
|
+
svar ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1824
|
+
import_react_native7.View,
|
|
1825
|
+
{
|
|
1826
|
+
style: {
|
|
1827
|
+
borderLeftWidth: tema.hairline * 2,
|
|
1828
|
+
borderLeftColor: tema.color.brand,
|
|
1829
|
+
paddingLeft: tema.space.sm,
|
|
1830
|
+
gap: tema.space.xs
|
|
1831
|
+
},
|
|
1832
|
+
children: [
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native7.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: tenantName ? tekst.svarFra(tenantName) : tekst.svarFraGenerisk }),
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1835
|
+
import_react_native7.Text,
|
|
1836
|
+
{
|
|
1837
|
+
style: {
|
|
1838
|
+
color: tema.color.textPrimary,
|
|
1839
|
+
fontSize: tema.font.small,
|
|
1840
|
+
lineHeight: tema.lineHeight.small
|
|
1841
|
+
},
|
|
1842
|
+
children: svar.text
|
|
1843
|
+
}
|
|
1844
|
+
)
|
|
1845
|
+
]
|
|
1846
|
+
}
|
|
1847
|
+
) : null
|
|
1848
|
+
] })
|
|
1849
|
+
},
|
|
1850
|
+
nokkel
|
|
1851
|
+
);
|
|
1845
1852
|
}) }),
|
|
1846
|
-
|
|
1853
|
+
apen !== null ? (
|
|
1854
|
+
// F32: fotens plass — én primærhandling om gangen. «Send nytt innspill» er borte til
|
|
1855
|
+
// tillegget er sendt eller avbrutt, så første trykk aldri treffer feil knapp.
|
|
1856
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { testID: "tillegg-fot", style: { gap: tema.space.sm }, children: [
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native7.View, { style: { flexDirection: "row", gap: tema.space.sm }, children: [
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1859
|
+
Btn,
|
|
1860
|
+
{
|
|
1861
|
+
testID: "tillegg-send",
|
|
1862
|
+
label: sender ? tekst.sender : tekst.send,
|
|
1863
|
+
disabled: utkast.length < min || sender,
|
|
1864
|
+
busy: sender,
|
|
1865
|
+
...utkast.length < min ? { hint: tekst.forKort(min) } : {},
|
|
1866
|
+
onPress: () => void send(apen),
|
|
1867
|
+
grow: true
|
|
1868
|
+
}
|
|
1869
|
+
),
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Btn, { testID: "tillegg-avbryt", label: tekst.avbryt, variant: "secondary", onPress: avbryt, grow: true })
|
|
1871
|
+
] }),
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: tekst.leggTilMerHint })
|
|
1873
|
+
] })
|
|
1874
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Btn, { testID: "send-nytt", label: rader.length === 0 ? tekst.sendForste : tekst.sendNytt, onPress: onNytt })
|
|
1847
1875
|
] });
|
|
1848
|
-
}
|
|
1876
|
+
});
|
|
1849
1877
|
|
|
1850
1878
|
// src/widget/Skjermbilde.tsx
|
|
1851
1879
|
var import_core2 = require("@innspel/core");
|
|
@@ -2256,9 +2284,12 @@ function Widget({
|
|
|
2256
2284
|
setVedlegg(void 0);
|
|
2257
2285
|
setSteg("felt");
|
|
2258
2286
|
}, []);
|
|
2287
|
+
const mineRef = (0, import_react11.useRef)(null);
|
|
2288
|
+
const tilleggUtkast = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
|
|
2259
2289
|
const gaaTilbake = (0, import_react11.useCallback)(() => {
|
|
2260
2290
|
setFeil(void 0);
|
|
2261
2291
|
if (steg === "mine") {
|
|
2292
|
+
if (mineRef.current?.lukkFelt()) return;
|
|
2262
2293
|
if (mineDirekte) lukk();
|
|
2263
2294
|
else setSteg("valg");
|
|
2264
2295
|
return;
|
|
@@ -2481,6 +2512,8 @@ function Widget({
|
|
|
2481
2512
|
steg === "mine" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2482
2513
|
MineInnspill,
|
|
2483
2514
|
{
|
|
2515
|
+
ref: mineRef,
|
|
2516
|
+
utkastLager: tilleggUtkast.current,
|
|
2484
2517
|
storage: client.storage,
|
|
2485
2518
|
rader: mine,
|
|
2486
2519
|
laster: lasterMine,
|