@drghaliasri/butex 6.1.2 → 6.1.3

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.
@@ -10447,6 +10447,15 @@ function document2Messages(locale) {
10447
10447
  return DOCUMENT2_MESSAGES[locale];
10448
10448
  }
10449
10449
 
10450
+ // src/react-document2/xelatexTextValidation.ts
10451
+ var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
10452
+ function hasXeLatexUnsupportedEmoji(value) {
10453
+ return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
10454
+ }
10455
+ function unsupportedEmojiMessage(uiLocale) {
10456
+ return uiLocale === "ar" ? "\u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u062A\u0639\u0628\u064A\u0631\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645." : "This emoji is not supported.";
10457
+ }
10458
+
10450
10459
  // src/react-document2/ArticleMetaPanel.tsx
10451
10460
  var import_jsx_runtime = require("react/jsx-runtime");
10452
10461
  var HIJRI_DAYS = Array.from({ length: 30 }, (_, index) => index + 1);
@@ -10454,6 +10463,20 @@ var HIJRI_YEARS = Array.from(
10454
10463
  { length: HIJRI_YEAR_MAX - HIJRI_YEAR_MIN + 1 },
10455
10464
  (_, index) => HIJRI_YEAR_MIN + index
10456
10465
  );
10466
+ var UNSUPPORTED_EMOJI_STYLE = {
10467
+ borderColor: "var(--butex-document2-error)",
10468
+ background: "var(--butex-document2-error-bg)"
10469
+ };
10470
+ function UnsupportedEmojiWarning({
10471
+ id,
10472
+ show,
10473
+ uiLocale
10474
+ }) {
10475
+ if (!show) {
10476
+ return null;
10477
+ }
10478
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id, className: "butex-document2-widget__field-error", children: unsupportedEmojiMessage(uiLocale) });
10479
+ }
10457
10480
  function HijriDateMenu({
10458
10481
  label,
10459
10482
  value,
@@ -10531,6 +10554,12 @@ function ArticleMetaPanel({
10531
10554
  const localRef = (0, import_react.useRef)(null);
10532
10555
  const resolvedRef = panelRef ?? localRef;
10533
10556
  const formattedDate = formatHijriDate(meta.date, { locale: uiLocale, digitForm });
10557
+ const titleUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.title);
10558
+ const authorsUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.authors);
10559
+ const abstractUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.abstract);
10560
+ const titleErrorId = "butex-document2-meta-title-unsupported-emoji";
10561
+ const authorsErrorId = "butex-document2-meta-authors-unsupported-emoji";
10562
+ const abstractErrorId = "butex-document2-meta-abstract-unsupported-emoji";
10534
10563
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
10535
10564
  "section",
10536
10565
  {
@@ -10557,12 +10586,16 @@ function ArticleMetaPanel({
10557
10586
  {
10558
10587
  ref: titleInputRef,
10559
10588
  value: meta.title,
10589
+ "aria-invalid": titleUnsupportedEmoji ? true : void 0,
10590
+ "aria-describedby": titleUnsupportedEmoji ? titleErrorId : void 0,
10591
+ style: titleUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
10560
10592
  onChange: (event) => {
10561
10593
  const value = event.currentTarget.value;
10562
10594
  onChange({ title: value });
10563
10595
  }
10564
10596
  }
10565
- )
10597
+ ),
10598
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnsupportedEmojiWarning, { id: titleErrorId, show: titleUnsupportedEmoji, uiLocale })
10566
10599
  ] }),
10567
10600
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "butex-document2-widget__article-meta-field", children: [
10568
10601
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: messages.articleAuthors }),
@@ -10571,12 +10604,16 @@ function ArticleMetaPanel({
10571
10604
  {
10572
10605
  rows: 2,
10573
10606
  value: meta.authors,
10607
+ "aria-invalid": authorsUnsupportedEmoji ? true : void 0,
10608
+ "aria-describedby": authorsUnsupportedEmoji ? authorsErrorId : void 0,
10609
+ style: authorsUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
10574
10610
  onChange: (event) => {
10575
10611
  const value = event.currentTarget.value;
10576
10612
  onChange({ authors: value });
10577
10613
  }
10578
10614
  }
10579
- )
10615
+ ),
10616
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnsupportedEmojiWarning, { id: authorsErrorId, show: authorsUnsupportedEmoji, uiLocale })
10580
10617
  ] }),
10581
10618
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "butex-document2-widget__article-meta-field", children: [
10582
10619
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: messages.articleDate }),
@@ -10627,12 +10664,16 @@ function ArticleMetaPanel({
10627
10664
  {
10628
10665
  rows: 3,
10629
10666
  value: meta.abstract,
10667
+ "aria-invalid": abstractUnsupportedEmoji ? true : void 0,
10668
+ "aria-describedby": abstractUnsupportedEmoji ? abstractErrorId : void 0,
10669
+ style: abstractUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
10630
10670
  onChange: (event) => {
10631
10671
  const value = event.currentTarget.value;
10632
10672
  onChange({ abstract: value });
10633
10673
  }
10634
10674
  }
10635
- )
10675
+ ),
10676
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnsupportedEmojiWarning, { id: abstractErrorId, show: abstractUnsupportedEmoji, uiLocale })
10636
10677
  ] })
10637
10678
  ] }),
10638
10679
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: BUTEX_CLOSING_HAMDALA })
@@ -11368,12 +11409,6 @@ function RefChip({
11368
11409
  ] });
11369
11410
  }
11370
11411
 
11371
- // src/react-document2/xelatexTextValidation.ts
11372
- var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
11373
- function hasXeLatexUnsupportedEmoji(value) {
11374
- return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
11375
- }
11376
-
11377
11412
  // src/react-document2/InlineField.tsx
11378
11413
  var import_jsx_runtime6 = require("react/jsx-runtime");
11379
11414
  function rememberCaret(element, blockId, fieldId, tokenId, onFieldFocus) {
@@ -11393,9 +11428,6 @@ function fitTextareaHeight(element) {
11393
11428
  element.style.height = "auto";
11394
11429
  element.style.height = `${String(element.scrollHeight)}px`;
11395
11430
  }
11396
- function xeLatexUnsupportedEmojiMessage(uiLocale) {
11397
- return uiLocale === "ar" ? "\u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u062A\u0639\u0628\u064A\u0631\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u062A\u0635\u062F\u064A\u0631 XeLaTeX \u0627\u0644\u062D\u0627\u0644\u064A \u0628\u062E\u0637 Amiri." : "This emoji is not supported by the current XeLaTeX export using the Amiri font.";
11398
- }
11399
11431
  function InlineField({
11400
11432
  field,
11401
11433
  blockId,
@@ -11515,7 +11547,7 @@ function InlineField({
11515
11547
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map((token) => {
11516
11548
  if (token.kind === "text") {
11517
11549
  const unsupportedEmoji = hasXeLatexUnsupportedEmoji(token.text);
11518
- const errorId = `butex-document2-xelatex-text-error-${token.id}`;
11550
+ const errorId = `butex-document2-unsupported-emoji-${token.id}`;
11519
11551
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react3.Fragment, { children: [
11520
11552
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
11521
11553
  "textarea",
@@ -11596,7 +11628,7 @@ function InlineField({
11596
11628
  id: errorId,
11597
11629
  className: "butex-document2-widget__field-error",
11598
11630
  style: { flexBasis: "100%" },
11599
- children: xeLatexUnsupportedEmojiMessage(uiLocale)
11631
+ children: unsupportedEmojiMessage(uiLocale)
11600
11632
  }
11601
11633
  ) : null
11602
11634
  ] }, token.id);