@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
|
@@ -14,15 +14,16 @@ import { getDefaultFormat } from "./types.js";
|
|
|
14
14
|
import * as __rspack_external__radix_ui_react_popover_c8444160 from "@radix-ui/react-popover";
|
|
15
15
|
dayjs.extend(customParseFormat);
|
|
16
16
|
const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
17
|
-
const { value, defaultValue, onChange, picker = 'date', showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder =
|
|
18
|
-
'Start date',
|
|
19
|
-
'End date'
|
|
20
|
-
], separator = '~', size, variant, disabled, allowClear = true, status, mobile, open: controlledOpen, onOpenChange, className, style, classNames, styles } = props;
|
|
17
|
+
const { value, defaultValue, onChange, picker = 'date', showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder: placeholderProp, separator = '~', size, variant, disabled, allowClear = true, status, mobile, open: controlledOpen, onOpenChange, className, style, classNames, styles } = props;
|
|
21
18
|
const popupId = useId();
|
|
22
19
|
const popupRef = useRef(null);
|
|
23
20
|
const [keyboardFocusRequested, setKeyboardFocusRequested] = useState(false);
|
|
24
21
|
const returnFocusRef = useRef(null);
|
|
25
22
|
const ctx = useTaoConfig();
|
|
23
|
+
const placeholder = placeholderProp ?? [
|
|
24
|
+
ctx.locale.startDate,
|
|
25
|
+
ctx.locale.endDate
|
|
26
|
+
];
|
|
26
27
|
const resolvedSize = size ?? ctx.size;
|
|
27
28
|
const resolvedVariant = variant ?? ctx.variant;
|
|
28
29
|
const startDisabled = (Array.isArray(disabled) ? disabled[0] : disabled) ?? ctx.disabled;
|
|
@@ -279,14 +280,14 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
279
280
|
type: "button",
|
|
280
281
|
"data-tao-calendar-nav-btn": "",
|
|
281
282
|
onClick: ()=>setViewDateStart(viewDateStart.subtract(1, 'year')),
|
|
282
|
-
"aria-label":
|
|
283
|
+
"aria-label": ctx.locale.previousYear,
|
|
283
284
|
children: /*#__PURE__*/ jsx(DoubleLeftIcon, {})
|
|
284
285
|
}),
|
|
285
286
|
/*#__PURE__*/ jsx("button", {
|
|
286
287
|
type: "button",
|
|
287
288
|
"data-tao-calendar-nav-btn": "",
|
|
288
289
|
onClick: ()=>setViewDateStart(viewDateStart.subtract(1, 'month')),
|
|
289
|
-
"aria-label":
|
|
290
|
+
"aria-label": ctx.locale.previousMonth,
|
|
290
291
|
children: /*#__PURE__*/ jsx(LeftIcon, {})
|
|
291
292
|
})
|
|
292
293
|
]
|
|
@@ -296,11 +297,11 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
296
297
|
children: [
|
|
297
298
|
/*#__PURE__*/ jsx("span", {
|
|
298
299
|
"data-tao-range-title": "",
|
|
299
|
-
children: viewDateStart.
|
|
300
|
+
children: ctx.locale.monthTitle(viewDateStart.month(), viewDateStart.year())
|
|
300
301
|
}),
|
|
301
302
|
/*#__PURE__*/ jsx("span", {
|
|
302
303
|
"data-tao-range-title": "",
|
|
303
|
-
children: viewDateEnd.
|
|
304
|
+
children: ctx.locale.monthTitle(viewDateEnd.month(), viewDateEnd.year())
|
|
304
305
|
})
|
|
305
306
|
]
|
|
306
307
|
}),
|
|
@@ -311,14 +312,14 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
311
312
|
type: "button",
|
|
312
313
|
"data-tao-calendar-nav-btn": "",
|
|
313
314
|
onClick: ()=>setViewDateStart(viewDateStart.add(1, 'month')),
|
|
314
|
-
"aria-label":
|
|
315
|
+
"aria-label": ctx.locale.nextMonth,
|
|
315
316
|
children: /*#__PURE__*/ jsx(RightIcon, {})
|
|
316
317
|
}),
|
|
317
318
|
/*#__PURE__*/ jsx("button", {
|
|
318
319
|
type: "button",
|
|
319
320
|
"data-tao-calendar-nav-btn": "",
|
|
320
321
|
onClick: ()=>setViewDateStart(viewDateStart.add(1, 'year')),
|
|
321
|
-
"aria-label":
|
|
322
|
+
"aria-label": ctx.locale.nextYear,
|
|
322
323
|
children: /*#__PURE__*/ jsx(DoubleRightIcon, {})
|
|
323
324
|
})
|
|
324
325
|
]
|
|
@@ -390,7 +391,7 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
390
391
|
event.stopPropagation();
|
|
391
392
|
handleClear(event);
|
|
392
393
|
},
|
|
393
|
-
"aria-label":
|
|
394
|
+
"aria-label": ctx.locale.clear,
|
|
394
395
|
role: "button",
|
|
395
396
|
tabIndex: 0,
|
|
396
397
|
onKeyDown: (event_0)=>{
|
|
@@ -619,7 +620,7 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
619
620
|
open: isOpen,
|
|
620
621
|
onClose: ()=>setOpen(false),
|
|
621
622
|
placement: "bottom",
|
|
622
|
-
title:
|
|
623
|
+
title: ctx.locale.dateRange,
|
|
623
624
|
height: "85vh",
|
|
624
625
|
children: panelContent
|
|
625
626
|
})
|
|
@@ -639,7 +640,7 @@ const range_picker_RangePicker = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
639
640
|
children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_c8444160.Content, {
|
|
640
641
|
id: popupId,
|
|
641
642
|
ref: popupRef,
|
|
642
|
-
"aria-label": props['aria-label'] ??
|
|
643
|
+
"aria-label": props['aria-label'] ?? ctx.locale.dateRange,
|
|
643
644
|
"data-tao-picker-dropdown": "",
|
|
644
645
|
sideOffset: 4,
|
|
645
646
|
align: "start",
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@layer tao {
|
|
2
|
+
[data-tao-descriptions] {
|
|
3
|
+
color: var(--tao-color-text);
|
|
4
|
+
font: var(--tao-font-size) / var(--tao-line-height) var(--tao-font-family);
|
|
5
|
+
min-width: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-tao-descriptions-header] {
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 16px;
|
|
12
|
+
margin-bottom: 20px;
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-tao-descriptions-title] {
|
|
17
|
+
font-size: var(--tao-font-size-lg);
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[data-tao-descriptions-extra] {
|
|
22
|
+
margin-inline-start: auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[data-tao-descriptions-view] {
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-tao-descriptions-view] table {
|
|
30
|
+
border-collapse: collapse;
|
|
31
|
+
table-layout: fixed;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[data-tao-descriptions-cell] {
|
|
36
|
+
text-align: start;
|
|
37
|
+
vertical-align: top;
|
|
38
|
+
overflow-wrap: anywhere;
|
|
39
|
+
padding: 0 16px 16px 0;
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-tao-descriptions-cell]:last-child {
|
|
44
|
+
padding-inline-end: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-tao-descriptions-item] {
|
|
48
|
+
align-items: baseline;
|
|
49
|
+
min-width: 0;
|
|
50
|
+
display: flex;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[data-tao-descriptions-label] {
|
|
54
|
+
color: var(--tao-color-text-secondary);
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-tao-descriptions-label][data-tao-colon]:after {
|
|
60
|
+
content: ":";
|
|
61
|
+
margin-inline: 2px 8px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[data-tao-descriptions-label]:not([data-tao-colon]) {
|
|
65
|
+
margin-inline-end: 8px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-tao-descriptions-content] {
|
|
69
|
+
flex: 1;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[data-tao-descriptions][data-tao-bordered] [data-tao-descriptions-view] {
|
|
74
|
+
border: 1px solid var(--tao-color-border);
|
|
75
|
+
border-radius: var(--tao-radius);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-tao-descriptions][data-tao-bordered] [data-tao-descriptions-cell] {
|
|
79
|
+
border-inline-end: 1px solid var(--tao-color-border);
|
|
80
|
+
border-bottom: 1px solid var(--tao-color-border);
|
|
81
|
+
padding: 16px 20px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[data-tao-descriptions][data-tao-bordered] [data-tao-descriptions-cell="label"] {
|
|
85
|
+
color: var(--tao-color-text-secondary);
|
|
86
|
+
background: var(--tao-color-fill-quaternary);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[data-tao-descriptions][data-tao-bordered] [data-tao-descriptions-cell]:last-child {
|
|
90
|
+
border-inline-end: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[data-tao-descriptions][data-tao-bordered] tr:last-child [data-tao-descriptions-cell] {
|
|
94
|
+
border-bottom: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[data-tao-descriptions][data-tao-layout="vertical"]:not([data-tao-bordered]) [data-tao-descriptions-cell="label"], [data-tao-descriptions][data-tao-size="small"] [data-tao-descriptions-cell] {
|
|
98
|
+
padding-bottom: 8px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[data-tao-descriptions][data-tao-bordered][data-tao-size="small"] [data-tao-descriptions-cell] {
|
|
102
|
+
padding: 8px 12px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
[data-tao-descriptions][data-tao-bordered][data-tao-size="medium"] [data-tao-descriptions-cell] {
|
|
106
|
+
padding: 12px 16px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes, type Key, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoBreakpointMap } from '../../utils/breakpoint.js';
|
|
3
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
4
|
+
import './descriptions.css';
|
|
5
|
+
export type DescriptionsSemanticPart = 'root' | 'header' | 'title' | 'extra' | 'label' | 'content';
|
|
6
|
+
export type DescriptionsItemSemanticPart = 'label' | 'content';
|
|
7
|
+
export interface DescriptionsItemProps {
|
|
8
|
+
prefixCls?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
labelStyle?: CSSProperties;
|
|
13
|
+
contentStyle?: CSSProperties;
|
|
14
|
+
classNames?: SemanticClassNames<DescriptionsItemSemanticPart>;
|
|
15
|
+
styles?: SemanticStyles<DescriptionsItemSemanticPart>;
|
|
16
|
+
span?: number | 'filled' | TaoBreakpointMap<number>;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export interface DescriptionsItemType extends Omit<DescriptionsItemProps, 'prefixCls'> {
|
|
20
|
+
key?: Key;
|
|
21
|
+
}
|
|
22
|
+
export interface DescriptionsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
23
|
+
prefixCls?: string;
|
|
24
|
+
rootClassName?: string;
|
|
25
|
+
bordered?: boolean;
|
|
26
|
+
size?: 'small' | 'medium' | 'middle' | 'large' | 'default';
|
|
27
|
+
title?: ReactNode;
|
|
28
|
+
extra?: ReactNode;
|
|
29
|
+
column?: number | TaoBreakpointMap<number>;
|
|
30
|
+
layout?: 'horizontal' | 'vertical';
|
|
31
|
+
colon?: boolean;
|
|
32
|
+
labelStyle?: CSSProperties;
|
|
33
|
+
contentStyle?: CSSProperties;
|
|
34
|
+
classNames?: SemanticClassNames<DescriptionsSemanticPart> | ((info: {
|
|
35
|
+
props: DescriptionsProps;
|
|
36
|
+
}) => SemanticClassNames<DescriptionsSemanticPart>);
|
|
37
|
+
styles?: SemanticStyles<DescriptionsSemanticPart> | ((info: {
|
|
38
|
+
props: DescriptionsProps;
|
|
39
|
+
}) => SemanticStyles<DescriptionsSemanticPart>);
|
|
40
|
+
items?: DescriptionsItemType[];
|
|
41
|
+
}
|
|
42
|
+
export interface DescriptionsRef {
|
|
43
|
+
nativeElement: HTMLDivElement;
|
|
44
|
+
}
|
|
45
|
+
declare function DescriptionsItem({ children }: DescriptionsItemProps): import("react").JSX.Element;
|
|
46
|
+
export declare const Descriptions: import("react").ForwardRefExoticComponent<DescriptionsProps & import("react").RefAttributes<DescriptionsRef>> & {
|
|
47
|
+
Item: typeof DescriptionsItem;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { Children, Fragment as external_react_Fragment, forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
|
|
4
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { resolveResponsiveValue, useBreakpoint } from "../../utils/breakpoint.js";
|
|
6
|
+
import { cx } from "../../utils/semantic.js";
|
|
7
|
+
import "./descriptions.css";
|
|
8
|
+
const renderable = (value)=>null != value && 'boolean' != typeof value;
|
|
9
|
+
function childrenToItems(children) {
|
|
10
|
+
return Children.toArray(children).flatMap((child)=>{
|
|
11
|
+
if (!/*#__PURE__*/ isValidElement(child)) return [];
|
|
12
|
+
return child.type === external_react_Fragment ? childrenToItems(child.props.children) : [
|
|
13
|
+
{
|
|
14
|
+
...child.props,
|
|
15
|
+
key: child.key ?? void 0
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function DescriptionsItem(t0) {
|
|
21
|
+
const $ = c(2);
|
|
22
|
+
const { children } = t0;
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] !== children) {
|
|
25
|
+
t1 = /*#__PURE__*/ jsx(Fragment, {
|
|
26
|
+
children: children
|
|
27
|
+
});
|
|
28
|
+
$[0] = children;
|
|
29
|
+
$[1] = t1;
|
|
30
|
+
} else t1 = $[1];
|
|
31
|
+
return t1;
|
|
32
|
+
}
|
|
33
|
+
const DescriptionsRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
34
|
+
const config = useTaoConfig();
|
|
35
|
+
const { prefixCls, rootClassName, bordered, size = config.size, title, extra, column, layout = 'horizontal', colon = true, labelStyle, contentStyle, classNames, styles, items, children, className, style, ...rest } = props;
|
|
36
|
+
const screens = useBreakpoint();
|
|
37
|
+
const columns = 'number' == typeof column ? column : resolveResponsiveValue(column ?? {}, screens) ?? resolveResponsiveValue({
|
|
38
|
+
xs: 1,
|
|
39
|
+
sm: 2,
|
|
40
|
+
md: 3,
|
|
41
|
+
xxxl: 4
|
|
42
|
+
}, screens) ?? 3;
|
|
43
|
+
const source = items ?? childrenToItems(children);
|
|
44
|
+
const rows = [];
|
|
45
|
+
let current = [];
|
|
46
|
+
let used = 0;
|
|
47
|
+
source.forEach((item)=>{
|
|
48
|
+
const remaining = columns - used;
|
|
49
|
+
const span = 'filled' === item.span ? remaining : Math.min(resolveResponsiveValue(item.span ?? 1, screens) ?? 1, remaining);
|
|
50
|
+
current.push({
|
|
51
|
+
...item,
|
|
52
|
+
span
|
|
53
|
+
});
|
|
54
|
+
used += span;
|
|
55
|
+
if (used >= columns || 'filled' === item.span) {
|
|
56
|
+
rows.push(current);
|
|
57
|
+
current = [];
|
|
58
|
+
used = 0;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if (current.length) {
|
|
62
|
+
current[current.length - 1].span += columns - used;
|
|
63
|
+
rows.push(current);
|
|
64
|
+
}
|
|
65
|
+
const merged = {
|
|
66
|
+
...props,
|
|
67
|
+
column: columns,
|
|
68
|
+
size,
|
|
69
|
+
layout,
|
|
70
|
+
colon
|
|
71
|
+
};
|
|
72
|
+
const classes = 'function' == typeof classNames ? classNames({
|
|
73
|
+
props: merged
|
|
74
|
+
}) : classNames;
|
|
75
|
+
const slots = 'function' == typeof styles ? styles({
|
|
76
|
+
props: merged
|
|
77
|
+
}) : styles;
|
|
78
|
+
const node = useRef(null);
|
|
79
|
+
useImperativeHandle(ref, ()=>({
|
|
80
|
+
nativeElement: node.current
|
|
81
|
+
}));
|
|
82
|
+
function cell(item_0, index, part, span_0) {
|
|
83
|
+
const Tag = 'label' === part ? 'th' : 'td';
|
|
84
|
+
const itemLabel = {
|
|
85
|
+
...labelStyle,
|
|
86
|
+
...slots?.label,
|
|
87
|
+
...item_0.labelStyle,
|
|
88
|
+
...item_0.styles?.label
|
|
89
|
+
};
|
|
90
|
+
const itemContent = {
|
|
91
|
+
...contentStyle,
|
|
92
|
+
...slots?.content,
|
|
93
|
+
...item_0.contentStyle,
|
|
94
|
+
...item_0.styles?.content
|
|
95
|
+
};
|
|
96
|
+
const partClass = 'label' === part ? cx(classes?.label, item_0.classNames?.label) : 'content' === part ? cx(classes?.content, item_0.classNames?.content) : void 0;
|
|
97
|
+
return /*#__PURE__*/ jsx(Tag, {
|
|
98
|
+
colSpan: span_0,
|
|
99
|
+
scope: 'label' === part ? 'vertical' === layout ? 'col' : 'row' : void 0,
|
|
100
|
+
"data-tao-descriptions-cell": part,
|
|
101
|
+
className: cx(item_0.prefixCls, item_0.className, bordered && partClass),
|
|
102
|
+
style: {
|
|
103
|
+
...item_0.style,
|
|
104
|
+
...bordered ? 'label' === part ? itemLabel : itemContent : {}
|
|
105
|
+
},
|
|
106
|
+
children: bordered ? 'label' === part ? item_0.label : item_0.children : /*#__PURE__*/ jsxs("div", {
|
|
107
|
+
"data-tao-descriptions-item": "",
|
|
108
|
+
children: [
|
|
109
|
+
'content' !== part && renderable(item_0.label) && /*#__PURE__*/ jsx("span", {
|
|
110
|
+
"data-tao-descriptions-label": "",
|
|
111
|
+
"data-tao-colon": colon || void 0,
|
|
112
|
+
className: cx(classes?.label, item_0.classNames?.label),
|
|
113
|
+
style: itemLabel,
|
|
114
|
+
children: item_0.label
|
|
115
|
+
}),
|
|
116
|
+
'label' !== part && renderable(item_0.children) && /*#__PURE__*/ jsx("span", {
|
|
117
|
+
"data-tao-descriptions-content": "",
|
|
118
|
+
className: cx(classes?.content, item_0.classNames?.content),
|
|
119
|
+
style: itemContent,
|
|
120
|
+
children: item_0.children
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
}, `${item_0.key ?? index}-${part}`);
|
|
125
|
+
}
|
|
126
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
127
|
+
...rest,
|
|
128
|
+
ref: node,
|
|
129
|
+
"data-tao-descriptions": "",
|
|
130
|
+
"data-tao-bordered": bordered || void 0,
|
|
131
|
+
"data-tao-layout": layout,
|
|
132
|
+
"data-tao-size": 'middle' === size || 'default' === size ? 'medium' : size,
|
|
133
|
+
className: cx(prefixCls, classes?.root, className, rootClassName),
|
|
134
|
+
style: {
|
|
135
|
+
...slots?.root,
|
|
136
|
+
...style
|
|
137
|
+
},
|
|
138
|
+
children: [
|
|
139
|
+
(renderable(title) || renderable(extra)) && /*#__PURE__*/ jsxs("div", {
|
|
140
|
+
"data-tao-descriptions-header": "",
|
|
141
|
+
className: classes?.header,
|
|
142
|
+
style: slots?.header,
|
|
143
|
+
children: [
|
|
144
|
+
renderable(title) && /*#__PURE__*/ jsx("div", {
|
|
145
|
+
"data-tao-descriptions-title": "",
|
|
146
|
+
className: classes?.title,
|
|
147
|
+
style: slots?.title,
|
|
148
|
+
children: title
|
|
149
|
+
}),
|
|
150
|
+
renderable(extra) && /*#__PURE__*/ jsx("div", {
|
|
151
|
+
"data-tao-descriptions-extra": "",
|
|
152
|
+
className: classes?.extra,
|
|
153
|
+
style: slots?.extra,
|
|
154
|
+
children: extra
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}),
|
|
158
|
+
/*#__PURE__*/ jsx("div", {
|
|
159
|
+
"data-tao-descriptions-view": "",
|
|
160
|
+
children: /*#__PURE__*/ jsx("table", {
|
|
161
|
+
children: /*#__PURE__*/ jsx("tbody", {
|
|
162
|
+
children: rows.map((row, index_0)=>'vertical' === layout ? /*#__PURE__*/ jsxs(external_react_Fragment, {
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ jsx("tr", {
|
|
165
|
+
children: row.map((item_1, i)=>cell(item_1, i, 'label', item_1.span))
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ jsx("tr", {
|
|
168
|
+
children: row.map((item_2, i_0)=>cell(item_2, i_0, 'content', item_2.span))
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
}, row[0].key ?? index_0) : /*#__PURE__*/ jsx("tr", {
|
|
172
|
+
children: row.flatMap((item_3, i_1)=>bordered ? [
|
|
173
|
+
cell(item_3, i_1, 'label', 1),
|
|
174
|
+
cell(item_3, i_1, 'content', 2 * item_3.span - 1)
|
|
175
|
+
] : [
|
|
176
|
+
cell(item_3, i_1, 'item', item_3.span)
|
|
177
|
+
])
|
|
178
|
+
}, row[0].key ?? index_0))
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
DescriptionsRoot.displayName = "Descriptions";
|
|
186
|
+
const Descriptions = Object.assign(DescriptionsRoot, {
|
|
187
|
+
Item: DescriptionsItem
|
|
188
|
+
});
|
|
189
|
+
export { Descriptions };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
[data-tao-divider] {
|
|
3
|
+
--tao-divider-line-style: solid;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
inline-size: 100%;
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
margin-block: var(--tao-margin-lg);
|
|
8
|
+
color: var(--tao-color-text);
|
|
9
|
+
font: inherit;
|
|
10
|
+
font-family: var(--tao-font-family);
|
|
11
|
+
font-weight: var(--tao-font-weight-strong);
|
|
12
|
+
align-items: center;
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-tao-divider][data-tao-variant="dashed"] {
|
|
17
|
+
--tao-divider-line-style: dashed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-tao-divider][data-tao-variant="dotted"] {
|
|
21
|
+
--tao-divider-line-style: dotted;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-tao-divider]:not([data-tao-has-title]), [data-tao-divider-rail] {
|
|
25
|
+
border-block-start: var(--tao-line-width) var(--tao-divider-line-style)
|
|
26
|
+
var(--tao-color-border-secondary);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-tao-divider][data-tao-size="small"] {
|
|
30
|
+
margin-block: var(--tao-margin-xs);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[data-tao-divider][data-tao-size="medium"] {
|
|
34
|
+
margin-block: var(--tao-margin-md);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-tao-divider][data-tao-plain] {
|
|
38
|
+
font-weight: 400;
|
|
39
|
+
font-size: var(--tao-font-size);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-tao-divider-rail] {
|
|
43
|
+
flex: 1;
|
|
44
|
+
min-inline-size: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-tao-divider-content] {
|
|
48
|
+
padding-inline: var(--tao-padding-md);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-tao-divider][data-tao-placement="start"] [data-tao-divider-rail="start"], [data-tao-divider][data-tao-placement="end"] [data-tao-divider-rail="end"], [data-tao-divider][data-tao-placement="left"]:dir(ltr) [data-tao-divider-rail="start"], [data-tao-divider][data-tao-placement="left"]:dir(rtl) [data-tao-divider-rail="end"], [data-tao-divider][data-tao-placement="right"]:dir(ltr) [data-tao-divider-rail="end"], [data-tao-divider][data-tao-placement="right"]:dir(rtl) [data-tao-divider-rail="start"] {
|
|
52
|
+
flex: 0 0 5%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-tao-divider][data-tao-custom-margin][data-tao-placement="start"] [data-tao-divider-rail="start"], [data-tao-divider][data-tao-custom-margin][data-tao-placement="end"] [data-tao-divider-rail="end"] {
|
|
56
|
+
flex-basis: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-tao-divider][data-tao-orientation="vertical"] {
|
|
60
|
+
block-size: .9em;
|
|
61
|
+
inline-size: 0;
|
|
62
|
+
margin-block: 0;
|
|
63
|
+
margin-inline: var(--tao-margin-xs);
|
|
64
|
+
vertical-align: middle;
|
|
65
|
+
border-block-start: 0;
|
|
66
|
+
border-inline-start: var(--tao-line-width) var(--tao-divider-line-style)
|
|
67
|
+
var(--tao-color-border-secondary);
|
|
68
|
+
display: inline-block;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
3
|
+
import './divider.css';
|
|
4
|
+
export type DividerSemanticPart = 'root' | 'rail' | 'content';
|
|
5
|
+
export type DividerTitlePlacement = 'start' | 'end' | 'center' | 'left' | 'right';
|
|
6
|
+
export interface DividerProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
prefixCls?: string;
|
|
8
|
+
rootClassName?: string;
|
|
9
|
+
/** @deprecated Use orientation. */
|
|
10
|
+
type?: 'horizontal' | 'vertical';
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
vertical?: boolean;
|
|
13
|
+
titlePlacement?: DividerTitlePlacement;
|
|
14
|
+
/** @deprecated Use styles.content margins. */
|
|
15
|
+
orientationMargin?: string | number;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
dashed?: boolean;
|
|
18
|
+
variant?: 'solid' | 'dashed' | 'dotted';
|
|
19
|
+
size?: 'small' | 'medium' | 'middle' | 'large';
|
|
20
|
+
plain?: boolean;
|
|
21
|
+
classNames?: SemanticClassNames<DividerSemanticPart> | ((info: {
|
|
22
|
+
props: DividerProps;
|
|
23
|
+
}) => SemanticClassNames<DividerSemanticPart>);
|
|
24
|
+
styles?: SemanticStyles<DividerSemanticPart> | ((info: {
|
|
25
|
+
props: DividerProps;
|
|
26
|
+
}) => SemanticStyles<DividerSemanticPart>);
|
|
27
|
+
}
|
|
28
|
+
export interface DividerRef {
|
|
29
|
+
nativeElement: HTMLDivElement;
|
|
30
|
+
}
|
|
31
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<DividerRef>>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
3
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
4
|
+
import { cx } from "../../utils/semantic.js";
|
|
5
|
+
import "./divider.css";
|
|
6
|
+
const Divider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
|
+
const ctx = useTaoConfig();
|
|
8
|
+
const { prefixCls, rootClassName, type, orientation, vertical, titlePlacement = 'center', orientationMargin, children, dashed, variant = 'solid', size = ctx.size, plain, className, style, classNames, styles, ...rest } = props;
|
|
9
|
+
const direction = orientation ?? (void 0 === vertical ? type ?? 'horizontal' : vertical ? 'vertical' : 'horizontal');
|
|
10
|
+
const mergedProps = {
|
|
11
|
+
...props,
|
|
12
|
+
orientation: direction,
|
|
13
|
+
titlePlacement,
|
|
14
|
+
variant,
|
|
15
|
+
size
|
|
16
|
+
};
|
|
17
|
+
const classes = 'function' == typeof classNames ? classNames({
|
|
18
|
+
props: mergedProps
|
|
19
|
+
}) : classNames;
|
|
20
|
+
const slots = 'function' == typeof styles ? styles({
|
|
21
|
+
props: mergedProps
|
|
22
|
+
}) : styles;
|
|
23
|
+
const node = useRef(null);
|
|
24
|
+
useImperativeHandle(ref, ()=>({
|
|
25
|
+
nativeElement: node.current
|
|
26
|
+
}));
|
|
27
|
+
const hasTitle = 'horizontal' === direction && null != children && 'boolean' != typeof children;
|
|
28
|
+
const margin = 'string' == typeof orientationMargin && /^\d+$/.test(orientationMargin) ? Number(orientationMargin) : orientationMargin;
|
|
29
|
+
const titleStyle = {
|
|
30
|
+
...'start' === titlePlacement ? {
|
|
31
|
+
marginInlineStart: margin
|
|
32
|
+
} : 'end' === titlePlacement ? {
|
|
33
|
+
marginInlineEnd: margin
|
|
34
|
+
} : 'left' === titlePlacement ? {
|
|
35
|
+
marginLeft: margin
|
|
36
|
+
} : 'right' === titlePlacement ? {
|
|
37
|
+
marginRight: margin
|
|
38
|
+
} : {},
|
|
39
|
+
...slots?.content
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/ jsx("div", {
|
|
42
|
+
...rest,
|
|
43
|
+
ref: node,
|
|
44
|
+
role: "separator",
|
|
45
|
+
"aria-orientation": direction,
|
|
46
|
+
"data-tao-divider": "",
|
|
47
|
+
"data-tao-orientation": direction,
|
|
48
|
+
"data-tao-placement": titlePlacement,
|
|
49
|
+
"data-tao-size": 'middle' === size ? 'medium' : size,
|
|
50
|
+
"data-tao-variant": dashed ? 'dashed' : variant,
|
|
51
|
+
"data-tao-plain": plain || void 0,
|
|
52
|
+
"data-tao-has-title": hasTitle || void 0,
|
|
53
|
+
"data-tao-custom-margin": void 0 !== orientationMargin || void 0,
|
|
54
|
+
className: cx(prefixCls, classes?.root, !hasTitle && classes?.rail, className, rootClassName),
|
|
55
|
+
style: {
|
|
56
|
+
...slots?.root,
|
|
57
|
+
...!hasTitle ? slots?.rail : {},
|
|
58
|
+
...style
|
|
59
|
+
},
|
|
60
|
+
children: hasTitle && /*#__PURE__*/ jsxs(Fragment, {
|
|
61
|
+
children: [
|
|
62
|
+
/*#__PURE__*/ jsx("span", {
|
|
63
|
+
"data-tao-divider-rail": "start",
|
|
64
|
+
className: classes?.rail,
|
|
65
|
+
style: slots?.rail
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ jsx("span", {
|
|
68
|
+
"data-tao-divider-content": "",
|
|
69
|
+
className: classes?.content,
|
|
70
|
+
style: titleStyle,
|
|
71
|
+
children: children
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ jsx("span", {
|
|
74
|
+
"data-tao-divider-rail": "end",
|
|
75
|
+
className: classes?.rail,
|
|
76
|
+
style: slots?.rail
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
Divider.displayName = 'Divider';
|
|
83
|
+
export { Divider };
|