@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,14 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { TaoPortalScope
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-context.js";
|
|
4
|
+
import { TaoPortalScope } from "../../provider/tao-portal-scope.js";
|
|
5
5
|
import { useCommittedRef } from "../../utils/refs.js";
|
|
6
6
|
import { cx } from "../../utils/semantic.js";
|
|
7
7
|
import "../tooltip/tooltip.css";
|
|
8
8
|
import "./slider.css";
|
|
9
|
-
import { interopDefault } from "../../utils/interop-default.js";
|
|
10
9
|
import * as __rspack_external__radix_ui_react_tooltip_b301f25d from "@radix-ui/react-tooltip";
|
|
11
|
-
const RcSliderComponent = /*#__PURE__*/ interopDefault(slider);
|
|
12
10
|
function SliderTip({ children, value, dragging, disabled, vertical, direction, options }) {
|
|
13
11
|
const [trigger, setTrigger] = useState(null);
|
|
14
12
|
const [active, setActive] = useState(options.defaultOpen ?? false);
|
|
@@ -96,15 +94,45 @@ function SliderTip({ children, value, dragging, disabled, vertical, direction, o
|
|
|
96
94
|
})
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
function getPrecision(step) {
|
|
98
|
+
if (!step) return 0;
|
|
99
|
+
const str = String(step);
|
|
100
|
+
const dot = str.indexOf('.');
|
|
101
|
+
return dot >= 0 ? str.length - dot - 1 : 0;
|
|
102
|
+
}
|
|
103
|
+
function toArrayValue(raw, isRange, min) {
|
|
104
|
+
if (Array.isArray(raw)) return raw.length ? [
|
|
105
|
+
...raw
|
|
106
|
+
] : [
|
|
107
|
+
min,
|
|
108
|
+
min
|
|
109
|
+
];
|
|
110
|
+
if ('number' == typeof raw) return isRange ? [
|
|
111
|
+
min,
|
|
112
|
+
raw
|
|
113
|
+
] : [
|
|
114
|
+
raw
|
|
115
|
+
];
|
|
116
|
+
return isRange ? [
|
|
117
|
+
min,
|
|
118
|
+
min
|
|
119
|
+
] : [
|
|
120
|
+
min
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
function pickAt(value, index) {
|
|
124
|
+
return Array.isArray(value) ? value[index] : value;
|
|
125
|
+
}
|
|
102
126
|
const Slider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
103
|
-
const { prefixCls = 'tao-slider', classNames, styles, rootClassName, className, style, orientation, vertical = false, direction: directionProp, disabled, keyboard, tooltip = {}, handleRender, reverse, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy
|
|
127
|
+
const { prefixCls = 'tao-slider', classNames, styles, rootClassName, className, style, min = 0, max = 100, step = 1, marks, dots = false, included = true, orientation, vertical = false, direction: directionProp, disabled, keyboard = true, tooltip = {}, handleRender, reverse = false, range = false, tabIndex = 0, ariaLabelForHandle, ariaLabelledByForHandle, ariaDescribedByForHandle, ariaValueTextFormatterForHandle, onBeforeChange, onChange, onAfterChange, onChangeComplete, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy } = props;
|
|
104
128
|
const [direction, directionRef] = useTaoDirection(directionProp);
|
|
105
129
|
const config = useTaoConfig();
|
|
106
130
|
const resolvedDisabled = disabled ?? config.disabled;
|
|
107
131
|
const resolvedVertical = orientation ? 'vertical' === orientation : vertical;
|
|
132
|
+
const isRange = Boolean(range);
|
|
133
|
+
const editableRange = 'object' == typeof range && !!range.editable;
|
|
134
|
+
const minCount = 'object' == typeof range && void 0 !== range.minCount ? range.minCount : 0;
|
|
135
|
+
const effectiveReverse = 'rtl' !== direction || resolvedVertical ? reverse : !reverse;
|
|
108
136
|
const mergedProps = {
|
|
109
137
|
...props,
|
|
110
138
|
disabled: resolvedDisabled,
|
|
@@ -116,82 +144,339 @@ const Slider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
116
144
|
const semanticStyles = 'function' == typeof styles ? styles({
|
|
117
145
|
props: mergedProps
|
|
118
146
|
}) : styles;
|
|
119
|
-
const allDisabled = Array.isArray(resolvedDisabled) ? resolvedDisabled.every(Boolean) : resolvedDisabled;
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const
|
|
147
|
+
const allDisabled = Array.isArray(resolvedDisabled) ? resolvedDisabled.every(Boolean) : !!resolvedDisabled;
|
|
148
|
+
const controlled = 'value' in props && void 0 !== props.value;
|
|
149
|
+
const [innerValues, setInnerValues] = useState(()=>toArrayValue(props.defaultValue, isRange, min));
|
|
150
|
+
const values = controlled ? toArrayValue(props.value, isRange, min) : innerValues;
|
|
151
|
+
const valuesRef = useRef(values);
|
|
152
|
+
valuesRef.current = values;
|
|
153
|
+
const [draggingIndex, setDraggingIndex] = useState(null);
|
|
154
|
+
const keyDirty = useRef(false);
|
|
155
|
+
const railRef = useRef(null);
|
|
156
|
+
const handleRefs = useRef([]);
|
|
157
|
+
useImperativeHandle(ref, ()=>({
|
|
158
|
+
focus: ()=>handleRefs.current[0]?.focus(),
|
|
159
|
+
blur: ()=>{
|
|
160
|
+
for (const el of handleRefs.current)el?.blur();
|
|
161
|
+
}
|
|
162
|
+
}), []);
|
|
163
|
+
const markKeys = useMemo(()=>marks ? Object.keys(marks).map(Number).filter((n)=>!Number.isNaN(n) && n >= min && n <= max).sort((a, b)=>a - b) : [], [
|
|
164
|
+
marks,
|
|
165
|
+
min,
|
|
166
|
+
max
|
|
167
|
+
]);
|
|
168
|
+
const clampAndSnap = (raw)=>{
|
|
169
|
+
const clamped = Math.min(max, Math.max(min, raw));
|
|
170
|
+
if (null === step) {
|
|
171
|
+
if (!markKeys.length) return clamped;
|
|
172
|
+
return markKeys.reduce((best, candidate)=>Math.abs(candidate - clamped) < Math.abs(best - clamped) ? candidate : best);
|
|
173
|
+
}
|
|
174
|
+
const precision = getPrecision(step);
|
|
175
|
+
const snapped = Math.round((clamped - min) / step) * step + min;
|
|
176
|
+
const bounded = Math.min(max, Math.max(min, snapped));
|
|
177
|
+
return Number(bounded.toFixed(precision));
|
|
178
|
+
};
|
|
179
|
+
const emit = (cb, next)=>{
|
|
180
|
+
if (!cb) return;
|
|
181
|
+
cb(isRange ? [
|
|
182
|
+
...next
|
|
183
|
+
] : next[0]);
|
|
184
|
+
};
|
|
185
|
+
const updateValues = (next, options = {})=>{
|
|
186
|
+
const prev = valuesRef.current;
|
|
187
|
+
if (options.fireBefore) emit(onBeforeChange, prev);
|
|
188
|
+
const changed = next.length !== prev.length || next.some((v, i)=>v !== prev[i]);
|
|
189
|
+
if (!changed) return false;
|
|
190
|
+
if (!controlled) setInnerValues(next);
|
|
191
|
+
valuesRef.current = next;
|
|
192
|
+
emit(onChange, next);
|
|
193
|
+
if (options.fireComplete) {
|
|
194
|
+
emit(onAfterChange, next);
|
|
195
|
+
emit(onChangeComplete, next);
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
};
|
|
199
|
+
const isHandleDisabled = (index)=>Array.isArray(resolvedDisabled) ? !!resolvedDisabled[index] : !!resolvedDisabled;
|
|
200
|
+
const clientToValue = (clientX, clientY)=>{
|
|
201
|
+
const rect = railRef.current?.getBoundingClientRect();
|
|
202
|
+
if (!rect || (resolvedVertical ? rect.height : rect.width) <= 0) return min;
|
|
203
|
+
let ratio = resolvedVertical ? (rect.bottom - clientY) / rect.height : (clientX - rect.left) / rect.width;
|
|
204
|
+
if (effectiveReverse) ratio = 1 - ratio;
|
|
205
|
+
return clampAndSnap(min + ratio * (max - min));
|
|
206
|
+
};
|
|
207
|
+
const handleRailPointerDown = (event)=>{
|
|
208
|
+
if (allDisabled) return;
|
|
209
|
+
const targetVal = clientToValue(event.clientX, event.clientY);
|
|
210
|
+
let bestIdx = -1;
|
|
211
|
+
let bestDist = 1 / 0;
|
|
212
|
+
values.forEach((v, i)=>{
|
|
213
|
+
if (isHandleDisabled(i)) return;
|
|
214
|
+
const dist = Math.abs(v - targetVal);
|
|
215
|
+
if (dist < bestDist) {
|
|
216
|
+
bestDist = dist;
|
|
217
|
+
bestIdx = i;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
if (bestIdx < 0) return;
|
|
221
|
+
const next = [
|
|
222
|
+
...values
|
|
223
|
+
];
|
|
224
|
+
next[bestIdx] = targetVal;
|
|
225
|
+
if (isRange) next.sort((a, b)=>a - b);
|
|
226
|
+
setDraggingIndex(bestIdx);
|
|
227
|
+
updateValues(next, {
|
|
228
|
+
fireBefore: true
|
|
229
|
+
});
|
|
230
|
+
const onMove = (moveEvent)=>{
|
|
231
|
+
const movedVal = clientToValue(moveEvent.clientX, moveEvent.clientY);
|
|
232
|
+
const updated = [
|
|
233
|
+
...valuesRef.current
|
|
234
|
+
];
|
|
235
|
+
updated[bestIdx] = movedVal;
|
|
236
|
+
if (isRange) updated.sort((a, b)=>a - b);
|
|
237
|
+
updateValues(updated);
|
|
238
|
+
};
|
|
239
|
+
const onUp = ()=>{
|
|
240
|
+
setDraggingIndex(null);
|
|
241
|
+
emit(onAfterChange, valuesRef.current);
|
|
242
|
+
emit(onChangeComplete, valuesRef.current);
|
|
243
|
+
window.removeEventListener('pointermove', onMove);
|
|
244
|
+
window.removeEventListener('pointerup', onUp);
|
|
245
|
+
};
|
|
246
|
+
window.addEventListener('pointermove', onMove);
|
|
247
|
+
window.addEventListener('pointerup', onUp);
|
|
248
|
+
};
|
|
249
|
+
const stepFromValue = (current, deltaDir)=>{
|
|
250
|
+
if (null === step) {
|
|
251
|
+
if (!markKeys.length) return current;
|
|
252
|
+
const idx = markKeys.findIndex((k)=>k >= current);
|
|
253
|
+
if (deltaDir > 0) {
|
|
254
|
+
if (idx < 0) return markKeys[markKeys.length - 1];
|
|
255
|
+
return markKeys[idx] === current ? markKeys[Math.min(markKeys.length - 1, idx + 1)] ?? current : markKeys[idx];
|
|
256
|
+
}
|
|
257
|
+
const prevMark = [
|
|
258
|
+
...markKeys
|
|
259
|
+
].reverse().find((k)=>k < current);
|
|
260
|
+
return prevMark ?? markKeys[0];
|
|
261
|
+
}
|
|
262
|
+
return clampAndSnap(current + deltaDir * step);
|
|
263
|
+
};
|
|
264
|
+
const handleKeyDown = (event, index)=>{
|
|
265
|
+
if (isHandleDisabled(index) || false === keyboard) return;
|
|
266
|
+
const code = event.keyCode || event.which;
|
|
267
|
+
const key = event.key;
|
|
268
|
+
if (editableRange && ('Delete' === key || 'Backspace' === key || 46 === code || 8 === code)) {
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
if (values.length <= Math.max(1, minCount)) return;
|
|
271
|
+
const next = values.filter((_, i)=>i !== index);
|
|
272
|
+
updateValues(next, {
|
|
273
|
+
fireBefore: true,
|
|
274
|
+
fireComplete: true
|
|
275
|
+
});
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
let targetVal = null;
|
|
279
|
+
const dirFactor = effectiveReverse ? -1 : 1;
|
|
280
|
+
if ('ArrowRight' === key || 39 === code || 'ArrowUp' === key || 38 === code) {
|
|
281
|
+
const sign = 'ArrowUp' === key || 38 === code ? reverse ? -1 : 1 : dirFactor;
|
|
282
|
+
targetVal = stepFromValue(values[index], sign);
|
|
283
|
+
} else if ('ArrowLeft' === key || 37 === code || 'ArrowDown' === key || 40 === code) {
|
|
284
|
+
const sign = 'ArrowDown' === key || 40 === code ? reverse ? 1 : -1 : -dirFactor;
|
|
285
|
+
targetVal = stepFromValue(values[index], sign);
|
|
286
|
+
} else if ('Home' === key || 36 === code) targetVal = min;
|
|
287
|
+
else if ('End' === key || 35 === code) targetVal = max;
|
|
288
|
+
else if ('PageUp' === key || 33 === code) targetVal = clampAndSnap(values[index] + (step ?? 1) * 2);
|
|
289
|
+
else if ('PageDown' === key || 34 === code) targetVal = clampAndSnap(values[index] - (step ?? 1) * 2);
|
|
290
|
+
if (null === targetVal) return;
|
|
291
|
+
event.preventDefault();
|
|
292
|
+
const next = [
|
|
293
|
+
...values
|
|
294
|
+
];
|
|
295
|
+
next[index] = targetVal;
|
|
296
|
+
if (isRange) next.sort((a, b)=>a - b);
|
|
297
|
+
const didChange = updateValues(next, {
|
|
298
|
+
fireBefore: true
|
|
299
|
+
});
|
|
300
|
+
if (didChange) keyDirty.current = true;
|
|
301
|
+
};
|
|
302
|
+
const handleKeyUp = (index)=>{
|
|
303
|
+
if (isHandleDisabled(index) || false === keyboard || !keyDirty.current) return;
|
|
304
|
+
keyDirty.current = false;
|
|
305
|
+
emit(onAfterChange, valuesRef.current);
|
|
306
|
+
emit(onChangeComplete, valuesRef.current);
|
|
307
|
+
};
|
|
308
|
+
const toPercent = (v)=>max === min ? 0 : (v - min) / (max - min) * 100;
|
|
309
|
+
const trackStart = isRange ? Math.min(...values) : min;
|
|
310
|
+
const trackEnd = isRange ? Math.max(...values) : values[0] ?? min;
|
|
311
|
+
const startPct = toPercent(trackStart);
|
|
312
|
+
const endPct = toPercent(trackEnd);
|
|
313
|
+
const posStyle = (pct)=>resolvedVertical ? effectiveReverse ? {
|
|
314
|
+
top: `${pct}%`,
|
|
315
|
+
transform: 'translateY(-50%)'
|
|
316
|
+
} : {
|
|
317
|
+
bottom: `${pct}%`,
|
|
318
|
+
transform: 'translateY(50%)'
|
|
319
|
+
} : effectiveReverse ? {
|
|
320
|
+
right: `${pct}%`,
|
|
321
|
+
transform: 'translateX(50%)'
|
|
322
|
+
} : {
|
|
323
|
+
left: `${pct}%`,
|
|
324
|
+
transform: 'translateX(-50%)'
|
|
325
|
+
};
|
|
326
|
+
const trackStyle = resolvedVertical ? effectiveReverse ? {
|
|
327
|
+
top: `${startPct}%`,
|
|
328
|
+
height: `${endPct - startPct}%`
|
|
329
|
+
} : {
|
|
330
|
+
bottom: `${startPct}%`,
|
|
331
|
+
height: `${endPct - startPct}%`
|
|
332
|
+
} : effectiveReverse ? {
|
|
333
|
+
right: `${startPct}%`,
|
|
334
|
+
width: `${endPct - startPct}%`
|
|
335
|
+
} : {
|
|
336
|
+
left: `${startPct}%`,
|
|
337
|
+
width: `${endPct - startPct}%`
|
|
338
|
+
};
|
|
339
|
+
const dotPoints = useMemo(()=>{
|
|
340
|
+
if (dots && step && step > 0) {
|
|
341
|
+
const list = [];
|
|
342
|
+
for(let v = min; v <= max; v += step)list.push(v);
|
|
343
|
+
return list;
|
|
344
|
+
}
|
|
345
|
+
return markKeys;
|
|
346
|
+
}, [
|
|
347
|
+
dots,
|
|
348
|
+
markKeys,
|
|
349
|
+
max,
|
|
350
|
+
min,
|
|
351
|
+
step
|
|
352
|
+
]);
|
|
126
353
|
return /*#__PURE__*/ jsx("div", {
|
|
127
354
|
ref: directionRef,
|
|
128
355
|
"data-tao-slider": "",
|
|
129
356
|
"data-tao-vertical": resolvedVertical ? '' : void 0,
|
|
130
357
|
"data-tao-disabled": allDisabled ? '' : void 0,
|
|
131
358
|
dir: direction,
|
|
132
|
-
children: /*#__PURE__*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
prefixCls: prefixCls,
|
|
136
|
-
ariaLabelForHandle: engineProps.ariaLabelForHandle ?? ariaLabel,
|
|
137
|
-
ariaLabelledByForHandle: engineProps.ariaLabelledByForHandle ?? ariaLabelledBy,
|
|
138
|
-
ariaDescribedByForHandle: engineProps.ariaDescribedByForHandle ?? ariaDescribedBy,
|
|
139
|
-
disabled: resolvedDisabled,
|
|
140
|
-
keyboard: keyboard,
|
|
141
|
-
onBeforeChange: withValueSnapshot(engineProps.onBeforeChange),
|
|
142
|
-
onChange: editableRange ? (value)=>{
|
|
143
|
-
if (deletion.current && Array.isArray(value)) deletion.current.value = value;
|
|
144
|
-
onChange?.(value);
|
|
145
|
-
} : onChange,
|
|
146
|
-
onAfterChange: onAfterChange,
|
|
147
|
-
onChangeComplete: onChangeComplete,
|
|
148
|
-
vertical: resolvedVertical,
|
|
149
|
-
reverse: 'rtl' !== direction || resolvedVertical ? reverse : !reverse,
|
|
150
|
-
className: cx(classes?.root, rootClassName, className),
|
|
359
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
360
|
+
ref: railRef,
|
|
361
|
+
className: cx(prefixCls, resolvedVertical && `${prefixCls}-vertical`, allDisabled && `${prefixCls}-disabled`, marks && `${prefixCls}-with-marks`, classes?.root, rootClassName, className),
|
|
151
362
|
style: {
|
|
152
363
|
...semanticStyles?.root,
|
|
153
364
|
...style
|
|
154
365
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
onKeyUp: void 0
|
|
167
|
-
});
|
|
168
|
-
else if (editableRange) handle = /*#__PURE__*/ cloneElement(node, {
|
|
169
|
-
onKeyDown: (event)=>{
|
|
170
|
-
const keyCode = event.which || event.keyCode;
|
|
171
|
-
if (8 !== keyCode && 46 !== keyCode) return void node.props.onKeyDown?.(event);
|
|
172
|
-
const change = {};
|
|
173
|
-
deletion.current = change;
|
|
174
|
-
try {
|
|
175
|
-
node.props.onKeyDown?.(event);
|
|
176
|
-
} finally{
|
|
177
|
-
deletion.current = null;
|
|
178
|
-
}
|
|
179
|
-
if (change.value) {
|
|
180
|
-
onAfterChange?.(change.value);
|
|
181
|
-
onChangeComplete?.(change.value);
|
|
182
|
-
}
|
|
366
|
+
onPointerDown: handleRailPointerDown,
|
|
367
|
+
children: [
|
|
368
|
+
/*#__PURE__*/ jsx("div", {
|
|
369
|
+
className: cx(`${prefixCls}-rail`, 'tao-slider-rail-slot', classes?.rail),
|
|
370
|
+
style: semanticStyles?.rail
|
|
371
|
+
}),
|
|
372
|
+
included && /*#__PURE__*/ jsx("div", {
|
|
373
|
+
className: cx(`${prefixCls}-track`, 'tao-slider-track-slot', classes?.track),
|
|
374
|
+
style: {
|
|
375
|
+
...trackStyle,
|
|
376
|
+
...semanticStyles?.track
|
|
183
377
|
}
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
378
|
+
}),
|
|
379
|
+
dotPoints.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
380
|
+
className: `${prefixCls}-step`,
|
|
381
|
+
children: dotPoints.map((pt)=>{
|
|
382
|
+
const active = included && pt >= trackStart && pt <= trackEnd;
|
|
383
|
+
return /*#__PURE__*/ jsx("span", {
|
|
384
|
+
className: cx(`${prefixCls}-dot`, active && `${prefixCls}-dot-active`),
|
|
385
|
+
style: posStyle(toPercent(pt))
|
|
386
|
+
}, pt);
|
|
387
|
+
})
|
|
388
|
+
}),
|
|
389
|
+
values.map((val, index)=>{
|
|
390
|
+
const handleKey = `handle-${index}`;
|
|
391
|
+
const hDisabled = isHandleDisabled(index);
|
|
392
|
+
const hTabIndex = pickAt(tabIndex, index) ?? 0;
|
|
393
|
+
const label = pickAt(ariaLabelForHandle, index) ?? ariaLabel ?? void 0;
|
|
394
|
+
const labelledBy = pickAt(ariaLabelledByForHandle, index) ?? ariaLabelledBy ?? void 0;
|
|
395
|
+
const describedBy = pickAt(ariaDescribedByForHandle, index) ?? ariaDescribedBy ?? void 0;
|
|
396
|
+
const valueTextFn = pickAt(ariaValueTextFormatterForHandle, index);
|
|
397
|
+
const baseHandle = /*#__PURE__*/ jsx("div", {
|
|
398
|
+
ref: (el)=>{
|
|
399
|
+
handleRefs.current[index] = el;
|
|
400
|
+
},
|
|
401
|
+
role: "slider",
|
|
402
|
+
tabIndex: hDisabled ? void 0 : hTabIndex,
|
|
403
|
+
"aria-valuemin": min,
|
|
404
|
+
"aria-valuemax": max,
|
|
405
|
+
"aria-valuenow": val,
|
|
406
|
+
"aria-disabled": hDisabled,
|
|
407
|
+
"aria-orientation": resolvedVertical ? 'vertical' : 'horizontal',
|
|
408
|
+
"aria-label": label,
|
|
409
|
+
"aria-labelledby": labelledBy,
|
|
410
|
+
"aria-describedby": describedBy,
|
|
411
|
+
"aria-valuetext": valueTextFn ? valueTextFn(val) : void 0,
|
|
412
|
+
className: cx(`${prefixCls}-handle`, draggingIndex === index && `${prefixCls}-handle-dragging`, 'tao-slider-handle-slot', classes?.handle),
|
|
413
|
+
style: {
|
|
414
|
+
...posStyle(toPercent(val)),
|
|
415
|
+
...semanticStyles?.handle
|
|
416
|
+
},
|
|
417
|
+
onKeyDown: (event)=>handleKeyDown(event, index),
|
|
418
|
+
onKeyUp: ()=>handleKeyUp(index)
|
|
419
|
+
}, handleKey);
|
|
420
|
+
const info = {
|
|
421
|
+
value: val,
|
|
422
|
+
dragging: draggingIndex === index,
|
|
423
|
+
index
|
|
424
|
+
};
|
|
425
|
+
const node = handleRender ? handleRender(baseHandle, info) : baseHandle;
|
|
426
|
+
return /*#__PURE__*/ jsx(SliderTip, {
|
|
427
|
+
value: val,
|
|
428
|
+
dragging: draggingIndex === index,
|
|
429
|
+
disabled: hDisabled,
|
|
430
|
+
vertical: resolvedVertical,
|
|
431
|
+
direction: direction,
|
|
432
|
+
options: tooltip,
|
|
433
|
+
children: node
|
|
434
|
+
}, handleKey);
|
|
435
|
+
}),
|
|
436
|
+
marks && markKeys.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
437
|
+
className: `${prefixCls}-mark`,
|
|
438
|
+
children: markKeys.map((pt)=>{
|
|
439
|
+
const rawMark = marks[pt];
|
|
440
|
+
const isObj = 'object' == typeof rawMark && null !== rawMark && 'label' in rawMark;
|
|
441
|
+
const markLabel = isObj ? rawMark.label : rawMark;
|
|
442
|
+
const markStyle = isObj ? rawMark.style : void 0;
|
|
443
|
+
const active = included && pt >= trackStart && pt <= trackEnd;
|
|
444
|
+
return /*#__PURE__*/ jsx("span", {
|
|
445
|
+
className: cx(`${prefixCls}-mark-text`, active && `${prefixCls}-mark-text-active`),
|
|
446
|
+
style: {
|
|
447
|
+
...posStyle(toPercent(pt)),
|
|
448
|
+
...markStyle
|
|
449
|
+
},
|
|
450
|
+
onMouseDown: (event)=>event.stopPropagation(),
|
|
451
|
+
onClick: (event)=>{
|
|
452
|
+
event.stopPropagation();
|
|
453
|
+
if (allDisabled) return;
|
|
454
|
+
let bestIdx = 0;
|
|
455
|
+
let bestDist = 1 / 0;
|
|
456
|
+
values.forEach((v, i)=>{
|
|
457
|
+
if (isHandleDisabled(i)) return;
|
|
458
|
+
const d = Math.abs(v - pt);
|
|
459
|
+
if (d < bestDist) {
|
|
460
|
+
bestDist = d;
|
|
461
|
+
bestIdx = i;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
if (isHandleDisabled(bestIdx)) return;
|
|
465
|
+
const next = [
|
|
466
|
+
...values
|
|
467
|
+
];
|
|
468
|
+
next[bestIdx] = pt;
|
|
469
|
+
if (isRange) next.sort((a, b)=>a - b);
|
|
470
|
+
updateValues(next, {
|
|
471
|
+
fireBefore: true,
|
|
472
|
+
fireComplete: true
|
|
473
|
+
});
|
|
474
|
+
},
|
|
475
|
+
children: markLabel
|
|
476
|
+
}, pt);
|
|
477
|
+
})
|
|
478
|
+
})
|
|
479
|
+
]
|
|
195
480
|
})
|
|
196
481
|
});
|
|
197
482
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Sonner,
|
|
1
|
+
export { Sonner, type SonnerAction, type SonnerPosition, type SonnerPromiseMessages, type SonnerProps, type SonnerSemanticPart, type SonnerToastItem, type SonnerToastOptions, type SonnerType, toast, } from './sonner.js';
|