@fibrae/semi-foundation 0.5.0 → 0.7.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 +20 -18
- package/README.zh-CN.md +20 -18
- package/dist/base/auto-close-foundation.d.ts +3 -10
- package/dist/base/auto-close-foundation.js +21 -42
- package/dist/base/constants.d.ts +1 -0
- package/dist/base/focus-handle.js +2 -2
- package/dist/base/focus-scope.js +1 -20
- package/dist/base/foundation.d.ts +0 -1
- package/dist/base/hook-api.d.ts +21 -0
- package/dist/base/hook-api.js +20 -0
- package/dist/base/index.d.ts +15 -0
- package/dist/base/index.js +15 -0
- package/dist/base/list-store.d.ts +53 -13
- package/dist/base/list-store.js +126 -48
- package/dist/base/modal-resources.js +1 -1
- package/dist/base/overlay-session.d.ts +16 -0
- package/dist/base/overlay-session.js +36 -0
- package/dist/base/static-list-wrapper.d.ts +6 -1
- package/dist/base/static-list-wrapper.js +12 -3
- package/dist/components/anchor/anchor.css +0 -4
- package/dist/components/anchor/anchor.scss +0 -3
- package/dist/components/anchor/foundation.d.ts +10 -2
- package/dist/components/anchor/foundation.js +45 -6
- package/dist/components/audio-player/audio-player.css +1 -1
- package/dist/components/audio-player/audio-player.scss +3 -1
- package/dist/components/audio-player/foundation.d.ts +7 -5
- package/dist/components/audio-player/foundation.js +5 -1
- package/dist/components/auto-complete/auto-complete.css +0 -4
- package/dist/components/auto-complete/auto-complete.scss +0 -2
- package/dist/components/auto-complete/constants.d.ts +3 -1
- package/dist/components/auto-complete/foundation.d.ts +5 -7
- package/dist/components/auto-complete/foundation.js +32 -28
- package/dist/components/avatar/avatar.css +1 -4
- package/dist/components/avatar/avatar.scss +1 -3
- package/dist/components/avatar/foundation.d.ts +3 -0
- package/dist/components/avatar/foundation.js +6 -2
- package/dist/components/backtop/backtop.css +0 -4
- package/dist/components/backtop/backtop.scss +0 -3
- package/dist/components/backtop/constants.d.ts +4 -0
- package/dist/components/backtop/constants.js +5 -1
- package/dist/components/backtop/foundation.d.ts +1 -0
- package/dist/components/backtop/foundation.js +7 -3
- package/dist/components/badge/badge.css +1 -4
- package/dist/components/badge/badge.scss +1 -3
- package/dist/components/badge/constants.d.ts +3 -1
- package/dist/components/banner/banner.css +0 -4
- package/dist/components/banner/banner.scss +0 -3
- package/dist/components/banner/foundation.d.ts +1 -0
- package/dist/components/breadcrumb/breadcrumb.css +9 -8
- package/dist/components/breadcrumb/breadcrumb.scss +10 -6
- package/dist/components/breadcrumb/foundation.d.ts +1 -0
- package/dist/components/breadcrumb/item-foundation.d.ts +3 -1
- package/dist/components/breadcrumb/item-foundation.js +1 -1
- package/dist/components/button/button.css +0 -9
- package/dist/components/button/constants.d.ts +3 -1
- package/dist/components/button/icon-button.css +0 -10
- package/dist/components/button/icon-button.scss +0 -1
- package/dist/components/button/rtl.scss +0 -7
- package/dist/components/calendar/calendar.css +0 -6
- package/dist/components/calendar/calendar.scss +0 -3
- package/dist/components/calendar/event-util.d.ts +3 -3
- package/dist/components/calendar/foundation.d.ts +15 -7
- package/dist/components/calendar/foundation.js +28 -17
- package/dist/components/calendar/month-foundation.d.ts +7 -2
- package/dist/components/calendar/month-foundation.js +11 -3
- package/dist/components/card/card.css +0 -14
- package/dist/components/card/card.scss +0 -3
- package/dist/components/card/constants.d.ts +3 -1
- package/dist/components/carousel/carousel.css +0 -4
- package/dist/components/carousel/foundation.d.ts +4 -1
- package/dist/components/carousel/foundation.js +20 -8
- package/dist/components/carousel/rtl.scss +0 -4
- package/dist/components/cascader/cascader.css +1 -6
- package/dist/components/cascader/cascader.scss +1 -1
- package/dist/components/cascader/constants.d.ts +2 -0
- package/dist/components/cascader/foundation.d.ts +8 -7
- package/dist/components/cascader/foundation.js +16 -7
- package/dist/components/cascader/rtl.scss +0 -5
- package/dist/components/cascader/util.d.ts +2 -2
- package/dist/components/cascader/util.js +2 -2
- package/dist/components/checkbox/checkbox-foundation.d.ts +4 -4
- package/dist/components/checkbox/checkbox-foundation.js +3 -1
- package/dist/components/checkbox/checkbox-group-foundation.d.ts +5 -0
- package/dist/components/checkbox/checkbox-group-foundation.js +4 -0
- package/dist/components/checkbox/checkbox.css +0 -5
- package/dist/components/checkbox/checkbox.scss +0 -3
- package/dist/components/code-highlight/code-highlight.css +1 -1
- package/dist/components/code-highlight/code-highlight.scss +1 -1
- package/dist/components/code-highlight/index.d.ts +2 -0
- package/dist/components/code-highlight/index.js +3 -0
- package/dist/components/collapse/collapse.css +1 -4
- package/dist/components/collapse/collapse.scss +1 -3
- package/dist/components/collapse/foundation.d.ts +1 -0
- package/dist/components/collapsible/foundation.d.ts +1 -0
- package/dist/components/color-picker/color-choose-area-foundation.d.ts +1 -0
- package/dist/components/color-picker/color-picker.css +1 -3
- package/dist/components/color-picker/color-picker.scss +1 -3
- package/dist/components/color-picker/color-slider-foundation.d.ts +1 -0
- package/dist/components/color-picker/data-part-foundation.d.ts +2 -1
- package/dist/components/color-picker/data-part-foundation.js +1 -1
- package/dist/components/color-picker/foundation.d.ts +9 -1
- package/dist/components/color-picker/foundation.js +20 -5
- package/dist/components/color-picker/utils/round.js +1 -1
- package/dist/components/config-provider/inherit-config.d.ts +5 -2
- package/dist/components/config-provider/inherit-config.js +1 -0
- package/dist/components/config-provider/responsive-types.d.ts +0 -3
- package/dist/components/cropper/constants.d.ts +2 -0
- package/dist/components/cropper/cropper.css +20 -22
- package/dist/components/cropper/cropper.scss +21 -23
- package/dist/components/cropper/foundation.d.ts +2 -15
- package/dist/components/cropper/foundation.js +139 -132
- package/dist/components/cropper/utils.d.ts +0 -1
- package/dist/components/cropper/utils.js +0 -1
- package/dist/components/date-picker/_utils/get-default-picker-date.d.ts +6 -4
- package/dist/components/date-picker/_utils/get-default-picker-date.js +12 -27
- package/dist/components/date-picker/_utils/index.d.ts +3 -4
- package/dist/components/date-picker/_utils/index.js +2 -3
- package/dist/components/date-picker/_utils/is-timestamp.js +1 -1
- package/dist/components/date-picker/_utils/parse-value.d.ts +13 -0
- package/dist/components/date-picker/_utils/parse-value.js +21 -0
- package/dist/components/date-picker/_utils/parser.d.ts +1 -0
- package/dist/components/date-picker/_utils/parser.js +5 -7
- package/dist/components/date-picker/_utils/picker-type.js +1 -1
- package/dist/components/date-picker/_utils/to-callback-args.d.ts +2 -5
- package/dist/components/date-picker/_utils/to-callback-args.js +4 -9
- package/dist/components/date-picker/constants.d.ts +2 -0
- package/dist/components/date-picker/constants.js +1 -1
- package/dist/components/date-picker/date-picker.css +0 -4
- package/dist/components/date-picker/foundation.d.ts +16 -26
- package/dist/components/date-picker/foundation.js +49 -42
- package/dist/components/date-picker/input-foundation.d.ts +11 -6
- package/dist/components/date-picker/input-foundation.js +13 -13
- package/dist/components/date-picker/month-foundation.d.ts +23 -8
- package/dist/components/date-picker/month-foundation.js +49 -10
- package/dist/components/date-picker/months-grid-foundation.d.ts +12 -10
- package/dist/components/date-picker/months-grid-foundation.js +60 -31
- package/dist/components/date-picker/rtl.scss +0 -4
- package/dist/components/date-picker/year-and-month-foundation.d.ts +2 -6
- package/dist/components/date-picker/year-and-month-foundation.js +5 -8
- package/dist/components/descriptions/constants.d.ts +3 -1
- package/dist/components/descriptions/descriptions.css +0 -4
- package/dist/components/descriptions/descriptions.scss +0 -3
- package/dist/components/divider/constants.d.ts +1 -1
- package/dist/components/divider/constants.js +1 -1
- package/dist/components/drag-move/foundation.d.ts +1 -0
- package/dist/components/dropdown/constants.d.ts +2 -0
- package/dist/components/dropdown/dropdown.css +0 -4
- package/dist/components/dropdown/dropdown.scss +0 -3
- package/dist/components/dropdown/foundation.d.ts +13 -0
- package/dist/components/dropdown/foundation.js +18 -7
- package/dist/components/dropdown/menu-foundation.d.ts +2 -1
- package/dist/components/dropdown/menu-foundation.js +2 -2
- package/dist/components/empty/constants.d.ts +3 -1
- package/dist/components/empty/empty.css +0 -4
- package/dist/components/empty/empty.scss +0 -3
- package/dist/components/feedback/constants.d.ts +3 -1
- package/dist/components/feedback/foundation.d.ts +9 -0
- package/dist/components/feedback/foundation.js +9 -0
- package/dist/components/float-button/float-button.css +2 -2
- package/dist/components/float-button/float-button.scss +2 -5
- package/dist/components/form/array-field-rows.d.ts +37 -8
- package/dist/components/form/array-field-rows.js +72 -18
- package/dist/components/form/errors.d.ts +3 -1
- package/dist/components/form/errors.js +5 -1
- package/dist/components/form/form.css +0 -10
- package/dist/components/form/form.scss +0 -7
- package/dist/components/form/foundation.d.ts +7 -2
- package/dist/components/form/foundation.js +14 -2
- package/dist/components/form/interface.d.ts +9 -2
- package/dist/components/form/utils.d.ts +54 -1
- package/dist/components/form/utils.js +43 -5
- package/dist/components/grid/grid.css +88 -4154
- package/dist/components/grid/grid.scss +32 -59
- package/dist/components/grid/gutter.d.ts +1 -1
- package/dist/components/grid/mixin.scss +20 -101
- package/dist/components/grid/utils.d.ts +8 -4
- package/dist/components/grid/utils.js +40 -27
- package/dist/components/grid/variables.scss +0 -1
- package/dist/components/highlight/constants.d.ts +3 -1
- package/dist/components/highlight/foundation.d.ts +7 -4
- package/dist/components/highlight/foundation.js +9 -7
- package/dist/components/hot-keys/foundation.d.ts +1 -0
- package/dist/components/image/constants.d.ts +5 -1
- package/dist/components/image/image-foundation.d.ts +1 -0
- package/dist/components/image/image.css +0 -6
- package/dist/components/image/preview-footer-foundation.d.ts +1 -0
- package/dist/components/image/preview-foundation.d.ts +1 -0
- package/dist/components/image/preview-image-foundation.d.ts +1 -0
- package/dist/components/image/preview-inner-foundation.d.ts +9 -6
- package/dist/components/image/preview-inner-foundation.js +59 -44
- package/dist/components/image/rtl.scss +0 -6
- package/dist/components/input/constants.d.ts +5 -1
- package/dist/components/input/foundation.d.ts +22 -2
- package/dist/components/input/foundation.js +26 -1
- package/dist/components/input/input.css +0 -18
- package/dist/components/input/input.scss +0 -17
- package/dist/components/input/text-entry-foundation.d.ts +8 -1
- package/dist/components/input/text-entry-foundation.js +13 -1
- package/dist/components/input/textarea-foundation.d.ts +23 -5
- package/dist/components/input/textarea-foundation.js +30 -6
- package/dist/components/input/textarea.css +0 -6
- package/dist/components/input/textarea.scss +0 -3
- package/dist/components/input/variables.scss +0 -3
- package/dist/components/input-number/constants.d.ts +3 -1
- package/dist/components/input-number/foundation.d.ts +1 -0
- package/dist/components/input-number/foundation.js +2 -2
- package/dist/components/input-number/input-number.css +0 -4
- package/dist/components/input-number/input-number.scss +0 -3
- package/dist/components/json-viewer/foundation.d.ts +10 -5
- package/dist/components/json-viewer/foundation.js +38 -23
- package/dist/components/layout/layout.css +0 -4
- package/dist/components/layout/layout.scss +0 -3
- package/dist/components/list/list.css +0 -5
- package/dist/components/list/list.scss +0 -3
- package/dist/components/lottie/foundation.d.ts +2 -2
- package/dist/components/lottie/foundation.js +23 -7
- package/dist/components/markdown-render/foundation.d.ts +2 -2
- package/dist/components/markdown-render/foundation.js +5 -2
- package/dist/components/markdown-render/markdown-render.css +2 -1
- package/dist/components/markdown-render/markdown-render.scss +2 -1
- package/dist/components/modal/confirm-instance.d.ts +28 -0
- package/dist/components/modal/confirm-instance.js +54 -0
- package/dist/components/modal/constants.d.ts +3 -1
- package/dist/components/modal/modal-content-foundation.d.ts +5 -5
- package/dist/components/modal/modal-content-foundation.js +6 -4
- package/dist/components/modal/modal-foundation.d.ts +3 -4
- package/dist/components/modal/modal-foundation.js +9 -18
- package/dist/components/modal/modal.css +0 -4
- package/dist/components/modal/modal.scss +0 -3
- package/dist/components/navigation/constants.d.ts +4 -0
- package/dist/components/navigation/foundation.d.ts +12 -4
- package/dist/components/navigation/foundation.js +19 -15
- package/dist/components/navigation/item-foundation.d.ts +14 -4
- package/dist/components/navigation/item-foundation.js +23 -10
- package/dist/components/navigation/navigation.css +0 -4
- package/dist/components/navigation/rtl.scss +0 -4
- package/dist/components/navigation/sub-nav-foundation.d.ts +1 -0
- package/dist/components/notification/constants.d.ts +1 -4
- package/dist/components/notification/constants.js +1 -6
- package/dist/components/notification/notification-api-foundation.d.ts +4 -2
- package/dist/components/notification/notification-api-foundation.js +14 -4
- package/dist/components/notification/notification-foundation.d.ts +1 -0
- package/dist/components/notification/notification-list-foundation.d.ts +14 -51
- package/dist/components/notification/notification-list-foundation.js +7 -63
- package/dist/components/notification/notification.css +0 -4
- package/dist/components/notification/notification.scss +0 -3
- package/dist/components/overflow-list/constants.d.ts +2 -0
- package/dist/components/overflow-list/foundation.d.ts +27 -15
- package/dist/components/overflow-list/foundation.js +105 -31
- package/dist/components/overflow-list/overflow-list.css +0 -4
- package/dist/components/overflow-list/overflow-list.scss +0 -3
- package/dist/components/pagination/foundation.d.ts +20 -2
- package/dist/components/pagination/foundation.js +32 -4
- package/dist/components/pagination/pagination.css +0 -4
- package/dist/components/pagination/rtl.scss +0 -4
- package/dist/components/pincode/foundation.d.ts +9 -2
- package/dist/components/pincode/foundation.js +11 -5
- package/dist/components/pincode/pincode.css +6 -8
- package/dist/components/pincode/pincode.scss +6 -9
- package/dist/components/popconfirm/constants.d.ts +3 -1
- package/dist/components/popconfirm/popconfirm-foundation.d.ts +4 -1
- package/dist/components/popconfirm/popconfirm-foundation.js +2 -1
- package/dist/components/popconfirm/popconfirm.css +0 -4
- package/dist/components/popconfirm/rtl.scss +0 -4
- package/dist/components/popover/constants.d.ts +2 -0
- package/dist/components/popover/popover.css +1 -4
- package/dist/components/popover/popover.scss +0 -2
- package/dist/components/progress/progress.css +2 -4
- package/dist/components/progress/progress.scss +2 -0
- package/dist/components/progress/rtl.scss +0 -4
- package/dist/components/radio/constants.d.ts +3 -1
- package/dist/components/radio/radio-foundation.d.ts +3 -5
- package/dist/components/radio/radio-foundation.js +3 -5
- package/dist/components/radio/radio-group-foundation.d.ts +6 -0
- package/dist/components/radio/radio-group-foundation.js +7 -0
- package/dist/components/radio/radio.css +0 -5
- package/dist/components/radio/radio.scss +0 -3
- package/dist/components/rating/foundation.d.ts +6 -0
- package/dist/components/rating/foundation.js +7 -2
- package/dist/components/rating/rating.css +0 -4
- package/dist/components/rating/rating.scss +0 -3
- package/dist/components/resizable/group/index.d.ts +1 -0
- package/dist/components/resizable/group/index.js +11 -1
- package/dist/components/resizable/resizable.css +6 -0
- package/dist/components/resizable/resizable.scss +3 -0
- package/dist/components/resizable/single/index.d.ts +1 -0
- package/dist/components/resizable/utils.js +1 -1
- package/dist/components/scroll-list/item-foundation.d.ts +17 -5
- package/dist/components/scroll-list/item-foundation.js +44 -29
- package/dist/components/scroll-list/scroll-list.css +0 -4
- package/dist/components/scroll-list/scroll-list.scss +0 -3
- package/dist/components/select/constants.d.ts +2 -0
- package/dist/components/select/constants.js +1 -1
- package/dist/components/select/foundation.d.ts +34 -11
- package/dist/components/select/foundation.js +126 -85
- package/dist/components/select/select.css +4 -7
- package/dist/components/select/select.scss +10 -5
- package/dist/components/side-sheet/constants.d.ts +2 -0
- package/dist/components/side-sheet/side-sheet-foundation.d.ts +10 -7
- package/dist/components/side-sheet/side-sheet-foundation.js +40 -30
- package/dist/components/side-sheet/side-sheet.css +0 -4
- package/dist/components/side-sheet/side-sheet.scss +0 -3
- package/dist/components/skeleton/skeleton.css +0 -4
- package/dist/components/skeleton/skeleton.scss +0 -3
- package/dist/components/slider/constants.d.ts +3 -1
- package/dist/components/slider/foundation.d.ts +39 -6
- package/dist/components/slider/foundation.js +56 -11
- package/dist/components/slider/rtl.scss +0 -2
- package/dist/components/slider/slider.css +2 -4
- package/dist/components/slider/slider.scss +2 -0
- package/dist/components/space/space.css +0 -4
- package/dist/components/space/space.scss +0 -3
- package/dist/components/spin/constants.d.ts +3 -1
- package/dist/components/spin/foundation.d.ts +1 -0
- package/dist/components/spin/foundation.js +1 -1
- package/dist/components/spin/spin.css +0 -5
- package/dist/components/spin/spin.scss +0 -3
- package/dist/components/steps/fill-steps.css +1 -1
- package/dist/components/steps/fill-steps.scss +1 -1
- package/dist/components/steps/steps.css +1 -7
- package/dist/components/steps/steps.scss +0 -2
- package/dist/components/switch/foundation.d.ts +1 -0
- package/dist/components/switch/rtl.scss +0 -4
- package/dist/components/switch/switch.css +0 -4
- package/dist/components/table/constants.d.ts +2 -0
- package/dist/components/table/foundation.d.ts +4 -3
- package/dist/components/table/foundation.js +40 -47
- package/dist/components/table/rtl.scss +0 -5
- package/dist/components/table/table.css +1 -6
- package/dist/components/table/table.scss +2 -1
- package/dist/components/table/utils.d.ts +59 -7
- package/dist/components/table/utils.js +90 -9
- package/dist/components/tabs/constants.d.ts +2 -0
- package/dist/components/tabs/foundation.d.ts +1 -9
- package/dist/components/tabs/foundation.js +21 -90
- package/dist/components/tabs/rtl.scss +0 -4
- package/dist/components/tabs/tab-bar-foundation.d.ts +45 -0
- package/dist/components/tabs/tab-bar-foundation.js +94 -0
- package/dist/components/tabs/tabs.css +4 -6
- package/dist/components/tabs/tabs.scss +4 -2
- package/dist/components/tabs/variables.scss +1 -1
- package/dist/components/tag/tag.css +0 -7
- package/dist/components/tag/tag.scss +0 -3
- package/dist/components/tag-input/foundation.d.ts +37 -14
- package/dist/components/tag-input/foundation.js +27 -1
- package/dist/components/tag-input/tag-input.css +0 -4
- package/dist/components/tag-input/tag-input.scss +0 -3
- package/dist/components/time-picker/combobox-options.d.ts +69 -0
- package/dist/components/time-picker/combobox-options.js +98 -0
- package/dist/components/time-picker/constants.d.ts +2 -0
- package/dist/components/time-picker/foundation.d.ts +19 -4
- package/dist/components/time-picker/foundation.js +46 -26
- package/dist/components/time-picker/input-foundation.d.ts +9 -2
- package/dist/components/time-picker/input-foundation.js +7 -0
- package/dist/components/time-picker/time-picker.css +0 -6
- package/dist/components/time-picker/time-picker.scss +0 -3
- package/dist/components/time-picker/utils/index.d.ts +4 -2
- package/dist/components/time-picker/utils/index.js +4 -6
- package/dist/components/timeline/rtl.scss +0 -4
- package/dist/components/timeline/timeline.css +0 -4
- package/dist/components/toast/constants.d.ts +0 -2
- package/dist/components/toast/constants.js +0 -2
- package/dist/components/toast/toast-api-foundation.d.ts +3 -2
- package/dist/components/toast/toast-api-foundation.js +14 -6
- package/dist/components/toast/toast-foundation.d.ts +1 -0
- package/dist/components/toast/toast-list-foundation.d.ts +11 -29
- package/dist/components/toast/toast-list-foundation.js +6 -74
- package/dist/components/toast/toast.css +0 -4
- package/dist/components/toast/toast.scss +0 -3
- package/dist/components/tooltip/constants.d.ts +2 -6
- package/dist/components/tooltip/constants.js +1 -7
- package/dist/components/tooltip/foundation.d.ts +15 -16
- package/dist/components/tooltip/foundation.js +60 -20
- package/dist/components/tooltip/tooltip.css +1 -4
- package/dist/components/tooltip/tooltip.scss +0 -2
- package/dist/components/transfer/constants.d.ts +1 -0
- package/dist/components/transfer/constants.js +2 -1
- package/dist/components/transfer/foundation.d.ts +37 -0
- package/dist/components/transfer/foundation.js +42 -1
- package/dist/components/transfer/transfer-utils.js +1 -1
- package/dist/components/transfer/transfer.css +0 -4
- package/dist/components/transfer/transfer.scss +0 -3
- package/dist/components/tree/constants.d.ts +2 -0
- package/dist/components/tree/foundation.d.ts +19 -4
- package/dist/components/tree/foundation.js +39 -4
- package/dist/components/tree/rtl.scss +0 -7
- package/dist/components/tree/shared.d.ts +50 -7
- package/dist/components/tree/shared.js +51 -9
- package/dist/components/tree/tree-util.d.ts +37 -38
- package/dist/components/tree/tree-util.js +5 -5
- package/dist/components/tree/tree.css +0 -7
- package/dist/components/tree-select/constants.d.ts +2 -0
- package/dist/components/tree-select/constants.js +1 -1
- package/dist/components/tree-select/foundation.d.ts +22 -14
- package/dist/components/tree-select/foundation.js +58 -13
- package/dist/components/tree-select/tree-select.css +0 -5
- package/dist/components/tree-select/tree-select.scss +0 -3
- package/dist/components/typography/copy.d.ts +8 -0
- package/dist/components/typography/copy.js +11 -0
- package/dist/components/typography/ellipsis.d.ts +31 -0
- package/dist/components/typography/ellipsis.js +30 -1
- package/dist/components/typography/rtl.scss +0 -4
- package/dist/components/typography/typography.css +0 -4
- package/dist/components/upload/constants.d.ts +4 -2
- package/dist/components/upload/constants.js +1 -1
- package/dist/components/upload/foundation.d.ts +26 -0
- package/dist/components/upload/foundation.js +28 -3
- package/dist/components/upload/rtl.scss +0 -4
- package/dist/components/upload/upload.css +0 -4
- package/dist/components/upload/utils.d.ts +7 -1
- package/dist/components/upload/utils.js +14 -4
- package/dist/components/user-guide/foundation.d.ts +5 -13
- package/dist/components/user-guide/foundation.js +91 -39
- package/dist/components/video-player/constants.d.ts +3 -0
- package/dist/components/video-player/constants.js +13 -1
- package/dist/components/video-player/foundation.d.ts +5 -4
- package/dist/components/video-player/foundation.js +7 -3
- package/dist/components/video-player/progress-foundation.d.ts +1 -1
- package/dist/components/video-player/progress-foundation.js +2 -2
- package/dist/components/video-player/seek-foundation.d.ts +7 -4
- package/dist/components/video-player/seek-foundation.js +26 -16
- package/dist/components/video-player/utils.d.ts +0 -2
- package/dist/components/video-player/utils.js +1 -14
- package/dist/components/video-player/video-player.css +10 -16
- package/dist/components/video-player/video-player.scss +12 -16
- package/dist/locale/index.d.ts +6 -0
- package/dist/locale/index.js +5 -0
- package/dist/locale/interface.d.ts +16 -5
- package/dist/locale/resolve-locale.d.ts +3 -3
- package/dist/locale/resolve-locale.js +20 -6
- package/dist/locale/source/en_US.js +4 -2
- package/dist/locale/source/zh_CN.js +4 -2
- package/dist/utils/a11y.d.ts +23 -11
- package/dist/utils/a11y.js +32 -17
- package/dist/utils/announcer.d.ts +0 -17
- package/dist/utils/announcer.js +1 -19
- package/dist/utils/assert-client.d.ts +1 -0
- package/dist/utils/assert-client.js +5 -0
- package/dist/utils/clipboard.d.ts +9 -1
- package/dist/utils/clipboard.js +25 -1
- package/dist/utils/date-fns-extra.d.ts +1 -0
- package/dist/utils/date-fns-extra.js +4 -1
- package/dist/utils/date-fns-locale.d.ts +6 -0
- package/dist/utils/date-fns-locale.js +15 -0
- package/dist/utils/dom.d.ts +10 -6
- package/dist/utils/dom.js +17 -6
- package/dist/utils/focus-handover.js +2 -2
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/layer.d.ts +15 -0
- package/dist/utils/layer.js +38 -1
- package/dist/utils/media.d.ts +2 -0
- package/dist/utils/media.js +15 -0
- package/dist/utils/zoned-time.d.ts +6 -0
- package/dist/utils/zoned-time.js +18 -0
- package/package.json +10 -7
- package/dist/components/anchor/rtl.scss +0 -9
- package/dist/components/auto-complete/rtl.scss +0 -9
- package/dist/components/avatar/rtl.scss +0 -11
- package/dist/components/backtop/rtl.scss +0 -8
- package/dist/components/badge/rtl.scss +0 -8
- package/dist/components/banner/rtl.scss +0 -8
- package/dist/components/breadcrumb/rtl.scss +0 -9
- package/dist/components/calendar/rtl.scss +0 -10
- package/dist/components/card/rtl.scss +0 -18
- package/dist/components/checkbox/rtl.scss +0 -11
- package/dist/components/collapse/rtl.scss +0 -8
- package/dist/components/date-picker/_utils/is-valid-date.d.ts +0 -1
- package/dist/components/date-picker/_utils/is-valid-date.js +0 -5
- package/dist/components/descriptions/rtl.scss +0 -8
- package/dist/components/dropdown/rtl.scss +0 -9
- package/dist/components/empty/rtl.scss +0 -8
- package/dist/components/float-button/rtl.scss +0 -2
- package/dist/components/form/rtl.scss +0 -13
- package/dist/components/grid/rtl.scss +0 -10
- package/dist/components/input/rtl.scss +0 -11
- package/dist/components/input-number/rtl.scss +0 -9
- package/dist/components/layout/rtl.scss +0 -7
- package/dist/components/list/rtl.scss +0 -9
- package/dist/components/modal/rtl.scss +0 -10
- package/dist/components/notification/rtl.scss +0 -9
- package/dist/components/overflow-list/rtl.scss +0 -7
- package/dist/components/popover/rtl.scss +0 -9
- package/dist/components/radio/rtl.scss +0 -11
- package/dist/components/rating/rtl.scss +0 -9
- package/dist/components/scroll-list/rtl.scss +0 -9
- package/dist/components/select/rtl.scss +0 -10
- package/dist/components/side-sheet/rtl.scss +0 -9
- package/dist/components/skeleton/rtl.scss +0 -9
- package/dist/components/space/rtl.scss +0 -8
- package/dist/components/spin/rtl.scss +0 -11
- package/dist/components/steps/rtl.scss +0 -14
- package/dist/components/tag/rtl.scss +0 -12
- package/dist/components/tag-input/rtl.scss +0 -9
- package/dist/components/time-picker/combox-foundation.d.ts +0 -64
- package/dist/components/time-picker/combox-foundation.js +0 -96
- package/dist/components/time-picker/rtl.scss +0 -10
- package/dist/components/toast/rtl.scss +0 -9
- package/dist/components/tooltip/rtl.scss +0 -9
- package/dist/components/transfer/rtl.scss +0 -9
- package/dist/components/tree-select/rtl.scss +0 -9
- package/dist/locale/source/ar.d.ts +0 -3
- package/dist/locale/source/ar.js +0 -520
- package/dist/locale/source/az.d.ts +0 -3
- package/dist/locale/source/az.js +0 -520
- package/dist/locale/source/bg.d.ts +0 -3
- package/dist/locale/source/bg.js +0 -520
- package/dist/locale/source/bn_IN.d.ts +0 -3
- package/dist/locale/source/bn_IN.js +0 -520
- package/dist/locale/source/ca.d.ts +0 -3
- package/dist/locale/source/ca.js +0 -520
- package/dist/locale/source/ceb_PH.d.ts +0 -3
- package/dist/locale/source/ceb_PH.js +0 -520
- package/dist/locale/source/cs_CZ.d.ts +0 -3
- package/dist/locale/source/cs_CZ.js +0 -520
- package/dist/locale/source/da.d.ts +0 -3
- package/dist/locale/source/da.js +0 -520
- package/dist/locale/source/de.d.ts +0 -3
- package/dist/locale/source/de.js +0 -520
- package/dist/locale/source/el_GR.d.ts +0 -3
- package/dist/locale/source/el_GR.js +0 -520
- package/dist/locale/source/en_GB.d.ts +0 -3
- package/dist/locale/source/en_GB.js +0 -520
- package/dist/locale/source/es.d.ts +0 -3
- package/dist/locale/source/es.js +0 -520
- package/dist/locale/source/es_419.d.ts +0 -3
- package/dist/locale/source/es_419.js +0 -520
- package/dist/locale/source/et.d.ts +0 -3
- package/dist/locale/source/et.js +0 -520
- package/dist/locale/source/fa_IR.d.ts +0 -3
- package/dist/locale/source/fa_IR.js +0 -520
- package/dist/locale/source/fi_FI.d.ts +0 -3
- package/dist/locale/source/fi_FI.js +0 -520
- package/dist/locale/source/fil_PH.d.ts +0 -3
- package/dist/locale/source/fil_PH.js +0 -520
- package/dist/locale/source/fr.d.ts +0 -3
- package/dist/locale/source/fr.js +0 -520
- package/dist/locale/source/fr_CA.d.ts +0 -3
- package/dist/locale/source/fr_CA.js +0 -520
- package/dist/locale/source/ga.d.ts +0 -3
- package/dist/locale/source/ga.js +0 -520
- package/dist/locale/source/he_IL.d.ts +0 -3
- package/dist/locale/source/he_IL.js +0 -520
- package/dist/locale/source/hi_IN.d.ts +0 -3
- package/dist/locale/source/hi_IN.js +0 -520
- package/dist/locale/source/hr.d.ts +0 -3
- package/dist/locale/source/hr.js +0 -520
- package/dist/locale/source/hu_HU.d.ts +0 -3
- package/dist/locale/source/hu_HU.js +0 -520
- package/dist/locale/source/id_ID.d.ts +0 -3
- package/dist/locale/source/id_ID.js +0 -520
- package/dist/locale/source/is.d.ts +0 -3
- package/dist/locale/source/is.js +0 -520
- package/dist/locale/source/it.d.ts +0 -3
- package/dist/locale/source/it.js +0 -520
- package/dist/locale/source/ja_JP.d.ts +0 -3
- package/dist/locale/source/ja_JP.js +0 -520
- package/dist/locale/source/jv_ID.d.ts +0 -3
- package/dist/locale/source/jv_ID.js +0 -520
- package/dist/locale/source/kk.d.ts +0 -3
- package/dist/locale/source/kk.js +0 -520
- package/dist/locale/source/km_KH.d.ts +0 -3
- package/dist/locale/source/km_KH.js +0 -520
- package/dist/locale/source/ko_KR.d.ts +0 -3
- package/dist/locale/source/ko_KR.js +0 -520
- package/dist/locale/source/lt.d.ts +0 -3
- package/dist/locale/source/lt.js +0 -520
- package/dist/locale/source/lv.d.ts +0 -3
- package/dist/locale/source/lv.js +0 -520
- package/dist/locale/source/ms_MY.d.ts +0 -3
- package/dist/locale/source/ms_MY.js +0 -520
- package/dist/locale/source/my_MM.d.ts +0 -3
- package/dist/locale/source/my_MM.js +0 -520
- package/dist/locale/source/nb.d.ts +0 -3
- package/dist/locale/source/nb.js +0 -520
- package/dist/locale/source/nl_NL.d.ts +0 -3
- package/dist/locale/source/nl_NL.js +0 -520
- package/dist/locale/source/pl_PL.d.ts +0 -3
- package/dist/locale/source/pl_PL.js +0 -520
- package/dist/locale/source/pt.d.ts +0 -3
- package/dist/locale/source/pt.js +0 -520
- package/dist/locale/source/pt_BR.d.ts +0 -3
- package/dist/locale/source/pt_BR.js +0 -520
- package/dist/locale/source/ro.d.ts +0 -3
- package/dist/locale/source/ro.js +0 -520
- package/dist/locale/source/ru_RU.d.ts +0 -3
- package/dist/locale/source/ru_RU.js +0 -520
- package/dist/locale/source/sk.d.ts +0 -3
- package/dist/locale/source/sk.js +0 -520
- package/dist/locale/source/sl.d.ts +0 -3
- package/dist/locale/source/sl.js +0 -520
- package/dist/locale/source/sq.d.ts +0 -3
- package/dist/locale/source/sq.js +0 -520
- package/dist/locale/source/sv_SE.d.ts +0 -3
- package/dist/locale/source/sv_SE.js +0 -520
- package/dist/locale/source/sw.d.ts +0 -3
- package/dist/locale/source/sw.js +0 -520
- package/dist/locale/source/th_TH.d.ts +0 -3
- package/dist/locale/source/th_TH.js +0 -520
- package/dist/locale/source/tr_TR.d.ts +0 -3
- package/dist/locale/source/tr_TR.js +0 -520
- package/dist/locale/source/uk_UA.d.ts +0 -3
- package/dist/locale/source/uk_UA.js +0 -520
- package/dist/locale/source/ur.d.ts +0 -3
- package/dist/locale/source/ur.js +0 -520
- package/dist/locale/source/uz.d.ts +0 -3
- package/dist/locale/source/uz.js +0 -520
- package/dist/locale/source/vi_VN.d.ts +0 -3
- package/dist/locale/source/vi_VN.js +0 -520
- package/dist/locale/source/zh_TW.d.ts +0 -3
- package/dist/locale/source/zh_TW.js +0 -520
- package/dist/utils/is-element.d.ts +0 -1
- package/dist/utils/is-element.js +0 -5
package/README.md
CHANGED
|
@@ -23,49 +23,51 @@ Build plugins need it to resolve `semi:` addresses, and the UI packages already
|
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
|
-
This package has no root entry.
|
|
26
|
+
This package has no root entry. The `base`, `utils` and `locale` directories each have an entry that gathers the directory's exports. Other modules are imported by deep file paths, which map one-to-one to the directories under `src/`. All come with type declarations:
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
|
-
import BaseFoundation from '@fibrae/semi-foundation/base
|
|
29
|
+
import { BaseFoundation, FocusScope } from '@fibrae/semi-foundation/base';
|
|
30
30
|
import InputFoundation from '@fibrae/semi-foundation/components/input/foundation';
|
|
31
|
-
import type { Locale } from '@fibrae/semi-foundation/locale
|
|
32
|
-
import en_GB from '@fibrae/semi-foundation/locale/source/en_GB';
|
|
31
|
+
import type { Locale } from '@fibrae/semi-foundation/locale';
|
|
33
32
|
import { utcToZonedTime } from '@fibrae/semi-foundation/utils/date-fns-extra';
|
|
34
33
|
```
|
|
35
34
|
|
|
35
|
+
The `utils` entry leaves out the date modules (`date-fns-extra`, `date-fns-locale`, `zoned-time`), and the `base` entry leaves out `base/env`. Import those by deep path.
|
|
36
|
+
|
|
36
37
|
`exports` also includes `./*.css` and `./*.scss`. The component CSS is compiled by `vp pack`. The published `.scss` contains `semi:` addresses and cannot be compiled by Sass directly; it goes through a build plugin or `@fibrae/semi-scss-compile`.
|
|
37
38
|
|
|
38
39
|
## Directories
|
|
39
40
|
|
|
40
|
-
| Directory | Contents
|
|
41
|
-
| ------------- |
|
|
42
|
-
| `components/` | One directory per component, containing `foundation.ts`, `constants.ts` and `*.scss` as needed (`variables.scss`, `mixin.scss
|
|
43
|
-
| `base/` | `BaseFoundation`, common constants and the stateful classes a foundation composes (focus scope, popup lifecycle, modal resources and similar)
|
|
44
|
-
| `utils/` | Stateless utilities: DOM, date, focus helpers, layer stack and similar
|
|
45
|
-
| `theme/` | The one theme: global tokens, palettes and mixins, loaded by component SCSS through `semi:theme`
|
|
46
|
-
| `locale/` | Locale packs
|
|
41
|
+
| Directory | Contents |
|
|
42
|
+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `components/` | One directory per component, containing `foundation.ts`, `constants.ts` and `*.scss` as needed (`variables.scss`, `mixin.scss` and similar ship only as source) |
|
|
44
|
+
| `base/` | `BaseFoundation`, common constants and the stateful classes a foundation composes (focus scope, popup lifecycle, modal resources and similar) |
|
|
45
|
+
| `utils/` | Stateless utilities: DOM, date, focus helpers, layer stack and similar |
|
|
46
|
+
| `theme/` | The one theme: global tokens, palettes and mixins, loaded by component SCSS through `semi:theme` |
|
|
47
|
+
| `locale/` | Locale packs, the `Locale` and `LocaleInput` types and the locale resolution shared by every framework |
|
|
47
48
|
|
|
48
49
|
## Locale packs
|
|
49
50
|
|
|
50
|
-
`src/locale/source/` holds
|
|
51
|
+
`src/locale/source/` holds the two built-in packs, `zh_CN` and `en_US`. Each file default-exports a `Locale`. `src/locale/index.ts` exports both packs and the `Locale`, `LocaleInput`, `LocaleComponentName` and `LocaleResult` types, and other packages import from `@fibrae/semi-foundation/locale`:
|
|
51
52
|
|
|
52
|
-
- `code`: the language code.
|
|
53
|
-
- `dateFnsLocale`: the date-fns locale object used to format and parse dates.
|
|
53
|
+
- `code`: the language code. Date components pick their date-fns locale by it (`src/utils/date-fns-locale.ts` builds in only zh-CN and en-US; others come from ConfigProvider's `dateFnsLocale`).
|
|
54
54
|
- `currency`: the ISO 4217 currency code, passed by InputNumber to `Intl.NumberFormat`.
|
|
55
55
|
- The other keys are grouped by component and hold built-in text and accessible names. Values with `${name}` are placeholders; do not translate the placeholder itself.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Every UI package exports `zh_CN` and `en_US` from its `locale` entry. Pass one to the UI package's `LocaleProvider` or `ConfigProvider`:
|
|
58
58
|
|
|
59
59
|
```tsx
|
|
60
60
|
import { LocaleProvider } from '@fibrae/semi-ui-react';
|
|
61
|
-
import
|
|
61
|
+
import { en_US } from '@fibrae/semi-ui-react/locale';
|
|
62
62
|
|
|
63
|
-
<LocaleProvider locale={
|
|
63
|
+
<LocaleProvider locale={en_US}>
|
|
64
64
|
<App />
|
|
65
65
|
</LocaleProvider>;
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Both providers also take a custom pack typed `LocaleInput`: only `code` is required, and every text or `currency` it leaves out comes from `en_US`. `src/locale/resolve-locale.ts` fills the gaps once per pack object and reuses the result, so create the pack once (at module level or memoized) and replace it rather than mutating it in place.
|
|
69
|
+
|
|
70
|
+
The Vue package's `LocaleProvider` has the same name and takes `:locale`. For adding text or accessible names to both built-in packs, see [locale-text](../../../.agents/skills/locale-text/SKILL.md).
|
|
69
71
|
|
|
70
72
|
## Related packages
|
|
71
73
|
|
package/README.zh-CN.md
CHANGED
|
@@ -23,49 +23,51 @@ pnpm add @fibrae/semi-foundation
|
|
|
23
23
|
|
|
24
24
|
## 使用
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
本包没有根入口。`base`、`utils`、`locale` 三个目录各有一个入口,汇总该目录的导出;其余模块按逐文件的深路径导入,与 `src/` 下的目录一一对应。都提供类型声明:
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
|
-
import BaseFoundation from '@fibrae/semi-foundation/base
|
|
29
|
+
import { BaseFoundation, FocusScope } from '@fibrae/semi-foundation/base';
|
|
30
30
|
import InputFoundation from '@fibrae/semi-foundation/components/input/foundation';
|
|
31
|
-
import type { Locale } from '@fibrae/semi-foundation/locale
|
|
32
|
-
import en_GB from '@fibrae/semi-foundation/locale/source/en_GB';
|
|
31
|
+
import type { Locale } from '@fibrae/semi-foundation/locale';
|
|
33
32
|
import { utcToZonedTime } from '@fibrae/semi-foundation/utils/date-fns-extra';
|
|
34
33
|
```
|
|
35
34
|
|
|
35
|
+
`utils` 入口不含日期模块(`date-fns-extra`、`date-fns-locale`、`zoned-time`),`base` 入口不含 `base/env`,它们只按深路径导入。
|
|
36
|
+
|
|
36
37
|
`exports` 还包含 `./*.css` 与 `./*.scss`:组件 CSS 是 `vp pack` 编译的产物;发布的 `.scss` 含有 `semi:` 地址,不能直接用 Sass 编译,需要经构建插件或 `@fibrae/semi-scss-compile`。
|
|
37
38
|
|
|
38
39
|
## 目录
|
|
39
40
|
|
|
40
|
-
| 目录 | 内容
|
|
41
|
-
| ------------- |
|
|
42
|
-
| `components/` | 每个组件一个目录,按需包含 `foundation.ts`、`constants.ts` 与 `*.scss`(`variables.scss`、`mixin.scss
|
|
43
|
-
| `base/` | `BaseFoundation`、通用常量,以及 foundation 组合使用的有状态类(焦点范围、弹层生命周期、模态资源等)
|
|
44
|
-
| `utils/` | 无状态工具:DOM、日期、焦点辅助、层栈等
|
|
45
|
-
| `theme/` | 唯一的主题:全局 token、色板、mixin,组件 SCSS 经 `semi:theme` 加载
|
|
46
|
-
| `locale/` |
|
|
41
|
+
| 目录 | 内容 |
|
|
42
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `components/` | 每个组件一个目录,按需包含 `foundation.ts`、`constants.ts` 与 `*.scss`(`variables.scss`、`mixin.scss` 等只按源文件发布) |
|
|
44
|
+
| `base/` | `BaseFoundation`、通用常量,以及 foundation 组合使用的有状态类(焦点范围、弹层生命周期、模态资源等) |
|
|
45
|
+
| `utils/` | 无状态工具:DOM、日期、焦点辅助、层栈等 |
|
|
46
|
+
| `theme/` | 唯一的主题:全局 token、色板、mixin,组件 SCSS 经 `semi:theme` 加载 |
|
|
47
|
+
| `locale/` | 语言包、`Locale` 与 `LocaleInput` 类型,以及各框架共用的语言解析 |
|
|
47
48
|
|
|
48
49
|
## 语言包
|
|
49
50
|
|
|
50
|
-
`src/locale/source/` 下有
|
|
51
|
+
`src/locale/source/` 下有 `zh_CN`、`en_US` 两个内置语言包,每个文件默认导出一个 `Locale`。`src/locale/index.ts` 统一导出两个语言包与 `Locale`、`LocaleInput`、`LocaleComponentName`、`LocaleResult` 类型,其他包从 `@fibrae/semi-foundation/locale` 导入:
|
|
51
52
|
|
|
52
|
-
- `code
|
|
53
|
-
- `dateFnsLocale`:格式化和解析日期时使用的 date-fns locale 对象。
|
|
53
|
+
- `code`:语言代码。日期组件按它取 date-fns locale(`src/utils/date-fns-locale.ts` 只内置 zh-CN、en-US,其余由 ConfigProvider 的 `dateFnsLocale` 传入)。
|
|
54
54
|
- `currency`:ISO 4217 货币代码,InputNumber 传给 `Intl.NumberFormat`。
|
|
55
55
|
- 其余键按组件分组,是组件的内置文案和可访问名称。含 `${名字}` 的值是占位符,翻译时不要替换占位符本身。
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
各 UI 包的 `locale` 入口导出 `zh_CN`、`en_US`,传给 UI 包的 `LocaleProvider` 或 `ConfigProvider`:
|
|
58
58
|
|
|
59
59
|
```tsx
|
|
60
60
|
import { LocaleProvider } from '@fibrae/semi-ui-react';
|
|
61
|
-
import
|
|
61
|
+
import { en_US } from '@fibrae/semi-ui-react/locale';
|
|
62
62
|
|
|
63
|
-
<LocaleProvider locale={
|
|
63
|
+
<LocaleProvider locale={en_US}>
|
|
64
64
|
<App />
|
|
65
65
|
</LocaleProvider>;
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
两个 provider 也接受 `LocaleInput` 类型的自定义语言包:只有 `code` 必填,没写的文案和 `currency` 取 `en_US`。`src/locale/resolve-locale.ts` 对同一个语言包对象只补齐一次并复用结果,所以语言包只创建一次(放在模块顶层或做 memo),要改就换一个新对象,不要原地修改。
|
|
69
|
+
|
|
70
|
+
Vue 包的 `LocaleProvider` 同名,通过 `:locale` 传入。给两个内置语言包新增文案或可访问名称的步骤见 [locale-text](../../../.agents/skills/locale-text/SKILL.md)。
|
|
69
71
|
|
|
70
72
|
## 与其他包的关系
|
|
71
73
|
|
|
@@ -19,26 +19,19 @@ export interface AutoCloseListState {
|
|
|
19
19
|
id?: string;
|
|
20
20
|
}[];
|
|
21
21
|
}
|
|
22
|
-
/** Closes a toast or notice after `duration`;
|
|
22
|
+
/** Closes a toast or notice after `duration`; its list pauses the countdown on hover and restarts it on an update */
|
|
23
23
|
export default class AutoCloseFoundation<P extends AutoCloseBaseProps = AutoCloseBaseProps, S = Record<string, never>, A extends AutoCloseAdapter<P, S> = AutoCloseAdapter<P, S>> extends BaseFoundation<A, P, S> {
|
|
24
24
|
#private;
|
|
25
25
|
init(): void;
|
|
26
26
|
destroy(): void;
|
|
27
27
|
isLeaving: () => boolean;
|
|
28
|
-
leave: () => void;
|
|
29
|
-
pauseCloseTimer: () => void;
|
|
30
|
-
resumeCloseTimer: () => void;
|
|
31
28
|
/**
|
|
32
29
|
* Follows the list: pauses while it is hovered or focused, stops when the store removed this item from outside (the
|
|
33
30
|
* countdown must not call onClose during the leave), and restarts when the store updated it in place. The first call
|
|
34
|
-
* only applies the state the item mounted into; hosts may call it before or after init().
|
|
35
|
-
* saw this item updated, so the host can follow up (announce it).
|
|
31
|
+
* only applies the state the item mounted into; hosts may call it before or after init().
|
|
36
32
|
*/
|
|
37
|
-
handleListChange: (list: AutoCloseListState) =>
|
|
38
|
-
startCloseTimer(): void;
|
|
33
|
+
handleListChange: (list: AutoCloseListState) => void;
|
|
39
34
|
close: (e?: {
|
|
40
35
|
stopPropagation: () => void;
|
|
41
36
|
}) => void;
|
|
42
|
-
clearCloseTimer(): void;
|
|
43
|
-
restartCloseTimer: () => void;
|
|
44
37
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import BaseFoundation from "./foundation.js";
|
|
2
|
+
import { ResetTimer } from "./reset-timer.js";
|
|
2
3
|
// src/base/auto-close-foundation.ts
|
|
3
|
-
/** Closes a toast or notice after `duration`;
|
|
4
|
+
/** Closes a toast or notice after `duration`; its list pauses the countdown on hover and restarts it on an update */
|
|
4
5
|
var AutoCloseFoundation = class extends BaseFoundation {
|
|
5
|
-
#timer =
|
|
6
|
+
#timer = new ResetTimer();
|
|
6
7
|
#id = null;
|
|
7
8
|
#paused = false;
|
|
8
9
|
#leaving = false;
|
|
@@ -11,70 +12,48 @@ var AutoCloseFoundation = class extends BaseFoundation {
|
|
|
11
12
|
const id = this.getProp("id");
|
|
12
13
|
return items.some((item) => item.id === id);
|
|
13
14
|
}
|
|
15
|
+
#startCloseTimer() {
|
|
16
|
+
this.#timer.clear();
|
|
17
|
+
const duration = this.getProp("duration");
|
|
18
|
+
if (!this.#leaving && !this.#paused && duration && typeof duration === "number") this.#timer.start(duration * 1e3, () => this.close());
|
|
19
|
+
}
|
|
14
20
|
init() {
|
|
15
|
-
this.
|
|
21
|
+
this.#timer.mount();
|
|
22
|
+
this.#startCloseTimer();
|
|
16
23
|
this.#id = this.getProp("id");
|
|
17
24
|
}
|
|
18
25
|
destroy() {
|
|
19
|
-
this.
|
|
26
|
+
this.#timer.unmount();
|
|
20
27
|
}
|
|
21
28
|
isLeaving = () => this.#leaving;
|
|
22
|
-
leave = () => {
|
|
23
|
-
this.#leaving = true;
|
|
24
|
-
this.clearCloseTimer();
|
|
25
|
-
};
|
|
26
|
-
pauseCloseTimer = () => {
|
|
27
|
-
this.#paused = true;
|
|
28
|
-
this.clearCloseTimer();
|
|
29
|
-
};
|
|
30
|
-
resumeCloseTimer = () => {
|
|
31
|
-
this.#paused = false;
|
|
32
|
-
this.startCloseTimer();
|
|
33
|
-
};
|
|
34
29
|
/**
|
|
35
30
|
* Follows the list: pauses while it is hovered or focused, stops when the store removed this item from outside (the
|
|
36
31
|
* countdown must not call onClose during the leave), and restarts when the store updated it in place. The first call
|
|
37
|
-
* only applies the state the item mounted into; hosts may call it before or after init().
|
|
38
|
-
* saw this item updated, so the host can follow up (announce it).
|
|
32
|
+
* only applies the state the item mounted into; hosts may call it before or after init().
|
|
39
33
|
*/
|
|
40
34
|
handleListChange = (list) => {
|
|
41
35
|
const prev = this.#list;
|
|
42
36
|
this.#list = list;
|
|
43
37
|
if (list.paused !== (prev?.paused ?? false)) {
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
this.#paused = list.paused;
|
|
39
|
+
this.#startCloseTimer();
|
|
40
|
+
}
|
|
41
|
+
if (list.removedItems && list.removedItems !== prev?.removedItems && this.#includesThis(list.removedItems)) {
|
|
42
|
+
this.#leaving = true;
|
|
43
|
+
this.#timer.clear();
|
|
46
44
|
}
|
|
47
|
-
if (list.removedItems && list.removedItems !== prev?.removedItems && this.#includesThis(list.removedItems)) this.leave();
|
|
48
45
|
if (prev && list.updatedItems !== prev.updatedItems && this.#includesThis(list.updatedItems)) {
|
|
49
|
-
this
|
|
50
|
-
|
|
46
|
+
this.#leaving = false;
|
|
47
|
+
this.#startCloseTimer();
|
|
51
48
|
}
|
|
52
|
-
return false;
|
|
53
49
|
};
|
|
54
|
-
startCloseTimer() {
|
|
55
|
-
this.clearCloseTimer();
|
|
56
|
-
const duration = this.getProp("duration");
|
|
57
|
-
if (!this.#leaving && !this.#paused && duration && typeof duration === "number") this.#timer = setTimeout(() => {
|
|
58
|
-
this.close();
|
|
59
|
-
}, duration * 1e3);
|
|
60
|
-
}
|
|
61
50
|
close = (e) => {
|
|
62
51
|
e?.stopPropagation();
|
|
63
52
|
if (this.#leaving) return;
|
|
64
53
|
this.#leaving = true;
|
|
65
|
-
this.
|
|
54
|
+
this.#timer.clear();
|
|
66
55
|
this.adapter.notifyWrapperToRemove(this.#id);
|
|
67
56
|
this.adapter.notifyClose();
|
|
68
57
|
};
|
|
69
|
-
clearCloseTimer() {
|
|
70
|
-
if (this.#timer) {
|
|
71
|
-
clearTimeout(this.#timer);
|
|
72
|
-
this.#timer = null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
restartCloseTimer = () => {
|
|
76
|
-
this.#leaving = false;
|
|
77
|
-
this.startCloseTimer();
|
|
78
|
-
};
|
|
79
58
|
};
|
|
80
59
|
export { AutoCloseFoundation as default };
|
package/dist/base/constants.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from "./env.js";
|
|
2
2
|
export declare const VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
3
|
+
export type ValidateStatus = (typeof VALIDATE_STATUS)[number];
|
|
3
4
|
declare const instanceIdKeyList: readonly ["id", "insetLabelId", "wrapperId", "addonId", "extraId"];
|
|
4
5
|
export type InstanceIdKey = (typeof instanceIdKeyList)[number];
|
|
5
6
|
export type GlobalDefaults<P> = P extends unknown ? Partial<Omit<P, InstanceIdKey>> : never;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isHTMLElement } from "../utils/dom.js";
|
|
2
2
|
import { tabbable } from "tabbable";
|
|
3
3
|
// src/base/focus-handle.ts
|
|
4
4
|
var FocusTrapHandle = class FocusTrapHandle {
|
|
@@ -37,7 +37,7 @@ var FocusTrapHandle = class FocusTrapHandle {
|
|
|
37
37
|
if (isFirstCurrentFocus) this.#focusElement(redirectForcingElement, event);
|
|
38
38
|
}
|
|
39
39
|
static getFocusableElements(node) {
|
|
40
|
-
return
|
|
40
|
+
return isHTMLElement(node) ? tabbable(node, { displayCheck: "full-native" }) : [];
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* The focused element as the tree of `scope` sees it, the document without one. Comparing it with nodes of that
|
package/dist/base/focus-scope.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
+
import { popupTriggers } from "../utils/layer.js";
|
|
1
2
|
import FocusTrapHandle from "./focus-handle.js";
|
|
2
|
-
import { POPUP_SELECTOR } from "../components/tooltip/constants.js";
|
|
3
|
-
import { getPopupTrigger } from "../utils/a11y.js";
|
|
4
3
|
// src/base/focus-scope.ts
|
|
5
|
-
function closestPopup(element) {
|
|
6
|
-
for (let current = element; current; current = current.getRootNode().host ?? null) {
|
|
7
|
-
const popup = current.closest(`${POPUP_SELECTOR}[id]`);
|
|
8
|
-
if (popup) return popup;
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
/** The triggers of the Tooltip-family popups around `element`, innermost first (D5 markup, see tooltip constants) */
|
|
13
|
-
function popupTriggers(element) {
|
|
14
|
-
const triggers = [];
|
|
15
|
-
for (let popup = closestPopup(element); popup;) {
|
|
16
|
-
const trigger = getPopupTrigger(popup.id, popup.getRootNode());
|
|
17
|
-
if (!trigger) break;
|
|
18
|
-
triggers.push(trigger);
|
|
19
|
-
popup = closestPopup(trigger);
|
|
20
|
-
}
|
|
21
|
-
return triggers;
|
|
22
|
-
}
|
|
23
4
|
const canTakeFocus = (element) => element?.isConnected && !element.matches(":disabled") && element.checkVisibility();
|
|
24
5
|
/**
|
|
25
6
|
* Focus handling of a modal overlay (APG dialog pattern): remember the focused element when the overlay opens, move
|
|
@@ -17,7 +17,6 @@ export interface DefaultAdapter<P = Record<string, any>, S = Record<string, any>
|
|
|
17
17
|
}
|
|
18
18
|
/** The context type an adapter declares; `unknown` for a foundation that does not read context */
|
|
19
19
|
export type ContextOf<T> = T extends DefaultAdapter<any, any, infer C> ? C : never;
|
|
20
|
-
export type HostContext<A> = unknown extends ContextOf<A> ? ([keyof ContextOf<A>] extends [never] ? any : ContextOf<A>) : ContextOf<A>;
|
|
21
20
|
export interface DirectionContext {
|
|
22
21
|
direction?: 'ltr' | 'rtl';
|
|
23
22
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface HookApi<O> {
|
|
2
|
+
success: (config: O) => string;
|
|
3
|
+
info: (config: O) => string;
|
|
4
|
+
error: (config: O) => string;
|
|
5
|
+
warning: (config: O) => string;
|
|
6
|
+
open: (config: O) => string;
|
|
7
|
+
close: (id: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface HookApiOptions {
|
|
10
|
+
/** Read on every call, so a context provider that changes the defaults takes effect */
|
|
11
|
+
readGlobalDefaults: () => object;
|
|
12
|
+
/** Runs before every call; a host that mounts its list lazily does it here */
|
|
13
|
+
beforeAdd?: () => void;
|
|
14
|
+
}
|
|
15
|
+
interface HookApiStore {
|
|
16
|
+
open(opts: object, globalDefaults: object): string;
|
|
17
|
+
remove(id: string): void;
|
|
18
|
+
}
|
|
19
|
+
/** The api of `useToast` and `useNotification` over one list store; `O` is the framework's options */
|
|
20
|
+
export declare function createHookApi<O extends object>(store: HookApiStore, { readGlobalDefaults, beforeAdd }: HookApiOptions): HookApi<O>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/base/hook-api.ts
|
|
2
|
+
/** The api of `useToast` and `useNotification` over one list store; `O` is the framework's options */
|
|
3
|
+
function createHookApi(store, { readGlobalDefaults, beforeAdd }) {
|
|
4
|
+
const add = (config, type) => {
|
|
5
|
+
beforeAdd?.();
|
|
6
|
+
return store.open({
|
|
7
|
+
...config,
|
|
8
|
+
type
|
|
9
|
+
}, readGlobalDefaults());
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
success: (config) => add(config, "success"),
|
|
13
|
+
info: (config) => add(config, "info"),
|
|
14
|
+
error: (config) => add(config, "error"),
|
|
15
|
+
warning: (config) => add(config, "warning"),
|
|
16
|
+
open: (config) => add(config, "default"),
|
|
17
|
+
close: (id) => store.remove(id)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export { createHookApi };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AutoCloseFoundation, { AutoCloseAdapter, AutoCloseBaseProps, AutoCloseListState } from "./auto-close-foundation.js";
|
|
2
|
+
import { GlobalDefaults, InstanceIdKey, VALIDATE_STATUS, ValidateStatus, omitInstanceIds } from "./constants.js";
|
|
3
|
+
import { BASE_CLASS_PREFIX } from "./env.js";
|
|
4
|
+
import FocusTrapHandle from "./focus-handle.js";
|
|
5
|
+
import FocusScope from "./focus-scope.js";
|
|
6
|
+
import BaseFoundation, { ContextOf, DefaultAdapter, DirectionContext, Lifecycle, PropReactions, createPropsTracker } from "./foundation.js";
|
|
7
|
+
import { HookApi, HookApiOptions, createHookApi } from "./hook-api.js";
|
|
8
|
+
import ListStore, { FreshItems, ListStoreItem, ListStoreState, getStackDepths, hasLostFocus, isAlertType, isStackExpanded, isStackHidden, readNoticeText } from "./list-store.js";
|
|
9
|
+
import ModalResources, { ModalHold } from "./modal-resources.js";
|
|
10
|
+
import OverlaySession from "./overlay-session.js";
|
|
11
|
+
import PopupLifecycle from "./popup-lifecycle.js";
|
|
12
|
+
import ReleaseHolder from "./release-holder.js";
|
|
13
|
+
import { ResetTimer } from "./reset-timer.js";
|
|
14
|
+
import StaticListWrapper from "./static-list-wrapper.js";
|
|
15
|
+
export { AutoCloseAdapter, AutoCloseBaseProps, AutoCloseFoundation, AutoCloseListState, BASE_CLASS_PREFIX, BaseFoundation, ContextOf, DefaultAdapter, DirectionContext, FocusScope, FocusTrapHandle, FreshItems, GlobalDefaults, HookApi, HookApiOptions, InstanceIdKey, Lifecycle, ListStore, ListStoreItem, ListStoreState, ModalHold, ModalResources, OverlaySession, PopupLifecycle, PropReactions, ReleaseHolder, ResetTimer, StaticListWrapper, VALIDATE_STATUS, ValidateStatus, createHookApi, createPropsTracker, getStackDepths, hasLostFocus, isAlertType, isStackExpanded, isStackHidden, omitInstanceIds, readNoticeText };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AutoCloseFoundation from "./auto-close-foundation.js";
|
|
2
|
+
import { VALIDATE_STATUS, omitInstanceIds } from "./constants.js";
|
|
3
|
+
import FocusTrapHandle from "./focus-handle.js";
|
|
4
|
+
import { BASE_CLASS_PREFIX } from "./env.js";
|
|
5
|
+
import FocusScope from "./focus-scope.js";
|
|
6
|
+
import BaseFoundation, { createPropsTracker } from "./foundation.js";
|
|
7
|
+
import { createHookApi } from "./hook-api.js";
|
|
8
|
+
import ListStore, { FreshItems, getStackDepths, hasLostFocus, isAlertType, isStackExpanded, isStackHidden, readNoticeText } from "./list-store.js";
|
|
9
|
+
import ModalResources from "./modal-resources.js";
|
|
10
|
+
import OverlaySession from "./overlay-session.js";
|
|
11
|
+
import PopupLifecycle from "./popup-lifecycle.js";
|
|
12
|
+
import ReleaseHolder from "./release-holder.js";
|
|
13
|
+
import { ResetTimer } from "./reset-timer.js";
|
|
14
|
+
import StaticListWrapper from "./static-list-wrapper.js";
|
|
15
|
+
export { AutoCloseFoundation, BASE_CLASS_PREFIX, BaseFoundation, FocusScope, FocusTrapHandle, FreshItems, ListStore, ModalResources, OverlaySession, PopupLifecycle, ReleaseHolder, ResetTimer, StaticListWrapper, VALIDATE_STATUS, createHookApi, createPropsTracker, getStackDepths, hasLostFocus, isAlertType, isStackExpanded, isStackHidden, omitInstanceIds, readNoticeText };
|
|
@@ -1,25 +1,65 @@
|
|
|
1
|
+
export interface ListStoreItem {
|
|
2
|
+
id?: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
stack?: boolean | number;
|
|
5
|
+
}
|
|
1
6
|
export interface ListStoreState<T> {
|
|
7
|
+
items: T[];
|
|
2
8
|
removedItems: T[];
|
|
3
9
|
updatedItems: T[];
|
|
4
10
|
order: string[];
|
|
11
|
+
/** How many items show before the list stacks, as the latest `open` asked; 0 never stacks */
|
|
12
|
+
stack: number;
|
|
5
13
|
}
|
|
6
14
|
/**
|
|
7
15
|
* The items of one Toast or Notification list, read by the list through subscribe and getSnapshot
|
|
8
16
|
* (useSyncExternalStore). Every change publishes a new state object, so a snapshot never changes after it is read.
|
|
9
|
-
* `
|
|
17
|
+
* `defaults` are the options of the static API that owns the list.
|
|
10
18
|
*/
|
|
11
|
-
export default class ListStore<
|
|
12
|
-
id?: string;
|
|
13
|
-
}, K extends string, S extends ListStoreState<T> & Record<K, T[]>> {
|
|
19
|
+
export default class ListStore<I extends ListStoreItem> {
|
|
14
20
|
#private;
|
|
15
|
-
|
|
21
|
+
defaults: I;
|
|
22
|
+
constructor(insertAt: 'start' | 'end', idPrefix: string, defaults: I);
|
|
16
23
|
subscribe: (listener: () => void) => () => void;
|
|
17
|
-
getSnapshot: () =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
getSnapshot: () => ListStoreState<I & {
|
|
25
|
+
id: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Shows an item with `opts` over the list's defaults and the global defaults, which is where the global defaults
|
|
29
|
+
* take effect: an explicit undefined replaces nothing. The item goes to the `insertAt` end, or updates the shown one
|
|
30
|
+
* with the same id in place. `beforeShow` gets the merged options before the item is added, so a static API can
|
|
31
|
+
* place its wrapper by them. Returns the id.
|
|
32
|
+
*/
|
|
33
|
+
open: (opts: I, globalDefaults: Partial<I>, beforeShow?: (merged: I) => void) => string;
|
|
34
|
+
remove: (id: string) => void;
|
|
35
|
+
finishLeave: (id: string) => void;
|
|
36
|
+
clear: () => void;
|
|
37
|
+
}
|
|
38
|
+
/** Whether the stack shows every item flat: no stacking, opened by hover or focus, or no more items than the threshold */
|
|
39
|
+
export declare function isStackExpanded(stack: number, opened: boolean, shownCount: number): boolean;
|
|
40
|
+
/** Whether a collapsed stack hides the item that `depth` shown items are newer than */
|
|
41
|
+
export declare function isStackHidden(expanded: boolean, depth: number): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* How many shown items are newer than each item, keyed by id; `ids` run newest first. Leaving items are not counted,
|
|
44
|
+
* or the ones behind them would sink and spring back when they go.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getStackDepths(ids: readonly string[], shown: ReadonlySet<string>): Map<string, number>;
|
|
47
|
+
/** The focus was inside `list` but its item unmounted, which fires no reliable blur and would keep the list paused */
|
|
48
|
+
export declare function hasLostFocus(focusInside: boolean, list?: Element | null): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a Toast or Notification of this type is an alert, which its own `role="alert"` announces; the list's
|
|
51
|
+
* announcer skips it so it is not read twice.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isAlertType(type?: string): type is "error" | "warning";
|
|
54
|
+
/** What an item announces: its title and content (`.${prefixCls}-title`, `.${prefixCls}-content`), without the icon and close button */
|
|
55
|
+
export declare function readNoticeText(item: Element | null | undefined, prefixCls: string): string;
|
|
56
|
+
/** Picks what a list announces: the items new since the previous call or updated in place, alerts excepted */
|
|
57
|
+
export declare class FreshItems {
|
|
58
|
+
#private;
|
|
59
|
+
pick<T extends {
|
|
60
|
+
id: string;
|
|
61
|
+
type?: string;
|
|
62
|
+
}>(items: readonly T[], updatedItems: readonly {
|
|
63
|
+
id?: string;
|
|
64
|
+
}[]): T[];
|
|
25
65
|
}
|