@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.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/components/button/button.css +1055 -0
- package/dist/components/button/button.d.ts +15 -0
- package/dist/components/button/button.js +93 -0
- package/dist/components/checkbox/checkbox.css +1035 -0
- package/dist/components/checkbox/checkbox.d.ts +33 -0
- package/dist/components/checkbox/checkbox.js +312 -0
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +18 -0
- package/dist/components/date-picker/calendar/calendar-grid.js +173 -0
- package/dist/components/date-picker/calendar/calendar-header.d.ts +10 -0
- package/dist/components/date-picker/calendar/calendar-header.js +336 -0
- package/dist/components/date-picker/calendar/month-grid.d.ts +9 -0
- package/dist/components/date-picker/calendar/month-grid.js +61 -0
- package/dist/components/date-picker/calendar/time-panel.d.ts +12 -0
- package/dist/components/date-picker/calendar/time-panel.js +233 -0
- package/dist/components/date-picker/calendar/use-calendar.d.ts +15 -0
- package/dist/components/date-picker/calendar/use-calendar.js +24 -0
- package/dist/components/date-picker/calendar/year-grid.d.ts +9 -0
- package/dist/components/date-picker/calendar/year-grid.js +60 -0
- package/dist/components/date-picker/date-picker.css +1799 -0
- package/dist/components/date-picker/date-picker.d.ts +29 -0
- package/dist/components/date-picker/date-picker.js +663 -0
- package/dist/components/date-picker/presets.d.ts +9 -0
- package/dist/components/date-picker/presets.js +36 -0
- package/dist/components/date-picker/range-picker.d.ts +30 -0
- package/dist/components/date-picker/range-picker.js +432 -0
- package/dist/components/date-picker/types.d.ts +39 -0
- package/dist/components/date-picker/types.js +7 -0
- package/dist/components/drawer/drawer.css +1112 -0
- package/dist/components/drawer/drawer.d.ts +17 -0
- package/dist/components/drawer/drawer.js +184 -0
- package/dist/components/form-actions/form-actions.d.ts +12 -0
- package/dist/components/form-actions/form-actions.js +42 -0
- package/dist/components/form-field/form-field.d.ts +17 -0
- package/dist/components/form-field/form-field.js +101 -0
- package/dist/components/form-field/form.css +1036 -0
- package/dist/components/form-section/form-section.d.ts +14 -0
- package/dist/components/form-section/form-section.js +92 -0
- package/dist/components/input/input.css +1185 -0
- package/dist/components/input/input.d.ts +15 -0
- package/dist/components/input/input.js +143 -0
- package/dist/components/pagination/pagination.css +1099 -0
- package/dist/components/pagination/pagination.d.ts +22 -0
- package/dist/components/pagination/pagination.js +310 -0
- package/dist/components/radio/radio.css +1045 -0
- package/dist/components/radio/radio.d.ts +34 -0
- package/dist/components/radio/radio.js +215 -0
- package/dist/components/scroll-area/scroll-area.css +1099 -0
- package/dist/components/scroll-area/scroll-area.d.ts +33 -0
- package/dist/components/scroll-area/scroll-area.js +375 -0
- package/dist/components/select/mobile-select.css +1044 -0
- package/dist/components/select/mobile-select.d.ts +19 -0
- package/dist/components/select/mobile-select.js +224 -0
- package/dist/components/select/select.css +1327 -0
- package/dist/components/select/select.d.ts +32 -0
- package/dist/components/select/select.js +532 -0
- package/dist/components/select/use-is-mobile.d.ts +1 -0
- package/dist/components/select/use-is-mobile.js +30 -0
- package/dist/components/splitter/splitter.css +1104 -0
- package/dist/components/splitter/splitter.d.ts +33 -0
- package/dist/components/splitter/splitter.js +451 -0
- package/dist/components/switch/switch.css +1170 -0
- package/dist/components/switch/switch.d.ts +19 -0
- package/dist/components/switch/switch.js +143 -0
- package/dist/components/table/table.css +1255 -0
- package/dist/components/table/table.d.ts +73 -0
- package/dist/components/table/table.js +1022 -0
- package/dist/components/tabs/tabs.css +1076 -0
- package/dist/components/tabs/tabs.d.ts +24 -0
- package/dist/components/tabs/tabs.js +256 -0
- package/dist/components/tag/tag.css +1124 -0
- package/dist/components/tag/tag.d.ts +33 -0
- package/dist/components/tag/tag.js +237 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/layouts/form-layout/form-layout.d.ts +6 -0
- package/dist/layouts/form-layout/form-layout.js +18 -0
- package/dist/layouts/stack/layout.css +1003 -0
- package/dist/layouts/stack/stack.d.ts +9 -0
- package/dist/layouts/stack/stack.js +27 -0
- package/dist/number-input/cursor.d.ts +9 -0
- package/dist/number-input/cursor.js +44 -0
- package/dist/number-input/format.d.ts +5 -0
- package/dist/number-input/format.js +50 -0
- package/dist/number-input/index.d.ts +5 -0
- package/dist/number-input/index.js +2 -0
- package/dist/number-input/number-input.d.ts +9 -0
- package/dist/number-input/number-input.js +101 -0
- package/dist/number-input/percentage.d.ts +3 -0
- package/dist/number-input/percentage.js +28 -0
- package/dist/number-input/types.d.ts +5 -0
- package/dist/number-input/types.js +0 -0
- package/dist/number-input/use-number-input.d.ts +30 -0
- package/dist/number-input/use-number-input.js +211 -0
- package/dist/number-input/validate.d.ts +3 -0
- package/dist/number-input/validate.js +17 -0
- package/dist/provider/tao-provider.d.ts +42 -0
- package/dist/provider/tao-provider.js +67 -0
- package/dist/theme/control.css +1061 -0
- package/dist/theme/theme.css +957 -0
- package/dist/utils/semantic.d.ts +10 -0
- package/dist/utils/semantic.js +5 -0
- package/llms.txt +67 -0
- package/package.json +97 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { SelectOption } from './select';
|
|
3
|
+
import './mobile-select.css';
|
|
4
|
+
interface MobileSelectContentProps {
|
|
5
|
+
options: SelectOption[];
|
|
6
|
+
value?: string;
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
showSearch?: boolean;
|
|
10
|
+
filterOption?: (input: string, option: SelectOption) => boolean;
|
|
11
|
+
notFoundContent?: ReactNode;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function MobileSelectContent({ options, value, onChange, showSearch, filterOption, notFoundContent, onClose, }: MobileSelectContentProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export interface MobileSelectDrawerProps extends MobileSelectContentProps {
|
|
16
|
+
open: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function MobileSelectDrawer({ open, onClose, placeholder, ...rest }: MobileSelectDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Drawer } from "../drawer/drawer.js";
|
|
5
|
+
import "./mobile-select.css";
|
|
6
|
+
const defaultFilter = (input, option)=>{
|
|
7
|
+
const label = 'string' == typeof option.label ? option.label : String(option.label);
|
|
8
|
+
return label.toLowerCase().includes(input.toLowerCase());
|
|
9
|
+
};
|
|
10
|
+
function MobileSelectContent(t0) {
|
|
11
|
+
const $ = c(23);
|
|
12
|
+
const { options, value, onChange, showSearch, filterOption, notFoundContent: t1, onClose } = t0;
|
|
13
|
+
const notFoundContent = void 0 === t1 ? "No results" : t1;
|
|
14
|
+
const [search, setSearch] = useState("");
|
|
15
|
+
let t2;
|
|
16
|
+
bb0: {
|
|
17
|
+
if (!showSearch || !search) {
|
|
18
|
+
t2 = options;
|
|
19
|
+
break bb0;
|
|
20
|
+
}
|
|
21
|
+
const fn = filterOption ?? defaultFilter;
|
|
22
|
+
let t3;
|
|
23
|
+
if ($[0] !== fn || $[1] !== options || $[2] !== search) {
|
|
24
|
+
let t4;
|
|
25
|
+
if ($[4] !== fn || $[5] !== search) {
|
|
26
|
+
t4 = (o)=>fn(search, o);
|
|
27
|
+
$[4] = fn;
|
|
28
|
+
$[5] = search;
|
|
29
|
+
$[6] = t4;
|
|
30
|
+
} else t4 = $[6];
|
|
31
|
+
t3 = options.filter(t4);
|
|
32
|
+
$[0] = fn;
|
|
33
|
+
$[1] = options;
|
|
34
|
+
$[2] = search;
|
|
35
|
+
$[3] = t3;
|
|
36
|
+
} else t3 = $[3];
|
|
37
|
+
t2 = t3;
|
|
38
|
+
}
|
|
39
|
+
const filteredOptions = t2;
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[7] !== onChange || $[8] !== onClose) {
|
|
42
|
+
t3 = (optValue)=>{
|
|
43
|
+
onChange?.(optValue);
|
|
44
|
+
onClose();
|
|
45
|
+
};
|
|
46
|
+
$[7] = onChange;
|
|
47
|
+
$[8] = onClose;
|
|
48
|
+
$[9] = t3;
|
|
49
|
+
} else t3 = $[9];
|
|
50
|
+
const handleSelect = t3;
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[10] !== search || $[11] !== showSearch) {
|
|
53
|
+
t4 = showSearch && /*#__PURE__*/ jsxs("div", {
|
|
54
|
+
"data-tao-sheet-search": "",
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ jsx(SearchIcon, {}),
|
|
57
|
+
/*#__PURE__*/ jsx("input", {
|
|
58
|
+
"data-tao-sheet-search-input": "",
|
|
59
|
+
value: search,
|
|
60
|
+
onChange: (e)=>setSearch(e.target.value),
|
|
61
|
+
placeholder: "Search...",
|
|
62
|
+
autoFocus: true
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
$[10] = search;
|
|
67
|
+
$[11] = showSearch;
|
|
68
|
+
$[12] = t4;
|
|
69
|
+
} else t4 = $[12];
|
|
70
|
+
let t5;
|
|
71
|
+
if ($[13] !== filteredOptions || $[14] !== handleSelect || $[15] !== notFoundContent || $[16] !== value) {
|
|
72
|
+
t5 = filteredOptions.length > 0 ? filteredOptions.map((opt)=>{
|
|
73
|
+
const isSelected = opt.value === value;
|
|
74
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
75
|
+
"data-tao-sheet-item": "",
|
|
76
|
+
"data-tao-selected": isSelected || void 0,
|
|
77
|
+
"data-tao-disabled": opt.disabled || void 0,
|
|
78
|
+
onClick: ()=>{
|
|
79
|
+
if (!opt.disabled) handleSelect(opt.value);
|
|
80
|
+
},
|
|
81
|
+
children: [
|
|
82
|
+
/*#__PURE__*/ jsx("span", {
|
|
83
|
+
"data-tao-sheet-item-label": "",
|
|
84
|
+
children: opt.label
|
|
85
|
+
}),
|
|
86
|
+
isSelected && /*#__PURE__*/ jsx("span", {
|
|
87
|
+
"data-tao-sheet-item-check": "",
|
|
88
|
+
children: /*#__PURE__*/ jsx(CheckIcon, {})
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
}, opt.value);
|
|
92
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
93
|
+
"data-tao-sheet-empty": "",
|
|
94
|
+
children: notFoundContent
|
|
95
|
+
});
|
|
96
|
+
$[13] = filteredOptions;
|
|
97
|
+
$[14] = handleSelect;
|
|
98
|
+
$[15] = notFoundContent;
|
|
99
|
+
$[16] = value;
|
|
100
|
+
$[17] = t5;
|
|
101
|
+
} else t5 = $[17];
|
|
102
|
+
let t6;
|
|
103
|
+
if ($[18] !== t5) {
|
|
104
|
+
t6 = /*#__PURE__*/ jsx("div", {
|
|
105
|
+
"data-tao-sheet-list": "",
|
|
106
|
+
children: t5
|
|
107
|
+
});
|
|
108
|
+
$[18] = t5;
|
|
109
|
+
$[19] = t6;
|
|
110
|
+
} else t6 = $[19];
|
|
111
|
+
let t7;
|
|
112
|
+
if ($[20] !== t4 || $[21] !== t6) {
|
|
113
|
+
t7 = /*#__PURE__*/ jsxs(Fragment, {
|
|
114
|
+
children: [
|
|
115
|
+
t4,
|
|
116
|
+
t6
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
$[20] = t4;
|
|
120
|
+
$[21] = t6;
|
|
121
|
+
$[22] = t7;
|
|
122
|
+
} else t7 = $[22];
|
|
123
|
+
return t7;
|
|
124
|
+
}
|
|
125
|
+
function MobileSelectDrawer(t0) {
|
|
126
|
+
const $ = c(14);
|
|
127
|
+
let onClose;
|
|
128
|
+
let open;
|
|
129
|
+
let placeholder;
|
|
130
|
+
let rest;
|
|
131
|
+
if ($[0] !== t0) {
|
|
132
|
+
({ open, onClose, placeholder, ...rest } = t0);
|
|
133
|
+
$[0] = t0;
|
|
134
|
+
$[1] = onClose;
|
|
135
|
+
$[2] = open;
|
|
136
|
+
$[3] = placeholder;
|
|
137
|
+
$[4] = rest;
|
|
138
|
+
} else {
|
|
139
|
+
onClose = $[1];
|
|
140
|
+
open = $[2];
|
|
141
|
+
placeholder = $[3];
|
|
142
|
+
rest = $[4];
|
|
143
|
+
}
|
|
144
|
+
const t1 = placeholder ?? "Select";
|
|
145
|
+
let t2;
|
|
146
|
+
if ($[5] !== onClose || $[6] !== placeholder || $[7] !== rest) {
|
|
147
|
+
t2 = /*#__PURE__*/ jsx(MobileSelectContent, {
|
|
148
|
+
onClose: onClose,
|
|
149
|
+
placeholder: placeholder,
|
|
150
|
+
...rest
|
|
151
|
+
});
|
|
152
|
+
$[5] = onClose;
|
|
153
|
+
$[6] = placeholder;
|
|
154
|
+
$[7] = rest;
|
|
155
|
+
$[8] = t2;
|
|
156
|
+
} else t2 = $[8];
|
|
157
|
+
let t3;
|
|
158
|
+
if ($[9] !== onClose || $[10] !== open || $[11] !== t1 || $[12] !== t2) {
|
|
159
|
+
t3 = /*#__PURE__*/ jsx(Drawer, {
|
|
160
|
+
open: open,
|
|
161
|
+
onClose: onClose,
|
|
162
|
+
placement: "bottom",
|
|
163
|
+
title: t1,
|
|
164
|
+
height: "70vh",
|
|
165
|
+
children: t2
|
|
166
|
+
});
|
|
167
|
+
$[9] = onClose;
|
|
168
|
+
$[10] = open;
|
|
169
|
+
$[11] = t1;
|
|
170
|
+
$[12] = t2;
|
|
171
|
+
$[13] = t3;
|
|
172
|
+
} else t3 = $[13];
|
|
173
|
+
return t3;
|
|
174
|
+
}
|
|
175
|
+
function SearchIcon() {
|
|
176
|
+
const $ = c(1);
|
|
177
|
+
let t0;
|
|
178
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t0 = /*#__PURE__*/ jsxs("svg", {
|
|
180
|
+
width: "14",
|
|
181
|
+
height: "14",
|
|
182
|
+
viewBox: "0 0 24 24",
|
|
183
|
+
fill: "none",
|
|
184
|
+
stroke: "currentColor",
|
|
185
|
+
strokeWidth: "2",
|
|
186
|
+
strokeLinecap: "round",
|
|
187
|
+
strokeLinejoin: "round",
|
|
188
|
+
children: [
|
|
189
|
+
/*#__PURE__*/ jsx("circle", {
|
|
190
|
+
cx: "11",
|
|
191
|
+
cy: "11",
|
|
192
|
+
r: "8"
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ jsx("path", {
|
|
195
|
+
d: "m21 21-4.3-4.3"
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
});
|
|
199
|
+
$[0] = t0;
|
|
200
|
+
} else t0 = $[0];
|
|
201
|
+
return t0;
|
|
202
|
+
}
|
|
203
|
+
function CheckIcon() {
|
|
204
|
+
const $ = c(1);
|
|
205
|
+
let t0;
|
|
206
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
207
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
208
|
+
width: "18",
|
|
209
|
+
height: "18",
|
|
210
|
+
viewBox: "0 0 24 24",
|
|
211
|
+
fill: "none",
|
|
212
|
+
stroke: "currentColor",
|
|
213
|
+
strokeWidth: "2.5",
|
|
214
|
+
strokeLinecap: "round",
|
|
215
|
+
strokeLinejoin: "round",
|
|
216
|
+
children: /*#__PURE__*/ jsx("polyline", {
|
|
217
|
+
points: "20 6 9 17 4 12"
|
|
218
|
+
})
|
|
219
|
+
});
|
|
220
|
+
$[0] = t0;
|
|
221
|
+
} else t0 = $[0];
|
|
222
|
+
return t0;
|
|
223
|
+
}
|
|
224
|
+
export { MobileSelectContent, MobileSelectDrawer };
|