mantur-components 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -14,7 +14,9 @@ npm install mantur-components
14
14
  npm install react react-dom @arco-design/web-react next-themes react-i18next
15
15
  ```
16
16
 
17
+ `next-themes` 用于组件库内置的 `ThemeSwitch`,它不是 Next.js 框架本身,普通 React/Vite 宿主也可以使用。
17
18
 
19
+ 组件库使用 Tailwind 工具类,不再导出独立的 CSS 文件,不需要引入 `mantur-components/style.css`。
18
20
 
19
21
  ## ManturHeader
20
22
 
@@ -158,20 +160,50 @@ interface ManturTenantContextDetail {
158
160
  }
159
161
  ```
160
162
 
161
- ## 导出的工具方法
163
+ ## i18n 文案
164
+
165
+ 组件库文案按组件拆分为 JSON 文件,目录结构为:
166
+
167
+ ```text
168
+ src/i18n/locales/{locale}/{component}.json
169
+ ```
170
+
171
+ 例如:
172
+
173
+ ```text
174
+ src/i18n/locales/zh-CN/header.json
175
+ src/i18n/locales/zh-CN/lang-switch.json
176
+ src/i18n/locales/en-US/header.json
177
+ src/i18n/locales/en-US/lang-switch.json
178
+ ```
179
+
180
+ 新增组件文案时,按组件新增对应 JSON 文件,并在 `src/i18n.ts` 中聚合。
181
+
182
+ ## 日期工具
183
+
184
+ 组件库导出 `formatDateByLang`,用于按语言格式化日期:
185
+
186
+ ```ts
187
+ import { formatDateByLang } from "mantur-components";
188
+
189
+ formatDateByLang("2026-05-19T12:00:00Z");
190
+ formatDateByLang("2026-05-19T12:00:00Z", "date");
191
+ formatDateByLang("2026-05-19T12:00:00Z", "datetime", "en-US");
192
+ ```
193
+
194
+ 未传语言时会读取组件库当前语言;中文输出 `YYYY-MM-DD` / `YYYY-MM-DD HH:mm:ss`,英文输出 `MM/DD/YYYY` / `MM/DD/YYYY HH:mm:ss`。
195
+
196
+ ## 公共导出
162
197
 
163
198
  ```ts
164
- import {
165
- getManturCurrentTenant,
166
- getManturTenantContextSnapshot,
167
- getManturTenants,
168
- getManturUserPoints,
169
- MANTUR_POINTS_REFRESH_EVENT,
170
- MANTUR_TENANT_CONTEXT_CHANGE_EVENT,
171
- refreshManturTenantContext,
172
- refreshManturUserPoints,
173
- switchAndRefreshManturTenant,
174
- switchManturTenant,
199
+ import { ManturHeader, formatDateByLang } from "mantur-components";
200
+ import type {
201
+ ManturDateFormatType,
202
+ ManturDateInput,
203
+ ManturHeaderProps,
204
+ ManturHeaderUser,
205
+ ManturTenant,
206
+ ManturTenantContextDetail,
175
207
  } from "mantur-components";
176
208
  ```
177
209
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,4 @@
1
1
  export { ManturHeader } from "./header";
2
- export { getManturCurrentTenant, getManturTenantContextSnapshot, getManturTenants, getManturUserPoints, MANTUR_POINTS_REFRESH_EVENT, MANTUR_TENANT_CONTEXT_CHANGE_EVENT, refreshManturUserPoints, refreshManturTenantContext, switchAndRefreshManturTenant, switchManturTenant, } from "./api";
3
- export { getManturMessages, getStoredManturLocale, MANTUR_LANGUAGE_CHANGE_EVENT, MANTUR_LANGUAGE_SOURCE_STORAGE_KEY, MANTUR_LANGUAGE_STORAGE_KEY, MANTUR_MESSAGES, normalizeManturLocale, } from "./i18n";
4
- export { LangSwitch, LANGUAGE_SOURCE_STORAGE_KEY, LANGUAGE_STORAGE_KEY } from "./lang-switch";
5
- export { ThemeSwitch } from "./theme-switch";
6
- export type { ManturLocale, ManturMessages } from "./i18n";
2
+ export { formatDateByLang } from "./utils/date";
3
+ export type { ManturDateFormatType, ManturDateInput } from "./utils/date";
7
4
  export type { ManturHeaderLabels, ManturHeaderProps, ManturHeaderUser, ManturProfileValues, ManturRole, ManturTenant, ManturTenantAuthContext, ManturTenantContextDetail, ManturUserPoints, } from "./types";