@rockshin/tao-ui 0.0.21 → 0.0.22
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 +8 -1
- package/component-manifest.json +77 -48
- package/dist/components/button/button.css +11 -11
- package/dist/components/button/button.d.ts +3 -2
- package/dist/components/button/button.js +55 -47
- package/dist/components/checkbox/checkbox.d.ts +3 -2
- package/dist/components/checkbox/checkbox.js +91 -81
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +7 -1
- package/dist/components/date-picker/calendar/calendar-grid.js +158 -160
- package/dist/components/date-picker/calendar/time-panel.js +64 -70
- package/dist/components/date-picker/date-picker.css +11 -5
- package/dist/components/date-picker/date-picker.d.ts +13 -5
- package/dist/components/date-picker/date-picker.js +389 -718
- package/dist/components/date-picker/range-picker.d.ts +12 -5
- package/dist/components/date-picker/range-picker.js +68 -12
- package/dist/components/date-picker/types.d.ts +5 -0
- package/dist/components/drawer/drawer.css +3 -1
- package/dist/components/form-field/form-field.d.ts +1 -1
- package/dist/components/form-field/form-field.js +106 -63
- package/dist/components/input/input.css +7 -1
- package/dist/components/input/input.d.ts +2 -1
- package/dist/components/input/input.js +76 -70
- package/dist/components/input-number/input-number.d.ts +5 -3
- package/dist/components/input-number/input-number.js +63 -47
- package/dist/components/modal/modal.css +2 -1
- package/dist/components/radio/radio.d.ts +3 -2
- package/dist/components/radio/radio.js +43 -39
- package/dist/components/select/mobile-select.d.ts +1 -1
- package/dist/components/select/mobile-select.js +1 -1
- package/dist/components/select/select-icons.d.ts +7 -0
- package/dist/components/select/select-icons.js +141 -0
- package/dist/components/select/select-model.d.ts +4 -0
- package/dist/components/select/select-model.js +22 -0
- package/dist/components/select/select-searchable-list.d.ts +22 -0
- package/dist/components/select/select-searchable-list.js +101 -0
- package/dist/components/select/select-tags.d.ts +15 -0
- package/dist/components/select/select-tags.js +152 -0
- package/dist/components/select/select-types.d.ts +82 -0
- package/dist/components/select/select-types.js +0 -0
- package/dist/components/select/select.css +2 -1
- package/dist/components/select/select.d.ts +2 -118
- package/dist/components/select/select.js +91 -404
- package/dist/components/select/use-is-mobile.js +2 -5
- package/dist/components/sonner/sonner.js +9 -3
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/splitter/splitter.js +181 -133
- package/dist/components/switch/switch.css +17 -8
- package/dist/components/switch/switch.d.ts +3 -2
- package/dist/components/switch/switch.js +90 -79
- package/dist/components/table/table-filter.d.ts +6 -0
- package/dist/components/table/table-filter.js +123 -0
- package/dist/components/table/table-icons.d.ts +9 -0
- package/dist/components/table/table-icons.js +157 -0
- package/dist/components/table/table-model.d.ts +11 -0
- package/dist/components/table/table-model.js +33 -0
- package/dist/components/table/table-types.d.ts +87 -0
- package/dist/components/table/table-types.js +0 -0
- package/dist/components/table/table.css +14 -15
- package/dist/components/table/table.d.ts +3 -101
- package/dist/components/table/table.js +29 -329
- package/dist/components/tabs/tabs.css +5 -2
- package/dist/components/tabs/tabs.js +71 -62
- package/dist/components/textarea/textarea.d.ts +5 -3
- package/dist/components/textarea/textarea.js +102 -85
- package/dist/docs/component-docs.d.ts +1 -0
- package/dist/docs/components/breadcrumb.doc.js +3 -1
- package/dist/docs/components/checkbox.doc.js +2 -5
- package/dist/docs/components/context-menu.doc.js +7 -2
- package/dist/docs/components/drawer.doc.js +4 -2
- package/dist/docs/components/dropdown.doc.js +7 -3
- package/dist/docs/components/form-field.doc.js +0 -1
- package/dist/docs/components/form-layout.doc.d.ts +1 -0
- package/dist/docs/components/form-layout.doc.js +3 -0
- package/dist/docs/components/form-section.doc.js +1 -1
- package/dist/docs/components/input-number.doc.js +2 -3
- package/dist/docs/components/input.doc.js +1 -2
- package/dist/docs/components/modal.doc.js +1 -1
- package/dist/docs/components/pagination.doc.js +1 -3
- package/dist/docs/components/radio.doc.js +1 -4
- package/dist/docs/components/range-picker.doc.js +2 -2
- package/dist/docs/components/select.doc.js +19 -6
- package/dist/docs/components/spinner.doc.js +4 -1
- package/dist/docs/components/splitter.doc.js +1 -1
- package/dist/docs/components/stack.doc.d.ts +1 -0
- package/dist/docs/components/stack.doc.js +3 -0
- package/dist/docs/components/switch.doc.js +1 -2
- package/dist/docs/components/table.doc.js +9 -4
- package/dist/docs/components/tabs.doc.js +2 -1
- package/dist/docs/components/tag.doc.js +1 -0
- package/dist/docs/components/tao-provider.doc.js +1 -2
- package/dist/index.d.ts +7 -9
- package/dist/index.js +4 -5
- package/dist/layouts/form-layout/form-layout.d.ts +8 -2
- package/dist/layouts/form-layout/form-layout.js +33 -9
- package/dist/layouts/stack/stack.d.ts +8 -2
- package/dist/layouts/stack/stack.js +36 -12
- package/dist/provider/tao-provider.d.ts +3 -9
- package/dist/provider/tao-provider.js +99 -33
- package/dist/theme/theme.css +24 -14
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +4 -1
- package/dist/utils/refs.d.ts +2 -0
- package/dist/utils/refs.js +7 -0
- package/llms.txt +26 -24
- package/package.json +16 -4
|
@@ -4,8 +4,7 @@ const selectDoc = {
|
|
|
4
4
|
category: 'Data Entry',
|
|
5
5
|
description: 'Chooses one value from a compact list of options.',
|
|
6
6
|
exports: [
|
|
7
|
-
'Select'
|
|
8
|
-
'ChevronsUpDownIcon'
|
|
7
|
+
'Select'
|
|
9
8
|
],
|
|
10
9
|
source: 'src/components/select/select.tsx',
|
|
11
10
|
story: 'stories/select.stories.tsx',
|
|
@@ -14,11 +13,25 @@ const selectDoc = {
|
|
|
14
13
|
],
|
|
15
14
|
semanticParts: [
|
|
16
15
|
'root',
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
16
|
+
'prefix',
|
|
17
|
+
'suffix',
|
|
18
|
+
'placeholder',
|
|
19
|
+
'clear',
|
|
20
|
+
'popup',
|
|
21
|
+
'search',
|
|
22
|
+
'searchInput',
|
|
23
|
+
'group',
|
|
24
|
+
'groupLabel',
|
|
20
25
|
'item',
|
|
21
|
-
'
|
|
26
|
+
'itemIcon',
|
|
27
|
+
'itemLabel',
|
|
28
|
+
'itemDesc',
|
|
29
|
+
'empty',
|
|
30
|
+
'tag',
|
|
31
|
+
'tagLabel',
|
|
32
|
+
'tagClose',
|
|
33
|
+
'tagRest',
|
|
34
|
+
'values'
|
|
22
35
|
],
|
|
23
36
|
keywords: [
|
|
24
37
|
'select',
|
|
@@ -13,12 +13,17 @@ const tableDoc = {
|
|
|
13
13
|
],
|
|
14
14
|
semanticParts: [
|
|
15
15
|
'root',
|
|
16
|
+
'scroll',
|
|
16
17
|
'table',
|
|
17
|
-
'header',
|
|
18
|
+
'header.wrapper',
|
|
19
|
+
'header.row',
|
|
18
20
|
'header.cell',
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
21
|
+
'header.content',
|
|
22
|
+
'header.title',
|
|
23
|
+
'body.row',
|
|
24
|
+
'body.cell',
|
|
25
|
+
'selection.cell',
|
|
26
|
+
'empty',
|
|
22
27
|
'pagination'
|
|
23
28
|
],
|
|
24
29
|
keywords: [
|
|
@@ -4,8 +4,7 @@ const taoProviderDoc = {
|
|
|
4
4
|
category: 'Config',
|
|
5
5
|
description: 'Provides global component defaults, portal scoping, and theme seed token overrides.',
|
|
6
6
|
exports: [
|
|
7
|
-
'TaoProvider'
|
|
8
|
-
'TaoPortalScope'
|
|
7
|
+
'TaoProvider'
|
|
9
8
|
],
|
|
10
9
|
source: 'src/provider/tao-provider.tsx',
|
|
11
10
|
story: 'stories/provider.stories.tsx',
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export { Button, type ButtonProps, type ButtonSemanticPart, } from './components
|
|
|
5
5
|
export { Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxOptionType, type CheckboxProps, type CheckboxSemanticPart, } from './components/checkbox/checkbox';
|
|
6
6
|
export { Collapsible, type CollapsibleContentProps, type CollapsibleProps, type CollapsibleSemanticPart, type CollapsibleTriggerProps, } from './components/collapsible/collapsible';
|
|
7
7
|
export { ContextMenu, type ContextMenuProps, type ContextMenuSemanticPart, } from './components/context-menu/context-menu';
|
|
8
|
-
export { DatePicker, type DatePickerProps, } from './components/date-picker/date-picker';
|
|
9
|
-
export { RangePicker, type RangePickerProps, } from './components/date-picker/range-picker';
|
|
8
|
+
export { DatePicker, type DatePickerProps, type DatePickerSemanticPart, type PickerRef, } from './components/date-picker/date-picker';
|
|
9
|
+
export { RangePicker, type RangePickerProps, type RangePickerSemanticPart, } from './components/date-picker/range-picker';
|
|
10
10
|
export { Drawer, type DrawerPlacement, type DrawerProps, type DrawerResizableConfig, type DrawerSemanticPart, type DrawerSize, } from './components/drawer/drawer';
|
|
11
11
|
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';
|
|
12
12
|
export { FormActions, type FormActionsProps, type FormActionsSemanticPart, } from './components/form-actions/form-actions';
|
|
@@ -17,9 +17,9 @@ export { InputNumber, type InputNumberProps, type InputNumberSemanticPart, } fro
|
|
|
17
17
|
export { type ConfirmType, Modal, type ModalFooterRender, type ModalFuncProps, type ModalFuncReturn, type ModalHookApi, type ModalProps, type ModalSemanticPart, } from './components/modal';
|
|
18
18
|
export { Pagination, type PaginationProps, type PaginationSemanticPart, } from './components/pagination/pagination';
|
|
19
19
|
export { Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, type RadioSemanticPart, } from './components/radio/radio';
|
|
20
|
-
export { Sonner, toast, type SonnerAction, type SonnerPosition, type SonnerProps, type SonnerSemanticPart, type SonnerToastItem, type SonnerToastOptions, type SonnerType, } from './components/sonner';
|
|
21
20
|
export { ScrollArea, type ScrollAreaProps, type ScrollAreaSemanticPart, type ScrollAreaType, } from './components/scroll-area/scroll-area';
|
|
22
|
-
export {
|
|
21
|
+
export { Select, type SelectOption, type SelectPlacement, type SelectProps, type SelectRef, type SelectSemanticPart, type TagRenderProps, } from './components/select/select';
|
|
22
|
+
export { Sonner, type SonnerAction, type SonnerPosition, type SonnerProps, type SonnerSemanticPart, type SonnerToastItem, type SonnerToastOptions, type SonnerType, toast, } from './components/sonner';
|
|
23
23
|
export { Spinner, type SpinnerProps, type SpinnerSemanticPart, } from './components/spinner/spinner';
|
|
24
24
|
export { Splitter, type SplitterPanelProps, type SplitterProps, type SplitterSemanticPart, } from './components/splitter/splitter';
|
|
25
25
|
export { Switch, type SwitchProps, type SwitchSemanticPart, } from './components/switch/switch';
|
|
@@ -27,10 +27,8 @@ export { type SorterResult, type SortOrder, Table, type TableColumn, type TableF
|
|
|
27
27
|
export { type TabItem, Tabs, type TabsProps, type TabsSemanticPart, } from './components/tabs/tabs';
|
|
28
28
|
export { CheckableTag, type CheckableTagProps, Tag, type TagColor, type TagProps, type TagSemanticPart, type TagVariant, } from './components/tag/tag';
|
|
29
29
|
export { type AutoSizeOptions, Textarea, type TextareaProps, type TextareaSemanticPart, } from './components/textarea/textarea';
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export { Stack, type StackProps } from './layouts/stack/stack';
|
|
30
|
+
export { FormLayout, type FormLayoutProps, type FormLayoutSemanticPart, } from './layouts/form-layout/form-layout';
|
|
31
|
+
export { Stack, type StackProps, type StackSemanticPart, } from './layouts/stack/stack';
|
|
33
32
|
export { type FormatOptions, HeadlessInputNumber, type HeadlessInputNumberProps, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from './number-input';
|
|
34
|
-
export {
|
|
35
|
-
export { type TaoTokenName, taoTokenNames, taoTokenVars, tokenVar, } from './theme/tokens';
|
|
33
|
+
export { type TaoConfig, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoStatus, type TaoThemeConfig, type TaoThemeMode, type TaoVariant, useTaoConfig, } from './provider/tao-provider';
|
|
36
34
|
export { cx, type SemanticClassNames, type SemanticStyles, } from './utils/semantic';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import "./theme/theme.css";
|
|
2
3
|
import "./theme/control.css";
|
|
3
4
|
export { Breadcrumb } from "./components/breadcrumb/breadcrumb.js";
|
|
@@ -17,9 +18,9 @@ export { InputNumber } from "./components/input-number/input-number.js";
|
|
|
17
18
|
export { Modal } from "./components/modal/index.js";
|
|
18
19
|
export { Pagination } from "./components/pagination/pagination.js";
|
|
19
20
|
export { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
20
|
-
export { Sonner, toast } from "./components/sonner/index.js";
|
|
21
21
|
export { ScrollArea } from "./components/scroll-area/scroll-area.js";
|
|
22
|
-
export {
|
|
22
|
+
export { Select } from "./components/select/select.js";
|
|
23
|
+
export { Sonner, toast } from "./components/sonner/index.js";
|
|
23
24
|
export { Spinner } from "./components/spinner/spinner.js";
|
|
24
25
|
export { Splitter } from "./components/splitter/splitter.js";
|
|
25
26
|
export { Switch } from "./components/switch/switch.js";
|
|
@@ -27,10 +28,8 @@ export { Table } from "./components/table/table.js";
|
|
|
27
28
|
export { Tabs } from "./components/tabs/tabs.js";
|
|
28
29
|
export { CheckableTag, Tag } from "./components/tag/tag.js";
|
|
29
30
|
export { Textarea } from "./components/textarea/textarea.js";
|
|
30
|
-
export { componentDocs, getComponentDoc } from "./docs/index.js";
|
|
31
31
|
export { FormLayout } from "./layouts/form-layout/form-layout.js";
|
|
32
32
|
export { Stack } from "./layouts/stack/stack.js";
|
|
33
33
|
export { HeadlessInputNumber, NumberInput, useNumberInput } from "./number-input/index.js";
|
|
34
|
-
export {
|
|
35
|
-
export { taoTokenNames, taoTokenVars, tokenVar } from "./theme/tokens.js";
|
|
34
|
+
export { TaoProvider, useTaoConfig } from "./provider/tao-provider.js";
|
|
36
35
|
export { cx } from "./utils/semantic.js";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
2
3
|
import '../stack/layout.css';
|
|
4
|
+
export type FormLayoutSemanticPart = 'root';
|
|
3
5
|
export interface FormLayoutProps {
|
|
4
6
|
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
classNames?: SemanticClassNames<FormLayoutSemanticPart>;
|
|
10
|
+
styles?: SemanticStyles<FormLayoutSemanticPart>;
|
|
5
11
|
}
|
|
6
|
-
export declare function FormLayout({ children }: FormLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function FormLayout({ children, className, style, classNames, styles, }: FormLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cx } from "../../utils/semantic.js";
|
|
3
4
|
import "../stack/layout.css";
|
|
4
5
|
function FormLayout(t0) {
|
|
5
|
-
const $ = c(
|
|
6
|
-
const { children } = t0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const $ = c(10);
|
|
7
|
+
const { children, className, style, classNames, styles } = t0;
|
|
8
|
+
const t1 = classNames?.root;
|
|
9
|
+
let t2;
|
|
10
|
+
if ($[0] !== className || $[1] !== t1) {
|
|
11
|
+
t2 = cx(t1, className);
|
|
12
|
+
$[0] = className;
|
|
13
|
+
$[1] = t1;
|
|
14
|
+
$[2] = t2;
|
|
15
|
+
} else t2 = $[2];
|
|
16
|
+
const t3 = styles?.root;
|
|
17
|
+
let t4;
|
|
18
|
+
if ($[3] !== style || $[4] !== t3) {
|
|
19
|
+
t4 = {
|
|
20
|
+
...t3,
|
|
21
|
+
...style
|
|
22
|
+
};
|
|
23
|
+
$[3] = style;
|
|
24
|
+
$[4] = t3;
|
|
25
|
+
$[5] = t4;
|
|
26
|
+
} else t4 = $[5];
|
|
27
|
+
let t5;
|
|
28
|
+
if ($[6] !== children || $[7] !== t2 || $[8] !== t4) {
|
|
29
|
+
t5 = /*#__PURE__*/ jsx("div", {
|
|
10
30
|
"data-tao-form-layout": "",
|
|
31
|
+
className: t2,
|
|
32
|
+
style: t4,
|
|
11
33
|
children: children
|
|
12
34
|
});
|
|
13
|
-
$[
|
|
14
|
-
$[
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
$[6] = children;
|
|
36
|
+
$[7] = t2;
|
|
37
|
+
$[8] = t4;
|
|
38
|
+
$[9] = t5;
|
|
39
|
+
} else t5 = $[9];
|
|
40
|
+
return t5;
|
|
17
41
|
}
|
|
18
42
|
export { FormLayout };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
2
3
|
import './layout.css';
|
|
4
|
+
export type StackSemanticPart = 'root';
|
|
3
5
|
export interface StackProps {
|
|
4
6
|
direction?: 'vertical' | 'horizontal';
|
|
5
7
|
gap?: 'sm' | 'md' | 'lg';
|
|
6
8
|
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
7
9
|
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
classNames?: SemanticClassNames<StackSemanticPart>;
|
|
13
|
+
styles?: SemanticStyles<StackSemanticPart>;
|
|
8
14
|
}
|
|
9
|
-
export declare function Stack({ direction, gap, align, children, }: StackProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function Stack({ direction, gap, align, children, className, style, classNames, styles, }: StackProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,51 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cx } from "../../utils/semantic.js";
|
|
3
4
|
import "./layout.css";
|
|
4
5
|
function Stack(t0) {
|
|
5
|
-
const $ = c(
|
|
6
|
-
const { direction: t1, gap: t2, align: t3, children } = t0;
|
|
6
|
+
const $ = c(13);
|
|
7
|
+
const { direction: t1, gap: t2, align: t3, children, className, style, classNames, styles } = t0;
|
|
7
8
|
const direction = void 0 === t1 ? "vertical" : t1;
|
|
8
9
|
const gap = void 0 === t2 ? "md" : t2;
|
|
9
10
|
const align = void 0 === t3 ? "stretch" : t3;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const t4 = classNames?.root;
|
|
12
|
+
let t5;
|
|
13
|
+
if ($[0] !== className || $[1] !== t4) {
|
|
14
|
+
t5 = cx(t4, className);
|
|
15
|
+
$[0] = className;
|
|
16
|
+
$[1] = t4;
|
|
17
|
+
$[2] = t5;
|
|
18
|
+
} else t5 = $[2];
|
|
19
|
+
const t6 = styles?.root;
|
|
20
|
+
let t7;
|
|
21
|
+
if ($[3] !== style || $[4] !== t6) {
|
|
22
|
+
t7 = {
|
|
23
|
+
...t6,
|
|
24
|
+
...style
|
|
25
|
+
};
|
|
26
|
+
$[3] = style;
|
|
27
|
+
$[4] = t6;
|
|
28
|
+
$[5] = t7;
|
|
29
|
+
} else t7 = $[5];
|
|
30
|
+
let t8;
|
|
31
|
+
if ($[6] !== align || $[7] !== children || $[8] !== direction || $[9] !== gap || $[10] !== t5 || $[11] !== t7) {
|
|
32
|
+
t8 = /*#__PURE__*/ jsx("div", {
|
|
13
33
|
"data-tao-stack": "",
|
|
14
34
|
"data-tao-direction": direction,
|
|
15
35
|
"data-tao-gap": gap,
|
|
16
36
|
"data-tao-align": align,
|
|
37
|
+
className: t5,
|
|
38
|
+
style: t7,
|
|
17
39
|
children: children
|
|
18
40
|
});
|
|
19
|
-
$[
|
|
20
|
-
$[
|
|
21
|
-
$[
|
|
22
|
-
$[
|
|
23
|
-
$[
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
$[6] = align;
|
|
42
|
+
$[7] = children;
|
|
43
|
+
$[8] = direction;
|
|
44
|
+
$[9] = gap;
|
|
45
|
+
$[10] = t5;
|
|
46
|
+
$[11] = t7;
|
|
47
|
+
$[12] = t8;
|
|
48
|
+
} else t8 = $[12];
|
|
49
|
+
return t8;
|
|
26
50
|
}
|
|
27
51
|
export { Stack };
|
|
@@ -36,20 +36,15 @@ export interface TaoThemeConfig {
|
|
|
36
36
|
}
|
|
37
37
|
export type TaoSize = 'small' | 'medium' | 'large';
|
|
38
38
|
export type TaoVariant = 'outlined' | 'filled' | 'borderless';
|
|
39
|
-
|
|
39
|
+
export type TaoStatus = 'error' | 'warning';
|
|
40
|
+
export interface TaoConfig {
|
|
40
41
|
size: TaoSize;
|
|
41
42
|
disabled: boolean;
|
|
42
43
|
variant: TaoVariant;
|
|
43
44
|
/** Resolved 明暗模式,portal 浮层用它重建 data-tao-theme。 */
|
|
44
45
|
mode: TaoThemeMode;
|
|
45
|
-
/**
|
|
46
|
-
* Merged CSS custom-property overrides from this provider and all ancestors.
|
|
47
|
-
* Carried through context so portaled layers (Modal/Drawer/Select dropdown…)
|
|
48
|
-
* — which render outside the provider's DOM subtree — can re-apply the theme.
|
|
49
|
-
*/
|
|
50
|
-
tokenStyle: CSSProperties;
|
|
51
46
|
}
|
|
52
|
-
export declare function useTaoConfig():
|
|
47
|
+
export declare function useTaoConfig(): TaoConfig;
|
|
53
48
|
/**
|
|
54
49
|
* Re-establishes the theme token scope inside a portal. Floating components
|
|
55
50
|
* portal their popup to document.body, escaping the `[data-tao-provider]`
|
|
@@ -76,4 +71,3 @@ export interface TaoProviderProps {
|
|
|
76
71
|
variant?: TaoVariant;
|
|
77
72
|
}
|
|
78
73
|
export declare function TaoProvider({ theme, size, disabled, variant, children, }: TaoProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
79
|
-
export {};
|
|
@@ -10,12 +10,31 @@ const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
|
10
10
|
tokenStyle: {}
|
|
11
11
|
});
|
|
12
12
|
function useTaoConfig() {
|
|
13
|
+
const $ = c(5);
|
|
14
|
+
const { size, disabled, variant, mode } = useContext(TaoConfigContext);
|
|
15
|
+
let t0;
|
|
16
|
+
if ($[0] !== disabled || $[1] !== mode || $[2] !== size || $[3] !== variant) {
|
|
17
|
+
t0 = {
|
|
18
|
+
size,
|
|
19
|
+
disabled,
|
|
20
|
+
variant,
|
|
21
|
+
mode
|
|
22
|
+
};
|
|
23
|
+
$[0] = disabled;
|
|
24
|
+
$[1] = mode;
|
|
25
|
+
$[2] = size;
|
|
26
|
+
$[3] = variant;
|
|
27
|
+
$[4] = t0;
|
|
28
|
+
} else t0 = $[4];
|
|
29
|
+
return t0;
|
|
30
|
+
}
|
|
31
|
+
function useTaoInternalConfig() {
|
|
13
32
|
return useContext(TaoConfigContext);
|
|
14
33
|
}
|
|
15
34
|
function TaoPortalScope(t0) {
|
|
16
35
|
const $ = c(16);
|
|
17
36
|
const { children, style, asChild } = t0;
|
|
18
|
-
const { tokenStyle, mode } =
|
|
37
|
+
const { tokenStyle, mode } = useTaoInternalConfig();
|
|
19
38
|
let t1;
|
|
20
39
|
if ($[0] !== mode) {
|
|
21
40
|
t1 = "light" === mode ? void 0 : {
|
|
@@ -94,6 +113,32 @@ const TOKEN_TO_VAR_PX = {
|
|
|
94
113
|
sizeUnit: '--tao-size-unit',
|
|
95
114
|
lineWidth: '--tao-line-width'
|
|
96
115
|
};
|
|
116
|
+
const TOKEN_TO_VAR_NUMBER = {
|
|
117
|
+
sizeStep: '--tao-size-step',
|
|
118
|
+
zIndexBase: '--tao-z-index-base',
|
|
119
|
+
zIndexPopupBase: '--tao-z-index-popup-base'
|
|
120
|
+
};
|
|
121
|
+
const DEFAULT_TOKEN_STYLE = {
|
|
122
|
+
'--tao-color-primary': 'oklch(0.205 0.01 70)',
|
|
123
|
+
'--tao-color-success': 'oklch(0.555 0.14 155)',
|
|
124
|
+
'--tao-color-warning': 'oklch(0.7 0.15 70)',
|
|
125
|
+
'--tao-color-error': 'oklch(0.57 0.19 25)',
|
|
126
|
+
'--tao-color-bg-base': 'oklch(0.985 0.004 70)',
|
|
127
|
+
'--tao-color-text-base': 'oklch(0.155 0.01 70)',
|
|
128
|
+
'--tao-color-bg-surface': 'oklch(1 0 0)',
|
|
129
|
+
'--tao-color-text-light-solid': 'oklch(0.985 0.004 70)',
|
|
130
|
+
'--tao-radius': '10px',
|
|
131
|
+
'--tao-font-size': '14px',
|
|
132
|
+
'--tao-control-height': '32px',
|
|
133
|
+
'--tao-size-unit': '4px',
|
|
134
|
+
'--tao-size-step': '4',
|
|
135
|
+
'--tao-line-width': '1px',
|
|
136
|
+
'--tao-font-family': '"Geist Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif',
|
|
137
|
+
'--tao-font-family-code': '"Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',
|
|
138
|
+
'--tao-motion-unit': '0.1s',
|
|
139
|
+
'--tao-z-index-base': '0',
|
|
140
|
+
'--tao-z-index-popup-base': '1000'
|
|
141
|
+
};
|
|
97
142
|
function useStableTokenKey(token) {
|
|
98
143
|
const key = JSON.stringify(token ?? null);
|
|
99
144
|
const ref = useRef(key);
|
|
@@ -101,7 +146,7 @@ function useStableTokenKey(token) {
|
|
|
101
146
|
return ref.current;
|
|
102
147
|
}
|
|
103
148
|
function TaoProvider(t0) {
|
|
104
|
-
const $ = c(
|
|
149
|
+
const $ = c(26);
|
|
105
150
|
const { theme, size, disabled, variant, children } = t0;
|
|
106
151
|
const parentConfig = useContext(TaoConfigContext);
|
|
107
152
|
const inherit = theme?.inherit ?? true;
|
|
@@ -131,6 +176,12 @@ function TaoProvider(t0) {
|
|
|
131
176
|
const val_0 = parsedToken[key_0];
|
|
132
177
|
if (null != val_0) vars[varName_0] = `${val_0}px`;
|
|
133
178
|
}
|
|
179
|
+
for (const [key_1, varName_1] of Object.entries(TOKEN_TO_VAR_NUMBER)){
|
|
180
|
+
const val_1 = parsedToken[key_1];
|
|
181
|
+
if (null != val_1) vars[varName_1] = String(val_1);
|
|
182
|
+
}
|
|
183
|
+
if (false === parsedToken.motion) vars["--tao-motion-unit"] = "0s";
|
|
184
|
+
else if (null != parsedToken.motionUnit) vars["--tao-motion-unit"] = `${parsedToken.motionUnit}s`;
|
|
134
185
|
$[2] = parsedToken;
|
|
135
186
|
$[3] = vars;
|
|
136
187
|
} else vars = $[3];
|
|
@@ -138,26 +189,41 @@ function TaoProvider(t0) {
|
|
|
138
189
|
}
|
|
139
190
|
const ownVars = t1;
|
|
140
191
|
let t2;
|
|
141
|
-
if ($[4] !==
|
|
142
|
-
t2 = {
|
|
143
|
-
...
|
|
192
|
+
if ($[4] !== inherit || $[5] !== ownVars) {
|
|
193
|
+
t2 = inherit ? {
|
|
194
|
+
...ownVars
|
|
195
|
+
} : {
|
|
196
|
+
...DEFAULT_TOKEN_STYLE,
|
|
144
197
|
...ownVars
|
|
145
198
|
};
|
|
146
|
-
$[4] =
|
|
147
|
-
$[5] =
|
|
199
|
+
$[4] = inherit;
|
|
200
|
+
$[5] = ownVars;
|
|
148
201
|
$[6] = t2;
|
|
149
202
|
} else t2 = $[6];
|
|
150
|
-
const
|
|
151
|
-
|
|
203
|
+
const scopedVars = t2;
|
|
204
|
+
let t3;
|
|
205
|
+
if ($[7] !== inherit || $[8] !== parentConfig.tokenStyle || $[9] !== scopedVars) {
|
|
206
|
+
t3 = inherit ? {
|
|
207
|
+
...parentConfig.tokenStyle,
|
|
208
|
+
...scopedVars
|
|
209
|
+
} : {
|
|
210
|
+
...scopedVars
|
|
211
|
+
};
|
|
212
|
+
$[7] = inherit;
|
|
213
|
+
$[8] = parentConfig.tokenStyle;
|
|
214
|
+
$[9] = scopedVars;
|
|
215
|
+
$[10] = t3;
|
|
216
|
+
} else t3 = $[10];
|
|
217
|
+
const tokenStyle = t3;
|
|
152
218
|
let t4;
|
|
153
|
-
if ($[
|
|
219
|
+
if ($[11] !== scopedVars) {
|
|
154
220
|
t4 = {
|
|
155
221
|
display: "contents",
|
|
156
|
-
...
|
|
222
|
+
...scopedVars
|
|
157
223
|
};
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
} else t4 = $[
|
|
224
|
+
$[11] = scopedVars;
|
|
225
|
+
$[12] = t4;
|
|
226
|
+
} else t4 = $[12];
|
|
161
227
|
const divStyle = t4;
|
|
162
228
|
const parentSize = parentConfig.size;
|
|
163
229
|
const parentDisabled = parentConfig.disabled;
|
|
@@ -168,7 +234,7 @@ function TaoProvider(t0) {
|
|
|
168
234
|
const t6 = disabled ?? (inherit ? parentDisabled : false);
|
|
169
235
|
const t7 = variant ?? (inherit ? parentVariant : "outlined");
|
|
170
236
|
let t8;
|
|
171
|
-
if ($[
|
|
237
|
+
if ($[13] !== mode || $[14] !== t5 || $[15] !== t6 || $[16] !== t7 || $[17] !== tokenStyle) {
|
|
172
238
|
t8 = {
|
|
173
239
|
size: t5,
|
|
174
240
|
disabled: t6,
|
|
@@ -176,38 +242,38 @@ function TaoProvider(t0) {
|
|
|
176
242
|
mode,
|
|
177
243
|
tokenStyle
|
|
178
244
|
};
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
} else t8 = $[
|
|
245
|
+
$[13] = mode;
|
|
246
|
+
$[14] = t5;
|
|
247
|
+
$[15] = t6;
|
|
248
|
+
$[16] = t7;
|
|
249
|
+
$[17] = tokenStyle;
|
|
250
|
+
$[18] = t8;
|
|
251
|
+
} else t8 = $[18];
|
|
186
252
|
const config = t8;
|
|
187
253
|
const t9 = "light" === mode ? void 0 : mode;
|
|
188
254
|
let t10;
|
|
189
|
-
if ($[
|
|
255
|
+
if ($[19] !== children || $[20] !== divStyle || $[21] !== t9) {
|
|
190
256
|
t10 = /*#__PURE__*/ jsx("div", {
|
|
191
257
|
style: divStyle,
|
|
192
258
|
"data-tao-provider": "",
|
|
193
259
|
"data-tao-theme": t9,
|
|
194
260
|
children: children
|
|
195
261
|
});
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
} else t10 = $[
|
|
262
|
+
$[19] = children;
|
|
263
|
+
$[20] = divStyle;
|
|
264
|
+
$[21] = t9;
|
|
265
|
+
$[22] = t10;
|
|
266
|
+
} else t10 = $[22];
|
|
201
267
|
let t11;
|
|
202
|
-
if ($[
|
|
268
|
+
if ($[23] !== config || $[24] !== t10) {
|
|
203
269
|
t11 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
204
270
|
value: config,
|
|
205
271
|
children: t10
|
|
206
272
|
});
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
} else t11 = $[
|
|
273
|
+
$[23] = config;
|
|
274
|
+
$[24] = t10;
|
|
275
|
+
$[25] = t11;
|
|
276
|
+
} else t11 = $[25];
|
|
211
277
|
return t11;
|
|
212
278
|
}
|
|
213
279
|
export { TaoPortalScope, TaoProvider, useTaoConfig };
|