dhre-ui-kit 0.0.375 → 0.0.376

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/lib/index.d.ts CHANGED
@@ -483,7 +483,6 @@ interface TypoTextProps extends TextProps {
483
483
  variant: keyof typeof FONT_STYLES;
484
484
  text?: string;
485
485
  testID?: string;
486
- translateToArabic?: boolean;
487
486
  }
488
487
  declare const CustomTypography: React$1.FC<TypoTextProps>;
489
488
 
package/lib/index.js CHANGED
@@ -376,55 +376,31 @@ const FONT_STYLES = {
376
376
  [FontStyle.L3_REGULAR]: createFontStyle("MeraasAktiv-Regular", 10, 14)
377
377
  };
378
378
 
379
- const translateToArabic = async (text) => {
380
- if (!text || text.trim() === "") {
381
- return text;
382
- }
383
- try {
384
- const result = await translate__default["default"](text, { to: "ar" });
385
- return result.text || text;
386
- } catch (error) {
387
- console.error("Translation error:", error);
388
- return text;
389
- }
390
- };
391
- const useArabicTranslation = (text, shouldTranslate = false) => {
392
- const [translatedText, setTranslatedText] = React.useState(text || "");
393
- const [isTranslating, setIsTranslating] = React.useState(false);
394
- const [error, setError] = React.useState(null);
395
- React.useEffect(() => {
396
- if (!shouldTranslate || !text) {
397
- setTranslatedText(text || "");
398
- return;
399
- }
400
- const translate2 = async () => {
401
- setIsTranslating(true);
402
- setError(null);
403
- try {
404
- const translated = await translateToArabic(text);
405
- setTranslatedText(translated);
406
- } catch (err) {
407
- setError(err instanceof Error ? err.message : "Translation failed");
408
- setTranslatedText(text);
409
- } finally {
410
- setIsTranslating(false);
411
- }
412
- };
413
- translate2();
414
- }, [text, shouldTranslate]);
415
- return { translatedText, isTranslating, error };
416
- };
417
-
418
379
  const CustomTypography = ({
419
380
  variant,
420
381
  style,
421
382
  text,
422
383
  testID = "CUSTOM_TYPOGRAPHY",
423
- translateToArabic = true,
424
384
  ...props
425
385
  }) => {
386
+ const [translatedText, setTranslatedText] = React.useState(text || "");
426
387
  const textStyle = FONT_STYLES[variant];
427
- const { translatedText } = useArabicTranslation(text, translateToArabic);
388
+ React.useEffect(() => {
389
+ const translateText = async () => {
390
+ if (!text || text.trim() === "") {
391
+ setTranslatedText(text || "");
392
+ return;
393
+ }
394
+ try {
395
+ const res = await translate__default["default"](text, { to: "ar" });
396
+ setTranslatedText(res.text);
397
+ } catch (error) {
398
+ console.error("Translation error:", error);
399
+ setTranslatedText(text);
400
+ }
401
+ };
402
+ translateText();
403
+ }, [text]);
428
404
  return /* @__PURE__ */ React__default["default"].createElement(
429
405
  reactNative.Text,
430
406
  {