@sustaina/shared-ui 1.23.0 → 1.23.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.
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
18
18
  import { reSplitAlphaNumeric, useReactTable, getCoreRowModel, getGroupedRowModel, getExpandedRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
19
19
  import * as SheetPrimitive from '@radix-ui/react-dialog';
20
20
  import i18n from 'i18next';
21
- import { initReactI18next, useTranslation } from 'react-i18next';
21
+ import { initReactI18next } from 'react-i18next';
22
22
  import { create } from 'zustand';
23
23
  import StarterKit from '@tiptap/starter-kit';
24
24
  import { ReactNodeViewRenderer, NodeViewWrapper, useEditor, EditorContent } from '@tiptap/react';
@@ -5070,17 +5070,17 @@ var defaultResource = {
5070
5070
  };
5071
5071
 
5072
5072
  // src/components/dialog-alert/locale/i18n.ts
5073
- i18n.use(initReactI18next).init({
5073
+ var instance = i18n.createInstance({
5074
5074
  resources: defaultResource,
5075
5075
  lng: "sharedui",
5076
5076
  fallbackLng: "sharedui",
5077
5077
  defaultNS: "translation",
5078
5078
  interpolation: {
5079
5079
  escapeValue: false
5080
- // react already safes from xss
5081
5080
  }
5082
- });
5083
- var i18n_default = i18n;
5081
+ }).use(initReactI18next);
5082
+ instance.init();
5083
+ var i18n_default = instance;
5084
5084
  var titleColorVariant = {
5085
5085
  default: "",
5086
5086
  success: "text-green-600",
@@ -5096,7 +5096,7 @@ function DialogAlert({
5096
5096
  description,
5097
5097
  variant = "default",
5098
5098
  confirmText,
5099
- cancelText = "cancel",
5099
+ cancelText = i18nPrefix + "cancel",
5100
5100
  onConfirm,
5101
5101
  onCancel,
5102
5102
  showCancel = true,
@@ -5105,7 +5105,6 @@ function DialogAlert({
5105
5105
  persistent = false
5106
5106
  }) {
5107
5107
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
5108
- const { t } = useTranslation();
5109
5108
  const handleCancel = useCallback(() => {
5110
5109
  onCancel?.();
5111
5110
  onOpenChange(false);
@@ -5117,13 +5116,13 @@ function DialogAlert({
5117
5116
  return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
5118
5117
  } : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
5119
5118
  /* @__PURE__ */ jsxs(DialogHeader2, { children: [
5120
- title && /* @__PURE__ */ jsx(DialogTitle2, { className: titleColorVariant[variant], children: t(title) }),
5121
- description && /* @__PURE__ */ jsx(DialogDescription2, { children: t(description) })
5119
+ title && /* @__PURE__ */ jsx(DialogTitle2, { className: titleColorVariant[variant], children: i18n_default.t(title) }),
5120
+ description && /* @__PURE__ */ jsx(DialogDescription2, { children: i18n_default.t(description) })
5122
5121
  ] }),
5123
5122
  outlet && outlet,
5124
5123
  /* @__PURE__ */ jsxs("div", { className: `flex gap-3 mt-3 ${alignClass}`, children: [
5125
- showCancel && /* @__PURE__ */ jsx(Button2, { variant: "cancel", onClick: handleCancel, children: t(cancelText) }),
5126
- confirmText && /* @__PURE__ */ jsx(Button2, { variant, onClick: handleConfirm, children: t(confirmText) })
5124
+ showCancel && /* @__PURE__ */ jsx(Button2, { variant: "cancel", onClick: handleCancel, children: i18n_default.t(cancelText) }),
5125
+ confirmText && /* @__PURE__ */ jsx(Button2, { variant, onClick: handleConfirm, children: i18n_default.t(confirmText) })
5127
5126
  ] })
5128
5127
  ] }) });
5129
5128
  }