@rockshin/tao-ui 0.0.40 → 0.0.42
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 +33 -7
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/component-manifest.json +1321 -10
- package/dist/components/affix/affix.css +11 -0
- package/dist/components/affix/affix.d.ts +21 -0
- package/dist/components/affix/affix.js +140 -0
- package/dist/components/app/app-modals.d.ts +2 -0
- package/dist/components/app/app-modals.js +266 -0
- package/dist/components/app/app-notices.d.ts +6 -0
- package/dist/components/app/app-notices.js +334 -0
- package/dist/components/app/app-types.d.ts +154 -0
- package/dist/components/app/app-types.js +0 -0
- package/dist/components/app/app.css +221 -0
- package/dist/components/app/app.d.ts +7 -0
- package/dist/components/app/app.js +69 -0
- package/dist/components/auto-complete/auto-complete.css +35 -0
- package/dist/components/auto-complete/auto-complete.d.ts +47 -0
- package/dist/components/auto-complete/auto-complete.js +106 -0
- package/dist/components/avatar/avatar.css +95 -0
- package/dist/components/avatar/avatar.d.ts +50 -0
- package/dist/components/avatar/avatar.js +159 -0
- package/dist/components/badge/badge.css +165 -0
- package/dist/components/badge/badge.d.ts +48 -0
- package/dist/components/badge/badge.js +412 -0
- package/dist/components/border-beam/border-beam.css +35 -0
- package/dist/components/border-beam/border-beam.d.ts +27 -0
- package/dist/components/border-beam/border-beam.js +215 -0
- package/dist/components/button/button.css +7 -0
- package/dist/components/calendar/calendar.css +176 -0
- package/dist/components/calendar/calendar.d.ts +56 -0
- package/dist/components/calendar/calendar.js +175 -0
- package/dist/components/card/card-tabs.d.ts +43 -0
- package/dist/components/card/card-tabs.js +455 -0
- package/dist/components/card/card.css +401 -0
- package/dist/components/card/card.d.ts +74 -0
- package/dist/components/card/card.js +362 -0
- package/dist/components/carousel/carousel.css +231 -0
- package/dist/components/carousel/carousel.d.ts +35 -0
- package/dist/components/carousel/carousel.js +193 -0
- package/dist/components/cascader/cascader.css +123 -0
- package/dist/components/cascader/cascader.d.ts +58 -0
- package/dist/components/cascader/cascader.js +132 -0
- package/dist/components/checkbox/checkbox.css +7 -0
- package/dist/components/color-picker/color-picker-types.d.ts +78 -0
- package/dist/components/color-picker/color-picker-types.js +0 -0
- package/dist/components/color-picker/color-picker.css +299 -0
- package/dist/components/color-picker/color-picker.d.ts +5 -0
- package/dist/components/color-picker/color-picker.js +974 -0
- package/dist/components/color-picker/color.d.ts +35 -0
- package/dist/components/color-picker/color.js +65 -0
- package/dist/components/date-picker/calendar/calendar-grid.js +4 -11
- package/dist/components/date-picker/calendar/calendar-header.js +76 -69
- package/dist/components/date-picker/calendar/month-grid.js +20 -31
- package/dist/components/date-picker/calendar/time-panel.js +46 -41
- package/dist/components/date-picker/date-picker.css +4 -0
- package/dist/components/date-picker/date-picker.js +4 -4
- package/dist/components/date-picker/range-picker.js +14 -13
- package/dist/components/descriptions/descriptions.css +109 -0
- package/dist/components/descriptions/descriptions.d.ts +49 -0
- package/dist/components/descriptions/descriptions.js +189 -0
- package/dist/components/divider/divider.css +71 -0
- package/dist/components/divider/divider.d.ts +31 -0
- package/dist/components/divider/divider.js +83 -0
- package/dist/components/drawer/drawer.js +199 -184
- package/dist/components/empty/empty.css +35 -0
- package/dist/components/empty/empty.d.ts +25 -0
- package/dist/components/empty/empty.js +278 -0
- package/dist/components/float-button/float-button.css +146 -0
- package/dist/components/float-button/float-button.d.ts +67 -0
- package/dist/components/float-button/float-button.js +347 -0
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form.js +3 -1
- package/dist/components/image/image-icons.d.ts +16 -0
- package/dist/components/image/image-icons.js +63 -0
- package/dist/components/image/image.css +253 -0
- package/dist/components/image/image.d.ts +75 -0
- package/dist/components/image/image.js +818 -0
- package/dist/components/input/input.css +8 -6
- package/dist/components/list/list-pagination.css +127 -0
- package/dist/components/list/list-pagination.d.ts +38 -0
- package/dist/components/list/list-pagination.js +321 -0
- package/dist/components/list/list.css +225 -0
- package/dist/components/list/list.d.ts +77 -0
- package/dist/components/list/list.js +660 -0
- package/dist/components/listy/listy.css +55 -0
- package/dist/components/listy/listy.d.ts +20 -0
- package/dist/components/listy/listy.js +158 -0
- package/dist/components/masonry/masonry.css +13 -0
- package/dist/components/masonry/masonry.d.ts +39 -0
- package/dist/components/masonry/masonry.js +287 -0
- package/dist/components/mentions/mentions.css +172 -0
- package/dist/components/mentions/mentions.d.ts +48 -0
- package/dist/components/mentions/mentions.js +115 -0
- package/dist/components/modal/modal.d.ts +30 -4
- package/dist/components/modal/modal.js +534 -241
- package/dist/components/pagination/pagination.css +10 -0
- package/dist/components/progress/progress.css +187 -0
- package/dist/components/progress/progress.d.ts +66 -0
- package/dist/components/progress/progress.js +567 -0
- package/dist/components/qr-code/qr-code.css +39 -0
- package/dist/components/qr-code/qr-code.d.ts +43 -0
- package/dist/components/qr-code/qr-code.js +286 -0
- package/dist/components/radio/radio.css +7 -0
- package/dist/components/rate/rate.css +97 -0
- package/dist/components/rate/rate.d.ts +17 -0
- package/dist/components/rate/rate.js +172 -0
- package/dist/components/result/result.css +69 -0
- package/dist/components/result/result.d.ts +33 -0
- package/dist/components/result/result.js +320 -0
- package/dist/components/segmented/segmented.css +134 -0
- package/dist/components/segmented/segmented.d.ts +40 -0
- package/dist/components/segmented/segmented.js +169 -0
- package/dist/components/select/mobile-select.d.ts +10 -4
- package/dist/components/select/mobile-select.js +166 -58
- package/dist/components/select/select-tags.js +178 -130
- package/dist/components/select/select-types.d.ts +51 -0
- package/dist/components/select/select.css +70 -10
- package/dist/components/select/select.js +30 -16
- package/dist/components/select/use-select-selection.js +44 -43
- package/dist/components/skeleton/skeleton.css +129 -0
- package/dist/components/skeleton/skeleton.d.ts +78 -0
- package/dist/components/skeleton/skeleton.js +457 -0
- package/dist/components/slider/slider.css +191 -0
- package/dist/components/slider/slider.d.ts +47 -0
- package/dist/components/slider/slider.js +310 -0
- package/dist/components/statistic/statistic.css +34 -0
- package/dist/components/statistic/statistic.d.ts +46 -0
- package/dist/components/statistic/statistic.js +491 -0
- package/dist/components/switch/switch-touch.css +20 -0
- package/dist/components/switch/switch.css +24 -13
- package/dist/components/switch/switch.js +8 -5
- package/dist/components/textarea/textarea.css +1 -1
- package/dist/components/time-picker/time-picker.css +205 -0
- package/dist/components/time-picker/time-picker.d.ts +63 -0
- package/dist/components/time-picker/time-picker.js +356 -0
- package/dist/components/timeline/timeline.css +259 -0
- package/dist/components/timeline/timeline.d.ts +50 -0
- package/dist/components/timeline/timeline.js +140 -0
- package/dist/components/tour/tour.css +151 -0
- package/dist/components/tour/tour.d.ts +45 -0
- package/dist/components/tour/tour.js +575 -0
- package/dist/components/transfer/transfer-list.d.ts +2 -0
- package/dist/components/transfer/transfer-list.js +513 -0
- package/dist/components/transfer/transfer-parts.d.ts +3 -0
- package/dist/components/transfer/transfer-parts.js +163 -0
- package/dist/components/transfer/transfer-types.d.ts +163 -0
- package/dist/components/transfer/transfer-types.js +0 -0
- package/dist/components/transfer/transfer.css +226 -0
- package/dist/components/transfer/transfer.d.ts +13 -0
- package/dist/components/transfer/transfer.js +204 -0
- package/dist/components/tree/tree.css +250 -0
- package/dist/components/tree/tree.d.ts +46 -0
- package/dist/components/tree/tree.js +389 -0
- package/dist/components/tree-select/select-engine.css +231 -0
- package/dist/components/tree-select/select-engine.d.ts +20 -0
- package/dist/components/tree-select/select-engine.js +46 -0
- package/dist/components/tree-select/tree-select.css +25 -0
- package/dist/components/tree-select/tree-select.d.ts +50 -0
- package/dist/components/tree-select/tree-select.js +131 -0
- package/dist/components/upload/upload-types.d.ts +135 -0
- package/dist/components/upload/upload-types.js +0 -0
- package/dist/components/upload/upload.css +177 -0
- package/dist/components/upload/upload.d.ts +12 -0
- package/dist/components/upload/upload.js +455 -0
- package/dist/components/watermark/watermark-context.d.ts +7 -0
- package/dist/components/watermark/watermark-context.js +20 -0
- package/dist/components/watermark/watermark.css +10 -0
- package/dist/components/watermark/watermark.d.ts +38 -0
- package/dist/components/watermark/watermark.js +436 -0
- package/dist/docs/component-docs.d.ts +35 -29
- package/dist/docs/component-docs.js +73 -1
- package/dist/docs/components/affix.doc.d.ts +14 -0
- package/dist/docs/components/affix.doc.js +22 -0
- package/dist/docs/components/app.doc.d.ts +18 -0
- package/dist/docs/components/app.doc.js +42 -0
- package/dist/docs/components/auto-complete.doc.d.ts +18 -0
- package/dist/docs/components/auto-complete.doc.js +49 -0
- package/dist/docs/components/avatar.doc.d.ts +17 -0
- package/dist/docs/components/avatar.doc.js +36 -0
- package/dist/docs/components/badge.doc.d.ts +17 -0
- package/dist/docs/components/badge.doc.js +34 -0
- package/dist/docs/components/border-beam.doc.d.ts +14 -0
- package/dist/docs/components/border-beam.doc.js +22 -0
- package/dist/docs/components/calendar.doc.d.ts +18 -0
- package/dist/docs/components/calendar.doc.js +45 -0
- package/dist/docs/components/card.doc.d.ts +17 -0
- package/dist/docs/components/card.doc.js +39 -0
- package/dist/docs/components/carousel.doc.d.ts +15 -0
- package/dist/docs/components/carousel.doc.js +26 -0
- package/dist/docs/components/cascader.doc.d.ts +18 -0
- package/dist/docs/components/cascader.doc.js +54 -0
- package/dist/docs/components/color-picker.doc.d.ts +18 -0
- package/dist/docs/components/color-picker.doc.js +46 -0
- package/dist/docs/components/descriptions.doc.d.ts +14 -0
- package/dist/docs/components/descriptions.doc.js +26 -0
- package/dist/docs/components/divider.doc.d.ts +17 -0
- package/dist/docs/components/divider.doc.js +34 -0
- package/dist/docs/components/empty.doc.d.ts +18 -0
- package/dist/docs/components/empty.doc.js +40 -0
- package/dist/docs/components/float-button.doc.d.ts +14 -0
- package/dist/docs/components/float-button.doc.js +23 -0
- package/dist/docs/components/form.doc.d.ts +1 -1
- package/dist/docs/components/image.doc.d.ts +15 -0
- package/dist/docs/components/image.doc.js +38 -0
- package/dist/docs/components/list.doc.d.ts +18 -0
- package/dist/docs/components/list.doc.js +43 -0
- package/dist/docs/components/listy.doc.d.ts +18 -0
- package/dist/docs/components/listy.doc.js +40 -0
- package/dist/docs/components/masonry.doc.d.ts +14 -0
- package/dist/docs/components/masonry.doc.js +22 -0
- package/dist/docs/components/mentions.doc.d.ts +18 -0
- package/dist/docs/components/mentions.doc.js +43 -0
- package/dist/docs/components/modal.doc.js +3 -0
- package/dist/docs/components/progress.doc.d.ts +18 -0
- package/dist/docs/components/progress.doc.js +41 -0
- package/dist/docs/components/qr-code.doc.d.ts +18 -0
- package/dist/docs/components/qr-code.doc.js +41 -0
- package/dist/docs/components/rate.doc.d.ts +18 -0
- package/dist/docs/components/rate.doc.js +38 -0
- package/dist/docs/components/result.doc.d.ts +18 -0
- package/dist/docs/components/result.doc.js +42 -0
- package/dist/docs/components/segmented.doc.d.ts +14 -0
- package/dist/docs/components/segmented.doc.js +24 -0
- package/dist/docs/components/skeleton.doc.d.ts +18 -0
- package/dist/docs/components/skeleton.doc.js +42 -0
- package/dist/docs/components/slider.doc.d.ts +18 -0
- package/dist/docs/components/slider.doc.js +41 -0
- package/dist/docs/components/statistic.doc.d.ts +14 -0
- package/dist/docs/components/statistic.doc.js +27 -0
- package/dist/docs/components/time-picker.doc.d.ts +18 -0
- package/dist/docs/components/time-picker.doc.js +45 -0
- package/dist/docs/components/timeline.doc.d.ts +14 -0
- package/dist/docs/components/timeline.doc.js +29 -0
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/docs/components/tour.doc.d.ts +15 -0
- package/dist/docs/components/tour.doc.js +36 -0
- package/dist/docs/components/transfer.doc.d.ts +18 -0
- package/dist/docs/components/transfer.doc.js +48 -0
- package/dist/docs/components/tree-select.doc.d.ts +18 -0
- package/dist/docs/components/tree-select.doc.js +55 -0
- package/dist/docs/components/tree.doc.d.ts +18 -0
- package/dist/docs/components/tree.doc.js +46 -0
- package/dist/docs/components/upload.doc.d.ts +18 -0
- package/dist/docs/components/upload.doc.js +43 -0
- package/dist/docs/components/watermark.doc.d.ts +14 -0
- package/dist/docs/components/watermark.doc.js +22 -0
- package/dist/entries/affix.d.ts +3 -0
- package/dist/entries/affix.js +4 -0
- package/dist/entries/app.d.ts +3 -0
- package/dist/entries/app.js +4 -0
- package/dist/entries/auto-complete.d.ts +4 -0
- package/dist/entries/auto-complete.js +4 -0
- package/dist/entries/avatar.d.ts +3 -0
- package/dist/entries/avatar.js +4 -0
- package/dist/entries/badge.d.ts +3 -0
- package/dist/entries/badge.js +4 -0
- package/dist/entries/border-beam.d.ts +3 -0
- package/dist/entries/border-beam.js +4 -0
- package/dist/entries/calendar.d.ts +3 -0
- package/dist/entries/calendar.js +4 -0
- package/dist/entries/card.d.ts +3 -0
- package/dist/entries/card.js +4 -0
- package/dist/entries/carousel.d.ts +3 -0
- package/dist/entries/carousel.js +4 -0
- package/dist/entries/cascader.d.ts +4 -0
- package/dist/entries/cascader.js +4 -0
- package/dist/entries/color-picker.d.ts +5 -0
- package/dist/entries/color-picker.js +4 -0
- package/dist/entries/descriptions.d.ts +3 -0
- package/dist/entries/descriptions.js +4 -0
- package/dist/entries/divider.d.ts +3 -0
- package/dist/entries/divider.js +4 -0
- package/dist/entries/empty.d.ts +3 -0
- package/dist/entries/empty.js +4 -0
- package/dist/entries/float-button.d.ts +3 -0
- package/dist/entries/float-button.js +4 -0
- package/dist/entries/image.d.ts +3 -0
- package/dist/entries/image.js +4 -0
- package/dist/entries/list.d.ts +3 -0
- package/dist/entries/list.js +4 -0
- package/dist/entries/listy.d.ts +3 -0
- package/dist/entries/listy.js +4 -0
- package/dist/entries/masonry.d.ts +3 -0
- package/dist/entries/masonry.js +4 -0
- package/dist/entries/mentions.d.ts +4 -0
- package/dist/entries/mentions.js +4 -0
- package/dist/entries/progress.d.ts +3 -0
- package/dist/entries/progress.js +4 -0
- package/dist/entries/provider.d.ts +1 -1
- package/dist/entries/provider.js +1 -1
- package/dist/entries/qr-code.d.ts +4 -0
- package/dist/entries/qr-code.js +4 -0
- package/dist/entries/rate.d.ts +3 -0
- package/dist/entries/rate.js +4 -0
- package/dist/entries/result.d.ts +3 -0
- package/dist/entries/result.js +4 -0
- package/dist/entries/segmented.d.ts +3 -0
- package/dist/entries/segmented.js +4 -0
- package/dist/entries/skeleton.d.ts +3 -0
- package/dist/entries/skeleton.js +4 -0
- package/dist/entries/slider.d.ts +3 -0
- package/dist/entries/slider.js +4 -0
- package/dist/entries/statistic.d.ts +3 -0
- package/dist/entries/statistic.js +4 -0
- package/dist/entries/time-picker.d.ts +3 -0
- package/dist/entries/time-picker.js +4 -0
- package/dist/entries/timeline.d.ts +3 -0
- package/dist/entries/timeline.js +4 -0
- package/dist/entries/tour.d.ts +3 -0
- package/dist/entries/tour.js +4 -0
- package/dist/entries/transfer.d.ts +3 -0
- package/dist/entries/transfer.js +4 -0
- package/dist/entries/tree-select.d.ts +4 -0
- package/dist/entries/tree-select.js +4 -0
- package/dist/entries/tree.d.ts +3 -0
- package/dist/entries/tree.js +4 -0
- package/dist/entries/upload.d.ts +4 -0
- package/dist/entries/upload.js +4 -0
- package/dist/entries/util.d.ts +1 -0
- package/dist/entries/util.js +1 -0
- package/dist/entries/watermark.d.ts +3 -0
- package/dist/entries/watermark.js +4 -0
- package/dist/index.d.ts +48 -3
- package/dist/index.js +38 -2
- package/dist/provider/locale.d.ts +59 -0
- package/dist/provider/locale.js +136 -0
- package/dist/provider/tao-provider.d.ts +16 -1
- package/dist/provider/tao-provider.js +104 -87
- package/dist/theme/control.css +10 -0
- package/dist/theme/theme.css +1 -1
- package/dist/utils/breakpoint.d.ts +2 -2
- package/dist/utils/breakpoint.js +3 -1
- package/dist/utils/interop-default.d.ts +2 -0
- package/dist/utils/interop-default.js +4 -0
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.js +0 -0
- package/llms.txt +476 -8
- package/package.json +27 -6
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
4
|
+
import { cx } from "../../utils/semantic.js";
|
|
5
|
+
import "./result.css";
|
|
6
|
+
function ResultIcon(t0) {
|
|
7
|
+
const $ = c(2);
|
|
8
|
+
const { status } = t0;
|
|
9
|
+
let t1;
|
|
10
|
+
if ($[0] !== status) {
|
|
11
|
+
t1 = /*#__PURE__*/ jsxs("svg", {
|
|
12
|
+
viewBox: "0 0 48 48",
|
|
13
|
+
fill: "none",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: [
|
|
16
|
+
"warning" === status ? /*#__PURE__*/ jsx("path", {
|
|
17
|
+
d: "M24 6L44 41H4L24 6z",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
strokeWidth: "2",
|
|
20
|
+
strokeLinejoin: "round"
|
|
21
|
+
}) : /*#__PURE__*/ jsx("circle", {
|
|
22
|
+
cx: "24",
|
|
23
|
+
cy: "24",
|
|
24
|
+
r: "19",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: "2"
|
|
27
|
+
}),
|
|
28
|
+
"success" === status ? /*#__PURE__*/ jsx("path", {
|
|
29
|
+
d: "m14 24 7 7 14-15",
|
|
30
|
+
stroke: "currentColor",
|
|
31
|
+
strokeWidth: "2.5",
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round"
|
|
34
|
+
}) : "error" === status ? /*#__PURE__*/ jsx("path", {
|
|
35
|
+
d: "m17 17 14 14m0-14L17 31",
|
|
36
|
+
stroke: "currentColor",
|
|
37
|
+
strokeWidth: "2.5",
|
|
38
|
+
strokeLinecap: "round"
|
|
39
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ jsx("path", {
|
|
42
|
+
d: "warning" === status ? "M24 19v11" : "M24 23v10",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeWidth: "2.5",
|
|
45
|
+
strokeLinecap: "round"
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ jsx("circle", {
|
|
48
|
+
cx: "24",
|
|
49
|
+
cy: "warning" === status ? 35 : 16,
|
|
50
|
+
r: "1.5",
|
|
51
|
+
fill: "currentColor"
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
$[0] = status;
|
|
58
|
+
$[1] = t1;
|
|
59
|
+
} else t1 = $[1];
|
|
60
|
+
return t1;
|
|
61
|
+
}
|
|
62
|
+
function ForbiddenImage() {
|
|
63
|
+
const $ = c(1);
|
|
64
|
+
let t0;
|
|
65
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
66
|
+
t0 = /*#__PURE__*/ jsx("span", {
|
|
67
|
+
"data-tao-result-code": "",
|
|
68
|
+
children: "403"
|
|
69
|
+
});
|
|
70
|
+
$[0] = t0;
|
|
71
|
+
} else t0 = $[0];
|
|
72
|
+
return t0;
|
|
73
|
+
}
|
|
74
|
+
function NotFoundImage() {
|
|
75
|
+
const $ = c(1);
|
|
76
|
+
let t0;
|
|
77
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
78
|
+
t0 = /*#__PURE__*/ jsx("span", {
|
|
79
|
+
"data-tao-result-code": "",
|
|
80
|
+
children: "404"
|
|
81
|
+
});
|
|
82
|
+
$[0] = t0;
|
|
83
|
+
} else t0 = $[0];
|
|
84
|
+
return t0;
|
|
85
|
+
}
|
|
86
|
+
function ServerErrorImage() {
|
|
87
|
+
const $ = c(1);
|
|
88
|
+
let t0;
|
|
89
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t0 = /*#__PURE__*/ jsx("span", {
|
|
91
|
+
"data-tao-result-code": "",
|
|
92
|
+
children: "500"
|
|
93
|
+
});
|
|
94
|
+
$[0] = t0;
|
|
95
|
+
} else t0 = $[0];
|
|
96
|
+
return t0;
|
|
97
|
+
}
|
|
98
|
+
const exceptionImages = {
|
|
99
|
+
403: ForbiddenImage,
|
|
100
|
+
404: NotFoundImage,
|
|
101
|
+
500: ServerErrorImage
|
|
102
|
+
};
|
|
103
|
+
const renderable = (value)=>null != value && 'boolean' != typeof value;
|
|
104
|
+
const ResultRoot = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
105
|
+
const $ = c(68);
|
|
106
|
+
let children;
|
|
107
|
+
let className;
|
|
108
|
+
let classNames;
|
|
109
|
+
let extra;
|
|
110
|
+
let icon;
|
|
111
|
+
let rest;
|
|
112
|
+
let rootClassName;
|
|
113
|
+
let style;
|
|
114
|
+
let styles;
|
|
115
|
+
let subTitle;
|
|
116
|
+
let t0;
|
|
117
|
+
let t1;
|
|
118
|
+
let title;
|
|
119
|
+
if ($[0] !== props) {
|
|
120
|
+
({ status: t0, icon, title, subTitle, extra, children, prefixCls: t1, className, rootClassName, style, classNames, styles, ...rest } = props);
|
|
121
|
+
$[0] = props;
|
|
122
|
+
$[1] = children;
|
|
123
|
+
$[2] = className;
|
|
124
|
+
$[3] = classNames;
|
|
125
|
+
$[4] = extra;
|
|
126
|
+
$[5] = icon;
|
|
127
|
+
$[6] = rest;
|
|
128
|
+
$[7] = rootClassName;
|
|
129
|
+
$[8] = style;
|
|
130
|
+
$[9] = styles;
|
|
131
|
+
$[10] = subTitle;
|
|
132
|
+
$[11] = t0;
|
|
133
|
+
$[12] = t1;
|
|
134
|
+
$[13] = title;
|
|
135
|
+
} else {
|
|
136
|
+
children = $[1];
|
|
137
|
+
className = $[2];
|
|
138
|
+
classNames = $[3];
|
|
139
|
+
extra = $[4];
|
|
140
|
+
icon = $[5];
|
|
141
|
+
rest = $[6];
|
|
142
|
+
rootClassName = $[7];
|
|
143
|
+
style = $[8];
|
|
144
|
+
styles = $[9];
|
|
145
|
+
subTitle = $[10];
|
|
146
|
+
t0 = $[11];
|
|
147
|
+
t1 = $[12];
|
|
148
|
+
title = $[13];
|
|
149
|
+
}
|
|
150
|
+
const status = void 0 === t0 ? "info" : t0;
|
|
151
|
+
const prefixCls = void 0 === t1 ? "tao-result" : t1;
|
|
152
|
+
let names;
|
|
153
|
+
let t2;
|
|
154
|
+
if ($[14] !== classNames || $[15] !== props || $[16] !== status || $[17] !== styles) {
|
|
155
|
+
const resolvedProps = {
|
|
156
|
+
...props,
|
|
157
|
+
status
|
|
158
|
+
};
|
|
159
|
+
names = "function" == typeof classNames ? classNames({
|
|
160
|
+
props: resolvedProps
|
|
161
|
+
}) : classNames;
|
|
162
|
+
t2 = "function" == typeof styles ? styles({
|
|
163
|
+
props: resolvedProps
|
|
164
|
+
}) : styles;
|
|
165
|
+
$[14] = classNames;
|
|
166
|
+
$[15] = props;
|
|
167
|
+
$[16] = status;
|
|
168
|
+
$[17] = styles;
|
|
169
|
+
$[18] = names;
|
|
170
|
+
$[19] = t2;
|
|
171
|
+
} else {
|
|
172
|
+
names = $[18];
|
|
173
|
+
t2 = $[19];
|
|
174
|
+
}
|
|
175
|
+
const slots = t2;
|
|
176
|
+
const root = useRef(null);
|
|
177
|
+
let t3;
|
|
178
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t3 = ()=>({
|
|
180
|
+
nativeElement: root.current
|
|
181
|
+
});
|
|
182
|
+
$[20] = t3;
|
|
183
|
+
} else t3 = $[20];
|
|
184
|
+
useImperativeHandle(ref, t3);
|
|
185
|
+
const exception = 403 === status || "403" === status || 404 === status || "404" === status || 500 === status || "500" === status;
|
|
186
|
+
const ExceptionImage = exception ? exceptionImages[String(status)] : void 0;
|
|
187
|
+
const t4 = `${prefixCls}-${status}`;
|
|
188
|
+
const t5 = names?.root;
|
|
189
|
+
let t6;
|
|
190
|
+
if ($[21] !== className || $[22] !== prefixCls || $[23] !== rootClassName || $[24] !== t4 || $[25] !== t5) {
|
|
191
|
+
t6 = cx(prefixCls, t4, t5, className, rootClassName);
|
|
192
|
+
$[21] = className;
|
|
193
|
+
$[22] = prefixCls;
|
|
194
|
+
$[23] = rootClassName;
|
|
195
|
+
$[24] = t4;
|
|
196
|
+
$[25] = t5;
|
|
197
|
+
$[26] = t6;
|
|
198
|
+
} else t6 = $[26];
|
|
199
|
+
const t7 = slots?.root;
|
|
200
|
+
let t8;
|
|
201
|
+
if ($[27] !== style || $[28] !== t7) {
|
|
202
|
+
t8 = {
|
|
203
|
+
...t7,
|
|
204
|
+
...style
|
|
205
|
+
};
|
|
206
|
+
$[27] = style;
|
|
207
|
+
$[28] = t7;
|
|
208
|
+
$[29] = t8;
|
|
209
|
+
} else t8 = $[29];
|
|
210
|
+
let t9;
|
|
211
|
+
if ($[30] !== ExceptionImage || $[31] !== exception || $[32] !== icon || $[33] !== names?.icon || $[34] !== prefixCls || $[35] !== slots?.icon || $[36] !== status) {
|
|
212
|
+
t9 = (exception || null !== icon && false !== icon) && /*#__PURE__*/ jsx("div", {
|
|
213
|
+
"data-tao-result-icon": "",
|
|
214
|
+
className: cx(`${prefixCls}-icon`, names?.icon),
|
|
215
|
+
style: slots?.icon,
|
|
216
|
+
children: ExceptionImage ? /*#__PURE__*/ jsx(ExceptionImage, {}) : renderable(icon) ? icon : /*#__PURE__*/ jsx(ResultIcon, {
|
|
217
|
+
status: status
|
|
218
|
+
})
|
|
219
|
+
});
|
|
220
|
+
$[30] = ExceptionImage;
|
|
221
|
+
$[31] = exception;
|
|
222
|
+
$[32] = icon;
|
|
223
|
+
$[33] = names?.icon;
|
|
224
|
+
$[34] = prefixCls;
|
|
225
|
+
$[35] = slots?.icon;
|
|
226
|
+
$[36] = status;
|
|
227
|
+
$[37] = t9;
|
|
228
|
+
} else t9 = $[37];
|
|
229
|
+
let t10;
|
|
230
|
+
if ($[38] !== names?.title || $[39] !== prefixCls || $[40] !== slots?.title || $[41] !== title) {
|
|
231
|
+
t10 = renderable(title) && /*#__PURE__*/ jsx("div", {
|
|
232
|
+
"data-tao-result-title": "",
|
|
233
|
+
className: cx(`${prefixCls}-title`, names?.title),
|
|
234
|
+
style: slots?.title,
|
|
235
|
+
children: title
|
|
236
|
+
});
|
|
237
|
+
$[38] = names?.title;
|
|
238
|
+
$[39] = prefixCls;
|
|
239
|
+
$[40] = slots?.title;
|
|
240
|
+
$[41] = title;
|
|
241
|
+
$[42] = t10;
|
|
242
|
+
} else t10 = $[42];
|
|
243
|
+
let t11;
|
|
244
|
+
if ($[43] !== names?.subTitle || $[44] !== prefixCls || $[45] !== slots?.subTitle || $[46] !== subTitle) {
|
|
245
|
+
t11 = renderable(subTitle) && /*#__PURE__*/ jsx("div", {
|
|
246
|
+
"data-tao-result-subtitle": "",
|
|
247
|
+
className: cx(`${prefixCls}-subtitle`, names?.subTitle),
|
|
248
|
+
style: slots?.subTitle,
|
|
249
|
+
children: subTitle
|
|
250
|
+
});
|
|
251
|
+
$[43] = names?.subTitle;
|
|
252
|
+
$[44] = prefixCls;
|
|
253
|
+
$[45] = slots?.subTitle;
|
|
254
|
+
$[46] = subTitle;
|
|
255
|
+
$[47] = t11;
|
|
256
|
+
} else t11 = $[47];
|
|
257
|
+
let t12;
|
|
258
|
+
if ($[48] !== extra || $[49] !== names?.extra || $[50] !== prefixCls || $[51] !== slots?.extra) {
|
|
259
|
+
t12 = renderable(extra) && /*#__PURE__*/ jsx("div", {
|
|
260
|
+
"data-tao-result-extra": "",
|
|
261
|
+
className: cx(`${prefixCls}-extra`, names?.extra),
|
|
262
|
+
style: slots?.extra,
|
|
263
|
+
children: extra
|
|
264
|
+
});
|
|
265
|
+
$[48] = extra;
|
|
266
|
+
$[49] = names?.extra;
|
|
267
|
+
$[50] = prefixCls;
|
|
268
|
+
$[51] = slots?.extra;
|
|
269
|
+
$[52] = t12;
|
|
270
|
+
} else t12 = $[52];
|
|
271
|
+
let t13;
|
|
272
|
+
if ($[53] !== children || $[54] !== names?.body || $[55] !== prefixCls || $[56] !== slots?.body) {
|
|
273
|
+
t13 = renderable(children) && /*#__PURE__*/ jsx("div", {
|
|
274
|
+
"data-tao-result-body": "",
|
|
275
|
+
className: cx(`${prefixCls}-body`, names?.body),
|
|
276
|
+
style: slots?.body,
|
|
277
|
+
children: children
|
|
278
|
+
});
|
|
279
|
+
$[53] = children;
|
|
280
|
+
$[54] = names?.body;
|
|
281
|
+
$[55] = prefixCls;
|
|
282
|
+
$[56] = slots?.body;
|
|
283
|
+
$[57] = t13;
|
|
284
|
+
} else t13 = $[57];
|
|
285
|
+
let t14;
|
|
286
|
+
if ($[58] !== rest || $[59] !== status || $[60] !== t10 || $[61] !== t11 || $[62] !== t12 || $[63] !== t13 || $[64] !== t6 || $[65] !== t8 || $[66] !== t9) {
|
|
287
|
+
t14 = /*#__PURE__*/ jsxs("div", {
|
|
288
|
+
...rest,
|
|
289
|
+
ref: root,
|
|
290
|
+
"data-tao-result": "",
|
|
291
|
+
"data-tao-status": status,
|
|
292
|
+
className: t6,
|
|
293
|
+
style: t8,
|
|
294
|
+
children: [
|
|
295
|
+
t9,
|
|
296
|
+
t10,
|
|
297
|
+
t11,
|
|
298
|
+
t12,
|
|
299
|
+
t13
|
|
300
|
+
]
|
|
301
|
+
});
|
|
302
|
+
$[58] = rest;
|
|
303
|
+
$[59] = status;
|
|
304
|
+
$[60] = t10;
|
|
305
|
+
$[61] = t11;
|
|
306
|
+
$[62] = t12;
|
|
307
|
+
$[63] = t13;
|
|
308
|
+
$[64] = t6;
|
|
309
|
+
$[65] = t8;
|
|
310
|
+
$[66] = t9;
|
|
311
|
+
$[67] = t14;
|
|
312
|
+
} else t14 = $[67];
|
|
313
|
+
return t14;
|
|
314
|
+
});
|
|
315
|
+
const result_Result = Object.assign(ResultRoot, {
|
|
316
|
+
PRESENTED_IMAGE_403: ForbiddenImage,
|
|
317
|
+
PRESENTED_IMAGE_404: NotFoundImage,
|
|
318
|
+
PRESENTED_IMAGE_500: ServerErrorImage
|
|
319
|
+
});
|
|
320
|
+
export { result_Result as Result };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@layer tao {
|
|
2
|
+
[data-tao-segmented] {
|
|
3
|
+
border-radius: var(--tao-radius);
|
|
4
|
+
background: var(--tao-color-fill-tertiary);
|
|
5
|
+
color: var(--tao-color-text-secondary);
|
|
6
|
+
font: var(--tao-font-size) / var(--tao-line-height) var(--tao-font-family);
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
align-items: stretch;
|
|
9
|
+
gap: 2px;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
padding: 3px;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-tao-segmented][data-tao-block] {
|
|
17
|
+
width: 100%;
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[data-tao-segmented-item] {
|
|
22
|
+
z-index: 1;
|
|
23
|
+
border-radius: calc(var(--tao-radius) - 2px);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
transition: background-color .15s, color .15s;
|
|
27
|
+
display: flex;
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-tao-segmented][data-tao-block] [data-tao-segmented-item] {
|
|
32
|
+
flex: 1;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-tao-segmented-item] input {
|
|
37
|
+
opacity: 0;
|
|
38
|
+
width: 1px;
|
|
39
|
+
height: 1px;
|
|
40
|
+
margin: 0;
|
|
41
|
+
position: absolute;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-tao-segmented-item]:has(input:focus-visible) {
|
|
45
|
+
outline: 2px solid var(--tao-color-primary);
|
|
46
|
+
outline-offset: 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[data-tao-segmented-item]:not([data-tao-disabled]):hover {
|
|
50
|
+
color: var(--tao-color-text);
|
|
51
|
+
background: var(--tao-color-fill-secondary);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[data-tao-segmented-item][data-tao-checked] {
|
|
55
|
+
color: var(--tao-color-text);
|
|
56
|
+
background: var(--tao-color-bg-container);
|
|
57
|
+
box-shadow: 0 1px 3px
|
|
58
|
+
color-mix(in oklab, var(--tao-color-text) 12%, transparent);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[data-tao-segmented-item][data-tao-checked]:not([data-tao-disabled]):hover {
|
|
62
|
+
background: var(--tao-color-bg-container);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-tao-segmented-item][data-tao-disabled] {
|
|
66
|
+
color: var(--tao-color-text-disabled);
|
|
67
|
+
cursor: not-allowed;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-tao-segmented-label] {
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
overflow-wrap: anywhere;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 6px;
|
|
76
|
+
min-width: 0;
|
|
77
|
+
min-height: 26px;
|
|
78
|
+
padding-inline: 12px;
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[data-tao-segmented-icon] {
|
|
83
|
+
align-items: center;
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[data-tao-segmented][data-tao-size="small"] [data-tao-segmented-label] {
|
|
88
|
+
min-height: 20px;
|
|
89
|
+
font-size: var(--tao-font-size-sm);
|
|
90
|
+
padding-inline: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[data-tao-segmented][data-tao-size="large"] [data-tao-segmented-label] {
|
|
94
|
+
min-height: 34px;
|
|
95
|
+
font-size: var(--tao-font-size-lg);
|
|
96
|
+
padding-inline: 16px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[data-tao-segmented][data-tao-orientation="vertical"] {
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[data-tao-segmented][data-tao-shape="round"], [data-tao-segmented][data-tao-shape="round"] [data-tao-segmented-item] {
|
|
104
|
+
border-radius: 999px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[data-tao-segmented-thumb] {
|
|
108
|
+
border-radius: calc(var(--tao-radius) - 2px);
|
|
109
|
+
background: var(--tao-color-bg-container);
|
|
110
|
+
box-shadow: 0 1px 3px
|
|
111
|
+
color-mix(in oklab, var(--tao-color-text) 12%, transparent);
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
transition: transform .18s;
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: 0;
|
|
116
|
+
left: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[data-tao-segmented][data-tao-has-thumb] [data-tao-segmented-item][data-tao-checked] {
|
|
120
|
+
box-shadow: none;
|
|
121
|
+
background: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[data-tao-segmented][data-tao-shape="round"] [data-tao-segmented-thumb] {
|
|
125
|
+
border-radius: 999px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@media (prefers-reduced-motion: reduce) {
|
|
129
|
+
[data-tao-segmented-item], [data-tao-segmented-thumb] {
|
|
130
|
+
transition: none;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode, type RefAttributes } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
3
|
+
import { type TooltipProps } from '../tooltip/tooltip.js';
|
|
4
|
+
import './segmented.css';
|
|
5
|
+
export type SegmentedValue = string | number;
|
|
6
|
+
export type SegmentedSemanticPart = 'root' | 'item' | 'label' | 'icon';
|
|
7
|
+
export interface SegmentedLabeledOption<ValueType = SegmentedValue> {
|
|
8
|
+
value: ValueType;
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
tooltip?: string | Omit<TooltipProps, 'children'>;
|
|
15
|
+
}
|
|
16
|
+
export type SegmentedOptions<ValueType = SegmentedValue> = (ValueType | SegmentedLabeledOption<ValueType>)[];
|
|
17
|
+
export interface SegmentedProps<ValueType = SegmentedValue> extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
18
|
+
prefixCls?: string;
|
|
19
|
+
rootClassName?: string;
|
|
20
|
+
options: SegmentedOptions<ValueType>;
|
|
21
|
+
value?: ValueType;
|
|
22
|
+
defaultValue?: ValueType;
|
|
23
|
+
onChange?: (value: ValueType) => void;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
name?: string;
|
|
26
|
+
block?: boolean;
|
|
27
|
+
size?: 'small' | 'medium' | 'middle' | 'large';
|
|
28
|
+
vertical?: boolean;
|
|
29
|
+
orientation?: 'horizontal' | 'vertical';
|
|
30
|
+
direction?: 'ltr' | 'rtl';
|
|
31
|
+
shape?: 'default' | 'round';
|
|
32
|
+
motionName?: string;
|
|
33
|
+
classNames?: SemanticClassNames<SegmentedSemanticPart> | ((info: {
|
|
34
|
+
props: SegmentedProps<ValueType>;
|
|
35
|
+
}) => SemanticClassNames<SegmentedSemanticPart>);
|
|
36
|
+
styles?: SemanticStyles<SegmentedSemanticPart> | ((info: {
|
|
37
|
+
props: SegmentedProps<ValueType>;
|
|
38
|
+
}) => SemanticStyles<SegmentedSemanticPart>);
|
|
39
|
+
}
|
|
40
|
+
export declare const Segmented: <ValueType = SegmentedValue>(props: SegmentedProps<ValueType> & RefAttributes<HTMLDivElement>) => React.ReactElement;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
4
|
+
import { cx } from "../../utils/semantic.js";
|
|
5
|
+
import { Tooltip } from "../tooltip/tooltip.js";
|
|
6
|
+
import "./segmented.css";
|
|
7
|
+
function SegmentedInner(props, ref) {
|
|
8
|
+
const config = useTaoConfig();
|
|
9
|
+
const id = useId();
|
|
10
|
+
const { prefixCls, rootClassName, options, value, defaultValue, onChange, disabled = config.disabled, name = id, block, size = config.size, vertical, orientation, direction, shape = 'default', motionName = 'tao-segmented-thumb-motion', classNames, styles, className, style, onKeyDown, ...rest } = props;
|
|
11
|
+
const resolved = options.map((option)=>'object' == typeof option && null !== option ? option : {
|
|
12
|
+
value: option,
|
|
13
|
+
label: String(option)
|
|
14
|
+
});
|
|
15
|
+
const [internal, setInternal] = useState(defaultValue ?? resolved[0]?.value);
|
|
16
|
+
const selected = void 0 !== value ? value : internal;
|
|
17
|
+
const axis = orientation ?? (vertical ? 'vertical' : 'horizontal');
|
|
18
|
+
const merged = {
|
|
19
|
+
...props,
|
|
20
|
+
value: selected,
|
|
21
|
+
disabled,
|
|
22
|
+
size,
|
|
23
|
+
shape,
|
|
24
|
+
orientation: axis
|
|
25
|
+
};
|
|
26
|
+
const classes = 'function' == typeof classNames ? classNames({
|
|
27
|
+
props: merged
|
|
28
|
+
}) : classNames;
|
|
29
|
+
const slots = 'function' == typeof styles ? styles({
|
|
30
|
+
props: merged
|
|
31
|
+
}) : styles;
|
|
32
|
+
const root = useRef(null);
|
|
33
|
+
useImperativeHandle(ref, ()=>root.current);
|
|
34
|
+
const [thumb, setThumb] = useState(null);
|
|
35
|
+
useLayoutEffect(()=>{
|
|
36
|
+
const container = root.current;
|
|
37
|
+
const item = container.querySelector('[data-tao-segmented-item][data-tao-checked]');
|
|
38
|
+
if (!item) return void setThumb(null);
|
|
39
|
+
const measure = ()=>{
|
|
40
|
+
const bounds = container.getBoundingClientRect();
|
|
41
|
+
const target = item.getBoundingClientRect();
|
|
42
|
+
const next = {
|
|
43
|
+
x: target.left - bounds.left,
|
|
44
|
+
y: target.top - bounds.top,
|
|
45
|
+
width: target.width,
|
|
46
|
+
height: target.height
|
|
47
|
+
};
|
|
48
|
+
setThumb((previous)=>previous && previous.x === next.x && previous.y === next.y && previous.width === next.width && previous.height === next.height ? previous : {
|
|
49
|
+
...next,
|
|
50
|
+
moving: null !== previous
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
measure();
|
|
54
|
+
const observer = new ResizeObserver(measure);
|
|
55
|
+
observer.observe(container);
|
|
56
|
+
observer.observe(item);
|
|
57
|
+
return ()=>observer.disconnect();
|
|
58
|
+
});
|
|
59
|
+
function select(next_0) {
|
|
60
|
+
if (next_0 === selected) return;
|
|
61
|
+
if (void 0 === value) setInternal(next_0);
|
|
62
|
+
onChange?.(next_0);
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
65
|
+
...rest,
|
|
66
|
+
ref: root,
|
|
67
|
+
role: "radiogroup",
|
|
68
|
+
"aria-orientation": axis,
|
|
69
|
+
dir: direction ?? props.dir,
|
|
70
|
+
"data-tao-segmented": "",
|
|
71
|
+
"data-tao-has-thumb": null !== thumb || void 0,
|
|
72
|
+
"data-tao-disabled": disabled || void 0,
|
|
73
|
+
"data-tao-block": block || void 0,
|
|
74
|
+
"data-tao-size": 'middle' === size ? 'medium' : size,
|
|
75
|
+
"data-tao-orientation": axis,
|
|
76
|
+
"data-tao-shape": shape,
|
|
77
|
+
className: cx(prefixCls, classes?.root, className, rootClassName),
|
|
78
|
+
style: {
|
|
79
|
+
...slots?.root,
|
|
80
|
+
...style
|
|
81
|
+
},
|
|
82
|
+
onKeyDown: (event)=>{
|
|
83
|
+
onKeyDown?.(event);
|
|
84
|
+
if (event.defaultPrevented || disabled) return;
|
|
85
|
+
const target_0 = event.target;
|
|
86
|
+
if ('radio' !== target_0.type) return;
|
|
87
|
+
const radios = Array.from(event.currentTarget.querySelectorAll('input[type="radio"]:not(:disabled)'));
|
|
88
|
+
const index = radios.indexOf(target_0);
|
|
89
|
+
const rtl = 'rtl' === getComputedStyle(event.currentTarget).direction;
|
|
90
|
+
const previous_0 = 'vertical' === axis ? 'ArrowUp' : rtl ? 'ArrowRight' : 'ArrowLeft';
|
|
91
|
+
const next_1 = 'vertical' === axis ? 'ArrowDown' : rtl ? 'ArrowLeft' : 'ArrowRight';
|
|
92
|
+
let nextIndex;
|
|
93
|
+
if (event.key === previous_0) nextIndex = (index - 1 + radios.length) % radios.length;
|
|
94
|
+
else if (event.key === next_1) nextIndex = (index + 1) % radios.length;
|
|
95
|
+
else if ('Home' === event.key) nextIndex = 0;
|
|
96
|
+
else {
|
|
97
|
+
if ('End' !== event.key) return;
|
|
98
|
+
nextIndex = radios.length - 1;
|
|
99
|
+
}
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
const radio = radios[nextIndex];
|
|
102
|
+
if (radio) {
|
|
103
|
+
radio.focus();
|
|
104
|
+
radio.click();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
children: [
|
|
108
|
+
thumb && /*#__PURE__*/ jsx("span", {
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
"data-tao-segmented-thumb": "",
|
|
111
|
+
className: cx(motionName, thumb.moving && `${motionName}-appear`, thumb.moving && `${motionName}-appear-active`),
|
|
112
|
+
style: {
|
|
113
|
+
width: thumb.width,
|
|
114
|
+
height: thumb.height,
|
|
115
|
+
transform: `translate(${thumb.x}px, ${thumb.y}px)`
|
|
116
|
+
},
|
|
117
|
+
onTransitionEnd: ()=>setThumb((previous_1)=>previous_1 ? {
|
|
118
|
+
...previous_1,
|
|
119
|
+
moving: false
|
|
120
|
+
} : previous_1)
|
|
121
|
+
}),
|
|
122
|
+
resolved.map((option_0)=>{
|
|
123
|
+
const isDisabled = disabled || option_0.disabled;
|
|
124
|
+
const key = `${typeof option_0.value}:${String(option_0.value)}`;
|
|
125
|
+
const item_0 = /*#__PURE__*/ jsxs("label", {
|
|
126
|
+
"data-tao-segmented-item": "",
|
|
127
|
+
"data-tao-checked": option_0.value === selected || void 0,
|
|
128
|
+
"data-tao-disabled": isDisabled || void 0,
|
|
129
|
+
className: cx(classes?.item, option_0.className),
|
|
130
|
+
style: slots?.item,
|
|
131
|
+
title: option_0.title ?? ('string' == typeof option_0.label || 'number' == typeof option_0.label ? String(option_0.label) : void 0),
|
|
132
|
+
children: [
|
|
133
|
+
/*#__PURE__*/ jsx("input", {
|
|
134
|
+
type: "radio",
|
|
135
|
+
name: name,
|
|
136
|
+
value: String(option_0.value),
|
|
137
|
+
checked: option_0.value === selected,
|
|
138
|
+
disabled: isDisabled,
|
|
139
|
+
onChange: ()=>select(option_0.value),
|
|
140
|
+
"aria-label": void 0 === option_0.label ? String(option_0.value) : void 0
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ jsxs("span", {
|
|
143
|
+
"data-tao-segmented-label": "",
|
|
144
|
+
className: classes?.label,
|
|
145
|
+
style: slots?.label,
|
|
146
|
+
children: [
|
|
147
|
+
void 0 !== option_0.icon && /*#__PURE__*/ jsx("span", {
|
|
148
|
+
"data-tao-segmented-icon": "",
|
|
149
|
+
className: classes?.icon,
|
|
150
|
+
style: slots?.icon,
|
|
151
|
+
children: option_0.icon
|
|
152
|
+
}),
|
|
153
|
+
option_0.label
|
|
154
|
+
]
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}, key);
|
|
158
|
+
return option_0.tooltip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
159
|
+
...'string' == typeof option_0.tooltip ? {
|
|
160
|
+
title: option_0.tooltip
|
|
161
|
+
} : option_0.tooltip,
|
|
162
|
+
children: item_0
|
|
163
|
+
}, key) : item_0;
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const Segmented = /*#__PURE__*/ forwardRef(SegmentedInner);
|
|
169
|
+
export { Segmented };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { SelectOption } from './select-types.js';
|
|
2
|
+
import type { SelectOption, SelectProps } from './select-types.js';
|
|
3
3
|
import './mobile-select.css';
|
|
4
|
-
interface MobileSelectContentProps {
|
|
4
|
+
interface MobileSelectContentProps extends Pick<SelectProps, 'classNames' | 'styles' | 'popupRender'> {
|
|
5
5
|
options: SelectOption[];
|
|
6
6
|
value?: string | string[];
|
|
7
7
|
onChange?: (value: string) => void;
|
|
@@ -9,6 +9,8 @@ interface MobileSelectContentProps {
|
|
|
9
9
|
onMultiChange?: (values: string[]) => void;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
showSearch?: boolean;
|
|
12
|
+
searchValue: string;
|
|
13
|
+
onSearch: (value: string) => void;
|
|
12
14
|
disabled?: boolean;
|
|
13
15
|
filterOption?: (input: string, option: SelectOption) => boolean;
|
|
14
16
|
notFoundContent?: ReactNode;
|
|
@@ -18,10 +20,14 @@ interface MobileSelectContentProps {
|
|
|
18
20
|
onClose: () => void;
|
|
19
21
|
/** Enable multi-select checkboxes + Done button flow. */
|
|
20
22
|
multiple?: boolean;
|
|
23
|
+
maxCount?: number;
|
|
24
|
+
mode?: 'multiple' | 'tags';
|
|
25
|
+
tokenSeparators?: string[];
|
|
26
|
+
onSearchClear: () => void;
|
|
21
27
|
}
|
|
22
|
-
declare function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, filterOption, notFoundContent, optionRender, onClose, multiple, disabled, }: MobileSelectContentProps): import("react").JSX.Element;
|
|
28
|
+
declare function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, searchValue: search, onSearch, filterOption, notFoundContent, optionRender, onClose, multiple, maxCount, mode, tokenSeparators, onSearchClear, disabled, classNames, styles, }: MobileSelectContentProps): import("react").JSX.Element;
|
|
23
29
|
export { MobileSelectContentInner as MobileSelectContent };
|
|
24
30
|
export interface MobileSelectDrawerProps extends MobileSelectContentProps {
|
|
25
31
|
open: boolean;
|
|
26
32
|
}
|
|
27
|
-
export declare function MobileSelectDrawer({ open, onClose, placeholder, ...rest }: MobileSelectDrawerProps): import("react").JSX.Element;
|
|
33
|
+
export declare function MobileSelectDrawer({ open, onClose, placeholder, classNames, styles, popupRender, ...rest }: MobileSelectDrawerProps): import("react").JSX.Element;
|