@rockshin/tao-ui 0.0.41 → 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 +69 -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,215 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { Fragment as external_react_Fragment, isValidElement, useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { cx as semantic_js_cx } from "../../utils/semantic.js";
|
|
6
|
+
import "./border-beam.css";
|
|
7
|
+
function gradient(color) {
|
|
8
|
+
if (!color) return;
|
|
9
|
+
const stops = 'string' == typeof color ? [
|
|
10
|
+
{
|
|
11
|
+
color,
|
|
12
|
+
percent: 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
color,
|
|
16
|
+
percent: 100
|
|
17
|
+
}
|
|
18
|
+
] : [
|
|
19
|
+
...color
|
|
20
|
+
];
|
|
21
|
+
const last = stops.at(-1);
|
|
22
|
+
if (last && 100 !== last.percent) stops.push({
|
|
23
|
+
...last,
|
|
24
|
+
percent: 100
|
|
25
|
+
});
|
|
26
|
+
return `linear-gradient(to left, ${stops.map((stop)=>`${stop.color} ${0.7 * Math.min(100, Math.max(0, stop.percent))}%`).join(', ')}, transparent)`;
|
|
27
|
+
}
|
|
28
|
+
function borderPath(width, height, style) {
|
|
29
|
+
const radii = [
|
|
30
|
+
style.borderTopLeftRadius,
|
|
31
|
+
style.borderTopRightRadius,
|
|
32
|
+
style.borderBottomRightRadius,
|
|
33
|
+
style.borderBottomLeftRadius
|
|
34
|
+
].map((value)=>{
|
|
35
|
+
const [x = '0', y = x] = value.split(' ');
|
|
36
|
+
const length = (part, total)=>Number.parseFloat(part) * (part.endsWith('%') ? total / 100 : 1) || 0;
|
|
37
|
+
return [
|
|
38
|
+
length(x, width),
|
|
39
|
+
length(y, height)
|
|
40
|
+
];
|
|
41
|
+
});
|
|
42
|
+
const [tl, tr, br, bl] = radii;
|
|
43
|
+
const scale = Math.min(1, width / (tl[0] + tr[0] || 1), width / (bl[0] + br[0] || 1), height / (tl[1] + bl[1] || 1), height / (tr[1] + br[1] || 1));
|
|
44
|
+
radii.forEach((radius)=>{
|
|
45
|
+
radius[0] *= scale;
|
|
46
|
+
radius[1] *= scale;
|
|
47
|
+
});
|
|
48
|
+
const points = [
|
|
49
|
+
{
|
|
50
|
+
x: tl[0],
|
|
51
|
+
y: 0,
|
|
52
|
+
distance: 0
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
const add = (x, y)=>{
|
|
56
|
+
const previous = points[points.length - 1];
|
|
57
|
+
const distance = Math.hypot(x - previous.x, y - previous.y);
|
|
58
|
+
if (distance) points.push({
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
distance: previous.distance + distance
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
[
|
|
65
|
+
tr,
|
|
66
|
+
br,
|
|
67
|
+
bl,
|
|
68
|
+
tl
|
|
69
|
+
].forEach(([rx, ry], corner)=>{
|
|
70
|
+
const cx = corner < 2 ? width - rx : rx;
|
|
71
|
+
const cy = 0 === corner || 3 === corner ? ry : height - ry;
|
|
72
|
+
for(let step = 0; step <= 16; step++){
|
|
73
|
+
const angle = -Math.PI / 2 + corner * Math.PI / 2 + step / 16 * Math.PI / 2;
|
|
74
|
+
add(cx + rx * Math.cos(angle), cy + ry * Math.sin(angle));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return points;
|
|
78
|
+
}
|
|
79
|
+
function perimeterPoint(distance, points) {
|
|
80
|
+
const index = Math.max(1, points.findIndex((point)=>point.distance >= distance));
|
|
81
|
+
const from = points[index - 1];
|
|
82
|
+
const to = points[index] ?? from;
|
|
83
|
+
const portion = (distance - from.distance) / (to.distance - from.distance || 1);
|
|
84
|
+
return [
|
|
85
|
+
from.x + (to.x - from.x) * portion,
|
|
86
|
+
from.y + (to.y - from.y) * portion,
|
|
87
|
+
180 * Math.atan2(to.y - from.y, to.x - from.x) / Math.PI
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
function BeamEffect({ host, item, duration, phase, prefixCls, className, style, classNames, styles }) {
|
|
91
|
+
const root = useRef(null);
|
|
92
|
+
const beam = useRef(null);
|
|
93
|
+
const border = getComputedStyle(host);
|
|
94
|
+
const inset = void 0 === item.outset ? [
|
|
95
|
+
border.borderTopWidth,
|
|
96
|
+
border.borderRightWidth,
|
|
97
|
+
border.borderBottomWidth,
|
|
98
|
+
border.borderLeftWidth
|
|
99
|
+
].map((value)=>`calc(-1 * ${value || '0px'})`).join(' ') : 'number' == typeof item.outset ? -item.outset : `calc(-1 * ${item.outset})`;
|
|
100
|
+
useEffect(()=>{
|
|
101
|
+
const overlay = root.current;
|
|
102
|
+
const light = beam.current;
|
|
103
|
+
const motion = matchMedia('(prefers-reduced-motion: reduce)');
|
|
104
|
+
let width = 0;
|
|
105
|
+
let height = 0;
|
|
106
|
+
let path = [];
|
|
107
|
+
let beamWidth = 0;
|
|
108
|
+
let beamHeight = 0;
|
|
109
|
+
let frame = 0;
|
|
110
|
+
let start;
|
|
111
|
+
const measure = ()=>{
|
|
112
|
+
width = overlay.clientWidth;
|
|
113
|
+
height = overlay.clientHeight;
|
|
114
|
+
path = borderPath(width, height, getComputedStyle(overlay));
|
|
115
|
+
beamWidth = light.offsetWidth;
|
|
116
|
+
beamHeight = light.offsetHeight;
|
|
117
|
+
};
|
|
118
|
+
const tick = (now)=>{
|
|
119
|
+
start ??= now;
|
|
120
|
+
const perimeter = path[path.length - 1].distance;
|
|
121
|
+
const distance = ((now - start) / (1000 * duration) + phase) % 1 * perimeter;
|
|
122
|
+
const [x, y, angle] = perimeterPoint(distance, path);
|
|
123
|
+
light.style.transform = `translate(${x - 0.9 * beamWidth}px, ${y - beamHeight / 2}px) rotate(${angle}deg)`;
|
|
124
|
+
frame = requestAnimationFrame(tick);
|
|
125
|
+
};
|
|
126
|
+
const updateMotion = ()=>{
|
|
127
|
+
cancelAnimationFrame(frame);
|
|
128
|
+
if (!motion.matches) frame = requestAnimationFrame(tick);
|
|
129
|
+
};
|
|
130
|
+
const observer = new ResizeObserver(measure);
|
|
131
|
+
observer.observe(overlay);
|
|
132
|
+
observer.observe(light);
|
|
133
|
+
measure();
|
|
134
|
+
updateMotion();
|
|
135
|
+
motion.addEventListener('change', updateMotion);
|
|
136
|
+
return ()=>{
|
|
137
|
+
observer.disconnect();
|
|
138
|
+
cancelAnimationFrame(frame);
|
|
139
|
+
motion.removeEventListener('change', updateMotion);
|
|
140
|
+
};
|
|
141
|
+
}, [
|
|
142
|
+
duration,
|
|
143
|
+
phase
|
|
144
|
+
]);
|
|
145
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
|
|
146
|
+
ref: root,
|
|
147
|
+
"aria-hidden": "true",
|
|
148
|
+
"data-tao-border-beam": "",
|
|
149
|
+
className: semantic_js_cx(prefixCls, classNames?.root, className),
|
|
150
|
+
style: {
|
|
151
|
+
inset,
|
|
152
|
+
padding: item.lineWidth ?? 1,
|
|
153
|
+
...styles?.root,
|
|
154
|
+
...style
|
|
155
|
+
},
|
|
156
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
157
|
+
ref: beam,
|
|
158
|
+
"data-tao-border-beam-light": "",
|
|
159
|
+
className: classNames?.beam,
|
|
160
|
+
style: {
|
|
161
|
+
width: item.size ?? 100,
|
|
162
|
+
backgroundImage: gradient(item.color),
|
|
163
|
+
...styles?.beam
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}), host);
|
|
167
|
+
}
|
|
168
|
+
function BorderBeam({ prefixCls, className, style, children, color, count, duration, items, lineWidth, outset, size, classNames, styles }) {
|
|
169
|
+
const [host, setHost] = useState(null);
|
|
170
|
+
const assignHost = useCallback((node)=>setHost(node instanceof HTMLElement ? node : node?.nativeElement ?? null), []);
|
|
171
|
+
useEffect(()=>{
|
|
172
|
+
if (!host || 'static' !== getComputedStyle(host).position) return;
|
|
173
|
+
const original = host.style.position;
|
|
174
|
+
host.style.position = 'relative';
|
|
175
|
+
return ()=>{
|
|
176
|
+
if ('relative' === host.style.position) host.style.position = original;
|
|
177
|
+
};
|
|
178
|
+
}, [
|
|
179
|
+
host
|
|
180
|
+
]);
|
|
181
|
+
const total = items?.length ?? (void 0 !== count && Number.isFinite(count) && count >= 1 ? Math.floor(count) : 1);
|
|
182
|
+
const seconds = void 0 !== duration && duration > 0 ? duration : 6;
|
|
183
|
+
const child = /*#__PURE__*/ isValidElement(children) && children.type !== external_react_Fragment ? /*#__PURE__*/ jsx(Slot, {
|
|
184
|
+
ref: assignHost,
|
|
185
|
+
children: children
|
|
186
|
+
}) : children;
|
|
187
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
188
|
+
children: [
|
|
189
|
+
child,
|
|
190
|
+
host && Array.from({
|
|
191
|
+
length: total
|
|
192
|
+
}, (_, index)=>({
|
|
193
|
+
phase: index / total,
|
|
194
|
+
item: items?.[index]
|
|
195
|
+
})).map(({ phase, item })=>/*#__PURE__*/ jsx(BeamEffect, {
|
|
196
|
+
host: host,
|
|
197
|
+
item: {
|
|
198
|
+
color,
|
|
199
|
+
lineWidth,
|
|
200
|
+
outset,
|
|
201
|
+
size,
|
|
202
|
+
...item
|
|
203
|
+
},
|
|
204
|
+
phase: phase,
|
|
205
|
+
duration: seconds,
|
|
206
|
+
prefixCls: prefixCls,
|
|
207
|
+
className: className,
|
|
208
|
+
style: style,
|
|
209
|
+
classNames: classNames,
|
|
210
|
+
styles: styles
|
|
211
|
+
}, `${total}-${phase}`))
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
export { BorderBeam };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
[data-tao-calendar] {
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-width: 0;
|
|
5
|
+
color: var(--tao-color-text);
|
|
6
|
+
background: var(--tao-color-bg-container);
|
|
7
|
+
border-radius: var(--tao-radius);
|
|
8
|
+
font: var(--tao-font-size) / var(--tao-line-height) var(--tao-font-family);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[data-tao-calendar-header] {
|
|
12
|
+
justify-content: flex-end;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--tao-margin-xs);
|
|
15
|
+
padding: var(--tao-padding-sm);
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-tao-calendar-header] select, [data-tao-calendar-modes] label {
|
|
21
|
+
height: var(--tao-control-height);
|
|
22
|
+
padding-inline: var(--tao-padding-sm);
|
|
23
|
+
border: 1px solid var(--tao-color-border);
|
|
24
|
+
border-radius: var(--tao-radius-sm);
|
|
25
|
+
background: var(--tao-color-bg-container);
|
|
26
|
+
color: inherit;
|
|
27
|
+
font: inherit;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-tao-calendar-modes] {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[data-tao-calendar-modes] label {
|
|
36
|
+
border-radius: 0;
|
|
37
|
+
align-items: center;
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
position: relative;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-tao-calendar-modes] label:first-child {
|
|
43
|
+
border-start-start-radius: var(--tao-radius-sm);
|
|
44
|
+
border-end-start-radius: var(--tao-radius-sm);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-tao-calendar-modes] label:last-child {
|
|
48
|
+
border-start-end-radius: var(--tao-radius-sm);
|
|
49
|
+
border-end-end-radius: var(--tao-radius-sm);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[data-tao-calendar-modes] label[data-selected] {
|
|
53
|
+
color: var(--tao-color-primary);
|
|
54
|
+
border-color: var(--tao-color-primary);
|
|
55
|
+
background: var(--tao-primary-bg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[data-tao-calendar] :is(select, button):focus-visible {
|
|
59
|
+
outline: 2px solid var(--tao-color-primary);
|
|
60
|
+
outline-offset: 2px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-tao-calendar-modes] input {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
width: 1px;
|
|
66
|
+
height: 1px;
|
|
67
|
+
position: absolute;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-tao-calendar-modes] label:has(input:focus-visible) {
|
|
71
|
+
outline: 2px solid var(--tao-color-primary);
|
|
72
|
+
outline-offset: 2px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[data-tao-calendar] table {
|
|
76
|
+
table-layout: fixed;
|
|
77
|
+
border-collapse: collapse;
|
|
78
|
+
width: 100%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[data-tao-calendar] th {
|
|
82
|
+
padding: var(--tao-padding-xs);
|
|
83
|
+
color: var(--tao-color-text-secondary);
|
|
84
|
+
text-align: end;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[data-tao-calendar] td {
|
|
89
|
+
color: var(--tao-color-text-disabled);
|
|
90
|
+
vertical-align: top;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
padding: 3px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
[data-tao-calendar] td[class*="-cell-in-view"] {
|
|
96
|
+
color: var(--tao-color-text);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[data-tao-calendar-cell] {
|
|
100
|
+
min-width: 0;
|
|
101
|
+
min-height: 100px;
|
|
102
|
+
padding: var(--tao-padding-xs);
|
|
103
|
+
border-top: 2px solid var(--tao-color-border-secondary);
|
|
104
|
+
transition: background-color var(--tao-motion-duration-fast);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[data-tao-calendar-value] {
|
|
108
|
+
text-align: end;
|
|
109
|
+
display: block;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[data-tao-calendar-events] {
|
|
113
|
+
overflow-wrap: anywhere;
|
|
114
|
+
min-width: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-tao-calendar] td:not([class*="-cell-disabled"]):hover [data-tao-calendar-cell] {
|
|
118
|
+
background: var(--tao-color-bg-text-hover);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[data-tao-calendar] td[class*="-cell-selected"] [data-tao-calendar-cell] {
|
|
122
|
+
background: var(--tao-primary-bg);
|
|
123
|
+
color: var(--tao-color-primary);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-tao-calendar-cell][data-today] {
|
|
127
|
+
border-top-color: var(--tao-color-primary);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
[data-tao-calendar] td[class*="-cell-disabled"] {
|
|
131
|
+
color: var(--tao-color-text-disabled);
|
|
132
|
+
cursor: not-allowed;
|
|
133
|
+
background: var(--tao-color-fill-tertiary);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
[data-tao-calendar][data-fullscreen="false"] {
|
|
137
|
+
border: 1px solid var(--tao-color-border-secondary);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[data-tao-calendar][data-fullscreen="false"] th {
|
|
141
|
+
text-align: center;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
[data-tao-calendar][data-fullscreen="false"] [data-tao-calendar-cell] {
|
|
145
|
+
border-radius: var(--tao-radius-sm);
|
|
146
|
+
border-top: 0;
|
|
147
|
+
min-height: 32px;
|
|
148
|
+
padding: 5px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
[data-tao-calendar][data-fullscreen="false"] [data-tao-calendar-value] {
|
|
152
|
+
text-align: center;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-tao-calendar][data-fullscreen="false"] [data-today] {
|
|
156
|
+
box-shadow: inset 0 0 0 1px var(--tao-color-primary);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (width <= 575px) {
|
|
160
|
+
[data-tao-calendar-cell] {
|
|
161
|
+
min-height: 64px;
|
|
162
|
+
padding: 4px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
[data-tao-calendar-header] {
|
|
166
|
+
justify-content: center;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media (prefers-reduced-motion: reduce) {
|
|
171
|
+
[data-tao-calendar-cell] {
|
|
172
|
+
transition: none;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CellRenderInfo, Locale } from '@rc-component/picker/interface';
|
|
2
|
+
import { type Dayjs } from 'dayjs';
|
|
3
|
+
import 'dayjs/locale/zh-cn';
|
|
4
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
5
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
6
|
+
import './calendar.css';
|
|
7
|
+
export type CalendarMode = 'year' | 'month';
|
|
8
|
+
export type CalendarSemanticPart = 'root' | 'header' | 'body' | 'content' | 'item' | 'itemContent';
|
|
9
|
+
export interface CalendarSelectInfo {
|
|
10
|
+
source: 'year' | 'month' | 'date' | 'customize';
|
|
11
|
+
}
|
|
12
|
+
export type HeaderRender<DateType> = (config: {
|
|
13
|
+
value: DateType;
|
|
14
|
+
type: CalendarMode;
|
|
15
|
+
onChange: (date: DateType) => void;
|
|
16
|
+
onTypeChange: (type: CalendarMode) => void;
|
|
17
|
+
}) => ReactNode;
|
|
18
|
+
type SemanticValue<Value, Props> = Value | ((info: {
|
|
19
|
+
props: Props;
|
|
20
|
+
}) => Value);
|
|
21
|
+
export interface CalendarProps<DateType = Dayjs> {
|
|
22
|
+
prefixCls?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
rootClassName?: string;
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
classNames?: SemanticValue<SemanticClassNames<CalendarSemanticPart>, CalendarProps<DateType>>;
|
|
27
|
+
styles?: SemanticValue<SemanticStyles<CalendarSemanticPart>, CalendarProps<DateType>>;
|
|
28
|
+
locale?: {
|
|
29
|
+
lang: Partial<Locale>;
|
|
30
|
+
timePickerLocale?: {
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
validRange?: [DateType, DateType];
|
|
35
|
+
disabledDate?: (date: DateType) => boolean;
|
|
36
|
+
dateFullCellRender?: (date: DateType) => ReactNode;
|
|
37
|
+
dateCellRender?: (date: DateType) => ReactNode;
|
|
38
|
+
monthFullCellRender?: (date: DateType) => ReactNode;
|
|
39
|
+
monthCellRender?: (date: DateType) => ReactNode;
|
|
40
|
+
cellRender?: (date: DateType, info: CellRenderInfo<DateType>) => ReactNode;
|
|
41
|
+
fullCellRender?: (date: DateType, info: CellRenderInfo<DateType>) => ReactNode;
|
|
42
|
+
headerRender?: HeaderRender<DateType>;
|
|
43
|
+
value?: DateType;
|
|
44
|
+
defaultValue?: DateType;
|
|
45
|
+
mode?: CalendarMode;
|
|
46
|
+
fullscreen?: boolean;
|
|
47
|
+
showWeek?: boolean;
|
|
48
|
+
onChange?: (date: DateType) => void;
|
|
49
|
+
onPanelChange?: (date: DateType, mode: CalendarMode) => void;
|
|
50
|
+
onSelect?: (date: DateType, info: CalendarSelectInfo) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface CalendarRef {
|
|
53
|
+
nativeElement: HTMLDivElement;
|
|
54
|
+
}
|
|
55
|
+
export declare const Calendar: import("react").ForwardRefExoticComponent<CalendarProps<Dayjs> & import("react").RefAttributes<CalendarRef>>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PickerPanel } from "@rc-component/picker";
|
|
3
|
+
import dayjs from "@rc-component/picker/generate/dayjs";
|
|
4
|
+
import en_US from "@rc-component/picker/locale/en_US";
|
|
5
|
+
import zh_CN from "@rc-component/picker/locale/zh_CN";
|
|
6
|
+
import dayjs_0 from "dayjs";
|
|
7
|
+
import "dayjs/locale/zh-cn";
|
|
8
|
+
import { forwardRef, useId, useImperativeHandle, useRef, useState } from "react";
|
|
9
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
10
|
+
import { cx } from "../../utils/semantic.js";
|
|
11
|
+
import "./calendar.css";
|
|
12
|
+
const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
13
|
+
const config = useTaoConfig();
|
|
14
|
+
const modeName = useId();
|
|
15
|
+
const root = useRef(null);
|
|
16
|
+
useImperativeHandle(ref, ()=>({
|
|
17
|
+
get nativeElement () {
|
|
18
|
+
return root.current;
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
const [innerValue, setValue] = useState(()=>props.defaultValue ?? dayjs_0());
|
|
22
|
+
const [innerMode, setMode] = useState('month');
|
|
23
|
+
const value = props.value ?? innerValue;
|
|
24
|
+
const mode = props.mode ?? innerMode;
|
|
25
|
+
const { fullscreen = true, validRange } = props;
|
|
26
|
+
const names = 'function' == typeof props.classNames ? props.classNames({
|
|
27
|
+
props
|
|
28
|
+
}) : props.classNames;
|
|
29
|
+
const styles = 'function' == typeof props.styles ? props.styles({
|
|
30
|
+
props
|
|
31
|
+
}) : props.styles;
|
|
32
|
+
const chinese = 'zh_CN' === config.locale.locale;
|
|
33
|
+
const locale = {
|
|
34
|
+
...chinese ? zh_CN : en_US,
|
|
35
|
+
...props.locale?.lang
|
|
36
|
+
};
|
|
37
|
+
const months = locale.shortMonths ?? dayjs.locale.getShortMonths?.(locale.locale) ?? [];
|
|
38
|
+
const disabled = (date)=>!!(validRange && (date.isBefore(validRange[0], 'day') || date.isAfter(validRange[1], 'day'))) || !!props.disabledDate?.(date);
|
|
39
|
+
const select = (date_0, source)=>{
|
|
40
|
+
if (void 0 === props.value) setValue(date_0);
|
|
41
|
+
if (!date_0.isSame(value, 'day')) {
|
|
42
|
+
if (!date_0.isSame(value, 'month' === mode ? 'month' : 'year')) props.onPanelChange?.(date_0, mode);
|
|
43
|
+
props.onChange?.(date_0);
|
|
44
|
+
}
|
|
45
|
+
props.onSelect?.(date_0, {
|
|
46
|
+
source
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const changeMode = (next)=>{
|
|
50
|
+
if (void 0 === props.mode) setMode(next);
|
|
51
|
+
props.onPanelChange?.(value, next);
|
|
52
|
+
};
|
|
53
|
+
const clamp = (date_1)=>validRange ? date_1.isBefore(validRange[0], 'day') ? validRange[0] : date_1.isAfter(validRange[1], 'day') ? validRange[1] : date_1 : date_1;
|
|
54
|
+
const firstYear = validRange?.[0].year() ?? value.year() - 10;
|
|
55
|
+
const lastYear = validRange?.[1].year() ?? value.year() + 10;
|
|
56
|
+
const minMonth = validRange && value.year() === validRange[0].year() ? validRange[0].month() : 0;
|
|
57
|
+
const maxMonth = validRange && value.year() === validRange[1].year() ? validRange[1].month() : 11;
|
|
58
|
+
const renderCell = (date_2, info)=>{
|
|
59
|
+
if (props.fullCellRender) return props.fullCellRender(date_2, info);
|
|
60
|
+
const legacyFull = 'month' === info.type ? props.monthFullCellRender : props.dateFullCellRender;
|
|
61
|
+
if (legacyFull) return legacyFull(date_2);
|
|
62
|
+
const extra = props.cellRender ? props.cellRender(date_2, info) : 'month' === info.type ? props.monthCellRender?.(date_2) : props.dateCellRender?.(date_2);
|
|
63
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
64
|
+
"data-tao-calendar-cell": "",
|
|
65
|
+
"data-today": date_2.isSame(dayjs_0(), 'month' === info.type ? 'month' : 'day') || void 0,
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsx("span", {
|
|
68
|
+
"data-tao-calendar-value": "",
|
|
69
|
+
children: 'month' === info.type ? months[date_2.month()] : String(date_2.date()).padStart(2, '0')
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ jsx("div", {
|
|
72
|
+
"data-tao-calendar-events": "",
|
|
73
|
+
className: names?.itemContent,
|
|
74
|
+
style: styles?.itemContent,
|
|
75
|
+
children: extra
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
81
|
+
ref: root,
|
|
82
|
+
"data-tao-calendar": "",
|
|
83
|
+
"data-fullscreen": fullscreen,
|
|
84
|
+
className: cx(names?.root, props.className, props.rootClassName),
|
|
85
|
+
style: {
|
|
86
|
+
...styles?.root,
|
|
87
|
+
...props.style
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
props.headerRender ? props.headerRender({
|
|
91
|
+
value,
|
|
92
|
+
type: mode,
|
|
93
|
+
onChange: (date_3)=>select(date_3, 'customize'),
|
|
94
|
+
onTypeChange: changeMode
|
|
95
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
96
|
+
"data-tao-calendar-header": "",
|
|
97
|
+
className: names?.header,
|
|
98
|
+
style: styles?.header,
|
|
99
|
+
children: [
|
|
100
|
+
/*#__PURE__*/ jsx("select", {
|
|
101
|
+
"aria-label": chinese ? '年' : 'Year',
|
|
102
|
+
value: value.year(),
|
|
103
|
+
onChange: (event)=>select(clamp(value.year(Number(event.target.value))), 'year'),
|
|
104
|
+
children: Array.from({
|
|
105
|
+
length: lastYear - firstYear + 1
|
|
106
|
+
}, (_, index)=>firstYear + index).map((year)=>/*#__PURE__*/ jsxs("option", {
|
|
107
|
+
value: year,
|
|
108
|
+
children: [
|
|
109
|
+
year,
|
|
110
|
+
chinese ? '年' : ''
|
|
111
|
+
]
|
|
112
|
+
}, year))
|
|
113
|
+
}),
|
|
114
|
+
'month' === mode && /*#__PURE__*/ jsx("select", {
|
|
115
|
+
"aria-label": chinese ? '月' : 'Month',
|
|
116
|
+
value: value.month(),
|
|
117
|
+
onChange: (event_0)=>select(value.month(Number(event_0.target.value)), 'month'),
|
|
118
|
+
children: months.map((month, index_0)=>index_0 >= minMonth && index_0 <= maxMonth ? /*#__PURE__*/ jsx("option", {
|
|
119
|
+
value: index_0,
|
|
120
|
+
children: month
|
|
121
|
+
}, month) : null)
|
|
122
|
+
}),
|
|
123
|
+
/*#__PURE__*/ jsx("div", {
|
|
124
|
+
"data-tao-calendar-modes": "",
|
|
125
|
+
role: "radiogroup",
|
|
126
|
+
"aria-label": chinese ? '日历视图' : 'Calendar view',
|
|
127
|
+
children: [
|
|
128
|
+
'month',
|
|
129
|
+
'year'
|
|
130
|
+
].map((type)=>/*#__PURE__*/ jsxs("label", {
|
|
131
|
+
"data-selected": mode === type || void 0,
|
|
132
|
+
children: [
|
|
133
|
+
/*#__PURE__*/ jsx("input", {
|
|
134
|
+
type: "radio",
|
|
135
|
+
name: modeName,
|
|
136
|
+
value: type,
|
|
137
|
+
checked: mode === type,
|
|
138
|
+
onChange: ()=>changeMode(type)
|
|
139
|
+
}),
|
|
140
|
+
/*#__PURE__*/ jsx("span", {
|
|
141
|
+
children: 'month' === type ? chinese ? '月' : 'Month' : chinese ? '年' : 'Year'
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
}, type))
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ jsx(PickerPanel, {
|
|
149
|
+
prefixCls: props.prefixCls ?? 'tao-calendar-panel',
|
|
150
|
+
generateConfig: dayjs,
|
|
151
|
+
locale: locale,
|
|
152
|
+
value: value,
|
|
153
|
+
mode: 'year' === mode ? 'month' : 'date',
|
|
154
|
+
picker: 'year' === mode ? 'month' : 'date',
|
|
155
|
+
hideHeader: true,
|
|
156
|
+
showWeek: props.showWeek,
|
|
157
|
+
disabledDate: disabled,
|
|
158
|
+
onSelect: (date_4)=>select(date_4, 'year' === mode ? 'month' : 'date'),
|
|
159
|
+
cellRender: (date_5, info_0)=>renderCell(date_5, info_0),
|
|
160
|
+
classNames: {
|
|
161
|
+
body: names?.body,
|
|
162
|
+
content: names?.content,
|
|
163
|
+
item: names?.item
|
|
164
|
+
},
|
|
165
|
+
styles: {
|
|
166
|
+
body: styles?.body,
|
|
167
|
+
content: styles?.content,
|
|
168
|
+
item: styles?.item
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
Calendar.displayName = 'Calendar';
|
|
175
|
+
export { Calendar };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type GetIndicatorSize, type MoreProps, type TabsProps as RcTabsProps, type Tab } from '@rc-component/tabs';
|
|
2
|
+
import type { CSSProperties, KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
3
|
+
type TabPart = 'root' | 'item' | 'remove' | 'indicator' | 'body' | 'content' | 'header';
|
|
4
|
+
type TabClassNames = Partial<Record<TabPart, string>> & {
|
|
5
|
+
popup?: {
|
|
6
|
+
root?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type TabStyles = Partial<Record<TabPart, CSSProperties>> & {
|
|
10
|
+
popup?: {
|
|
11
|
+
root?: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export interface CardTabsProps extends Omit<RcTabsProps, 'classNames' | 'styles' | 'items' | 'editable' | 'more'> {
|
|
15
|
+
type?: 'line' | 'card' | 'editable-card';
|
|
16
|
+
size?: 'small' | 'medium' | 'middle' | 'large';
|
|
17
|
+
hideAdd?: boolean;
|
|
18
|
+
centered?: boolean;
|
|
19
|
+
rootClassName?: string;
|
|
20
|
+
classNames?: TabClassNames | ((info: {
|
|
21
|
+
props: CardTabsProps;
|
|
22
|
+
}) => TabClassNames);
|
|
23
|
+
styles?: TabStyles | ((info: {
|
|
24
|
+
props: CardTabsProps;
|
|
25
|
+
}) => TabStyles);
|
|
26
|
+
tabPlacement?: 'top' | 'bottom' | 'start' | 'end';
|
|
27
|
+
onEdit?: (event: MouseEvent | KeyboardEvent | string, action: 'add' | 'remove') => void;
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
indicatorSize?: GetIndicatorSize;
|
|
30
|
+
items?: (Tab & {
|
|
31
|
+
destroyInactiveTabPane?: boolean;
|
|
32
|
+
})[];
|
|
33
|
+
destroyInactiveTabPane?: boolean;
|
|
34
|
+
addIcon?: ReactNode;
|
|
35
|
+
moreIcon?: ReactNode;
|
|
36
|
+
removeIcon?: ReactNode;
|
|
37
|
+
more?: MoreProps & {
|
|
38
|
+
visible?: boolean;
|
|
39
|
+
onVisibleChange?: (open: boolean) => void;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export declare function CardTabs(props: CardTabsProps): import("react").JSX.Element;
|
|
43
|
+
export {};
|