@rockshin/tao-ui 0.0.60 → 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 +28 -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.js +418 -982
- package/dist/components/context-menu/context-menu.css +4 -4
- package/dist/components/context-menu/context-menu.d.ts +1 -1
- package/dist/components/context-menu/context-menu.js +52 -138
- 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 +81 -210
- 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 +93 -104
- 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 +217 -252
- 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 -31
- package/dist/components/dropdown/dropdown.js +90 -276
- 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 +36 -47
- 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 -67
- 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 +2 -1
- package/dist/components/input-number/input-number.js +30 -152
- 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 +288 -73
- package/dist/components/menu/menu-render.d.ts +2 -1
- package/dist/components/menu/menu-render.js +149 -307
- package/dist/components/menu/menu.css +142 -140
- package/dist/components/modal/confirm-dialog.js +8 -18
- 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 +1 -1
- package/dist/components/pagination/pagination.js +137 -290
- 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 +168 -275
- 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-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 -269
- 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 -413
- 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 +1 -1
- package/dist/components/table/table-filter.js +68 -155
- 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 +85 -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 +1 -1
- package/dist/components/tabs/tabs.js +156 -331
- 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 +88 -220
- 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.js +105 -215
- 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 +11 -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.js +42 -42
- 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 -378
- package/dist/theme/control.css +106 -126
- package/dist/theme/theme.css +2 -0
- 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,644 +1,365 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react-compiler-runtime";
|
|
3
2
|
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
4
|
-
import tour from "@rc-component/tour";
|
|
5
|
-
import { getPlacements } from "@rc-component/tour/es/placements";
|
|
6
3
|
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
7
|
-
import {
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { useTaoInternalConfig } from "../../provider/tao-context.js";
|
|
6
|
+
import { TaoPortalScope } from "../../provider/tao-portal-scope.js";
|
|
8
7
|
import { cx } from "../../utils/semantic.js";
|
|
9
8
|
import { Button } from "../button/button.js";
|
|
10
9
|
import { CloseIcon } from "../select/select-icons.js";
|
|
11
10
|
import "./tour.css";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
function resolveTarget(target) {
|
|
12
|
+
if (!target) return null;
|
|
13
|
+
return 'function' == typeof target ? target() : target;
|
|
14
|
+
}
|
|
15
|
+
function computePopupPosition(rect, placement) {
|
|
16
|
+
if (!rect || 'center' === placement) return {
|
|
17
|
+
position: 'fixed',
|
|
18
|
+
top: '50%',
|
|
19
|
+
left: '50%',
|
|
20
|
+
transform: 'translate(-50%, -50%)'
|
|
21
|
+
};
|
|
22
|
+
const gap = 12;
|
|
23
|
+
if (placement.startsWith('top')) return {
|
|
24
|
+
position: 'fixed',
|
|
25
|
+
top: Math.max(12, rect.top - gap),
|
|
26
|
+
left: Math.max(12, rect.left + rect.width / 2),
|
|
27
|
+
transform: 'translate(-50%, -100%)'
|
|
28
|
+
};
|
|
29
|
+
if (placement.startsWith('left')) return {
|
|
30
|
+
position: 'fixed',
|
|
31
|
+
top: Math.max(12, rect.top + rect.height / 2),
|
|
32
|
+
left: Math.max(12, rect.left - gap),
|
|
33
|
+
transform: 'translate(-100%, -50%)'
|
|
34
|
+
};
|
|
35
|
+
if (placement.startsWith('right')) return {
|
|
36
|
+
position: 'fixed',
|
|
37
|
+
top: Math.max(12, rect.top + rect.height / 2),
|
|
38
|
+
left: rect.right + gap,
|
|
39
|
+
transform: 'translate(0, -50%)'
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
position: 'fixed',
|
|
43
|
+
top: rect.bottom + gap,
|
|
44
|
+
left: Math.max(12, rect.left + rect.width / 2),
|
|
45
|
+
transform: 'translate(-50%, 0)'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function TourPanel({ step, current, total, type, globalClosable, globalCloseIcon, indicatorsRender, actionsRender, classes, styles, masked, disabledInteraction, onPrev, onNext, onFinish, onClose }) {
|
|
49
|
+
const { locale } = useTaoInternalConfig();
|
|
18
50
|
const titleId = useId();
|
|
19
51
|
const descriptionId = useId();
|
|
20
52
|
const panelRef = useRef(null);
|
|
21
53
|
const [hasTarget, setHasTarget] = useState(false);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
$[0] = disabledInteraction;
|
|
31
|
-
$[1] = hasTarget;
|
|
32
|
-
$[2] = masked;
|
|
33
|
-
$[3] = step;
|
|
34
|
-
$[4] = t1;
|
|
35
|
-
} else t1 = $[4];
|
|
36
|
-
useLayoutEffect(t1);
|
|
54
|
+
useLayoutEffect(()=>{
|
|
55
|
+
if (!masked || disabledInteraction) {
|
|
56
|
+
if (hasTarget) setHasTarget(false);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const available = Boolean(resolveTarget(step.target));
|
|
60
|
+
if (available !== hasTarget) setHasTarget(available);
|
|
61
|
+
});
|
|
37
62
|
const modal = masked && (disabledInteraction || !hasTarget);
|
|
38
|
-
const {
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
let t7;
|
|
84
|
-
let t8;
|
|
85
|
-
if ($[16] !== compact || $[17] !== mode || $[18] !== tokenStyle) {
|
|
86
|
-
t7 = ()=>{
|
|
87
|
-
const popup = panelRef.current.parentElement;
|
|
88
|
-
popup.dataset.taoTourPopup = "";
|
|
89
|
-
popup.dataset.taoProvider = "";
|
|
90
|
-
if ("light" === mode) delete popup.dataset.taoTheme;
|
|
91
|
-
else popup.dataset.taoTheme = mode;
|
|
92
|
-
if (compact) popup.dataset.taoDensity = "compact";
|
|
93
|
-
else delete popup.dataset.taoDensity;
|
|
94
|
-
for (const [name, value] of Object.entries(tokenStyle ?? {}))popup.style.setProperty(name, String(value));
|
|
95
|
-
};
|
|
96
|
-
t8 = [
|
|
97
|
-
mode,
|
|
98
|
-
compact,
|
|
99
|
-
tokenStyle
|
|
100
|
-
];
|
|
101
|
-
$[16] = compact;
|
|
102
|
-
$[17] = mode;
|
|
103
|
-
$[18] = tokenStyle;
|
|
104
|
-
$[19] = t7;
|
|
105
|
-
$[20] = t8;
|
|
106
|
-
} else {
|
|
107
|
-
t7 = $[19];
|
|
108
|
-
t8 = $[20];
|
|
109
|
-
}
|
|
110
|
-
useEffect(t7, t8);
|
|
111
|
-
let t9;
|
|
112
|
-
if ($[21] !== current || $[22] !== locale || $[23] !== prevButtonProps || $[24] !== primary || $[25] !== step || $[26] !== stepActions) {
|
|
113
|
-
t9 = current > 0 && /*#__PURE__*/ jsx(Button, {
|
|
114
|
-
size: "small",
|
|
115
|
-
variant: primary ? "ghost" : "secondary",
|
|
116
|
-
...prevButtonProps,
|
|
117
|
-
onClick: (event)=>{
|
|
118
|
-
prevButtonProps?.onClick?.(event);
|
|
119
|
-
if (event.defaultPrevented) return;
|
|
120
|
-
stepActions?.onPrev?.();
|
|
121
|
-
step.onPrev?.();
|
|
122
|
-
},
|
|
123
|
-
children: prevButtonProps?.children ?? locale.previous
|
|
124
|
-
});
|
|
125
|
-
$[21] = current;
|
|
126
|
-
$[22] = locale;
|
|
127
|
-
$[23] = prevButtonProps;
|
|
128
|
-
$[24] = primary;
|
|
129
|
-
$[25] = step;
|
|
130
|
-
$[26] = stepActions;
|
|
131
|
-
$[27] = t9;
|
|
132
|
-
} else t9 = $[27];
|
|
133
|
-
const t10 = primary ? "secondary" : "primary";
|
|
134
|
-
let t11;
|
|
135
|
-
if ($[28] !== last || $[29] !== nextButtonProps || $[30] !== step || $[31] !== stepActions) {
|
|
136
|
-
t11 = (event_0)=>{
|
|
137
|
-
nextButtonProps?.onClick?.(event_0);
|
|
138
|
-
if (event_0.defaultPrevented) return;
|
|
139
|
-
if (last) {
|
|
140
|
-
stepActions?.onFinish?.();
|
|
141
|
-
step.onFinish?.();
|
|
142
|
-
} else {
|
|
143
|
-
stepActions?.onNext?.();
|
|
144
|
-
step.onNext?.();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
$[28] = last;
|
|
148
|
-
$[29] = nextButtonProps;
|
|
149
|
-
$[30] = step;
|
|
150
|
-
$[31] = stepActions;
|
|
151
|
-
$[32] = t11;
|
|
152
|
-
} else t11 = $[32];
|
|
153
|
-
const t12 = nextButtonProps?.children ?? (last ? locale.done : locale.next);
|
|
154
|
-
let t13;
|
|
155
|
-
if ($[33] !== nextButtonProps || $[34] !== t10 || $[35] !== t11 || $[36] !== t12) {
|
|
156
|
-
t13 = /*#__PURE__*/ jsx(Button, {
|
|
157
|
-
size: "small",
|
|
158
|
-
variant: t10,
|
|
159
|
-
...nextButtonProps,
|
|
160
|
-
onClick: t11,
|
|
161
|
-
children: t12
|
|
162
|
-
});
|
|
163
|
-
$[33] = nextButtonProps;
|
|
164
|
-
$[34] = t10;
|
|
165
|
-
$[35] = t11;
|
|
166
|
-
$[36] = t12;
|
|
167
|
-
$[37] = t13;
|
|
168
|
-
} else t13 = $[37];
|
|
169
|
-
let t14;
|
|
170
|
-
if ($[38] !== t13 || $[39] !== t9) {
|
|
171
|
-
t14 = /*#__PURE__*/ jsxs(Fragment, {
|
|
172
|
-
children: [
|
|
173
|
-
t9,
|
|
174
|
-
t13
|
|
175
|
-
]
|
|
176
|
-
});
|
|
177
|
-
$[38] = t13;
|
|
178
|
-
$[39] = t9;
|
|
179
|
-
$[40] = t14;
|
|
180
|
-
} else t14 = $[40];
|
|
181
|
-
const actions = t14;
|
|
182
|
-
let t15;
|
|
183
|
-
if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
|
|
184
|
-
t15 = (event_1)=>{
|
|
185
|
-
event_1.preventDefault();
|
|
186
|
-
panelRef.current?.focus();
|
|
187
|
-
};
|
|
188
|
-
$[41] = t15;
|
|
189
|
-
} else t15 = $[41];
|
|
190
|
-
const t16 = primary ? "primary" : "default";
|
|
191
|
-
const t17 = modal || void 0;
|
|
192
|
-
const t18 = null != title ? titleId : void 0;
|
|
193
|
-
const t19 = null != description ? descriptionId : void 0;
|
|
194
|
-
let t20;
|
|
195
|
-
if ($[42] !== closable || $[43] !== closeAttrs || $[44] !== closeIcon || $[45] !== cn.close || $[46] !== locale || $[47] !== st.close || $[48] !== step || $[49] !== stepActions) {
|
|
196
|
-
t20 = closable && /*#__PURE__*/ jsx("button", {
|
|
197
|
-
type: "button",
|
|
198
|
-
"data-tao-tour-close": "",
|
|
199
|
-
"aria-label": locale.close,
|
|
200
|
-
...closeAttrs,
|
|
201
|
-
className: cn.close,
|
|
202
|
-
style: st.close,
|
|
203
|
-
onClick: ()=>{
|
|
204
|
-
stepActions?.onClose?.();
|
|
205
|
-
step.onClose?.();
|
|
206
|
-
},
|
|
207
|
-
children: closeIcon ?? step.closeIcon ?? /*#__PURE__*/ jsx(CloseIcon, {})
|
|
208
|
-
});
|
|
209
|
-
$[42] = closable;
|
|
210
|
-
$[43] = closeAttrs;
|
|
211
|
-
$[44] = closeIcon;
|
|
212
|
-
$[45] = cn.close;
|
|
213
|
-
$[46] = locale;
|
|
214
|
-
$[47] = st.close;
|
|
215
|
-
$[48] = step;
|
|
216
|
-
$[49] = stepActions;
|
|
217
|
-
$[50] = t20;
|
|
218
|
-
} else t20 = $[50];
|
|
219
|
-
let t21;
|
|
220
|
-
if ($[51] !== cn.cover || $[52] !== cover || $[53] !== st.cover) {
|
|
221
|
-
t21 = null != cover && /*#__PURE__*/ jsx("div", {
|
|
222
|
-
"data-tao-tour-cover": "",
|
|
223
|
-
className: cn.cover,
|
|
224
|
-
style: st.cover,
|
|
225
|
-
children: cover
|
|
226
|
-
});
|
|
227
|
-
$[51] = cn.cover;
|
|
228
|
-
$[52] = cover;
|
|
229
|
-
$[53] = st.cover;
|
|
230
|
-
$[54] = t21;
|
|
231
|
-
} else t21 = $[54];
|
|
232
|
-
let t22;
|
|
233
|
-
if ($[55] !== cn.header || $[56] !== cn.title || $[57] !== st.header || $[58] !== st.title || $[59] !== title || $[60] !== titleId) {
|
|
234
|
-
t22 = null != title && /*#__PURE__*/ jsx("div", {
|
|
235
|
-
"data-tao-tour-header": "",
|
|
236
|
-
className: cn.header,
|
|
237
|
-
style: st.header,
|
|
238
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
239
|
-
id: titleId,
|
|
240
|
-
"data-tao-tour-title": "",
|
|
241
|
-
className: cn.title,
|
|
242
|
-
style: st.title,
|
|
243
|
-
children: title
|
|
63
|
+
const { title, description, cover, nextButtonProps, prevButtonProps } = step;
|
|
64
|
+
const closable = step.closable ?? globalClosable;
|
|
65
|
+
const cn = {
|
|
66
|
+
...classes,
|
|
67
|
+
...step.classNames
|
|
68
|
+
};
|
|
69
|
+
const st = {
|
|
70
|
+
...styles,
|
|
71
|
+
...step.styles
|
|
72
|
+
};
|
|
73
|
+
const primary = (step.type ?? type) === 'primary';
|
|
74
|
+
const last = current >= total - 1;
|
|
75
|
+
const closeProps = closable && 'object' == typeof closable ? closable : {};
|
|
76
|
+
const { closeIcon, ...closeAttrs } = closeProps;
|
|
77
|
+
const actions = /*#__PURE__*/ jsxs(Fragment, {
|
|
78
|
+
children: [
|
|
79
|
+
current > 0 && /*#__PURE__*/ jsx(Button, {
|
|
80
|
+
size: "small",
|
|
81
|
+
variant: primary ? 'ghost' : 'secondary',
|
|
82
|
+
...prevButtonProps,
|
|
83
|
+
onClick: (event)=>{
|
|
84
|
+
prevButtonProps?.onClick?.(event);
|
|
85
|
+
if (event.defaultPrevented) return;
|
|
86
|
+
step.onPrev?.();
|
|
87
|
+
onPrev();
|
|
88
|
+
},
|
|
89
|
+
children: prevButtonProps?.children ?? locale.previous
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ jsx(Button, {
|
|
92
|
+
size: "small",
|
|
93
|
+
variant: primary ? 'secondary' : 'primary',
|
|
94
|
+
...nextButtonProps,
|
|
95
|
+
onClick: (event)=>{
|
|
96
|
+
nextButtonProps?.onClick?.(event);
|
|
97
|
+
if (event.defaultPrevented) return;
|
|
98
|
+
if (last) {
|
|
99
|
+
step.onFinish?.();
|
|
100
|
+
onFinish();
|
|
101
|
+
} else {
|
|
102
|
+
step.onNext?.();
|
|
103
|
+
onNext();
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
children: nextButtonProps?.children ?? (last ? locale.done : locale.next)
|
|
244
107
|
})
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
$[59] = title;
|
|
251
|
-
$[60] = titleId;
|
|
252
|
-
$[61] = t22;
|
|
253
|
-
} else t22 = $[61];
|
|
254
|
-
let t23;
|
|
255
|
-
if ($[62] !== cn.description || $[63] !== description || $[64] !== descriptionId || $[65] !== st.description) {
|
|
256
|
-
t23 = null != description && /*#__PURE__*/ jsx("div", {
|
|
257
|
-
id: descriptionId,
|
|
258
|
-
"data-tao-tour-description": "",
|
|
259
|
-
className: cn.description,
|
|
260
|
-
style: st.description,
|
|
261
|
-
children: description
|
|
262
|
-
});
|
|
263
|
-
$[62] = cn.description;
|
|
264
|
-
$[63] = description;
|
|
265
|
-
$[64] = descriptionId;
|
|
266
|
-
$[65] = st.description;
|
|
267
|
-
$[66] = t23;
|
|
268
|
-
} else t23 = $[66];
|
|
269
|
-
let t24;
|
|
270
|
-
if ($[67] !== cn.indicator || $[68] !== cn.indicators || $[69] !== current || $[70] !== indicatorsRender || $[71] !== st.indicator || $[72] !== st.indicators || $[73] !== total) {
|
|
271
|
-
t24 = total > 1 && /*#__PURE__*/ jsx("div", {
|
|
272
|
-
"data-tao-tour-indicators": "",
|
|
273
|
-
className: cn.indicators,
|
|
274
|
-
style: st.indicators,
|
|
275
|
-
children: indicatorsRender ? indicatorsRender(current, total) : Array.from({
|
|
276
|
-
length: total
|
|
277
|
-
}, _temp).map((stepIndex)=>/*#__PURE__*/ jsx("span", {
|
|
278
|
-
"data-tao-tour-indicator": "",
|
|
279
|
-
"data-active": stepIndex === current || void 0,
|
|
280
|
-
className: cn.indicator,
|
|
281
|
-
style: st.indicator
|
|
282
|
-
}, stepIndex))
|
|
283
|
-
});
|
|
284
|
-
$[67] = cn.indicator;
|
|
285
|
-
$[68] = cn.indicators;
|
|
286
|
-
$[69] = current;
|
|
287
|
-
$[70] = indicatorsRender;
|
|
288
|
-
$[71] = st.indicator;
|
|
289
|
-
$[72] = st.indicators;
|
|
290
|
-
$[73] = total;
|
|
291
|
-
$[74] = t24;
|
|
292
|
-
} else t24 = $[74];
|
|
293
|
-
let t25;
|
|
294
|
-
if ($[75] !== actions || $[76] !== actionsRender || $[77] !== current || $[78] !== total) {
|
|
295
|
-
t25 = actionsRender ? actionsRender(actions, {
|
|
296
|
-
current,
|
|
297
|
-
total
|
|
298
|
-
}) : actions;
|
|
299
|
-
$[75] = actions;
|
|
300
|
-
$[76] = actionsRender;
|
|
301
|
-
$[77] = current;
|
|
302
|
-
$[78] = total;
|
|
303
|
-
$[79] = t25;
|
|
304
|
-
} else t25 = $[79];
|
|
305
|
-
let t26;
|
|
306
|
-
if ($[80] !== cn.actions || $[81] !== st.actions || $[82] !== t25) {
|
|
307
|
-
t26 = /*#__PURE__*/ jsx("div", {
|
|
308
|
-
"data-tao-tour-actions": "",
|
|
309
|
-
className: cn.actions,
|
|
310
|
-
style: st.actions,
|
|
311
|
-
children: t25
|
|
312
|
-
});
|
|
313
|
-
$[80] = cn.actions;
|
|
314
|
-
$[81] = st.actions;
|
|
315
|
-
$[82] = t25;
|
|
316
|
-
$[83] = t26;
|
|
317
|
-
} else t26 = $[83];
|
|
318
|
-
let t27;
|
|
319
|
-
if ($[84] !== cn.footer || $[85] !== st.footer || $[86] !== t24 || $[87] !== t26) {
|
|
320
|
-
t27 = /*#__PURE__*/ jsxs("div", {
|
|
321
|
-
"data-tao-tour-footer": "",
|
|
322
|
-
className: cn.footer,
|
|
323
|
-
style: st.footer,
|
|
324
|
-
children: [
|
|
325
|
-
t24,
|
|
326
|
-
t26
|
|
327
|
-
]
|
|
328
|
-
});
|
|
329
|
-
$[84] = cn.footer;
|
|
330
|
-
$[85] = st.footer;
|
|
331
|
-
$[86] = t24;
|
|
332
|
-
$[87] = t26;
|
|
333
|
-
$[88] = t27;
|
|
334
|
-
} else t27 = $[88];
|
|
335
|
-
let t28;
|
|
336
|
-
if ($[89] !== cn.section || $[90] !== st.section || $[91] !== t20 || $[92] !== t21 || $[93] !== t22 || $[94] !== t23 || $[95] !== t27) {
|
|
337
|
-
t28 = /*#__PURE__*/ jsxs("div", {
|
|
338
|
-
"data-tao-tour-section": "",
|
|
339
|
-
className: cn.section,
|
|
340
|
-
style: st.section,
|
|
341
|
-
children: [
|
|
342
|
-
t20,
|
|
343
|
-
t21,
|
|
344
|
-
t22,
|
|
345
|
-
t23,
|
|
346
|
-
t27
|
|
347
|
-
]
|
|
348
|
-
});
|
|
349
|
-
$[89] = cn.section;
|
|
350
|
-
$[90] = st.section;
|
|
351
|
-
$[91] = t20;
|
|
352
|
-
$[92] = t21;
|
|
353
|
-
$[93] = t22;
|
|
354
|
-
$[94] = t23;
|
|
355
|
-
$[95] = t27;
|
|
356
|
-
$[96] = t28;
|
|
357
|
-
} else t28 = $[96];
|
|
358
|
-
let t29;
|
|
359
|
-
if ($[97] !== cn.root || $[98] !== st.root || $[99] !== t16 || $[100] !== t17 || $[101] !== t18 || $[102] !== t19 || $[103] !== t28) {
|
|
360
|
-
t29 = /*#__PURE__*/ jsx("div", {
|
|
361
|
-
ref: panelRef,
|
|
362
|
-
"data-tao-tour": "",
|
|
363
|
-
"data-type": t16,
|
|
364
|
-
role: "dialog",
|
|
365
|
-
"aria-modal": t17,
|
|
366
|
-
"aria-labelledby": t18,
|
|
367
|
-
"aria-describedby": t19,
|
|
368
|
-
tabIndex: -1,
|
|
369
|
-
className: cn.root,
|
|
370
|
-
style: st.root,
|
|
371
|
-
children: t28
|
|
372
|
-
});
|
|
373
|
-
$[97] = cn.root;
|
|
374
|
-
$[98] = st.root;
|
|
375
|
-
$[99] = t16;
|
|
376
|
-
$[100] = t17;
|
|
377
|
-
$[101] = t18;
|
|
378
|
-
$[102] = t19;
|
|
379
|
-
$[103] = t28;
|
|
380
|
-
$[104] = t29;
|
|
381
|
-
} else t29 = $[104];
|
|
382
|
-
let t30;
|
|
383
|
-
if ($[105] !== modal || $[106] !== t29) {
|
|
384
|
-
t30 = /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
return /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
111
|
+
asChild: true,
|
|
112
|
+
children: /*#__PURE__*/ jsx(FocusScope, {
|
|
385
113
|
asChild: true,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
114
|
+
trapped: modal,
|
|
115
|
+
loop: modal,
|
|
116
|
+
onMountAutoFocus: (event)=>{
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
panelRef.current?.focus();
|
|
119
|
+
},
|
|
120
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
121
|
+
ref: panelRef,
|
|
122
|
+
"data-tao-tour": "",
|
|
123
|
+
"data-type": primary ? 'primary' : 'default',
|
|
124
|
+
role: "dialog",
|
|
125
|
+
"aria-modal": modal || void 0,
|
|
126
|
+
"aria-labelledby": null != title ? titleId : void 0,
|
|
127
|
+
"aria-describedby": null != description ? descriptionId : void 0,
|
|
128
|
+
tabIndex: -1,
|
|
129
|
+
className: cn.root,
|
|
130
|
+
style: st.root,
|
|
131
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
132
|
+
"data-tao-tour-section": "",
|
|
133
|
+
className: cn.section,
|
|
134
|
+
style: st.section,
|
|
135
|
+
children: [
|
|
136
|
+
closable && /*#__PURE__*/ jsx("button", {
|
|
137
|
+
type: "button",
|
|
138
|
+
"data-tao-tour-close": "",
|
|
139
|
+
"aria-label": closeAttrs['aria-label'] ?? locale.close,
|
|
140
|
+
...closeAttrs,
|
|
141
|
+
className: cn.close,
|
|
142
|
+
style: st.close,
|
|
143
|
+
onClick: ()=>{
|
|
144
|
+
step.onClose?.();
|
|
145
|
+
onClose();
|
|
146
|
+
},
|
|
147
|
+
children: closeIcon ?? step.closeIcon ?? globalCloseIcon ?? /*#__PURE__*/ jsx(CloseIcon, {})
|
|
148
|
+
}),
|
|
149
|
+
null != cover && /*#__PURE__*/ jsx("div", {
|
|
150
|
+
"data-tao-tour-cover": "",
|
|
151
|
+
className: cn.cover,
|
|
152
|
+
style: st.cover,
|
|
153
|
+
children: cover
|
|
154
|
+
}),
|
|
155
|
+
null != title && /*#__PURE__*/ jsx("div", {
|
|
156
|
+
"data-tao-tour-header": "",
|
|
157
|
+
className: cn.header,
|
|
158
|
+
style: st.header,
|
|
159
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
160
|
+
id: titleId,
|
|
161
|
+
"data-tao-tour-title": "",
|
|
162
|
+
className: cn.title,
|
|
163
|
+
style: st.title,
|
|
164
|
+
children: title
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
null != description && /*#__PURE__*/ jsx("div", {
|
|
168
|
+
id: descriptionId,
|
|
169
|
+
"data-tao-tour-description": "",
|
|
170
|
+
className: cn.description,
|
|
171
|
+
style: st.description,
|
|
172
|
+
children: description
|
|
173
|
+
}),
|
|
174
|
+
/*#__PURE__*/ jsxs("div", {
|
|
175
|
+
"data-tao-tour-footer": "",
|
|
176
|
+
className: cn.footer,
|
|
177
|
+
style: st.footer,
|
|
178
|
+
children: [
|
|
179
|
+
total > 1 && /*#__PURE__*/ jsx("div", {
|
|
180
|
+
"data-tao-tour-indicators": "",
|
|
181
|
+
className: cn.indicators,
|
|
182
|
+
style: st.indicators,
|
|
183
|
+
children: indicatorsRender ? indicatorsRender(current, total) : Array.from({
|
|
184
|
+
length: total
|
|
185
|
+
}, (_, index)=>index).map((stepIndex)=>/*#__PURE__*/ jsx("span", {
|
|
186
|
+
"data-tao-tour-indicator": "",
|
|
187
|
+
"data-active": stepIndex === current || void 0,
|
|
188
|
+
className: cn.indicator,
|
|
189
|
+
style: st.indicator
|
|
190
|
+
}, stepIndex))
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ jsx("div", {
|
|
193
|
+
"data-tao-tour-actions": "",
|
|
194
|
+
className: cn.actions,
|
|
195
|
+
style: st.actions,
|
|
196
|
+
children: actionsRender ? actionsRender(actions, {
|
|
197
|
+
current,
|
|
198
|
+
total
|
|
199
|
+
}) : actions
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
})
|
|
392
205
|
})
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
$[106] = t29;
|
|
396
|
-
$[107] = t30;
|
|
397
|
-
} else t30 = $[107];
|
|
398
|
-
return t30;
|
|
399
|
-
}
|
|
400
|
-
function _temp(_, index) {
|
|
401
|
-
return index;
|
|
206
|
+
})
|
|
207
|
+
});
|
|
402
208
|
}
|
|
403
209
|
function Tour(props) {
|
|
404
|
-
const $ = c(71);
|
|
405
210
|
const { tokenStyle } = useTaoInternalConfig();
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
({
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
if ($[22] !== props || $[23] !== styles) {
|
|
481
|
-
t5 = "function" == typeof styles ? styles({
|
|
482
|
-
props
|
|
483
|
-
}) : styles;
|
|
484
|
-
$[22] = props;
|
|
485
|
-
$[23] = styles;
|
|
486
|
-
$[24] = t5;
|
|
487
|
-
} else t5 = $[24];
|
|
488
|
-
const st = t5;
|
|
489
|
-
const layer = zIndex ?? "calc(var(--tao-z-index-base) + var(--tao-z-index-popup-base) + 170)";
|
|
490
|
-
let t6;
|
|
491
|
-
if ($[25] !== className || $[26] !== layer || $[27] !== props.scrollIntoViewOptions || $[28] !== steps || $[29] !== style || $[30] !== tokenStyle) {
|
|
492
|
-
let t7;
|
|
493
|
-
if ($[32] !== className || $[33] !== layer || $[34] !== props.scrollIntoViewOptions || $[35] !== style || $[36] !== tokenStyle) {
|
|
494
|
-
t7 = (t8)=>{
|
|
495
|
-
const { onClose: _close, onFinish: _finish, onNext: _next, onPrev: _prev, ...step } = t8;
|
|
496
|
-
return {
|
|
497
|
-
...step,
|
|
498
|
-
scrollIntoViewOptions: step.scrollIntoViewOptions ?? props.scrollIntoViewOptions,
|
|
211
|
+
const { steps = [], type, indicatorsRender, actionsRender, classNames, styles, className, style, prefixCls = 'tao-tour', rootClassName, keyboard = true, zIndex, open, defaultOpen = false, current: controlledCurrent, defaultCurrent = 0, onChange, onClose, onFinish, placement: globalPlacement = 'bottom', mask: globalMask = true, closable = true, closeIcon, disabledInteraction, scrollIntoViewOptions = true, getPopupContainer } = props;
|
|
212
|
+
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
213
|
+
const isOpen = void 0 !== open ? open : innerOpen;
|
|
214
|
+
const [innerCurrent, setInnerCurrent] = useState(defaultCurrent);
|
|
215
|
+
const current = void 0 !== controlledCurrent ? controlledCurrent : innerCurrent;
|
|
216
|
+
const safeCurrent = Math.min(Math.max(0, current), Math.max(0, steps.length - 1));
|
|
217
|
+
const step = steps[safeCurrent];
|
|
218
|
+
const [targetRect, setTargetRect] = useState(null);
|
|
219
|
+
const maskId = useId();
|
|
220
|
+
useLayoutEffect(()=>{
|
|
221
|
+
if (!isOpen || !step) return void setTargetRect(null);
|
|
222
|
+
const target = resolveTarget(step.target);
|
|
223
|
+
if (!target) return void setTargetRect(null);
|
|
224
|
+
const rect = target.getBoundingClientRect();
|
|
225
|
+
const offscreen = rect.bottom < 0 || rect.top > window.innerHeight || rect.right < 0 || rect.left > window.innerWidth;
|
|
226
|
+
const scrollOpt = void 0 !== step.scrollIntoViewOptions ? step.scrollIntoViewOptions : scrollIntoViewOptions;
|
|
227
|
+
if (offscreen && false !== scrollOpt && 'function' == typeof target.scrollIntoView) if ('object' == typeof scrollOpt) target.scrollIntoView(scrollOpt);
|
|
228
|
+
else target.scrollIntoView({
|
|
229
|
+
block: 'center',
|
|
230
|
+
inline: 'nearest'
|
|
231
|
+
});
|
|
232
|
+
setTargetRect(target.getBoundingClientRect());
|
|
233
|
+
}, [
|
|
234
|
+
isOpen,
|
|
235
|
+
step,
|
|
236
|
+
scrollIntoViewOptions
|
|
237
|
+
]);
|
|
238
|
+
const dismiss = ()=>{
|
|
239
|
+
if (void 0 === open) setInnerOpen(false);
|
|
240
|
+
onClose?.(safeCurrent);
|
|
241
|
+
};
|
|
242
|
+
const goTo = (next)=>{
|
|
243
|
+
if (void 0 === controlledCurrent) setInnerCurrent(next);
|
|
244
|
+
onChange?.(next);
|
|
245
|
+
};
|
|
246
|
+
useEffect(()=>{
|
|
247
|
+
if (!isOpen || !keyboard) return;
|
|
248
|
+
const handleKeyDown = (event)=>{
|
|
249
|
+
if ('Escape' === event.key || 27 === event.keyCode) dismiss();
|
|
250
|
+
else if (('ArrowRight' === event.key || 39 === event.keyCode) && safeCurrent < steps.length - 1) goTo(safeCurrent + 1);
|
|
251
|
+
else if (('ArrowLeft' === event.key || 37 === event.keyCode) && safeCurrent > 0) goTo(safeCurrent - 1);
|
|
252
|
+
};
|
|
253
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
254
|
+
return ()=>window.removeEventListener('keydown', handleKeyDown);
|
|
255
|
+
});
|
|
256
|
+
if (!isOpen || !step || "u" < typeof document) return null;
|
|
257
|
+
const cn = 'function' == typeof classNames ? classNames({
|
|
258
|
+
props
|
|
259
|
+
}) : classNames;
|
|
260
|
+
const st = 'function' == typeof styles ? styles({
|
|
261
|
+
props
|
|
262
|
+
}) : styles;
|
|
263
|
+
const layer = zIndex ?? 'calc(var(--tao-z-index-base) + var(--tao-z-index-popup-base) + 170)';
|
|
264
|
+
const stepMask = step.mask ?? globalMask;
|
|
265
|
+
const masked = false !== stepMask;
|
|
266
|
+
const maskObj = 'object' == typeof stepMask ? stepMask : void 0;
|
|
267
|
+
const placement = step.placement ?? globalPlacement;
|
|
268
|
+
const popupPos = computePopupPosition(targetRect, placement);
|
|
269
|
+
const host = getPopupContainer?.() ?? document.body;
|
|
270
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsxs(Fragment, {
|
|
271
|
+
children: [
|
|
272
|
+
masked && /*#__PURE__*/ jsx("div", {
|
|
273
|
+
className: cx(`${prefixCls}-mask`, 'tao-tour-mask-layer', cn?.mask),
|
|
274
|
+
style: {
|
|
275
|
+
position: 'fixed',
|
|
276
|
+
inset: 0,
|
|
277
|
+
pointerEvents: disabledInteraction || !targetRect ? 'auto' : 'none',
|
|
278
|
+
...tokenStyle,
|
|
279
|
+
zIndex: layer,
|
|
280
|
+
...maskObj?.style,
|
|
281
|
+
...st?.mask
|
|
282
|
+
},
|
|
283
|
+
children: /*#__PURE__*/ jsxs("svg", {
|
|
284
|
+
"aria-hidden": "true",
|
|
499
285
|
style: {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
width: 360,
|
|
504
|
-
maxWidth: "calc(100vw - 24px)",
|
|
505
|
-
...style,
|
|
506
|
-
...step.style
|
|
286
|
+
width: '100%',
|
|
287
|
+
height: '100%',
|
|
288
|
+
display: 'block'
|
|
507
289
|
},
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
disabledInteraction: props.disabledInteraction
|
|
583
|
-
});
|
|
584
|
-
$[49] = actionsRender;
|
|
585
|
-
$[50] = cn;
|
|
586
|
-
$[51] = indicatorsRender;
|
|
587
|
-
$[52] = props.disabledInteraction;
|
|
588
|
-
$[53] = props.mask;
|
|
589
|
-
$[54] = st;
|
|
590
|
-
$[55] = steps;
|
|
591
|
-
$[56] = type;
|
|
592
|
-
$[57] = t15;
|
|
593
|
-
} else t15 = $[57];
|
|
594
|
-
let t16;
|
|
595
|
-
if ($[58] !== keyboard || $[59] !== mergedSteps || $[60] !== prefixCls || $[61] !== rest || $[62] !== rootClassName || $[63] !== t12 || $[64] !== t14 || $[65] !== t15 || $[66] !== t7 || $[67] !== t8 || $[68] !== t9 || $[69] !== zIndex) {
|
|
596
|
-
t16 = /*#__PURE__*/ jsx(RcTourComponent, {
|
|
597
|
-
...rest,
|
|
598
|
-
open: t7,
|
|
599
|
-
onClose: t8,
|
|
600
|
-
prefixCls: prefixCls,
|
|
601
|
-
steps: mergedSteps,
|
|
602
|
-
keyboard: keyboard,
|
|
603
|
-
zIndex: zIndex,
|
|
604
|
-
builtinPlacements: t9,
|
|
605
|
-
rootClassName: rootClassName,
|
|
606
|
-
classNames: t12,
|
|
607
|
-
styles: t14,
|
|
608
|
-
renderPanel: t15
|
|
609
|
-
});
|
|
610
|
-
$[58] = keyboard;
|
|
611
|
-
$[59] = mergedSteps;
|
|
612
|
-
$[60] = prefixCls;
|
|
613
|
-
$[61] = rest;
|
|
614
|
-
$[62] = rootClassName;
|
|
615
|
-
$[63] = t12;
|
|
616
|
-
$[64] = t14;
|
|
617
|
-
$[65] = t15;
|
|
618
|
-
$[66] = t7;
|
|
619
|
-
$[67] = t8;
|
|
620
|
-
$[68] = t9;
|
|
621
|
-
$[69] = zIndex;
|
|
622
|
-
$[70] = t16;
|
|
623
|
-
} else t16 = $[70];
|
|
624
|
-
return t16;
|
|
625
|
-
}
|
|
626
|
-
function _temp3(config) {
|
|
627
|
-
return Object.fromEntries(Object.entries(getPlacements(config?.arrowPointAtCenter)).map(_temp2));
|
|
628
|
-
}
|
|
629
|
-
function _temp2(t0) {
|
|
630
|
-
const [name, placement] = t0;
|
|
631
|
-
return [
|
|
632
|
-
name,
|
|
633
|
-
{
|
|
634
|
-
...placement,
|
|
635
|
-
overflow: {
|
|
636
|
-
adjustX: true,
|
|
637
|
-
adjustY: true,
|
|
638
|
-
shiftX: 12,
|
|
639
|
-
shiftY: 12
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
];
|
|
290
|
+
children: [
|
|
291
|
+
/*#__PURE__*/ jsx("defs", {
|
|
292
|
+
children: /*#__PURE__*/ jsxs("mask", {
|
|
293
|
+
id: maskId,
|
|
294
|
+
children: [
|
|
295
|
+
/*#__PURE__*/ jsx("rect", {
|
|
296
|
+
x: "0",
|
|
297
|
+
y: "0",
|
|
298
|
+
width: "100%",
|
|
299
|
+
height: "100%",
|
|
300
|
+
fill: "white"
|
|
301
|
+
}),
|
|
302
|
+
targetRect && /*#__PURE__*/ jsx("rect", {
|
|
303
|
+
x: Math.max(0, targetRect.left - 6),
|
|
304
|
+
y: Math.max(0, targetRect.top - 6),
|
|
305
|
+
width: targetRect.width + 12,
|
|
306
|
+
height: targetRect.height + 12,
|
|
307
|
+
rx: 6,
|
|
308
|
+
fill: "black"
|
|
309
|
+
})
|
|
310
|
+
]
|
|
311
|
+
})
|
|
312
|
+
}),
|
|
313
|
+
/*#__PURE__*/ jsx("rect", {
|
|
314
|
+
x: "0",
|
|
315
|
+
y: "0",
|
|
316
|
+
width: "100%",
|
|
317
|
+
height: "100%",
|
|
318
|
+
fill: maskObj?.color ?? 'rgba(0, 0, 0, 0.45)',
|
|
319
|
+
mask: `url(#${maskId})`
|
|
320
|
+
})
|
|
321
|
+
]
|
|
322
|
+
})
|
|
323
|
+
}),
|
|
324
|
+
/*#__PURE__*/ jsx("div", {
|
|
325
|
+
"data-tao-tour-popup": "",
|
|
326
|
+
className: cx(prefixCls, rootClassName, className, step.className),
|
|
327
|
+
style: {
|
|
328
|
+
...tokenStyle,
|
|
329
|
+
...popupPos,
|
|
330
|
+
zIndex: layer,
|
|
331
|
+
width: 360,
|
|
332
|
+
maxWidth: 'calc(100vw - 24px)',
|
|
333
|
+
...style,
|
|
334
|
+
...step.style
|
|
335
|
+
},
|
|
336
|
+
children: /*#__PURE__*/ jsx(TourPanel, {
|
|
337
|
+
step: step,
|
|
338
|
+
current: safeCurrent,
|
|
339
|
+
total: steps.length,
|
|
340
|
+
type: type,
|
|
341
|
+
globalClosable: closable,
|
|
342
|
+
globalCloseIcon: closeIcon,
|
|
343
|
+
indicatorsRender: indicatorsRender,
|
|
344
|
+
actionsRender: actionsRender,
|
|
345
|
+
classes: cn,
|
|
346
|
+
styles: st,
|
|
347
|
+
masked: masked,
|
|
348
|
+
disabledInteraction: disabledInteraction,
|
|
349
|
+
onPrev: ()=>{
|
|
350
|
+
if (safeCurrent > 0) goTo(safeCurrent - 1);
|
|
351
|
+
},
|
|
352
|
+
onNext: ()=>{
|
|
353
|
+
if (safeCurrent < steps.length - 1) goTo(safeCurrent + 1);
|
|
354
|
+
},
|
|
355
|
+
onFinish: ()=>{
|
|
356
|
+
onFinish?.();
|
|
357
|
+
dismiss();
|
|
358
|
+
},
|
|
359
|
+
onClose: dismiss
|
|
360
|
+
})
|
|
361
|
+
})
|
|
362
|
+
]
|
|
363
|
+
}), host);
|
|
643
364
|
}
|
|
644
365
|
export { Tour };
|