@rockshin/tao-ui 0.0.1

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 (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/components/button/button.css +1055 -0
  4. package/dist/components/button/button.d.ts +15 -0
  5. package/dist/components/button/button.js +93 -0
  6. package/dist/components/checkbox/checkbox.css +1035 -0
  7. package/dist/components/checkbox/checkbox.d.ts +33 -0
  8. package/dist/components/checkbox/checkbox.js +312 -0
  9. package/dist/components/date-picker/calendar/calendar-grid.d.ts +18 -0
  10. package/dist/components/date-picker/calendar/calendar-grid.js +173 -0
  11. package/dist/components/date-picker/calendar/calendar-header.d.ts +10 -0
  12. package/dist/components/date-picker/calendar/calendar-header.js +336 -0
  13. package/dist/components/date-picker/calendar/month-grid.d.ts +9 -0
  14. package/dist/components/date-picker/calendar/month-grid.js +61 -0
  15. package/dist/components/date-picker/calendar/time-panel.d.ts +12 -0
  16. package/dist/components/date-picker/calendar/time-panel.js +233 -0
  17. package/dist/components/date-picker/calendar/use-calendar.d.ts +15 -0
  18. package/dist/components/date-picker/calendar/use-calendar.js +24 -0
  19. package/dist/components/date-picker/calendar/year-grid.d.ts +9 -0
  20. package/dist/components/date-picker/calendar/year-grid.js +60 -0
  21. package/dist/components/date-picker/date-picker.css +1799 -0
  22. package/dist/components/date-picker/date-picker.d.ts +29 -0
  23. package/dist/components/date-picker/date-picker.js +663 -0
  24. package/dist/components/date-picker/presets.d.ts +9 -0
  25. package/dist/components/date-picker/presets.js +36 -0
  26. package/dist/components/date-picker/range-picker.d.ts +30 -0
  27. package/dist/components/date-picker/range-picker.js +432 -0
  28. package/dist/components/date-picker/types.d.ts +39 -0
  29. package/dist/components/date-picker/types.js +7 -0
  30. package/dist/components/drawer/drawer.css +1112 -0
  31. package/dist/components/drawer/drawer.d.ts +17 -0
  32. package/dist/components/drawer/drawer.js +184 -0
  33. package/dist/components/form-actions/form-actions.d.ts +12 -0
  34. package/dist/components/form-actions/form-actions.js +42 -0
  35. package/dist/components/form-field/form-field.d.ts +17 -0
  36. package/dist/components/form-field/form-field.js +101 -0
  37. package/dist/components/form-field/form.css +1036 -0
  38. package/dist/components/form-section/form-section.d.ts +14 -0
  39. package/dist/components/form-section/form-section.js +92 -0
  40. package/dist/components/input/input.css +1185 -0
  41. package/dist/components/input/input.d.ts +15 -0
  42. package/dist/components/input/input.js +143 -0
  43. package/dist/components/pagination/pagination.css +1099 -0
  44. package/dist/components/pagination/pagination.d.ts +22 -0
  45. package/dist/components/pagination/pagination.js +310 -0
  46. package/dist/components/radio/radio.css +1045 -0
  47. package/dist/components/radio/radio.d.ts +34 -0
  48. package/dist/components/radio/radio.js +215 -0
  49. package/dist/components/scroll-area/scroll-area.css +1099 -0
  50. package/dist/components/scroll-area/scroll-area.d.ts +33 -0
  51. package/dist/components/scroll-area/scroll-area.js +375 -0
  52. package/dist/components/select/mobile-select.css +1044 -0
  53. package/dist/components/select/mobile-select.d.ts +19 -0
  54. package/dist/components/select/mobile-select.js +224 -0
  55. package/dist/components/select/select.css +1327 -0
  56. package/dist/components/select/select.d.ts +32 -0
  57. package/dist/components/select/select.js +532 -0
  58. package/dist/components/select/use-is-mobile.d.ts +1 -0
  59. package/dist/components/select/use-is-mobile.js +30 -0
  60. package/dist/components/splitter/splitter.css +1104 -0
  61. package/dist/components/splitter/splitter.d.ts +33 -0
  62. package/dist/components/splitter/splitter.js +451 -0
  63. package/dist/components/switch/switch.css +1170 -0
  64. package/dist/components/switch/switch.d.ts +19 -0
  65. package/dist/components/switch/switch.js +143 -0
  66. package/dist/components/table/table.css +1255 -0
  67. package/dist/components/table/table.d.ts +73 -0
  68. package/dist/components/table/table.js +1022 -0
  69. package/dist/components/tabs/tabs.css +1076 -0
  70. package/dist/components/tabs/tabs.d.ts +24 -0
  71. package/dist/components/tabs/tabs.js +256 -0
  72. package/dist/components/tag/tag.css +1124 -0
  73. package/dist/components/tag/tag.d.ts +33 -0
  74. package/dist/components/tag/tag.js +237 -0
  75. package/dist/index.d.ts +23 -0
  76. package/dist/index.js +23 -0
  77. package/dist/layouts/form-layout/form-layout.d.ts +6 -0
  78. package/dist/layouts/form-layout/form-layout.js +18 -0
  79. package/dist/layouts/stack/layout.css +1003 -0
  80. package/dist/layouts/stack/stack.d.ts +9 -0
  81. package/dist/layouts/stack/stack.js +27 -0
  82. package/dist/number-input/cursor.d.ts +9 -0
  83. package/dist/number-input/cursor.js +44 -0
  84. package/dist/number-input/format.d.ts +5 -0
  85. package/dist/number-input/format.js +50 -0
  86. package/dist/number-input/index.d.ts +5 -0
  87. package/dist/number-input/index.js +2 -0
  88. package/dist/number-input/number-input.d.ts +9 -0
  89. package/dist/number-input/number-input.js +101 -0
  90. package/dist/number-input/percentage.d.ts +3 -0
  91. package/dist/number-input/percentage.js +28 -0
  92. package/dist/number-input/types.d.ts +5 -0
  93. package/dist/number-input/types.js +0 -0
  94. package/dist/number-input/use-number-input.d.ts +30 -0
  95. package/dist/number-input/use-number-input.js +211 -0
  96. package/dist/number-input/validate.d.ts +3 -0
  97. package/dist/number-input/validate.js +17 -0
  98. package/dist/provider/tao-provider.d.ts +42 -0
  99. package/dist/provider/tao-provider.js +67 -0
  100. package/dist/theme/control.css +1061 -0
  101. package/dist/theme/theme.css +957 -0
  102. package/dist/utils/semantic.d.ts +10 -0
  103. package/dist/utils/semantic.js +5 -0
  104. package/llms.txt +67 -0
  105. package/package.json +97 -0
@@ -0,0 +1,33 @@
1
+ import { type CSSProperties, type MouseEvent, type ReactNode } from 'react';
2
+ import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
+ import './tag.css';
4
+ export type TagSemanticPart = 'root' | 'icon' | 'close';
5
+ export type TagColor = 'default' | 'primary' | 'success' | 'warning' | 'error' | (string & {});
6
+ export type TagVariant = 'filled' | 'solid' | 'outlined';
7
+ export interface TagProps {
8
+ children?: ReactNode;
9
+ color?: TagColor;
10
+ variant?: TagVariant;
11
+ icon?: ReactNode;
12
+ closeIcon?: ReactNode | boolean;
13
+ onClose?: (e: MouseEvent<HTMLElement>) => void;
14
+ disabled?: boolean;
15
+ className?: string;
16
+ style?: CSSProperties;
17
+ classNames?: SemanticClassNames<TagSemanticPart>;
18
+ styles?: SemanticStyles<TagSemanticPart>;
19
+ }
20
+ export interface CheckableTagProps {
21
+ children?: ReactNode;
22
+ checked?: boolean;
23
+ onChange?: (checked: boolean) => void;
24
+ disabled?: boolean;
25
+ icon?: ReactNode;
26
+ className?: string;
27
+ style?: CSSProperties;
28
+ }
29
+ export declare function Tag({ children, color, variant, icon, closeIcon, onClose, disabled, className, style, classNames, styles, }: TagProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare namespace Tag {
31
+ var CheckableTag: typeof import("./tag").CheckableTag;
32
+ }
33
+ export declare function CheckableTag({ children, checked, onChange, disabled, icon, className, style, }: CheckableTagProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,237 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cx } from "../../utils/semantic.js";
4
+ import "./tag.css";
5
+ function CloseIcon() {
6
+ const $ = c(1);
7
+ let t0;
8
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
9
+ t0 = /*#__PURE__*/ jsx("svg", {
10
+ width: "12",
11
+ height: "12",
12
+ viewBox: "0 0 12 12",
13
+ fill: "none",
14
+ "aria-hidden": true,
15
+ children: /*#__PURE__*/ jsx("path", {
16
+ d: "M3 3l6 6M9 3l-6 6",
17
+ stroke: "currentColor",
18
+ strokeWidth: "1.5",
19
+ strokeLinecap: "round"
20
+ })
21
+ });
22
+ $[0] = t0;
23
+ } else t0 = $[0];
24
+ return t0;
25
+ }
26
+ function Tag(t0) {
27
+ const $ = c(35);
28
+ const { children, color: t1, variant: t2, icon, closeIcon, onClose, disabled: t3, className, style, classNames, styles } = t0;
29
+ const color = void 0 === t1 ? "default" : t1;
30
+ const variant = void 0 === t2 ? "filled" : t2;
31
+ const disabled = void 0 === t3 ? false : t3;
32
+ let t4;
33
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
34
+ t4 = [
35
+ "default",
36
+ "primary",
37
+ "success",
38
+ "warning",
39
+ "error"
40
+ ];
41
+ $[0] = t4;
42
+ } else t4 = $[0];
43
+ const isPreset = t4.includes(color);
44
+ const showClose = false !== closeIcon && null !== closeIcon && (closeIcon || onClose);
45
+ let t5;
46
+ if ($[1] !== disabled || $[2] !== onClose) {
47
+ t5 = (e)=>{
48
+ if (disabled) return;
49
+ onClose?.(e);
50
+ };
51
+ $[1] = disabled;
52
+ $[2] = onClose;
53
+ $[3] = t5;
54
+ } else t5 = $[3];
55
+ const handleClose = t5;
56
+ let t6;
57
+ if ($[4] !== color || $[5] !== isPreset || $[6] !== variant) {
58
+ t6 = !isPreset && color ? {
59
+ ..."solid" === variant ? {
60
+ background: color,
61
+ color: "#fff",
62
+ borderColor: color
63
+ } : "outlined" === variant ? {
64
+ color,
65
+ borderColor: color
66
+ } : {
67
+ background: `color-mix(in oklch, ${color} 12%, var(--tao-color-bg-base))`,
68
+ color,
69
+ borderColor: `color-mix(in oklch, ${color} 30%, var(--tao-color-bg-base))`
70
+ }
71
+ } : void 0;
72
+ $[4] = color;
73
+ $[5] = isPreset;
74
+ $[6] = variant;
75
+ $[7] = t6;
76
+ } else t6 = $[7];
77
+ const customColorStyle = t6;
78
+ const t7 = isPreset ? color : void 0;
79
+ const t8 = disabled || void 0;
80
+ const t9 = classNames?.root;
81
+ let t10;
82
+ if ($[8] !== className || $[9] !== t9) {
83
+ t10 = cx(t9, className);
84
+ $[8] = className;
85
+ $[9] = t9;
86
+ $[10] = t10;
87
+ } else t10 = $[10];
88
+ const t11 = styles?.root;
89
+ let t12;
90
+ if ($[11] !== customColorStyle || $[12] !== style || $[13] !== t11) {
91
+ t12 = {
92
+ ...customColorStyle,
93
+ ...t11,
94
+ ...style
95
+ };
96
+ $[11] = customColorStyle;
97
+ $[12] = style;
98
+ $[13] = t11;
99
+ $[14] = t12;
100
+ } else t12 = $[14];
101
+ let t13;
102
+ if ($[15] !== classNames?.icon || $[16] !== icon || $[17] !== styles?.icon) {
103
+ t13 = null != icon && /*#__PURE__*/ jsx("span", {
104
+ "data-tao-tag-icon": "",
105
+ className: cx(classNames?.icon),
106
+ style: styles?.icon,
107
+ children: icon
108
+ });
109
+ $[15] = classNames?.icon;
110
+ $[16] = icon;
111
+ $[17] = styles?.icon;
112
+ $[18] = t13;
113
+ } else t13 = $[18];
114
+ let t14;
115
+ if ($[19] !== classNames?.close || $[20] !== closeIcon || $[21] !== disabled || $[22] !== handleClose || $[23] !== showClose || $[24] !== styles?.close) {
116
+ t14 = showClose && /*#__PURE__*/ jsx("span", {
117
+ "data-tao-tag-close": "",
118
+ role: "button",
119
+ tabIndex: disabled ? void 0 : 0,
120
+ "aria-label": "Close",
121
+ onClick: handleClose,
122
+ onKeyDown: (e_0)=>{
123
+ if ("Enter" === e_0.key || " " === e_0.key) {
124
+ e_0.preventDefault();
125
+ handleClose(e_0);
126
+ }
127
+ },
128
+ className: cx(classNames?.close),
129
+ style: styles?.close,
130
+ children: true === closeIcon || void 0 === closeIcon ? /*#__PURE__*/ jsx(CloseIcon, {}) : closeIcon
131
+ });
132
+ $[19] = classNames?.close;
133
+ $[20] = closeIcon;
134
+ $[21] = disabled;
135
+ $[22] = handleClose;
136
+ $[23] = showClose;
137
+ $[24] = styles?.close;
138
+ $[25] = t14;
139
+ } else t14 = $[25];
140
+ let t15;
141
+ if ($[26] !== children || $[27] !== t10 || $[28] !== t12 || $[29] !== t13 || $[30] !== t14 || $[31] !== t7 || $[32] !== t8 || $[33] !== variant) {
142
+ t15 = /*#__PURE__*/ jsxs("span", {
143
+ "data-tao-tag": "",
144
+ "data-tao-color": t7,
145
+ "data-tao-variant": variant,
146
+ "data-tao-disabled": t8,
147
+ className: t10,
148
+ style: t12,
149
+ children: [
150
+ t13,
151
+ children,
152
+ t14
153
+ ]
154
+ });
155
+ $[26] = children;
156
+ $[27] = t10;
157
+ $[28] = t12;
158
+ $[29] = t13;
159
+ $[30] = t14;
160
+ $[31] = t7;
161
+ $[32] = t8;
162
+ $[33] = variant;
163
+ $[34] = t15;
164
+ } else t15 = $[34];
165
+ return t15;
166
+ }
167
+ function CheckableTag(t0) {
168
+ const $ = c(18);
169
+ const { children, checked: t1, onChange, disabled: t2, icon, className, style } = t0;
170
+ const checked = void 0 === t1 ? false : t1;
171
+ const disabled = void 0 === t2 ? false : t2;
172
+ const t3 = checked || void 0;
173
+ const t4 = disabled || void 0;
174
+ const t5 = disabled ? void 0 : 0;
175
+ let t6;
176
+ let t7;
177
+ if ($[0] !== checked || $[1] !== disabled || $[2] !== onChange) {
178
+ t6 = ()=>!disabled && onChange?.(!checked);
179
+ t7 = (e)=>{
180
+ if (!disabled && ("Enter" === e.key || " " === e.key)) {
181
+ e.preventDefault();
182
+ onChange?.(!checked);
183
+ }
184
+ };
185
+ $[0] = checked;
186
+ $[1] = disabled;
187
+ $[2] = onChange;
188
+ $[3] = t6;
189
+ $[4] = t7;
190
+ } else {
191
+ t6 = $[3];
192
+ t7 = $[4];
193
+ }
194
+ let t8;
195
+ if ($[5] !== icon) {
196
+ t8 = null != icon && /*#__PURE__*/ jsx("span", {
197
+ "data-tao-tag-icon": "",
198
+ children: icon
199
+ });
200
+ $[5] = icon;
201
+ $[6] = t8;
202
+ } else t8 = $[6];
203
+ let t9;
204
+ if ($[7] !== checked || $[8] !== children || $[9] !== className || $[10] !== style || $[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6 || $[15] !== t7 || $[16] !== t8) {
205
+ t9 = /*#__PURE__*/ jsxs("span", {
206
+ "data-tao-tag": "",
207
+ "data-tao-checkable": "",
208
+ "data-tao-checked": t3,
209
+ "data-tao-disabled": t4,
210
+ role: "checkbox",
211
+ "aria-checked": checked,
212
+ tabIndex: t5,
213
+ className: className,
214
+ style: style,
215
+ onClick: t6,
216
+ onKeyDown: t7,
217
+ children: [
218
+ t8,
219
+ children
220
+ ]
221
+ });
222
+ $[7] = checked;
223
+ $[8] = children;
224
+ $[9] = className;
225
+ $[10] = style;
226
+ $[11] = t3;
227
+ $[12] = t4;
228
+ $[13] = t5;
229
+ $[14] = t6;
230
+ $[15] = t7;
231
+ $[16] = t8;
232
+ $[17] = t9;
233
+ } else t9 = $[17];
234
+ return t9;
235
+ }
236
+ Tag.CheckableTag = CheckableTag;
237
+ export { CheckableTag, Tag };
@@ -0,0 +1,23 @@
1
+ export { TaoProvider, useTaoConfig, type TaoProviderProps, type TaoThemeConfig, type TaoSeedToken, type TaoSize, type TaoVariant, } from './provider/tao-provider';
2
+ export { cx, type SemanticClassNames, type SemanticStyles } from './utils/semantic';
3
+ export { Button, type ButtonProps, type ButtonSemanticPart } from './components/button/button';
4
+ export { Input, type InputProps, type InputSemanticPart } from './components/input/input';
5
+ export { Select, type SelectProps, type SelectOption, } from './components/select/select';
6
+ export { FormField, type FormFieldProps, type FormFieldSemanticPart, } from './components/form-field/form-field';
7
+ export { FormSection, type FormSectionProps, type FormSectionSemanticPart, } from './components/form-section/form-section';
8
+ export { FormActions, type FormActionsProps, type FormActionsSemanticPart, } from './components/form-actions/form-actions';
9
+ export { Drawer, type DrawerProps, type DrawerPlacement, type DrawerSemanticPart, } from './components/drawer/drawer';
10
+ export { Switch, type SwitchProps, type SwitchSemanticPart } from './components/switch/switch';
11
+ export { DatePicker, type DatePickerProps, } from './components/date-picker/date-picker';
12
+ export { RangePicker, type RangePickerProps, } from './components/date-picker/range-picker';
13
+ export { Checkbox, CheckboxGroup, type CheckboxProps, type CheckboxGroupProps, type CheckboxOptionType, type CheckboxSemanticPart, } from './components/checkbox/checkbox';
14
+ export { Radio, RadioGroup, type RadioProps, type RadioGroupProps, type RadioOptionType, type RadioSemanticPart, } from './components/radio/radio';
15
+ export { Tabs, type TabsProps, type TabItem, type TabsSemanticPart, } from './components/tabs/tabs';
16
+ export { Pagination, type PaginationProps, type PaginationSemanticPart, } from './components/pagination/pagination';
17
+ export { Table, type TableProps, type TableColumn, type TableRowSelection, type TableFilterItem, type TablePagination, type SortOrder, type SorterResult, type TableSemanticPart, } from './components/table/table';
18
+ export { Splitter, type SplitterProps, type SplitterPanelProps, type SplitterSemanticPart, } from './components/splitter/splitter';
19
+ export { Tag, CheckableTag, type TagProps, type CheckableTagProps, type TagColor, type TagVariant, type TagSemanticPart, } from './components/tag/tag';
20
+ export { ScrollArea, type ScrollAreaProps, type ScrollAreaType, type ScrollAreaSemanticPart, } from './components/scroll-area/scroll-area';
21
+ export { Stack, type StackProps } from './layouts/stack/stack';
22
+ export { FormLayout, type FormLayoutProps } from './layouts/form-layout/form-layout';
23
+ export { type FormatOptions, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from './number-input';
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ export { TaoProvider, useTaoConfig } from "./provider/tao-provider.js";
2
+ export { cx } from "./utils/semantic.js";
3
+ export { Button } from "./components/button/button.js";
4
+ export { Input } from "./components/input/input.js";
5
+ export { Select } from "./components/select/select.js";
6
+ export { FormField } from "./components/form-field/form-field.js";
7
+ export { FormSection } from "./components/form-section/form-section.js";
8
+ export { FormActions } from "./components/form-actions/form-actions.js";
9
+ export { Drawer } from "./components/drawer/drawer.js";
10
+ export { Switch } from "./components/switch/switch.js";
11
+ export { DatePicker } from "./components/date-picker/date-picker.js";
12
+ export { RangePicker } from "./components/date-picker/range-picker.js";
13
+ export { Checkbox, CheckboxGroup } from "./components/checkbox/checkbox.js";
14
+ export { Radio, RadioGroup } from "./components/radio/radio.js";
15
+ export { Tabs } from "./components/tabs/tabs.js";
16
+ export { Pagination } from "./components/pagination/pagination.js";
17
+ export { Table } from "./components/table/table.js";
18
+ export { Splitter } from "./components/splitter/splitter.js";
19
+ export { CheckableTag, Tag } from "./components/tag/tag.js";
20
+ export { ScrollArea } from "./components/scroll-area/scroll-area.js";
21
+ export { Stack } from "./layouts/stack/stack.js";
22
+ export { FormLayout } from "./layouts/form-layout/form-layout.js";
23
+ export { NumberInput, useNumberInput } from "./number-input/index.js";
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ import '../stack/layout.css';
3
+ export interface FormLayoutProps {
4
+ children: ReactNode;
5
+ }
6
+ export declare function FormLayout({ children }: FormLayoutProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import "../stack/layout.css";
4
+ function FormLayout(t0) {
5
+ const $ = c(2);
6
+ const { children } = t0;
7
+ let t1;
8
+ if ($[0] !== children) {
9
+ t1 = /*#__PURE__*/ jsx("div", {
10
+ "data-tao-form-layout": "",
11
+ children: children
12
+ });
13
+ $[0] = children;
14
+ $[1] = t1;
15
+ } else t1 = $[1];
16
+ return t1;
17
+ }
18
+ export { FormLayout };