@designbasekorea/figma-ui 0.1.66 → 0.1.67

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/dist/index.esm.js CHANGED
@@ -2,7 +2,6 @@ import React, { useRef, useEffect, useState } from 'react';
2
2
  import { HeartFilledIcon, CoffeeFilledIcon, AppWindowIcon, YoutubeIcon, InstagramIcon, FigmaIcon, MailIcon, ExternalLinkIcon, MoreHorizontalIcon, CloseIcon, CircleCheckFilledIcon, ResizableIcon, GripVerticalIcon } from '@designbasekorea/icons';
3
3
  import { SplitView, Button, Toggle, Spinner, Badge, SegmentControl, Logo, Input, Modal, Progressbar } from '@designbasekorea/ui';
4
4
  export * from '@designbasekorea/ui';
5
- import { useTranslation } from 'react-i18next';
6
5
 
7
6
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
8
7
 
@@ -296,15 +295,24 @@ const PaymentBadge = ({ isActive, onClick, isLoading = false, text, t = (key) =>
296
295
  };
297
296
  PaymentBadge.displayName = 'PaymentBadge';
298
297
 
298
+ let useTranslation = null;
299
+ try {
300
+ const reactI18next = require('react-i18next');
301
+ useTranslation = reactI18next.useTranslation;
302
+ }
303
+ catch (e) {
304
+ }
299
305
  const DEFAULT_LANGUAGES = [
300
306
  { code: 'ko', label: 'KO' },
301
307
  { code: 'en', label: 'EN' },
302
308
  ];
303
309
  const LanguageSelector = ({ currentLanguage, languages = DEFAULT_LANGUAGES, onLanguageChange, size = 's', className, t }) => {
304
- const { i18n } = useTranslation();
305
- const activeLanguage = currentLanguage || i18n.language || 'ko';
310
+ const i18n = useTranslation ? useTranslation().i18n : null;
311
+ const activeLanguage = currentLanguage || (i18n?.language) || 'ko';
306
312
  const handleLanguageChange = (languageCode) => {
307
- i18n.changeLanguage(languageCode);
313
+ if (i18n) {
314
+ i18n.changeLanguage(languageCode);
315
+ }
308
316
  if (onLanguageChange) {
309
317
  onLanguageChange(languageCode);
310
318
  }