@rockshin/tao-ui 0.0.59 → 0.1.0
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 +5 -1
- package/component-manifest.json +1 -1
- package/dist/components/affix/affix.css +1 -1
- package/dist/components/affix/affix.d.ts +1 -0
- package/dist/components/affix/affix.js +18 -17
- package/dist/components/alert/alert.css +123 -119
- package/dist/components/alert/alert.js +78 -188
- package/dist/components/app/app-modals.js +49 -98
- package/dist/components/app/app-notices.d.ts +2 -2
- package/dist/components/app/app-notices.js +294 -243
- package/dist/components/app/app-types.d.ts +6 -3
- package/dist/components/app/app.css +185 -183
- package/dist/components/app/app.js +1 -1
- package/dist/components/auto-complete/auto-complete.css +30 -28
- package/dist/components/auto-complete/auto-complete.d.ts +3 -1
- package/dist/components/auto-complete/auto-complete.js +2 -1
- package/dist/components/badge/badge.js +42 -127
- package/dist/components/border-beam/border-beam.css +1 -1
- package/dist/components/border-beam/border-beam.d.ts +1 -0
- package/dist/components/border-beam/border-beam.js +1 -0
- package/dist/components/breadcrumb/breadcrumb.css +123 -120
- package/dist/components/breadcrumb/breadcrumb.js +160 -265
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +52 -151
- package/dist/components/calendar/calendar.js +28 -27
- package/dist/components/card/card-tabs.d.ts +56 -5
- package/dist/components/card/card-tabs.js +214 -468
- package/dist/components/card/card.d.ts +1 -2
- package/dist/components/card/card.js +64 -226
- package/dist/components/carousel/carousel.css +1 -1
- package/dist/components/carousel/carousel.d.ts +59 -4
- package/dist/components/carousel/carousel.js +299 -243
- package/dist/components/cascader/cascader.css +186 -184
- package/dist/components/cascader/cascader.d.ts +3 -1
- package/dist/components/cascader/cascader.js +29 -34
- package/dist/components/checkbox/checkbox.css +93 -90
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +171 -499
- package/dist/components/collapse/collapse-panels.js +145 -400
- package/dist/components/collapse/collapse.css +172 -170
- package/dist/components/collapse/collapse.d.ts +1 -1
- package/dist/components/collapse/collapse.js +62 -181
- package/dist/components/color-picker/color-picker.css +1 -1
- package/dist/components/color-picker/color-picker.js +418 -981
- package/dist/components/context-menu/context-menu.css +4 -4
- package/dist/components/context-menu/context-menu.d.ts +3 -1
- package/dist/components/context-menu/context-menu.js +54 -135
- package/dist/components/date-picker/calendar/calendar-grid.js +41 -41
- package/dist/components/date-picker/calendar/calendar-header.js +171 -337
- package/dist/components/date-picker/calendar/month-grid.js +33 -103
- package/dist/components/date-picker/calendar/time-panel.js +84 -209
- package/dist/components/date-picker/calendar/year-grid.js +36 -105
- package/dist/components/date-picker/date-localization.js +1 -1
- package/dist/components/date-picker/date-picker.css +599 -642
- package/dist/components/date-picker/date-picker.d.ts +2 -1
- package/dist/components/date-picker/date-picker.js +96 -105
- package/dist/components/date-picker/presets.js +12 -37
- package/dist/components/date-picker/range-picker.d.ts +2 -1
- package/dist/components/date-picker/range-picker.js +222 -255
- package/dist/components/date-picker/types.d.ts +2 -1
- package/dist/components/descriptions/descriptions.css +1 -1
- package/dist/components/descriptions/descriptions.js +30 -39
- package/dist/components/drawer/drawer.css +202 -200
- package/dist/components/drawer/drawer.js +28 -34
- package/dist/components/dropdown/dropdown-core.d.ts +32 -0
- package/dist/components/dropdown/dropdown-core.js +156 -0
- package/dist/components/dropdown/dropdown.css +38 -36
- package/dist/components/dropdown/dropdown.d.ts +4 -30
- package/dist/components/dropdown/dropdown.js +91 -271
- package/dist/components/empty/empty.css +30 -28
- package/dist/components/empty/empty.js +81 -236
- package/dist/components/float-button/float-button.css +1 -1
- package/dist/components/float-button/float-button.js +38 -48
- package/dist/components/form/field-control.js +2 -3
- package/dist/components/form/form-item.js +67 -129
- package/dist/components/form/form.css +36 -34
- package/dist/components/form/form.d.ts +1 -1
- package/dist/components/form/form.js +29 -100
- package/dist/components/form/index.d.ts +1 -1
- package/dist/components/form/use-form.js +48 -66
- package/dist/components/form-actions/form-actions.d.ts +1 -0
- package/dist/components/form-actions/form-actions.js +10 -36
- package/dist/components/form-field/form-field-view.d.ts +1 -0
- package/dist/components/form-field/form-field-view.js +81 -288
- package/dist/components/form-field/form-field.js +13 -31
- package/dist/components/form-field/form.css +74 -72
- package/dist/components/form-section/form-section.d.ts +1 -0
- package/dist/components/form-section/form-section.js +38 -91
- package/dist/components/image/image-icons.js +16 -31
- package/dist/components/image/image.css +1 -1
- package/dist/components/image/image.js +298 -911
- package/dist/components/input/base-input.d.ts +3 -1
- package/dist/components/input/base-input.js +8 -7
- package/dist/components/input/input-shared.css +62 -60
- package/dist/components/input/input-shared.d.ts +1 -1
- package/dist/components/input/input-shared.js +56 -100
- package/dist/components/input/input.css +222 -220
- package/dist/components/input/otp.d.ts +2 -1
- package/dist/components/input/otp.js +143 -324
- package/dist/components/input/password.js +12 -67
- package/dist/components/input/search.js +13 -13
- package/dist/components/input-number/input-number.d.ts +4 -2
- package/dist/components/input-number/input-number.js +30 -137
- package/dist/components/list/list-pagination.css +107 -105
- package/dist/components/list/list-pagination.d.ts +56 -5
- package/dist/components/list/list-pagination.js +249 -316
- package/dist/components/list/list.css +179 -177
- package/dist/components/list/list.js +170 -604
- package/dist/components/listy/listy.css +55 -53
- package/dist/components/listy/listy.d.ts +43 -4
- package/dist/components/listy/listy.js +198 -216
- package/dist/components/masonry/masonry.css +1 -1
- package/dist/components/masonry/masonry.d.ts +1 -0
- package/dist/components/masonry/masonry.js +90 -244
- package/dist/components/mentions/mentions.css +153 -151
- package/dist/components/mentions/mentions.d.ts +53 -11
- package/dist/components/mentions/mentions.js +291 -75
- package/dist/components/menu/menu-render.d.ts +7 -0
- package/dist/components/menu/menu-render.js +156 -302
- package/dist/components/menu/menu.css +142 -140
- package/dist/components/modal/confirm-dialog.js +19 -24
- package/dist/components/modal/modal.css +165 -162
- package/dist/components/modal/modal.js +285 -731
- package/dist/components/modal/use-modal.js +25 -25
- package/dist/components/pagination/pagination.css +134 -131
- package/dist/components/pagination/pagination.d.ts +4 -3
- package/dist/components/pagination/pagination.js +138 -281
- package/dist/components/popconfirm/popconfirm.css +38 -36
- package/dist/components/popconfirm/popconfirm.js +105 -288
- package/dist/components/popover/popover.css +89 -87
- package/dist/components/popover/popover.js +189 -469
- package/dist/components/progress/progress.css +153 -151
- package/dist/components/progress/progress.js +34 -43
- package/dist/components/qr-code/qr-code.css +36 -34
- package/dist/components/qr-code/qr-code.js +83 -277
- package/dist/components/radio/radio.css +95 -92
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +114 -376
- package/dist/components/rate/rate.css +80 -78
- package/dist/components/rate/rate.d.ts +34 -6
- package/dist/components/rate/rate.js +160 -244
- package/dist/components/result/result.css +59 -57
- package/dist/components/result/result.d.ts +1 -0
- package/dist/components/result/result.js +118 -291
- package/dist/components/scroll-area/scroll-area.css +160 -148
- package/dist/components/scroll-area/scroll-area.js +284 -488
- package/dist/components/segmented/segmented.css +1 -1
- package/dist/components/segmented/segmented.js +59 -58
- package/dist/components/select/mobile-select.css +166 -164
- package/dist/components/select/mobile-select.js +48 -131
- package/dist/components/select/select-icons.js +59 -128
- package/dist/components/select/select-model.js +1 -1
- package/dist/components/select/select-searchable-list.js +19 -19
- package/dist/components/select/select-tags.js +70 -156
- package/dist/components/select/select-types.d.ts +2 -1
- package/dist/components/select/select.css +509 -506
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +67 -65
- package/dist/components/select/use-select-selection.js +181 -261
- package/dist/components/skeleton/skeleton.css +105 -103
- package/dist/components/skeleton/skeleton.js +140 -399
- package/dist/components/slider/slider.css +160 -158
- package/dist/components/slider/slider.d.ts +45 -6
- package/dist/components/slider/slider.js +359 -74
- package/dist/components/sonner/index.d.ts +1 -1
- package/dist/components/sonner/sonner.css +190 -182
- package/dist/components/sonner/sonner.js +12 -11
- package/dist/components/spinner/spinner.css +80 -76
- package/dist/components/spinner/spinner.d.ts +1 -1
- package/dist/components/spinner/spinner.js +75 -219
- package/dist/components/splitter/splitter.css +157 -154
- package/dist/components/splitter/splitter.js +271 -448
- package/dist/components/statistic/statistic.css +1 -1
- package/dist/components/statistic/statistic.js +121 -406
- package/dist/components/status-icon/status-icon.js +14 -26
- package/dist/components/steps/steps-icons.js +63 -100
- package/dist/components/steps/steps.css +817 -807
- package/dist/components/steps/steps.d.ts +1 -1
- package/dist/components/steps/steps.js +38 -94
- package/dist/components/steps/use-display-steps.js +21 -54
- package/dist/components/switch/switch-touch.css +17 -15
- package/dist/components/switch/switch.css +192 -190
- package/dist/components/switch/switch.js +63 -196
- package/dist/components/table/table-filter.d.ts +3 -1
- package/dist/components/table/table-filter.js +72 -133
- package/dist/components/table/table-icons.js +77 -152
- package/dist/components/table/table-summary.js +30 -77
- package/dist/components/table/table-types.d.ts +2 -1
- package/dist/components/table/table.css +468 -465
- package/dist/components/table/table.js +86 -84
- package/dist/components/table/use-table-data.js +137 -248
- package/dist/components/tabs/tabs.css +123 -120
- package/dist/components/tabs/tabs.d.ts +4 -3
- package/dist/components/tabs/tabs.js +157 -322
- package/dist/components/tag/tag.css +231 -221
- package/dist/components/tag/tag.js +110 -248
- package/dist/components/textarea/textarea.css +2 -1
- package/dist/components/textarea/textarea.d.ts +3 -1
- package/dist/components/textarea/textarea.js +16 -15
- package/dist/components/time-picker/time-picker.d.ts +1 -0
- package/dist/components/time-picker/time-picker.js +91 -221
- package/dist/components/timeline/timeline.css +1 -1
- package/dist/components/timeline/timeline.js +17 -17
- package/dist/components/tooltip/tooltip.css +79 -77
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +111 -263
- package/dist/components/tour/tour.css +1 -1
- package/dist/components/tour/tour.d.ts +59 -6
- package/dist/components/tour/tour.js +343 -622
- package/dist/components/transfer/transfer-list.js +19 -19
- package/dist/components/transfer/transfer-parts.js +63 -139
- package/dist/components/transfer/transfer.css +192 -190
- package/dist/components/transfer/transfer.js +57 -56
- package/dist/components/tree/tree-check.js +25 -32
- package/dist/components/tree/tree-keyboard.js +1 -1
- package/dist/components/tree/tree.css +204 -200
- package/dist/components/tree/tree.js +139 -277
- package/dist/components/tree-select/select-engine.css +200 -197
- package/dist/components/tree-select/select-engine.js +11 -38
- package/dist/components/tree-select/tree-select.css +21 -19
- package/dist/components/tree-select/tree-select.d.ts +3 -1
- package/dist/components/tree-select/tree-select.js +12 -10
- package/dist/components/upload/upload.js +193 -308
- package/dist/components/watermark/watermark-context.js +8 -14
- package/dist/components/watermark/watermark.css +1 -1
- package/dist/components/watermark/watermark.js +209 -400
- package/dist/docs/components/stack.doc.js +1 -1
- package/dist/docs/components/table.doc.js +1 -1
- package/dist/entries/affix.d.ts +0 -2
- package/dist/entries/affix.js +0 -2
- package/dist/entries/alert.d.ts +0 -2
- package/dist/entries/alert.js +0 -2
- package/dist/entries/app.d.ts +0 -2
- package/dist/entries/app.js +0 -2
- package/dist/entries/auto-complete.d.ts +0 -2
- package/dist/entries/auto-complete.js +0 -2
- package/dist/entries/avatar.d.ts +0 -2
- package/dist/entries/avatar.js +0 -2
- package/dist/entries/badge.d.ts +0 -2
- package/dist/entries/badge.js +0 -2
- package/dist/entries/border-beam.d.ts +0 -2
- package/dist/entries/border-beam.js +0 -2
- package/dist/entries/breadcrumb.d.ts +0 -2
- package/dist/entries/breadcrumb.js +0 -2
- package/dist/entries/button.d.ts +0 -2
- package/dist/entries/button.js +0 -2
- package/dist/entries/calendar.d.ts +0 -2
- package/dist/entries/calendar.js +0 -2
- package/dist/entries/card.d.ts +0 -2
- package/dist/entries/card.js +0 -2
- package/dist/entries/carousel.d.ts +0 -2
- package/dist/entries/carousel.js +0 -2
- package/dist/entries/cascader.d.ts +0 -2
- package/dist/entries/cascader.js +0 -2
- package/dist/entries/checkbox.d.ts +0 -2
- package/dist/entries/checkbox.js +0 -2
- package/dist/entries/collapse.d.ts +0 -2
- package/dist/entries/collapse.js +0 -2
- package/dist/entries/color-picker.d.ts +0 -2
- package/dist/entries/color-picker.js +0 -2
- package/dist/entries/context-menu.d.ts +0 -2
- package/dist/entries/context-menu.js +0 -2
- package/dist/entries/date-picker.d.ts +0 -2
- package/dist/entries/date-picker.js +0 -2
- package/dist/entries/descriptions.d.ts +0 -2
- package/dist/entries/descriptions.js +0 -2
- package/dist/entries/divider.d.ts +0 -2
- package/dist/entries/divider.js +0 -2
- package/dist/entries/drawer.d.ts +0 -2
- package/dist/entries/drawer.js +0 -2
- package/dist/entries/dropdown.d.ts +0 -2
- package/dist/entries/dropdown.js +0 -2
- package/dist/entries/empty.d.ts +0 -2
- package/dist/entries/empty.js +0 -2
- package/dist/entries/float-button.d.ts +0 -2
- package/dist/entries/float-button.js +0 -2
- package/dist/entries/form-actions.d.ts +0 -2
- package/dist/entries/form-actions.js +0 -2
- package/dist/entries/form-field.d.ts +0 -2
- package/dist/entries/form-field.js +0 -2
- package/dist/entries/form-layout.d.ts +0 -2
- package/dist/entries/form-layout.js +0 -2
- package/dist/entries/form-section.d.ts +0 -2
- package/dist/entries/form-section.js +0 -2
- package/dist/entries/form.d.ts +1 -3
- package/dist/entries/form.js +0 -2
- package/dist/entries/image.d.ts +0 -2
- package/dist/entries/image.js +0 -2
- package/dist/entries/input-number.d.ts +0 -2
- package/dist/entries/input-number.js +0 -2
- package/dist/entries/input.d.ts +1 -3
- package/dist/entries/input.js +0 -2
- package/dist/entries/list.d.ts +0 -2
- package/dist/entries/list.js +0 -2
- package/dist/entries/listy.d.ts +0 -2
- package/dist/entries/listy.js +0 -2
- package/dist/entries/masonry.d.ts +0 -2
- package/dist/entries/masonry.js +0 -2
- package/dist/entries/mentions.d.ts +0 -2
- package/dist/entries/mentions.js +0 -2
- package/dist/entries/modal.d.ts +0 -2
- package/dist/entries/modal.js +0 -2
- package/dist/entries/number-input.d.ts +0 -2
- package/dist/entries/number-input.js +0 -2
- package/dist/entries/pagination.d.ts +0 -2
- package/dist/entries/pagination.js +0 -2
- package/dist/entries/popconfirm.d.ts +0 -2
- package/dist/entries/popconfirm.js +0 -2
- package/dist/entries/popover.d.ts +0 -2
- package/dist/entries/popover.js +0 -2
- package/dist/entries/progress.d.ts +0 -2
- package/dist/entries/progress.js +0 -2
- package/dist/entries/provider.d.ts +1 -3
- package/dist/entries/provider.js +1 -3
- package/dist/entries/qr-code.d.ts +0 -2
- package/dist/entries/qr-code.js +0 -2
- package/dist/entries/radio.d.ts +0 -2
- package/dist/entries/radio.js +0 -2
- package/dist/entries/range-picker.d.ts +0 -2
- package/dist/entries/range-picker.js +0 -2
- package/dist/entries/rate.d.ts +0 -2
- package/dist/entries/rate.js +0 -2
- package/dist/entries/result.d.ts +0 -2
- package/dist/entries/result.js +0 -2
- package/dist/entries/scroll-area.d.ts +0 -2
- package/dist/entries/scroll-area.js +0 -2
- package/dist/entries/segmented.d.ts +0 -2
- package/dist/entries/segmented.js +0 -2
- package/dist/entries/select.d.ts +0 -2
- package/dist/entries/select.js +0 -2
- package/dist/entries/skeleton.d.ts +0 -2
- package/dist/entries/skeleton.js +0 -2
- package/dist/entries/slider.d.ts +0 -2
- package/dist/entries/slider.js +0 -2
- package/dist/entries/sonner.d.ts +0 -2
- package/dist/entries/sonner.js +0 -2
- package/dist/entries/spinner.d.ts +0 -2
- package/dist/entries/spinner.js +0 -2
- package/dist/entries/splitter.d.ts +0 -2
- package/dist/entries/splitter.js +0 -2
- package/dist/entries/stack.d.ts +0 -2
- package/dist/entries/stack.js +0 -2
- package/dist/entries/statistic.d.ts +0 -2
- package/dist/entries/statistic.js +0 -2
- package/dist/entries/steps.d.ts +0 -2
- package/dist/entries/steps.js +0 -2
- package/dist/entries/switch.d.ts +0 -2
- package/dist/entries/switch.js +0 -2
- package/dist/entries/table.d.ts +0 -2
- package/dist/entries/table.js +0 -2
- package/dist/entries/tabs.d.ts +0 -2
- package/dist/entries/tabs.js +0 -2
- package/dist/entries/tag.d.ts +0 -2
- package/dist/entries/tag.js +0 -2
- package/dist/entries/textarea.d.ts +0 -2
- package/dist/entries/textarea.js +0 -2
- package/dist/entries/time-picker.d.ts +0 -2
- package/dist/entries/time-picker.js +0 -2
- package/dist/entries/timeline.d.ts +0 -2
- package/dist/entries/timeline.js +0 -2
- package/dist/entries/tooltip.d.ts +0 -2
- package/dist/entries/tooltip.js +0 -2
- package/dist/entries/tour.d.ts +0 -2
- package/dist/entries/tour.js +0 -2
- package/dist/entries/transfer.d.ts +0 -2
- package/dist/entries/transfer.js +0 -2
- package/dist/entries/tree-select.d.ts +0 -2
- package/dist/entries/tree-select.js +0 -2
- package/dist/entries/tree.d.ts +0 -2
- package/dist/entries/tree.js +0 -2
- package/dist/entries/upload.d.ts +0 -2
- package/dist/entries/upload.js +0 -2
- package/dist/entries/watermark.d.ts +0 -2
- package/dist/entries/watermark.js +0 -2
- package/dist/index.d.ts +5 -7
- package/dist/index.js +2 -4
- package/dist/layouts/form-layout/form-layout.d.ts +1 -0
- package/dist/layouts/form-layout/form-layout.js +10 -36
- package/dist/layouts/stack/layout.css +46 -44
- package/dist/layouts/stack/stack.d.ts +1 -0
- package/dist/layouts/stack/stack.js +16 -69
- package/dist/locales/ar-EG.js +25 -2
- package/dist/locales/create-locale.d.ts +1 -2
- package/dist/locales/create-locale.js +0 -28
- package/dist/locales/de-DE.js +25 -2
- package/dist/locales/en-US.js +24 -1
- package/dist/locales/es-ES.js +25 -2
- package/dist/locales/fr-FR.js +25 -2
- package/dist/locales/hi-IN.js +25 -2
- package/dist/locales/id-ID.js +25 -2
- package/dist/locales/index.d.ts +10 -10
- package/dist/locales/index.js +9 -9
- package/dist/locales/it-IT.js +25 -2
- package/dist/locales/ja-JP.js +25 -2
- package/dist/locales/ko-KR.js +25 -2
- package/dist/locales/pt-BR.js +25 -2
- package/dist/locales/ru-RU.js +25 -2
- package/dist/locales/th-TH.js +25 -2
- package/dist/locales/tr-TR.js +25 -2
- package/dist/locales/vi-VN.js +25 -2
- package/dist/locales/zh-CN.js +25 -2
- package/dist/locales/zh-TW.js +25 -2
- package/dist/number-input/number-input.js +24 -81
- package/dist/number-input/use-number-input.d.ts +1 -0
- package/dist/number-input/use-number-input.js +47 -43
- package/dist/provider/locale.d.ts +1 -1
- package/dist/provider/tao-context.d.ts +38 -0
- package/dist/provider/tao-context.js +92 -0
- package/dist/provider/tao-portal-scope.d.ts +14 -0
- package/dist/provider/tao-portal-scope.js +54 -0
- package/dist/provider/tao-provider.d.ts +5 -55
- package/dist/provider/tao-provider.js +94 -364
- package/dist/theme/control.css +106 -122
- package/dist/theme/theme.css +4 -2
- package/dist/utils/dialog-content.js +55 -210
- package/dist/utils/overlay.js +15 -30
- package/dist/utils/rc-compat.d.ts +13 -0
- package/dist/utils/rc-compat.js +48 -0
- package/dist/utils/refs.js +5 -19
- package/package.json +10 -16
|
@@ -1,97 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
@layer components {
|
|
2
|
+
[data-tao-rate] {
|
|
3
|
+
color: var(--tao-rate-star-color, var(--tao-color-warning));
|
|
4
|
+
font-family: var(--tao-font-family);
|
|
5
|
+
font-size: var(--tao-rate-star-size, 20px);
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
outline: none;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
line-height: 1;
|
|
12
|
+
list-style: none;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
}
|
|
14
15
|
|
|
15
|
-
[data-tao-rate][data-tao-size="small"] {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
[data-tao-rate][data-tao-size="small"] {
|
|
17
|
+
font-size: var(--tao-rate-star-size, 16px);
|
|
18
|
+
gap: 6px;
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
[data-tao-rate][data-tao-size="large"] {
|
|
21
|
-
|
|
22
|
-
}
|
|
21
|
+
[data-tao-rate][data-tao-size="large"] {
|
|
22
|
+
font-size: var(--tao-rate-star-size, 24px);
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
[data-tao-rate-item] {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
25
|
+
[data-tao-rate-item] {
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
transition: transform var(--tao-motion-duration-fast);
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
29
30
|
|
|
30
|
-
[data-tao-rate-item] > [role="radio"] {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
31
|
+
[data-tao-rate-item] > [role="radio"] {
|
|
32
|
+
outline: none;
|
|
33
|
+
display: block;
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
35
36
|
|
|
36
|
-
[data-tao-rate-item] > [role="radio"] > div {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
37
|
+
[data-tao-rate-item] > [role="radio"] > div {
|
|
38
|
+
color: var(--tao-rate-star-bg, var(--tao-color-fill-secondary));
|
|
39
|
+
display: flex;
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
[data-tao-rate-item] > [role="radio"] > div:first-child {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
42
|
+
[data-tao-rate-item] > [role="radio"] > div:first-child {
|
|
43
|
+
inset-inline-start: 0;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
width: 50%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
50
51
|
|
|
51
|
-
[data-tao-rate-item] > [role="radio"] > div:first-child > * {
|
|
52
|
-
|
|
53
|
-
}
|
|
52
|
+
[data-tao-rate-item] > [role="radio"] > div:first-child > * {
|
|
53
|
+
flex: none;
|
|
54
|
+
}
|
|
54
55
|
|
|
55
|
-
[data-tao-rate-item][data-tao-full] > [role="radio"] > div, [data-tao-rate-item][data-tao-half] > [role="radio"] > div:first-child {
|
|
56
|
-
|
|
57
|
-
}
|
|
56
|
+
[data-tao-rate-item][data-tao-full] > [role="radio"] > div, [data-tao-rate-item][data-tao-half] > [role="radio"] > div:first-child {
|
|
57
|
+
color: inherit;
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
[data-tao-rate-item]:hover {
|
|
60
|
-
|
|
61
|
-
}
|
|
60
|
+
[data-tao-rate-item]:hover {
|
|
61
|
+
transform: scale(1.08);
|
|
62
|
+
}
|
|
62
63
|
|
|
63
|
-
[data-tao-rate-item] > [role="radio"]:focus-visible {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
64
|
+
[data-tao-rate-item] > [role="radio"]:focus-visible {
|
|
65
|
+
outline: 2px solid var(--tao-color-primary);
|
|
66
|
+
outline-offset: 3px;
|
|
67
|
+
border-radius: var(--tao-radius-sm);
|
|
68
|
+
}
|
|
68
69
|
|
|
69
|
-
[data-tao-rate]:focus-visible {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
70
|
+
[data-tao-rate]:focus-visible {
|
|
71
|
+
outline: 2px solid var(--tao-color-primary);
|
|
72
|
+
outline-offset: 4px;
|
|
73
|
+
border-radius: var(--tao-radius-sm);
|
|
74
|
+
}
|
|
74
75
|
|
|
75
|
-
[data-tao-rate]:is([data-tao-disabled], [data-tao-readonly]) [data-tao-rate-item] {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
76
|
+
[data-tao-rate]:is([data-tao-disabled], [data-tao-readonly]) [data-tao-rate-item] {
|
|
77
|
+
cursor: default;
|
|
78
|
+
transform: none;
|
|
79
|
+
}
|
|
79
80
|
|
|
80
|
-
[data-tao-rate][data-tao-disabled] {
|
|
81
|
-
|
|
82
|
-
}
|
|
81
|
+
[data-tao-rate][data-tao-disabled] {
|
|
82
|
+
opacity: var(--tao-opacity-disabled, .5);
|
|
83
|
+
}
|
|
83
84
|
|
|
84
|
-
@media (pointer: coarse) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
@media (pointer: coarse) {
|
|
86
|
+
[data-tao-rate-item] > [role="radio"]:after {
|
|
87
|
+
content: "";
|
|
88
|
+
position: absolute;
|
|
89
|
+
inset: -10px -4px;
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
|
-
}
|
|
91
92
|
|
|
92
|
-
@media (prefers-reduced-motion: reduce) {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
@media (prefers-reduced-motion: reduce) {
|
|
94
|
+
[data-tao-rate-item] {
|
|
95
|
+
transition: none;
|
|
96
|
+
}
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type
|
|
3
|
-
import { type TaoSize } from '../../provider/tao-provider.js';
|
|
1
|
+
import { type AriaAttributes, type FocusEvent, type HTMLAttributes, type KeyboardEvent, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoSize } from '../../provider/tao-context.js';
|
|
4
3
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
5
4
|
import { type TooltipProps } from '../tooltip/tooltip.js';
|
|
6
5
|
import './rate.css';
|
|
7
|
-
export
|
|
6
|
+
export interface RateRef {
|
|
7
|
+
focus: () => void;
|
|
8
|
+
blur: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface RateStarProps {
|
|
11
|
+
index?: number;
|
|
12
|
+
count?: number;
|
|
13
|
+
value?: number;
|
|
14
|
+
allowHalf?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
focused?: boolean;
|
|
17
|
+
}
|
|
8
18
|
export type RateSemanticPart = 'root' | 'item';
|
|
9
|
-
export interface RateProps extends
|
|
19
|
+
export interface RateProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onChange' | 'onFocus' | 'onBlur' | 'onKeyDown'>, Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'> {
|
|
20
|
+
prefixCls?: string;
|
|
10
21
|
rootClassName?: string;
|
|
11
22
|
size?: TaoSize | 'middle';
|
|
23
|
+
count?: number;
|
|
24
|
+
value?: number;
|
|
25
|
+
defaultValue?: number;
|
|
26
|
+
allowHalf?: boolean;
|
|
27
|
+
allowClear?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
12
29
|
readOnly?: boolean;
|
|
30
|
+
keyboard?: boolean;
|
|
31
|
+
autoFocus?: boolean;
|
|
32
|
+
tabIndex?: number;
|
|
33
|
+
direction?: 'ltr' | 'rtl';
|
|
34
|
+
character?: ReactNode | ((props: RateStarProps) => ReactNode);
|
|
35
|
+
characterRender?: (origin: ReactElement, props: RateStarProps) => ReactElement;
|
|
13
36
|
tooltips?: (Omit<TooltipProps, 'children'> | string)[];
|
|
37
|
+
onChange?: (value: number) => void;
|
|
38
|
+
onHoverChange?: (value: number) => void;
|
|
39
|
+
onFocus?: (event: FocusEvent<HTMLUListElement>) => void;
|
|
40
|
+
onBlur?: (event: FocusEvent<HTMLUListElement>) => void;
|
|
41
|
+
onKeyDown?: (event: KeyboardEvent<HTMLUListElement>) => void;
|
|
14
42
|
classNames?: SemanticClassNames<RateSemanticPart>;
|
|
15
43
|
styles?: SemanticStyles<RateSemanticPart>;
|
|
16
44
|
}
|
|
17
|
-
export declare const Rate: import("react").ForwardRefExoticComponent<RateProps & import("react").RefAttributes<
|
|
45
|
+
export declare const Rate: import("react").ForwardRefExoticComponent<RateProps & import("react").RefAttributes<RateRef>>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { cloneElement, forwardRef, useState } from "react";
|
|
5
|
-
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-context.js";
|
|
6
4
|
import { cx } from "../../utils/semantic.js";
|
|
7
5
|
import { Tooltip } from "../tooltip/tooltip.js";
|
|
8
6
|
import "./rate.css";
|
|
9
|
-
import { interopDefault } from "../../utils/interop-default.js";
|
|
10
|
-
const RcRateComponent = /*#__PURE__*/ interopDefault(rate);
|
|
11
7
|
const Star = /*#__PURE__*/ jsx("svg", {
|
|
12
8
|
"data-tao-rate-icon": "",
|
|
13
9
|
viewBox: "0 0 24 24",
|
|
@@ -20,250 +16,170 @@ const Star = /*#__PURE__*/ jsx("svg", {
|
|
|
20
16
|
})
|
|
21
17
|
});
|
|
22
18
|
const Rate = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
let className;
|
|
26
|
-
let classNames;
|
|
27
|
-
let defaultValue;
|
|
28
|
-
let directionProp;
|
|
29
|
-
let disabled;
|
|
30
|
-
let keyboard;
|
|
31
|
-
let onChange;
|
|
32
|
-
let rest;
|
|
33
|
-
let rootClassName;
|
|
34
|
-
let size;
|
|
35
|
-
let style;
|
|
36
|
-
let styles;
|
|
37
|
-
let t0;
|
|
38
|
-
let t1;
|
|
39
|
-
let t2;
|
|
40
|
-
let t3;
|
|
41
|
-
let tooltips;
|
|
42
|
-
let value;
|
|
43
|
-
if ($[0] !== props) {
|
|
44
|
-
({ prefixCls: t0, rootClassName, className, classNames, style, styles, tooltips, size, disabled, readOnly: t1, character: t2, characterRender, direction: directionProp, count: t3, keyboard, value, defaultValue, onChange, ...rest } = props);
|
|
45
|
-
$[0] = props;
|
|
46
|
-
$[1] = characterRender;
|
|
47
|
-
$[2] = className;
|
|
48
|
-
$[3] = classNames;
|
|
49
|
-
$[4] = defaultValue;
|
|
50
|
-
$[5] = directionProp;
|
|
51
|
-
$[6] = disabled;
|
|
52
|
-
$[7] = keyboard;
|
|
53
|
-
$[8] = onChange;
|
|
54
|
-
$[9] = rest;
|
|
55
|
-
$[10] = rootClassName;
|
|
56
|
-
$[11] = size;
|
|
57
|
-
$[12] = style;
|
|
58
|
-
$[13] = styles;
|
|
59
|
-
$[14] = t0;
|
|
60
|
-
$[15] = t1;
|
|
61
|
-
$[16] = t2;
|
|
62
|
-
$[17] = t3;
|
|
63
|
-
$[18] = tooltips;
|
|
64
|
-
$[19] = value;
|
|
65
|
-
} else {
|
|
66
|
-
characterRender = $[1];
|
|
67
|
-
className = $[2];
|
|
68
|
-
classNames = $[3];
|
|
69
|
-
defaultValue = $[4];
|
|
70
|
-
directionProp = $[5];
|
|
71
|
-
disabled = $[6];
|
|
72
|
-
keyboard = $[7];
|
|
73
|
-
onChange = $[8];
|
|
74
|
-
rest = $[9];
|
|
75
|
-
rootClassName = $[10];
|
|
76
|
-
size = $[11];
|
|
77
|
-
style = $[12];
|
|
78
|
-
styles = $[13];
|
|
79
|
-
t0 = $[14];
|
|
80
|
-
t1 = $[15];
|
|
81
|
-
t2 = $[16];
|
|
82
|
-
t3 = $[17];
|
|
83
|
-
tooltips = $[18];
|
|
84
|
-
value = $[19];
|
|
85
|
-
}
|
|
86
|
-
const prefixCls = void 0 === t0 ? "tao-rate" : t0;
|
|
87
|
-
const readOnly = void 0 === t1 ? false : t1;
|
|
88
|
-
const character = void 0 === t2 ? Star : t2;
|
|
89
|
-
const count = void 0 === t3 ? 5 : t3;
|
|
90
|
-
const [direction, directionRef] = useTaoDirection(void 0 === directionProp ? void 0 : "rtl" === directionProp ? "rtl" : "ltr");
|
|
19
|
+
const { prefixCls = 'tao-rate', rootClassName, className, classNames, style, styles, tooltips, size, disabled, readOnly = false, allowHalf = false, allowClear = true, character = Star, characterRender, direction: directionProp, count = 5, keyboard = true, tabIndex = 0, autoFocus, value, defaultValue, onChange, onHoverChange, onFocus, onBlur, onKeyDown, ...rest } = props;
|
|
20
|
+
const [direction, directionRef] = useTaoDirection(void 0 === directionProp ? void 0 : 'rtl' === directionProp ? 'rtl' : 'ltr');
|
|
91
21
|
const config = useTaoConfig();
|
|
92
22
|
const resolvedDisabled = disabled ?? config.disabled;
|
|
93
|
-
const
|
|
23
|
+
const locked = resolvedDisabled || readOnly;
|
|
24
|
+
const controlled = 'value' in props;
|
|
94
25
|
const [internalValue, setInternalValue] = useState(defaultValue ?? 0);
|
|
26
|
+
const [hoverValue, setHoverValue] = useState(null);
|
|
27
|
+
const [focused, setFocused] = useState(false);
|
|
28
|
+
const listRef = useRef(null);
|
|
95
29
|
const selectedValue = Math.min(count, Math.max(0, controlled ? value ?? 0 : internalValue));
|
|
30
|
+
const displayValue = hoverValue ?? selectedValue;
|
|
96
31
|
const numberLocale = config.locale.numberLocale;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
$[32] = style;
|
|
154
|
-
$[33] = t16;
|
|
155
|
-
$[34] = t17;
|
|
156
|
-
} else t17 = $[34];
|
|
157
|
-
let t18;
|
|
158
|
-
if ($[35] !== characterRender || $[36] !== classNames?.item || $[37] !== count || $[38] !== handleChange || $[39] !== keyboard || $[40] !== numberFormat || $[41] !== rest || $[42] !== selectedValue || $[43] !== styles?.item || $[44] !== tooltips) {
|
|
159
|
-
t18 = (node, info)=>{
|
|
160
|
-
const index = info.index ?? 0;
|
|
161
|
-
const half = !!info.allowHalf && (info.value ?? 0) > index && (info.value ?? 0) < index + 1;
|
|
162
|
-
const item = node;
|
|
163
|
-
const radio = item.props.children;
|
|
164
|
-
const checked = selectedValue > index && selectedValue <= index + 1;
|
|
165
|
-
const score = numberFormat.format(checked ? selectedValue : index + 1);
|
|
166
|
-
const child = /*#__PURE__*/ cloneElement(item, {
|
|
167
|
-
...{
|
|
168
|
-
"data-tao-rate-item": "",
|
|
169
|
-
"data-tao-half": half ? "" : void 0,
|
|
170
|
-
"data-tao-full": (info.value ?? 0) >= index + 1 ? "" : void 0
|
|
171
|
-
},
|
|
172
|
-
className: cx(node.props.className, classNames?.item),
|
|
173
|
-
style: styles?.item,
|
|
174
|
-
children: /*#__PURE__*/ cloneElement(radio, {
|
|
175
|
-
"aria-checked": checked,
|
|
176
|
-
"aria-label": `${score} / ${numberFormat.format(count)}`,
|
|
177
|
-
onKeyDown: false !== keyboard && radio.props.onKeyDown ? (event)=>{
|
|
178
|
-
if (" " !== event.key) return void radio.props.onKeyDown?.(event);
|
|
179
|
-
event.preventDefault();
|
|
180
|
-
if (!event.repeat) {
|
|
181
|
-
const starValue = index + 1;
|
|
182
|
-
const clear = (rest.allowClear ?? true) && selectedValue === starValue;
|
|
183
|
-
handleChange(clear ? 0 : starValue);
|
|
184
|
-
}
|
|
185
|
-
} : void 0
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
const rendered = characterRender ? characterRender(child, info) : child;
|
|
189
|
-
const tip = tooltips?.[index];
|
|
190
|
-
return tip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
191
|
-
..."string" == typeof tip ? {
|
|
192
|
-
title: tip
|
|
193
|
-
} : tip,
|
|
194
|
-
children: rendered
|
|
195
|
-
}) : rendered;
|
|
196
|
-
};
|
|
197
|
-
$[35] = characterRender;
|
|
198
|
-
$[36] = classNames?.item;
|
|
199
|
-
$[37] = count;
|
|
200
|
-
$[38] = handleChange;
|
|
201
|
-
$[39] = keyboard;
|
|
202
|
-
$[40] = numberFormat;
|
|
203
|
-
$[41] = rest;
|
|
204
|
-
$[42] = selectedValue;
|
|
205
|
-
$[43] = styles?.item;
|
|
206
|
-
$[44] = tooltips;
|
|
207
|
-
$[45] = t18;
|
|
208
|
-
} else t18 = $[45];
|
|
209
|
-
let t19;
|
|
210
|
-
if ($[46] !== character || $[47] !== count || $[48] !== direction || $[49] !== handleChange || $[50] !== keyboard || $[51] !== prefixCls || $[52] !== ref || $[53] !== rest || $[54] !== selectedValue || $[55] !== t10 || $[56] !== t11 || $[57] !== t12 || $[58] !== t13 || $[59] !== t15 || $[60] !== t17 || $[61] !== t18 || $[62] !== t8 || $[63] !== t9) {
|
|
211
|
-
t19 = /*#__PURE__*/ jsx(RcRateComponent, {
|
|
32
|
+
const numberFormat = useMemo(()=>new Intl.NumberFormat(numberLocale), [
|
|
33
|
+
numberLocale
|
|
34
|
+
]);
|
|
35
|
+
useImperativeHandle(ref, ()=>({
|
|
36
|
+
focus: ()=>listRef.current?.focus(),
|
|
37
|
+
blur: ()=>listRef.current?.blur()
|
|
38
|
+
}), []);
|
|
39
|
+
const commitValue = (next)=>{
|
|
40
|
+
const bounded = Math.min(count, Math.max(0, next));
|
|
41
|
+
if (!controlled) setInternalValue(bounded);
|
|
42
|
+
onChange?.(bounded);
|
|
43
|
+
};
|
|
44
|
+
const getStarValue = (index, event)=>{
|
|
45
|
+
if (!allowHalf) return index + 1;
|
|
46
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
47
|
+
if (rect.width <= 0) return index + 1;
|
|
48
|
+
const offset = 'rtl' === direction ? rect.right - event.clientX : event.clientX - rect.left;
|
|
49
|
+
return offset < rect.width / 2 ? index + 0.5 : index + 1;
|
|
50
|
+
};
|
|
51
|
+
const handleStarClick = (index, event)=>{
|
|
52
|
+
if (locked) return;
|
|
53
|
+
const starVal = getStarValue(index, event);
|
|
54
|
+
const shouldClear = allowClear && starVal === selectedValue;
|
|
55
|
+
setHoverValue(null);
|
|
56
|
+
commitValue(shouldClear ? 0 : starVal);
|
|
57
|
+
};
|
|
58
|
+
const handleStarHover = (index, event)=>{
|
|
59
|
+
if (locked) return;
|
|
60
|
+
const starVal = getStarValue(index, event);
|
|
61
|
+
if (starVal !== hoverValue) {
|
|
62
|
+
setHoverValue(starVal);
|
|
63
|
+
onHoverChange?.(starVal);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleListKeyDown = (event)=>{
|
|
67
|
+
onKeyDown?.(event);
|
|
68
|
+
if (locked || !keyboard) return;
|
|
69
|
+
const isRtl = 'rtl' === direction;
|
|
70
|
+
const step = allowHalf ? 0.5 : 1;
|
|
71
|
+
const increase = isRtl ? 'ArrowLeft' === event.key : 'ArrowRight' === event.key;
|
|
72
|
+
const decrease = isRtl ? 'ArrowRight' === event.key : 'ArrowLeft' === event.key;
|
|
73
|
+
if (increase) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
commitValue(selectedValue + step);
|
|
76
|
+
} else if (decrease) {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
commitValue(selectedValue - step);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/ jsx("span", {
|
|
82
|
+
ref: directionRef,
|
|
83
|
+
dir: direction,
|
|
84
|
+
style: {
|
|
85
|
+
display: 'contents'
|
|
86
|
+
},
|
|
87
|
+
children: /*#__PURE__*/ jsx("ul", {
|
|
212
88
|
...rest,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
89
|
+
ref: listRef,
|
|
90
|
+
role: "radiogroup",
|
|
91
|
+
tabIndex: locked ? -1 : tabIndex,
|
|
92
|
+
autoFocus: autoFocus,
|
|
216
93
|
"data-tao-rate": "",
|
|
217
|
-
"data-tao-size":
|
|
218
|
-
"data-tao-disabled":
|
|
219
|
-
"data-tao-readonly":
|
|
220
|
-
"aria-readonly":
|
|
221
|
-
"aria-disabled":
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
94
|
+
"data-tao-size": 'middle' === size ? 'medium' : size ?? config.size,
|
|
95
|
+
"data-tao-disabled": resolvedDisabled ? '' : void 0,
|
|
96
|
+
"data-tao-readonly": readOnly ? '' : void 0,
|
|
97
|
+
"aria-readonly": readOnly || void 0,
|
|
98
|
+
"aria-disabled": resolvedDisabled || void 0,
|
|
99
|
+
className: cx(prefixCls, locked && `${prefixCls}-disabled`, 'rtl' === direction && `${prefixCls}-rtl`, classNames?.root, rootClassName, className),
|
|
100
|
+
style: {
|
|
101
|
+
...styles?.root,
|
|
102
|
+
...style
|
|
103
|
+
},
|
|
104
|
+
onFocus: (event)=>{
|
|
105
|
+
setFocused(true);
|
|
106
|
+
onFocus?.(event);
|
|
107
|
+
},
|
|
108
|
+
onBlur: (event)=>{
|
|
109
|
+
setFocused(false);
|
|
110
|
+
onBlur?.(event);
|
|
111
|
+
},
|
|
112
|
+
onMouseLeave: ()=>{
|
|
113
|
+
if (null !== hoverValue) {
|
|
114
|
+
setHoverValue(null);
|
|
115
|
+
onHoverChange?.(selectedValue);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
onKeyDown: handleListKeyDown,
|
|
119
|
+
children: Array.from({
|
|
120
|
+
length: count
|
|
121
|
+
}, (_, index)=>{
|
|
122
|
+
const starKey = `star-${index}`;
|
|
123
|
+
const info = {
|
|
124
|
+
index,
|
|
125
|
+
count,
|
|
126
|
+
value: displayValue,
|
|
127
|
+
allowHalf,
|
|
128
|
+
disabled: locked,
|
|
129
|
+
focused
|
|
130
|
+
};
|
|
131
|
+
const half = allowHalf && displayValue > index && displayValue < index + 1;
|
|
132
|
+
const full = displayValue >= index + 1;
|
|
133
|
+
const checked = selectedValue > index && selectedValue <= index + 1;
|
|
134
|
+
const score = numberFormat.format(checked ? selectedValue : index + 1);
|
|
135
|
+
const charNode = 'function' == typeof character ? character(info) : character;
|
|
136
|
+
const itemNode = /*#__PURE__*/ jsx("li", {
|
|
137
|
+
"data-tao-rate-item": "",
|
|
138
|
+
"data-tao-half": half ? '' : void 0,
|
|
139
|
+
"data-tao-full": full ? '' : void 0,
|
|
140
|
+
className: cx(`${prefixCls}-star`, full && `${prefixCls}-star-full`, half && `${prefixCls}-star-half`, classNames?.item),
|
|
141
|
+
style: styles?.item,
|
|
142
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
143
|
+
role: "radio",
|
|
144
|
+
tabIndex: locked ? -1 : 0,
|
|
145
|
+
"aria-checked": checked,
|
|
146
|
+
"aria-posinset": index + 1,
|
|
147
|
+
"aria-setsize": count,
|
|
148
|
+
"aria-label": `${score} / ${numberFormat.format(count)}`,
|
|
149
|
+
onClick: (event)=>handleStarClick(index, event),
|
|
150
|
+
onMouseMove: (event)=>handleStarHover(index, event),
|
|
151
|
+
onKeyDown: !keyboard || locked ? void 0 : (event)=>{
|
|
152
|
+
if ('Enter' === event.key || ' ' === event.key) {
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
if (!event.repeat) {
|
|
155
|
+
const starVal = index + 1;
|
|
156
|
+
commitValue(allowClear && selectedValue === starVal ? 0 : starVal);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
children: [
|
|
161
|
+
/*#__PURE__*/ jsx("div", {
|
|
162
|
+
className: `${prefixCls}-star-first`,
|
|
163
|
+
children: charNode
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ jsx("div", {
|
|
166
|
+
className: `${prefixCls}-star-second`,
|
|
167
|
+
children: charNode
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
}, starKey);
|
|
172
|
+
const rendered = characterRender ? characterRender(itemNode, info) : itemNode;
|
|
173
|
+
const tip = tooltips?.[index];
|
|
174
|
+
return tip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
175
|
+
...'string' == typeof tip ? {
|
|
176
|
+
title: tip
|
|
177
|
+
} : tip,
|
|
178
|
+
children: rendered
|
|
179
|
+
}, starKey) : rendered;
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
});
|
|
267
183
|
});
|
|
268
184
|
Rate.displayName = 'Rate';
|
|
269
185
|
export { Rate };
|