@rockshin/tao-ui 0.0.43 → 0.0.45
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 +7 -1
- package/component-manifest.json +10 -3
- package/dist/components/auto-complete/auto-complete.js +12 -3
- package/dist/components/breadcrumb/breadcrumb.css +4 -0
- package/dist/components/breadcrumb/breadcrumb.js +1 -0
- package/dist/components/calendar/calendar.d.ts +1 -0
- package/dist/components/calendar/calendar.js +10 -3
- package/dist/components/card/card-tabs.js +204 -182
- package/dist/components/card/card.js +1 -1
- package/dist/components/carousel/carousel.js +11 -5
- package/dist/components/cascader/cascader.js +16 -4
- package/dist/components/collapse/collapse.css +8 -0
- package/dist/components/context-menu/context-menu.d.ts +2 -1
- package/dist/components/context-menu/context-menu.js +57 -44
- package/dist/components/date-picker/calendar/calendar-grid.js +3 -2
- package/dist/components/date-picker/date-picker.css +4 -0
- package/dist/components/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.js +13 -3
- package/dist/components/date-picker/range-picker.d.ts +1 -0
- package/dist/components/date-picker/range-picker.js +13 -3
- package/dist/components/drawer/drawer.d.ts +2 -1
- package/dist/components/drawer/drawer.js +32 -20
- package/dist/components/dropdown/dropdown.d.ts +1 -0
- package/dist/components/dropdown/dropdown.js +139 -123
- package/dist/components/form/field-control.d.ts +6 -0
- package/dist/components/form/field-control.js +42 -0
- package/dist/components/form/form-context.d.ts +3 -0
- package/dist/components/form/form-item.d.ts +2 -1
- package/dist/components/form/form-item.js +55 -42
- package/dist/components/form/form.d.ts +5 -5
- package/dist/components/form/form.js +86 -68
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/use-form.d.ts +16 -0
- package/dist/components/form/use-form.js +69 -0
- package/dist/components/form-field/form-field-view.d.ts +4 -2
- package/dist/components/form-field/form-field-view.js +42 -35
- package/dist/components/mentions/mentions.js +6 -2
- package/dist/components/modal/modal.d.ts +2 -1
- package/dist/components/modal/modal.js +14 -4
- package/dist/components/pagination/pagination.css +4 -0
- package/dist/components/popover/popover.d.ts +2 -1
- package/dist/components/popover/popover.js +185 -176
- package/dist/components/rate/rate.js +114 -88
- package/dist/components/scroll-area/scroll-area.js +127 -118
- package/dist/components/segmented/segmented.js +52 -29
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +52 -47
- package/dist/components/select/select-types.d.ts +1 -0
- package/dist/components/select/select.js +19 -6
- package/dist/components/slider/slider.js +136 -133
- package/dist/components/splitter/splitter.css +4 -0
- package/dist/components/splitter/splitter.js +5 -3
- package/dist/components/table/table.css +29 -11
- package/dist/components/table/table.js +383 -547
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/time-picker/time-picker.js +21 -7
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.js +82 -71
- package/dist/components/transfer/transfer-parts.js +12 -2
- package/dist/components/transfer/transfer.js +10 -4
- package/dist/components/tree/tree-keyboard.d.ts +6 -0
- package/dist/components/tree/tree-keyboard.js +27 -0
- package/dist/components/tree/tree.js +14 -3
- package/dist/components/tree-select/select-engine.d.ts +2 -1
- package/dist/components/tree-select/select-engine.js +23 -15
- package/dist/components/tree-select/tree-select.js +20 -10
- package/dist/docs/components/form.doc.js +3 -1
- package/dist/docs/components/tao-provider.doc.js +6 -1
- package/dist/entries/form.d.ts +2 -2
- package/dist/entries/provider.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/provider/tao-provider.d.ts +10 -3
- package/dist/provider/tao-provider.js +198 -88
- package/dist/utils/scroll-left.d.ts +3 -0
- package/dist/utils/scroll-left.js +7 -0
- package/llms.txt +3 -3
- package/package.json +4 -2
|
@@ -9,7 +9,8 @@ const formDoc = {
|
|
|
9
9
|
source: 'src/components/form/form.tsx',
|
|
10
10
|
story: 'stories/form.stories.tsx',
|
|
11
11
|
tests: [
|
|
12
|
-
'tests/form/form.test.tsx'
|
|
12
|
+
'tests/form/form.test.tsx',
|
|
13
|
+
'tests/form/form-scroll.test.tsx'
|
|
13
14
|
],
|
|
14
15
|
semanticParts: [
|
|
15
16
|
'root'
|
|
@@ -32,6 +33,7 @@ const formDoc = {
|
|
|
32
33
|
'Declare validation as rules on Form.Item; the required mark is inferred from rules.',
|
|
33
34
|
'Use dependencies for cross-field rules such as password confirmation.',
|
|
34
35
|
'Use Form.useForm() for imperative control (setFieldsValue, resetFields, submit).',
|
|
36
|
+
'Call form.scrollToField(name, { focus: true }) to reveal a mounted field, including full Form.List paths; custom controls must forward ref or id.',
|
|
35
37
|
'Set size or disabled on Form to cascade them to every control inside.'
|
|
36
38
|
],
|
|
37
39
|
avoid: [
|
|
@@ -24,7 +24,7 @@ const taoProviderDoc = {
|
|
|
24
24
|
'tokenVar'
|
|
25
25
|
],
|
|
26
26
|
usage: {
|
|
27
|
-
description: 'Wrap an app or subtree with TaoProvider to set size, disabled, variant, and theme defaults.',
|
|
27
|
+
description: 'Wrap an app or subtree with TaoProvider to set size, disabled, variant, direction, and theme defaults.',
|
|
28
28
|
bestPractices: [
|
|
29
29
|
'Prefer provider-level defaults for app-wide decisions.',
|
|
30
30
|
'Use nested providers for scoped theme overrides.'
|
|
@@ -34,6 +34,11 @@ const taoProviderDoc = {
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
props: [
|
|
37
|
+
{
|
|
38
|
+
name: 'direction',
|
|
39
|
+
type: "'ltr' | 'rtl'",
|
|
40
|
+
description: 'Text and interaction direction. Inherits the surrounding DOM when omitted; nested providers and component props can override it. Portals retain their source direction.'
|
|
41
|
+
},
|
|
37
42
|
{
|
|
38
43
|
name: 'size',
|
|
39
44
|
type: 'TaoSize',
|
package/dist/entries/form.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../theme/theme.css';
|
|
2
2
|
import '../theme/control.css';
|
|
3
|
-
export type {
|
|
4
|
-
export { Form, type FormItemChildren, type FormItemProps, type FormItemSemanticPart, type FormItemValidateStatus, type FormProps, type FormSemanticPart, } from '../components/form/index.js';
|
|
3
|
+
export type { NamePath, Rule, RuleObject, } from '@rc-component/form';
|
|
4
|
+
export { Form, type FormInstance, type FormScrollOptions, type FormItemChildren, type FormItemProps, type FormItemSemanticPart, type FormItemValidateStatus, type FormProps, type FormSemanticPart, } from '../components/form/index.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '../theme/theme.css';
|
|
2
2
|
import '../theme/control.css';
|
|
3
|
-
export { type ButtonComponentToken, enUS, type FormFieldComponentToken, type InputComponentToken, type TaoComponentTokenMap, type TaoConfig, type TaoLocale, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoStatus, type TaoThemeConfig, type TaoThemeMode, type TaoVariant, useTaoConfig, useTaoToken, zhCN, } from '../provider/tao-provider.js';
|
|
3
|
+
export { type ButtonComponentToken, enUS, type FormFieldComponentToken, type InputComponentToken, type TaoComponentTokenMap, type TaoConfig, type TaoDirection, type TaoLocale, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoStatus, type TaoThemeConfig, type TaoThemeMode, type TaoVariant, useTaoConfig, useTaoToken, zhCN, } from '../provider/tao-provider.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './theme/theme.css';
|
|
2
2
|
import './theme/control.css';
|
|
3
|
-
export type {
|
|
3
|
+
export type { NamePath, Rule, RuleObject, } from '@rc-component/form';
|
|
4
4
|
export { Affix, type AffixProps, type AffixRef, type AffixSemanticPart, } from './components/affix/affix.js';
|
|
5
5
|
export { Alert, type AlertProps, type AlertSemanticPart, type AlertType, } from './components/alert/alert.js';
|
|
6
6
|
export type { AutoCompleteOption, AutoCompleteProps, AutoCompleteRef, AutoCompleteSemanticPart, AutoCompleteSemanticType, DataSourceItemObject, DataSourceItemType, } from './components/auto-complete/auto-complete.js';
|
|
@@ -29,7 +29,7 @@ export { Drawer, type DrawerPlacement, type DrawerProps, type DrawerResizableCon
|
|
|
29
29
|
export { Dropdown, type DropdownButtonProps, type DropdownPlacement, type DropdownProps, type DropdownSemanticPart, type DropdownTrigger, type MenuDividerType, type MenuGroupType, type MenuItem, type MenuItemType, type MenuProps, } from './components/dropdown/dropdown.js';
|
|
30
30
|
export { Empty, type EmptyProps, type EmptyRef, type EmptySemanticPart, } from './components/empty/empty.js';
|
|
31
31
|
export { type BackTopProps, FloatButton, type FloatButtonBackTopProps, type FloatButtonBadgeProps, type FloatButtonElement, type FloatButtonGroupProps, type FloatButtonGroupRef, type FloatButtonGroupSemanticPart, type FloatButtonGroupTrigger, type FloatButtonProps, type FloatButtonRef, type FloatButtonSemanticPart, type FloatButtonShape, type FloatButtonType, } from './components/float-button/float-button.js';
|
|
32
|
-
export { Form, type FormItemChildren, type FormItemProps, type FormItemSemanticPart, type FormItemValidateStatus, type FormProps, type FormSemanticPart, } from './components/form/index.js';
|
|
32
|
+
export { Form, type FormInstance, type FormScrollOptions, type FormItemChildren, type FormItemProps, type FormItemSemanticPart, type FormItemValidateStatus, type FormProps, type FormSemanticPart, } from './components/form/index.js';
|
|
33
33
|
export { FormActions, type FormActionsProps, type FormActionsSemanticPart, } from './components/form-actions/form-actions.js';
|
|
34
34
|
export { FormField, type FormFieldProps, type FormFieldSemanticPart, } from './components/form-field/form-field.js';
|
|
35
35
|
export { FormSection, type FormSectionProps, type FormSectionSemanticPart, } from './components/form-section/form-section.js';
|
|
@@ -80,7 +80,7 @@ export { Watermark, type WatermarkContent, type WatermarkFont, type WatermarkPro
|
|
|
80
80
|
export { FormLayout, type FormLayoutProps, type FormLayoutSemanticPart, } from './layouts/form-layout/form-layout.js';
|
|
81
81
|
export { Stack, type StackProps, type StackSemanticPart, } from './layouts/stack/stack.js';
|
|
82
82
|
export { type FormatOptions, HeadlessInputNumber, type HeadlessInputNumberProps, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from './number-input/index.js';
|
|
83
|
-
export { type ButtonComponentToken, enUS, type FormFieldComponentToken, type InputComponentToken, type TaoComponentTokenMap, type TaoConfig, type TaoLocale, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoStatus, type TaoThemeConfig, type TaoThemeMode, type TaoVariant, useTaoConfig, useTaoToken, zhCN, } from './provider/tao-provider.js';
|
|
83
|
+
export { type ButtonComponentToken, enUS, type FormFieldComponentToken, type InputComponentToken, type TaoComponentTokenMap, type TaoConfig, type TaoDirection, type TaoLocale, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoStatus, type TaoThemeConfig, type TaoThemeMode, type TaoVariant, useTaoConfig, useTaoToken, zhCN, } from './provider/tao-provider.js';
|
|
84
84
|
export { type TaoTokenName, taoTokenNames, tokenVar } from './theme/tokens.js';
|
|
85
85
|
export { resolveResponsiveValue, type TaoBreakpoint, type TaoBreakpointMap, type TaoResponsiveValue, useBreakpoint, useIsMobile, } from './utils/breakpoint.js';
|
|
86
86
|
export { cx, type SemanticClassNames, type SemanticStyles, } from './utils/semantic.js';
|
|
@@ -1,7 +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
|
-
export { enUS,
|
|
4
|
+
export { enUS, type TaoLocale, zhCN } from './locale.js';
|
|
5
5
|
export interface TaoSeedToken {
|
|
6
6
|
colorPrimary?: string;
|
|
7
7
|
colorSuccess?: string;
|
|
@@ -94,7 +94,9 @@ export interface TaoThemeConfig {
|
|
|
94
94
|
export type TaoSize = 'small' | 'medium' | 'large';
|
|
95
95
|
export type TaoVariant = 'outlined' | 'filled' | 'borderless';
|
|
96
96
|
export type TaoStatus = 'error' | 'warning';
|
|
97
|
+
export type TaoDirection = 'ltr' | 'rtl';
|
|
97
98
|
export interface TaoConfig {
|
|
99
|
+
direction?: TaoDirection;
|
|
98
100
|
locale: TaoLocale;
|
|
99
101
|
size: TaoSize;
|
|
100
102
|
disabled: boolean;
|
|
@@ -115,6 +117,8 @@ interface TaoConfigContextValue extends TaoConfig {
|
|
|
115
117
|
export declare function useTaoConfig(): TaoConfig;
|
|
116
118
|
/** Internal component access for token propagation through third-party portals. */
|
|
117
119
|
export declare function useTaoInternalConfig(): TaoConfigContextValue;
|
|
120
|
+
/** Resolve DOM inheritance at a component's source, before it creates portals. */
|
|
121
|
+
export declare function useTaoDirection(explicit?: TaoDirection | 'auto', source?: 'parent' | 'self'): readonly [TaoDirection, import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>];
|
|
118
122
|
/**
|
|
119
123
|
* antd `theme.useToken` counterpart, zero-runtime edition: returns every
|
|
120
124
|
* design token as a `var(--tao-*)` reference string, so custom components can
|
|
@@ -142,12 +146,15 @@ export declare function useTaoToken(): {
|
|
|
142
146
|
* div would otherwise render even while the popup is closed, leaving a ghost
|
|
143
147
|
* `<div data-tao-provider>` in the body for every mounted-but-closed Select.
|
|
144
148
|
*/
|
|
145
|
-
export declare function TaoPortalScope({ children, style, asChild, }: {
|
|
149
|
+
export declare function TaoPortalScope({ children, style, asChild, direction: directionProp, }: {
|
|
146
150
|
children: ReactNode;
|
|
147
151
|
style?: CSSProperties;
|
|
148
152
|
asChild?: boolean;
|
|
153
|
+
direction?: TaoDirection;
|
|
149
154
|
}): import("react").JSX.Element;
|
|
150
155
|
export interface TaoProviderProps {
|
|
156
|
+
/** Text and interaction direction. Defaults to the surrounding DOM direction. */
|
|
157
|
+
direction?: TaoDirection;
|
|
151
158
|
/** Select and calendar text; missing keys inherit from the parent (English at the root). */
|
|
152
159
|
locale?: Partial<TaoLocale>;
|
|
153
160
|
children: ReactNode;
|
|
@@ -156,4 +163,4 @@ export interface TaoProviderProps {
|
|
|
156
163
|
disabled?: boolean;
|
|
157
164
|
variant?: TaoVariant;
|
|
158
165
|
}
|
|
159
|
-
export declare function TaoProvider({ locale: localeProp, theme, size, disabled, variant, children, }: TaoProviderProps): import("react").JSX.Element;
|
|
166
|
+
export declare function TaoProvider({ direction: directionProp, locale: localeProp, theme, size, disabled, variant, children, }: TaoProviderProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
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
7
|
const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
@@ -14,31 +14,97 @@ const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
|
14
14
|
locale: enUS
|
|
15
15
|
});
|
|
16
16
|
function useTaoConfig() {
|
|
17
|
-
const $ = c(
|
|
18
|
-
const { size, disabled, variant, mode, compact, locale } = useContext(TaoConfigContext);
|
|
17
|
+
const $ = c(8);
|
|
18
|
+
const { size, disabled, variant, mode, compact, locale, direction } = useContext(TaoConfigContext);
|
|
19
19
|
let t0;
|
|
20
|
-
if ($[0] !== compact || $[1] !==
|
|
20
|
+
if ($[0] !== compact || $[1] !== direction || $[2] !== disabled || $[3] !== locale || $[4] !== mode || $[5] !== size || $[6] !== variant) {
|
|
21
21
|
t0 = {
|
|
22
22
|
size,
|
|
23
23
|
disabled,
|
|
24
24
|
variant,
|
|
25
25
|
mode,
|
|
26
26
|
compact,
|
|
27
|
-
locale
|
|
27
|
+
locale,
|
|
28
|
+
direction
|
|
28
29
|
};
|
|
29
30
|
$[0] = compact;
|
|
30
|
-
$[1] =
|
|
31
|
-
$[2] =
|
|
32
|
-
$[3] =
|
|
33
|
-
$[4] =
|
|
34
|
-
$[5] =
|
|
35
|
-
$[6] =
|
|
36
|
-
|
|
31
|
+
$[1] = direction;
|
|
32
|
+
$[2] = disabled;
|
|
33
|
+
$[3] = locale;
|
|
34
|
+
$[4] = mode;
|
|
35
|
+
$[5] = size;
|
|
36
|
+
$[6] = variant;
|
|
37
|
+
$[7] = t0;
|
|
38
|
+
} else t0 = $[7];
|
|
37
39
|
return t0;
|
|
38
40
|
}
|
|
39
41
|
function useTaoInternalConfig() {
|
|
40
42
|
return useContext(TaoConfigContext);
|
|
41
43
|
}
|
|
44
|
+
function useTaoDirection(explicit, t0) {
|
|
45
|
+
const $ = c(8);
|
|
46
|
+
const source = void 0 === t0 ? "parent" : t0;
|
|
47
|
+
const { direction: contextDirection } = useContext(TaoConfigContext);
|
|
48
|
+
const [element, setElement] = useState(null);
|
|
49
|
+
const [inherited, setInherited] = useState();
|
|
50
|
+
let t1;
|
|
51
|
+
let t2;
|
|
52
|
+
if ($[0] !== contextDirection || $[1] !== element || $[2] !== explicit || $[3] !== source) {
|
|
53
|
+
t1 = ()=>{
|
|
54
|
+
if (explicit && "auto" !== explicit || !element) return;
|
|
55
|
+
const target = "self" === source || "auto" === explicit ? element : element.parentElement;
|
|
56
|
+
if (!target) return;
|
|
57
|
+
const update = ()=>{
|
|
58
|
+
const value = getComputedStyle(target).direction || target.closest("[dir]")?.getAttribute("dir") || contextDirection;
|
|
59
|
+
setInherited("rtl" === value ? "rtl" : "ltr");
|
|
60
|
+
for(let ancestor = target; ancestor; ancestor = ancestor.parentElement){
|
|
61
|
+
const auto = "auto" === ancestor.dir;
|
|
62
|
+
observer.observe(ancestor, {
|
|
63
|
+
attributes: true,
|
|
64
|
+
attributeFilter: [
|
|
65
|
+
"dir",
|
|
66
|
+
"style",
|
|
67
|
+
"class"
|
|
68
|
+
],
|
|
69
|
+
childList: auto,
|
|
70
|
+
characterData: auto,
|
|
71
|
+
subtree: auto
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const observer = new MutationObserver(update);
|
|
76
|
+
update();
|
|
77
|
+
return ()=>observer.disconnect();
|
|
78
|
+
};
|
|
79
|
+
t2 = [
|
|
80
|
+
element,
|
|
81
|
+
explicit,
|
|
82
|
+
contextDirection,
|
|
83
|
+
source
|
|
84
|
+
];
|
|
85
|
+
$[0] = contextDirection;
|
|
86
|
+
$[1] = element;
|
|
87
|
+
$[2] = explicit;
|
|
88
|
+
$[3] = source;
|
|
89
|
+
$[4] = t1;
|
|
90
|
+
$[5] = t2;
|
|
91
|
+
} else {
|
|
92
|
+
t1 = $[4];
|
|
93
|
+
t2 = $[5];
|
|
94
|
+
}
|
|
95
|
+
useLayoutEffect(t1, t2);
|
|
96
|
+
const t3 = ("auto" === explicit ? void 0 : explicit) ?? inherited ?? contextDirection ?? "ltr";
|
|
97
|
+
let t4;
|
|
98
|
+
if ($[6] !== t3) {
|
|
99
|
+
t4 = [
|
|
100
|
+
t3,
|
|
101
|
+
setElement
|
|
102
|
+
];
|
|
103
|
+
$[6] = t3;
|
|
104
|
+
$[7] = t4;
|
|
105
|
+
} else t4 = $[7];
|
|
106
|
+
return t4;
|
|
107
|
+
}
|
|
42
108
|
function useTaoToken() {
|
|
43
109
|
const $ = c(1);
|
|
44
110
|
let t0;
|
|
@@ -51,82 +117,119 @@ function useTaoToken() {
|
|
|
51
117
|
return t0;
|
|
52
118
|
}
|
|
53
119
|
function TaoPortalScope(t0) {
|
|
54
|
-
const $ = c(
|
|
55
|
-
const { children, style, asChild } = t0;
|
|
56
|
-
const
|
|
120
|
+
const $ = c(31);
|
|
121
|
+
const { children, style, asChild, direction: directionProp } = t0;
|
|
122
|
+
const config = useTaoInternalConfig();
|
|
123
|
+
const { tokenStyle, mode, compact } = config;
|
|
124
|
+
const direction = directionProp ?? config.direction;
|
|
57
125
|
let t1;
|
|
58
|
-
if ($[0] !==
|
|
59
|
-
t1 =
|
|
60
|
-
|
|
126
|
+
if ($[0] !== config || $[1] !== direction) {
|
|
127
|
+
t1 = {
|
|
128
|
+
...config,
|
|
129
|
+
direction
|
|
61
130
|
};
|
|
62
|
-
$[0] =
|
|
63
|
-
$[1] =
|
|
64
|
-
|
|
65
|
-
|
|
131
|
+
$[0] = config;
|
|
132
|
+
$[1] = direction;
|
|
133
|
+
$[2] = t1;
|
|
134
|
+
} else t1 = $[2];
|
|
135
|
+
const portalConfig = t1;
|
|
66
136
|
let t2;
|
|
67
|
-
if ($[
|
|
68
|
-
t2 =
|
|
137
|
+
if ($[3] !== mode) {
|
|
138
|
+
t2 = "light" === mode ? void 0 : {
|
|
139
|
+
"data-tao-theme": mode
|
|
140
|
+
};
|
|
141
|
+
$[3] = mode;
|
|
142
|
+
$[4] = t2;
|
|
143
|
+
} else t2 = $[4];
|
|
144
|
+
const themeAttr = t2;
|
|
145
|
+
let t3;
|
|
146
|
+
if ($[5] !== compact) {
|
|
147
|
+
t3 = compact ? {
|
|
69
148
|
"data-tao-density": "compact"
|
|
70
149
|
} : void 0;
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
} else
|
|
74
|
-
const densityAttr =
|
|
150
|
+
$[5] = compact;
|
|
151
|
+
$[6] = t3;
|
|
152
|
+
} else t3 = $[6];
|
|
153
|
+
const densityAttr = t3;
|
|
75
154
|
if (asChild) {
|
|
76
|
-
let
|
|
77
|
-
if ($[
|
|
78
|
-
|
|
155
|
+
let t4;
|
|
156
|
+
if ($[7] !== style || $[8] !== tokenStyle) {
|
|
157
|
+
t4 = {
|
|
79
158
|
...tokenStyle,
|
|
80
159
|
...style
|
|
81
160
|
};
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
} else
|
|
86
|
-
let
|
|
87
|
-
if ($[
|
|
88
|
-
|
|
161
|
+
$[7] = style;
|
|
162
|
+
$[8] = tokenStyle;
|
|
163
|
+
$[9] = t4;
|
|
164
|
+
} else t4 = $[9];
|
|
165
|
+
let t5;
|
|
166
|
+
if ($[10] !== children || $[11] !== densityAttr || $[12] !== direction || $[13] !== t4 || $[14] !== themeAttr) {
|
|
167
|
+
t5 = /*#__PURE__*/ jsx(Slot, {
|
|
168
|
+
dir: direction,
|
|
89
169
|
"data-tao-provider": "",
|
|
90
170
|
...themeAttr,
|
|
91
171
|
...densityAttr,
|
|
92
|
-
style:
|
|
172
|
+
style: t4,
|
|
93
173
|
children: children
|
|
94
174
|
});
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
|
|
101
|
-
|
|
175
|
+
$[10] = children;
|
|
176
|
+
$[11] = densityAttr;
|
|
177
|
+
$[12] = direction;
|
|
178
|
+
$[13] = t4;
|
|
179
|
+
$[14] = themeAttr;
|
|
180
|
+
$[15] = t5;
|
|
181
|
+
} else t5 = $[15];
|
|
182
|
+
let t6;
|
|
183
|
+
if ($[16] !== portalConfig || $[17] !== t5) {
|
|
184
|
+
t6 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
185
|
+
value: portalConfig,
|
|
186
|
+
children: t5
|
|
187
|
+
});
|
|
188
|
+
$[16] = portalConfig;
|
|
189
|
+
$[17] = t5;
|
|
190
|
+
$[18] = t6;
|
|
191
|
+
} else t6 = $[18];
|
|
192
|
+
return t6;
|
|
102
193
|
}
|
|
103
|
-
let
|
|
104
|
-
if ($[
|
|
105
|
-
|
|
194
|
+
let t4;
|
|
195
|
+
if ($[19] !== style || $[20] !== tokenStyle) {
|
|
196
|
+
t4 = {
|
|
106
197
|
display: "contents",
|
|
107
198
|
...tokenStyle,
|
|
108
199
|
...style
|
|
109
200
|
};
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else
|
|
114
|
-
let
|
|
115
|
-
if ($[
|
|
116
|
-
|
|
201
|
+
$[19] = style;
|
|
202
|
+
$[20] = tokenStyle;
|
|
203
|
+
$[21] = t4;
|
|
204
|
+
} else t4 = $[21];
|
|
205
|
+
let t5;
|
|
206
|
+
if ($[22] !== children || $[23] !== densityAttr || $[24] !== direction || $[25] !== t4 || $[26] !== themeAttr) {
|
|
207
|
+
t5 = /*#__PURE__*/ jsx("div", {
|
|
208
|
+
dir: direction,
|
|
117
209
|
"data-tao-provider": "",
|
|
118
210
|
...themeAttr,
|
|
119
211
|
...densityAttr,
|
|
120
|
-
style:
|
|
212
|
+
style: t4,
|
|
121
213
|
children: children
|
|
122
214
|
});
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
|
|
129
|
-
|
|
215
|
+
$[22] = children;
|
|
216
|
+
$[23] = densityAttr;
|
|
217
|
+
$[24] = direction;
|
|
218
|
+
$[25] = t4;
|
|
219
|
+
$[26] = themeAttr;
|
|
220
|
+
$[27] = t5;
|
|
221
|
+
} else t5 = $[27];
|
|
222
|
+
let t6;
|
|
223
|
+
if ($[28] !== portalConfig || $[29] !== t5) {
|
|
224
|
+
t6 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
225
|
+
value: portalConfig,
|
|
226
|
+
children: t5
|
|
227
|
+
});
|
|
228
|
+
$[28] = portalConfig;
|
|
229
|
+
$[29] = t5;
|
|
230
|
+
$[30] = t6;
|
|
231
|
+
} else t6 = $[30];
|
|
232
|
+
return t6;
|
|
130
233
|
}
|
|
131
234
|
const TOKEN_TO_VAR = {
|
|
132
235
|
colorPrimary: '--tao-color-primary',
|
|
@@ -188,8 +291,9 @@ const UNITLESS_COMPONENT_TOKEN_KEYS = new Set([
|
|
|
188
291
|
'fontWeight'
|
|
189
292
|
]);
|
|
190
293
|
function TaoProvider(t0) {
|
|
191
|
-
const $ = c(
|
|
192
|
-
const { locale: localeProp, theme, size, disabled, variant, children } = t0;
|
|
294
|
+
const $ = c(33);
|
|
295
|
+
const { direction: directionProp, locale: localeProp, theme, size, disabled, variant, children } = t0;
|
|
296
|
+
const [direction, directionRef] = useTaoDirection(directionProp);
|
|
193
297
|
const parentConfig = useContext(TaoConfigContext);
|
|
194
298
|
let t1;
|
|
195
299
|
if ($[0] !== localeProp || $[1] !== parentConfig.locale) {
|
|
@@ -291,8 +395,9 @@ function TaoProvider(t0) {
|
|
|
291
395
|
const t7 = disabled ?? (inherit ? parentDisabled : false);
|
|
292
396
|
const t8 = variant ?? (inherit ? parentVariant : "outlined");
|
|
293
397
|
let t9;
|
|
294
|
-
if ($[14] !== compact || $[15] !==
|
|
398
|
+
if ($[14] !== compact || $[15] !== direction || $[16] !== locale || $[17] !== mode || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 || $[21] !== tokenStyle) {
|
|
295
399
|
t9 = {
|
|
400
|
+
direction,
|
|
296
401
|
size: t6,
|
|
297
402
|
disabled: t7,
|
|
298
403
|
variant: t8,
|
|
@@ -302,42 +407,47 @@ function TaoProvider(t0) {
|
|
|
302
407
|
locale
|
|
303
408
|
};
|
|
304
409
|
$[14] = compact;
|
|
305
|
-
$[15] =
|
|
306
|
-
$[16] =
|
|
307
|
-
$[17] =
|
|
308
|
-
$[18] =
|
|
309
|
-
$[19] =
|
|
310
|
-
$[20] =
|
|
311
|
-
$[21] =
|
|
312
|
-
|
|
410
|
+
$[15] = direction;
|
|
411
|
+
$[16] = locale;
|
|
412
|
+
$[17] = mode;
|
|
413
|
+
$[18] = t6;
|
|
414
|
+
$[19] = t7;
|
|
415
|
+
$[20] = t8;
|
|
416
|
+
$[21] = tokenStyle;
|
|
417
|
+
$[22] = t9;
|
|
418
|
+
} else t9 = $[22];
|
|
313
419
|
const config = t9;
|
|
314
420
|
const t10 = "light" === mode ? void 0 : mode;
|
|
315
421
|
const t11 = compact ? "compact" : void 0;
|
|
316
422
|
let t12;
|
|
317
|
-
if ($[
|
|
423
|
+
if ($[23] !== children || $[24] !== directionProp || $[25] !== directionRef || $[26] !== divStyle || $[27] !== t10 || $[28] !== t11) {
|
|
318
424
|
t12 = /*#__PURE__*/ jsx("div", {
|
|
425
|
+
ref: directionRef,
|
|
426
|
+
dir: directionProp,
|
|
319
427
|
style: divStyle,
|
|
320
428
|
"data-tao-provider": "",
|
|
321
429
|
"data-tao-theme": t10,
|
|
322
430
|
"data-tao-density": t11,
|
|
323
431
|
children: children
|
|
324
432
|
});
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
|
|
433
|
+
$[23] = children;
|
|
434
|
+
$[24] = directionProp;
|
|
435
|
+
$[25] = directionRef;
|
|
436
|
+
$[26] = divStyle;
|
|
437
|
+
$[27] = t10;
|
|
438
|
+
$[28] = t11;
|
|
439
|
+
$[29] = t12;
|
|
440
|
+
} else t12 = $[29];
|
|
331
441
|
let t13;
|
|
332
|
-
if ($[
|
|
442
|
+
if ($[30] !== config || $[31] !== t12) {
|
|
333
443
|
t13 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
334
444
|
value: config,
|
|
335
445
|
children: t12
|
|
336
446
|
});
|
|
337
|
-
$[
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
} else t13 = $[
|
|
447
|
+
$[30] = config;
|
|
448
|
+
$[31] = t12;
|
|
449
|
+
$[32] = t13;
|
|
450
|
+
} else t13 = $[32];
|
|
341
451
|
return t13;
|
|
342
452
|
}
|
|
343
|
-
export { TaoPortalScope, TaoProvider, enUS, useTaoConfig, useTaoInternalConfig, useTaoToken, zhCN };
|
|
453
|
+
export { TaoPortalScope, TaoProvider, enUS, useTaoConfig, useTaoDirection, useTaoInternalConfig, useTaoToken, zhCN };
|
|
@@ -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.
|
|
@@ -356,7 +356,7 @@ Collects and validates field values with an antd-aligned API (rules, dependencie
|
|
|
356
356
|
- Exports: `Form`
|
|
357
357
|
- Source: `src/components/form/form.tsx`
|
|
358
358
|
- Storybook: `stories/form.stories.tsx`
|
|
359
|
-
- Tests: `tests/form/form.test.tsx`
|
|
359
|
+
- Tests: `tests/form/form.test.tsx`, `tests/form/form-scroll.test.tsx`
|
|
360
360
|
- Semantic parts: `root`
|
|
361
361
|
|
|
362
362
|
Use Form with Form.Item when fields need a value store, rule validation, or submit handling. Use the lighter FormField when you manage state yourself.
|
|
@@ -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.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A modern React component library with semantic DOM customization and OKLCH-based theming.",
|
|
6
6
|
"keywords": [
|
|
@@ -151,8 +151,10 @@
|
|
|
151
151
|
"@rc-component/tree": "~1.5.3",
|
|
152
152
|
"@rc-component/tree-select": "~1.19.0",
|
|
153
153
|
"@rc-component/upload": "~1.1.1",
|
|
154
|
+
"@rc-component/util": "1.14.0",
|
|
154
155
|
"dayjs": "^1.11.23",
|
|
155
156
|
"react-compiler-runtime": "^1.0.0",
|
|
156
|
-
"react-remove-scroll": "^2.7.2"
|
|
157
|
+
"react-remove-scroll": "^2.7.2",
|
|
158
|
+
"scroll-into-view-if-needed": "3.1.0"
|
|
157
159
|
}
|
|
158
160
|
}
|