@rockshin/tao-ui 0.0.44 → 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.
Files changed (152) hide show
  1. package/README.md +9 -1
  2. package/component-manifest.json +38 -4
  3. package/dist/components/alert/alert.js +20 -17
  4. package/dist/components/auto-complete/auto-complete.js +12 -3
  5. package/dist/components/avatar/avatar.js +2 -1
  6. package/dist/components/breadcrumb/breadcrumb.css +4 -0
  7. package/dist/components/breadcrumb/breadcrumb.js +82 -77
  8. package/dist/components/calendar/calendar.d.ts +1 -1
  9. package/dist/components/calendar/calendar.js +51 -33
  10. package/dist/components/card/card-tabs.js +204 -182
  11. package/dist/components/card/card.js +1 -1
  12. package/dist/components/carousel/carousel.js +11 -5
  13. package/dist/components/cascader/cascader.js +16 -4
  14. package/dist/components/collapse/collapse.css +8 -0
  15. package/dist/components/color-picker/color-picker.js +273 -269
  16. package/dist/components/context-menu/context-menu.d.ts +2 -1
  17. package/dist/components/context-menu/context-menu.js +57 -44
  18. package/dist/components/date-picker/calendar/calendar-grid.js +13 -6
  19. package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
  20. package/dist/components/date-picker/calendar/use-calendar.js +2 -3
  21. package/dist/components/date-picker/date-localization.d.ts +3 -0
  22. package/dist/components/date-picker/date-localization.js +76 -0
  23. package/dist/components/date-picker/date-picker.css +4 -0
  24. package/dist/components/date-picker/date-picker.d.ts +1 -0
  25. package/dist/components/date-picker/date-picker.js +48 -30
  26. package/dist/components/date-picker/range-picker.d.ts +1 -0
  27. package/dist/components/date-picker/range-picker.js +41 -23
  28. package/dist/components/drawer/drawer.d.ts +2 -1
  29. package/dist/components/drawer/drawer.js +32 -20
  30. package/dist/components/dropdown/dropdown.d.ts +1 -0
  31. package/dist/components/dropdown/dropdown.js +160 -143
  32. package/dist/components/float-button/float-button.js +3 -2
  33. package/dist/components/form/form.js +88 -103
  34. package/dist/components/image/image.js +202 -137
  35. package/dist/components/list/list-pagination.js +148 -147
  36. package/dist/components/mentions/mentions.js +6 -2
  37. package/dist/components/modal/confirm-dialog.js +4 -2
  38. package/dist/components/modal/modal.d.ts +2 -1
  39. package/dist/components/modal/modal.js +387 -375
  40. package/dist/components/pagination/pagination.css +4 -0
  41. package/dist/components/pagination/pagination.js +115 -110
  42. package/dist/components/popconfirm/popconfirm.js +109 -107
  43. package/dist/components/popover/popover.d.ts +2 -1
  44. package/dist/components/popover/popover.js +185 -176
  45. package/dist/components/qr-code/qr-code.js +22 -21
  46. package/dist/components/rate/rate.js +114 -88
  47. package/dist/components/scroll-area/scroll-area.js +132 -120
  48. package/dist/components/segmented/segmented.js +52 -29
  49. package/dist/components/select/mobile-select.d.ts +3 -2
  50. package/dist/components/select/mobile-select.js +54 -48
  51. package/dist/components/select/select-types.d.ts +1 -0
  52. package/dist/components/select/select.js +19 -6
  53. package/dist/components/slider/slider.js +136 -133
  54. package/dist/components/sonner/sonner.js +10 -10
  55. package/dist/components/spinner/spinner.js +1 -1
  56. package/dist/components/splitter/splitter.css +4 -0
  57. package/dist/components/splitter/splitter.js +29 -24
  58. package/dist/components/statistic/statistic.d.ts +2 -0
  59. package/dist/components/statistic/statistic.js +203 -187
  60. package/dist/components/table/table-filter.js +61 -52
  61. package/dist/components/table/table-icons.js +3 -1
  62. package/dist/components/table/table.css +29 -11
  63. package/dist/components/table/table.d.ts +1 -1
  64. package/dist/components/table/table.js +384 -547
  65. package/dist/components/tabs/tabs.js +3 -2
  66. package/dist/components/tag/tag.js +22 -19
  67. package/dist/components/time-picker/time-picker.d.ts +0 -1
  68. package/dist/components/time-picker/time-picker.js +160 -103
  69. package/dist/components/tooltip/tooltip.d.ts +2 -1
  70. package/dist/components/tooltip/tooltip.js +82 -71
  71. package/dist/components/transfer/transfer-list.js +224 -488
  72. package/dist/components/transfer/transfer-parts.js +14 -4
  73. package/dist/components/transfer/transfer-types.d.ts +1 -0
  74. package/dist/components/transfer/transfer.js +23 -20
  75. package/dist/components/tree/tree-keyboard.d.ts +6 -0
  76. package/dist/components/tree/tree-keyboard.js +27 -0
  77. package/dist/components/tree/tree.js +14 -3
  78. package/dist/components/tree-select/select-engine.d.ts +2 -1
  79. package/dist/components/tree-select/select-engine.js +23 -15
  80. package/dist/components/tree-select/tree-select.js +20 -10
  81. package/dist/components/upload/upload.js +30 -26
  82. package/dist/docs/component-docs.d.ts +13 -2
  83. package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
  84. package/dist/docs/components/headless-input-number.doc.js +7 -0
  85. package/dist/docs/components/input-number.doc.d.ts +5 -0
  86. package/dist/docs/components/input-number.doc.js +7 -0
  87. package/dist/docs/components/statistic.doc.d.ts +5 -0
  88. package/dist/docs/components/statistic.doc.js +7 -0
  89. package/dist/docs/components/tao-provider.doc.d.ts +8 -2
  90. package/dist/docs/components/tao-provider.doc.js +16 -3
  91. package/dist/docs/components/tooltip.doc.d.ts +2 -2
  92. package/dist/entries/provider.d.ts +2 -1
  93. package/dist/entries/provider.js +1 -0
  94. package/dist/index.d.ts +2 -1
  95. package/dist/index.js +1 -0
  96. package/dist/locales/ar-EG.d.ts +3 -0
  97. package/dist/locales/ar-EG.js +199 -0
  98. package/dist/locales/create-locale.d.ts +41 -0
  99. package/dist/locales/create-locale.js +88 -0
  100. package/dist/locales/de-DE.d.ts +3 -0
  101. package/dist/locales/de-DE.js +195 -0
  102. package/dist/locales/en-US.d.ts +2 -0
  103. package/dist/locales/en-US.js +194 -0
  104. package/dist/locales/es-ES.d.ts +3 -0
  105. package/dist/locales/es-ES.js +195 -0
  106. package/dist/locales/fr-FR.d.ts +3 -0
  107. package/dist/locales/fr-FR.js +195 -0
  108. package/dist/locales/hi-IN.d.ts +3 -0
  109. package/dist/locales/hi-IN.js +194 -0
  110. package/dist/locales/id-ID.d.ts +3 -0
  111. package/dist/locales/id-ID.js +194 -0
  112. package/dist/locales/index.d.ts +18 -0
  113. package/dist/locales/index.js +17 -0
  114. package/dist/locales/it-IT.d.ts +3 -0
  115. package/dist/locales/it-IT.js +195 -0
  116. package/dist/locales/ja-JP.d.ts +3 -0
  117. package/dist/locales/ja-JP.js +194 -0
  118. package/dist/locales/ko-KR.d.ts +3 -0
  119. package/dist/locales/ko-KR.js +194 -0
  120. package/dist/locales/pt-BR.d.ts +3 -0
  121. package/dist/locales/pt-BR.js +195 -0
  122. package/dist/locales/ru-RU.d.ts +3 -0
  123. package/dist/locales/ru-RU.js +197 -0
  124. package/dist/locales/th-TH.d.ts +3 -0
  125. package/dist/locales/th-TH.js +194 -0
  126. package/dist/locales/tr-TR.d.ts +3 -0
  127. package/dist/locales/tr-TR.js +194 -0
  128. package/dist/locales/types.d.ts +176 -0
  129. package/dist/locales/types.js +0 -0
  130. package/dist/locales/vi-VN.d.ts +3 -0
  131. package/dist/locales/vi-VN.js +194 -0
  132. package/dist/locales/zh-CN.d.ts +3 -0
  133. package/dist/locales/zh-CN.js +194 -0
  134. package/dist/locales/zh-TW.d.ts +3 -0
  135. package/dist/locales/zh-TW.js +194 -0
  136. package/dist/number-input/format.d.ts +4 -3
  137. package/dist/number-input/format.js +9 -7
  138. package/dist/number-input/locale.d.ts +19 -0
  139. package/dist/number-input/locale.js +44 -0
  140. package/dist/number-input/number-input.js +1 -0
  141. package/dist/number-input/use-number-input.d.ts +2 -0
  142. package/dist/number-input/use-number-input.js +180 -176
  143. package/dist/provider/locale.d.ts +3 -65
  144. package/dist/provider/locale.js +2 -146
  145. package/dist/provider/merge-locale.d.ts +8 -0
  146. package/dist/provider/merge-locale.js +53 -0
  147. package/dist/provider/tao-provider.d.ts +16 -5
  148. package/dist/provider/tao-provider.js +200 -92
  149. package/dist/utils/scroll-left.d.ts +3 -0
  150. package/dist/utils/scroll-left.js +7 -0
  151. package/llms.txt +3 -3
  152. 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,7 +1,8 @@
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
- export { enUS, zhCN, type TaoLocale } from './locale.js';
4
+ import { type ResolvedTaoLocale } from './merge-locale.js';
5
+ export { enUS, type TaoLocale, zhCN } from './locale.js';
5
6
  export interface TaoSeedToken {
6
7
  colorPrimary?: string;
7
8
  colorSuccess?: string;
@@ -94,7 +95,9 @@ export interface TaoThemeConfig {
94
95
  export type TaoSize = 'small' | 'medium' | 'large';
95
96
  export type TaoVariant = 'outlined' | 'filled' | 'borderless';
96
97
  export type TaoStatus = 'error' | 'warning';
98
+ export type TaoDirection = 'ltr' | 'rtl';
97
99
  export interface TaoConfig {
100
+ direction?: TaoDirection;
98
101
  locale: TaoLocale;
99
102
  size: TaoSize;
100
103
  disabled: boolean;
@@ -105,6 +108,7 @@ export interface TaoConfig {
105
108
  compact: boolean;
106
109
  }
107
110
  interface TaoConfigContextValue extends TaoConfig {
111
+ locale: ResolvedTaoLocale;
108
112
  /**
109
113
  * Merged CSS custom-property overrides from this provider and all ancestors.
110
114
  * Carried through context so portaled layers (Modal/Drawer/Select dropdown…)
@@ -112,9 +116,13 @@ interface TaoConfigContextValue extends TaoConfig {
112
116
  */
113
117
  tokenStyle: CSSProperties;
114
118
  }
115
- export declare function useTaoConfig(): TaoConfig;
119
+ export declare function useTaoConfig(): TaoConfig & {
120
+ locale: ResolvedTaoLocale;
121
+ };
116
122
  /** Internal component access for token propagation through third-party portals. */
117
123
  export declare function useTaoInternalConfig(): TaoConfigContextValue;
124
+ /** Resolve DOM inheritance at a component's source, before it creates portals. */
125
+ export declare function useTaoDirection(explicit?: TaoDirection | 'auto', source?: 'parent' | 'self'): readonly [TaoDirection, import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>];
118
126
  /**
119
127
  * antd `theme.useToken` counterpart, zero-runtime edition: returns every
120
128
  * design token as a `var(--tao-*)` reference string, so custom components can
@@ -142,13 +150,16 @@ export declare function useTaoToken(): {
142
150
  * div would otherwise render even while the popup is closed, leaving a ghost
143
151
  * `<div data-tao-provider>` in the body for every mounted-but-closed Select.
144
152
  */
145
- export declare function TaoPortalScope({ children, style, asChild, }: {
153
+ export declare function TaoPortalScope({ children, style, asChild, direction: directionProp, }: {
146
154
  children: ReactNode;
147
155
  style?: CSSProperties;
148
156
  asChild?: boolean;
157
+ direction?: TaoDirection;
149
158
  }): import("react").JSX.Element;
150
159
  export interface TaoProviderProps {
151
- /** Select and calendar text; missing keys inherit from the parent (English at the root). */
160
+ /** Text and interaction direction. Defaults to the surrounding DOM direction. */
161
+ direction?: TaoDirection;
162
+ /** Component text and regional settings; omitted keys inherit from the parent. */
152
163
  locale?: Partial<TaoLocale>;
153
164
  children: ReactNode;
154
165
  theme?: TaoThemeConfig;
@@ -156,4 +167,4 @@ export interface TaoProviderProps {
156
167
  disabled?: boolean;
157
168
  variant?: TaoVariant;
158
169
  }
159
- export declare function TaoProvider({ locale: localeProp, theme, size, disabled, variant, children, }: TaoProviderProps): import("react").JSX.Element;
170
+ export declare function TaoProvider({ direction: directionProp, locale: localeProp, theme, size, disabled, variant, children, }: TaoProviderProps): import("react").JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
- import { createContext, useContext, useRef } from "react";
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,
@@ -14,31 +15,97 @@ const TaoConfigContext = /*#__PURE__*/ createContext({
14
15
  locale: enUS
15
16
  });
16
17
  function useTaoConfig() {
17
- const $ = c(7);
18
- const { size, disabled, variant, mode, compact, locale } = useContext(TaoConfigContext);
18
+ const $ = c(8);
19
+ const { size, disabled, variant, mode, compact, locale, direction } = useContext(TaoConfigContext);
19
20
  let t0;
20
- if ($[0] !== compact || $[1] !== disabled || $[2] !== locale || $[3] !== mode || $[4] !== size || $[5] !== variant) {
21
+ if ($[0] !== compact || $[1] !== direction || $[2] !== disabled || $[3] !== locale || $[4] !== mode || $[5] !== size || $[6] !== variant) {
21
22
  t0 = {
22
23
  size,
23
24
  disabled,
24
25
  variant,
25
26
  mode,
26
27
  compact,
27
- locale
28
+ locale,
29
+ direction
28
30
  };
29
31
  $[0] = compact;
30
- $[1] = disabled;
31
- $[2] = locale;
32
- $[3] = mode;
33
- $[4] = size;
34
- $[5] = variant;
35
- $[6] = t0;
36
- } else t0 = $[6];
32
+ $[1] = direction;
33
+ $[2] = disabled;
34
+ $[3] = locale;
35
+ $[4] = mode;
36
+ $[5] = size;
37
+ $[6] = variant;
38
+ $[7] = t0;
39
+ } else t0 = $[7];
37
40
  return t0;
38
41
  }
39
42
  function useTaoInternalConfig() {
40
43
  return useContext(TaoConfigContext);
41
44
  }
45
+ function useTaoDirection(explicit, t0) {
46
+ const $ = c(8);
47
+ const source = void 0 === t0 ? "parent" : t0;
48
+ const { direction: contextDirection } = useContext(TaoConfigContext);
49
+ const [element, setElement] = useState(null);
50
+ const [inherited, setInherited] = useState();
51
+ let t1;
52
+ let t2;
53
+ if ($[0] !== contextDirection || $[1] !== element || $[2] !== explicit || $[3] !== source) {
54
+ t1 = ()=>{
55
+ if (explicit && "auto" !== explicit || !element) return;
56
+ const target = "self" === source || "auto" === explicit ? element : element.parentElement;
57
+ if (!target) return;
58
+ const update = ()=>{
59
+ const value = getComputedStyle(target).direction || target.closest("[dir]")?.getAttribute("dir") || contextDirection;
60
+ setInherited("rtl" === value ? "rtl" : "ltr");
61
+ for(let ancestor = target; ancestor; ancestor = ancestor.parentElement){
62
+ const auto = "auto" === ancestor.dir;
63
+ observer.observe(ancestor, {
64
+ attributes: true,
65
+ attributeFilter: [
66
+ "dir",
67
+ "style",
68
+ "class"
69
+ ],
70
+ childList: auto,
71
+ characterData: auto,
72
+ subtree: auto
73
+ });
74
+ }
75
+ };
76
+ const observer = new MutationObserver(update);
77
+ update();
78
+ return ()=>observer.disconnect();
79
+ };
80
+ t2 = [
81
+ element,
82
+ explicit,
83
+ contextDirection,
84
+ source
85
+ ];
86
+ $[0] = contextDirection;
87
+ $[1] = element;
88
+ $[2] = explicit;
89
+ $[3] = source;
90
+ $[4] = t1;
91
+ $[5] = t2;
92
+ } else {
93
+ t1 = $[4];
94
+ t2 = $[5];
95
+ }
96
+ useLayoutEffect(t1, t2);
97
+ const t3 = ("auto" === explicit ? void 0 : explicit) ?? inherited ?? contextDirection ?? "ltr";
98
+ let t4;
99
+ if ($[6] !== t3) {
100
+ t4 = [
101
+ t3,
102
+ setElement
103
+ ];
104
+ $[6] = t3;
105
+ $[7] = t4;
106
+ } else t4 = $[7];
107
+ return t4;
108
+ }
42
109
  function useTaoToken() {
43
110
  const $ = c(1);
44
111
  let t0;
@@ -51,82 +118,119 @@ function useTaoToken() {
51
118
  return t0;
52
119
  }
53
120
  function TaoPortalScope(t0) {
54
- const $ = c(20);
55
- const { children, style, asChild } = t0;
56
- const { tokenStyle, mode, compact } = useTaoInternalConfig();
121
+ const $ = c(31);
122
+ const { children, style, asChild, direction: directionProp } = t0;
123
+ const config = useTaoInternalConfig();
124
+ const { tokenStyle, mode, compact } = config;
125
+ const direction = directionProp ?? config.direction;
57
126
  let t1;
58
- if ($[0] !== mode) {
59
- t1 = "light" === mode ? void 0 : {
60
- "data-tao-theme": mode
127
+ if ($[0] !== config || $[1] !== direction) {
128
+ t1 = {
129
+ ...config,
130
+ direction
61
131
  };
62
- $[0] = mode;
63
- $[1] = t1;
64
- } else t1 = $[1];
65
- const themeAttr = t1;
132
+ $[0] = config;
133
+ $[1] = direction;
134
+ $[2] = t1;
135
+ } else t1 = $[2];
136
+ const portalConfig = t1;
66
137
  let t2;
67
- if ($[2] !== compact) {
68
- t2 = compact ? {
138
+ if ($[3] !== mode) {
139
+ t2 = "light" === mode ? void 0 : {
140
+ "data-tao-theme": mode
141
+ };
142
+ $[3] = mode;
143
+ $[4] = t2;
144
+ } else t2 = $[4];
145
+ const themeAttr = t2;
146
+ let t3;
147
+ if ($[5] !== compact) {
148
+ t3 = compact ? {
69
149
  "data-tao-density": "compact"
70
150
  } : void 0;
71
- $[2] = compact;
72
- $[3] = t2;
73
- } else t2 = $[3];
74
- const densityAttr = t2;
151
+ $[5] = compact;
152
+ $[6] = t3;
153
+ } else t3 = $[6];
154
+ const densityAttr = t3;
75
155
  if (asChild) {
76
- let t3;
77
- if ($[4] !== style || $[5] !== tokenStyle) {
78
- t3 = {
156
+ let t4;
157
+ if ($[7] !== style || $[8] !== tokenStyle) {
158
+ t4 = {
79
159
  ...tokenStyle,
80
160
  ...style
81
161
  };
82
- $[4] = style;
83
- $[5] = tokenStyle;
84
- $[6] = t3;
85
- } else t3 = $[6];
86
- let t4;
87
- if ($[7] !== children || $[8] !== densityAttr || $[9] !== t3 || $[10] !== themeAttr) {
88
- t4 = /*#__PURE__*/ jsx(Slot, {
162
+ $[7] = style;
163
+ $[8] = tokenStyle;
164
+ $[9] = t4;
165
+ } else t4 = $[9];
166
+ let t5;
167
+ if ($[10] !== children || $[11] !== densityAttr || $[12] !== direction || $[13] !== t4 || $[14] !== themeAttr) {
168
+ t5 = /*#__PURE__*/ jsx(Slot, {
169
+ dir: direction,
89
170
  "data-tao-provider": "",
90
171
  ...themeAttr,
91
172
  ...densityAttr,
92
- style: t3,
173
+ style: t4,
93
174
  children: children
94
175
  });
95
- $[7] = children;
96
- $[8] = densityAttr;
97
- $[9] = t3;
98
- $[10] = themeAttr;
99
- $[11] = t4;
100
- } else t4 = $[11];
101
- return t4;
176
+ $[10] = children;
177
+ $[11] = densityAttr;
178
+ $[12] = direction;
179
+ $[13] = t4;
180
+ $[14] = themeAttr;
181
+ $[15] = t5;
182
+ } else t5 = $[15];
183
+ let t6;
184
+ if ($[16] !== portalConfig || $[17] !== t5) {
185
+ t6 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
186
+ value: portalConfig,
187
+ children: t5
188
+ });
189
+ $[16] = portalConfig;
190
+ $[17] = t5;
191
+ $[18] = t6;
192
+ } else t6 = $[18];
193
+ return t6;
102
194
  }
103
- let t3;
104
- if ($[12] !== style || $[13] !== tokenStyle) {
105
- t3 = {
195
+ let t4;
196
+ if ($[19] !== style || $[20] !== tokenStyle) {
197
+ t4 = {
106
198
  display: "contents",
107
199
  ...tokenStyle,
108
200
  ...style
109
201
  };
110
- $[12] = style;
111
- $[13] = tokenStyle;
112
- $[14] = t3;
113
- } else t3 = $[14];
114
- let t4;
115
- if ($[15] !== children || $[16] !== densityAttr || $[17] !== t3 || $[18] !== themeAttr) {
116
- t4 = /*#__PURE__*/ jsx("div", {
202
+ $[19] = style;
203
+ $[20] = tokenStyle;
204
+ $[21] = t4;
205
+ } else t4 = $[21];
206
+ let t5;
207
+ if ($[22] !== children || $[23] !== densityAttr || $[24] !== direction || $[25] !== t4 || $[26] !== themeAttr) {
208
+ t5 = /*#__PURE__*/ jsx("div", {
209
+ dir: direction,
117
210
  "data-tao-provider": "",
118
211
  ...themeAttr,
119
212
  ...densityAttr,
120
- style: t3,
213
+ style: t4,
121
214
  children: children
122
215
  });
123
- $[15] = children;
124
- $[16] = densityAttr;
125
- $[17] = t3;
126
- $[18] = themeAttr;
127
- $[19] = t4;
128
- } else t4 = $[19];
129
- return t4;
216
+ $[22] = children;
217
+ $[23] = densityAttr;
218
+ $[24] = direction;
219
+ $[25] = t4;
220
+ $[26] = themeAttr;
221
+ $[27] = t5;
222
+ } else t5 = $[27];
223
+ let t6;
224
+ if ($[28] !== portalConfig || $[29] !== t5) {
225
+ t6 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
226
+ value: portalConfig,
227
+ children: t5
228
+ });
229
+ $[28] = portalConfig;
230
+ $[29] = t5;
231
+ $[30] = t6;
232
+ } else t6 = $[30];
233
+ return t6;
130
234
  }
131
235
  const TOKEN_TO_VAR = {
132
236
  colorPrimary: '--tao-color-primary',
@@ -188,15 +292,13 @@ const UNITLESS_COMPONENT_TOKEN_KEYS = new Set([
188
292
  'fontWeight'
189
293
  ]);
190
294
  function TaoProvider(t0) {
191
- const $ = c(30);
192
- const { locale: localeProp, theme, size, disabled, variant, children } = t0;
295
+ const $ = c(33);
296
+ const { direction: directionProp, locale: localeProp, theme, size, disabled, variant, children } = t0;
297
+ const [direction, directionRef] = useTaoDirection(directionProp);
193
298
  const parentConfig = useContext(TaoConfigContext);
194
299
  let t1;
195
300
  if ($[0] !== localeProp || $[1] !== parentConfig.locale) {
196
- t1 = localeProp ? {
197
- ...parentConfig.locale,
198
- ...localeProp
199
- } : parentConfig.locale;
301
+ t1 = mergeLocale(parentConfig.locale, localeProp);
200
302
  $[0] = localeProp;
201
303
  $[1] = parentConfig.locale;
202
304
  $[2] = t1;
@@ -291,8 +393,9 @@ function TaoProvider(t0) {
291
393
  const t7 = disabled ?? (inherit ? parentDisabled : false);
292
394
  const t8 = variant ?? (inherit ? parentVariant : "outlined");
293
395
  let t9;
294
- if ($[14] !== compact || $[15] !== locale || $[16] !== mode || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== tokenStyle) {
396
+ if ($[14] !== compact || $[15] !== direction || $[16] !== locale || $[17] !== mode || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 || $[21] !== tokenStyle) {
295
397
  t9 = {
398
+ direction,
296
399
  size: t6,
297
400
  disabled: t7,
298
401
  variant: t8,
@@ -302,42 +405,47 @@ function TaoProvider(t0) {
302
405
  locale
303
406
  };
304
407
  $[14] = compact;
305
- $[15] = locale;
306
- $[16] = mode;
307
- $[17] = t6;
308
- $[18] = t7;
309
- $[19] = t8;
310
- $[20] = tokenStyle;
311
- $[21] = t9;
312
- } else t9 = $[21];
408
+ $[15] = direction;
409
+ $[16] = locale;
410
+ $[17] = mode;
411
+ $[18] = t6;
412
+ $[19] = t7;
413
+ $[20] = t8;
414
+ $[21] = tokenStyle;
415
+ $[22] = t9;
416
+ } else t9 = $[22];
313
417
  const config = t9;
314
418
  const t10 = "light" === mode ? void 0 : mode;
315
419
  const t11 = compact ? "compact" : void 0;
316
420
  let t12;
317
- if ($[22] !== children || $[23] !== divStyle || $[24] !== t10 || $[25] !== t11) {
421
+ if ($[23] !== children || $[24] !== directionProp || $[25] !== directionRef || $[26] !== divStyle || $[27] !== t10 || $[28] !== t11) {
318
422
  t12 = /*#__PURE__*/ jsx("div", {
423
+ ref: directionRef,
424
+ dir: directionProp,
319
425
  style: divStyle,
320
426
  "data-tao-provider": "",
321
427
  "data-tao-theme": t10,
322
428
  "data-tao-density": t11,
323
429
  children: children
324
430
  });
325
- $[22] = children;
326
- $[23] = divStyle;
327
- $[24] = t10;
328
- $[25] = t11;
329
- $[26] = t12;
330
- } else t12 = $[26];
431
+ $[23] = children;
432
+ $[24] = directionProp;
433
+ $[25] = directionRef;
434
+ $[26] = divStyle;
435
+ $[27] = t10;
436
+ $[28] = t11;
437
+ $[29] = t12;
438
+ } else t12 = $[29];
331
439
  let t13;
332
- if ($[27] !== config || $[28] !== t12) {
440
+ if ($[30] !== config || $[31] !== t12) {
333
441
  t13 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
334
442
  value: config,
335
443
  children: t12
336
444
  });
337
- $[27] = config;
338
- $[28] = t12;
339
- $[29] = t13;
340
- } else t13 = $[29];
445
+ $[30] = config;
446
+ $[31] = t12;
447
+ $[32] = t13;
448
+ } else t13 = $[32];
341
449
  return t13;
342
450
  }
343
- export { TaoPortalScope, TaoProvider, enUS, useTaoConfig, useTaoInternalConfig, useTaoToken, zhCN };
451
+ export { TaoPortalScope, TaoProvider, enUS, useTaoConfig, useTaoDirection, useTaoInternalConfig, useTaoToken, zhCN };
@@ -0,0 +1,3 @@
1
+ /** Physical offset from the left edge; native RTL scrollLeft runs from -max to 0. */
2
+ export declare function getScrollLeft(element: HTMLElement, direction?: string): number;
3
+ export declare function setScrollLeft(element: HTMLElement, left: number): void;
@@ -0,0 +1,7 @@
1
+ function getScrollLeft(element, direction = getComputedStyle(element).direction) {
2
+ return 'rtl' === direction ? element.scrollWidth - element.clientWidth + element.scrollLeft : element.scrollLeft;
3
+ }
4
+ function setScrollLeft(element, left) {
5
+ element.scrollLeft = 'rtl' === getComputedStyle(element).direction ? left - (element.scrollWidth - element.clientWidth) : left;
6
+ }
7
+ export { getScrollLeft, setScrollLeft };
package/llms.txt CHANGED
@@ -15,7 +15,7 @@ The package root remains available and includes all component styles.
15
15
 
16
16
  ## Core Concepts
17
17
 
18
- - `TaoProvider` supplies size, disabled, variant, portal scope, and theme seed token defaults.
18
+ - `TaoProvider` supplies size, disabled, variant, direction, portal scope, and theme seed token defaults.
19
19
  - Components expose semantic DOM customization through `classNames` and `styles` props.
20
20
  - Theme tokens are CSS custom properties prefixed with `--tao-*`; import `tokenVar(name)` and `taoTokenNames` from `@rockshin/tao-ui/tokens`.
21
21
  - Import `componentDocs` and `getComponentDoc(name)` from `@rockshin/tao-ui/meta` for machine-readable component metadata.
@@ -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`
@@ -851,7 +851,7 @@ Provides global component defaults, portal scoping, and theme seed token overrid
851
851
  - Storybook: `stories/provider.stories.tsx`
852
852
  - Tests: `tests/provider/tao-provider.test.tsx`
853
853
 
854
- Wrap an app or subtree with TaoProvider to set size, disabled, variant, and theme defaults.
854
+ Wrap an app or subtree with TaoProvider to set size, disabled, variant, direction, and theme defaults.
855
855
 
856
856
  ### Textarea
857
857
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockshin/tao-ui",
3
- "version": "0.0.44",
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"