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.mjs CHANGED
@@ -339,55 +339,31 @@ const FONT_STYLES = {
339
339
  [FontStyle.L3_REGULAR]: createFontStyle("MeraasAktiv-Regular", 10, 14)
340
340
  };
341
341
 
342
- const translateToArabic = async (text) => {
343
- if (!text || text.trim() === "") {
344
- return text;
345
- }
346
- try {
347
- const result = await translate(text, { to: "ar" });
348
- return result.text || text;
349
- } catch (error) {
350
- console.error("Translation error:", error);
351
- return text;
352
- }
353
- };
354
- const useArabicTranslation = (text, shouldTranslate = false) => {
355
- const [translatedText, setTranslatedText] = useState(text || "");
356
- const [isTranslating, setIsTranslating] = useState(false);
357
- const [error, setError] = useState(null);
358
- useEffect(() => {
359
- if (!shouldTranslate || !text) {
360
- setTranslatedText(text || "");
361
- return;
362
- }
363
- const translate2 = async () => {
364
- setIsTranslating(true);
365
- setError(null);
366
- try {
367
- const translated = await translateToArabic(text);
368
- setTranslatedText(translated);
369
- } catch (err) {
370
- setError(err instanceof Error ? err.message : "Translation failed");
371
- setTranslatedText(text);
372
- } finally {
373
- setIsTranslating(false);
374
- }
375
- };
376
- translate2();
377
- }, [text, shouldTranslate]);
378
- return { translatedText, isTranslating, error };
379
- };
380
-
381
342
  const CustomTypography = ({
382
343
  variant,
383
344
  style,
384
345
  text,
385
346
  testID = "CUSTOM_TYPOGRAPHY",
386
- translateToArabic = true,
387
347
  ...props
388
348
  }) => {
349
+ const [translatedText, setTranslatedText] = useState(text || "");
389
350
  const textStyle = FONT_STYLES[variant];
390
- const { translatedText } = useArabicTranslation(text, translateToArabic);
351
+ useEffect(() => {
352
+ const translateText = async () => {
353
+ if (!text || text.trim() === "") {
354
+ setTranslatedText(text || "");
355
+ return;
356
+ }
357
+ try {
358
+ const res = await translate(text, { to: "ar" });
359
+ setTranslatedText(res.text);
360
+ } catch (error) {
361
+ console.error("Translation error:", error);
362
+ setTranslatedText(text);
363
+ }
364
+ };
365
+ translateText();
366
+ }, [text]);
391
367
  return /* @__PURE__ */ React.createElement(
392
368
  Text,
393
369
  {