@innspel/react-native 0.5.0 → 0.6.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 +42 -1
- package/dist/index.cjs +361 -280
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -3
- package/dist/index.d.ts +60 -3
- package/dist/index.js +367 -286
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -46,15 +46,25 @@ var import_react_native10 = require("react-native");
|
|
|
46
46
|
// src/skjermbilde.ts
|
|
47
47
|
var import_react = require("react");
|
|
48
48
|
var import_react_native = require("react-native");
|
|
49
|
-
function
|
|
49
|
+
function storrelse(uri) {
|
|
50
|
+
return new Promise((resolve, reject) => import_react_native.Image.getSize(uri, (w, h) => resolve({ width: w, height: h }), reject));
|
|
51
|
+
}
|
|
52
|
+
function createScreenshotAdapter(captureRef, options = {}) {
|
|
53
|
+
const { pickImage, captureScreen } = options;
|
|
50
54
|
return {
|
|
51
|
-
async capture(ref,
|
|
52
|
-
const uri = await captureRef(ref, { format:
|
|
53
|
-
|
|
54
|
-
(resolve, reject) => import_react_native.Image.getSize(uri, (w, h) => resolve({ width: w, height: h }), reject)
|
|
55
|
-
);
|
|
56
|
-
return { uri, width, height };
|
|
55
|
+
async capture(ref, opts) {
|
|
56
|
+
const uri = await captureRef(ref, { format: opts.format, quality: opts.quality, result: "tmpfile" });
|
|
57
|
+
return { uri, ...await storrelse(uri) };
|
|
57
58
|
},
|
|
59
|
+
...pickImage ? {
|
|
60
|
+
async pick() {
|
|
61
|
+
const valgt = await pickImage();
|
|
62
|
+
if (!valgt) return null;
|
|
63
|
+
const { width, height } = valgt.width && valgt.height ? { width: valgt.width, height: valgt.height } : await storrelse(valgt.uri);
|
|
64
|
+
return { uri: valgt.uri, width, height };
|
|
65
|
+
}
|
|
66
|
+
} : {},
|
|
67
|
+
...captureScreen === false ? { captureScreen: false } : {},
|
|
58
68
|
measure(ref) {
|
|
59
69
|
return new Promise((resolve) => {
|
|
60
70
|
const view = ref.current;
|
|
@@ -538,6 +548,10 @@ var tekst = {
|
|
|
538
548
|
// 2f — skjermbilde (K4, DD-39, DD-40, DD-42)
|
|
539
549
|
leggVedSkjermbilde: "Legg ved skjermbilde",
|
|
540
550
|
leggVedHint: "Bildet tas f\xF8rst n\xE5r du trykker \u2014 du ser det f\xF8r det sendes.",
|
|
551
|
+
velgBilde: "Velg bilde",
|
|
552
|
+
velgBildeHint: "Fra bildene dine. Du ser det og kan maskere det f\xF8r det sendes.",
|
|
553
|
+
skjermbildeUnderGalleri: "Bildet er fra galleriet. Appen maskerer ingenting i det for deg \u2014 mal over det som ikke skal med.",
|
|
554
|
+
bildeFeilet: "kunne ikke hente bildet. Du kan sende uten.",
|
|
541
555
|
skjermbildeTittel: "Se over bildet",
|
|
542
556
|
skjermbildeUnder: "Bildet ble tatt da du trykket. Det du maskerer, ser vi aldri.",
|
|
543
557
|
maskering: "Maskering",
|
|
@@ -693,6 +707,8 @@ function Felt({
|
|
|
693
707
|
onSend,
|
|
694
708
|
sender,
|
|
695
709
|
onSkjermbilde,
|
|
710
|
+
onVelgBilde,
|
|
711
|
+
bildeNotat,
|
|
696
712
|
harVedlegg,
|
|
697
713
|
onFjernVedlegg
|
|
698
714
|
}) {
|
|
@@ -718,229 +734,254 @@ function Felt({
|
|
|
718
734
|
return verdi2 && !fjernedeFelter.includes(felt) ? { felt, etikett, verdi: verdi2 } : null;
|
|
719
735
|
}).filter((x) => x !== null);
|
|
720
736
|
}, [kontekst, fjernedeFelter]);
|
|
721
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { style: {
|
|
722
|
-
|
|
723
|
-
import_react_native3.
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { testID: "skjema", style: { flexGrow: 1, flexShrink: 1, gap: tema.space.md }, children: [
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
739
|
+
import_react_native3.ScrollView,
|
|
724
740
|
{
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
minHeight: tema.touch,
|
|
730
|
-
borderWidth: tema.hairline,
|
|
731
|
-
borderColor: tema.color.borderInteractive,
|
|
732
|
-
borderRadius: tema.radius.pill,
|
|
733
|
-
paddingLeft: tema.space.md,
|
|
734
|
-
paddingRight: tema.space.xs
|
|
735
|
-
},
|
|
741
|
+
testID: "skjema-kropp",
|
|
742
|
+
style: { flexGrow: 0, flexShrink: 1 },
|
|
743
|
+
contentContainerStyle: { gap: tema.space.md },
|
|
744
|
+
keyboardShouldPersistTaps: "handled",
|
|
736
745
|
children: [
|
|
737
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
738
|
-
|
|
739
|
-
import_react_native3.Pressable,
|
|
746
|
+
lenketTil ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
747
|
+
import_react_native3.View,
|
|
740
748
|
{
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
749
|
+
style: {
|
|
750
|
+
flexDirection: "row",
|
|
751
|
+
alignItems: "center",
|
|
752
|
+
gap: tema.space.sm,
|
|
753
|
+
minHeight: tema.touch,
|
|
754
|
+
borderWidth: tema.hairline,
|
|
755
|
+
borderColor: tema.color.borderInteractive,
|
|
756
|
+
borderRadius: tema.radius.pill,
|
|
757
|
+
paddingLeft: tema.space.md,
|
|
758
|
+
paddingRight: tema.space.xs
|
|
759
|
+
},
|
|
760
|
+
children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { flex: 1, color: tema.color.textPrimary, fontSize: tema.font.small }, children: tekst.lenketTil(lenketTil.title) }),
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
763
|
+
import_react_native3.Pressable,
|
|
764
|
+
{
|
|
765
|
+
testID: "fjern-lenke",
|
|
766
|
+
accessibilityRole: "button",
|
|
767
|
+
accessibilityLabel: tekst.fjernLenke,
|
|
768
|
+
onPress: onFjernLenke,
|
|
769
|
+
style: { minWidth: tema.touch, minHeight: tema.touch, alignItems: "center", justifyContent: "center" },
|
|
770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: "\u2715" })
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
]
|
|
747
774
|
}
|
|
748
|
-
)
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
775
|
+
) : null,
|
|
776
|
+
uavklart ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
777
|
+
import_react_native3.View,
|
|
778
|
+
{
|
|
779
|
+
style: {
|
|
780
|
+
gap: tema.space.sm,
|
|
781
|
+
backgroundColor: tema.color.warningBg,
|
|
782
|
+
borderRadius: tema.radius.md,
|
|
783
|
+
padding: tema.space.md
|
|
784
|
+
},
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
787
|
+
import_react_native3.Text,
|
|
788
|
+
{
|
|
789
|
+
accessibilityRole: "alert",
|
|
790
|
+
accessibilityLiveRegion: "polite",
|
|
791
|
+
style: {
|
|
792
|
+
color: tema.color.warning,
|
|
793
|
+
fontSize: tema.font.small,
|
|
794
|
+
lineHeight: tema.lineHeight.small,
|
|
795
|
+
fontWeight: tema.weight.medium
|
|
796
|
+
},
|
|
797
|
+
children: tekst.monsterSpm[uavklart.kind]
|
|
798
|
+
}
|
|
799
|
+
),
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { style: { flexDirection: "row", gap: tema.space.sm }, children: [
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
802
|
+
Btn,
|
|
803
|
+
{
|
|
804
|
+
grow: true,
|
|
805
|
+
variant: "secondary",
|
|
806
|
+
testID: "monster-fjern",
|
|
807
|
+
label: tekst.monsterFjern,
|
|
808
|
+
onPress: () => onEndre(verdi.slice(0, uavklart.start) + verdi.slice(uavklart.end))
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
812
|
+
Btn,
|
|
813
|
+
{
|
|
814
|
+
grow: true,
|
|
815
|
+
variant: "ghost",
|
|
816
|
+
testID: "monster-behold",
|
|
817
|
+
label: tekst.monsterBehold,
|
|
818
|
+
onPress: () => setBeholdt((b) => [...b, uavklart.match])
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
] }),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Hint, { children: tekst.monsterForklaring })
|
|
823
|
+
]
|
|
824
|
+
}
|
|
825
|
+
) : null,
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(H, { children: spor === "onske" ? tekst.feltLabelOnske : tekst.feltLabelFeil }),
|
|
762
827
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
828
|
+
import_react_native3.TextInput,
|
|
829
|
+
{
|
|
830
|
+
testID: "innspill-tekst",
|
|
831
|
+
accessibilityLabel: spor === "onske" ? tekst.feltLabelOnske : tekst.feltLabelFeil,
|
|
832
|
+
value: verdi,
|
|
833
|
+
onChangeText: onEndre,
|
|
834
|
+
maxLength: textMaxLength,
|
|
835
|
+
multiline: true,
|
|
836
|
+
numberOfLines: 4,
|
|
837
|
+
placeholder: spor === "onske" ? tekst.placeholderOnske : tekst.placeholderFeil,
|
|
838
|
+
placeholderTextColor: tema.color.textMuted,
|
|
839
|
+
style: {
|
|
840
|
+
backgroundColor: tema.color.surfaceRaised,
|
|
841
|
+
borderWidth: tema.hairline,
|
|
842
|
+
borderColor: full ? tema.color.warning : tema.color.borderStrong,
|
|
843
|
+
borderRadius: tema.radius.md,
|
|
844
|
+
padding: tema.space.md,
|
|
845
|
+
color: tema.color.textPrimary,
|
|
846
|
+
fontSize: tema.font.body,
|
|
847
|
+
lineHeight: tema.lineHeight.body,
|
|
848
|
+
minHeight: tema.touch * 2,
|
|
849
|
+
textAlignVertical: "top"
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
visTeller ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
763
854
|
import_react_native3.Text,
|
|
764
855
|
{
|
|
765
|
-
|
|
766
|
-
accessibilityLiveRegion: "polite",
|
|
856
|
+
testID: "teller",
|
|
857
|
+
accessibilityLiveRegion: full ? "assertive" : "polite",
|
|
767
858
|
style: {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
fontWeight: tema.weight.medium
|
|
859
|
+
alignSelf: "flex-end",
|
|
860
|
+
color: full ? tema.color.warning : tema.color.textMuted,
|
|
861
|
+
fontSize: tema.font.small
|
|
772
862
|
},
|
|
773
|
-
children:
|
|
863
|
+
children: [
|
|
864
|
+
brukt,
|
|
865
|
+
" / ",
|
|
866
|
+
textMaxLength,
|
|
867
|
+
full ? tekst.tellerFull : ""
|
|
868
|
+
]
|
|
774
869
|
}
|
|
775
|
-
),
|
|
776
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
777
|
-
|
|
870
|
+
) : null,
|
|
871
|
+
harVedlegg ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
872
|
+
import_react_native3.View,
|
|
873
|
+
{
|
|
874
|
+
testID: "vedlegg-chip",
|
|
875
|
+
style: {
|
|
876
|
+
flexDirection: "row",
|
|
877
|
+
alignItems: "center",
|
|
878
|
+
gap: tema.space.sm,
|
|
879
|
+
minHeight: tema.touch,
|
|
880
|
+
borderWidth: tema.hairline,
|
|
881
|
+
borderColor: tema.color.borderInteractive,
|
|
882
|
+
borderRadius: tema.radius.pill,
|
|
883
|
+
paddingLeft: tema.space.md,
|
|
884
|
+
paddingRight: tema.space.xs
|
|
885
|
+
},
|
|
886
|
+
children: [
|
|
887
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { fontSize: tema.font.small }, children: "\u{1F4F7}" }),
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { flex: 1, color: tema.color.textPrimary, fontSize: tema.font.small }, children: tekst.skjermbildeLagtVed }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
890
|
+
import_react_native3.Pressable,
|
|
891
|
+
{
|
|
892
|
+
testID: "fjern-vedlegg",
|
|
893
|
+
accessibilityRole: "button",
|
|
894
|
+
accessibilityLabel: tekst.fjernSkjermbilde,
|
|
895
|
+
onPress: onFjernVedlegg,
|
|
896
|
+
style: { minWidth: tema.touch, minHeight: tema.touch, alignItems: "center", justifyContent: "center" },
|
|
897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: "\u2715" })
|
|
898
|
+
}
|
|
899
|
+
)
|
|
900
|
+
]
|
|
901
|
+
}
|
|
902
|
+
) : onSkjermbilde || onVelgBilde ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { style: { gap: tema.space.sm }, children: [
|
|
903
|
+
onSkjermbilde ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
778
904
|
Btn,
|
|
779
905
|
{
|
|
780
|
-
grow: true,
|
|
781
906
|
variant: "secondary",
|
|
782
|
-
testID: "
|
|
783
|
-
|
|
784
|
-
|
|
907
|
+
testID: "legg-ved-skjermbilde",
|
|
908
|
+
ikon: "\u{1F4F7}",
|
|
909
|
+
label: tekst.leggVedSkjermbilde,
|
|
910
|
+
hint: tekst.leggVedHint,
|
|
911
|
+
onPress: onSkjermbilde
|
|
785
912
|
}
|
|
786
|
-
),
|
|
787
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
913
|
+
) : null,
|
|
914
|
+
onVelgBilde ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
788
915
|
Btn,
|
|
789
916
|
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
label: tekst.
|
|
794
|
-
|
|
917
|
+
variant: "secondary",
|
|
918
|
+
testID: "velg-bilde",
|
|
919
|
+
ikon: "\u{1F5BC}",
|
|
920
|
+
label: tekst.velgBilde,
|
|
921
|
+
hint: tekst.velgBildeHint,
|
|
922
|
+
onPress: onVelgBilde
|
|
795
923
|
}
|
|
796
|
-
)
|
|
797
|
-
|
|
798
|
-
|
|
924
|
+
) : null,
|
|
925
|
+
bildeNotat ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { testID: "bilde-notat", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Hint, { children: bildeNotat }) }) : null
|
|
926
|
+
] }) : null,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { style: { borderTopWidth: tema.hairline, borderTopColor: tema.color.border, paddingTop: tema.space.sm }, children: [
|
|
928
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
929
|
+
import_react_native3.Pressable,
|
|
930
|
+
{
|
|
931
|
+
testID: "kontekst-bryter",
|
|
932
|
+
accessibilityRole: "button",
|
|
933
|
+
accessibilityState: { expanded: apen },
|
|
934
|
+
accessibilityLabel: `${tekst.kontekstLinje}${apen ? "" : tekst.kontekstVis}`,
|
|
935
|
+
onPress: () => setApen((a) => !a),
|
|
936
|
+
style: { minHeight: tema.touch, justifyContent: "center" },
|
|
937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: [
|
|
938
|
+
apen ? "\u25B4" : "\u25BE",
|
|
939
|
+
" ",
|
|
940
|
+
tekst.kontekstLinje,
|
|
941
|
+
apen ? "" : tekst.kontekstVis
|
|
942
|
+
] })
|
|
943
|
+
}
|
|
944
|
+
),
|
|
945
|
+
apen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { children: [
|
|
946
|
+
linjer.map((l) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
947
|
+
import_react_native3.View,
|
|
948
|
+
{
|
|
949
|
+
style: {
|
|
950
|
+
flexDirection: "row",
|
|
951
|
+
alignItems: "center",
|
|
952
|
+
gap: tema.space.sm,
|
|
953
|
+
minHeight: tema.touch,
|
|
954
|
+
borderBottomWidth: tema.hairline,
|
|
955
|
+
borderBottomColor: tema.color.border
|
|
956
|
+
},
|
|
957
|
+
children: [
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { color: tema.color.textMuted, fontSize: tema.font.small, minWidth: tema.touch * 2 }, children: l.etikett }),
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { flex: 1, color: tema.color.textPrimary, fontSize: tema.font.small }, children: l.verdi }),
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
961
|
+
import_react_native3.Pressable,
|
|
962
|
+
{
|
|
963
|
+
testID: `fjern-${l.felt}`,
|
|
964
|
+
accessibilityRole: "button",
|
|
965
|
+
accessibilityLabel: `${tekst.kontekstFjern} ${l.etikett.toLowerCase()} fra innsendingen`,
|
|
966
|
+
onPress: () => onFjernKontekst(l.felt),
|
|
967
|
+
style: { minWidth: tema.touch, minHeight: tema.touch, alignItems: "center", justifyContent: "center" },
|
|
968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: [
|
|
969
|
+
"\u2715 ",
|
|
970
|
+
tekst.kontekstFjern
|
|
971
|
+
] })
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
]
|
|
975
|
+
},
|
|
976
|
+
l.felt
|
|
977
|
+
)),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { style: { paddingTop: tema.space.sm }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Hint, { children: tekst.kontekstAldri }) })
|
|
979
|
+
] }) : null
|
|
980
|
+
] })
|
|
799
981
|
]
|
|
800
982
|
}
|
|
801
|
-
) : null,
|
|
802
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(H, { children: spor === "onske" ? tekst.feltLabelOnske : tekst.feltLabelFeil }),
|
|
803
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
804
|
-
import_react_native3.TextInput,
|
|
805
|
-
{
|
|
806
|
-
testID: "innspill-tekst",
|
|
807
|
-
accessibilityLabel: spor === "onske" ? tekst.feltLabelOnske : tekst.feltLabelFeil,
|
|
808
|
-
value: verdi,
|
|
809
|
-
onChangeText: onEndre,
|
|
810
|
-
maxLength: textMaxLength,
|
|
811
|
-
multiline: true,
|
|
812
|
-
numberOfLines: 4,
|
|
813
|
-
placeholder: spor === "onske" ? tekst.placeholderOnske : tekst.placeholderFeil,
|
|
814
|
-
placeholderTextColor: tema.color.textMuted,
|
|
815
|
-
style: {
|
|
816
|
-
backgroundColor: tema.color.surfaceRaised,
|
|
817
|
-
borderWidth: tema.hairline,
|
|
818
|
-
borderColor: full ? tema.color.warning : tema.color.borderStrong,
|
|
819
|
-
borderRadius: tema.radius.md,
|
|
820
|
-
padding: tema.space.md,
|
|
821
|
-
color: tema.color.textPrimary,
|
|
822
|
-
fontSize: tema.font.body,
|
|
823
|
-
lineHeight: tema.lineHeight.body,
|
|
824
|
-
minHeight: tema.touch * 2,
|
|
825
|
-
textAlignVertical: "top"
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
983
|
),
|
|
829
|
-
|
|
830
|
-
import_react_native3.Text,
|
|
831
|
-
{
|
|
832
|
-
testID: "teller",
|
|
833
|
-
accessibilityLiveRegion: full ? "assertive" : "polite",
|
|
834
|
-
style: {
|
|
835
|
-
alignSelf: "flex-end",
|
|
836
|
-
color: full ? tema.color.warning : tema.color.textMuted,
|
|
837
|
-
fontSize: tema.font.small
|
|
838
|
-
},
|
|
839
|
-
children: [
|
|
840
|
-
brukt,
|
|
841
|
-
" / ",
|
|
842
|
-
textMaxLength,
|
|
843
|
-
full ? tekst.tellerFull : ""
|
|
844
|
-
]
|
|
845
|
-
}
|
|
846
|
-
) : null,
|
|
847
|
-
harVedlegg ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
848
|
-
import_react_native3.View,
|
|
849
|
-
{
|
|
850
|
-
testID: "vedlegg-chip",
|
|
851
|
-
style: {
|
|
852
|
-
flexDirection: "row",
|
|
853
|
-
alignItems: "center",
|
|
854
|
-
gap: tema.space.sm,
|
|
855
|
-
minHeight: tema.touch,
|
|
856
|
-
borderWidth: tema.hairline,
|
|
857
|
-
borderColor: tema.color.borderInteractive,
|
|
858
|
-
borderRadius: tema.radius.pill,
|
|
859
|
-
paddingLeft: tema.space.md,
|
|
860
|
-
paddingRight: tema.space.xs
|
|
861
|
-
},
|
|
862
|
-
children: [
|
|
863
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { fontSize: tema.font.small }, children: "\u{1F4F7}" }),
|
|
864
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { flex: 1, color: tema.color.textPrimary, fontSize: tema.font.small }, children: tekst.skjermbildeLagtVed }),
|
|
865
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
866
|
-
import_react_native3.Pressable,
|
|
867
|
-
{
|
|
868
|
-
testID: "fjern-vedlegg",
|
|
869
|
-
accessibilityRole: "button",
|
|
870
|
-
accessibilityLabel: tekst.fjernSkjermbilde,
|
|
871
|
-
onPress: onFjernVedlegg,
|
|
872
|
-
style: { minWidth: tema.touch, minHeight: tema.touch, alignItems: "center", justifyContent: "center" },
|
|
873
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: "\u2715" })
|
|
874
|
-
}
|
|
875
|
-
)
|
|
876
|
-
]
|
|
877
|
-
}
|
|
878
|
-
) : onSkjermbilde ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
879
|
-
Btn,
|
|
880
|
-
{
|
|
881
|
-
variant: "secondary",
|
|
882
|
-
testID: "legg-ved-skjermbilde",
|
|
883
|
-
ikon: "\u{1F4F7}",
|
|
884
|
-
label: tekst.leggVedSkjermbilde,
|
|
885
|
-
hint: tekst.leggVedHint,
|
|
886
|
-
onPress: onSkjermbilde
|
|
887
|
-
}
|
|
888
|
-
) : null,
|
|
889
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { style: { borderTopWidth: tema.hairline, borderTopColor: tema.color.border, paddingTop: tema.space.sm }, children: [
|
|
890
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
891
|
-
import_react_native3.Pressable,
|
|
892
|
-
{
|
|
893
|
-
testID: "kontekst-bryter",
|
|
894
|
-
accessibilityRole: "button",
|
|
895
|
-
accessibilityState: { expanded: apen },
|
|
896
|
-
accessibilityLabel: `${tekst.kontekstLinje}${apen ? "" : tekst.kontekstVis}`,
|
|
897
|
-
onPress: () => setApen((a) => !a),
|
|
898
|
-
style: { minHeight: tema.touch, justifyContent: "center" },
|
|
899
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: [
|
|
900
|
-
apen ? "\u25B4" : "\u25BE",
|
|
901
|
-
" ",
|
|
902
|
-
tekst.kontekstLinje,
|
|
903
|
-
apen ? "" : tekst.kontekstVis
|
|
904
|
-
] })
|
|
905
|
-
}
|
|
906
|
-
),
|
|
907
|
-
apen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.View, { children: [
|
|
908
|
-
linjer.map((l) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
909
|
-
import_react_native3.View,
|
|
910
|
-
{
|
|
911
|
-
style: {
|
|
912
|
-
flexDirection: "row",
|
|
913
|
-
alignItems: "center",
|
|
914
|
-
gap: tema.space.sm,
|
|
915
|
-
minHeight: tema.touch,
|
|
916
|
-
borderBottomWidth: tema.hairline,
|
|
917
|
-
borderBottomColor: tema.color.border
|
|
918
|
-
},
|
|
919
|
-
children: [
|
|
920
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { color: tema.color.textMuted, fontSize: tema.font.small, minWidth: tema.touch * 2 }, children: l.etikett }),
|
|
921
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { style: { flex: 1, color: tema.color.textPrimary, fontSize: tema.font.small }, children: l.verdi }),
|
|
922
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
923
|
-
import_react_native3.Pressable,
|
|
924
|
-
{
|
|
925
|
-
testID: `fjern-${l.felt}`,
|
|
926
|
-
accessibilityRole: "button",
|
|
927
|
-
accessibilityLabel: `${tekst.kontekstFjern} ${l.etikett.toLowerCase()} fra innsendingen`,
|
|
928
|
-
onPress: () => onFjernKontekst(l.felt),
|
|
929
|
-
style: { minWidth: tema.touch, minHeight: tema.touch, alignItems: "center", justifyContent: "center" },
|
|
930
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native3.Text, { style: { color: tema.color.textSecondary, fontSize: tema.font.small }, children: [
|
|
931
|
-
"\u2715 ",
|
|
932
|
-
tekst.kontekstFjern
|
|
933
|
-
] })
|
|
934
|
-
}
|
|
935
|
-
)
|
|
936
|
-
]
|
|
937
|
-
},
|
|
938
|
-
l.felt
|
|
939
|
-
)),
|
|
940
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { style: { paddingTop: tema.space.sm }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Hint, { children: tekst.kontekstAldri }) })
|
|
941
|
-
] }) : null
|
|
942
|
-
] }),
|
|
943
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { style: { flex: 1, justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { testID: "skjema-fot", style: { flexGrow: 1, flexShrink: 0, justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
944
985
|
Btn,
|
|
945
986
|
{
|
|
946
987
|
testID: "send",
|
|
@@ -1024,73 +1065,82 @@ function KjenteFeil({
|
|
|
1024
1065
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native5.ActivityIndicator, { accessibilityLabel: "Sjekker kjente feil", color: tema.color.textSecondary })
|
|
1025
1066
|
] });
|
|
1026
1067
|
}
|
|
1027
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native5.View, { style: {
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native5.View, { testID: "kjente-feil", style: { flexGrow: 1, flexShrink: 1, gap: tema.space.md }, children: [
|
|
1028
1069
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(H, { sub: spor === "onske" ? tekst.kjenteFeilUnderOnske : tekst.kjenteFeilUnderFeil, children: spor === "onske" ? tekst.kjenteFeilTittelOnske : tekst.kjenteFeilTittelFeil }),
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1071
|
+
import_react_native5.ScrollView,
|
|
1072
|
+
{
|
|
1073
|
+
testID: "kjente-feil-liste",
|
|
1074
|
+
style: { flexGrow: 0, flexShrink: 1 },
|
|
1075
|
+
contentContainerStyle: { gap: tema.space.md },
|
|
1076
|
+
keyboardShouldPersistTaps: "handled",
|
|
1077
|
+
children: kort.map((k) => {
|
|
1078
|
+
const versjon = k.fixedIn ? k.status === "fikset" ? tekst.rettetI(k.fixedIn) : tekst.rettesI(k.fixedIn) : void 0;
|
|
1079
|
+
const kontekst = versjon ? `${k.title}. ${versjon}` : k.title;
|
|
1080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Card, { children: [
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1082
|
+
import_react_native5.Text,
|
|
1083
|
+
{
|
|
1084
|
+
style: {
|
|
1085
|
+
color: tema.color.textPrimary,
|
|
1086
|
+
fontSize: tema.font.body,
|
|
1087
|
+
lineHeight: tema.lineHeight.body,
|
|
1088
|
+
fontWeight: tema.weight.medium
|
|
1089
|
+
},
|
|
1090
|
+
children: k.title
|
|
1091
|
+
}
|
|
1092
|
+
),
|
|
1093
|
+
k.workaround ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1094
|
+
import_react_native5.Text,
|
|
1095
|
+
{
|
|
1096
|
+
style: {
|
|
1097
|
+
color: tema.color.textSecondary,
|
|
1098
|
+
fontSize: tema.font.small,
|
|
1099
|
+
lineHeight: tema.lineHeight.small
|
|
1100
|
+
},
|
|
1101
|
+
children: [
|
|
1102
|
+
tekst.omvei,
|
|
1103
|
+
" ",
|
|
1104
|
+
k.workaround
|
|
1105
|
+
]
|
|
1106
|
+
}
|
|
1107
|
+
) : null,
|
|
1108
|
+
versjon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1109
|
+
StatusPill,
|
|
1110
|
+
{
|
|
1111
|
+
ikon: k.status === "fikset" ? "\u2713" : "\u{1F527}",
|
|
1112
|
+
etikett: versjon,
|
|
1113
|
+
farge: k.status === "fikset" ? "success" : "info"
|
|
1114
|
+
}
|
|
1115
|
+
) : null,
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native5.View, { style: { flexDirection: "row", gap: tema.space.sm }, children: [
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1118
|
+
Btn,
|
|
1119
|
+
{
|
|
1120
|
+
grow: true,
|
|
1121
|
+
testID: `ja-ogsa-${k.id}`,
|
|
1122
|
+
label: tekst.svarJa,
|
|
1123
|
+
accessibilityLabel: `${tekst.svarJa}. ${kontekst}`,
|
|
1124
|
+
onPress: () => onJaOgsa(k)
|
|
1125
|
+
}
|
|
1126
|
+
),
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1128
|
+
Btn,
|
|
1129
|
+
{
|
|
1130
|
+
grow: true,
|
|
1131
|
+
variant: "secondary",
|
|
1132
|
+
testID: `ligner-${k.id}`,
|
|
1133
|
+
label: tekst.svarLigner,
|
|
1134
|
+
accessibilityLabel: `${tekst.svarLigner}. ${kontekst}`,
|
|
1135
|
+
onPress: () => onLigner(k)
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] })
|
|
1139
|
+
] }, k.id);
|
|
1140
|
+
})
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native5.View, { testID: "kjente-feil-fot", style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Btn, { variant: "secondary", testID: "nei-noe-annet", label: tekst.svarNei, onPress: onNei }) })
|
|
1094
1144
|
] });
|
|
1095
1145
|
}
|
|
1096
1146
|
|
|
@@ -1288,6 +1338,8 @@ function Skjermbilde({
|
|
|
1288
1338
|
rotStorrelse,
|
|
1289
1339
|
previewRef,
|
|
1290
1340
|
komponerer,
|
|
1341
|
+
kilde = "skjerm",
|
|
1342
|
+
notat,
|
|
1291
1343
|
onFjern,
|
|
1292
1344
|
onLeggVed
|
|
1293
1345
|
}) {
|
|
@@ -1380,7 +1432,8 @@ function Skjermbilde({
|
|
|
1380
1432
|
};
|
|
1381
1433
|
const a11y = tekst.skjermbildeA11y(automasker.length, egne.length, allTekst);
|
|
1382
1434
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native8.View, { style: { flex: 1, gap: tema.space.md }, children: [
|
|
1383
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(H, { sub: tekst.skjermbildeUnder, children: tekst.skjermbildeTittel }),
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(H, { sub: kilde === "galleri" ? tekst.skjermbildeUnderGalleri : tekst.skjermbildeUnder, children: tekst.skjermbildeTittel }),
|
|
1436
|
+
notat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native8.View, { testID: "bilde-notat", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Hint, { children: notat }) }) : null,
|
|
1384
1437
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native8.View, { accessibilityRole: "toolbar", accessibilityLabel: tekst.maskering, style: { flexDirection: "row", gap: tema.space.sm }, children: [
|
|
1385
1438
|
knapp("felt", "\u25A3", tekst.maskerFelt),
|
|
1386
1439
|
knapp("pensel", "\u270E", tekst.tegnOver),
|
|
@@ -1485,7 +1538,8 @@ function Widget({
|
|
|
1485
1538
|
synlig,
|
|
1486
1539
|
apneOpsjoner,
|
|
1487
1540
|
onLukk,
|
|
1488
|
-
tenantName
|
|
1541
|
+
tenantName,
|
|
1542
|
+
imageStepNote
|
|
1489
1543
|
}) {
|
|
1490
1544
|
const tema = useTema();
|
|
1491
1545
|
const insets = (0, import_react10.useContext)(import_react_native_safe_area_context.SafeAreaInsetsContext) ?? import_react_native_safe_area_context.initialWindowMetrics?.insets ?? { top: 0, bottom: 0, left: 0, right: 0 };
|
|
@@ -1508,9 +1562,13 @@ function Widget({
|
|
|
1508
1562
|
const [automasker, setAutomasker] = (0, import_react10.useState)([]);
|
|
1509
1563
|
const [rotStorrelse, setRotStorrelse] = (0, import_react10.useState)({ width: 1, height: 1 });
|
|
1510
1564
|
const [komponerer, setKomponerer] = (0, import_react10.useState)(false);
|
|
1565
|
+
const [kilde, setKilde] = (0, import_react10.useState)("skjerm");
|
|
1511
1566
|
const [vedlegg, setVedlegg] = (0, import_react10.useState)();
|
|
1512
1567
|
const [innstillinger, setInnstillinger] = (0, import_react10.useState)({ ...client.settings });
|
|
1513
1568
|
const skjermbildeMulig = innstillinger.screenshotsEnabled && skjermbilde?.adapter != null;
|
|
1569
|
+
const fangstMulig = skjermbildeMulig && skjermbilde?.adapter?.captureScreen !== false;
|
|
1570
|
+
const galleriMulig = skjermbildeMulig && typeof skjermbilde?.adapter?.pick === "function";
|
|
1571
|
+
const bildeNotat = typeof imageStepNote === "string" ? imageStepNote : imageStepNote?.[spor];
|
|
1514
1572
|
const nullstill = (0, import_react10.useCallback)(() => {
|
|
1515
1573
|
setSteg("valg");
|
|
1516
1574
|
setSpor("feil");
|
|
@@ -1587,11 +1645,28 @@ function Widget({
|
|
|
1587
1645
|
setAutomasker([]);
|
|
1588
1646
|
}
|
|
1589
1647
|
setBilde(fangst);
|
|
1648
|
+
setKilde("skjerm");
|
|
1590
1649
|
setSteg("skjermbilde");
|
|
1591
1650
|
} catch {
|
|
1592
1651
|
setFeil(tekst.skjermbildeFeilet);
|
|
1593
1652
|
}
|
|
1594
1653
|
}, [skjermbilde]);
|
|
1654
|
+
const velgBilde = (0, import_react10.useCallback)(async () => {
|
|
1655
|
+
const pick = skjermbilde?.adapter?.pick;
|
|
1656
|
+
if (!pick) return;
|
|
1657
|
+
setFeil(void 0);
|
|
1658
|
+
try {
|
|
1659
|
+
const valgt = await pick.call(skjermbilde.adapter);
|
|
1660
|
+
if (!valgt) return;
|
|
1661
|
+
setRotStorrelse({ width: valgt.width, height: valgt.height });
|
|
1662
|
+
setAutomasker([]);
|
|
1663
|
+
setBilde(valgt);
|
|
1664
|
+
setKilde("galleri");
|
|
1665
|
+
setSteg("skjermbilde");
|
|
1666
|
+
} catch {
|
|
1667
|
+
setFeil(tekst.bildeFeilet);
|
|
1668
|
+
}
|
|
1669
|
+
}, [skjermbilde]);
|
|
1595
1670
|
const leggVedBilde = (0, import_react10.useCallback)(async () => {
|
|
1596
1671
|
if (!skjermbilde?.adapter) return;
|
|
1597
1672
|
setKomponerer(true);
|
|
@@ -1755,7 +1830,9 @@ function Widget({
|
|
|
1755
1830
|
funn,
|
|
1756
1831
|
onSend: send,
|
|
1757
1832
|
sender,
|
|
1758
|
-
...
|
|
1833
|
+
...fangstMulig ? { onSkjermbilde: taSkjermbilde } : {},
|
|
1834
|
+
...galleriMulig ? { onVelgBilde: velgBilde } : {},
|
|
1835
|
+
...bildeNotat ? { bildeNotat } : {},
|
|
1759
1836
|
harVedlegg: vedlegg !== void 0,
|
|
1760
1837
|
onFjernVedlegg: fjernBilde
|
|
1761
1838
|
}
|
|
@@ -1768,6 +1845,8 @@ function Widget({
|
|
|
1768
1845
|
rotStorrelse,
|
|
1769
1846
|
previewRef,
|
|
1770
1847
|
komponerer,
|
|
1848
|
+
kilde,
|
|
1849
|
+
...bildeNotat ? { notat: bildeNotat } : {},
|
|
1771
1850
|
onFjern: fjernBilde,
|
|
1772
1851
|
onLeggVed: leggVedBilde
|
|
1773
1852
|
}
|
|
@@ -1815,7 +1894,8 @@ function InnspelProvider({
|
|
|
1815
1894
|
theme,
|
|
1816
1895
|
colorScheme = "dark",
|
|
1817
1896
|
tenantName,
|
|
1818
|
-
screenshot
|
|
1897
|
+
screenshot,
|
|
1898
|
+
imageStepNote
|
|
1819
1899
|
}) {
|
|
1820
1900
|
const [synlig, setSynlig] = (0, import_react11.useState)(false);
|
|
1821
1901
|
const [apneOpsjoner, setApneOpsjoner] = (0, import_react11.useState)();
|
|
@@ -1849,6 +1929,7 @@ function InnspelProvider({
|
|
|
1849
1929
|
synlig,
|
|
1850
1930
|
...apneOpsjoner ? { apneOpsjoner } : {},
|
|
1851
1931
|
...tenantName ? { tenantName } : {},
|
|
1932
|
+
...imageStepNote ? { imageStepNote } : {},
|
|
1852
1933
|
onLukk: close
|
|
1853
1934
|
}
|
|
1854
1935
|
)
|