@globalpayments/vega 2.47.0 → 2.48.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/dist/cjs/{app-globals-981f7aba.js → app-globals-22798708.js} +6 -6
- package/dist/cjs/brand-switch-state-controller-slimmer-5efa1b24.js +51 -0
- package/dist/cjs/{content-state-605de6a3.js → content-state-54d94562.js} +221 -5
- package/dist/cjs/{dark-mode-state-controller-slimmer-2af3e67c.js → dark-mode-state-controller-slimmer-add5d8a8.js} +1 -1
- package/dist/cjs/{dark-mode-style-controller-c93b94d2.js → dark-mode-style-controller-4adb7fb2.js} +20 -17
- package/dist/cjs/{design-token-117a19a8.js → design-token-1abb655a.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-4bdbd76d.js → element-appender-slimmer-2d4c8c18.js} +4 -4
- package/dist/cjs/{form-field-controller-slimmer-6d69c74f.js → form-field-controller-slimmer-527c25a0.js} +4 -4
- package/dist/cjs/{image-annotation-action-5e3aa73c.js → image-annotation-action-b78404b8.js} +2 -2
- package/dist/cjs/{index-ec9a1f36.js → index-c4dec3aa.js} +1 -1
- package/dist/cjs/index.cjs.js +10 -10
- package/dist/cjs/{inject-keyboard-manager-d1eac696.js → inject-keyboard-manager-b301e887.js} +1 -1
- package/dist/cjs/{keyboard-manager-97d0ddfa.js → keyboard-manager-2ccf4b16.js} +25 -5
- package/dist/cjs/{keyboard-manager-slimmer-23ce5dcf.js → keyboard-manager-slimmer-900cf2f5.js} +1 -1
- package/dist/cjs/loader.cjs.js +9 -9
- package/dist/cjs/{min-number-rule-5bcccc8f.js → min-number-rule-965fc43d.js} +2 -2
- package/dist/cjs/{public-rules-66f53e7e.js → public-rules-c4d2df9d.js} +5 -5
- package/dist/cjs/{responsive-format-facade-3542fc47.js → responsive-format-facade-38f3763e.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-649ef4b4.js → rich-text-editor-required-rule-e73f2c4f.js} +1 -1
- package/dist/cjs/{static-subject-title-1d23c102.js → static-subject-title-7e7d791a.js} +2 -2
- package/dist/cjs/{string-input-formatter-slimmer-56a2401f.js → string-input-formatter-slimmer-50322824.js} +2 -2
- package/dist/cjs/{style-formatter-b735d506.js → style-formatter-ecb4d49c.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-b16c9094.js → sub-state-notify-slimmer-7f437b19.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-1b6de09f.js → sub-state-observer-slimmer-e90362cd.js} +1 -1
- package/dist/cjs/{translation-5173d223.js → translation-212b1875.js} +1 -1
- package/dist/cjs/{translation-slimmer-e900e8d4.js → translation-slimmer-d1512c6d.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +8 -8
- package/dist/cjs/vega-app-footer.cjs.entry.js +38 -28
- package/dist/cjs/vega-app-header-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-box.cjs.entry.js +9 -9
- package/dist/cjs/vega-brand-logo.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-circle.cjs.entry.js +8 -8
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +7 -7
- package/dist/cjs/vega-calendar_3.cjs.entry.js +6 -6
- package/dist/cjs/vega-card.cjs.entry.js +8 -8
- package/dist/cjs/vega-carousel.cjs.entry.js +7 -7
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-chip.cjs.entry.js +8 -8
- package/dist/cjs/vega-color-picker.cjs.entry.js +5 -5
- package/dist/cjs/vega-combo-box.cjs.entry.js +7 -7
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-dialog_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-divider.cjs.entry.js +8 -8
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +14 -14
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
- package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
- package/dist/cjs/vega-flag-icon.cjs.entry.js +8 -8
- package/dist/cjs/vega-flex.cjs.entry.js +9 -9
- package/dist/cjs/vega-font.cjs.entry.js +8 -8
- package/dist/cjs/vega-form.cjs.entry.js +6 -6
- package/dist/cjs/vega-grid.cjs.entry.js +8 -8
- package/dist/cjs/vega-icon.cjs.entry.js +8 -8
- package/dist/cjs/vega-image-uploader.cjs.entry.js +20 -11
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-numeric.cjs.entry.js +13 -10
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-range.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-select.cjs.entry.js +10 -10
- package/dist/cjs/vega-input.cjs.entry.js +10 -10
- package/dist/cjs/{vega-internal-event-id-dc866d43.js → vega-internal-event-id-bfea9b93.js} +4 -0
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +459 -198
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination.cjs.entry.js +8 -8
- package/dist/cjs/vega-popover_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-radio_2.cjs.entry.js +10 -7
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +14 -14
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +453 -197
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +9 -9
- package/dist/cjs/vega-signature-capture.cjs.entry.js +11 -11
- package/dist/cjs/{vega-skeleton-loader-controller-8cbd7656.js → vega-skeleton-loader-controller-db868c98.js} +3 -3
- package/dist/cjs/vega-stepper.cjs.entry.js +8 -8
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-table_8.cjs.entry.js +10 -10
- package/dist/cjs/vega-textarea.cjs.entry.js +5 -5
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +13 -13
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +5 -5
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +15 -15
- package/dist/cjs/vega.cjs.js +9 -9
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +42 -31
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/vega-dropdown-item.css +4 -2
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +3 -0
- package/dist/collection/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-actions-renderer.js +4 -1
- package/dist/collection/components/vega-image-uploader/vega-image-uploader.js +11 -1
- package/dist/collection/components/vega-input/vega-input.js +4 -4
- package/dist/collection/components/vega-nav/slimmers/vega-left-nav-group-hierarchy-controller.js +31 -0
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/renderers/vega-left-nav-header-renderer.js +5 -4
- package/dist/collection/components/vega-nav/vega-left-nav/test/vega-left-nav-mock-data.js +147 -0
- package/dist/collection/components/vega-nav/vega-left-nav/vega-left-nav.js +50 -8
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-initialize-selected-controller.js +56 -0
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-link-click-controller.js +70 -0
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-open-state-controller.js +47 -0
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-other-groups-click-controller.js +60 -0
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/renderers/vega-left-nav-group-renderer.js +10 -9
- package/dist/collection/components/vega-nav/vega-left-nav-group/vega-left-nav-group.js +21 -6
- package/dist/collection/components/vega-nav/vega-left-nav-link/slimmers/controllers/vega-left-nav-link-controller.js +21 -0
- package/dist/collection/components/vega-nav/vega-left-nav-link/slimmers/renderers/vega-left-nav-link-renderer.js +13 -1
- package/dist/collection/components/vega-nav/vega-left-nav-link/vega-left-nav-link.js +5 -0
- package/dist/collection/components/vega-popover/vega-popover.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +7 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/selection-range-annotation.js +8 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +8 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +47 -2
- package/dist/collection/components/vega-rich-text-editor/dto/editor-state.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +8 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +7 -1
- package/dist/collection/components/vega-rich-text-editor/dto/range.js +8 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/selection-state.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +18 -15
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/history-controller.js +137 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +54 -15
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +13 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +116 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/slimmers/renderers/vega-rich-text-image-editor-renderer.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.js +2 -1
- package/dist/collection/components/vega-stepper/vega-stepper.js +2 -2
- package/dist/collection/components/vega-tab-group/vega-tab-group.js +3 -0
- package/dist/collection/components/vega-time-picker/vega-time-picker.js +3 -0
- package/dist/collection/components/vega-tooltip/vega-tooltip.js +3 -0
- package/dist/collection/constants/misc.js +2 -0
- package/dist/collection/helpers/change-manager/subject/static-subject/static-subject-title.js +1 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +2 -0
- package/dist/collection/helpers/keyboard/keyboard-manager.js +25 -5
- package/dist/collection/helpers/keyboard/test/keyboard-manager.test.js +204 -105
- package/dist/collection/helpers/slimmers/brand-switch-state-controller-slimmer.js +46 -0
- package/dist/collection/helpers/slimmers/test/brand-switch-state-controller-slimmer.test.js +75 -0
- package/dist/collection/helpers/theme/controllers/{new-brand-style-controller.js → brand-style-controller.js} +9 -9
- package/dist/collection/helpers/theme/controllers/dark-mode-style-controller.js +1 -1
- package/dist/collection/helpers/theme/internal-theme-manager.js +12 -9
- package/dist/collection/helpers/theme/tests/theme-manager-controller.test.js +4 -4
- package/dist/collection/helpers/theme/theme-manager.js +2 -2
- package/dist/collection/helpers/validator/rules/max-number-rule.js +1 -1
- package/dist/collection/helpers/validator/rules/min-number-rule.js +1 -1
- package/dist/collection/helpers/validator/test/rules/max-number-rule.test.js +2 -2
- package/dist/collection/helpers/validator/test/rules/min-number-rule.test.js +2 -2
- package/dist/esm/{app-globals-c055c18a.js → app-globals-1bb57f5e.js} +6 -6
- package/dist/esm/brand-switch-state-controller-slimmer-05c85e6d.js +49 -0
- package/dist/esm/{content-state-8d0d38d7.js → content-state-6dba6625.js} +221 -5
- package/dist/esm/{dark-mode-state-controller-slimmer-0678a94b.js → dark-mode-state-controller-slimmer-f1c2c299.js} +1 -1
- package/dist/esm/{dark-mode-style-controller-e5915f26.js → dark-mode-style-controller-2ada8e22.js} +20 -17
- package/dist/esm/{design-token-7406782c.js → design-token-070b7326.js} +1 -1
- package/dist/esm/{element-appender-slimmer-16eaeb31.js → element-appender-slimmer-d196dd21.js} +4 -4
- package/dist/esm/{form-field-controller-slimmer-a383d067.js → form-field-controller-slimmer-e7dc3db1.js} +4 -4
- package/dist/esm/{image-annotation-action-de567e61.js → image-annotation-action-0b661259.js} +2 -2
- package/dist/esm/{index-96374234.js → index-4aa167d6.js} +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/{inject-keyboard-manager-ab0bfb8b.js → inject-keyboard-manager-f513be4a.js} +1 -1
- package/dist/esm/{keyboard-manager-8c4ef91b.js → keyboard-manager-262be5ce.js} +25 -5
- package/dist/esm/{keyboard-manager-slimmer-6f5cb52a.js → keyboard-manager-slimmer-42bf9773.js} +1 -1
- package/dist/esm/loader.js +9 -9
- package/dist/esm/{min-number-rule-a6082418.js → min-number-rule-86421853.js} +2 -2
- package/dist/esm/{public-rules-f9fe1987.js → public-rules-f9aaa527.js} +5 -5
- package/dist/esm/{responsive-format-facade-299d8ee9.js → responsive-format-facade-dfed6d94.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-7fd7dcb3.js → rich-text-editor-required-rule-42b796eb.js} +1 -1
- package/dist/esm/{static-subject-title-4a9deb68.js → static-subject-title-ca83d6b6.js} +2 -2
- package/dist/esm/{string-input-formatter-slimmer-8c7987ac.js → string-input-formatter-slimmer-c61f82d6.js} +2 -2
- package/dist/esm/{style-formatter-2ebb1fd2.js → style-formatter-788dbacf.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-2216c7dc.js → sub-state-notify-slimmer-4e3cf09d.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-da938c88.js → sub-state-observer-slimmer-be7a6ce3.js} +1 -1
- package/dist/esm/{translation-78207e81.js → translation-cf7f020a.js} +1 -1
- package/dist/esm/{translation-slimmer-d49fcdf4.js → translation-slimmer-88966d5c.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +8 -8
- package/dist/esm/vega-app-footer.entry.js +38 -28
- package/dist/esm/vega-app-header-button.entry.js +8 -8
- package/dist/esm/vega-box.entry.js +9 -9
- package/dist/esm/vega-brand-logo.entry.js +3 -3
- package/dist/esm/vega-button-circle.entry.js +8 -8
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +7 -7
- package/dist/esm/vega-calendar_3.entry.js +6 -6
- package/dist/esm/vega-card.entry.js +8 -8
- package/dist/esm/vega-carousel.entry.js +7 -7
- package/dist/esm/vega-checkbox_2.entry.js +5 -5
- package/dist/esm/vega-chip.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +5 -5
- package/dist/esm/vega-combo-box.entry.js +7 -7
- package/dist/esm/vega-date-picker_2.entry.js +15 -15
- package/dist/esm/vega-dialog_2.entry.js +8 -8
- package/dist/esm/vega-divider.entry.js +8 -8
- package/dist/esm/vega-dropdown_5.entry.js +14 -14
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +1 -1
- package/dist/esm/vega-file-uploader.entry.js +6 -6
- package/dist/esm/vega-flag-icon.entry.js +8 -8
- package/dist/esm/vega-flex.entry.js +9 -9
- package/dist/esm/vega-font.entry.js +8 -8
- package/dist/esm/vega-form.entry.js +6 -6
- package/dist/esm/vega-grid.entry.js +8 -8
- package/dist/esm/vega-icon.entry.js +8 -8
- package/dist/esm/vega-image-uploader.entry.js +20 -11
- package/dist/esm/vega-input-credit-card.entry.js +5 -5
- package/dist/esm/vega-input-numeric.entry.js +13 -10
- package/dist/esm/vega-input-phone-number.entry.js +5 -5
- package/dist/esm/vega-input-range.entry.js +6 -6
- package/dist/esm/vega-input-select.entry.js +10 -10
- package/dist/esm/vega-input.entry.js +10 -10
- package/dist/esm/{vega-internal-event-id-7d1ff289.js → vega-internal-event-id-85ad403f.js} +3 -1
- package/dist/esm/vega-left-nav_5.entry.js +459 -198
- package/dist/esm/vega-loader-wrapper_2.entry.js +7 -7
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +1 -1
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination.entry.js +8 -8
- package/dist/esm/vega-popover_2.entry.js +15 -15
- package/dist/esm/vega-radio_2.entry.js +10 -7
- package/dist/esm/vega-rich-text-content.entry.js +14 -14
- package/dist/esm/vega-rich-text-editor_4.entry.js +453 -197
- package/dist/esm/vega-selection-chip_2.entry.js +10 -10
- package/dist/esm/vega-selection-tile_2.entry.js +6 -6
- package/dist/esm/vega-sidenav_3.entry.js +9 -9
- package/dist/esm/vega-signature-capture.entry.js +11 -11
- package/dist/esm/{vega-skeleton-loader-controller-90e8d34d.js → vega-skeleton-loader-controller-c2a8bd27.js} +3 -3
- package/dist/esm/vega-stepper.entry.js +8 -8
- package/dist/esm/vega-tab-group_2.entry.js +1 -1
- package/dist/esm/vega-table_8.entry.js +10 -10
- package/dist/esm/vega-textarea.entry.js +5 -5
- package/dist/esm/vega-time-picker_2.entry.js +13 -13
- package/dist/esm/vega-toggle-switch.entry.js +5 -5
- package/dist/esm/vega-tooltip_2.entry.js +15 -15
- package/dist/esm/vega.js +9 -9
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +8 -3
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +3 -0
- package/dist/types/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-actions-renderer.d.ts +1 -0
- package/dist/types/components/vega-image-uploader/vega-image-uploader.d.ts +3 -0
- package/dist/types/components/vega-input/vega-input.d.ts +2 -2
- package/dist/types/components/vega-nav/interface.d.ts +11 -0
- package/dist/types/components/vega-nav/slimmers/vega-left-nav-group-hierarchy-controller.d.ts +15 -0
- package/dist/types/components/vega-nav/vega-left-nav/slimmers/renderers/vega-left-nav-header-renderer.d.ts +1 -0
- package/dist/types/components/vega-nav/vega-left-nav/test/vega-left-nav-mock-data.d.ts +4 -0
- package/dist/types/components/vega-nav/vega-left-nav/vega-left-nav.d.ts +25 -4
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-initialize-selected-controller.d.ts +20 -0
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-link-click-controller.d.ts +25 -0
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-open-state-controller.d.ts +27 -0
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-other-groups-click-controller.d.ts +17 -0
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/renderers/vega-left-nav-group-renderer.d.ts +2 -1
- package/dist/types/components/vega-nav/vega-left-nav-group/vega-left-nav-group.d.ts +12 -5
- package/dist/types/components/vega-nav/vega-left-nav-link/slimmers/controllers/vega-left-nav-link-controller.d.ts +5 -0
- package/dist/types/components/vega-nav/vega-left-nav-link/slimmers/renderers/vega-left-nav-link-renderer.d.ts +2 -0
- package/dist/types/components/vega-nav/vega-left-nav-link/vega-left-nav-link.d.ts +2 -0
- package/dist/types/components/vega-popover/vega-popover.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/selection-range-annotation.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +9 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +19 -1
- package/dist/types/components/vega-rich-text-editor/dto/editor-state.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +9 -1
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/range.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/dto/selection-state.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/history-controller.d.ts +54 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +14 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +4 -1
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +2 -0
- package/dist/types/components/vega-tab-group/vega-tab-group.d.ts +3 -0
- package/dist/types/components/vega-time-picker/vega-time-picker.d.ts +3 -0
- package/dist/types/components/vega-tooltip/vega-tooltip.d.ts +3 -0
- package/dist/types/components.d.ts +23 -11
- package/dist/types/constants/misc.d.ts +2 -0
- package/dist/types/helpers/change-manager/subject/static-subject/static-subject-title.d.ts +2 -2
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +2 -0
- package/dist/types/helpers/keyboard/keyboard-manager.d.ts +11 -1
- package/dist/types/helpers/slimmers/brand-switch-state-controller-slimmer.d.ts +22 -0
- package/dist/types/helpers/slimmers/test/brand-switch-state-controller-slimmer.test.d.ts +1 -0
- package/dist/types/helpers/theme/controllers/{new-brand-style-controller.d.ts → brand-style-controller.d.ts} +3 -3
- package/dist/types/helpers/theme/internal-theme-manager.d.ts +8 -8
- package/dist/types/helpers/theme/theme-manager.d.ts +4 -4
- package/dist/types/helpers/theme/theme.d.ts +6 -1
- package/dist/types/types/components.type.d.ts +1 -0
- package/dist/types/types/public-api.d.ts +1 -1
- package/dist/types/types/ui.type.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-f01300ea.entry.js → p-024cccab.entry.js} +1 -1
- package/dist/vega/{p-8f98e604.entry.js → p-07d1c3e1.entry.js} +1 -1
- package/dist/vega/{p-eaab3fea.entry.js → p-0969877b.entry.js} +1 -1
- package/dist/vega/{p-a9f2ad08.entry.js → p-09c13382.entry.js} +1 -1
- package/dist/vega/{p-b5f05d21.entry.js → p-09f7f841.entry.js} +1 -1
- package/dist/vega/{p-20af6415.entry.js → p-0a18f5f6.entry.js} +1 -1
- package/dist/vega/{p-d54c48b0.js → p-0d355793.js} +1 -1
- package/dist/vega/{p-f3f73fd3.entry.js → p-10f1429e.entry.js} +1 -1
- package/dist/vega/{p-0835a2fd.js → p-1503f791.js} +1 -1
- package/dist/vega/p-1b3f492f.entry.js +1 -0
- package/dist/vega/{p-d2947f32.entry.js → p-1d0cf3ae.entry.js} +1 -1
- package/dist/vega/{p-4b541ce8.entry.js → p-2198de3e.entry.js} +1 -1
- package/dist/vega/{p-e3b70eed.entry.js → p-2491d18f.entry.js} +1 -1
- package/dist/vega/{p-e309bfd1.entry.js → p-24e0cdcc.entry.js} +1 -1
- package/dist/vega/{p-aa29ccd4.entry.js → p-27e3825f.entry.js} +1 -1
- package/dist/vega/p-27e56c67.entry.js +1 -0
- package/dist/vega/{p-76a3a552.entry.js → p-292b421a.entry.js} +1 -1
- package/dist/vega/{p-d2a65457.entry.js → p-2ecae9fe.entry.js} +1 -1
- package/dist/vega/{p-562de411.entry.js → p-2fadef27.entry.js} +1 -1
- package/dist/vega/{p-b4108ddb.entry.js → p-31ec679b.entry.js} +1 -1
- package/dist/vega/{p-f5fdf1ae.entry.js → p-32c68611.entry.js} +1 -1
- package/dist/vega/{p-42b62b48.js → p-32ca74b1.js} +1 -1
- package/dist/vega/{p-4640d35d.entry.js → p-353d32c0.entry.js} +1 -1
- package/dist/vega/{p-63ea4f38.entry.js → p-371cc8e8.entry.js} +1 -1
- package/dist/vega/{p-84aa2ebc.entry.js → p-38fa38dc.entry.js} +1 -1
- package/dist/vega/{p-720d87f9.entry.js → p-472727a4.entry.js} +1 -1
- package/dist/vega/{p-12a8d705.js → p-48b7f20d.js} +1 -1
- package/dist/vega/p-4e68dfd9.js +1 -0
- package/dist/vega/{p-693934d5.entry.js → p-4fa94b35.entry.js} +1 -1
- package/dist/vega/{p-c17b7a1f.js → p-50677c8e.js} +1 -1
- package/dist/vega/{p-1486bc3f.js → p-50e80afa.js} +1 -1
- package/dist/vega/p-56a0b13d.js +1 -0
- package/dist/vega/p-575ca599.entry.js +1 -0
- package/dist/vega/{p-23a26150.js → p-5773a9a3.js} +1 -1
- package/dist/vega/{p-7a3826a0.entry.js → p-57e813f2.entry.js} +1 -1
- package/dist/vega/{p-90ebcda7.entry.js → p-5a8f129f.entry.js} +1 -1
- package/dist/vega/p-5c1eedc5.js +1 -0
- package/dist/vega/{p-0a3607f7.entry.js → p-5c3da7ed.entry.js} +1 -1
- package/dist/vega/{p-b2643e88.js → p-5e3a15a1.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-23ff7605.entry.js → p-65a76f19.entry.js} +1 -1
- package/dist/vega/p-6be16084.js +1 -0
- package/dist/vega/{p-69cc3fa2.js → p-6cabdb36.js} +1 -1
- package/dist/vega/{p-d296cf86.entry.js → p-6cc32ffa.entry.js} +1 -1
- package/dist/vega/{p-d7642125.js → p-72ecfd40.js} +1 -1
- package/dist/vega/{p-be186a9f.entry.js → p-7581d242.entry.js} +1 -1
- package/dist/vega/{p-a0b6da44.js → p-75c68f51.js} +1 -1
- package/dist/vega/p-7db32dc0.entry.js +1 -0
- package/dist/vega/{p-f0c85061.js → p-7f6702f7.js} +1 -1
- package/dist/vega/{p-7f1a7346.entry.js → p-84298e28.entry.js} +1 -1
- package/dist/vega/{p-704d9730.js → p-8ade44bf.js} +1 -1
- package/dist/vega/p-8bc4c015.entry.js +1 -0
- package/dist/vega/{p-e66515c7.js → p-8d283666.js} +1 -1
- package/dist/vega/p-904d1b43.js +1 -0
- package/dist/vega/{p-c87b5c83.entry.js → p-971f7d3c.entry.js} +1 -1
- package/dist/vega/{p-1138fa63.entry.js → p-9dba10f7.entry.js} +1 -1
- package/dist/vega/p-aea89be5.entry.js +1 -0
- package/dist/vega/p-b1f9fca8.entry.js +1 -0
- package/dist/vega/{p-ff9e8753.entry.js → p-b3e1dc86.entry.js} +1 -1
- package/dist/vega/{p-327a017b.entry.js → p-baca6dfc.entry.js} +1 -1
- package/dist/vega/p-bf1894ec.js +1 -0
- package/dist/vega/p-c5f8b3a3.entry.js +1 -0
- package/dist/vega/p-c6a3fe8a.entry.js +1 -0
- package/dist/vega/p-c754b32c.js +1 -0
- package/dist/vega/p-cc43a4ca.js +1 -0
- package/dist/vega/{p-f3efc8f0.entry.js → p-ccdd49be.entry.js} +1 -1
- package/dist/vega/p-cd205d96.js +1 -0
- package/dist/vega/{p-414e7edc.entry.js → p-d033ed44.entry.js} +1 -1
- package/dist/vega/{p-7cc3feb4.entry.js → p-d6591d70.entry.js} +1 -1
- package/dist/vega/{p-80c86d79.js → p-d7937711.js} +1 -1
- package/dist/vega/{p-26005df1.js → p-db4112af.js} +1 -1
- package/dist/vega/{p-90e70662.entry.js → p-db7a6878.entry.js} +1 -1
- package/dist/vega/{p-0e7fc736.entry.js → p-dd33bc71.entry.js} +1 -1
- package/dist/vega/{p-fb6d87cd.entry.js → p-e8f16f1d.entry.js} +1 -1
- package/dist/vega/{p-ba0a76fe.entry.js → p-ed6cc75b.entry.js} +1 -1
- package/dist/vega/p-f4d3387c.entry.js +1 -0
- package/dist/vega/{p-27287998.entry.js → p-f5b19d4f.entry.js} +1 -1
- package/dist/vega/{p-1114896d.entry.js → p-f7423232.entry.js} +1 -1
- package/dist/vega/p-fba4bae5.js +1 -0
- package/dist/vega/p-fda0c179.entry.js +1 -0
- package/dist/vega/p-ff41dc6a.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-controller.js +0 -30
- package/dist/collection/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-sibling-observer-controller.js +0 -48
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-controller.d.ts +0 -11
- package/dist/types/components/vega-nav/vega-left-nav-group/slimmers/controllers/vega-left-nav-group-sibling-observer-controller.d.ts +0 -18
- package/dist/vega/p-06d7990e.js +0 -1
- package/dist/vega/p-1154e439.entry.js +0 -1
- package/dist/vega/p-12d60f5f.js +0 -1
- package/dist/vega/p-214aa52e.js +0 -1
- package/dist/vega/p-2c0d1ec9.entry.js +0 -1
- package/dist/vega/p-2e65e175.js +0 -1
- package/dist/vega/p-3165ee95.entry.js +0 -1
- package/dist/vega/p-380ba357.entry.js +0 -1
- package/dist/vega/p-41c48bcc.entry.js +0 -1
- package/dist/vega/p-4c62c178.entry.js +0 -1
- package/dist/vega/p-626dd54f.entry.js +0 -1
- package/dist/vega/p-6f2faa34.js +0 -1
- package/dist/vega/p-6f9731a1.entry.js +0 -1
- package/dist/vega/p-7f9dd834.entry.js +0 -1
- package/dist/vega/p-865b45dc.entry.js +0 -1
- package/dist/vega/p-b07add9c.entry.js +0 -1
- package/dist/vega/p-b9051ad2.js +0 -1
- package/dist/vega/p-da40b4c3.js +0 -1
- package/dist/vega/p-f2373487.js +0 -1
- package/dist/vega/p-ff8ef8af.entry.js +0 -1
- package/dist/vega/p-ff9ccfa8.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getDeepActiveElementInShadow, isParent } from '../../utils/ui';
|
|
2
|
+
import { isNonNullable } from '../../types/type-guard';
|
|
2
3
|
/**
|
|
3
4
|
* It listens to the keyup event on the window and calls the appropriate method on the registered elements
|
|
4
5
|
*
|
|
@@ -53,9 +54,8 @@ class KeyboardManager {
|
|
|
53
54
|
* listener.
|
|
54
55
|
*/
|
|
55
56
|
invokeListeners(eventName, event) {
|
|
56
|
-
const keyCode = event.code;
|
|
57
57
|
this.listeners
|
|
58
|
-
.filter((listener) => listener.eventName === eventName && this.shouldInvokeListener(listener,
|
|
58
|
+
.filter((listener) => listener.eventName === eventName && this.shouldInvokeListener(listener, event))
|
|
59
59
|
.forEach((listener) => listener.callback(event));
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -64,10 +64,11 @@ class KeyboardManager {
|
|
|
64
64
|
*
|
|
65
65
|
* @param {KeyboardEventListener} listener - KeyboardEventListener - the listener object that we're
|
|
66
66
|
* checking
|
|
67
|
-
* @param {
|
|
67
|
+
* @param {KeyboardEvent} event - The keyboard event that triggered the listener.
|
|
68
68
|
* @returns {boolean} - should invoke
|
|
69
69
|
*/
|
|
70
|
-
shouldInvokeListener(listener,
|
|
70
|
+
shouldInvokeListener(listener, event) {
|
|
71
|
+
const keyCode = event.code;
|
|
71
72
|
let activeElementInScope = [];
|
|
72
73
|
let activeElementOutScope = [];
|
|
73
74
|
const isKeyCodeAccepted = Array.isArray(listener.keyCode)
|
|
@@ -95,7 +96,26 @@ class KeyboardManager {
|
|
|
95
96
|
const isActiveElementOutScope = listener.activeElementOutScope
|
|
96
97
|
? activeElementOutScope.every((element) => !isParent(getDeepActiveElementInShadow(), element))
|
|
97
98
|
: true;
|
|
98
|
-
|
|
99
|
+
const isExpectedModifierPressed = isNonNullable(listener.modifierPressed)
|
|
100
|
+
? listener.modifierPressed === this.isModifierPressed(event)
|
|
101
|
+
: true;
|
|
102
|
+
const isExpectedShiftKeyPressed = isNonNullable(listener.shiftKey)
|
|
103
|
+
? listener.shiftKey === event.shiftKey
|
|
104
|
+
: true;
|
|
105
|
+
return (isKeyCodeAccepted &&
|
|
106
|
+
isActiveElementInScope &&
|
|
107
|
+
isActiveElementOutScope &&
|
|
108
|
+
isExpectedModifierPressed &&
|
|
109
|
+
isExpectedShiftKeyPressed);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Checks if the platform modifier key (Meta on Mac, Ctrl on Windows) is pressed.
|
|
113
|
+
*
|
|
114
|
+
* @param {KeyboardEvent} e - The keyboard event to check.
|
|
115
|
+
* @returns {boolean} - True if the platform modifier key is pressed, false otherwise.
|
|
116
|
+
*/
|
|
117
|
+
isModifierPressed(e) {
|
|
118
|
+
return /Mac|iPhone|iPad/.test(navigator.userAgent) ? e.metaKey : e.ctrlKey;
|
|
99
119
|
}
|
|
100
120
|
}
|
|
101
121
|
export default new KeyboardManager();
|
|
@@ -1,107 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
keyCode: 'Tab',
|
|
59
|
-
activeElementOutScope: [button3],
|
|
60
|
-
callback: callback10,
|
|
61
|
-
eventName: 'keydown',
|
|
62
|
-
},
|
|
63
|
-
]);
|
|
64
|
-
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
65
|
-
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'Tab' }));
|
|
66
|
-
expect(callback4).toBeCalledTimes(0);
|
|
67
|
-
expect(callback5).toBeCalledTimes(2);
|
|
68
|
-
expect(callback6).toBeCalledTimes(0);
|
|
69
|
-
expect(callback7).toBeCalledTimes(1);
|
|
70
|
-
expect(callback8).toBeCalledTimes(0);
|
|
71
|
-
expect(callback9).toBeCalledTimes(1);
|
|
72
|
-
expect(callback10).toBeCalledTimes(1);
|
|
73
|
-
KeyboardManager.default.deregister(listens);
|
|
74
|
-
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
75
|
-
expect(callback4).toBeCalledTimes(0);
|
|
76
|
-
expect(callback5).toBeCalledTimes(2);
|
|
77
|
-
expect(callback6).toBeCalledTimes(0);
|
|
78
|
-
const callback11 = jest.fn();
|
|
79
|
-
const callback12 = jest.fn();
|
|
80
|
-
KeyboardManager.default.register([
|
|
81
|
-
{ keyCode: 'Tab', activeElementInScope: [shadowCompRoot], callback: callback11 },
|
|
82
|
-
{ keyCode: 'Tab', activeElementOutScope: [shadowCompRoot], callback: callback12 },
|
|
83
|
-
]);
|
|
84
|
-
Object.assign(document, { activeElement: shadowCompRoot });
|
|
85
|
-
Object.assign(shadowCompRoot, { shadowRoot: { activeElement: input } });
|
|
86
|
-
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
87
|
-
expect(callback11).toBeCalledTimes(1);
|
|
88
|
-
expect(callback12).toBeCalledTimes(0);
|
|
89
|
-
});
|
|
90
|
-
test('while keyup, the callback should not effect next callback ', () => {
|
|
91
|
-
/* eslint-disable-next-line */
|
|
92
|
-
const KeyboardManager = require('../keyboard-manager');
|
|
93
|
-
const callback1 = () => {
|
|
1
|
+
import KeyboardManager from '../keyboard-manager';
|
|
2
|
+
import { setupUserAgent } from '../../../utils/test-utils';
|
|
3
|
+
describe('KeyboardManager', () => {
|
|
4
|
+
let button1;
|
|
5
|
+
let button2;
|
|
6
|
+
let button3;
|
|
7
|
+
let shadowComp;
|
|
8
|
+
let shadowCompRoot;
|
|
9
|
+
let input;
|
|
10
|
+
beforeAll(() => {
|
|
11
|
+
const innerHTML = `
|
|
12
|
+
<button class='button1'>test1</button>
|
|
13
|
+
<button class='button2'>test2</button>
|
|
14
|
+
<button class='button3'>test3</button>
|
|
15
|
+
<div class='shadow'></div>
|
|
16
|
+
`;
|
|
17
|
+
document.body.innerHTML = innerHTML;
|
|
18
|
+
button1 = document.body.querySelector('.button1');
|
|
19
|
+
button2 = document.body.querySelector('.button2');
|
|
20
|
+
button3 = document.body.querySelector('.button3');
|
|
21
|
+
shadowComp = document.querySelector('.shadow');
|
|
22
|
+
shadowCompRoot = shadowComp.attachShadow({ mode: 'open' });
|
|
23
|
+
input = document.createElement('input');
|
|
24
|
+
shadowCompRoot.appendChild(input);
|
|
25
|
+
});
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
setupUserAgent('desktop');
|
|
28
|
+
KeyboardManager['listenKeyPress']();
|
|
29
|
+
});
|
|
30
|
+
test('should proper while use KeyboardManager', () => {
|
|
31
|
+
const callback1 = jest.fn();
|
|
32
|
+
const callback2 = jest.fn();
|
|
33
|
+
const callback3 = jest.fn();
|
|
34
|
+
KeyboardManager.register([
|
|
35
|
+
{ keyCode: 'Tab', activeElementInScope: [button1], callback: callback1 },
|
|
36
|
+
{ keyCode: ['ArrowUp', 'ArrowDown'], activeElementInScope: [button1], callback: callback2 },
|
|
37
|
+
{ keyCode: 'Escape', activeElementInScope: [button1], callback: callback3 },
|
|
38
|
+
]);
|
|
39
|
+
Object.assign(document, { activeElement: button1 });
|
|
40
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
41
|
+
expect(callback1).toBeCalledTimes(1);
|
|
42
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'ArrowUp' }));
|
|
43
|
+
expect(callback2).toBeCalledTimes(1);
|
|
44
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'ArrowDown' }));
|
|
45
|
+
expect(callback2).toBeCalledTimes(2);
|
|
46
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Escape' }));
|
|
47
|
+
expect(callback3).toBeCalledTimes(1);
|
|
48
|
+
const callback4 = jest.fn();
|
|
49
|
+
const callback5 = jest.fn();
|
|
50
|
+
const callback6 = jest.fn();
|
|
51
|
+
const listens = [
|
|
52
|
+
{ keyCode: 'Tab', activeElementInScope: [button1], callback: callback4 },
|
|
53
|
+
{ keyCode: 'Tab', activeElementInScope: [button2], callback: callback5 },
|
|
54
|
+
{ keyCode: 'Tab', activeElementInScope: [button3], callback: callback6 },
|
|
55
|
+
];
|
|
56
|
+
KeyboardManager.register(listens);
|
|
94
57
|
Object.assign(document, { activeElement: button2 });
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
58
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
59
|
+
expect(callback4).toBeCalledTimes(0);
|
|
60
|
+
expect(callback5).toBeCalledTimes(1);
|
|
61
|
+
expect(callback6).toBeCalledTimes(0);
|
|
62
|
+
const callback7 = jest.fn();
|
|
63
|
+
const callback8 = jest.fn();
|
|
64
|
+
const callback9 = jest.fn();
|
|
65
|
+
const callback10 = jest.fn();
|
|
66
|
+
KeyboardManager.register([
|
|
67
|
+
{ keyCode: 'Tab', activeElementInScope: [button2], callback: callback7 },
|
|
68
|
+
{ keyCode: 'Tab', activeElementOutScope: [button2], callback: callback8 },
|
|
69
|
+
{ keyCode: 'Tab', activeElementOutScope: [button3], callback: callback9 },
|
|
70
|
+
{
|
|
71
|
+
keyCode: 'Tab',
|
|
72
|
+
activeElementOutScope: [button3],
|
|
73
|
+
callback: callback10,
|
|
74
|
+
eventName: 'keydown',
|
|
75
|
+
},
|
|
76
|
+
]);
|
|
77
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
78
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'Tab' }));
|
|
79
|
+
expect(callback4).toBeCalledTimes(0);
|
|
80
|
+
expect(callback5).toBeCalledTimes(2);
|
|
81
|
+
expect(callback6).toBeCalledTimes(0);
|
|
82
|
+
expect(callback7).toBeCalledTimes(1);
|
|
83
|
+
expect(callback8).toBeCalledTimes(0);
|
|
84
|
+
expect(callback9).toBeCalledTimes(1);
|
|
85
|
+
expect(callback10).toBeCalledTimes(1);
|
|
86
|
+
KeyboardManager.deregister(listens);
|
|
87
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
88
|
+
expect(callback4).toBeCalledTimes(0);
|
|
89
|
+
expect(callback5).toBeCalledTimes(2);
|
|
90
|
+
expect(callback6).toBeCalledTimes(0);
|
|
91
|
+
const callback11 = jest.fn();
|
|
92
|
+
const callback12 = jest.fn();
|
|
93
|
+
KeyboardManager.register([
|
|
94
|
+
{ keyCode: 'Tab', activeElementInScope: [shadowComp], callback: callback11 },
|
|
95
|
+
{ keyCode: 'Tab', activeElementOutScope: [shadowComp], callback: callback12 },
|
|
96
|
+
]);
|
|
97
|
+
Object.assign(document, { activeElement: shadowComp });
|
|
98
|
+
Object.assign(shadowComp, { shadowRoot: { activeElement: input } });
|
|
99
|
+
document.dispatchEvent(new KeyboardEvent('keyup', { code: 'Tab' }));
|
|
100
|
+
expect(callback11).toBeCalledTimes(1);
|
|
101
|
+
expect(callback12).toBeCalledTimes(0);
|
|
102
|
+
});
|
|
103
|
+
test('should handle modifierPressed correctly', () => {
|
|
104
|
+
const callback1 = jest.fn();
|
|
105
|
+
const callback2 = jest.fn();
|
|
106
|
+
const callback3 = jest.fn();
|
|
107
|
+
KeyboardManager.register([
|
|
108
|
+
{
|
|
109
|
+
keyCode: 'KeyZ',
|
|
110
|
+
eventName: 'keydown',
|
|
111
|
+
activeElementInScope: [button1],
|
|
112
|
+
callback: callback1,
|
|
113
|
+
modifierPressed: true,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
keyCode: 'KeyZ',
|
|
117
|
+
eventName: 'keydown',
|
|
118
|
+
activeElementInScope: [button1],
|
|
119
|
+
callback: callback2,
|
|
120
|
+
modifierPressed: false,
|
|
121
|
+
},
|
|
122
|
+
{ keyCode: 'KeyZ', eventName: 'keydown', activeElementInScope: [button1], callback: callback3 },
|
|
123
|
+
]);
|
|
124
|
+
Object.assign(document, { activeElement: button1 });
|
|
125
|
+
// Test with modifier keys pressed
|
|
126
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'KeyZ', metaKey: true }));
|
|
127
|
+
expect(callback1).toBeCalledTimes(1);
|
|
128
|
+
expect(callback2).toBeCalledTimes(0);
|
|
129
|
+
expect(callback3).toBeCalledTimes(1);
|
|
130
|
+
// Test with no modifier keys pressed
|
|
131
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'KeyZ', metaKey: false }));
|
|
132
|
+
expect(callback1).toBeCalledTimes(1);
|
|
133
|
+
expect(callback2).toBeCalledTimes(1);
|
|
134
|
+
expect(callback3).toBeCalledTimes(2);
|
|
135
|
+
});
|
|
136
|
+
test('should handle modifierPressed correctly on Windows', () => {
|
|
137
|
+
Object.defineProperty(window.navigator, 'userAgent', {
|
|
138
|
+
value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36',
|
|
139
|
+
configurable: true,
|
|
140
|
+
});
|
|
141
|
+
const callback1 = jest.fn();
|
|
142
|
+
const callback2 = jest.fn();
|
|
143
|
+
const callback3 = jest.fn();
|
|
144
|
+
KeyboardManager.register([
|
|
145
|
+
{
|
|
146
|
+
keyCode: 'KeyZ',
|
|
147
|
+
eventName: 'keydown',
|
|
148
|
+
activeElementInScope: [button1],
|
|
149
|
+
callback: callback1,
|
|
150
|
+
modifierPressed: true,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
keyCode: 'KeyZ',
|
|
154
|
+
eventName: 'keydown',
|
|
155
|
+
activeElementInScope: [button1],
|
|
156
|
+
callback: callback2,
|
|
157
|
+
modifierPressed: false,
|
|
158
|
+
},
|
|
159
|
+
{ keyCode: 'KeyZ', eventName: 'keydown', activeElementInScope: [button1], callback: callback3 },
|
|
160
|
+
]);
|
|
161
|
+
Object.assign(document, { activeElement: button1 });
|
|
162
|
+
// Test with modifier keys pressed
|
|
163
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'KeyZ', ctrlKey: true }));
|
|
164
|
+
expect(callback1).toBeCalledTimes(1);
|
|
165
|
+
expect(callback2).toBeCalledTimes(0);
|
|
166
|
+
expect(callback3).toBeCalledTimes(1);
|
|
167
|
+
// Test with no modifier keys pressed
|
|
168
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'KeyZ', ctrlKey: false }));
|
|
169
|
+
expect(callback1).toBeCalledTimes(1);
|
|
170
|
+
expect(callback2).toBeCalledTimes(1);
|
|
171
|
+
expect(callback3).toBeCalledTimes(2);
|
|
172
|
+
});
|
|
173
|
+
test('should handle shiftKey correctly', () => {
|
|
174
|
+
const callback1 = jest.fn();
|
|
175
|
+
const callback2 = jest.fn();
|
|
176
|
+
const callback3 = jest.fn();
|
|
177
|
+
KeyboardManager.register([
|
|
178
|
+
{
|
|
179
|
+
keyCode: 'KeyZ',
|
|
180
|
+
eventName: 'keydown',
|
|
181
|
+
activeElementInScope: [button1],
|
|
182
|
+
callback: callback1,
|
|
183
|
+
shiftKey: true,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
keyCode: 'KeyZ',
|
|
187
|
+
eventName: 'keydown',
|
|
188
|
+
activeElementInScope: [button1],
|
|
189
|
+
callback: callback2,
|
|
190
|
+
shiftKey: false,
|
|
191
|
+
},
|
|
192
|
+
{ keyCode: 'KeyZ', eventName: 'keydown', activeElementInScope: [button1], callback: callback3 },
|
|
193
|
+
]);
|
|
194
|
+
Object.assign(document, { activeElement: button1 });
|
|
195
|
+
// Test with shift key pressed
|
|
196
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'KeyZ', shiftKey: true }));
|
|
197
|
+
expect(callback1).toBeCalledTimes(1);
|
|
198
|
+
expect(callback2).toBeCalledTimes(0);
|
|
199
|
+
expect(callback3).toBeCalledTimes(1);
|
|
200
|
+
// Test with no shift key pressed
|
|
201
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { code: 'KeyZ', shiftKey: false }));
|
|
202
|
+
expect(callback1).toBeCalledTimes(1);
|
|
203
|
+
expect(callback2).toBeCalledTimes(1);
|
|
204
|
+
expect(callback3).toBeCalledTimes(2);
|
|
205
|
+
});
|
|
106
206
|
});
|
|
107
|
-
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { MapToComponentField, MapToComponentMethod, VegaSlimmer } from 'vega-slimmer/core';
|
|
8
|
+
import { GP_BRAND_CHANGE } from '../change-manager/subject/static-subject/static-subject-title';
|
|
9
|
+
import { Observer } from '../change-manager/observer/observer';
|
|
10
|
+
import ChangeManager from '../change-manager/change-manager';
|
|
11
|
+
/** The `BrandSwitchControllerSlimmer` class monitors brand changes and updates the color, logo and footer content accordingly. */
|
|
12
|
+
export class BrandSwitchControllerSlimmer extends VegaSlimmer {
|
|
13
|
+
/**
|
|
14
|
+
* Component lifecycle - [connectedCallback]
|
|
15
|
+
* Register an observer to watch for current branding updates, which will cause the component to update.
|
|
16
|
+
*/
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
this.observer = new Observer(this.isAcceptObserver.bind(this), (currentBranding) => {
|
|
19
|
+
this.currentBranding = currentBranding;
|
|
20
|
+
});
|
|
21
|
+
ChangeManager.register(GP_BRAND_CHANGE, this.observer);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* cancel dark mode observer when disconnectedCallback
|
|
25
|
+
*/
|
|
26
|
+
disconnectResizeObserver() {
|
|
27
|
+
ChangeManager.unregister(GP_BRAND_CHANGE, this.observer);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether the observer should accept changes.
|
|
31
|
+
*
|
|
32
|
+
* @returns {boolean} Always returns true in the current implementation.
|
|
33
|
+
*/
|
|
34
|
+
isAcceptObserver() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__decorate([
|
|
39
|
+
MapToComponentField({ writable: true })
|
|
40
|
+
], BrandSwitchControllerSlimmer.prototype, "currentBranding", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
MapToComponentMethod('connectedCallback')
|
|
43
|
+
], BrandSwitchControllerSlimmer.prototype, "connectedCallback", null);
|
|
44
|
+
__decorate([
|
|
45
|
+
MapToComponentMethod('disconnectedCallback')
|
|
46
|
+
], BrandSwitchControllerSlimmer.prototype, "disconnectResizeObserver", null);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import '../../../polyfill/test-polyfill/unit/index';
|
|
8
|
+
import { InjectVegaSlimmer, MapToComponentField } from 'vega-slimmer/core';
|
|
9
|
+
import { MockHTMLElement } from '@stencil/core/mock-doc';
|
|
10
|
+
import { BrandSwitchControllerSlimmer } from '../brand-switch-state-controller-slimmer';
|
|
11
|
+
import { VegaInternalThemeManager } from '../../theme/internal-theme-manager';
|
|
12
|
+
describe('BrandSwitchControllerSlimmer', () => {
|
|
13
|
+
const mockedComponentConnectedCallbackMethod = jest.fn();
|
|
14
|
+
const mockedComponentDisconnectedCallbackMethod = jest.fn();
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
mockedComponentDisconnectedCallbackMethod.mockClear();
|
|
17
|
+
mockedComponentConnectedCallbackMethod.mockClear();
|
|
18
|
+
});
|
|
19
|
+
describe('BrandSwitchControllerSlimmer should work proper', () => {
|
|
20
|
+
class MockedBrandSwitchControllerSlimmer extends BrandSwitchControllerSlimmer {
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
__decorate([
|
|
26
|
+
MapToComponentField({ writable: true })
|
|
27
|
+
], MockedBrandSwitchControllerSlimmer.prototype, "currentBranding", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
MapToComponentField()
|
|
30
|
+
], MockedBrandSwitchControllerSlimmer.prototype, "host", void 0);
|
|
31
|
+
class MockedComponent {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.currentBranding = 'heartland';
|
|
34
|
+
this.controller = new MockedBrandSwitchControllerSlimmer();
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
mockedComponentConnectedCallbackMethod();
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
mockedComponentDisconnectedCallbackMethod();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
__decorate([
|
|
44
|
+
InjectVegaSlimmer()
|
|
45
|
+
], MockedComponent.prototype, "controller", void 0);
|
|
46
|
+
test('should get brand name when apply branding to "gp"', () => {
|
|
47
|
+
const mockedComponent = new MockedComponent();
|
|
48
|
+
const host = new MockHTMLElement('body', 'div');
|
|
49
|
+
mockedComponent.host = host;
|
|
50
|
+
mockedComponent.connectedCallback();
|
|
51
|
+
expect(mockedComponentConnectedCallbackMethod).toBeCalledTimes(1);
|
|
52
|
+
expect(mockedComponent.currentBranding).toEqual('heartland');
|
|
53
|
+
VegaInternalThemeManager.applyBranding('gp');
|
|
54
|
+
expect(mockedComponent.currentBranding).toEqual('gp');
|
|
55
|
+
});
|
|
56
|
+
test('should get brand name when apply branding to "genius"', () => {
|
|
57
|
+
const mockedComponent = new MockedComponent();
|
|
58
|
+
const host = new MockHTMLElement('body', 'div');
|
|
59
|
+
mockedComponent.host = host;
|
|
60
|
+
mockedComponent.connectedCallback();
|
|
61
|
+
expect(mockedComponentConnectedCallbackMethod).toBeCalledTimes(1);
|
|
62
|
+
VegaInternalThemeManager.applyBranding('genius');
|
|
63
|
+
expect(mockedComponent.currentBranding).toEqual('genius');
|
|
64
|
+
});
|
|
65
|
+
test('should not get brand name when disconnectedCallback is called', () => {
|
|
66
|
+
const mockedComponent = new MockedComponent();
|
|
67
|
+
const host = new MockHTMLElement('body', 'div');
|
|
68
|
+
mockedComponent.host = host;
|
|
69
|
+
mockedComponent.disconnectedCallback();
|
|
70
|
+
expect(mockedComponentDisconnectedCallbackMethod).toBeCalledTimes(1);
|
|
71
|
+
VegaInternalThemeManager.applyBranding('genius');
|
|
72
|
+
expect(mockedComponent.currentBranding).toEqual('heartland');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -3,30 +3,30 @@ import { LightModeShadowTokens } from '../../../constants/tokens/themes/v2-new-b
|
|
|
3
3
|
import { LightModeColorTokens } from '../../../constants/tokens/themes/v2-new-brand/light-mode-color-tokens';
|
|
4
4
|
import { Observer } from '../../change-manager/observer/observer';
|
|
5
5
|
import ChangeManager from '../../change-manager/change-manager';
|
|
6
|
-
import { DARK_MODE_CHANGE,
|
|
6
|
+
import { DARK_MODE_CHANGE, GP_BRAND_CHANGE, } from '../../change-manager/subject/static-subject/static-subject-title';
|
|
7
7
|
import { VegaInternalThemeManager } from '../internal-theme-manager';
|
|
8
8
|
import { StyleControllerAbstract } from './style-controller.abstract';
|
|
9
9
|
/**
|
|
10
|
-
* Vega components
|
|
10
|
+
* Vega components brand style controller
|
|
11
11
|
*/
|
|
12
|
-
class
|
|
12
|
+
class BrandStyleController extends StyleControllerAbstract {
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
this.tokens = {};
|
|
16
|
-
this.themeStyleContainerKey = 'vega-
|
|
16
|
+
this.themeStyleContainerKey = 'vega-brand-theme';
|
|
17
17
|
this.observer = new Observer(this.isAcceptObserver.bind(this), (options) => {
|
|
18
|
-
if (options) {
|
|
19
|
-
this.
|
|
18
|
+
if (options === 'heartland') {
|
|
19
|
+
this.reset(this.themeStyleContainerKey);
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
this.
|
|
22
|
+
this.generateThemeStyle();
|
|
23
23
|
}
|
|
24
24
|
const isDarkMode = VegaInternalThemeManager.isDarkMode();
|
|
25
25
|
if (isDarkMode) {
|
|
26
26
|
ChangeManager.notify(DARK_MODE_CHANGE, isDarkMode);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
ChangeManager.register(
|
|
29
|
+
ChangeManager.register(GP_BRAND_CHANGE, this.observer);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* It generates a CSS style for light mode to override the style.
|
|
@@ -47,4 +47,4 @@ class NewBrandStyleController extends StyleControllerAbstract {
|
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
export const
|
|
50
|
+
export const VegaBrandStyleController = new BrandStyleController();
|
|
@@ -55,7 +55,7 @@ class DarkModeStyleController extends StyleControllerAbstract {
|
|
|
55
55
|
generateThemeStyle() {
|
|
56
56
|
const newBrandTokens = Object.assign(NewBrandingDarkModeColorTokens, NewBrandingDarkModeBorderTokens, NewBrandingDarkModeRingTokens, NewBrandingDarkModeShadowTokens);
|
|
57
57
|
const oldTokens = Object.assign(DarkModeColorTokens, DarkModeBorderTokens, DarkModeRingTokens, DarkModeShadowTokens);
|
|
58
|
-
this.darkModeColorAllTokens = Object.assign(VegaInternalThemeManager.
|
|
58
|
+
this.darkModeColorAllTokens = Object.assign(VegaInternalThemeManager.getBranding() === 'heartland' ? oldTokens : newBrandTokens, CustomDarkModeColorTokens, this.dynamicCustomDarkModeColor);
|
|
59
59
|
const keys = Object.keys(this.darkModeColorAllTokens);
|
|
60
60
|
this.getStyleContainer(this.themeStyleContainerKey).innerHTML = `
|
|
61
61
|
html.dark {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { VegaColorSchemaOverridingController } from './controllers/color-schema-overriding-controller';
|
|
2
2
|
import './controllers/dark-mode-style-controller';
|
|
3
3
|
import ChangeManager from '../change-manager/change-manager';
|
|
4
|
-
import { DARK_MODE_CHANGE,
|
|
5
|
-
import './controllers/
|
|
4
|
+
import { DARK_MODE_CHANGE, GP_BRAND_CHANGE, } from '../change-manager/subject/static-subject/static-subject-title';
|
|
5
|
+
import './controllers/brand-style-controller';
|
|
6
6
|
/**
|
|
7
7
|
* Vega components controller to control the internal theme manager
|
|
8
8
|
*/
|
|
9
9
|
class InternalThemeManager {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.currentBranding = 'heartland';
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* It takes the colors you passed in, parses them into the correct format, and then applies them to the theme
|
|
12
15
|
*
|
|
@@ -50,19 +53,19 @@ class InternalThemeManager {
|
|
|
50
53
|
/**
|
|
51
54
|
* This function return the new brand name.
|
|
52
55
|
*
|
|
53
|
-
* @returns {
|
|
56
|
+
* @returns {BrandOptions} return the new brand options.
|
|
54
57
|
*/
|
|
55
|
-
|
|
56
|
-
return this.
|
|
58
|
+
getBranding() {
|
|
59
|
+
return this.currentBranding;
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
59
|
-
* This function switches the Vega theme to a
|
|
62
|
+
* This function switches the Vega theme to a brand theme based on the provided options.
|
|
60
63
|
*
|
|
61
|
-
* @param {
|
|
64
|
+
* @param {BrandOptions} options - The options includes 'gp', 'genius' and 'heartland' options
|
|
62
65
|
*/
|
|
63
66
|
applyBranding(options) {
|
|
64
|
-
this.
|
|
65
|
-
ChangeManager.notify(
|
|
67
|
+
this.currentBranding = options;
|
|
68
|
+
ChangeManager.notify(GP_BRAND_CHANGE, options);
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
export const VegaInternalThemeManager = new InternalThemeManager();
|
|
@@ -567,16 +567,16 @@ describe('New Brand Theme', () => {
|
|
|
567
567
|
it('should enable the new brand theme when set useNewColor: true', () => {
|
|
568
568
|
var _a;
|
|
569
569
|
VegaThemeManager.applyBranding('gp');
|
|
570
|
-
expect((_a = document.head.querySelector('#vega-
|
|
571
|
-
VegaThemeManager.applyBranding(
|
|
572
|
-
expect(document.head.querySelector('#vega-
|
|
570
|
+
expect((_a = document.head.querySelector('#vega-brand-theme')) === null || _a === void 0 ? void 0 : _a.textContent).toMatchSnapshot();
|
|
571
|
+
VegaThemeManager.applyBranding('heartland');
|
|
572
|
+
expect(document.head.querySelector('#vega-brand-theme')).toBeNull();
|
|
573
573
|
});
|
|
574
574
|
it('should enable the dark mode with the new brand theme', () => {
|
|
575
575
|
var _a, _b;
|
|
576
576
|
VegaThemeManager.applyBranding('gp');
|
|
577
577
|
VegaThemeManager.toggleDarkMode(true);
|
|
578
578
|
expect((_a = document.head.querySelector('#vegaDarkModeStyle')) === null || _a === void 0 ? void 0 : _a.textContent).toMatchSnapshot();
|
|
579
|
-
VegaThemeManager.applyBranding(
|
|
579
|
+
VegaThemeManager.applyBranding('heartland');
|
|
580
580
|
expect((_b = document.head.querySelector('#vegaDarkModeStyle')) === null || _b === void 0 ? void 0 : _b.textContent).toMatchSnapshot();
|
|
581
581
|
});
|
|
582
582
|
});
|
|
@@ -55,9 +55,9 @@ class ThemeManager {
|
|
|
55
55
|
return VegaInternalThemeManager.isDarkMode();
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* This function switches the Vega theme to a
|
|
58
|
+
* This function switches the Vega theme to a brand theme based on the provided options.
|
|
59
59
|
*
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {BrandOptions} options - The options includes 'gp', 'genius' and 'heartland' options
|
|
61
61
|
* @vegaVersion 2.47.0
|
|
62
62
|
*/
|
|
63
63
|
applyBranding(options) {
|
|
@@ -29,7 +29,7 @@ export class MaxNumberRule extends InternalFormFieldValidationRule {
|
|
|
29
29
|
if (!this.isAcceptedInputType(input)) {
|
|
30
30
|
throw new Error(`Unexpected type of input: ${typeof input}: ${input}`);
|
|
31
31
|
}
|
|
32
|
-
const maxValue = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.maxValue)
|
|
32
|
+
const maxValue = !isNaN((_a = this.config) === null || _a === void 0 ? void 0 : _a.maxValue) ? this.config.maxValue : Number.MAX_VALUE;
|
|
33
33
|
return {
|
|
34
34
|
isValid: convertToNumber(input) <= maxValue,
|
|
35
35
|
message: convertToNumber(input) <= maxValue
|
|
@@ -29,7 +29,7 @@ export class MinNumberRule extends InternalFormFieldValidationRule {
|
|
|
29
29
|
if (!this.isAcceptedInputType(input)) {
|
|
30
30
|
throw new Error(`Unexpected type of input: ${typeof input}: ${input}`);
|
|
31
31
|
}
|
|
32
|
-
const minValue = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.minValue)
|
|
32
|
+
const minValue = !isNaN((_a = this.config) === null || _a === void 0 ? void 0 : _a.minValue) ? this.config.minValue : 0;
|
|
33
33
|
return {
|
|
34
34
|
isValid: convertToNumber(input) >= minValue,
|
|
35
35
|
message: convertToNumber(input) >= minValue
|