@rockshin/tao-ui 0.0.45 → 0.0.46
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 +3 -1
- package/component-manifest.json +32 -3
- package/dist/components/alert/alert.js +20 -17
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js +81 -77
- package/dist/components/calendar/calendar.d.ts +0 -1
- package/dist/components/calendar/calendar.js +41 -30
- package/dist/components/color-picker/color-picker.js +273 -269
- package/dist/components/date-picker/calendar/calendar-grid.js +10 -4
- package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
- package/dist/components/date-picker/calendar/use-calendar.js +2 -3
- package/dist/components/date-picker/date-localization.d.ts +3 -0
- package/dist/components/date-picker/date-localization.js +76 -0
- package/dist/components/date-picker/date-picker.js +35 -27
- package/dist/components/date-picker/range-picker.js +28 -20
- package/dist/components/dropdown/dropdown.js +21 -20
- package/dist/components/float-button/float-button.js +3 -2
- package/dist/components/form/form.js +88 -103
- package/dist/components/image/image.js +202 -137
- package/dist/components/list/list-pagination.js +148 -147
- package/dist/components/modal/confirm-dialog.js +4 -2
- package/dist/components/modal/modal.js +385 -383
- package/dist/components/pagination/pagination.js +115 -110
- package/dist/components/popconfirm/popconfirm.js +109 -107
- package/dist/components/qr-code/qr-code.js +22 -21
- package/dist/components/scroll-area/scroll-area.js +41 -38
- package/dist/components/select/mobile-select.d.ts +1 -1
- package/dist/components/select/mobile-select.js +2 -1
- package/dist/components/sonner/sonner.js +10 -10
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.js +24 -21
- package/dist/components/statistic/statistic.d.ts +2 -0
- package/dist/components/statistic/statistic.js +203 -187
- package/dist/components/table/table-filter.js +61 -52
- package/dist/components/table/table-icons.js +3 -1
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +5 -4
- package/dist/components/tag/tag.js +22 -19
- package/dist/components/time-picker/time-picker.d.ts +0 -1
- package/dist/components/time-picker/time-picker.js +139 -96
- package/dist/components/transfer/transfer-list.js +224 -488
- package/dist/components/transfer/transfer-parts.js +2 -2
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +13 -16
- package/dist/components/upload/upload.js +30 -26
- package/dist/docs/component-docs.d.ts +13 -2
- package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
- package/dist/docs/components/headless-input-number.doc.js +7 -0
- package/dist/docs/components/input-number.doc.d.ts +5 -0
- package/dist/docs/components/input-number.doc.js +7 -0
- package/dist/docs/components/statistic.doc.d.ts +5 -0
- package/dist/docs/components/statistic.doc.js +7 -0
- package/dist/docs/components/tao-provider.doc.d.ts +8 -2
- package/dist/docs/components/tao-provider.doc.js +10 -2
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/entries/provider.d.ts +1 -0
- package/dist/entries/provider.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.d.ts +3 -0
- package/dist/locales/ar-EG.js +199 -0
- package/dist/locales/create-locale.d.ts +41 -0
- package/dist/locales/create-locale.js +88 -0
- package/dist/locales/de-DE.d.ts +3 -0
- package/dist/locales/de-DE.js +195 -0
- package/dist/locales/en-US.d.ts +2 -0
- package/dist/locales/en-US.js +194 -0
- package/dist/locales/es-ES.d.ts +3 -0
- package/dist/locales/es-ES.js +195 -0
- package/dist/locales/fr-FR.d.ts +3 -0
- package/dist/locales/fr-FR.js +195 -0
- package/dist/locales/hi-IN.d.ts +3 -0
- package/dist/locales/hi-IN.js +194 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +194 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/index.js +17 -0
- package/dist/locales/it-IT.d.ts +3 -0
- package/dist/locales/it-IT.js +195 -0
- package/dist/locales/ja-JP.d.ts +3 -0
- package/dist/locales/ja-JP.js +194 -0
- package/dist/locales/ko-KR.d.ts +3 -0
- package/dist/locales/ko-KR.js +194 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.js +195 -0
- package/dist/locales/ru-RU.d.ts +3 -0
- package/dist/locales/ru-RU.js +197 -0
- package/dist/locales/th-TH.d.ts +3 -0
- package/dist/locales/th-TH.js +194 -0
- package/dist/locales/tr-TR.d.ts +3 -0
- package/dist/locales/tr-TR.js +194 -0
- package/dist/locales/types.d.ts +176 -0
- package/dist/locales/types.js +0 -0
- package/dist/locales/vi-VN.d.ts +3 -0
- package/dist/locales/vi-VN.js +194 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +194 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +194 -0
- package/dist/number-input/format.d.ts +4 -3
- package/dist/number-input/format.js +9 -7
- package/dist/number-input/locale.d.ts +19 -0
- package/dist/number-input/locale.js +44 -0
- package/dist/number-input/number-input.js +1 -0
- package/dist/number-input/use-number-input.d.ts +2 -0
- package/dist/number-input/use-number-input.js +180 -176
- package/dist/provider/locale.d.ts +3 -65
- package/dist/provider/locale.js +2 -146
- package/dist/provider/merge-locale.d.ts +8 -0
- package/dist/provider/merge-locale.js +53 -0
- package/dist/provider/tao-provider.d.ts +6 -2
- package/dist/provider/tao-provider.js +2 -4
- package/llms.txt +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ValidateMessages } from '@rc-component/form/es/interface';
|
|
2
|
+
import type { TaoLocale, TaoMessages } from '../locales/types.js';
|
|
3
|
+
export type ResolvedTaoLocale = TaoLocale & {
|
|
4
|
+
messages: TaoMessages;
|
|
5
|
+
};
|
|
6
|
+
/** rc Form groups contain templates; override individual templates, not siblings. */
|
|
7
|
+
export declare function mergeValidateMessages(parent: ValidateMessages | undefined, override: ValidateMessages | undefined): ValidateMessages | undefined;
|
|
8
|
+
export declare function mergeLocale(parent: ResolvedTaoLocale, override: Partial<TaoLocale> | undefined): ResolvedTaoLocale;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { enUS, zhCN } from "./locale.js";
|
|
2
|
+
function mergeValidateMessages(parent, override) {
|
|
3
|
+
if (!override) return parent;
|
|
4
|
+
return {
|
|
5
|
+
...parent,
|
|
6
|
+
...override,
|
|
7
|
+
date: {
|
|
8
|
+
...parent?.date,
|
|
9
|
+
...override.date
|
|
10
|
+
},
|
|
11
|
+
types: {
|
|
12
|
+
...parent?.types,
|
|
13
|
+
...override.types
|
|
14
|
+
},
|
|
15
|
+
string: {
|
|
16
|
+
...parent?.string,
|
|
17
|
+
...override.string
|
|
18
|
+
},
|
|
19
|
+
number: {
|
|
20
|
+
...parent?.number,
|
|
21
|
+
...override.number
|
|
22
|
+
},
|
|
23
|
+
array: {
|
|
24
|
+
...parent?.array,
|
|
25
|
+
...override.array
|
|
26
|
+
},
|
|
27
|
+
pattern: {
|
|
28
|
+
...parent?.pattern,
|
|
29
|
+
...override.pattern
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function mergeLocale(parent, override) {
|
|
34
|
+
if (!override) return parent;
|
|
35
|
+
const legacy = override.locale !== parent.locale ? 'zh_CN' === override.locale ? zhCN : 'en_US' === override.locale ? enUS : void 0 : void 0;
|
|
36
|
+
return {
|
|
37
|
+
...parent,
|
|
38
|
+
...legacy ? {
|
|
39
|
+
numberLocale: legacy.numberLocale,
|
|
40
|
+
dayjsLocale: legacy.dayjsLocale,
|
|
41
|
+
weekStartsOn: legacy.weekStartsOn,
|
|
42
|
+
pickerLocale: legacy.pickerLocale
|
|
43
|
+
} : {},
|
|
44
|
+
...override,
|
|
45
|
+
messages: {
|
|
46
|
+
...parent.messages,
|
|
47
|
+
...legacy?.messages,
|
|
48
|
+
...override.messages
|
|
49
|
+
},
|
|
50
|
+
form: mergeValidateMessages(legacy?.form ?? parent.form, override.form)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export { mergeLocale, mergeValidateMessages };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
2
|
import { type TaoTokenName } from '../theme/tokens.js';
|
|
3
3
|
import { type TaoLocale } from './locale.js';
|
|
4
|
+
import { type ResolvedTaoLocale } from './merge-locale.js';
|
|
4
5
|
export { enUS, type TaoLocale, zhCN } from './locale.js';
|
|
5
6
|
export interface TaoSeedToken {
|
|
6
7
|
colorPrimary?: string;
|
|
@@ -107,6 +108,7 @@ export interface TaoConfig {
|
|
|
107
108
|
compact: boolean;
|
|
108
109
|
}
|
|
109
110
|
interface TaoConfigContextValue extends TaoConfig {
|
|
111
|
+
locale: ResolvedTaoLocale;
|
|
110
112
|
/**
|
|
111
113
|
* Merged CSS custom-property overrides from this provider and all ancestors.
|
|
112
114
|
* Carried through context so portaled layers (Modal/Drawer/Select dropdown…)
|
|
@@ -114,7 +116,9 @@ interface TaoConfigContextValue extends TaoConfig {
|
|
|
114
116
|
*/
|
|
115
117
|
tokenStyle: CSSProperties;
|
|
116
118
|
}
|
|
117
|
-
export declare function useTaoConfig(): TaoConfig
|
|
119
|
+
export declare function useTaoConfig(): TaoConfig & {
|
|
120
|
+
locale: ResolvedTaoLocale;
|
|
121
|
+
};
|
|
118
122
|
/** Internal component access for token propagation through third-party portals. */
|
|
119
123
|
export declare function useTaoInternalConfig(): TaoConfigContextValue;
|
|
120
124
|
/** Resolve DOM inheritance at a component's source, before it creates portals. */
|
|
@@ -155,7 +159,7 @@ export declare function TaoPortalScope({ children, style, asChild, direction: di
|
|
|
155
159
|
export interface TaoProviderProps {
|
|
156
160
|
/** Text and interaction direction. Defaults to the surrounding DOM direction. */
|
|
157
161
|
direction?: TaoDirection;
|
|
158
|
-
/**
|
|
162
|
+
/** Component text and regional settings; omitted keys inherit from the parent. */
|
|
159
163
|
locale?: Partial<TaoLocale>;
|
|
160
164
|
children: ReactNode;
|
|
161
165
|
theme?: TaoThemeConfig;
|
|
@@ -4,6 +4,7 @@ import { Slot } from "@radix-ui/react-slot";
|
|
|
4
4
|
import { createContext, useContext, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { taoTokenVars } from "../theme/tokens.js";
|
|
6
6
|
import { enUS, zhCN } from "./locale.js";
|
|
7
|
+
import { mergeLocale } from "./merge-locale.js";
|
|
7
8
|
const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
8
9
|
size: 'medium',
|
|
9
10
|
disabled: false,
|
|
@@ -297,10 +298,7 @@ function TaoProvider(t0) {
|
|
|
297
298
|
const parentConfig = useContext(TaoConfigContext);
|
|
298
299
|
let t1;
|
|
299
300
|
if ($[0] !== localeProp || $[1] !== parentConfig.locale) {
|
|
300
|
-
t1 = localeProp
|
|
301
|
-
...parentConfig.locale,
|
|
302
|
-
...localeProp
|
|
303
|
-
} : parentConfig.locale;
|
|
301
|
+
t1 = mergeLocale(parentConfig.locale, localeProp);
|
|
304
302
|
$[0] = localeProp;
|
|
305
303
|
$[1] = parentConfig.locale;
|
|
306
304
|
$[2] = t1;
|
package/llms.txt
CHANGED
|
@@ -843,7 +843,7 @@ Use Tag for lightweight metadata or status markers. Use CheckableTag for compact
|
|
|
843
843
|
|
|
844
844
|
### TaoProvider
|
|
845
845
|
|
|
846
|
-
Provides global component defaults, portal scoping, and theme seed token overrides.
|
|
846
|
+
Provides global component defaults, 17 locales with date and number regional settings, portal scoping, and theme seed token overrides.
|
|
847
847
|
|
|
848
848
|
- Category: Config
|
|
849
849
|
- Exports: `TaoProvider`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockshin/tao-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A modern React component library with semantic DOM customization and OKLCH-based theming.",
|
|
6
6
|
"keywords": [
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"types": "./dist/theme/tokens.d.ts",
|
|
43
43
|
"import": "./dist/theme/tokens.js"
|
|
44
44
|
},
|
|
45
|
+
"./locale/*": {
|
|
46
|
+
"types": "./dist/locales/*.d.ts",
|
|
47
|
+
"import": "./dist/locales/*.js"
|
|
48
|
+
},
|
|
45
49
|
"./*": {
|
|
46
50
|
"types": "./dist/entries/*.d.ts",
|
|
47
51
|
"import": "./dist/entries/*.js"
|