@xignature/docx-editor 1.0.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.
@@ -0,0 +1,35 @@
1
+ import {
2
+ FindReplaceDialog,
3
+ FindReplaceDialog_default,
4
+ createDefaultFindOptions,
5
+ createSearchPattern,
6
+ escapeRegexString,
7
+ findAllMatches,
8
+ findInDocument,
9
+ findInParagraph,
10
+ getDefaultHighlightOptions,
11
+ getMatchCountText,
12
+ isEmptySearch,
13
+ replaceAllInContent,
14
+ replaceFirstInContent,
15
+ scrollToMatch,
16
+ useFindReplace
17
+ } from "./chunk-625UL7ND.mjs";
18
+ import "./chunk-OG6X5JJA.mjs";
19
+ export {
20
+ FindReplaceDialog,
21
+ createDefaultFindOptions,
22
+ createSearchPattern,
23
+ FindReplaceDialog_default as default,
24
+ escapeRegexString,
25
+ findAllMatches,
26
+ findInDocument,
27
+ findInParagraph,
28
+ getDefaultHighlightOptions,
29
+ getMatchCountText,
30
+ isEmptySearch,
31
+ replaceAllInContent,
32
+ replaceFirstInContent,
33
+ scrollToMatch,
34
+ useFindReplace
35
+ };
@@ -0,0 +1,248 @@
1
+ import {
2
+ useTranslation
3
+ } from "./chunk-OG6X5JJA.mjs";
4
+
5
+ // src/react/components/dialogs/FootnotePropertiesDialog.tsx
6
+ import { useState, useCallback } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var overlayStyle = {
9
+ position: "fixed",
10
+ top: 0,
11
+ left: 0,
12
+ right: 0,
13
+ bottom: 0,
14
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
15
+ display: "flex",
16
+ alignItems: "center",
17
+ justifyContent: "center",
18
+ zIndex: 1e4
19
+ };
20
+ var dialogStyle = {
21
+ backgroundColor: "white",
22
+ borderRadius: 8,
23
+ boxShadow: "0 4px 20px rgba(0, 0, 0, 0.15)",
24
+ padding: 24,
25
+ minWidth: 400,
26
+ maxWidth: 500
27
+ };
28
+ var sectionStyle = {
29
+ marginBottom: 16,
30
+ padding: 12,
31
+ border: "1px solid #e0e0e0",
32
+ borderRadius: 4
33
+ };
34
+ var labelStyle = {
35
+ display: "block",
36
+ fontSize: 12,
37
+ color: "#666",
38
+ marginBottom: 4
39
+ };
40
+ var selectStyle = {
41
+ width: "100%",
42
+ padding: "4px 8px",
43
+ border: "1px solid #ccc",
44
+ borderRadius: 4,
45
+ fontSize: 13,
46
+ marginBottom: 8
47
+ };
48
+ var inputStyle = {
49
+ width: 60,
50
+ padding: "4px 8px",
51
+ border: "1px solid #ccc",
52
+ borderRadius: 4,
53
+ fontSize: 13,
54
+ marginBottom: 8
55
+ };
56
+ var buttonRowStyle = {
57
+ display: "flex",
58
+ justifyContent: "flex-end",
59
+ gap: 8,
60
+ marginTop: 16
61
+ };
62
+ var buttonStyle = {
63
+ padding: "6px 16px",
64
+ border: "1px solid #ccc",
65
+ borderRadius: 4,
66
+ cursor: "pointer",
67
+ fontSize: 13,
68
+ backgroundColor: "white"
69
+ };
70
+ var primaryButtonStyle = {
71
+ ...buttonStyle,
72
+ backgroundColor: "#2563eb",
73
+ color: "white",
74
+ border: "1px solid #2563eb"
75
+ };
76
+ var numberFormatOptions = [
77
+ { value: "decimal", labelKey: "dialogs.footnoteProperties.formats.decimal" },
78
+ { value: "lowerRoman", labelKey: "dialogs.footnoteProperties.formats.lowerRoman" },
79
+ { value: "upperRoman", labelKey: "dialogs.footnoteProperties.formats.upperRoman" },
80
+ { value: "lowerLetter", labelKey: "dialogs.footnoteProperties.formats.lowerAlpha" },
81
+ { value: "upperLetter", labelKey: "dialogs.footnoteProperties.formats.upperAlpha" },
82
+ { value: "chicago", labelKey: "dialogs.footnoteProperties.formats.symbols" }
83
+ ];
84
+ function FootnotePropertiesDialog({
85
+ isOpen,
86
+ onClose,
87
+ onApply,
88
+ footnotePr,
89
+ endnotePr
90
+ }) {
91
+ const { t } = useTranslation();
92
+ const [fnPosition, setFnPosition] = useState(
93
+ footnotePr?.position ?? "pageBottom"
94
+ );
95
+ const [fnNumFmt, setFnNumFmt] = useState(footnotePr?.numFmt ?? "decimal");
96
+ const [fnNumStart, setFnNumStart] = useState(footnotePr?.numStart ?? 1);
97
+ const [fnRestart, setFnRestart] = useState(
98
+ footnotePr?.numRestart ?? "continuous"
99
+ );
100
+ const [enPosition, setEnPosition] = useState(endnotePr?.position ?? "docEnd");
101
+ const [enNumFmt, setEnNumFmt] = useState(endnotePr?.numFmt ?? "lowerRoman");
102
+ const [enNumStart, setEnNumStart] = useState(endnotePr?.numStart ?? 1);
103
+ const [enRestart, setEnRestart] = useState(
104
+ endnotePr?.numRestart ?? "continuous"
105
+ );
106
+ const handleApply = useCallback(() => {
107
+ onApply(
108
+ { position: fnPosition, numFmt: fnNumFmt, numStart: fnNumStart, numRestart: fnRestart },
109
+ { position: enPosition, numFmt: enNumFmt, numStart: enNumStart, numRestart: enRestart }
110
+ );
111
+ onClose();
112
+ }, [
113
+ fnPosition,
114
+ fnNumFmt,
115
+ fnNumStart,
116
+ fnRestart,
117
+ enPosition,
118
+ enNumFmt,
119
+ enNumStart,
120
+ enRestart,
121
+ onApply,
122
+ onClose
123
+ ]);
124
+ if (!isOpen) return null;
125
+ return /* @__PURE__ */ jsx("div", { style: overlayStyle, onClick: onClose, children: /* @__PURE__ */ jsxs("div", { style: dialogStyle, onClick: (e) => e.stopPropagation(), children: [
126
+ /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 16px", fontSize: 16 }, children: t("dialogs.footnoteProperties.title") }),
127
+ /* @__PURE__ */ jsxs("div", { style: sectionStyle, children: [
128
+ /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 8px", fontSize: 14 }, children: t("dialogs.footnoteProperties.footnotes") }),
129
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.position") }),
130
+ /* @__PURE__ */ jsxs(
131
+ "select",
132
+ {
133
+ style: selectStyle,
134
+ value: fnPosition,
135
+ onChange: (e) => setFnPosition(e.target.value),
136
+ children: [
137
+ /* @__PURE__ */ jsx("option", { value: "pageBottom", children: t("dialogs.footnoteProperties.footnotePositions.bottomOfPage") }),
138
+ /* @__PURE__ */ jsx("option", { value: "beneathText", children: t("dialogs.footnoteProperties.footnotePositions.belowText") })
139
+ ]
140
+ }
141
+ ),
142
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.numberFormat") }),
143
+ /* @__PURE__ */ jsx(
144
+ "select",
145
+ {
146
+ style: selectStyle,
147
+ value: fnNumFmt,
148
+ onChange: (e) => setFnNumFmt(e.target.value),
149
+ children: numberFormatOptions.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: t(o.labelKey) }, o.value))
150
+ }
151
+ ),
152
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
153
+ /* @__PURE__ */ jsxs("div", { children: [
154
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.startAt") }),
155
+ /* @__PURE__ */ jsx(
156
+ "input",
157
+ {
158
+ type: "number",
159
+ min: 1,
160
+ style: inputStyle,
161
+ value: fnNumStart,
162
+ onChange: (e) => setFnNumStart(parseInt(e.target.value, 10) || 1)
163
+ }
164
+ )
165
+ ] }),
166
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
167
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.numbering") }),
168
+ /* @__PURE__ */ jsxs(
169
+ "select",
170
+ {
171
+ style: selectStyle,
172
+ value: fnRestart,
173
+ onChange: (e) => setFnRestart(e.target.value),
174
+ children: [
175
+ /* @__PURE__ */ jsx("option", { value: "continuous", children: t("dialogs.footnoteProperties.numberingOptions.continuous") }),
176
+ /* @__PURE__ */ jsx("option", { value: "eachSect", children: t("dialogs.footnoteProperties.numberingOptions.restartSection") }),
177
+ /* @__PURE__ */ jsx("option", { value: "eachPage", children: t("dialogs.footnoteProperties.numberingOptions.restartPage") })
178
+ ]
179
+ }
180
+ )
181
+ ] })
182
+ ] })
183
+ ] }),
184
+ /* @__PURE__ */ jsxs("div", { style: sectionStyle, children: [
185
+ /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 8px", fontSize: 14 }, children: t("dialogs.footnoteProperties.endnotes") }),
186
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.position") }),
187
+ /* @__PURE__ */ jsxs(
188
+ "select",
189
+ {
190
+ style: selectStyle,
191
+ value: enPosition,
192
+ onChange: (e) => setEnPosition(e.target.value),
193
+ children: [
194
+ /* @__PURE__ */ jsx("option", { value: "docEnd", children: t("dialogs.footnoteProperties.endnotePositions.endOfDocument") }),
195
+ /* @__PURE__ */ jsx("option", { value: "sectEnd", children: t("dialogs.footnoteProperties.endnotePositions.endOfSection") })
196
+ ]
197
+ }
198
+ ),
199
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.numberFormat") }),
200
+ /* @__PURE__ */ jsx(
201
+ "select",
202
+ {
203
+ style: selectStyle,
204
+ value: enNumFmt,
205
+ onChange: (e) => setEnNumFmt(e.target.value),
206
+ children: numberFormatOptions.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: t(o.labelKey) }, o.value))
207
+ }
208
+ ),
209
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
210
+ /* @__PURE__ */ jsxs("div", { children: [
211
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.startAt") }),
212
+ /* @__PURE__ */ jsx(
213
+ "input",
214
+ {
215
+ type: "number",
216
+ min: 1,
217
+ style: inputStyle,
218
+ value: enNumStart,
219
+ onChange: (e) => setEnNumStart(parseInt(e.target.value, 10) || 1)
220
+ }
221
+ )
222
+ ] }),
223
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
224
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: t("dialogs.footnoteProperties.numbering") }),
225
+ /* @__PURE__ */ jsxs(
226
+ "select",
227
+ {
228
+ style: selectStyle,
229
+ value: enRestart,
230
+ onChange: (e) => setEnRestart(e.target.value),
231
+ children: [
232
+ /* @__PURE__ */ jsx("option", { value: "continuous", children: t("dialogs.footnoteProperties.numberingOptions.continuous") }),
233
+ /* @__PURE__ */ jsx("option", { value: "eachSect", children: t("dialogs.footnoteProperties.numberingOptions.restartSection") })
234
+ ]
235
+ }
236
+ )
237
+ ] })
238
+ ] })
239
+ ] }),
240
+ /* @__PURE__ */ jsxs("div", { style: buttonRowStyle, children: [
241
+ /* @__PURE__ */ jsx("button", { style: buttonStyle, onClick: onClose, children: t("common.cancel") }),
242
+ /* @__PURE__ */ jsx("button", { style: primaryButtonStyle, onClick: handleApply, children: t("common.apply") })
243
+ ] })
244
+ ] }) });
245
+ }
246
+ export {
247
+ FootnotePropertiesDialog
248
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ HyperlinkDialog,
3
+ HyperlinkDialog_default,
4
+ createBookmarkLinkData,
5
+ createHyperlinkData,
6
+ emailToMailto,
7
+ extractBookmarksForDialog,
8
+ getDisplayText,
9
+ getUrlType,
10
+ isBookmarkHyperlinkData,
11
+ isExternalHyperlinkData,
12
+ isValidUrl,
13
+ normalizeUrl,
14
+ phoneToTel,
15
+ useHyperlinkDialog
16
+ } from "./chunk-TSNYN4SV.mjs";
17
+ import "./chunk-OG6X5JJA.mjs";
18
+ export {
19
+ HyperlinkDialog,
20
+ createBookmarkLinkData,
21
+ createHyperlinkData,
22
+ HyperlinkDialog_default as default,
23
+ emailToMailto,
24
+ extractBookmarksForDialog,
25
+ getDisplayText,
26
+ getUrlType,
27
+ isBookmarkHyperlinkData,
28
+ isExternalHyperlinkData,
29
+ isValidUrl,
30
+ normalizeUrl,
31
+ phoneToTel,
32
+ useHyperlinkDialog
33
+ };