@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,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useTaoConfig, useTaoInternalConfig } from "../../provider/tao-context.js";
|
|
5
|
+
import { TaoPortalScope } from "../../provider/tao-portal-scope.js";
|
|
6
|
+
import { useIsomorphicLayoutEffect } from "../../utils/rc-compat.js";
|
|
7
7
|
import { useCommittedRef } from "../../utils/refs.js";
|
|
8
8
|
import { cx } from "../../utils/semantic.js";
|
|
9
9
|
import { Spinner } from "../spinner/spinner.js";
|
|
@@ -50,116 +50,225 @@ function iconFor(type, icon) {
|
|
|
50
50
|
})
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
function NoticeCard({ entry, index, onDismiss, closeLabel, prefixCls }) {
|
|
54
|
+
const [hovered, setHovered] = useState(false);
|
|
55
|
+
const [percent, setPercent] = useState(0);
|
|
56
|
+
const remainingRef = useRef('number' == typeof entry.duration && entry.duration > 0 ? 1000 * entry.duration : 0);
|
|
57
|
+
const onDismissRef = useCommittedRef(onDismiss);
|
|
58
|
+
useEffect(()=>{
|
|
59
|
+
if (entry.version < 0) return;
|
|
60
|
+
remainingRef.current = 'number' == typeof entry.duration && entry.duration > 0 ? 1000 * entry.duration : 0;
|
|
61
|
+
setPercent(0);
|
|
62
|
+
}, [
|
|
63
|
+
entry.duration,
|
|
64
|
+
entry.version
|
|
65
|
+
]);
|
|
66
|
+
useEffect(()=>{
|
|
67
|
+
if (entry.version < 0 || 'number' != typeof entry.duration || entry.duration <= 0 || entry.pauseOnHover && hovered) return;
|
|
68
|
+
const start = Date.now();
|
|
69
|
+
const wait = Math.max(0, remainingRef.current);
|
|
70
|
+
const timer = setTimeout(()=>{
|
|
71
|
+
onDismissRef.current(entry.key);
|
|
72
|
+
}, wait);
|
|
73
|
+
const totalMs = 1000 * entry.duration;
|
|
74
|
+
const interval = entry.showProgress ? setInterval(()=>{
|
|
75
|
+
const elapsed = totalMs - Math.max(0, wait - (Date.now() - start));
|
|
76
|
+
setPercent(Math.min(100, Math.round(elapsed / totalMs * 100)));
|
|
77
|
+
}, 100) : void 0;
|
|
78
|
+
return ()=>{
|
|
79
|
+
clearTimeout(timer);
|
|
80
|
+
if (interval) clearInterval(interval);
|
|
81
|
+
remainingRef.current = Math.max(0, wait - (Date.now() - start));
|
|
82
|
+
};
|
|
83
|
+
}, [
|
|
84
|
+
entry.duration,
|
|
85
|
+
entry.key,
|
|
86
|
+
entry.pauseOnHover,
|
|
87
|
+
entry.showProgress,
|
|
88
|
+
entry.version,
|
|
89
|
+
hovered,
|
|
90
|
+
onDismissRef
|
|
91
|
+
]);
|
|
92
|
+
const closableObj = 'object' == typeof entry.closable ? entry.closable : void 0;
|
|
93
|
+
const showClose = false !== entry.closable;
|
|
94
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
95
|
+
...entry.props,
|
|
96
|
+
role: entry.role,
|
|
97
|
+
className: cx(`${prefixCls}-notice`, entry.classNames.root, entry.className, 'string' == typeof entry.props?.className ? entry.props.className : void 0),
|
|
98
|
+
style: {
|
|
99
|
+
'--notification-index': index,
|
|
100
|
+
'--notification-y': `${64 * index}px`,
|
|
101
|
+
...entry.styles.root,
|
|
102
|
+
...entry.style,
|
|
103
|
+
...'object' == typeof entry.props?.style && entry.props.style ? entry.props.style : {}
|
|
104
|
+
},
|
|
105
|
+
onClick: entry.onClick,
|
|
106
|
+
onMouseEnter: ()=>setHovered(true),
|
|
107
|
+
onMouseLeave: ()=>setHovered(false),
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ jsxs("div", {
|
|
110
|
+
className: entry.classNames.wrapper,
|
|
111
|
+
style: entry.styles.wrapper,
|
|
112
|
+
children: [
|
|
113
|
+
null != entry.icon && /*#__PURE__*/ jsx("div", {
|
|
114
|
+
className: entry.classNames.icon,
|
|
115
|
+
style: entry.styles.icon,
|
|
116
|
+
children: entry.icon
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ jsxs("div", {
|
|
119
|
+
className: entry.classNames.section,
|
|
120
|
+
style: entry.styles.section,
|
|
121
|
+
children: [
|
|
122
|
+
null != entry.title && /*#__PURE__*/ jsx("div", {
|
|
123
|
+
className: entry.classNames.title,
|
|
124
|
+
style: entry.styles.title,
|
|
125
|
+
children: entry.title
|
|
126
|
+
}),
|
|
127
|
+
null != entry.description && /*#__PURE__*/ jsx("div", {
|
|
128
|
+
className: entry.classNames.description,
|
|
129
|
+
style: entry.styles.description,
|
|
130
|
+
children: entry.description
|
|
131
|
+
}),
|
|
132
|
+
null != entry.actions && /*#__PURE__*/ jsx("div", {
|
|
133
|
+
className: entry.classNames.actions,
|
|
134
|
+
style: entry.styles.actions,
|
|
135
|
+
children: entry.actions
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
}),
|
|
141
|
+
showClose && /*#__PURE__*/ jsx("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
disabled: closableObj?.disabled,
|
|
144
|
+
"aria-label": closableObj?.['aria-label'] ?? closeLabel,
|
|
145
|
+
className: entry.classNames.close,
|
|
146
|
+
style: entry.styles.close,
|
|
147
|
+
onClick: (event)=>{
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
if (!closableObj?.disabled) onDismiss(entry.key);
|
|
150
|
+
},
|
|
151
|
+
children: closableObj?.closeIcon ?? '×'
|
|
152
|
+
}),
|
|
153
|
+
entry.showProgress && 'number' == typeof entry.duration && entry.duration > 0 && /*#__PURE__*/ jsx("progress", {
|
|
154
|
+
className: entry.classNames.progress,
|
|
155
|
+
style: entry.styles.progress,
|
|
156
|
+
max: 100,
|
|
157
|
+
value: percent
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
53
162
|
function useNoticeHolder(kind, config) {
|
|
54
|
-
const
|
|
55
|
-
const { tokenStyle } = useTaoInternalConfig();
|
|
163
|
+
const { tokenStyle, locale } = useTaoInternalConfig();
|
|
56
164
|
const notificationConfig = config;
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} else t8 = $[5];
|
|
80
|
-
const t9 = config;
|
|
81
|
-
let t10;
|
|
82
|
-
if ($[6] !== notificationConfig.styles || $[7] !== t9) {
|
|
83
|
-
t10 = resolveAppSemantic(notificationConfig.styles, t9);
|
|
84
|
-
$[6] = notificationConfig.styles;
|
|
85
|
-
$[7] = t9;
|
|
86
|
-
$[8] = t10;
|
|
87
|
-
} else t10 = $[8];
|
|
88
|
-
let t11;
|
|
89
|
-
if ($[9] !== config) {
|
|
90
|
-
t11 = config.transitionName ? {
|
|
91
|
-
motionName: config.transitionName
|
|
92
|
-
} : void 0;
|
|
93
|
-
$[9] = config;
|
|
94
|
-
$[10] = t11;
|
|
95
|
-
} else t11 = $[10];
|
|
96
|
-
let t12;
|
|
97
|
-
if ($[11] !== config.rtl || $[12] !== config.top || $[13] !== kind || $[14] !== notificationConfig.bottom || $[15] !== tokenStyle) {
|
|
98
|
-
t12 = (node, t13)=>{
|
|
99
|
-
const { key } = t13;
|
|
100
|
-
return /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
101
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
102
|
-
"data-tao-app-notices": kind,
|
|
103
|
-
"data-tao-placement": key,
|
|
104
|
-
dir: void 0 === config.rtl ? void 0 : config.rtl ? "rtl" : "ltr",
|
|
105
|
-
style: {
|
|
106
|
-
...tokenStyle,
|
|
107
|
-
top: String(key).startsWith("top") ? config.top ?? 24 : void 0,
|
|
108
|
-
bottom: String(key).startsWith("bottom") ? notificationConfig.bottom ?? 24 : void 0
|
|
109
|
-
},
|
|
110
|
-
children: node
|
|
111
|
-
})
|
|
112
|
-
});
|
|
165
|
+
const prefixCls = config.prefixCls ?? `tao-app-${kind}`;
|
|
166
|
+
const [entries, setEntries] = useState([]);
|
|
167
|
+
const entriesRef = useRef([]);
|
|
168
|
+
entriesRef.current = entries;
|
|
169
|
+
const latestConfig = useCommittedRef(config);
|
|
170
|
+
const versionRef = useRef(0);
|
|
171
|
+
const api = useMemo(()=>{
|
|
172
|
+
const close = (key)=>{
|
|
173
|
+
const target = entriesRef.current.find((item)=>item.key === key);
|
|
174
|
+
if (!target) return;
|
|
175
|
+
const next = entriesRef.current.filter((item)=>item.key !== key);
|
|
176
|
+
entriesRef.current = next;
|
|
177
|
+
setEntries(next);
|
|
178
|
+
target.onClose?.();
|
|
179
|
+
};
|
|
180
|
+
const destroy = ()=>{
|
|
181
|
+
const existing = [
|
|
182
|
+
...entriesRef.current
|
|
183
|
+
];
|
|
184
|
+
entriesRef.current = [];
|
|
185
|
+
setEntries([]);
|
|
186
|
+
for (const item of existing)item.onClose?.();
|
|
113
187
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
188
|
+
const open = (input)=>{
|
|
189
|
+
const nextVersion = ++versionRef.current;
|
|
190
|
+
const entry = {
|
|
191
|
+
...input,
|
|
192
|
+
version: nextVersion
|
|
193
|
+
};
|
|
194
|
+
const idx = entriesRef.current.findIndex((item)=>item.key === input.key);
|
|
195
|
+
let next;
|
|
196
|
+
if (idx >= 0) {
|
|
197
|
+
next = [
|
|
198
|
+
...entriesRef.current
|
|
199
|
+
];
|
|
200
|
+
next[idx] = entry;
|
|
201
|
+
} else next = [
|
|
202
|
+
...entriesRef.current,
|
|
203
|
+
entry
|
|
204
|
+
];
|
|
205
|
+
const maxCount = latestConfig.current.maxCount ?? 0;
|
|
206
|
+
const evicted = [];
|
|
207
|
+
while(maxCount > 0 && next.length > maxCount){
|
|
208
|
+
const removed = next.shift();
|
|
209
|
+
if (removed) evicted.push(removed);
|
|
210
|
+
}
|
|
211
|
+
entriesRef.current = next;
|
|
212
|
+
setEntries(next);
|
|
213
|
+
for (const removed of evicted)removed.onClose?.();
|
|
136
214
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
215
|
+
return {
|
|
216
|
+
open,
|
|
217
|
+
close,
|
|
218
|
+
destroy
|
|
219
|
+
};
|
|
220
|
+
}, [
|
|
221
|
+
latestConfig
|
|
222
|
+
]);
|
|
223
|
+
const grouped = useMemo(()=>{
|
|
224
|
+
const map = new Map();
|
|
225
|
+
for (const entry of entries){
|
|
226
|
+
const list = map.get(entry.placement);
|
|
227
|
+
if (list) list.push(entry);
|
|
228
|
+
else map.set(entry.placement, [
|
|
229
|
+
entry
|
|
230
|
+
]);
|
|
231
|
+
}
|
|
232
|
+
return map;
|
|
233
|
+
}, [
|
|
234
|
+
entries
|
|
235
|
+
]);
|
|
236
|
+
const container = "u" > typeof document ? config.getContainer?.() ?? document.body : null;
|
|
237
|
+
const listClasses = noticeClasses(resolveAppSemantic(notificationConfig.classNames, config));
|
|
238
|
+
const listStyles = resolveAppSemantic(notificationConfig.styles, config);
|
|
239
|
+
const holder = container && grouped.size > 0 ? /*#__PURE__*/ createPortal([
|
|
240
|
+
...grouped.entries()
|
|
241
|
+
].map(([placement, items])=>/*#__PURE__*/ jsx(TaoPortalScope, {
|
|
242
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
243
|
+
"data-tao-app-notices": kind,
|
|
244
|
+
"data-tao-placement": placement,
|
|
245
|
+
dir: void 0 === config.rtl ? void 0 : config.rtl ? 'rtl' : 'ltr',
|
|
246
|
+
style: {
|
|
247
|
+
...tokenStyle,
|
|
248
|
+
top: placement.startsWith('top') ? config.top ?? 24 : void 0,
|
|
249
|
+
bottom: placement.startsWith('bottom') ? notificationConfig.bottom ?? 24 : void 0
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
252
|
+
className: cx(`${prefixCls}-list`, listClasses.list),
|
|
253
|
+
style: listStyles?.list,
|
|
254
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
255
|
+
className: cx(`${prefixCls}-list-content`, listClasses.listContent),
|
|
256
|
+
style: listStyles?.listContent,
|
|
257
|
+
children: items.map((entry, idx)=>/*#__PURE__*/ jsx(NoticeCard, {
|
|
258
|
+
entry: entry,
|
|
259
|
+
index: idx,
|
|
260
|
+
prefixCls: prefixCls,
|
|
261
|
+
closeLabel: locale.close,
|
|
262
|
+
onDismiss: api.close
|
|
263
|
+
}, entry.key))
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
}, placement)), container) : null;
|
|
268
|
+
return [
|
|
269
|
+
api,
|
|
270
|
+
holder
|
|
271
|
+
];
|
|
163
272
|
}
|
|
164
273
|
function messageResult(promise, close) {
|
|
165
274
|
return Object.assign(close, {
|
|
@@ -175,7 +284,7 @@ function useAppMessages(config = {}) {
|
|
|
175
284
|
const sequence = useRef(0);
|
|
176
285
|
const disposed = useRef(false);
|
|
177
286
|
const latest = useCommittedRef(config);
|
|
178
|
-
|
|
287
|
+
useIsomorphicLayoutEffect(()=>{
|
|
179
288
|
disposed.current = false;
|
|
180
289
|
return ()=>{
|
|
181
290
|
disposed.current = true;
|
|
@@ -184,39 +293,38 @@ function useAppMessages(config = {}) {
|
|
|
184
293
|
};
|
|
185
294
|
}, []);
|
|
186
295
|
const api = useMemo(()=>{
|
|
187
|
-
const finish = (key,
|
|
188
|
-
if (active.current.get(key) !==
|
|
296
|
+
const finish = (key, life)=>{
|
|
297
|
+
if (active.current.get(key) !== life) return;
|
|
189
298
|
active.current.delete(key);
|
|
190
299
|
try {
|
|
191
|
-
|
|
300
|
+
life.onClose?.();
|
|
192
301
|
} finally{
|
|
193
|
-
for (const resolve of
|
|
302
|
+
for (const resolve of life.resolve)resolve();
|
|
194
303
|
}
|
|
195
304
|
};
|
|
196
|
-
const close = (
|
|
197
|
-
if (!
|
|
198
|
-
notices.close(
|
|
199
|
-
finish(
|
|
305
|
+
const close = (key, life = active.current.get(key))=>{
|
|
306
|
+
if (!life || active.current.get(key) !== life) return;
|
|
307
|
+
notices.close(key);
|
|
308
|
+
finish(key, life);
|
|
200
309
|
};
|
|
201
310
|
const open = (args)=>{
|
|
202
311
|
if (disposed.current) return messageResult(Promise.resolve(true), ()=>{});
|
|
203
312
|
const defaults = latest.current;
|
|
204
|
-
const
|
|
313
|
+
const key = null == args.key ? `tao-app-message-${sequence.current++}` : explicitMessageKey(args.key);
|
|
205
314
|
const merged = {
|
|
206
315
|
...defaults,
|
|
207
316
|
...args
|
|
208
317
|
};
|
|
209
318
|
const classNames = noticeClasses(resolveAppSemantic(defaults.classNames, merged), resolveAppSemantic(args.classNames, merged));
|
|
210
319
|
const styles = noticeStyles(resolveAppSemantic(defaults.styles, merged), resolveAppSemantic(args.styles, merged));
|
|
211
|
-
const
|
|
320
|
+
const life = active.current.get(key) ?? {
|
|
212
321
|
resolve: []
|
|
213
322
|
};
|
|
214
|
-
|
|
215
|
-
const promise = new Promise((
|
|
216
|
-
active.current.set(
|
|
323
|
+
life.onClose = args.onClose;
|
|
324
|
+
const promise = new Promise((resolve)=>life.resolve.push(()=>resolve(true)));
|
|
325
|
+
active.current.set(key, life);
|
|
217
326
|
notices.open({
|
|
218
|
-
|
|
219
|
-
key: key_1,
|
|
327
|
+
key,
|
|
220
328
|
title: args.content,
|
|
221
329
|
duration: args.duration ?? defaults.duration ?? 3,
|
|
222
330
|
pauseOnHover: args.pauseOnHover ?? defaults.pauseOnHover ?? true,
|
|
@@ -224,20 +332,23 @@ function useAppMessages(config = {}) {
|
|
|
224
332
|
closable: false,
|
|
225
333
|
placement: 'top',
|
|
226
334
|
icon: iconFor(args.type, args.icon),
|
|
335
|
+
className: args.className,
|
|
336
|
+
style: args.style,
|
|
227
337
|
classNames,
|
|
228
338
|
styles,
|
|
229
|
-
|
|
339
|
+
onClick: args.onClick,
|
|
340
|
+
onClose: ()=>finish(key, life)
|
|
230
341
|
});
|
|
231
342
|
const maxCount = defaults.maxCount ?? 0;
|
|
232
343
|
while(maxCount > 0 && active.current.size > maxCount)close(active.current.keys().next().value);
|
|
233
|
-
return messageResult(promise, ()=>close(
|
|
344
|
+
return messageResult(promise, ()=>close(key, life));
|
|
234
345
|
};
|
|
235
346
|
const typed = (type)=>(content, duration, onClose)=>{
|
|
236
|
-
const
|
|
347
|
+
const args = content && 'object' == typeof content && 'content' in content ? content : {
|
|
237
348
|
content
|
|
238
349
|
};
|
|
239
350
|
return open({
|
|
240
|
-
...
|
|
351
|
+
...args,
|
|
241
352
|
type,
|
|
242
353
|
...'number' == typeof duration ? {
|
|
243
354
|
duration
|
|
@@ -256,13 +367,13 @@ function useAppMessages(config = {}) {
|
|
|
256
367
|
warning: typed('warning'),
|
|
257
368
|
error: typed('error'),
|
|
258
369
|
loading: typed('loading'),
|
|
259
|
-
destroy: (
|
|
260
|
-
if (void 0 !==
|
|
370
|
+
destroy: (key)=>{
|
|
371
|
+
if (void 0 !== key) return void close(explicitMessageKey(key));
|
|
261
372
|
const failures = [];
|
|
262
|
-
for (const [
|
|
373
|
+
for (const [k, life] of [
|
|
263
374
|
...active.current
|
|
264
375
|
])try {
|
|
265
|
-
close(
|
|
376
|
+
close(k, life);
|
|
266
377
|
} catch (error) {
|
|
267
378
|
failures.push(error);
|
|
268
379
|
}
|
|
@@ -279,137 +390,77 @@ function useAppMessages(config = {}) {
|
|
|
279
390
|
holder
|
|
280
391
|
];
|
|
281
392
|
}
|
|
282
|
-
function useAppNotifications(
|
|
283
|
-
const $ = c(23);
|
|
284
|
-
let t1;
|
|
285
|
-
if ($[0] !== t0) {
|
|
286
|
-
t1 = void 0 === t0 ? {} : t0;
|
|
287
|
-
$[0] = t0;
|
|
288
|
-
$[1] = t1;
|
|
289
|
-
} else t1 = $[1];
|
|
290
|
-
const config = t1;
|
|
393
|
+
function useAppNotifications(config = {}) {
|
|
291
394
|
const { locale } = useTaoConfig();
|
|
292
395
|
const closeLabel = useCommittedRef(locale.close);
|
|
293
|
-
const [notices, holder] = useNoticeHolder(
|
|
396
|
+
const [notices, holder] = useNoticeHolder('notification', config);
|
|
294
397
|
const latest = useCommittedRef(config);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
398
|
+
const sequence = useRef(0);
|
|
399
|
+
const api = useMemo(()=>{
|
|
400
|
+
const open = (args)=>{
|
|
298
401
|
const defaults = latest.current;
|
|
299
402
|
const merged = {
|
|
300
403
|
...defaults,
|
|
301
404
|
...args
|
|
302
405
|
};
|
|
303
|
-
const closeIcon = void 0 === args.closeIcon ? void 0 === defaults.closeIcon ?
|
|
406
|
+
const closeIcon = void 0 === args.closeIcon ? void 0 === defaults.closeIcon ? '×' : defaults.closeIcon : args.closeIcon;
|
|
304
407
|
const closable = false === args.closable || null === args.closable || false === closeIcon || null === closeIcon ? false : {
|
|
305
408
|
closeIcon,
|
|
306
|
-
|
|
307
|
-
...
|
|
409
|
+
'aria-label': closeLabel.current,
|
|
410
|
+
...'object' == typeof args.closable ? args.closable : {}
|
|
308
411
|
};
|
|
309
412
|
const classNames = noticeClasses(resolveAppSemantic(defaults.classNames, merged), resolveAppSemantic(args.classNames, merged));
|
|
310
413
|
const styles = noticeStyles(resolveAppSemantic(defaults.styles, merged), resolveAppSemantic(args.styles, merged));
|
|
311
|
-
const
|
|
312
|
-
const title = args.title ?? args.message;
|
|
414
|
+
const key = args.key ?? `tao-app-notification-${sequence.current++}`;
|
|
313
415
|
notices.open({
|
|
314
|
-
|
|
315
|
-
title:
|
|
316
|
-
|
|
317
|
-
title,
|
|
318
|
-
/*#__PURE__*/ jsx("button", {
|
|
319
|
-
type: "button",
|
|
320
|
-
disabled: true,
|
|
321
|
-
"aria-label": closable["aria-label"] ?? closeLabel.current,
|
|
322
|
-
className: classNames.close,
|
|
323
|
-
style: styles.close,
|
|
324
|
-
children: closable.closeIcon
|
|
325
|
-
})
|
|
326
|
-
]
|
|
327
|
-
}) : title,
|
|
416
|
+
key,
|
|
417
|
+
title: args.title ?? args.message,
|
|
418
|
+
description: args.description,
|
|
328
419
|
actions: args.actions ?? args.btn,
|
|
329
|
-
placement: args.placement ?? defaults.placement ??
|
|
420
|
+
placement: args.placement ?? defaults.placement ?? 'topRight',
|
|
330
421
|
duration: args.duration ?? defaults.duration ?? 4.5,
|
|
331
422
|
pauseOnHover: args.pauseOnHover ?? defaults.pauseOnHover ?? true,
|
|
332
423
|
showProgress: args.showProgress ?? defaults.showProgress,
|
|
333
|
-
role: args.role ??
|
|
424
|
+
role: args.role ?? 'alert',
|
|
334
425
|
icon: iconFor(args.type, args.icon),
|
|
426
|
+
className: args.className,
|
|
427
|
+
style: args.style,
|
|
335
428
|
classNames,
|
|
336
429
|
styles,
|
|
337
|
-
closable
|
|
430
|
+
closable,
|
|
431
|
+
props: args.props,
|
|
432
|
+
onClick: args.onClick,
|
|
433
|
+
onClose: args.onClose
|
|
338
434
|
});
|
|
339
435
|
};
|
|
340
|
-
|
|
341
|
-
$[3] = latest;
|
|
342
|
-
$[4] = notices;
|
|
343
|
-
$[5] = t2;
|
|
344
|
-
} else t2 = $[5];
|
|
345
|
-
const open = t2;
|
|
346
|
-
let t3;
|
|
347
|
-
let t4;
|
|
348
|
-
let t5;
|
|
349
|
-
let t6;
|
|
350
|
-
if ($[6] !== open) {
|
|
351
|
-
t3 = (args_0)=>open({
|
|
352
|
-
...args_0,
|
|
353
|
-
type: "success"
|
|
354
|
-
});
|
|
355
|
-
t4 = (args_1)=>open({
|
|
356
|
-
...args_1,
|
|
357
|
-
type: "info"
|
|
358
|
-
});
|
|
359
|
-
t5 = (args_2)=>open({
|
|
360
|
-
...args_2,
|
|
361
|
-
type: "error"
|
|
362
|
-
});
|
|
363
|
-
t6 = (args_3)=>open({
|
|
364
|
-
...args_3,
|
|
365
|
-
type: "warning"
|
|
366
|
-
});
|
|
367
|
-
$[6] = open;
|
|
368
|
-
$[7] = t3;
|
|
369
|
-
$[8] = t4;
|
|
370
|
-
$[9] = t5;
|
|
371
|
-
$[10] = t6;
|
|
372
|
-
} else {
|
|
373
|
-
t3 = $[7];
|
|
374
|
-
t4 = $[8];
|
|
375
|
-
t5 = $[9];
|
|
376
|
-
t6 = $[10];
|
|
377
|
-
}
|
|
378
|
-
let t7;
|
|
379
|
-
if ($[11] !== notices) {
|
|
380
|
-
t7 = (key)=>void 0 === key ? notices.destroy() : notices.close(key);
|
|
381
|
-
$[11] = notices;
|
|
382
|
-
$[12] = t7;
|
|
383
|
-
} else t7 = $[12];
|
|
384
|
-
let t8;
|
|
385
|
-
if ($[13] !== open || $[14] !== t3 || $[15] !== t4 || $[16] !== t5 || $[17] !== t6 || $[18] !== t7) {
|
|
386
|
-
t8 = {
|
|
436
|
+
return {
|
|
387
437
|
open,
|
|
388
|
-
success:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
438
|
+
success: (args)=>open({
|
|
439
|
+
...args,
|
|
440
|
+
type: 'success'
|
|
441
|
+
}),
|
|
442
|
+
info: (args)=>open({
|
|
443
|
+
...args,
|
|
444
|
+
type: 'info'
|
|
445
|
+
}),
|
|
446
|
+
error: (args)=>open({
|
|
447
|
+
...args,
|
|
448
|
+
type: 'error'
|
|
449
|
+
}),
|
|
450
|
+
warning: (args)=>open({
|
|
451
|
+
...args,
|
|
452
|
+
type: 'warning'
|
|
453
|
+
}),
|
|
454
|
+
destroy: (key)=>void 0 === key ? notices.destroy() : notices.close(key)
|
|
393
455
|
};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
let t9;
|
|
404
|
-
if ($[20] !== api || $[21] !== holder) {
|
|
405
|
-
t9 = [
|
|
406
|
-
api,
|
|
407
|
-
holder
|
|
408
|
-
];
|
|
409
|
-
$[20] = api;
|
|
410
|
-
$[21] = holder;
|
|
411
|
-
$[22] = t9;
|
|
412
|
-
} else t9 = $[22];
|
|
413
|
-
return t9;
|
|
456
|
+
}, [
|
|
457
|
+
closeLabel,
|
|
458
|
+
latest,
|
|
459
|
+
notices
|
|
460
|
+
]);
|
|
461
|
+
return [
|
|
462
|
+
api,
|
|
463
|
+
holder
|
|
464
|
+
];
|
|
414
465
|
}
|
|
415
466
|
export { resolveAppSemantic, useAppMessages, useAppNotifications };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { NotificationProps } from '@rc-component/notification';
|
|
2
1
|
import type { CSSProperties, ElementType, Key, MouseEvent, ReactNode } from 'react';
|
|
3
2
|
import type { SemanticClassNames, SemanticStyles } from '../../utils/semantic.js';
|
|
4
3
|
import type { ButtonProps } from '../button/button.js';
|
|
@@ -75,8 +74,12 @@ export interface AppNotificationArgs {
|
|
|
75
74
|
readonly type?: Exclude<AppNoticeType, 'loading'>;
|
|
76
75
|
onClick?: () => void;
|
|
77
76
|
closeIcon?: ReactNode;
|
|
78
|
-
closable?:
|
|
79
|
-
|
|
77
|
+
closable?: boolean | ({
|
|
78
|
+
closeIcon?: ReactNode;
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
'aria-label'?: string;
|
|
81
|
+
} & Record<string, unknown>);
|
|
82
|
+
props?: Record<string, unknown>;
|
|
80
83
|
role?: 'alert' | 'status';
|
|
81
84
|
}
|
|
82
85
|
export interface AppNotificationConfig {
|