react-pdf-rtl 0.1.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.
@@ -0,0 +1,259 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { Style } from '@react-pdf/types';
4
+
5
+ interface RTLTextProps {
6
+ children: string | number;
7
+ style?: Style | Style[];
8
+ /** Force direction instead of auto-detecting */
9
+ direction?: "rtl" | "ltr" | "auto";
10
+ wrap?: boolean;
11
+ debug?: boolean;
12
+ }
13
+ /**
14
+ * Drop-in replacement for @react-pdf/renderer's <Text> with RTL support.
15
+ *
16
+ * Automatically:
17
+ * - Detects Hebrew/Arabic content and applies RLE bidi markers
18
+ * - Handles mixed content (Hebrew text + numbers) correctly
19
+ * - Preserves LTR content unchanged
20
+ *
21
+ * @example
22
+ * <RTLText style={{ fontSize: 14 }}>חפירה וביסוס - 3 מ"ק</RTLText>
23
+ * <RTLText>Item description in English</RTLText>
24
+ */
25
+ declare function RTLText({ children, style, direction, wrap, debug }: RTLTextProps): react_jsx_runtime.JSX.Element;
26
+ interface RTLViewProps {
27
+ children: React.ReactNode;
28
+ style?: Style | Style[];
29
+ debug?: boolean;
30
+ }
31
+ /**
32
+ * A <View> pre-configured for RTL layout.
33
+ * Sets flexDirection to "row-reverse" and textAlign to "right".
34
+ * Use as a wrapper for rows in RTL documents.
35
+ *
36
+ * @example
37
+ * <RTLView style={{ marginBottom: 8 }}>
38
+ * <RTLText>תיאור עבודה</RTLText>
39
+ * <Text>₪1,200</Text>
40
+ * </RTLView>
41
+ */
42
+ declare function RTLView({ children, style, debug }: RTLViewProps): react_jsx_runtime.JSX.Element;
43
+ /**
44
+ * Returns base styles for an RTL page layout.
45
+ * Pass your fontFamily to get consistent defaults.
46
+ *
47
+ * @example
48
+ * const pageStyle = getRTLPageStyle("Rubik");
49
+ */
50
+ declare function getRTLPageStyle(fontFamily?: string): Style;
51
+ interface RTLTableColumn {
52
+ /** Column header label */
53
+ header: string;
54
+ /** Key in the data row object */
55
+ key: string;
56
+ /** Flex width (like CSS flex) */
57
+ flex?: number;
58
+ /** Explicit width in pts */
59
+ width?: number;
60
+ /** Text alignment within the cell */
61
+ align?: "right" | "left" | "center";
62
+ /** If true, formats value as currency using formatCurrencyRTL */
63
+ isCurrency?: boolean;
64
+ /** Custom cell renderer */
65
+ render?: (value: unknown, row: Record<string, unknown>) => string;
66
+ }
67
+ interface RTLTableProps {
68
+ columns: RTLTableColumn[];
69
+ data: Record<string, unknown>[];
70
+ fontFamily?: string;
71
+ /** Header background color */
72
+ headerBg?: string;
73
+ /** Header text color */
74
+ headerColor?: string;
75
+ /** Row stripe color (alternating rows) */
76
+ stripeBg?: string;
77
+ /** Border color */
78
+ borderColor?: string;
79
+ /** Font size for table content */
80
+ fontSize?: number;
81
+ }
82
+ /**
83
+ * A fully RTL-aware table component for @react-pdf/renderer.
84
+ *
85
+ * Renders columns right-to-left, handles Hebrew text in cells,
86
+ * and supports currency formatting out of the box.
87
+ *
88
+ * @example
89
+ * <RTLTable
90
+ * columns={[
91
+ * { header: "תיאור", key: "description", flex: 3 },
92
+ * { header: "כמות", key: "quantity", flex: 1, align: "center" },
93
+ * { header: "מחיר יחידה", key: "unitPrice", flex: 1, isCurrency: true },
94
+ * { header: 'סה"כ', key: "total", flex: 1, isCurrency: true },
95
+ * ]}
96
+ * data={boqItems}
97
+ * headerBg="#1a1a1a"
98
+ * headerColor="#EAB308"
99
+ * />
100
+ */
101
+ declare function RTLTable({ columns, data, fontFamily, headerBg, headerColor, stripeBg, borderColor, fontSize, }: RTLTableProps): react_jsx_runtime.JSX.Element;
102
+ interface RTLDividerProps {
103
+ color?: string;
104
+ thickness?: number;
105
+ marginVertical?: number;
106
+ }
107
+ /**
108
+ * A simple horizontal divider for RTL PDF documents.
109
+ */
110
+ declare function RTLDivider({ color, thickness, marginVertical }: RTLDividerProps): react_jsx_runtime.JSX.Element;
111
+ interface RTLSummaryRowProps {
112
+ label: string;
113
+ value: string | number;
114
+ isCurrency?: boolean;
115
+ bold?: boolean;
116
+ fontSize?: number;
117
+ color?: string;
118
+ fontFamily?: string;
119
+ }
120
+ /**
121
+ * A label + value row for totals/summaries in RTL layout.
122
+ * Label on the right, value on the left — as expected in Hebrew documents.
123
+ *
124
+ * @example
125
+ * <RTLSummaryRow label='סה"כ לפני מע"מ' value={12500} isCurrency bold />
126
+ * <RTLSummaryRow label='מע"מ 18%' value={2250} isCurrency />
127
+ * <RTLSummaryRow label="סכום סופי" value={14750} isCurrency bold color="#EAB308" />
128
+ */
129
+ declare function RTLSummaryRow({ label, value, isCurrency, bold, fontSize, color, fontFamily, }: RTLSummaryRowProps): react_jsx_runtime.JSX.Element;
130
+
131
+ type RTLFontWeight = "normal" | "bold" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
132
+ interface RTLFontSource {
133
+ src: string;
134
+ fontWeight?: RTLFontWeight;
135
+ fontStyle?: "normal" | "italic";
136
+ }
137
+ interface RegisterRTLFontOptions {
138
+ /** Font family name, e.g. "Rubik" */
139
+ family: string;
140
+ /** Array of font sources (different weights/styles) */
141
+ fonts: RTLFontSource[];
142
+ }
143
+ /**
144
+ * Registers a font family with @react-pdf/renderer.
145
+ * Wraps Font.register with sensible defaults for RTL fonts.
146
+ *
147
+ * @example
148
+ * registerRTLFont({
149
+ * family: "Rubik",
150
+ * fonts: [
151
+ * { src: "/fonts/Rubik-Regular.ttf", fontWeight: "normal" },
152
+ * { src: "/fonts/Rubik-Bold.ttf", fontWeight: "bold" },
153
+ * ],
154
+ * });
155
+ */
156
+ declare function registerRTLFont(options: RegisterRTLFontOptions): void;
157
+ /**
158
+ * Registers the Rubik font from Google Fonts CDN.
159
+ * Rubik is the recommended font for Hebrew PDFs — designed for Hebrew,
160
+ * supports all weights, and renders cleanly in @react-pdf/renderer.
161
+ *
162
+ * Weights registered: 300 (Light), 400 (Regular), 500 (Medium), 700 (Bold)
163
+ */
164
+ declare function registerRubik(): void;
165
+ /**
166
+ * Registers Noto Sans Hebrew from Google Fonts CDN.
167
+ * Good fallback if Rubik is not desired — extensive Hebrew glyph coverage.
168
+ */
169
+ declare function registerNotoSansHebrew(): void;
170
+ /**
171
+ * Disables font hyphenation — critical for Hebrew text.
172
+ * Hebrew words should never be hyphenated mid-word.
173
+ */
174
+ declare function disableHyphenation(): void;
175
+ /**
176
+ * One-shot setup: registers Rubik + disables hyphenation.
177
+ * This is the recommended setup for Hebrew PDFs.
178
+ *
179
+ * @example
180
+ * // At the top of your PDF component file:
181
+ * setupHebrewPDF();
182
+ */
183
+ declare function setupHebrewPDF(fontFamily?: "Rubik" | "NotoSansHebrew"): void;
184
+
185
+ /**
186
+ * Unicode bidi control characters
187
+ */
188
+ declare const BIDI: {
189
+ /** Right-to-Left Embedding — forces RTL rendering for the embedded text */
190
+ readonly RLE: "‫";
191
+ /** Left-to-Right Embedding */
192
+ readonly LRE: "‪";
193
+ /** Pop Directional Formatting — ends the current embedding */
194
+ readonly PDF: "‬";
195
+ /** Right-to-Left Mark — invisible RTL directional mark */
196
+ readonly RLM: "‏";
197
+ /** Left-to-Right Mark */
198
+ readonly LRM: "‎";
199
+ /** Right-to-Left Override — strongly forces RTL */
200
+ readonly RLO: "‮";
201
+ };
202
+ /**
203
+ * Returns true if the string contains any RTL characters (Hebrew, Arabic, etc.)
204
+ * FIX: coerces input to string — safe when called from JS without types
205
+ */
206
+ declare function hasRTLChars(str: unknown): boolean;
207
+ /**
208
+ * Returns true if the MAJORITY of the string's alphabetic content is RTL.
209
+ * Useful for mixed strings like "מחיר: 120 ₪" — still considered RTL.
210
+ * FIX: coerces input to string — safe when called from JS without types
211
+ */
212
+ declare function isRTLDominant(str: unknown): boolean;
213
+ /**
214
+ * Wraps text in RLE...PDF bidi markers so @react-pdf/renderer
215
+ * renders it right-to-left correctly, including mixed content.
216
+ *
217
+ * FIX: idempotent — guards against double-wrapping (broken bidi nesting)
218
+ */
219
+ declare function wrapRTL(text: string): string;
220
+ /**
221
+ * Wraps text in LRE...PDF for explicit LTR segments inside an RTL document.
222
+ * FIX: idempotent — guards against double-wrapping
223
+ */
224
+ declare function wrapLTR(text: string): string;
225
+ /**
226
+ * Smart wrap: auto-detects direction and wraps accordingly.
227
+ * FIX: accepts string | number | null | undefined — BoQ fields are often numbers
228
+ */
229
+ declare function smartWrap(text: string | number | null | undefined): string;
230
+ /**
231
+ * Formats a currency amount for RTL display.
232
+ * Ensures the symbol (₪) and number don't get scrambled in bidi context.
233
+ *
234
+ * FIX: throws RangeError on NaN/Infinity with clear message
235
+ * FIX: handles negative amounts correctly (discounts, returns)
236
+ */
237
+ declare function formatCurrencyRTL(amount: number, symbol?: string, locale?: string): string;
238
+ /**
239
+ * Splits mixed RTL/LTR text into segments with direction metadata.
240
+ * Reconstructs exactly: splitBidiSegments(s).map(s => s.text).join('') === s
241
+ *
242
+ * FIX: uses Array.from() to correctly handle surrogate pairs (emoji, rare Unicode)
243
+ */
244
+ type TextSegment = {
245
+ text: string;
246
+ direction: "rtl" | "ltr" | "neutral";
247
+ };
248
+ declare function splitBidiSegments(text: string): TextSegment[];
249
+ /**
250
+ * Returns true if the string already contains bidi control characters.
251
+ */
252
+ declare function hasBidiMarkers(text: string): boolean;
253
+ /**
254
+ * Strips all bidi control characters from a string.
255
+ * Use for: extracting plain text for storage, search, or logging.
256
+ */
257
+ declare function stripBidiMarkers(text: string): string;
258
+
259
+ export { BIDI, RTLDivider, type RTLDividerProps, type RTLFontSource, type RTLFontWeight, RTLSummaryRow, type RTLSummaryRowProps, RTLTable, type RTLTableColumn, type RTLTableProps, RTLText, type RTLTextProps, RTLView, type RTLViewProps, type RegisterRTLFontOptions, type TextSegment, disableHyphenation, formatCurrencyRTL, getRTLPageStyle, hasBidiMarkers, hasRTLChars, isRTLDominant, registerNotoSansHebrew, registerRTLFont, registerRubik, setupHebrewPDF, smartWrap, splitBidiSegments, stripBidiMarkers, wrapLTR, wrapRTL };
package/dist/index.js ADDED
@@ -0,0 +1,367 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BIDI: () => BIDI,
24
+ RTLDivider: () => RTLDivider,
25
+ RTLSummaryRow: () => RTLSummaryRow,
26
+ RTLTable: () => RTLTable,
27
+ RTLText: () => RTLText,
28
+ RTLView: () => RTLView,
29
+ disableHyphenation: () => disableHyphenation,
30
+ formatCurrencyRTL: () => formatCurrencyRTL,
31
+ getRTLPageStyle: () => getRTLPageStyle,
32
+ hasBidiMarkers: () => hasBidiMarkers,
33
+ hasRTLChars: () => hasRTLChars,
34
+ isRTLDominant: () => isRTLDominant,
35
+ registerNotoSansHebrew: () => registerNotoSansHebrew,
36
+ registerRTLFont: () => registerRTLFont,
37
+ registerRubik: () => registerRubik,
38
+ setupHebrewPDF: () => setupHebrewPDF,
39
+ smartWrap: () => smartWrap,
40
+ splitBidiSegments: () => splitBidiSegments,
41
+ stripBidiMarkers: () => stripBidiMarkers,
42
+ wrapLTR: () => wrapLTR,
43
+ wrapRTL: () => wrapRTL
44
+ });
45
+ module.exports = __toCommonJS(index_exports);
46
+
47
+ // src/components/index.tsx
48
+ var import_renderer = require("@react-pdf/renderer");
49
+
50
+ // src/utils/rtl.ts
51
+ var RTL_PATTERN = /[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC]/;
52
+ var NUMERIC_ONLY_PATTERN = /^[\d\s.,₪$€%+\-*/()]+$/;
53
+ var BIDI = {
54
+ /** Right-to-Left Embedding — forces RTL rendering for the embedded text */
55
+ RLE: "\u202B",
56
+ /** Left-to-Right Embedding */
57
+ LRE: "\u202A",
58
+ /** Pop Directional Formatting — ends the current embedding */
59
+ PDF: "\u202C",
60
+ /** Right-to-Left Mark — invisible RTL directional mark */
61
+ RLM: "\u200F",
62
+ /** Left-to-Right Mark */
63
+ LRM: "\u200E",
64
+ /** Right-to-Left Override — strongly forces RTL */
65
+ RLO: "\u202E"
66
+ };
67
+ function hasRTLChars(str) {
68
+ if (str == null) return false;
69
+ return RTL_PATTERN.test(String(str));
70
+ }
71
+ function isRTLDominant(str) {
72
+ var _a, _b;
73
+ if (str == null) return false;
74
+ const s = String(str);
75
+ const rtlMatches = s.match(
76
+ /[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC]/g
77
+ );
78
+ const ltrMatches = s.match(/[a-zA-Z]/g);
79
+ const rtlCount = (_a = rtlMatches == null ? void 0 : rtlMatches.length) != null ? _a : 0;
80
+ const ltrCount = (_b = ltrMatches == null ? void 0 : ltrMatches.length) != null ? _b : 0;
81
+ return rtlCount > 0 && rtlCount >= ltrCount;
82
+ }
83
+ function wrapRTL(text) {
84
+ if (text.charCodeAt(0) === 8235) return text;
85
+ return `\u202B${text}\u202C`;
86
+ }
87
+ function wrapLTR(text) {
88
+ if (text.charCodeAt(0) === 8234) return text;
89
+ return `\u202A${text}\u202C`;
90
+ }
91
+ function smartWrap(text) {
92
+ if (text == null) return "";
93
+ const str = String(text);
94
+ if (!str) return str;
95
+ const trimmed = str.trim();
96
+ if (!trimmed) return "";
97
+ if (NUMERIC_ONLY_PATTERN.test(trimmed)) return trimmed;
98
+ return isRTLDominant(trimmed) ? wrapRTL(trimmed) : trimmed;
99
+ }
100
+ function formatCurrencyRTL(amount, symbol = "\u20AA", locale = "he-IL") {
101
+ if (!Number.isFinite(amount)) {
102
+ throw new RangeError(
103
+ `formatCurrencyRTL: expected a finite number, got ${amount}`
104
+ );
105
+ }
106
+ const abs = Math.abs(amount);
107
+ const formatted = abs.toLocaleString(locale, {
108
+ minimumFractionDigits: 0,
109
+ maximumFractionDigits: 2
110
+ });
111
+ const valueStr = amount < 0 ? `-${formatted}` : formatted;
112
+ return `\u200F${symbol}${wrapLTR(valueStr)}`;
113
+ }
114
+ function splitBidiSegments(text) {
115
+ if (!text) return [];
116
+ const segments = [];
117
+ let current = "";
118
+ let currentDir = "neutral";
119
+ for (const char of Array.from(text)) {
120
+ const charDir = RTL_PATTERN.test(char) ? "rtl" : /[a-zA-Z]/.test(char) ? "ltr" : "neutral";
121
+ if (charDir !== "neutral" && charDir !== currentDir && current) {
122
+ segments.push({ text: current, direction: currentDir });
123
+ current = char;
124
+ currentDir = charDir;
125
+ } else {
126
+ if (charDir !== "neutral") currentDir = charDir;
127
+ current += char;
128
+ }
129
+ }
130
+ if (current) segments.push({ text: current, direction: currentDir });
131
+ return segments;
132
+ }
133
+ function hasBidiMarkers(text) {
134
+ return /[\u202A-\u202E\u200E\u200F]/.test(text);
135
+ }
136
+ function stripBidiMarkers(text) {
137
+ return text.replace(/[\u202A-\u202E\u200E\u200F]/g, "");
138
+ }
139
+
140
+ // src/components/index.tsx
141
+ var import_jsx_runtime = require("react/jsx-runtime");
142
+ function RTLText({ children, style, direction = "auto", wrap = true, debug }) {
143
+ const str = String(children);
144
+ let content;
145
+ if (direction === "rtl") {
146
+ content = wrapRTL(str);
147
+ } else if (direction === "ltr") {
148
+ content = str;
149
+ } else {
150
+ content = smartWrap(str);
151
+ }
152
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Text, { style, wrap, debug, children: content });
153
+ }
154
+ function RTLView({ children, style, debug }) {
155
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.View, { style: [styles.rtlView, style], debug, children });
156
+ }
157
+ function getRTLPageStyle(fontFamily = "Rubik") {
158
+ return {
159
+ fontFamily,
160
+ fontSize: 11,
161
+ direction: "rtl",
162
+ textAlign: "right",
163
+ paddingTop: 40,
164
+ paddingBottom: 60,
165
+ paddingHorizontal: 40
166
+ };
167
+ }
168
+ function RTLTable({
169
+ columns,
170
+ data,
171
+ fontFamily = "Rubik",
172
+ headerBg = "#1F2937",
173
+ headerColor = "#FFFFFF",
174
+ stripeBg = "#F9FAFB",
175
+ borderColor = "#E5E7EB",
176
+ fontSize = 10
177
+ }) {
178
+ const colStyles = columns.map((col) => {
179
+ var _a;
180
+ return {
181
+ flex: (_a = col.flex) != null ? _a : 1,
182
+ width: col.width,
183
+ paddingHorizontal: 8,
184
+ paddingVertical: 6,
185
+ borderRightWidth: 1,
186
+ borderRightColor: borderColor
187
+ };
188
+ });
189
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_renderer.View, { style: { borderWidth: 1, borderColor, fontFamily }, children: [
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.View, { style: [styles.tableRow, { backgroundColor: headerBg, flexDirection: "row-reverse" }], children: columns.map((col, i) => {
191
+ var _a;
192
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.View, { style: colStyles[i], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ import_renderer.Text,
194
+ {
195
+ style: {
196
+ fontSize,
197
+ fontWeight: "bold",
198
+ color: headerColor,
199
+ textAlign: (_a = col.align) != null ? _a : "right"
200
+ },
201
+ children: wrapRTL(col.header)
202
+ }
203
+ ) }, col.key);
204
+ }) }),
205
+ data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
206
+ import_renderer.View,
207
+ {
208
+ style: [
209
+ styles.tableRow,
210
+ { flexDirection: "row-reverse", backgroundColor: rowIndex % 2 === 1 ? stripeBg : "#FFFFFF" }
211
+ ],
212
+ wrap: false,
213
+ children: columns.map((col, i) => {
214
+ var _a;
215
+ const raw = row[col.key];
216
+ let cellText;
217
+ if (col.render) {
218
+ cellText = col.render(raw, row);
219
+ } else if (col.isCurrency && typeof raw === "number") {
220
+ cellText = formatCurrencyRTL(raw);
221
+ } else {
222
+ const str = String(raw != null ? raw : "");
223
+ cellText = hasRTLChars(str) ? wrapRTL(str) : str;
224
+ }
225
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.View, { style: colStyles[i], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
226
+ import_renderer.Text,
227
+ {
228
+ style: {
229
+ fontSize,
230
+ color: "#111827",
231
+ textAlign: (_a = col.align) != null ? _a : col.isCurrency ? "left" : "right"
232
+ },
233
+ children: cellText
234
+ }
235
+ ) }, col.key);
236
+ })
237
+ },
238
+ rowIndex
239
+ ))
240
+ ] });
241
+ }
242
+ function RTLDivider({ color = "#E5E7EB", thickness = 1, marginVertical = 8 }) {
243
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
+ import_renderer.View,
245
+ {
246
+ style: {
247
+ borderBottomWidth: thickness,
248
+ borderBottomColor: color,
249
+ marginVertical
250
+ }
251
+ }
252
+ );
253
+ }
254
+ function RTLSummaryRow({
255
+ label,
256
+ value,
257
+ isCurrency = false,
258
+ bold = false,
259
+ fontSize = 11,
260
+ color = "#111827",
261
+ fontFamily = "Rubik"
262
+ }) {
263
+ const displayValue = isCurrency && typeof value === "number" ? formatCurrencyRTL(value) : String(value);
264
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_renderer.View, { style: [styles.summaryRow, { fontFamily }], children: [
265
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Text, { style: { fontSize, fontWeight: bold ? "bold" : "normal", color, textAlign: "right" }, children: wrapRTL(label) }),
266
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Text, { style: { fontSize, fontWeight: bold ? "bold" : "normal", color, textAlign: "left" }, children: displayValue })
267
+ ] });
268
+ }
269
+ var styles = import_renderer.StyleSheet.create({
270
+ rtlView: {
271
+ flexDirection: "row-reverse",
272
+ textAlign: "right"
273
+ },
274
+ tableRow: {
275
+ flexDirection: "row-reverse",
276
+ alignItems: "center",
277
+ minHeight: 28
278
+ },
279
+ summaryRow: {
280
+ flexDirection: "row",
281
+ justifyContent: "space-between",
282
+ alignItems: "center",
283
+ paddingVertical: 4
284
+ }
285
+ });
286
+
287
+ // src/fonts/register.ts
288
+ var import_renderer2 = require("@react-pdf/renderer");
289
+ function registerRTLFont(options) {
290
+ import_renderer2.Font.register({
291
+ family: options.family,
292
+ fonts: options.fonts
293
+ });
294
+ }
295
+ function registerRubik() {
296
+ import_renderer2.Font.register({
297
+ family: "Rubik",
298
+ fonts: [
299
+ {
300
+ src: "https://fonts.gstatic.com/s/rubik/v28/iJWZBXyIfDnIV5PNhY1KTN7Z-Yh-B4i1UA.woff2",
301
+ fontWeight: 300
302
+ },
303
+ {
304
+ src: "https://fonts.gstatic.com/s/rubik/v28/iJWZBXyIfDnIV5PNhY1KTN7Z-Yh-NYi1UA.woff2",
305
+ fontWeight: 400
306
+ },
307
+ {
308
+ src: "https://fonts.gstatic.com/s/rubik/v28/iJWZBXyIfDnIV5PNhY1KTN7Z-Yh-B4i1UA.woff2",
309
+ fontWeight: 500
310
+ },
311
+ {
312
+ src: "https://fonts.gstatic.com/s/rubik/v28/iJWZBXyIfDnIV5PNhY1KTN7Z-Yh-0oi1UA.woff2",
313
+ fontWeight: 700
314
+ }
315
+ ]
316
+ });
317
+ }
318
+ function registerNotoSansHebrew() {
319
+ import_renderer2.Font.register({
320
+ family: "NotoSansHebrew",
321
+ fonts: [
322
+ {
323
+ src: "https://fonts.gstatic.com/s/notosanshebrew/v38/or3HQ7v33eiDljA1IufXTtVf7V6RvEEdhQlk0LlGxCyaeNKYZC0sqk3xXGJXag.woff2",
324
+ fontWeight: 400
325
+ },
326
+ {
327
+ src: "https://fonts.gstatic.com/s/notosanshebrew/v38/or3HQ7v33eiDljA1IufXTtVf7V6RvEEdhQlk0LlGxCyaeNKYZC0sqk3xXGJXag.woff2",
328
+ fontWeight: 700
329
+ }
330
+ ]
331
+ });
332
+ }
333
+ function disableHyphenation() {
334
+ import_renderer2.Font.registerHyphenationCallback((word) => [word]);
335
+ }
336
+ function setupHebrewPDF(fontFamily = "Rubik") {
337
+ if (fontFamily === "Rubik") {
338
+ registerRubik();
339
+ } else {
340
+ registerNotoSansHebrew();
341
+ }
342
+ disableHyphenation();
343
+ }
344
+ // Annotate the CommonJS export names for ESM import in node:
345
+ 0 && (module.exports = {
346
+ BIDI,
347
+ RTLDivider,
348
+ RTLSummaryRow,
349
+ RTLTable,
350
+ RTLText,
351
+ RTLView,
352
+ disableHyphenation,
353
+ formatCurrencyRTL,
354
+ getRTLPageStyle,
355
+ hasBidiMarkers,
356
+ hasRTLChars,
357
+ isRTLDominant,
358
+ registerNotoSansHebrew,
359
+ registerRTLFont,
360
+ registerRubik,
361
+ setupHebrewPDF,
362
+ smartWrap,
363
+ splitBidiSegments,
364
+ stripBidiMarkers,
365
+ wrapLTR,
366
+ wrapRTL
367
+ });