@type-dom/ui 0.0.10 → 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/package.json +3 -4
- package/src/aria.d.ts +2 -2
- package/src/components/basic/td-button/td-button.abstract.d.ts +5 -5
- package/src/components/basic/td-button/td-button.abstract.js +46 -42
- package/src/components/basic/td-button/td-button.interface.d.ts +3 -6
- package/src/components/basic/td-button/td-button.style.d.ts +16 -5
- package/src/components/basic/td-button/td-button.style.js +43 -17
- package/src/components/basic/td-button-group/td-button-group.class.d.ts +3 -2
- package/src/components/basic/td-button-group/td-button-group.class.js +34 -37
- package/src/components/basic/td-button-group/td-button-group.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-aside/td-aside.class.d.ts +2 -2
- package/src/components/basic/td-container/td-aside/td-aside.class.js +6 -5
- package/src/components/basic/td-container/td-aside/td-aside.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-container.class.d.ts +2 -3
- package/src/components/basic/td-container/td-container.class.js +9 -7
- package/src/components/basic/td-container/td-container.interface.d.ts +3 -4
- package/src/components/basic/td-container/td-container.js +3 -2
- package/src/components/basic/td-container/td-footer/td-footer.class.d.ts +2 -2
- package/src/components/basic/td-container/td-footer/td-footer.class.js +4 -3
- package/src/components/basic/td-container/td-footer/td-footer.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-header/td-header.class.d.ts +2 -2
- package/src/components/basic/td-container/td-header/td-header.class.js +3 -3
- package/src/components/basic/td-container/td-header/td-header.interface.d.ts +3 -3
- package/src/components/basic/td-container/td-main/td-main.class.d.ts +4 -2
- package/src/components/basic/td-container/td-main/td-main.class.js +8 -5
- package/src/components/basic/td-container/td-main/td-main.interface.d.ts +3 -3
- package/src/components/basic/td-icon/td-icon.class.d.ts +4 -6
- package/src/components/basic/td-icon/td-icon.class.js +21 -18
- package/src/components/basic/td-icon/td-icon.interface.d.ts +3 -4
- package/src/components/basic/td-layout/td-col/td-col.class.d.ts +2 -3
- package/src/components/basic/td-layout/td-col/td-col.class.js +4 -4
- package/src/components/basic/td-layout/td-col/td-col.interface.d.ts +3 -3
- package/src/components/basic/td-layout/td-row/td-row.class.d.ts +2 -2
- package/src/components/basic/td-layout/td-row/td-row.class.js +5 -4
- package/src/components/basic/td-layout/td-row/td-row.interface.d.ts +3 -3
- package/src/components/basic/td-link/td-link.class.d.ts +2 -2
- package/src/components/basic/td-link/td-link.class.js +6 -10
- package/src/components/basic/td-link/td-link.interface.d.ts +3 -3
- package/src/components/basic/td-link/td-link.style.js +1 -1
- package/src/components/basic/td-scrollbar/bar/bar.class.d.ts +2 -2
- package/src/components/basic/td-scrollbar/bar/bar.class.js +4 -4
- package/src/components/basic/td-scrollbar/bar/bar.interface.d.ts +3 -3
- package/src/components/basic/td-scrollbar/td-scrollbar.class.d.ts +4 -2
- package/src/components/basic/td-scrollbar/td-scrollbar.class.js +4 -3
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.d.ts +3 -4
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.js +1 -1
- package/src/components/basic/td-scrollbar/thumb/thumb.class.d.ts +2 -2
- package/src/components/basic/td-scrollbar/thumb/thumb.class.js +2 -3
- package/src/components/basic/td-scrollbar/thumb/thumb.interface.d.ts +3 -3
- package/src/components/basic/td-space/td-space.class.d.ts +2 -2
- package/src/components/basic/td-space/td-space.class.js +11 -5
- package/src/components/basic/td-space/td-space.interface.d.ts +3 -4
- package/src/components/basic/td-text/td-text.class.d.ts +4 -2
- package/src/components/basic/td-text/td-text.class.js +6 -4
- package/src/components/basic/td-text/td-text.interface.d.ts +3 -3
- package/src/components/data/td-avatar/td-avatar.class.d.ts +2 -2
- package/src/components/data/td-avatar/td-avatar.class.js +19 -25
- package/src/components/data/td-avatar/td-avatar.interface.d.ts +3 -3
- package/src/components/data/td-avatar/td-avatar.style.d.ts +2 -0
- package/src/components/data/td-avatar/td-avatar.style.js +19 -1
- package/src/components/data/td-badge/td-badge.class.d.ts +2 -2
- package/src/components/data/td-badge/td-badge.class.js +4 -4
- package/src/components/data/td-badge/td-badge.interface.d.ts +3 -3
- package/src/components/data/td-card/td-card.class.d.ts +4 -5
- package/src/components/data/td-card/td-card.class.js +16 -30
- package/src/components/data/td-card/td-card.interface.d.ts +3 -3
- package/src/components/data/td-card/td-card.style.d.ts +3 -2
- package/src/components/data/td-card/td-card.style.js +17 -3
- package/src/components/data/td-check-tag/td-check-tag.class.d.ts +2 -2
- package/src/components/data/td-check-tag/td-check-tag.class.js +5 -5
- package/src/components/data/td-check-tag/td-check-tag.interface.d.ts +3 -3
- package/src/components/data/td-check-tag/td-check-tag.style.d.ts +2 -2
- package/src/components/data/td-check-tag/td-check-tag.style.js +3 -3
- package/src/components/data/td-collapse/td-collapse.class.d.ts +2 -2
- package/src/components/data/td-collapse/td-collapse.class.js +20 -20
- package/src/components/data/td-collapse/td-collapse.interface.d.ts +3 -3
- package/src/components/data/td-collapse/td-collapse.style.d.ts +2 -0
- package/src/components/data/td-collapse/td-collapse.style.js +9 -1
- package/src/components/data/td-collapse-item/td-collapse-item.class.d.ts +4 -5
- package/src/components/data/td-collapse-item/td-collapse-item.class.js +8 -7
- package/src/components/data/td-collapse-item/td-collapse-item.interface.d.ts +3 -3
- package/src/components/data/td-count-down/td-count-down.class.d.ts +1 -1
- package/src/components/data/td-count-down/td-count-down.class.js +1 -1
- package/src/components/data/td-descriptions/td-descriptions-row.d.ts +4 -5
- package/src/components/data/td-descriptions/td-descriptions-row.js +1 -1
- package/src/components/data/td-descriptions/td-descriptions.class.d.ts +3 -3
- package/src/components/data/td-descriptions/td-descriptions.class.js +2 -3
- package/src/components/data/td-descriptions/td-descriptions.interface.d.ts +3 -4
- package/src/components/data/td-descriptions/td-descritions-cell.d.ts +6 -5
- package/src/components/data/td-descriptions/td-descritions-cell.js +5 -4
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.d.ts +2 -3
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +5 -4
- package/src/components/data/td-descriptions-item/td-descriptions-item.interface.d.ts +3 -4
- package/src/components/data/td-empty/td-empty.class.d.ts +2 -2
- package/src/components/data/td-empty/td-empty.class.js +2 -3
- package/src/components/data/td-empty/td-empty.interface.d.ts +3 -4
- package/src/components/data/td-image/td-image.class.d.ts +2 -3
- package/src/components/data/td-image/td-image.class.js +4 -22
- package/src/components/data/td-image/td-image.interface.d.ts +3 -3
- package/src/components/data/td-image/td-image.style.d.ts +2 -0
- package/src/components/data/td-image/td-image.style.js +19 -1
- package/src/components/data/td-image-viewer/td-image-viewer.class.d.ts +3 -5
- package/src/components/data/td-image-viewer/td-image-viewer.class.js +20 -17
- package/src/components/data/td-image-viewer/td-image-viewer.interface.d.ts +3 -3
- package/src/components/data/td-result/td-result.class.d.ts +2 -2
- package/src/components/data/td-result/td-result.class.js +4 -3
- package/src/components/data/td-result/td-result.interface.d.ts +3 -4
- package/src/components/data/td-segmented/td-segmented.class.d.ts +2 -3
- package/src/components/data/td-segmented/td-segmented.class.js +7 -8
- package/src/components/data/td-segmented/td-segmented.interface.d.ts +2 -3
- package/src/components/data/td-statistic/td-statistic.abstract.d.ts +3 -4
- package/src/components/data/td-statistic/td-statistic.abstract.js +15 -14
- package/src/components/data/td-statistic/td-statistic.class.js +1 -0
- package/src/components/data/td-statistic/td-statistic.interface.d.ts +3 -4
- package/src/components/data/td-tag/td-tag.class.d.ts +3 -4
- package/src/components/data/td-tag/td-tag.class.js +13 -13
- package/src/components/data/td-tag/td-tag.interface.d.ts +3 -3
- package/src/components/feedback/index.d.ts +2 -0
- package/src/components/feedback/index.js +3 -1
- package/src/components/feedback/td-alert/td-alert.class.d.ts +2 -3
- package/src/components/feedback/td-alert/td-alert.class.js +19 -17
- package/src/components/feedback/td-alert/td-alert.interface.d.ts +3 -3
- package/src/components/feedback/td-dialog/td-dialog.class.d.ts +3 -3
- package/src/components/feedback/td-dialog/td-dialog.class.js +25 -29
- package/src/components/feedback/td-dialog/td-dialog.interface.d.ts +3 -3
- package/src/components/feedback/td-dialog/td-dialog.interface.js +1 -1
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.d.ts +2 -3
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +10 -7
- package/src/components/feedback/td-dialog-content/td-dialog-content.interface.d.ts +3 -4
- package/src/components/feedback/td-drawer/td-drawer.class.d.ts +3 -3
- package/src/components/feedback/td-drawer/td-drawer.class.js +5 -5
- package/src/components/feedback/td-drawer/td-drawer.interface.d.ts +2 -2
- package/src/components/feedback/td-focus-trap/focus-trap.d.ts +15 -0
- package/src/components/feedback/td-focus-trap/focus-trap.js +71 -0
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +8 -7
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +129 -129
- package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +3 -3
- package/src/components/feedback/td-loading/td-loading.class.d.ts +2 -3
- package/src/components/feedback/td-loading/td-loading.class.js +21 -17
- package/src/components/feedback/td-loading/td-loading.interface.d.ts +3 -4
- package/src/components/feedback/td-message/td-message.class.d.ts +4 -4
- package/src/components/feedback/td-message/td-message.class.js +31 -31
- package/src/components/feedback/td-message/td-message.interface.d.ts +3 -4
- package/src/components/feedback/td-message-box/td-message-box.class.d.ts +10 -12
- package/src/components/feedback/td-message-box/td-message-box.class.js +30 -52
- package/src/components/feedback/td-message-box/td-message-box.interface.d.ts +4 -5
- package/src/components/feedback/td-notification/td-notification.class.d.ts +4 -5
- package/src/components/feedback/td-notification/td-notification.class.js +17 -18
- package/src/components/feedback/td-notification/td-notification.interface.d.ts +3 -4
- package/src/components/feedback/td-only-child/td-only-child.class.d.ts +3 -3
- package/src/components/feedback/td-only-child/td-only-child.class.js +3 -3
- package/src/components/feedback/td-overlay/td-overlay.class.d.ts +2 -3
- package/src/components/feedback/td-overlay/td-overlay.class.js +6 -5
- package/src/components/feedback/td-overlay/td-overlay.interface.d.ts +3 -3
- package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +2 -2
- package/src/components/feedback/td-popper/arrow/arrow.class.js +7 -6
- package/src/components/feedback/td-popper/arrow/arrow.const.d.ts +3 -0
- package/src/components/feedback/td-popper/arrow/arrow.const.js +6 -0
- package/src/components/feedback/td-popper/arrow/arrow.interface.d.ts +3 -4
- package/src/components/feedback/td-popper/constants.d.ts +25 -0
- package/src/components/feedback/td-popper/constants.js +5 -0
- package/src/components/feedback/td-popper/content/content.class.d.ts +2 -2
- package/src/components/feedback/td-popper/content/content.class.js +7 -13
- package/src/components/feedback/td-popper/content/content.const.d.ts +2 -2
- package/src/components/feedback/td-popper/content/content.const.js +3 -4
- package/src/components/feedback/td-popper/content/content.interface.d.ts +24 -11
- package/src/components/feedback/td-popper/content/content.interface.js +4 -0
- package/src/components/feedback/td-popper/td-popper.class.d.ts +3 -2
- package/src/components/feedback/td-popper/td-popper.class.js +9 -7
- package/src/components/feedback/td-popper/td-popper.const.d.ts +5 -20
- package/src/components/feedback/td-popper/td-popper.const.js +8 -3
- package/src/components/feedback/td-popper/td-popper.interface.d.ts +6 -4
- package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +2 -2
- package/src/components/feedback/td-popper/trigger/trigger.class.js +6 -6
- package/src/components/feedback/td-popper/trigger/trigger.const.d.ts +1 -0
- package/src/components/feedback/td-popper/trigger/trigger.const.js +4 -1
- package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +3 -3
- package/src/components/feedback/td-tooltip/content/content.class.d.ts +2 -2
- package/src/components/feedback/td-tooltip/content/content.class.js +4 -3
- package/src/components/feedback/td-tooltip/content/content.const.d.ts +55 -0
- package/src/components/feedback/td-tooltip/content/content.const.js +6 -0
- package/src/components/feedback/td-tooltip/content/content.interface.d.ts +19 -3
- package/src/components/feedback/td-tooltip/td-tooltip.class.d.ts +5 -3
- package/src/components/feedback/td-tooltip/td-tooltip.class.js +84 -9
- package/src/components/feedback/td-tooltip/td-tooltip.const.d.ts +77 -0
- package/src/components/feedback/td-tooltip/td-tooltip.const.js +9 -0
- package/src/components/feedback/td-tooltip/td-tooltip.interface.d.ts +6 -3
- package/src/components/feedback/td-tooltip/trigger/trigger.class.d.ts +3 -2
- package/src/components/feedback/td-tooltip/trigger/trigger.class.js +56 -3
- package/src/components/feedback/td-tooltip/trigger/trigger.const.d.ts +4 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.const.js +6 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.interface.d.ts +7 -2
- package/src/components/form/index.d.ts +17 -16
- package/src/components/form/index.js +19 -17
- package/src/components/form/td-checkbox/composables/use-checkbox-status.js +1 -1
- package/src/components/form/td-checkbox/composables/use-checkbox.js +1 -1
- package/src/components/form/td-checkbox/td-checkbox.class.d.ts +18 -3
- package/src/components/form/td-checkbox/td-checkbox.class.js +231 -9
- package/src/components/form/td-checkbox/td-checkbox.const.d.ts +63 -0
- package/src/components/form/td-checkbox/td-checkbox.const.js +88 -0
- package/src/components/form/td-checkbox/td-checkbox.interface.d.ts +5 -5
- package/src/components/form/td-checkbox/td-checkbox.style.d.ts +9 -0
- package/src/components/form/td-checkbox/td-checkbox.style.js +165 -12
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.d.ts +9 -3
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +114 -26
- package/src/components/form/td-checkbox-button/td-checkbox-button.interface.d.ts +2 -4
- package/src/components/form/td-checkbox-button/td-checkbox-button.style.d.ts +8 -1
- package/src/components/form/td-checkbox-button/td-checkbox-button.style.js +89 -12
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.d.ts +11 -3
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +118 -5
- package/src/components/form/td-checkbox-group/td-checkbox-group.interface.d.ts +8 -5
- package/src/components/form/td-form/td-form.class.d.ts +4 -2
- package/src/components/form/td-form/td-form.class.js +9 -5
- package/src/components/form/td-form/td-form.interface.d.ts +7 -4
- package/src/components/form/td-form-item/td-form-item.class.d.ts +4 -5
- package/src/components/form/td-form-item/td-form-item.class.js +34 -27
- package/src/components/form/td-form-item/td-form-item.interface.d.ts +3 -3
- package/src/components/form/td-input/td-input.class.d.ts +3 -4
- package/src/components/form/td-input/td-input.class.js +30 -26
- package/src/components/form/td-input/td-input.interface.d.ts +3 -4
- package/src/components/form/td-input/widget/suffix.d.ts +1 -0
- package/src/components/form/td-input/widget/suffix.js +6 -1
- package/src/components/form/td-input/widget/td-input-wrapper.class.js +5 -5
- package/src/components/form/td-option/td-option.class.d.ts +2 -2
- package/src/components/form/td-option/td-option.class.js +3 -3
- package/src/components/form/td-option/td-option.interface.d.ts +3 -3
- package/src/components/form/td-option-group/td-option-group.class.d.ts +2 -2
- package/src/components/form/td-option-group/td-option-group.class.js +2 -3
- package/src/components/form/td-option-group/td-option-group.interface.d.ts +3 -3
- package/src/components/form/td-radio/td-radio.class.d.ts +2 -3
- package/src/components/form/td-radio/td-radio.class.js +8 -5
- package/src/components/form/td-radio/td-radio.interface.d.ts +3 -3
- package/src/components/form/td-radio-button/td-radio-button.class.d.ts +2 -3
- package/src/components/form/td-radio-button/td-radio-button.class.js +9 -9
- package/src/components/form/td-radio-button/td-radio-button.interface.d.ts +3 -3
- package/src/components/form/td-radio-group/td-radio-group.class.d.ts +2 -5
- package/src/components/form/td-radio-group/td-radio-group.class.js +14 -11
- package/src/components/form/td-radio-group/td-radio-group.interface.d.ts +3 -4
- package/src/components/form/td-select/dropdown/dropdown.class.d.ts +2 -2
- package/src/components/form/td-select/dropdown/dropdown.class.js +2 -3
- package/src/components/form/td-select/dropdown/dropdown.interface.d.ts +3 -4
- package/src/components/form/td-select/td-select.class.d.ts +4 -6
- package/src/components/form/td-select/td-select.class.js +4 -6
- package/src/components/form/td-select/td-select.interface.d.ts +13 -5
- package/src/components/form/td-select/td-select.style.d.ts +23 -0
- package/src/components/form/td-select/td-select.style.js +170 -1
- package/src/components/form/td-switch/td-switch.class.d.ts +2 -3
- package/src/components/form/td-switch/td-switch.class.js +2 -3
- package/src/components/form/td-switch/td-switch.interface.d.ts +3 -4
- package/src/components/navigation/td-affix/td-affix.class.d.ts +2 -3
- package/src/components/navigation/td-affix/td-affix.class.js +2 -3
- package/src/components/navigation/td-affix/td-affix.interface.d.ts +3 -4
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.d.ts +2 -2
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +2 -3
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.interface.d.ts +3 -4
- package/src/components/navigation/td-anchor/td-anchor.class.d.ts +2 -2
- package/src/components/navigation/td-anchor/td-anchor.class.js +6 -4
- package/src/components/navigation/td-anchor/td-anchor.function.js +1 -1
- package/src/components/navigation/td-anchor/td-anchor.interface.d.ts +3 -3
- package/src/components/navigation/td-backtop/td-backtop.class.d.ts +5 -6
- package/src/components/navigation/td-backtop/td-backtop.class.js +36 -59
- package/src/components/navigation/td-backtop/td-backtop.const.d.ts +18 -0
- package/src/components/navigation/td-backtop/td-backtop.const.js +21 -0
- package/src/components/navigation/td-backtop/td-backtop.interface.d.ts +3 -3
- package/src/components/navigation/td-backtop/td-backtop.style.d.ts +2 -0
- package/src/components/navigation/td-backtop/td-backtop.style.js +19 -1
- package/src/components/navigation/td-backtop/use-backtop.d.ts +2 -3
- package/src/components/navigation/td-backtop/use-backtop.js +2 -2
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.d.ts +3 -3
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +12 -8
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.interface.d.ts +3 -4
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.d.ts +2 -2
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +2 -3
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.interface.d.ts +3 -4
- package/src/components/navigation/td-menu/td-menu.class.d.ts +2 -2
- package/src/components/navigation/td-menu/td-menu.class.js +4 -3
- package/src/components/navigation/td-menu/td-menu.interface.d.ts +3 -4
- package/src/components/navigation/td-tabs/td-tab-bar.class.d.ts +2 -2
- package/src/components/navigation/td-tabs/td-tab-bar.class.js +3 -3
- package/src/components/navigation/td-tabs/td-tab-bar.interface.d.ts +3 -3
- package/src/components/navigation/td-tabs/td-tab-nav.class.d.ts +2 -3
- package/src/components/navigation/td-tabs/td-tab-nav.class.js +3 -4
- package/src/components/navigation/td-tabs/td-tab-nav.interface.d.ts +3 -3
- package/src/components/navigation/td-tabs/td-tab-pane.class.d.ts +2 -3
- package/src/components/navigation/td-tabs/td-tab-pane.class.js +12 -16
- package/src/components/navigation/td-tabs/td-tab-pane.interface.d.ts +3 -4
- package/src/components/navigation/td-tabs/td-tabs.class.d.ts +2 -2
- package/src/components/navigation/td-tabs/td-tabs.class.js +6 -4
- package/src/components/navigation/td-tabs/td-tabs.interface.d.ts +3 -3
- package/src/components/others/example/example-source-wrapper.js +2 -1
- package/src/components/others/td-divider/td-divider.class.d.ts +2 -2
- package/src/components/others/td-divider/td-divider.class.js +2 -3
- package/src/components/others/td-divider/td-divider.interface.d.ts +3 -3
- package/src/constants/aria.d.ts +17 -0
- package/src/constants/aria.js +20 -0
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/use-delayed-toggle.d.ts +23 -0
- package/src/hooks/use-delayed-toggle.js +52 -0
- package/src/styles/var.d.ts +1 -15
- package/src/styles/var.js +6 -16
- package/src/utils/dom/event.d.ts +6 -0
- package/src/utils/dom/event.js +17 -0
- package/src/ui/ui.abstract.d.ts +0 -18
- package/src/ui/ui.abstract.js +0 -50
- package/src/ui/ui.interface.d.ts +0 -12
- package/src/ui/ui.interface.js +0 -2
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdDialog = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
6
|
-
const td_dialog_content_class_1 = require("../td-dialog-content/td-dialog-content.class");
|
|
7
|
-
const td_overlay_class_1 = require("../td-overlay/td-overlay.class");
|
|
8
5
|
const event_1 = require("../../../constants/event");
|
|
9
|
-
|
|
6
|
+
const td_overlay_class_1 = require("../td-overlay/td-overlay.class");
|
|
7
|
+
const td_dialog_content_class_1 = require("../td-dialog-content/td-dialog-content.class");
|
|
8
|
+
// todo 最外层是 Teleport
|
|
9
|
+
class TdDialog extends framework_1.TypeFragment {
|
|
10
10
|
constructor(params = {}) {
|
|
11
|
-
super(
|
|
11
|
+
super();
|
|
12
|
+
// this.useTag('fragment');
|
|
12
13
|
console.log('TdDialog . ');
|
|
13
14
|
this.className = 'TdDialog';
|
|
14
15
|
const appendTo = (params === null || params === void 0 ? void 0 : params.appendToBody) ? document.body : params === null || params === void 0 ? void 0 : params.appendTo;
|
|
@@ -25,31 +26,26 @@ class TdDialog extends ui_abstract_1.UI {
|
|
|
25
26
|
zIndex: td_overlay_class_1.overlayZIndex + 1000,
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
slot: this.overlay,
|
|
49
|
-
}),
|
|
50
|
-
]
|
|
29
|
+
// todo error Teleport import
|
|
30
|
+
this.content = new framework_1.Transition({
|
|
31
|
+
name: 'dialog-fade',
|
|
32
|
+
emits: {
|
|
33
|
+
afterEnter: () => {
|
|
34
|
+
console.log('afterEnter . ');
|
|
35
|
+
this.afterEnter();
|
|
36
|
+
},
|
|
37
|
+
afterLeave: () => {
|
|
38
|
+
console.log('afterLeave . ');
|
|
39
|
+
this.afterLeave();
|
|
40
|
+
},
|
|
41
|
+
beforeLeave: () => {
|
|
42
|
+
console.log('beforeLeave . ');
|
|
43
|
+
this.beforeLeave();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
slot: this.overlay,
|
|
51
47
|
});
|
|
52
|
-
this.addChild(this.
|
|
48
|
+
this.addChild(this.content);
|
|
53
49
|
this.props = this.useParams(params);
|
|
54
50
|
}
|
|
55
51
|
show() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ITdDialogContentConfig } from '../td-dialog-content/td-dialog-content.interface';
|
|
1
|
+
import { ITypeElement } from '@type-dom/framework';
|
|
3
2
|
import { UPDATE_MODEL_EVENT } from '../../../constants/event';
|
|
4
|
-
|
|
3
|
+
import { ITdDialogContentConfig } from '../td-dialog-content/td-dialog-content.interface';
|
|
4
|
+
export interface ITdDialog extends ITypeElement {
|
|
5
5
|
className: 'TdDialog';
|
|
6
6
|
}
|
|
7
7
|
export interface ITdDialogConfig extends ITdDialogContentConfig {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dialogEmits = void 0;
|
|
4
|
-
const event_1 = require("../../../constants/event");
|
|
5
4
|
const utils_1 = require("@type-dom/utils");
|
|
5
|
+
const event_1 = require("../../../constants/event");
|
|
6
6
|
exports.dialogEmits = {
|
|
7
7
|
open: () => true,
|
|
8
8
|
opened: () => true,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Div, Footer, Header } from '@type-dom/framework';
|
|
2
|
-
import { UI } from '../../../ui/ui.abstract';
|
|
1
|
+
import { Div, Footer, Header, TypeDiv } from '@type-dom/framework';
|
|
3
2
|
import { ITdDialogConfig } from '../td-dialog/td-dialog.interface';
|
|
4
3
|
import { ITdDialogContent } from './td-dialog-content.interface';
|
|
5
|
-
export declare class TdDialogContent extends
|
|
4
|
+
export declare class TdDialogContent extends TypeDiv implements ITdDialogContent {
|
|
6
5
|
className: 'TdDialogContent';
|
|
7
6
|
props: ITdDialogConfig;
|
|
8
7
|
header?: Header;
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TdDialogContent = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
5
|
const svgs_1 = require("@type-dom/svgs");
|
|
6
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
7
6
|
const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
|
|
8
7
|
const td_dialog_style_1 = require("../td-dialog/td-dialog.style");
|
|
9
|
-
class TdDialogContent extends
|
|
8
|
+
class TdDialogContent extends framework_1.TypeDiv {
|
|
10
9
|
constructor(params = {}) {
|
|
11
10
|
var _a, _b, _c;
|
|
12
|
-
super(
|
|
11
|
+
super();
|
|
13
12
|
this.className = 'TdDialogContent';
|
|
13
|
+
// this.useTag('div');
|
|
14
14
|
this.style.addObj(td_dialog_style_1.$dialogStyle);
|
|
15
15
|
this.header = new framework_1.Header({
|
|
16
16
|
className: 'td-dialog-content',
|
|
@@ -21,8 +21,9 @@ class TdDialogContent extends ui_abstract_1.UI {
|
|
|
21
21
|
width: params.width,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
this.header.addChild(this.getSlotNode('header'));
|
|
24
|
+
// this.header.addChild(this.getSlotNode('header'));
|
|
25
25
|
if ((_a = params === null || params === void 0 ? void 0 : params.slots) === null || _a === void 0 ? void 0 : _a.header) {
|
|
26
|
+
this.header.slotChild(params.slots.header);
|
|
26
27
|
}
|
|
27
28
|
else {
|
|
28
29
|
const header = new framework_1.Span({
|
|
@@ -32,7 +33,8 @@ class TdDialogContent extends ui_abstract_1.UI {
|
|
|
32
33
|
},
|
|
33
34
|
styleObj: td_dialog_style_1.$dialogTitleStyle,
|
|
34
35
|
});
|
|
35
|
-
this.
|
|
36
|
+
this.header.addChild(header);
|
|
37
|
+
// this.getSlotNode('header').addSlot(header);
|
|
36
38
|
}
|
|
37
39
|
const showClose = (_b = params === null || params === void 0 ? void 0 : params.showClose) !== null && _b !== void 0 ? _b : true;
|
|
38
40
|
const closeIcon = (params === null || params === void 0 ? void 0 : params.closeIcon) ? params.closeIcon : new td_icon_class_1.TdIcon({
|
|
@@ -63,14 +65,15 @@ class TdDialogContent extends ui_abstract_1.UI {
|
|
|
63
65
|
name: 'td-dialog-body',
|
|
64
66
|
styleObj: td_dialog_style_1.$dialogBodyStyle
|
|
65
67
|
});
|
|
66
|
-
this.body.
|
|
68
|
+
this.body.slotChild(params.slot);
|
|
67
69
|
this.addChildren(this.header, this.body);
|
|
68
70
|
if ((_c = params === null || params === void 0 ? void 0 : params.slots) === null || _c === void 0 ? void 0 : _c.footer) {
|
|
69
71
|
this.footer = new framework_1.Footer({
|
|
70
72
|
name: 'td-dialog-footer',
|
|
71
73
|
styleObj: td_dialog_style_1.$dialogFooterStyle,
|
|
72
74
|
});
|
|
73
|
-
this.footer.addChild(this.getSlotNode('footer'));
|
|
75
|
+
// this.footer.addChild(this.getSlotNode('footer'));
|
|
76
|
+
this.footer.slotChild(params.slots.footer);
|
|
74
77
|
this.addChild(this.footer);
|
|
75
78
|
}
|
|
76
79
|
this.props = this.useParams(params);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { TypeHtml } from '@type-dom/framework';
|
|
2
|
-
import { IUI, IUIConfig } from '../../../ui/ui.interface';
|
|
1
|
+
import { ITypeConfig, ITypeDiv, TypeHtml } from '@type-dom/framework';
|
|
3
2
|
import { TdIcon } from '../../basic/td-icon/td-icon.class';
|
|
4
|
-
export interface ITdDialogContent extends
|
|
3
|
+
export interface ITdDialogContent extends ITypeDiv {
|
|
5
4
|
className: 'TdDialogContent';
|
|
6
5
|
}
|
|
7
|
-
export interface ITdDialogContentConfig extends
|
|
6
|
+
export interface ITdDialogContentConfig extends ITypeConfig {
|
|
8
7
|
/**
|
|
9
8
|
* @description whether to align the header and footer in center
|
|
10
9
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transition, TypeFragment } from '@type-dom/framework';
|
|
2
2
|
import { ITdDrawer, ITdDrawerConfig } from './td-drawer.interface';
|
|
3
|
-
export declare class TdDrawer extends
|
|
3
|
+
export declare class TdDrawer extends TypeFragment implements ITdDrawer {
|
|
4
4
|
className: 'TdDrawer';
|
|
5
|
+
content: Transition;
|
|
5
6
|
props: ITdDrawerConfig;
|
|
6
|
-
private transition;
|
|
7
7
|
constructor(params?: ITdDrawerConfig);
|
|
8
8
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdDrawer = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
6
5
|
const td_overlay_class_1 = require("../td-overlay/td-overlay.class");
|
|
7
|
-
class TdDrawer extends
|
|
6
|
+
class TdDrawer extends framework_1.TypeFragment {
|
|
8
7
|
constructor(params = {}) {
|
|
9
|
-
super(
|
|
8
|
+
super();
|
|
9
|
+
// this.useTag('fragment');
|
|
10
10
|
this.className = 'TdDrawer';
|
|
11
|
-
this.
|
|
11
|
+
this.content = new framework_1.Transition({
|
|
12
12
|
name: 'fade',
|
|
13
13
|
emits: {
|
|
14
14
|
afterEnter: () => {
|
|
@@ -32,7 +32,7 @@ class TdDrawer extends ui_abstract_1.UI {
|
|
|
32
32
|
}
|
|
33
33
|
})
|
|
34
34
|
});
|
|
35
|
-
this.addChild(this.
|
|
35
|
+
this.addChild(this.content);
|
|
36
36
|
this.props = this.useParams(params);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITypeElement } from '@type-dom/framework';
|
|
2
2
|
import { ITdDialogConfig } from '../td-dialog/td-dialog.interface';
|
|
3
|
-
export interface ITdDrawer extends
|
|
3
|
+
export interface ITdDrawer extends ITypeElement {
|
|
4
4
|
className: 'TdDrawer';
|
|
5
5
|
}
|
|
6
6
|
export interface ITdDrawerConfig extends ITdDialogConfig {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare class FocusTrap {
|
|
2
|
+
private container;
|
|
3
|
+
private focusableElements;
|
|
4
|
+
private firstTabbableElement;
|
|
5
|
+
private lastTabbableElement;
|
|
6
|
+
private previousFocus;
|
|
7
|
+
constructor(container: HTMLElement);
|
|
8
|
+
enable(): void;
|
|
9
|
+
disable(): void;
|
|
10
|
+
private handleTab;
|
|
11
|
+
private handleFocusIn;
|
|
12
|
+
private getTabbableElements;
|
|
13
|
+
private getFirstTabbableElement;
|
|
14
|
+
private getLastTabbableElement;
|
|
15
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// 原生焦点捕获
|
|
3
|
+
class FocusTrap {
|
|
4
|
+
constructor(container) {
|
|
5
|
+
this.handleTab = (event) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
if (event.key === 'Tab') {
|
|
8
|
+
const { shiftKey } = event;
|
|
9
|
+
const isTabbingForward = !shiftKey;
|
|
10
|
+
const focusedElement = document.activeElement;
|
|
11
|
+
if ((isTabbingForward && focusedElement === this.lastTabbableElement) ||
|
|
12
|
+
(!isTabbingForward && focusedElement === this.firstTabbableElement)) {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
isTabbingForward ?
|
|
15
|
+
(_a = this.firstTabbableElement) === null || _a === void 0 ? void 0 : _a.focus() :
|
|
16
|
+
(_b = this.lastTabbableElement) === null || _b === void 0 ? void 0 : _b.focus();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.handleFocusIn = (event) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const focusedElement = event.target;
|
|
23
|
+
if (focusedElement && !this.container.contains(focusedElement)) {
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
(_a = this.firstTabbableElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
this.container = container;
|
|
29
|
+
this.focusableElements = this.getTabbableElements();
|
|
30
|
+
this.firstTabbableElement = this.getFirstTabbableElement();
|
|
31
|
+
this.lastTabbableElement = this.getLastTabbableElement();
|
|
32
|
+
this.previousFocus = document.activeElement;
|
|
33
|
+
}
|
|
34
|
+
enable() {
|
|
35
|
+
if (this.container) {
|
|
36
|
+
this.previousFocus = document.activeElement;
|
|
37
|
+
this.container.setAttribute('tabindex', '0');
|
|
38
|
+
this.container.focus();
|
|
39
|
+
window.addEventListener('keydown', this.handleTab);
|
|
40
|
+
window.addEventListener('focusin', this.handleFocusIn);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
disable() {
|
|
44
|
+
if (this.container) {
|
|
45
|
+
this.container.removeAttribute('tabindex');
|
|
46
|
+
if (this.previousFocus) {
|
|
47
|
+
this.previousFocus.focus();
|
|
48
|
+
}
|
|
49
|
+
window.removeEventListener('keydown', this.handleTab);
|
|
50
|
+
window.removeEventListener('focusin', this.handleFocusIn);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
getTabbableElements() {
|
|
54
|
+
return this.container.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]');
|
|
55
|
+
}
|
|
56
|
+
getFirstTabbableElement() {
|
|
57
|
+
const elements = Array.from(this.focusableElements);
|
|
58
|
+
return elements.length > 0 ? elements[0] : null;
|
|
59
|
+
}
|
|
60
|
+
getLastTabbableElement() {
|
|
61
|
+
const elements = Array.from(this.focusableElements);
|
|
62
|
+
return elements.length > 0 ? elements[elements.length - 1] : null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//
|
|
66
|
+
// // 使用示例
|
|
67
|
+
// const modal = document.getElementById('modal');
|
|
68
|
+
// const focusTrap = new FocusTrap(modal);
|
|
69
|
+
// focusTrap.enable(); // 启用 focus trap
|
|
70
|
+
// // 在需要的地方禁用 focus trap
|
|
71
|
+
// focusTrap.disable();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeElement, TypeFragment } from '@type-dom/framework';
|
|
2
2
|
import { ITdFocusTrap, ITdFocusTrapConfig } from './td-focus-trap.interface';
|
|
3
|
-
export declare class TdFocusTrap extends
|
|
3
|
+
export declare class TdFocusTrap extends TypeFragment implements ITdFocusTrap {
|
|
4
4
|
className: 'TdFocusTrap';
|
|
5
|
+
content: TypeElement;
|
|
5
6
|
props: ITdFocusTrapConfig;
|
|
6
7
|
inheritAttrs: boolean;
|
|
7
8
|
forwardRef?: HTMLElement;
|
|
@@ -15,13 +16,13 @@ export declare class TdFocusTrap extends UI<undefined> implements ITdFocusTrap {
|
|
|
15
16
|
setup(): void;
|
|
16
17
|
mounted(): void;
|
|
17
18
|
beforeDestroy(): void;
|
|
18
|
-
onKeydown(e: KeyboardEvent)
|
|
19
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
19
20
|
setFocusTrapEl(el: HTMLElement): void;
|
|
20
21
|
setForwardRef(newEl: HTMLElement, oldEl: HTMLElement): void;
|
|
21
|
-
trapOnFocus(e: Event)
|
|
22
|
-
releaseOnFocus(e: Event)
|
|
23
|
-
onFocusIn(e: FocusEvent)
|
|
24
|
-
onFocusOut(e: Event)
|
|
22
|
+
trapOnFocus: (e: Event) => void;
|
|
23
|
+
releaseOnFocus: (e: Event) => void;
|
|
24
|
+
onFocusIn: (e: FocusEvent) => void;
|
|
25
|
+
onFocusOut: (e: Event) => void;
|
|
25
26
|
startTrap(): Promise<void>;
|
|
26
27
|
stopTrap(): void;
|
|
27
28
|
}
|
|
@@ -5,13 +5,139 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const utils_1 = require("@type-dom/utils");
|
|
6
6
|
const framework_1 = require("@type-dom/framework");
|
|
7
7
|
const use_escape_keydown_1 = require("../../../hooks/use-escape-keydown");
|
|
8
|
-
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
9
8
|
const utils_2 = require("./utils");
|
|
10
9
|
const tokens_1 = require("./tokens");
|
|
11
|
-
class TdFocusTrap extends
|
|
10
|
+
class TdFocusTrap extends framework_1.TypeFragment {
|
|
12
11
|
constructor(params = {}) {
|
|
13
|
-
super(
|
|
12
|
+
super();
|
|
13
|
+
this.onKeydown = (e) => {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!this.props.loop && !this.props.trapped) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
|
|
22
|
+
const { loop } = this.props;
|
|
23
|
+
const isTabbing = key === utils_1.EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
|
|
24
|
+
const currentFocusingEl = document.activeElement;
|
|
25
|
+
if (isTabbing && currentFocusingEl) {
|
|
26
|
+
const container = currentTarget;
|
|
27
|
+
const [first, last] = (0, utils_2.getEdges)(container);
|
|
28
|
+
const isTabbable = first && last;
|
|
29
|
+
if (isTabbable) {
|
|
30
|
+
if (!shiftKey && currentFocusingEl === last) {
|
|
31
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
32
|
+
focusReason: this.focusReason
|
|
33
|
+
});
|
|
34
|
+
this.emit('focusout-prevented', focusoutPreventedEvent);
|
|
35
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
if (loop) {
|
|
38
|
+
(0, utils_2.tryFocus)(first, true);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (shiftKey &&
|
|
43
|
+
[first, container].includes(currentFocusingEl)) {
|
|
44
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
45
|
+
focusReason: this.focusReason
|
|
46
|
+
});
|
|
47
|
+
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
48
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
if (loop) {
|
|
51
|
+
(0, utils_2.tryFocus)(last, true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (currentFocusingEl === container) {
|
|
58
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
59
|
+
focusReason: this.focusReason
|
|
60
|
+
});
|
|
61
|
+
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
62
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.trapOnFocus = (e) => {
|
|
70
|
+
this.emit(tokens_1.ON_TRAP_FOCUS_EVT, e);
|
|
71
|
+
};
|
|
72
|
+
this.releaseOnFocus = (e) => {
|
|
73
|
+
this.emit(tokens_1.ON_RELEASE_FOCUS_EVT, e);
|
|
74
|
+
};
|
|
75
|
+
this.onFocusIn = (e) => {
|
|
76
|
+
var _a;
|
|
77
|
+
const trapContainer = this.forwardRef;
|
|
78
|
+
if (!trapContainer) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const target = e.target;
|
|
82
|
+
const relatedTarget = e.relatedTarget;
|
|
83
|
+
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
84
|
+
if (!this.props.trapped) {
|
|
85
|
+
const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
|
|
86
|
+
if (!isPrevFocusedInTrap) {
|
|
87
|
+
this.lastFocusBeforeTrapped = relatedTarget;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (isFocusedInTrap) {
|
|
91
|
+
this.emit('focusin', e);
|
|
92
|
+
}
|
|
93
|
+
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (this.props.trapped) {
|
|
97
|
+
if (isFocusedInTrap) {
|
|
98
|
+
this.lastFocusAfterTrapped = target;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
this.onFocusOut = (e) => {
|
|
106
|
+
var _a;
|
|
107
|
+
const trapContainer = this.forwardRef;
|
|
108
|
+
if (((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) || !trapContainer) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (this.props.trapped) {
|
|
112
|
+
const relatedTarget = e
|
|
113
|
+
.relatedTarget;
|
|
114
|
+
if (!(0, utils_1.isNil)(relatedTarget) && !trapContainer.contains(relatedTarget)) {
|
|
115
|
+
// Give embedded focus layer time to pause this layer before reclaiming focus
|
|
116
|
+
// And only reclaim focus if it should currently be trapping
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
var _a;
|
|
119
|
+
if (!((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) && this.props.trapped) {
|
|
120
|
+
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
121
|
+
focusReason: this.focusReason
|
|
122
|
+
});
|
|
123
|
+
this.emit('focusout-prevented', focusoutPreventedEvent);
|
|
124
|
+
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
125
|
+
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, 0);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const target = e.target;
|
|
133
|
+
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
134
|
+
if (!isFocusedInTrap)
|
|
135
|
+
this.emit('focusout', e);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// this.useTag('fragment');
|
|
14
139
|
this.className = 'TdFocusTrap';
|
|
140
|
+
this.content = params.slot;
|
|
15
141
|
this.inheritAttrs = false;
|
|
16
142
|
this.props = this.useParams(params);
|
|
17
143
|
}
|
|
@@ -50,62 +176,6 @@ class TdFocusTrap extends ui_abstract_1.UI {
|
|
|
50
176
|
var _a;
|
|
51
177
|
(_a = this.escapeKeydown) === null || _a === void 0 ? void 0 : _a.beforeDestroy();
|
|
52
178
|
}
|
|
53
|
-
onKeydown(e) {
|
|
54
|
-
var _a;
|
|
55
|
-
if (!this.props.loop && !this.props.trapped) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
|
|
62
|
-
const { loop } = this.props;
|
|
63
|
-
const isTabbing = key === utils_1.EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
|
|
64
|
-
const currentFocusingEl = document.activeElement;
|
|
65
|
-
if (isTabbing && currentFocusingEl) {
|
|
66
|
-
const container = currentTarget;
|
|
67
|
-
const [first, last] = (0, utils_2.getEdges)(container);
|
|
68
|
-
const isTabbable = first && last;
|
|
69
|
-
if (isTabbable) {
|
|
70
|
-
if (!shiftKey && currentFocusingEl === last) {
|
|
71
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
72
|
-
focusReason: this.focusReason
|
|
73
|
-
});
|
|
74
|
-
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
75
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
76
|
-
e.preventDefault();
|
|
77
|
-
if (loop) {
|
|
78
|
-
(0, utils_2.tryFocus)(first, true);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else if (shiftKey &&
|
|
83
|
-
[first, container].includes(currentFocusingEl)) {
|
|
84
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
85
|
-
focusReason: this.focusReason
|
|
86
|
-
});
|
|
87
|
-
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
88
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
if (loop) {
|
|
91
|
-
(0, utils_2.tryFocus)(last, true);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
if (currentFocusingEl === container) {
|
|
98
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
99
|
-
focusReason: this.focusReason
|
|
100
|
-
});
|
|
101
|
-
// emit('focusout-prevented', focusoutPreventedEvent);
|
|
102
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
179
|
setFocusTrapEl(el) {
|
|
110
180
|
if (el) {
|
|
111
181
|
this.props.focusTrapEl = el;
|
|
@@ -124,76 +194,6 @@ class TdFocusTrap extends ui_abstract_1.UI {
|
|
|
124
194
|
oldEl.removeEventListener('focusout', this.onFocusOut);
|
|
125
195
|
}
|
|
126
196
|
}
|
|
127
|
-
trapOnFocus(e) {
|
|
128
|
-
this.emit(tokens_1.ON_TRAP_FOCUS_EVT, e);
|
|
129
|
-
}
|
|
130
|
-
releaseOnFocus(e) {
|
|
131
|
-
this.emit(tokens_1.ON_RELEASE_FOCUS_EVT, e);
|
|
132
|
-
}
|
|
133
|
-
onFocusIn(e) {
|
|
134
|
-
var _a;
|
|
135
|
-
const trapContainer = this.forwardRef;
|
|
136
|
-
if (!trapContainer) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const target = e.target;
|
|
140
|
-
const relatedTarget = e.relatedTarget;
|
|
141
|
-
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
142
|
-
if (!this.props.trapped) {
|
|
143
|
-
const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
|
|
144
|
-
if (!isPrevFocusedInTrap) {
|
|
145
|
-
this.lastFocusBeforeTrapped = relatedTarget;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (isFocusedInTrap) {
|
|
149
|
-
this.emit('focusin', e);
|
|
150
|
-
}
|
|
151
|
-
if ((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
if (this.props.trapped) {
|
|
155
|
-
if (isFocusedInTrap) {
|
|
156
|
-
this.lastFocusAfterTrapped = target;
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
;
|
|
164
|
-
onFocusOut(e) {
|
|
165
|
-
var _a;
|
|
166
|
-
const trapContainer = this.forwardRef;
|
|
167
|
-
if (((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) || !trapContainer) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (this.props.trapped) {
|
|
171
|
-
const relatedTarget = e
|
|
172
|
-
.relatedTarget;
|
|
173
|
-
if (!(0, utils_1.isNil)(relatedTarget) && !trapContainer.contains(relatedTarget)) {
|
|
174
|
-
// Give embedded focus layer time to pause this layer before reclaiming focus
|
|
175
|
-
// And only reclaim focus if it should currently be trapping
|
|
176
|
-
setTimeout(() => {
|
|
177
|
-
var _a;
|
|
178
|
-
if (!((_a = this.focusLayer) === null || _a === void 0 ? void 0 : _a.paused) && this.props.trapped) {
|
|
179
|
-
const focusoutPreventedEvent = (0, utils_2.createFocusOutPreventedEvent)({
|
|
180
|
-
focusReason: this.focusReason
|
|
181
|
-
});
|
|
182
|
-
this.emit('focusout-prevented', focusoutPreventedEvent);
|
|
183
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
184
|
-
(0, utils_2.tryFocus)(this.lastFocusAfterTrapped, true);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}, 0);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
const target = e.target;
|
|
192
|
-
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
193
|
-
if (!isFocusedInTrap)
|
|
194
|
-
this.emit('focusout', e);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
197
|
startTrap() {
|
|
198
198
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
199
199
|
// Wait for forwardRef to resolve
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITypeConfig, ITypeElement } from '@type-dom/framework';
|
|
2
2
|
import { ON_RELEASE_FOCUS_EVT, ON_TRAP_FOCUS_EVT } from './tokens';
|
|
3
|
-
export interface ITdFocusTrap extends
|
|
3
|
+
export interface ITdFocusTrap extends ITypeElement {
|
|
4
4
|
className: 'TdFocusTrap';
|
|
5
5
|
}
|
|
6
|
-
export interface ITdFocusTrapConfig extends
|
|
6
|
+
export interface ITdFocusTrapConfig extends ITypeConfig {
|
|
7
7
|
loop?: boolean;
|
|
8
8
|
trapped?: boolean;
|
|
9
9
|
focusTrapEl?: HTMLElement;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeTransition } from '@type-dom/framework';
|
|
2
2
|
import { ITdLoading, ITdLoadingConfig } from './td-loading.interface';
|
|
3
|
-
export declare class TdLoading extends
|
|
3
|
+
export declare class TdLoading extends TypeTransition implements ITdLoading {
|
|
4
4
|
className: 'TdLoading';
|
|
5
5
|
props: ITdLoadingConfig;
|
|
6
|
-
private transition;
|
|
7
6
|
private mask;
|
|
8
7
|
private svg;
|
|
9
8
|
private spinner;
|