@ukic/web-components 3.0.0-alpha.6 → 3.0.0-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/{helpers-dd569d97.js → helpers-8ca38600.js} +24 -1
- package/dist/cjs/helpers-8ca38600.js.map +1 -0
- package/dist/cjs/ic-accordion-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ic-alert.cjs.entry.js +2 -9
- package/dist/cjs/ic-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +1 -1
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js +1 -1
- package/dist/cjs/ic-card-vertical.cjs.entry.js +12 -19
- package/dist/cjs/ic-card-vertical.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ic-chip.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ic-divider.cjs.entry.js +1 -1
- package/dist/cjs/ic-empty-state.cjs.entry.js +2 -12
- package/dist/cjs/ic-empty-state.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer.cjs.entry.js +18 -7
- package/dist/cjs/ic-footer.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-hero.cjs.entry.js +2 -9
- package/dist/cjs/ic-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js +27 -21
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-input-label_2.cjs.entry.js +1 -1
- package/dist/cjs/ic-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
- package/dist/cjs/ic-pagination-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-pagination.cjs.entry.js +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +32 -28
- package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-select.cjs.entry.js +44 -32
- package/dist/cjs/ic-select.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
- package/dist/cjs/ic-switch.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab.cjs.entry.js +1 -1
- package/dist/cjs/ic-text-field.cjs.entry.js +10 -8
- package/dist/cjs/ic-text-field.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-theme.cjs.entry.js +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +1 -1
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js +27 -11
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toggle-button.cjs.entry.js +51 -5
- package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-top-navigation.cjs.entry.js +2 -2
- package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-typography.cjs.entry.js +1 -1
- package/dist/cjs/index-f982899d.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/ag-theme-icds.css +32 -31
- package/dist/collection/components/ic-alert/ic-alert.js +3 -10
- package/dist/collection/components/ic-alert/ic-alert.js.map +1 -1
- package/dist/collection/components/ic-alert/test/basic/ic-alert.spec.js +21 -3
- package/dist/collection/components/ic-alert/test/basic/ic-alert.spec.js.map +1 -1
- package/dist/collection/components/ic-card-vertical/ic-card-vertical.js +13 -20
- package/dist/collection/components/ic-card-vertical/ic-card-vertical.js.map +1 -1
- package/dist/collection/components/ic-card-vertical/test/basic/ic-card-vertical.spec.js +34 -3
- package/dist/collection/components/ic-card-vertical/test/basic/ic-card-vertical.spec.js.map +1 -1
- package/dist/collection/components/ic-empty-state/ic-empty-state.js +3 -13
- package/dist/collection/components/ic-empty-state/ic-empty-state.js.map +1 -1
- package/dist/collection/components/ic-footer/ic-footer.js +18 -7
- package/dist/collection/components/ic-footer/ic-footer.js.map +1 -1
- package/dist/collection/components/ic-footer/test/basic/ic-footer.spec.js +41 -0
- package/dist/collection/components/ic-footer/test/basic/ic-footer.spec.js.map +1 -1
- package/dist/collection/components/ic-hero/ic-hero.js +3 -10
- package/dist/collection/components/ic-hero/ic-hero.js.map +1 -1
- package/dist/collection/components/ic-hero/test/basic/ic-hero.spec.js +21 -3
- package/dist/collection/components/ic-hero/test/basic/ic-hero.spec.js.map +1 -1
- package/dist/collection/components/ic-input-component-container/ic-input-component-container.js +3 -10
- package/dist/collection/components/ic-input-component-container/ic-input-component-container.js.map +1 -1
- package/dist/collection/components/ic-input-component-container/test/basic/ic-input-component-container.spec.js +21 -3
- package/dist/collection/components/ic-input-component-container/test/basic/ic-input-component-container.spec.js.map +1 -1
- package/dist/collection/components/ic-menu/ic-menu.css +6 -0
- package/dist/collection/components/ic-menu/ic-menu.js +38 -11
- package/dist/collection/components/ic-menu/ic-menu.js.map +1 -1
- package/dist/collection/components/ic-menu/test/basic/ic-menu.spec.js +9 -9
- package/dist/collection/components/ic-menu/test/basic/ic-menu.spec.js.map +1 -1
- package/dist/collection/components/ic-search-bar/ic-search-bar.css +66 -4
- package/dist/collection/components/ic-search-bar/ic-search-bar.js +53 -28
- package/dist/collection/components/ic-search-bar/ic-search-bar.js.map +1 -1
- package/dist/collection/components/ic-search-bar/test/basic/ic-search-bar.spec.js +59 -93
- package/dist/collection/components/ic-search-bar/test/basic/ic-search-bar.spec.js.map +1 -1
- package/dist/collection/components/ic-select/ic-select.js +46 -34
- package/dist/collection/components/ic-select/ic-select.js.map +1 -1
- package/dist/collection/components/ic-select/test/basic/ic-select.spec.js +64 -0
- package/dist/collection/components/ic-select/test/basic/ic-select.spec.js.map +1 -1
- package/dist/collection/components/ic-text-field/ic-text-field.js +16 -9
- package/dist/collection/components/ic-text-field/ic-text-field.js.map +1 -1
- package/dist/collection/components/ic-toggle-button/ic-toggle-button.js +68 -15
- package/dist/collection/components/ic-toggle-button/ic-toggle-button.js.map +1 -1
- package/dist/collection/components/ic-toggle-button-group/ic-toggle-button-group.js +33 -9
- package/dist/collection/components/ic-toggle-button-group/ic-toggle-button-group.js.map +1 -1
- package/dist/collection/components/ic-toggle-button-group/test/ic-toggle-button-group.spec.js +79 -14
- package/dist/collection/components/ic-toggle-button-group/test/ic-toggle-button-group.spec.js.map +1 -1
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.css +4 -0
- package/dist/collection/testspec.setup.js +14 -0
- package/dist/collection/testspec.setup.js.map +1 -1
- package/dist/collection/utils/helpers.js +20 -0
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/types.js.map +1 -1
- package/dist/components/helpers.js +22 -1
- package/dist/components/helpers.js.map +1 -1
- package/dist/components/ic-alert.js +3 -10
- package/dist/components/ic-alert.js.map +1 -1
- package/dist/components/ic-card-vertical.js +13 -20
- package/dist/components/ic-card-vertical.js.map +1 -1
- package/dist/components/ic-empty-state.js +3 -13
- package/dist/components/ic-empty-state.js.map +1 -1
- package/dist/components/ic-footer.js +18 -7
- package/dist/components/ic-footer.js.map +1 -1
- package/dist/components/ic-hero.js +3 -10
- package/dist/components/ic-hero.js.map +1 -1
- package/dist/components/ic-input-component-container2.js +3 -10
- package/dist/components/ic-input-component-container2.js.map +1 -1
- package/dist/components/ic-menu2.js +25 -12
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-search-bar.js +46 -53
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-select.js +45 -33
- package/dist/components/ic-select.js.map +1 -1
- package/dist/components/ic-side-navigation.js +1 -1
- package/dist/components/ic-stepper.js +1 -1
- package/dist/components/ic-text-field.js +371 -1
- package/dist/components/ic-text-field.js.map +1 -1
- package/dist/components/ic-theme.js +1 -1
- package/dist/components/ic-toggle-button-group.js +31 -11
- package/dist/components/ic-toggle-button-group.js.map +1 -1
- package/dist/components/ic-toggle-button.js +58 -12
- package/dist/components/ic-toggle-button.js.map +1 -1
- package/dist/components/ic-top-navigation.js +2 -2
- package/dist/components/ic-top-navigation.js.map +1 -1
- package/dist/core/ag-theme-icds.css +32 -31
- package/dist/core/core.css +15 -3
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-bc7b8a1e.entry.js → p-076c3140.entry.js} +2 -2
- package/dist/core/p-08ff51ff.entry.js +2 -0
- package/dist/core/p-08ff51ff.entry.js.map +1 -0
- package/dist/core/{p-b5439baa.entry.js → p-229523bc.entry.js} +2 -2
- package/dist/core/p-2392b3ef.js +2 -0
- package/dist/core/p-2392b3ef.js.map +1 -0
- package/dist/core/p-28af4d8a.entry.js +2 -0
- package/dist/core/p-28af4d8a.entry.js.map +1 -0
- package/dist/core/p-333d1e79.entry.js +2 -0
- package/dist/core/p-333d1e79.entry.js.map +1 -0
- package/dist/core/p-3a1a7524.entry.js +2 -0
- package/dist/core/{p-cfe32b37.entry.js.map → p-3a1a7524.entry.js.map} +1 -1
- package/dist/core/{p-a23c515d.entry.js → p-434fa633.entry.js} +2 -2
- package/dist/core/{p-5d417fc0.entry.js → p-492c7e88.entry.js} +2 -2
- package/dist/core/{p-b9aa801f.entry.js → p-4bdd6aad.entry.js} +2 -2
- package/dist/core/{p-0b8c3770.entry.js → p-4e9a0efe.entry.js} +2 -2
- package/dist/core/{p-3cfef37a.entry.js → p-50601f1e.entry.js} +2 -2
- package/dist/core/p-537af2dd.entry.js +2 -0
- package/dist/core/p-537af2dd.entry.js.map +1 -0
- package/dist/core/{p-07cd8a50.entry.js → p-54604d29.entry.js} +2 -2
- package/dist/core/p-5637b986.entry.js +2 -0
- package/dist/core/{p-dcb2073d.entry.js.map → p-5637b986.entry.js.map} +1 -1
- package/dist/core/p-56b5e33e.entry.js +2 -0
- package/dist/core/p-56b5e33e.entry.js.map +1 -0
- package/dist/core/p-5aa7dcae.entry.js +2 -0
- package/dist/core/p-5aa7dcae.entry.js.map +1 -0
- package/dist/core/{p-c2b359d9.entry.js → p-5c5b0b12.entry.js} +2 -2
- package/dist/core/p-6594d2df.entry.js +2 -0
- package/dist/core/{p-3420a999.entry.js.map → p-6594d2df.entry.js.map} +1 -1
- package/dist/core/{p-810f5a2d.entry.js → p-67a75b77.entry.js} +2 -2
- package/dist/core/p-67a75b77.entry.js.map +1 -0
- package/dist/core/{p-4f72a02a.entry.js → p-68046114.entry.js} +2 -2
- package/dist/core/{p-705db6a5.entry.js → p-6c7836ff.entry.js} +2 -2
- package/dist/core/{p-da85eaf6.entry.js → p-74b8206f.entry.js} +2 -2
- package/dist/core/{p-520c6089.entry.js → p-7f05cc17.entry.js} +2 -2
- package/dist/core/{p-d2909711.entry.js → p-81e8d7c5.entry.js} +2 -2
- package/dist/core/{p-b2a41070.entry.js → p-840113b1.entry.js} +2 -2
- package/dist/core/{p-ded2dbed.entry.js → p-84c28c4d.entry.js} +2 -2
- package/dist/core/{p-7124b387.entry.js → p-88fdd912.entry.js} +2 -2
- package/dist/core/{p-b51e378c.entry.js → p-8a66d8b0.entry.js} +2 -2
- package/dist/core/{p-225384ab.entry.js → p-8aceec77.entry.js} +2 -2
- package/dist/core/{p-0821fc5b.entry.js → p-91c46a86.entry.js} +2 -2
- package/dist/core/p-91c46a86.entry.js.map +1 -0
- package/dist/core/{p-91c1327d.entry.js → p-92e3c5a2.entry.js} +2 -2
- package/dist/core/{p-f42c0469.entry.js → p-98429cbe.entry.js} +2 -2
- package/dist/core/{p-b27dfa1b.entry.js → p-98963b03.entry.js} +2 -2
- package/dist/core/{p-3994d86d.entry.js → p-a3b00ec1.entry.js} +2 -2
- package/dist/core/{p-9c1d4f72.entry.js → p-a4467032.entry.js} +2 -2
- package/dist/core/{p-193582d4.entry.js → p-a6f25812.entry.js} +2 -2
- package/dist/core/p-a81a91a2.entry.js +2 -0
- package/dist/core/p-a81a91a2.entry.js.map +1 -0
- package/dist/core/{p-c83e933c.entry.js → p-ab14882b.entry.js} +2 -2
- package/dist/core/p-ac61fa48.entry.js +2 -0
- package/dist/core/p-ac61fa48.entry.js.map +1 -0
- package/dist/core/{p-580b1593.entry.js → p-b468aa80.entry.js} +2 -2
- package/dist/core/{p-4dc48606.entry.js → p-cf5f427b.entry.js} +2 -2
- package/dist/core/{p-5d653608.entry.js → p-cfcb0c5b.entry.js} +2 -2
- package/dist/core/p-d41e5b62.entry.js +2 -0
- package/dist/core/p-d41e5b62.entry.js.map +1 -0
- package/dist/core/{p-98dbbb34.entry.js → p-d7043445.entry.js} +2 -2
- package/dist/core/{p-406e58af.entry.js → p-e2de6dd4.entry.js} +2 -2
- package/dist/core/{p-0d505c1f.entry.js → p-e719ae4e.entry.js} +2 -2
- package/dist/core/{p-4af52174.entry.js → p-ea71e89f.entry.js} +2 -2
- package/dist/core/{p-518ea375.entry.js → p-ee0d4bf4.entry.js} +2 -2
- package/dist/core/{p-a24bcf5f.entry.js → p-f0e45316.entry.js} +2 -2
- package/dist/core/p-f297c365.entry.js +2 -0
- package/dist/core/p-f297c365.entry.js.map +1 -0
- package/dist/core/{p-5ba8e679.entry.js → p-f61170f3.entry.js} +2 -2
- package/dist/core/{p-61510f00.entry.js → p-f7b71154.entry.js} +2 -2
- package/dist/core/{p-1234f7a5.entry.js → p-fb7a9d6b.entry.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/{helpers-e594bfc6.js → helpers-1c6e542d.js} +23 -2
- package/dist/esm/helpers-1c6e542d.js.map +1 -0
- package/dist/esm/ic-accordion-group.entry.js +1 -1
- package/dist/esm/ic-accordion.entry.js +1 -1
- package/dist/esm/ic-alert.entry.js +3 -10
- package/dist/esm/ic-alert.entry.js.map +1 -1
- package/dist/esm/ic-back-to-top.entry.js +1 -1
- package/dist/esm/ic-badge.entry.js +1 -1
- package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
- package/dist/esm/ic-breadcrumb.entry.js +1 -1
- package/dist/esm/ic-button_3.entry.js +1 -1
- package/dist/esm/ic-card-vertical.entry.js +13 -20
- package/dist/esm/ic-card-vertical.entry.js.map +1 -1
- package/dist/esm/ic-checkbox-group.entry.js +1 -1
- package/dist/esm/ic-checkbox.entry.js +1 -1
- package/dist/esm/ic-chip.entry.js +1 -1
- package/dist/esm/ic-data-row.entry.js +1 -1
- package/dist/esm/ic-dialog.entry.js +1 -1
- package/dist/esm/ic-divider.entry.js +1 -1
- package/dist/esm/ic-empty-state.entry.js +3 -13
- package/dist/esm/ic-empty-state.entry.js.map +1 -1
- package/dist/esm/ic-footer-link-group.entry.js +1 -1
- package/dist/esm/ic-footer-link.entry.js +1 -1
- package/dist/esm/ic-footer.entry.js +18 -7
- package/dist/esm/ic-footer.entry.js.map +1 -1
- package/dist/esm/ic-hero.entry.js +3 -10
- package/dist/esm/ic-hero.entry.js.map +1 -1
- package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
- package/dist/esm/ic-input-component-container_3.entry.js +28 -22
- package/dist/esm/ic-input-component-container_3.entry.js.map +1 -1
- package/dist/esm/ic-input-label_2.entry.js +1 -1
- package/dist/esm/ic-link.entry.js +1 -1
- package/dist/esm/ic-menu-group.entry.js +1 -1
- package/dist/esm/ic-menu-item.entry.js +1 -1
- package/dist/esm/ic-navigation-button.entry.js +1 -1
- package/dist/esm/ic-navigation-group.entry.js +1 -1
- package/dist/esm/ic-navigation-item.entry.js +1 -1
- package/dist/esm/ic-navigation-menu.entry.js +1 -1
- package/dist/esm/ic-page-header.entry.js +1 -1
- package/dist/esm/ic-pagination-item.entry.js +1 -1
- package/dist/esm/ic-pagination.entry.js +1 -1
- package/dist/esm/ic-popover-menu.entry.js +1 -1
- package/dist/esm/ic-radio-group.entry.js +1 -1
- package/dist/esm/ic-radio-option.entry.js +1 -1
- package/dist/esm/ic-search-bar.entry.js +32 -28
- package/dist/esm/ic-search-bar.entry.js.map +1 -1
- package/dist/esm/ic-select.entry.js +44 -32
- package/dist/esm/ic-select.entry.js.map +1 -1
- package/dist/esm/ic-side-navigation.entry.js +1 -1
- package/dist/esm/ic-status-tag.entry.js +1 -1
- package/dist/esm/ic-step.entry.js +1 -1
- package/dist/esm/ic-stepper.entry.js +1 -1
- package/dist/esm/ic-switch.entry.js +1 -1
- package/dist/esm/ic-tab-group.entry.js +1 -1
- package/dist/esm/ic-tab-panel.entry.js +1 -1
- package/dist/esm/ic-tab.entry.js +1 -1
- package/dist/esm/ic-text-field.entry.js +10 -8
- package/dist/esm/ic-text-field.entry.js.map +1 -1
- package/dist/esm/ic-theme.entry.js +1 -1
- package/dist/esm/ic-toast.entry.js +1 -1
- package/dist/esm/ic-toggle-button-group.entry.js +27 -11
- package/dist/esm/ic-toggle-button-group.entry.js.map +1 -1
- package/dist/esm/ic-toggle-button.entry.js +51 -5
- package/dist/esm/ic-toggle-button.entry.js.map +1 -1
- package/dist/esm/ic-top-navigation.entry.js +2 -2
- package/dist/esm/ic-top-navigation.entry.js.map +1 -1
- package/dist/esm/ic-typography.entry.js +1 -1
- package/dist/esm/index-d1d2c456.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-alert/ic-alert.d.ts +0 -1
- package/dist/types/components/ic-card-vertical/ic-card-vertical.d.ts +0 -1
- package/dist/types/components/ic-empty-state/ic-empty-state.d.ts +0 -1
- package/dist/types/components/ic-footer/ic-footer.d.ts +1 -0
- package/dist/types/components/ic-hero/ic-hero.d.ts +0 -1
- package/dist/types/components/ic-input-component-container/ic-input-component-container.d.ts +0 -1
- package/dist/types/components/ic-menu/ic-menu.d.ts +6 -1
- package/dist/types/components/ic-search-bar/ic-search-bar.d.ts +9 -2
- package/dist/types/components/ic-select/ic-select.d.ts +5 -4
- package/dist/types/components/ic-text-field/ic-text-field.d.ts +2 -1
- package/dist/types/components/ic-toggle-button/ic-toggle-button.d.ts +3 -3
- package/dist/types/components/ic-toggle-button-group/ic-toggle-button-group.d.ts +4 -0
- package/dist/types/components.d.ts +17 -7
- package/dist/types/testspec.setup.d.ts +9 -0
- package/dist/types/utils/helpers.d.ts +3 -0
- package/dist/types/utils/types.d.ts +1 -0
- package/hydrate/index.js +243 -150
- package/package.json +2 -9
- package/vscode-data.json +1 -1
- package/dist/cjs/helpers-dd569d97.js.map +0 -1
- package/dist/components/ic-text-field2.js +0 -373
- package/dist/components/ic-text-field2.js.map +0 -1
- package/dist/core/p-0821fc5b.entry.js.map +0 -1
- package/dist/core/p-3420a999.entry.js +0 -2
- package/dist/core/p-3bfc4a52.entry.js +0 -2
- package/dist/core/p-3bfc4a52.entry.js.map +0 -1
- package/dist/core/p-48e98730.js +0 -2
- package/dist/core/p-48e98730.js.map +0 -1
- package/dist/core/p-59800237.entry.js +0 -2
- package/dist/core/p-59800237.entry.js.map +0 -1
- package/dist/core/p-6159b077.entry.js +0 -2
- package/dist/core/p-6159b077.entry.js.map +0 -1
- package/dist/core/p-6859019c.entry.js +0 -2
- package/dist/core/p-6859019c.entry.js.map +0 -1
- package/dist/core/p-810744b5.entry.js +0 -2
- package/dist/core/p-810744b5.entry.js.map +0 -1
- package/dist/core/p-810f5a2d.entry.js.map +0 -1
- package/dist/core/p-8a2670c1.entry.js +0 -2
- package/dist/core/p-8a2670c1.entry.js.map +0 -1
- package/dist/core/p-aefebee9.entry.js +0 -2
- package/dist/core/p-aefebee9.entry.js.map +0 -1
- package/dist/core/p-c67f7603.entry.js +0 -2
- package/dist/core/p-c67f7603.entry.js.map +0 -1
- package/dist/core/p-c6e91e13.entry.js +0 -2
- package/dist/core/p-c6e91e13.entry.js.map +0 -1
- package/dist/core/p-ca27ab19.entry.js +0 -2
- package/dist/core/p-ca27ab19.entry.js.map +0 -1
- package/dist/core/p-cfe32b37.entry.js +0 -2
- package/dist/core/p-dcb2073d.entry.js +0 -2
- package/dist/esm/helpers-e594bfc6.js.map +0 -1
- /package/dist/core/{p-bc7b8a1e.entry.js.map → p-076c3140.entry.js.map} +0 -0
- /package/dist/core/{p-b5439baa.entry.js.map → p-229523bc.entry.js.map} +0 -0
- /package/dist/core/{p-a23c515d.entry.js.map → p-434fa633.entry.js.map} +0 -0
- /package/dist/core/{p-5d417fc0.entry.js.map → p-492c7e88.entry.js.map} +0 -0
- /package/dist/core/{p-b9aa801f.entry.js.map → p-4bdd6aad.entry.js.map} +0 -0
- /package/dist/core/{p-0b8c3770.entry.js.map → p-4e9a0efe.entry.js.map} +0 -0
- /package/dist/core/{p-3cfef37a.entry.js.map → p-50601f1e.entry.js.map} +0 -0
- /package/dist/core/{p-07cd8a50.entry.js.map → p-54604d29.entry.js.map} +0 -0
- /package/dist/core/{p-c2b359d9.entry.js.map → p-5c5b0b12.entry.js.map} +0 -0
- /package/dist/core/{p-4f72a02a.entry.js.map → p-68046114.entry.js.map} +0 -0
- /package/dist/core/{p-705db6a5.entry.js.map → p-6c7836ff.entry.js.map} +0 -0
- /package/dist/core/{p-da85eaf6.entry.js.map → p-74b8206f.entry.js.map} +0 -0
- /package/dist/core/{p-520c6089.entry.js.map → p-7f05cc17.entry.js.map} +0 -0
- /package/dist/core/{p-d2909711.entry.js.map → p-81e8d7c5.entry.js.map} +0 -0
- /package/dist/core/{p-b2a41070.entry.js.map → p-840113b1.entry.js.map} +0 -0
- /package/dist/core/{p-ded2dbed.entry.js.map → p-84c28c4d.entry.js.map} +0 -0
- /package/dist/core/{p-7124b387.entry.js.map → p-88fdd912.entry.js.map} +0 -0
- /package/dist/core/{p-b51e378c.entry.js.map → p-8a66d8b0.entry.js.map} +0 -0
- /package/dist/core/{p-225384ab.entry.js.map → p-8aceec77.entry.js.map} +0 -0
- /package/dist/core/{p-91c1327d.entry.js.map → p-92e3c5a2.entry.js.map} +0 -0
- /package/dist/core/{p-f42c0469.entry.js.map → p-98429cbe.entry.js.map} +0 -0
- /package/dist/core/{p-b27dfa1b.entry.js.map → p-98963b03.entry.js.map} +0 -0
- /package/dist/core/{p-3994d86d.entry.js.map → p-a3b00ec1.entry.js.map} +0 -0
- /package/dist/core/{p-9c1d4f72.entry.js.map → p-a4467032.entry.js.map} +0 -0
- /package/dist/core/{p-193582d4.entry.js.map → p-a6f25812.entry.js.map} +0 -0
- /package/dist/core/{p-c83e933c.entry.js.map → p-ab14882b.entry.js.map} +0 -0
- /package/dist/core/{p-580b1593.entry.js.map → p-b468aa80.entry.js.map} +0 -0
- /package/dist/core/{p-4dc48606.entry.js.map → p-cf5f427b.entry.js.map} +0 -0
- /package/dist/core/{p-5d653608.entry.js.map → p-cfcb0c5b.entry.js.map} +0 -0
- /package/dist/core/{p-98dbbb34.entry.js.map → p-d7043445.entry.js.map} +0 -0
- /package/dist/core/{p-406e58af.entry.js.map → p-e2de6dd4.entry.js.map} +0 -0
- /package/dist/core/{p-0d505c1f.entry.js.map → p-e719ae4e.entry.js.map} +0 -0
- /package/dist/core/{p-4af52174.entry.js.map → p-ea71e89f.entry.js.map} +0 -0
- /package/dist/core/{p-518ea375.entry.js.map → p-ee0d4bf4.entry.js.map} +0 -0
- /package/dist/core/{p-a24bcf5f.entry.js.map → p-f0e45316.entry.js.map} +0 -0
- /package/dist/core/{p-5ba8e679.entry.js.map → p-f61170f3.entry.js.map} +0 -0
- /package/dist/core/{p-61510f00.entry.js.map → p-f7b71154.entry.js.map} +0 -0
- /package/dist/core/{p-1234f7a5.entry.js.map → p-fb7a9d6b.entry.js.map} +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
import { Host, h,
|
1
|
+
import { Host, h, } from "@stencil/core";
|
2
2
|
import { IcBrandForegroundEnum, } from "../../utils/types";
|
3
|
-
import { slotHasContent, getBrandForegroundAppearance, onComponentRequiredPropUndefined, isPropDefined, isSlotUsed,
|
3
|
+
import { slotHasContent, getBrandForegroundAppearance, onComponentRequiredPropUndefined, isPropDefined, isSlotUsed, renderDynamicChildSlots, } from "../../utils/helpers";
|
4
4
|
/**
|
5
5
|
* @slot heading - Content will be rendered in the title area, in place of the heading.
|
6
6
|
* @slot subheading - Content will be rendered in the title area, in place of the subheading.
|
@@ -10,13 +10,6 @@ import { slotHasContent, getBrandForegroundAppearance, onComponentRequiredPropUn
|
|
10
10
|
export class Hero {
|
11
11
|
constructor() {
|
12
12
|
this.hostMutationObserver = null;
|
13
|
-
this.hostMutationCallback = (mutationList) => {
|
14
|
-
if (mutationList.some(({ type, addedNodes, removedNodes }) => type === "childList"
|
15
|
-
? checkSlotInChildMutations(addedNodes, removedNodes, "secondary")
|
16
|
-
: false)) {
|
17
|
-
forceUpdate(this);
|
18
|
-
}
|
19
|
-
};
|
20
13
|
this.foregroundColor = getBrandForegroundAppearance();
|
21
14
|
this.rightContent = false;
|
22
15
|
this.leftContentFullWidth = !this.rightContent && this.secondaryHeading === undefined;
|
@@ -41,7 +34,7 @@ export class Hero {
|
|
41
34
|
componentDidLoad() {
|
42
35
|
!isSlotUsed(this.el, "heading") &&
|
43
36
|
onComponentRequiredPropUndefined([{ prop: this.heading, propName: "heading" }], "Hero");
|
44
|
-
this.hostMutationObserver = new MutationObserver(this
|
37
|
+
this.hostMutationObserver = new MutationObserver((mutationList) => renderDynamicChildSlots(mutationList, "secondary", this));
|
45
38
|
this.hostMutationObserver.observe(this.el, {
|
46
39
|
childList: true,
|
47
40
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-hero.js","sourceRoot":"","sources":["../../../src/components/ic-hero/ic-hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,KAAK,EACL,MAAM,EACN,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAKL,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,gCAAgC,EAChC,aAAa,EACb,UAAU,EACV,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAG7B;;;;;GAKG;AAOH,MAAM,OAAO,IAAI;;QACP,yBAAoB,GAAqB,IAAI,CAAC;QAkG9C,yBAAoB,GAAG,CAAC,YAA8B,EAAQ,EAAE;YACtE,IACE,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE,CACvD,IAAI,KAAK,WAAW;gBAClB,CAAC,CAAC,yBAAyB,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC;gBAClE,CAAC,CAAC,KAAK,CACV,EACD,CAAC;gBACD,WAAW,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC,CAAC;+BAxG4C,4BAA4B,EAAE;4BAC3C,KAAK;oCAGpC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS;4BAC3B,cAAc;uBAKf,MAAM;;8BAUa,MAAM;yCAKV,KAAK;;;;oBAoBnB,QAAQ;;;IAOxC,oBAA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AQ,CAC5B,CACF;gBACL,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CACzD,WAAK,KAAK,EAAC,iBAAiB;oBAC1B,YAAM,IAAI,EAAC,WAAW,IACnB,gBAAgB,IAAI,CACnB,WAAK,KAAK,EAAC,qBAAqB;wBAC9B,WAAK,KAAK,EAAC,mBAAmB;4BAC5B,qBAAe,OAAO,EAAC,IAAI;gCACzB,cAAK,gBAAgB,CAAM,CACb,CACZ;wBACN,WAAK,KAAK,EAAC,sBAAsB;4BAC/B,qBAAe,OAAO,EAAC,gBAAgB,IACpC,mBAAmB,CACN,CACZ,CACF,CACP,CACI,CACH,CACP,CACoB,CAClB,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Host,\n Prop,\n h,\n State,\n Listen,\n forceUpdate,\n} from \"@stencil/core\";\nimport {\n IcAlignment,\n IcSizesNoLarge,\n IcBrand,\n IcBrandForeground,\n IcBrandForegroundEnum,\n} from \"../../utils/types\";\nimport {\n slotHasContent,\n getBrandForegroundAppearance,\n onComponentRequiredPropUndefined,\n isPropDefined,\n isSlotUsed,\n checkSlotInChildMutations,\n} from \"../../utils/helpers\";\nimport { IcHeroContentAlignments } from \"./ic-hero.types\";\n\n/**\n * @slot heading - Content will be rendered in the title area, in place of the heading.\n * @slot subheading - Content will be rendered in the title area, in place of the subheading.\n * @slot interaction - Content will be rendered in the interaction area, adjacent to the title area.\n * @slot secondary - Content will be rendered in the secondary content area.\n */\n\n@Component({\n tag: \"ic-hero\",\n styleUrl: \"ic-hero.css\",\n shadow: true,\n})\nexport class Hero {\n private hostMutationObserver: MutationObserver = null;\n\n @Element() el: HTMLIcHeroElement;\n\n @State() foregroundColor: IcBrandForeground = getBrandForegroundAppearance();\n @State() rightContent: boolean = false;\n // set by above state\n @State() leftContentFullWidth: boolean =\n !this.rightContent && this.secondaryHeading === undefined;\n @State() scrollFactor: string = \"right -100px\";\n\n /**\n * The alignment of the hero.\n */\n @Prop() aligned: IcAlignment = \"left\";\n\n /**\n * The optional background image.\n */\n @Prop() backgroundImage?: string;\n\n /**\n * The alignment of the hero content.\n */\n @Prop() contentAligned: IcHeroContentAlignments = \"left\";\n\n /**\n * If `true`, the background image (if set) will not scroll using a parallax effect.\n */\n @Prop() disableBackgroundParallax?: boolean = false;\n\n /**\n * The heading of the hero. An <h2> level heading.\n */\n @Prop() heading: string;\n\n /**\n * The optional secondary heading, an <h3> level heading. Replaced by slotted right content.\n */\n @Prop() secondaryHeading?: string;\n\n /**\n * The optional secondary subheading, replaced by slotted right content.\n */\n @Prop() secondarySubheading?: string;\n\n /**\n * The size of the hero component.\n */\n @Prop() size?: IcSizesNoLarge = \"medium\";\n\n /**\n * The description for the hero.\n */\n @Prop() subheading?: string;\n\n disconnectedCallback(): void {\n this.hostMutationObserver?.disconnect();\n }\n\n componentWillLoad(): void {\n this.rightContent = slotHasContent(this.el, \"secondary\");\n }\n\n componentDidLoad(): void {\n !isSlotUsed(this.el, \"heading\") &&\n onComponentRequiredPropUndefined(\n [{ prop: this.heading, propName: \"heading\" }],\n \"Hero\"\n );\n\n this.hostMutationObserver = new MutationObserver(this.hostMutationCallback);\n this.hostMutationObserver.observe(this.el, {\n childList: true,\n });\n }\n\n componentWillRender(): void {\n this.rightContent = slotHasContent(this.el, \"secondary\");\n }\n\n @Listen(\"brandChange\", { target: \"document\" })\n brandChangeHandler(ev: CustomEvent<IcBrand>): void {\n this.foregroundColor = ev.detail.mode;\n }\n\n @Listen(\"scroll\", { target: \"document\" })\n doScroll(): void {\n if (this.disableBackgroundParallax) {\n return;\n }\n\n const scrolltotop = document.scrollingElement.scrollTop;\n const factor = 0.4;\n const y = -100 + scrolltotop * factor;\n this.scrollFactor = \"right \" + y + \"px\";\n }\n\n private hostMutationCallback = (mutationList: MutationRecord[]): void => {\n if (\n mutationList.some(({ type, addedNodes, removedNodes }) =>\n type === \"childList\"\n ? checkSlotInChildMutations(addedNodes, removedNodes, \"secondary\")\n : false\n )\n ) {\n forceUpdate(this);\n }\n };\n\n render() {\n const {\n aligned,\n size,\n heading,\n subheading,\n secondaryHeading,\n secondarySubheading,\n foregroundColor,\n backgroundImage,\n scrollFactor,\n } = this;\n\n let style = {};\n\n if (isPropDefined(backgroundImage)) {\n style = {\n \"background-image\": \"url(\" + backgroundImage + \")\",\n \"background-position\": scrollFactor,\n };\n }\n\n return (\n <Host\n class={{\n [`ic-hero-${IcBrandForegroundEnum.Dark}`]:\n foregroundColor === IcBrandForegroundEnum.Dark,\n [\"has-background-image\"]: backgroundImage !== undefined,\n [\"ic-hero-small\"]: size === \"small\",\n [\"secondary-heading\"]: !!secondaryHeading,\n }}\n style={style}\n >\n <ic-section-container\n aligned={aligned}\n fullHeight\n class=\"section-container\"\n >\n <div\n class={{\n [\"left-container\"]: true,\n [\"left-container-full-width\"]: this.leftContentFullWidth,\n }}\n >\n <div class=\"heading\">\n <slot name=\"heading\">\n <ic-typography\n variant={size === \"small\" ? \"h2\" : \"h1\"}\n class={{\n [\"heading-bottom-spacing\"]: size !== \"small\",\n }}\n >\n <h2>{heading}</h2>\n </ic-typography>\n </slot>\n </div>\n <div class=\"subheading\">\n <slot name=\"subheading\">\n <ic-typography variant=\"body\">{subheading}</ic-typography>\n </slot>\n </div>\n <div class=\"interaction-container\">\n <slot name=\"interaction\"></slot>\n </div>\n </div>\n {(isPropDefined(secondaryHeading) || this.rightContent) && (\n <div class=\"right-container\">\n <slot name=\"secondary\">\n {secondaryHeading && (\n <div class=\"secondary-container\">\n <div class=\"secondary-heading\">\n <ic-typography variant=\"h4\">\n <h3>{secondaryHeading}</h3>\n </ic-typography>\n </div>\n <div class=\"secondary-subheading\">\n <ic-typography variant=\"subtitle-small\">\n {secondarySubheading}\n </ic-typography>\n </div>\n </div>\n )}\n </slot>\n </div>\n )}\n </ic-section-container>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ic-hero.js","sourceRoot":"","sources":["../../../src/components/ic-hero/ic-hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAKL,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,gCAAgC,EAChC,aAAa,EACb,UAAU,EACV,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAG7B;;;;;GAKG;AAOH,MAAM,OAAO,IAAI;;QACP,yBAAoB,GAAqB,IAAI,CAAC;+BAIR,4BAA4B,EAAE;4BAC3C,KAAK;oCAGpC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS;4BAC3B,cAAc;uBAKf,MAAM;;8BAUa,MAAM;yCAKV,KAAK;;;;oBAoBnB,QAAQ;;;IAOxC,oBAAoB;;QAClB,MAAA,IAAI,CAAC,oBAAoB,0CAAE,UAAU,EAAE,CAAC;IAC1C,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;IAED,gBAAgB;QACd,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC;YAC7B,gCAAgC,CAC9B,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAC7C,MAAM,CACP,CAAC;QAEJ,IAAI,CAA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AsB;4BAC/B,qBAAe,OAAO,EAAC,gBAAgB,IACpC,mBAAmB,CACN,CACZ,CACF,CACP,CACI,CACH,CACP,CACoB,CAClB,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Host,\n Prop,\n h,\n State,\n Listen,\n} from \"@stencil/core\";\nimport {\n IcAlignment,\n IcSizesNoLarge,\n IcBrand,\n IcBrandForeground,\n IcBrandForegroundEnum,\n} from \"../../utils/types\";\nimport {\n slotHasContent,\n getBrandForegroundAppearance,\n onComponentRequiredPropUndefined,\n isPropDefined,\n isSlotUsed,\n renderDynamicChildSlots,\n} from \"../../utils/helpers\";\nimport { IcHeroContentAlignments } from \"./ic-hero.types\";\n\n/**\n * @slot heading - Content will be rendered in the title area, in place of the heading.\n * @slot subheading - Content will be rendered in the title area, in place of the subheading.\n * @slot interaction - Content will be rendered in the interaction area, adjacent to the title area.\n * @slot secondary - Content will be rendered in the secondary content area.\n */\n\n@Component({\n tag: \"ic-hero\",\n styleUrl: \"ic-hero.css\",\n shadow: true,\n})\nexport class Hero {\n private hostMutationObserver: MutationObserver = null;\n\n @Element() el: HTMLIcHeroElement;\n\n @State() foregroundColor: IcBrandForeground = getBrandForegroundAppearance();\n @State() rightContent: boolean = false;\n // set by above state\n @State() leftContentFullWidth: boolean =\n !this.rightContent && this.secondaryHeading === undefined;\n @State() scrollFactor: string = \"right -100px\";\n\n /**\n * The alignment of the hero.\n */\n @Prop() aligned: IcAlignment = \"left\";\n\n /**\n * The optional background image.\n */\n @Prop() backgroundImage?: string;\n\n /**\n * The alignment of the hero content.\n */\n @Prop() contentAligned: IcHeroContentAlignments = \"left\";\n\n /**\n * If `true`, the background image (if set) will not scroll using a parallax effect.\n */\n @Prop() disableBackgroundParallax?: boolean = false;\n\n /**\n * The heading of the hero. An <h2> level heading.\n */\n @Prop() heading: string;\n\n /**\n * The optional secondary heading, an <h3> level heading. Replaced by slotted right content.\n */\n @Prop() secondaryHeading?: string;\n\n /**\n * The optional secondary subheading, replaced by slotted right content.\n */\n @Prop() secondarySubheading?: string;\n\n /**\n * The size of the hero component.\n */\n @Prop() size?: IcSizesNoLarge = \"medium\";\n\n /**\n * The description for the hero.\n */\n @Prop() subheading?: string;\n\n disconnectedCallback(): void {\n this.hostMutationObserver?.disconnect();\n }\n\n componentWillLoad(): void {\n this.rightContent = slotHasContent(this.el, \"secondary\");\n }\n\n componentDidLoad(): void {\n !isSlotUsed(this.el, \"heading\") &&\n onComponentRequiredPropUndefined(\n [{ prop: this.heading, propName: \"heading\" }],\n \"Hero\"\n );\n\n this.hostMutationObserver = new MutationObserver((mutationList) =>\n renderDynamicChildSlots(mutationList, \"secondary\", this)\n );\n this.hostMutationObserver.observe(this.el, {\n childList: true,\n });\n }\n\n componentWillRender(): void {\n this.rightContent = slotHasContent(this.el, \"secondary\");\n }\n\n @Listen(\"brandChange\", { target: \"document\" })\n brandChangeHandler(ev: CustomEvent<IcBrand>): void {\n this.foregroundColor = ev.detail.mode;\n }\n\n @Listen(\"scroll\", { target: \"document\" })\n doScroll(): void {\n if (this.disableBackgroundParallax) {\n return;\n }\n\n const scrolltotop = document.scrollingElement.scrollTop;\n const factor = 0.4;\n const y = -100 + scrolltotop * factor;\n this.scrollFactor = \"right \" + y + \"px\";\n }\n\n render() {\n const {\n aligned,\n size,\n heading,\n subheading,\n secondaryHeading,\n secondarySubheading,\n foregroundColor,\n backgroundImage,\n scrollFactor,\n } = this;\n\n let style = {};\n\n if (isPropDefined(backgroundImage)) {\n style = {\n \"background-image\": \"url(\" + backgroundImage + \")\",\n \"background-position\": scrollFactor,\n };\n }\n\n return (\n <Host\n class={{\n [`ic-hero-${IcBrandForegroundEnum.Dark}`]:\n foregroundColor === IcBrandForegroundEnum.Dark,\n [\"has-background-image\"]: backgroundImage !== undefined,\n [\"ic-hero-small\"]: size === \"small\",\n [\"secondary-heading\"]: !!secondaryHeading,\n }}\n style={style}\n >\n <ic-section-container\n aligned={aligned}\n fullHeight\n class=\"section-container\"\n >\n <div\n class={{\n [\"left-container\"]: true,\n [\"left-container-full-width\"]: this.leftContentFullWidth,\n }}\n >\n <div class=\"heading\">\n <slot name=\"heading\">\n <ic-typography\n variant={size === \"small\" ? \"h2\" : \"h1\"}\n class={{\n [\"heading-bottom-spacing\"]: size !== \"small\",\n }}\n >\n <h2>{heading}</h2>\n </ic-typography>\n </slot>\n </div>\n <div class=\"subheading\">\n <slot name=\"subheading\">\n <ic-typography variant=\"body\">{subheading}</ic-typography>\n </slot>\n </div>\n <div class=\"interaction-container\">\n <slot name=\"interaction\"></slot>\n </div>\n </div>\n {(isPropDefined(secondaryHeading) || this.rightContent) && (\n <div class=\"right-container\">\n <slot name=\"secondary\">\n {secondaryHeading && (\n <div class=\"secondary-container\">\n <div class=\"secondary-heading\">\n <ic-typography variant=\"h4\">\n <h3>{secondaryHeading}</h3>\n </ic-typography>\n </div>\n <div class=\"secondary-subheading\">\n <ic-typography variant=\"subtitle-small\">\n {secondarySubheading}\n </ic-typography>\n </div>\n </div>\n )}\n </slot>\n </div>\n )}\n </ic-section-container>\n </Host>\n );\n }\n}\n"]}
|
@@ -1,6 +1,13 @@
|
|
1
1
|
import { newSpecPage } from "@stencil/core/testing";
|
2
2
|
import { Hero } from "../../ic-hero";
|
3
|
+
import { mockHasDynamicChildSlots, mockMutationObserverImplementation, mockRenderDynamicChildSlots, } from "../../../../testspec.setup";
|
3
4
|
describe("ic-hero component", () => {
|
5
|
+
afterAll(() => {
|
6
|
+
jest.restoreAllMocks();
|
7
|
+
});
|
8
|
+
afterEach(() => {
|
9
|
+
jest.clearAllMocks();
|
10
|
+
});
|
4
11
|
it("should render", async () => {
|
5
12
|
const page = await newSpecPage({
|
6
13
|
components: [Hero],
|
@@ -77,15 +84,26 @@ describe("ic-hero component", () => {
|
|
77
84
|
components: [Hero],
|
78
85
|
html: `<ic-hero heading="Test title" subheading="Test text"></ic-hero>`,
|
79
86
|
});
|
87
|
+
const component = page.rootInstance;
|
88
|
+
const host = page.root;
|
89
|
+
const observerInstance = mockMutationObserverImplementation.mock.results[0].value;
|
80
90
|
const icon = document.createElement("svg");
|
81
91
|
icon.setAttribute("slot", "secondary");
|
82
|
-
|
92
|
+
observerInstance.observe(host, { childList: true });
|
93
|
+
host.appendChild(icon);
|
94
|
+
const mockMutationRecord = [
|
83
95
|
{
|
84
|
-
type: "childList",
|
85
96
|
addedNodes: [icon],
|
86
97
|
removedNodes: [],
|
98
|
+
target: host,
|
87
99
|
},
|
88
|
-
]
|
100
|
+
];
|
101
|
+
observerInstance.trigger(mockMutationRecord);
|
102
|
+
await page.waitForChanges();
|
103
|
+
expect(mockRenderDynamicChildSlots).toHaveBeenCalledTimes(1);
|
104
|
+
expect(mockRenderDynamicChildSlots).toHaveBeenCalledWith(mockMutationRecord, "secondary", component);
|
105
|
+
expect(mockHasDynamicChildSlots).toHaveBeenCalledTimes(1);
|
106
|
+
expect(page.root).toMatchSnapshot();
|
89
107
|
});
|
90
108
|
});
|
91
109
|
//# sourceMappingURL=ic-hero.spec.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-hero.spec.js","sourceRoot":"","sources":["../../../../../src/components/ic-hero/test/basic/ic-hero.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"ic-hero.spec.js","sourceRoot":"","sources":["../../../../../src/components/ic-hero/test/basic/ic-hero.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA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AM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,MAAM,gBAAgB,GACpB,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAE3D,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEpD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAEvB,MAAM,kBAAkB,GAAyB;YAC/C;gBACE,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,YAAY,EAAE,EAAE;gBAChB,MAAM,EAAE,IAAI;aACb;SACF,CAAC;QAEF,gBAAgB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAE7C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE5B,MAAM,CAAC,2BAA2B,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,2BAA2B,CAAC,CAAC,oBAAoB,CACtD,kBAAkB,EAClB,WAAW,EACX,SAAS,CACV,CAAC;QAEF,MAAM,CAAC,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAE1D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from \"@stencil/core/testing\";\nimport { Hero } from \"../../ic-hero\";\nimport {\n mockHasDynamicChildSlots,\n mockMutationObserverImplementation,\n MockMutationRecord,\n mockRenderDynamicChildSlots,\n} from \"../../../../testspec.setup\";\n\ndescribe(\"ic-hero component\", () => {\n afterAll(() => {\n jest.restoreAllMocks();\n });\n\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n it(\"should render\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\"></ic-hero>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders\");\n });\n\n it(\"should render with a secondary heading\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\" secondary-heading=\"Test title\" secondary-subheading=\"Test text\"></ic-hero>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-secondary-heading\");\n });\n\n it(\"should render with interaction content\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\"><ic-button slot=\"interaction\">Button</ic-button></ic-hero>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-interaction-content\");\n });\n\n it(\"should render with secondary content\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\"><ic-card-vertical slot=\"secondary\" heading=\"Test card\"></ic-card-vertical></ic-hero>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-secondary-content\");\n });\n\n it(\"should render with a background image when given\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\" background-image=\"test.png\"><ic-card-vertical slot=\"secondary\" heading=\"Test card\"></ic-card-vertical></ic-hero>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-with-background-image\");\n });\n\n it(\"should use parallax on scroll when a background image is given\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\" background-image=\"test.png\"><ic-card-vertical slot=\"secondary\" heading=\"Test card\"></ic-card-vertical></ic-hero>`,\n });\n\n page.doc.scrollingElement.scrollTop = 50;\n page.doc.dispatchEvent(new CustomEvent(\"scroll\"));\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot(\"renders-with-parallax-on-scroll\");\n });\n\n it(\"should use not parallax on scroll when a background image is given, but parallax disabled\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" disable-background-parallax subheading=\"Test text\" background-image=\"test.png\"><ic-card-vertical slot=\"secondary\" heading=\"Test card\"></ic-card-vertical></ic-hero>`,\n });\n\n page.doc.scrollingElement.scrollTop = 50;\n page.doc.dispatchEvent(new CustomEvent(\"scroll\"));\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot(\n \"renders-with-parallax-on-scroll-disabled\"\n );\n });\n\n it(\"should render at size small\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero size=\"small\" heading=\"Test title\" subheading=\"Test text\"></ic-hero>`,\n });\n\n expect(page.root).toMatchSnapshot(\"renders-small-variant\");\n });\n\n it(\"should correctly set foregroundColor on brand change\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\"></ic-hero>`,\n });\n\n await page.rootInstance.brandChangeHandler({ detail: { mode: \"dark\" } });\n await page.waitForChanges();\n\n expect(page.rootInstance.foregroundColor).toBe(\"dark\");\n });\n\n it(\"should test rendering secondary slot after initial render\", async () => {\n const page = await newSpecPage({\n components: [Hero],\n html: `<ic-hero heading=\"Test title\" subheading=\"Test text\"></ic-hero>`,\n });\n\n const component = page.rootInstance;\n const host = page.root;\n\n const observerInstance =\n mockMutationObserverImplementation.mock.results[0].value;\n\n const icon = document.createElement(\"svg\");\n icon.setAttribute(\"slot\", \"secondary\");\n\n observerInstance.observe(host, { childList: true });\n\n host.appendChild(icon);\n\n const mockMutationRecord: MockMutationRecord[] = [\n {\n addedNodes: [icon],\n removedNodes: [],\n target: host,\n },\n ];\n\n observerInstance.trigger(mockMutationRecord);\n\n await page.waitForChanges();\n\n expect(mockRenderDynamicChildSlots).toHaveBeenCalledTimes(1);\n expect(mockRenderDynamicChildSlots).toHaveBeenCalledWith(\n mockMutationRecord,\n \"secondary\",\n component\n );\n\n expect(mockHasDynamicChildSlots).toHaveBeenCalledTimes(1);\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
package/dist/collection/components/ic-input-component-container/ic-input-component-container.js
CHANGED
@@ -1,19 +1,12 @@
|
|
1
|
-
import { Host,
|
1
|
+
import { Host, h } from "@stencil/core";
|
2
2
|
import { IcInformationStatus, } from "../../utils/types";
|
3
3
|
import successIcon from "../../assets/success-icon.svg";
|
4
|
-
import {
|
4
|
+
import { removeDisabledFalse, renderDynamicChildSlots, slotHasContent, } from "../../utils/helpers";
|
5
5
|
/**
|
6
6
|
* @slot left-icon - Content will be placed to the left of the input.
|
7
7
|
*/
|
8
8
|
export class InputComponentContainer {
|
9
9
|
constructor() {
|
10
|
-
this.hostMutationCallback = (mutationList) => {
|
11
|
-
if (mutationList.some(({ type, addedNodes, removedNodes }) => type === "childList"
|
12
|
-
? checkSlotInChildMutations(addedNodes, removedNodes, "left-icon")
|
13
|
-
: false)) {
|
14
|
-
forceUpdate(this);
|
15
|
-
}
|
16
|
-
};
|
17
10
|
this.disabled = false;
|
18
11
|
this.fullWidth = false;
|
19
12
|
this.multiLine = false;
|
@@ -29,7 +22,7 @@ export class InputComponentContainer {
|
|
29
22
|
removeDisabledFalse(this.disabled, this.el);
|
30
23
|
}
|
31
24
|
componentDidLoad() {
|
32
|
-
this.hostMutationObserver = new MutationObserver(this
|
25
|
+
this.hostMutationObserver = new MutationObserver((mutationList) => renderDynamicChildSlots(mutationList, "left-icon", this));
|
33
26
|
this.hostMutationObserver.observe(this.el, { childList: true });
|
34
27
|
}
|
35
28
|
render() {
|
package/dist/collection/components/ic-input-component-container/ic-input-component-container.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-input-component-container.js","sourceRoot":"","sources":["../../../src/components/ic-input-component-container/ic-input-component-container.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"ic-input-component-container.js","sourceRoot":"","sources":["../../../src/components/ic-input-component-container/ic-input-component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AAC,QAAQ,IAAI,CAAC,QAAQ;gBACnD,uCAAuC,EAAE,QAAQ;gBACjD,uCAAuC,EAAE,QAAQ;gBACjD,wCAAwC,EAAE,SAAS;gBACnD,yCAAyC,EAAE,SAAS;aACrD,mBACc,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;YAEvC,WAAK,KAAK,EAAC,iBAAiB;gBACzB,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,CACvC,WAAK,KAAK,EAAC,gBAAgB;oBACzB,YAAM,IAAI,EAAC,WAAW,GAAG,CACrB,CACP;gBACD,eAAa;gBAEZ,gBAAgB;oBACf,gBAAgB,KAAK,mBAAmB,CAAC,OAAO,IAAI,CAClD,YAAM,KAAK,EAAC,gBAAgB,EAAC,SAAS,EAAE,WAAW,GAAI,CACxD,CACC,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Prop, Watch, h } from \"@stencil/core\";\n\nimport {\n IcInformationStatus,\n IcInformationStatusOrEmpty,\n IcSizes,\n} from \"../../utils/types\";\nimport successIcon from \"../../assets/success-icon.svg\";\nimport {\n removeDisabledFalse,\n renderDynamicChildSlots,\n slotHasContent,\n} from \"../../utils/helpers\";\n\n/**\n * @slot left-icon - Content will be placed to the left of the input.\n */\n@Component({\n tag: \"ic-input-component-container\",\n styleUrl: \"ic-input-component-container.css\",\n})\nexport class InputComponentContainer {\n private hostMutationObserver: MutationObserver;\n @Element() el: HTMLIcInputComponentContainerElement;\n\n /**\n * If `true`, the disabled state will be set.\n */\n @Prop() disabled: boolean = false;\n @Watch(\"disabled\")\n watchDisabledHandler(): void {\n removeDisabledFalse(this.disabled, this.el);\n }\n\n /**\n * If `true`, the input component container will fill the width of the container it is in.\n */\n @Prop() fullWidth: boolean = false;\n\n /**\n * If `true`, the input component container will allow for multiple lines.\n */\n @Prop() multiLine: boolean = false;\n\n /**\n * If `true`, the readonly state will be set.\n */\n @Prop() readonly: boolean = false;\n\n /**\n * The size of the input component container component.\n */\n @Prop() size?: IcSizes = \"medium\";\n\n /**\n * If `true`, the validation will display inline.\n */\n @Prop() validationInline: boolean = false;\n\n /**\n * The validation status of the input component container - e.g. 'error' | 'warning' | 'success'.\n */\n @Prop() validationStatus: IcInformationStatusOrEmpty = \"\";\n\n componentWillLoad(): void {\n removeDisabledFalse(this.disabled, this.el);\n }\n\n componentDidLoad(): void {\n this.hostMutationObserver = new MutationObserver((mutationList) =>\n renderDynamicChildSlots(mutationList, \"left-icon\", this)\n );\n this.hostMutationObserver.observe(this.el, { childList: true });\n }\n\n render() {\n const {\n size,\n validationStatus,\n disabled,\n readonly,\n multiLine,\n fullWidth,\n validationInline,\n } = this;\n\n return (\n <Host\n class={{\n [`ic-input-component-container-${size}`]: true,\n [`ic-input-component-container-${validationStatus}`]:\n validationStatus !== \"\" && !disabled && !readonly,\n \"ic-input-component-container-disabled\": disabled,\n \"ic-input-component-container-readonly\": readonly,\n \"ic-input-component-container-multiline\": multiLine,\n \"ic-input-component-container-full-width\": fullWidth,\n }}\n aria-disabled={disabled ? \"true\" : null}\n >\n <div class=\"focus-indicator\">\n {slotHasContent(this.el, \"left-icon\") && (\n <div class=\"icon-container\">\n <slot name=\"left-icon\" />\n </div>\n )}\n <slot></slot>\n\n {validationInline &&\n validationStatus === IcInformationStatus.Success && (\n <span class=\"inline-success\" innerHTML={successIcon} />\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
@@ -1,6 +1,13 @@
|
|
1
|
+
import { mockHasDynamicChildSlots, mockMutationObserverImplementation, mockRenderDynamicChildSlots, } from "../../../../testspec.setup";
|
1
2
|
import { InputComponentContainer } from "../../ic-input-component-container";
|
2
3
|
import { newSpecPage } from "@stencil/core/testing";
|
3
4
|
describe("ic-input-component-container", () => {
|
5
|
+
afterAll(() => {
|
6
|
+
jest.restoreAllMocks();
|
7
|
+
});
|
8
|
+
afterEach(() => {
|
9
|
+
jest.clearAllMocks();
|
10
|
+
});
|
4
11
|
it("should render", async () => {
|
5
12
|
const page = await newSpecPage({
|
6
13
|
components: [InputComponentContainer],
|
@@ -140,15 +147,26 @@ describe("ic-input-component-container", () => {
|
|
140
147
|
components: [InputComponentContainer],
|
141
148
|
html: `<ic-input-component-container>content</ic-input-component-container>`,
|
142
149
|
});
|
150
|
+
const component = page.rootInstance;
|
151
|
+
const host = page.root;
|
152
|
+
const observerInstance = mockMutationObserverImplementation.mock.results[0].value;
|
143
153
|
const icon = document.createElement("svg");
|
144
154
|
icon.setAttribute("slot", "left-icon");
|
145
|
-
|
155
|
+
observerInstance.observe(host, { childList: true });
|
156
|
+
host.appendChild(icon);
|
157
|
+
const mockMutationRecord = [
|
146
158
|
{
|
147
|
-
type: "childList",
|
148
159
|
addedNodes: [icon],
|
149
160
|
removedNodes: [],
|
161
|
+
target: host,
|
150
162
|
},
|
151
|
-
]
|
163
|
+
];
|
164
|
+
observerInstance.trigger(mockMutationRecord);
|
165
|
+
await page.waitForChanges();
|
166
|
+
expect(mockRenderDynamicChildSlots).toHaveBeenCalledTimes(1);
|
167
|
+
expect(mockRenderDynamicChildSlots).toHaveBeenCalledWith(mockMutationRecord, "left-icon", component);
|
168
|
+
expect(mockHasDynamicChildSlots).toHaveBeenCalledTimes(1);
|
169
|
+
expect(page.root).toMatchSnapshot();
|
152
170
|
});
|
153
171
|
});
|
154
172
|
//# sourceMappingURL=ic-input-component-container.spec.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-input-component-container.spec.js","sourceRoot":"","sources":["../../../../../src/components/ic-input-component-container/test/basic/ic-input-component-container.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAA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H;SACvH,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;KAM7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,uBAAuB,CAAC;YACrC,IAAI,EAAE,6JAA6J;SACpK,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;KAW7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,uBAAuB,CAAC;YACrC,IAAI,EAAE,sEAAsE;SAC7E,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvC,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC;YACrC;gBACE,IAAI,EAAE,WAAW;gBACjB,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,YAAY,EAAE,EAAE;aACjB;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { InputComponentContainer } from \"../../ic-input-component-container\";\nimport { newSpecPage } from \"@stencil/core/testing\";\n\ndescribe(\"ic-input-component-container\", () => {\n it(\"should render\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with validation status\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\">content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-success\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container> \n `);\n });\n\n it(\"should render with validation inline\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" validation-inline=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-success\" validation-inline=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n <span class=\"inline-success\">\n svg\n </span>\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should ignore validation inline if not success\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"error\" validation-inline=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-error ic-input-component-container-medium\" validation-inline=\"true\" validation-status=\"error\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with size small, multiline & fullwidth props set\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container size=\"small\" multi-line=true full-width=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-small ic-input-component-container-full-width ic-input-component-container-multiline\" full-width=\"true\" multi-line=\"true\" size=\"small\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with size large\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container size=large>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-large\" size=\"large\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render disabled\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" disabled=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container aria-disabled=\"true\" class=\"ic-input-component-container-disabled ic-input-component-container-medium\" disabled=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n\n page.rootInstance.disabled = false;\n\n await page.waitForChanges();\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-success\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render readonly\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" readonly=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-readonly\" readonly=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with slotted content\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" disabled=true><span slot=\"left-icon\">slotted content</span>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container aria-disabled=\"true\" class=\"ic-input-component-container-disabled ic-input-component-container-medium\" disabled=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n <div class=\"icon-container\">\n <span slot=\"left-icon\">\n slotted content\n </span>\n </div>\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should test rendering icon after initial render\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container>content</ic-input-component-container>`,\n });\n\n const icon = document.createElement(\"svg\");\n icon.setAttribute(\"slot\", \"left-icon\");\n\n page.rootInstance.hostMutationCallback([\n {\n type: \"childList\",\n addedNodes: [icon],\n removedNodes: [],\n },\n ]);\n });\n});\n"]}
|
1
|
+
{"version":3,"file":"ic-input-component-container.spec.js","sourceRoot":"","sources":["../../../../../src/components/ic-input-component-container/test/basic/ic-input-component-container.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAElC,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,uBAAuB,CAAC;YACrC,IAAI,EAAE,sEAAsE;SAC7E,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;KAM7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,uBAAuB,CAAC;YACrC,IAAI,EAAE,kGAAkG;SACzG,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;KAM7B,CAAC,CAAC;IACL,CAAC,CAAC,CAA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AAI,CAAC;QAEvB,MAAM,gBAAgB,GACpB,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAE3D,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEpD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAEvB,MAAM,kBAAkB,GAAyB;YAC/C;gBACE,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,YAAY,EAAE,EAAE;gBAChB,MAAM,EAAE,IAAI;aACb;SACF,CAAC;QAEF,gBAAgB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAE7C,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE5B,MAAM,CAAC,2BAA2B,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,2BAA2B,CAAC,CAAC,oBAAoB,CACtD,kBAAkB,EAClB,WAAW,EACX,SAAS,CACV,CAAC;QAEF,MAAM,CAAC,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAE1D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n mockHasDynamicChildSlots,\n mockMutationObserverImplementation,\n MockMutationRecord,\n mockRenderDynamicChildSlots,\n} from \"../../../../testspec.setup\";\nimport { InputComponentContainer } from \"../../ic-input-component-container\";\nimport { newSpecPage } from \"@stencil/core/testing\";\n\ndescribe(\"ic-input-component-container\", () => {\n afterAll(() => {\n jest.restoreAllMocks();\n });\n\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n it(\"should render\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with validation status\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\">content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-success\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container> \n `);\n });\n\n it(\"should render with validation inline\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" validation-inline=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-success\" validation-inline=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n <span class=\"inline-success\">\n svg\n </span>\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should ignore validation inline if not success\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"error\" validation-inline=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-error ic-input-component-container-medium\" validation-inline=\"true\" validation-status=\"error\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with size small, multiline & fullwidth props set\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container size=\"small\" multi-line=true full-width=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-small ic-input-component-container-full-width ic-input-component-container-multiline\" full-width=\"true\" multi-line=\"true\" size=\"small\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with size large\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container size=large>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-large\" size=\"large\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render disabled\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" disabled=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container aria-disabled=\"true\" class=\"ic-input-component-container-disabled ic-input-component-container-medium\" disabled=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n\n page.rootInstance.disabled = false;\n\n await page.waitForChanges();\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-success\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render readonly\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" readonly=true>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container class=\"ic-input-component-container-medium ic-input-component-container-readonly\" readonly=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should render with slotted content\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container validation-status=\"success\" disabled=true><span slot=\"left-icon\">slotted content</span>content</ic-input-component-container>`,\n });\n\n expect(page.root).toEqualHtml(`\n <ic-input-component-container aria-disabled=\"true\" class=\"ic-input-component-container-disabled ic-input-component-container-medium\" disabled=\"true\" validation-status=\"success\">\n <div class=\"focus-indicator\">\n <div class=\"icon-container\">\n <span slot=\"left-icon\">\n slotted content\n </span>\n </div>\n content\n </div>\n </ic-input-component-container>\n `);\n });\n\n it(\"should test rendering icon after initial render\", async () => {\n const page = await newSpecPage({\n components: [InputComponentContainer],\n html: `<ic-input-component-container>content</ic-input-component-container>`,\n });\n\n const component = page.rootInstance;\n const host = page.root;\n\n const observerInstance =\n mockMutationObserverImplementation.mock.results[0].value;\n\n const icon = document.createElement(\"svg\");\n icon.setAttribute(\"slot\", \"left-icon\");\n\n observerInstance.observe(host, { childList: true });\n\n host.appendChild(icon);\n\n const mockMutationRecord: MockMutationRecord[] = [\n {\n addedNodes: [icon],\n removedNodes: [],\n target: host,\n },\n ];\n\n observerInstance.trigger(mockMutationRecord);\n\n await page.waitForChanges();\n\n expect(mockRenderDynamicChildSlots).toHaveBeenCalledTimes(1);\n expect(mockRenderDynamicChildSlots).toHaveBeenCalledWith(\n mockMutationRecord,\n \"left-icon\",\n component\n );\n\n expect(mockHasDynamicChildSlots).toHaveBeenCalledTimes(1);\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
@@ -7,6 +7,7 @@ export class Menu {
|
|
7
7
|
constructor() {
|
8
8
|
this.ACTIVE_DESCENDANT = "aria-activedescendant";
|
9
9
|
this.CLEAR_BUTTON_ID = "clear-button";
|
10
|
+
this.SEARCH_BAR_TAG = "IC-SEARCH-BAR";
|
10
11
|
this.disabledOptionSelected = false;
|
11
12
|
this.hasPreviouslyBlurred = false;
|
12
13
|
this.hasTimedOut = false;
|
@@ -71,7 +72,7 @@ export class Menu {
|
|
71
72
|
}
|
72
73
|
};
|
73
74
|
this.getParentEl = (parent) => {
|
74
|
-
if (parent.tagName ===
|
75
|
+
if (parent.tagName === this.SEARCH_BAR_TAG) {
|
75
76
|
this.isSearchBar = true;
|
76
77
|
}
|
77
78
|
else if (parent.tagName === "IC-SELECT") {
|
@@ -323,7 +324,7 @@ export class Menu {
|
|
323
324
|
// Otherwise, if a different OS, checks Ctrl key
|
324
325
|
if ((isMacDevice() && event.metaKey) ||
|
325
326
|
(!isMacDevice() && event.ctrlKey)) {
|
326
|
-
this.
|
327
|
+
this.emitSelectAllEvents();
|
327
328
|
this.lastOptionFocused = null;
|
328
329
|
this.lastOptionSelected = null;
|
329
330
|
}
|
@@ -449,7 +450,7 @@ export class Menu {
|
|
449
450
|
this.handleSelectAllClick = () => {
|
450
451
|
this.keyboardNav = false;
|
451
452
|
this.menu.focus();
|
452
|
-
this.
|
453
|
+
this.emitSelectAllEvents();
|
453
454
|
this.lastOptionFocused = null;
|
454
455
|
this.lastOptionSelected = null;
|
455
456
|
};
|
@@ -520,13 +521,17 @@ export class Menu {
|
|
520
521
|
? this.lastOptionSelected
|
521
522
|
: null;
|
522
523
|
};
|
523
|
-
this.
|
524
|
-
var _a;
|
524
|
+
this.emitSelectAllEvents = () => {
|
525
|
+
var _a, _b;
|
525
526
|
// Select all if there is either no value or not all options are selected
|
526
527
|
// 'true' means select all, 'false' means clear all
|
527
528
|
this.menuOptionSelectAll.emit({
|
528
529
|
select: !this.value || !(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === this.ungroupedOptions.length),
|
529
530
|
});
|
531
|
+
// Emit clear event if all options are selected
|
532
|
+
if (((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) === this.ungroupedOptions.length) {
|
533
|
+
this.icClear.emit();
|
534
|
+
}
|
530
535
|
};
|
531
536
|
this.emitMenuKeyPress = (isNavKey, key) => {
|
532
537
|
this.menuKeyPress.emit({ isNavKey: isNavKey, key: key });
|
@@ -671,7 +676,7 @@ export class Menu {
|
|
671
676
|
const showCheckIcon = !!option[this.valueField] &&
|
672
677
|
!!this.value &&
|
673
678
|
selected &&
|
674
|
-
this.parentEl.tagName !==
|
679
|
+
this.parentEl.tagName !== this.SEARCH_BAR_TAG;
|
675
680
|
return (h(Fragment, null, option.loading && h("ic-loading-indicator", { size: "icon" }), h("div", { class: {
|
676
681
|
"option-text-container": true,
|
677
682
|
"show-check-icon": showCheckIcon,
|
@@ -792,8 +797,7 @@ export class Menu {
|
|
792
797
|
highlightedEl.focus();
|
793
798
|
}
|
794
799
|
}
|
795
|
-
else if (this.inputEl.tagName !== "
|
796
|
-
this.inputEl.tagName !== "INPUT") {
|
800
|
+
else if (this.inputEl.tagName !== "INPUT") {
|
797
801
|
this.menu.focus();
|
798
802
|
}
|
799
803
|
}
|
@@ -879,16 +883,24 @@ export class Menu {
|
|
879
883
|
this.focusFromSearchKeypress = true;
|
880
884
|
}
|
881
885
|
render() {
|
882
|
-
const { inputLabel, options, menuId, value, fullWidth, hasTimedOut, isLoading, size, open, inputEl, keyboardNav, } = this;
|
886
|
+
const { inputLabel, options, menuId, value, fullWidth, hasTimedOut, isLoading, size, open, inputEl, keyboardNav, parentEl, SEARCH_BAR_TAG, } = this;
|
883
887
|
const selectAllButtonText = `${(value === null || value === void 0 ? void 0 : value.length) === this.ungroupedOptions.length ? "Clear" : "Select"} all`;
|
884
888
|
const hasNoResults = this.host.classList.contains("no-results");
|
885
889
|
return (h(Host, { class: {
|
886
890
|
"ic-menu-full-width": fullWidth,
|
887
|
-
"ic-menu-no-focus": (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) === "INPUT"
|
891
|
+
"ic-menu-no-focus": ((inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) === "INPUT" &&
|
892
|
+
(parentEl === null || parentEl === void 0 ? void 0 : parentEl.tagName) !== SEARCH_BAR_TAG) ||
|
893
|
+
hasTimedOut ||
|
894
|
+
isLoading,
|
888
895
|
[`ic-menu-${size}`]: true,
|
889
896
|
"ic-menu-open": open && options.length !== 0,
|
890
897
|
"ic-menu-multiple": this.isMultiSelect,
|
891
|
-
} }, options.length !== 0 && (h("ul", { id: menuId, class: "menu", role: "listbox", "aria-label": `${inputLabel} pop-up`, "aria-multiselectable": this.isMultiSelect ? "true" : "false", tabindex: open &&
|
898
|
+
} }, options.length !== 0 && (h("ul", { id: menuId, class: "menu", role: "listbox", "aria-label": `${inputLabel} pop-up`, "aria-multiselectable": this.isMultiSelect ? "true" : "false", tabindex: open &&
|
899
|
+
!keyboardNav &&
|
900
|
+
((inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) !== "INPUT" ||
|
901
|
+
(parentEl === null || parentEl === void 0 ? void 0 : parentEl.tagName) === SEARCH_BAR_TAG)
|
902
|
+
? "0"
|
903
|
+
: "-1", ref: (el) => (this.menu = el), onKeyDown: this.handleMenuKeyDown, onKeyUp: this.handleMenuKeyUp, onBlur: this.handleBlur }, this.getSortedOptions(options).map((option, index) => {
|
892
904
|
if (option.children) {
|
893
905
|
if (option.children.length > 0) {
|
894
906
|
return (h("div", null, h("ic-typography", { class: "option-group-title", role: "presentation", variant: "subtitle-small" }, h("p", null, option[this.labelField])), option.children.map((childOption) => childOption.label &&
|
@@ -1279,6 +1291,21 @@ export class Menu {
|
|
1279
1291
|
}
|
1280
1292
|
static get events() {
|
1281
1293
|
return [{
|
1294
|
+
"method": "icClear",
|
1295
|
+
"name": "icClear",
|
1296
|
+
"bubbles": true,
|
1297
|
+
"cancelable": true,
|
1298
|
+
"composed": true,
|
1299
|
+
"docs": {
|
1300
|
+
"tags": [],
|
1301
|
+
"text": "Emitted when the clear all button is clicked."
|
1302
|
+
},
|
1303
|
+
"complexType": {
|
1304
|
+
"original": "void",
|
1305
|
+
"resolved": "void",
|
1306
|
+
"references": {}
|
1307
|
+
}
|
1308
|
+
}, {
|
1282
1309
|
"method": "menuKeyPress",
|
1283
1310
|
"name": "menuKeyPress",
|
1284
1311
|
"bubbles": true,
|