@venite/components 0.16.2 → 0.16.6
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/ion-button_13.cjs.entry.js +1787 -0
- package/dist/cjs/ion-checkbox_3.cjs.entry.js +235 -0
- package/dist/cjs/ion-segment_16.cjs.entry.js +5 -4
- package/dist/cjs/ldf-day-name_5.cjs.entry.js +1 -2
- package/dist/cjs/ldf-editable-add-block-menu.cjs.entry.js +2 -2
- package/dist/cjs/ldf-editable-filter-documents.cjs.entry.js +1 -1
- package/dist/cjs/ldf-editable-lookup_2.cjs.entry.js +3 -3
- package/dist/cjs/ldf-editable-metadata.cjs.entry.js +3 -3
- package/dist/cjs/ldf.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{option-a9f12c93.js → option-1ebd4514.js} +6 -2
- package/dist/cjs/{rubric-85fc7418.js → rubric-662d8baa.js} +44 -5
- package/dist/cjs/{specific-class-acf1bb37.js → specific-class-d80d272a.js} +2 -2
- package/dist/collection/components/liturgical-document/dist/liturgical-document.js +6 -1
- package/dist/collection/components/liturgical-document/liturgical-document.js +21 -1
- package/dist/collection/components/option/dist/option.js +318 -0
- package/dist/collection/components/prayers-and-thanksgivings/dist/prayers-and-thanksgivings.js +258 -0
- package/dist/collection/components/prayers-and-thanksgivings/prayers-and-thanksgivings.js +55 -36
- package/dist/collection/components/psalm/dist/psalm.js +0 -1
- package/dist/collection/components/psalm/psalm.js +0 -1
- package/dist/collection/components/string/dist/string.js +0 -1
- package/dist/collection/components/string/string.js +0 -1
- package/dist/collection/components/text/dist/text.js +1 -1
- package/dist/collection/components/text/text.js +1 -1
- package/dist/esm/{app-globals-2b41bd8d.js → app-globals-729b03cf.js} +1 -1
- package/dist/esm/{index-1885f1b8.js → index-734a6b69.js} +1 -1
- package/dist/esm/{index-8b9e221a.js → index-9579282b.js} +3 -3
- package/dist/esm/{index-dcd553ac.js → index-f0f6a379.js} +1 -1
- package/dist/esm/ion-action-sheet.entry.js +3 -3
- package/dist/esm/ion-alert.entry.js +3 -3
- package/dist/esm/ion-app.entry.js +3 -3
- package/dist/esm/ion-avatar.entry.js +2 -2
- package/dist/esm/ion-back-button.entry.js +2 -2
- package/dist/esm/ion-backdrop.entry.js +2 -2
- package/dist/esm/ion-badge.entry.js +2 -2
- package/dist/esm/ion-button_13.entry.js +1771 -0
- package/dist/esm/ion-card-content_6.entry.js +3 -3
- package/dist/esm/ion-card-subtitle.entry.js +2 -2
- package/dist/esm/ion-card_2.entry.js +2 -2
- package/dist/esm/ion-checkbox_3.entry.js +229 -0
- package/dist/esm/ion-chip.entry.js +2 -2
- package/dist/esm/ion-datetime_2.entry.js +3 -3
- package/dist/esm/ion-fab-button.entry.js +2 -2
- package/dist/esm/ion-fab-list.entry.js +2 -2
- package/dist/esm/ion-fab.entry.js +2 -2
- package/dist/esm/ion-footer.entry.js +2 -2
- package/dist/esm/ion-img.entry.js +2 -2
- package/dist/esm/ion-infinite-scroll-content.entry.js +2 -2
- package/dist/esm/ion-infinite-scroll.entry.js +2 -2
- package/dist/esm/ion-input_2.entry.js +2 -2
- package/dist/esm/ion-item-divider.entry.js +2 -2
- package/dist/esm/ion-item-group.entry.js +2 -2
- package/dist/esm/ion-item-option.entry.js +2 -2
- package/dist/esm/ion-item-options.entry.js +2 -2
- package/dist/esm/ion-item-sliding.entry.js +2 -2
- package/dist/esm/ion-list-header.entry.js +2 -2
- package/dist/esm/ion-loading.entry.js +3 -3
- package/dist/esm/ion-menu-button.entry.js +4 -4
- package/dist/esm/ion-menu-toggle.entry.js +4 -4
- package/dist/esm/ion-menu.entry.js +3 -3
- package/dist/esm/ion-modal.entry.js +4 -4
- package/dist/esm/ion-nav-link.entry.js +1 -1
- package/dist/esm/ion-nav.entry.js +3 -3
- package/dist/esm/ion-note.entry.js +2 -2
- package/dist/esm/ion-picker-column.entry.js +2 -2
- package/dist/esm/ion-picker.entry.js +3 -3
- package/dist/esm/ion-popover.entry.js +4 -4
- package/dist/esm/ion-progress-bar.entry.js +2 -2
- package/dist/esm/ion-radio_2.entry.js +2 -2
- package/dist/esm/ion-range.entry.js +2 -2
- package/dist/esm/ion-refresher-content.entry.js +2 -2
- package/dist/esm/ion-refresher.entry.js +2 -2
- package/dist/esm/ion-reorder-group.entry.js +2 -2
- package/dist/esm/ion-reorder.entry.js +2 -2
- package/dist/esm/ion-route-redirect.entry.js +1 -1
- package/dist/esm/ion-route.entry.js +1 -1
- package/dist/esm/ion-router-link.entry.js +2 -2
- package/dist/esm/ion-router-outlet.entry.js +3 -3
- package/dist/esm/ion-router.entry.js +1 -1
- package/dist/esm/ion-segment_16.entry.js +8 -7
- package/dist/esm/ion-select-popover.entry.js +3 -3
- package/dist/esm/ion-select_2.entry.js +3 -3
- package/dist/esm/ion-slide.entry.js +2 -2
- package/dist/esm/ion-slides.entry.js +2 -2
- package/dist/esm/ion-spinner.entry.js +2 -2
- package/dist/esm/ion-split-pane.entry.js +2 -2
- package/dist/esm/ion-tab-bar.entry.js +2 -2
- package/dist/esm/ion-tab-button.entry.js +2 -2
- package/dist/esm/ion-tab.entry.js +1 -1
- package/dist/esm/ion-tabs.entry.js +1 -1
- package/dist/esm/ion-text.entry.js +2 -2
- package/dist/esm/ion-textarea.entry.js +2 -2
- package/dist/esm/ion-thumbnail.entry.js +2 -2
- package/dist/esm/ion-toast.entry.js +3 -3
- package/dist/esm/ion-virtual-scroll.entry.js +1 -1
- package/dist/esm/{ionic-global-fef4299f.js → ionic-global-ef89a0a5.js} +1 -1
- package/dist/esm/{ios.transition-2460f61e.js → ios.transition-b1be0863.js} +2 -2
- package/dist/esm/ldf-day-name_5.entry.js +4 -5
- package/dist/esm/ldf-editable-add-block-menu.entry.js +3 -3
- package/dist/esm/ldf-editable-condition-piece.entry.js +1 -1
- package/dist/esm/ldf-editable-condition.entry.js +1 -1
- package/dist/esm/ldf-editable-filter-documents.entry.js +2 -2
- package/dist/esm/ldf-editable-lookup_2.entry.js +4 -4
- package/dist/esm/ldf-editable-metadata.entry.js +4 -4
- package/dist/esm/ldf-editable-preference-option.entry.js +1 -1
- package/dist/esm/ldf-editable-preference.entry.js +1 -1
- package/dist/esm/ldf-editable-preferences.entry.js +3 -3
- package/dist/esm/ldf-editable-string-list.entry.js +1 -1
- package/dist/esm/ldf-editor-cursors.entry.js +1 -1
- package/dist/esm/ldf-editor.entry.js +1 -1
- package/dist/esm/ldf.js +4 -4
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{md.transition-7eb37dd1.js → md.transition-1763f475.js} +2 -2
- package/dist/esm/{menu-toggle-util-d6bed342.js → menu-toggle-util-29e61ff3.js} +1 -1
- package/dist/esm/{option-042c9673.js → option-47d50244.js} +6 -2
- package/dist/esm/{overlays-e1d5aa58.js → overlays-06b43b65.js} +2 -2
- package/dist/esm/{rubric-9c750946.js → rubric-2330a030.js} +44 -5
- package/dist/esm/{specific-class-2df4b72a.js → specific-class-28e26e40.js} +2 -2
- package/dist/esm/{status-tap-900b721a.js → status-tap-7458bd71.js} +1 -1
- package/dist/ldf/ldf.esm.js +1 -1
- package/dist/ldf/{p-a7a10747.entry.js → p-018e57db.entry.js} +1 -1
- package/dist/ldf/p-02ef484e.entry.js +1 -0
- package/dist/ldf/{p-5bfa9969.entry.js → p-04715bf0.entry.js} +1 -1
- package/dist/ldf/{p-8cb241a8.entry.js → p-0651768a.entry.js} +1 -1
- package/dist/ldf/{p-a80bce6a.entry.js → p-07d6d3ad.entry.js} +1 -1
- package/dist/ldf/p-08584ccc.entry.js +1 -0
- package/dist/ldf/{p-d3a17399.entry.js → p-0873a34a.entry.js} +1 -1
- package/dist/ldf/{p-5febfbde.entry.js → p-0f69db87.entry.js} +1 -1
- package/dist/ldf/{p-6b6b9f77.entry.js → p-1504379f.entry.js} +1 -1
- package/dist/ldf/{p-110c6e85.entry.js → p-1a8e2899.entry.js} +1 -1
- package/dist/ldf/p-21e2f0a3.entry.js +1 -0
- package/dist/ldf/{p-6c3d4341.entry.js → p-25a736f1.entry.js} +1 -1
- package/dist/ldf/{p-43d7a734.entry.js → p-2c36a583.entry.js} +1 -1
- package/dist/ldf/{p-4c8f895f.entry.js → p-2fa1c501.entry.js} +1 -1
- package/dist/ldf/{p-a0b9b689.entry.js → p-302dc0d5.entry.js} +1 -1
- package/dist/ldf/{p-54f83929.entry.js → p-327b14ac.entry.js} +1 -1
- package/dist/ldf/{p-4d5b52ad.entry.js → p-32f7ba8e.entry.js} +1 -1
- package/dist/ldf/{p-8a064810.entry.js → p-3545fcdc.entry.js} +1 -1
- package/dist/ldf/{p-8c8bf861.entry.js → p-374118d7.entry.js} +1 -1
- package/dist/ldf/p-37f356a4.entry.js +1 -0
- package/dist/ldf/{p-7f7de09a.entry.js → p-380f8655.entry.js} +1 -1
- package/dist/ldf/{p-7df0687c.entry.js → p-3c9930ff.entry.js} +1 -1
- package/dist/ldf/{p-dbdb2b0a.entry.js → p-3f39c2ad.entry.js} +1 -1
- package/dist/ldf/{p-35680ca6.entry.js → p-430c418a.entry.js} +1 -1
- package/dist/ldf/{p-986921d2.js → p-48e44122.js} +1 -1
- package/dist/ldf/{p-4b154310.entry.js → p-4a4380fa.entry.js} +1 -1
- package/dist/ldf/p-4b80de48.js +1 -0
- package/dist/ldf/{p-06bc76d9.entry.js → p-4d392128.entry.js} +1 -1
- package/dist/ldf/p-4e0b3c0f.entry.js +1 -0
- package/dist/ldf/{p-b631cadf.entry.js → p-52656429.entry.js} +1 -1
- package/dist/ldf/p-53c807a4.js +1 -0
- package/dist/ldf/{p-91969280.js → p-55d797c1.js} +1 -1
- package/dist/ldf/{p-71ed0c0f.entry.js → p-59340423.entry.js} +1 -1
- package/dist/ldf/{p-0c8f1542.entry.js → p-5be7ff17.entry.js} +1 -1
- package/dist/ldf/p-5bf20b51.js +1 -0
- package/dist/ldf/{p-ae3cd06a.entry.js → p-63b5daf6.entry.js} +1 -1
- package/dist/ldf/{p-0afd3d32.entry.js → p-66a7385e.entry.js} +1 -1
- package/dist/ldf/p-698a3399.entry.js +1 -0
- package/dist/ldf/{p-4d92e32b.entry.js → p-69f85ad3.entry.js} +1 -1
- package/dist/ldf/{p-0cb749f6.entry.js → p-6fe24d85.entry.js} +1 -1
- package/dist/ldf/{p-ceb4c199.entry.js → p-70e47f8b.entry.js} +1 -1
- package/dist/ldf/{p-e778bf3c.entry.js → p-73a16936.entry.js} +1 -1
- package/dist/ldf/{p-bacac874.entry.js → p-79a526a1.entry.js} +1 -1
- package/dist/ldf/{p-20f5f7c0.entry.js → p-7abeb82c.entry.js} +1 -1
- package/dist/ldf/{p-79997a72.entry.js → p-7df11f48.entry.js} +1 -1
- package/dist/ldf/{p-91cef52f.entry.js → p-7efa633b.entry.js} +1 -1
- package/dist/ldf/{p-8ed588f7.entry.js → p-84f38db6.entry.js} +1 -1
- package/dist/ldf/{p-5a74ad40.entry.js → p-8767a74e.entry.js} +1 -1
- package/dist/ldf/{p-7fba586d.entry.js → p-8932ec85.entry.js} +1 -1
- package/dist/ldf/{p-74e1596c.entry.js → p-8c2727db.entry.js} +1 -1
- package/dist/ldf/{p-913c92ca.entry.js → p-972e4f2a.entry.js} +1 -1
- package/dist/ldf/{p-0ce10dcd.js → p-978e2c6d.js} +1 -1
- package/dist/ldf/p-9bd5d1d4.entry.js +1 -0
- package/dist/ldf/{p-5fa1dcfb.entry.js → p-9c397c49.entry.js} +1 -1
- package/dist/ldf/p-9e2c172e.entry.js +1 -0
- package/dist/ldf/{p-6b0fab5d.js → p-9e82b403.js} +2 -2
- package/dist/ldf/{p-2b9556d3.entry.js → p-a98c89d1.entry.js} +1 -1
- package/dist/ldf/{p-c3dbb344.entry.js → p-ac7a17ce.entry.js} +1 -1
- package/dist/ldf/{p-3b236b73.js → p-acbbd1ec.js} +1 -1
- package/dist/ldf/p-b1242016.js +1 -0
- package/dist/ldf/{p-50d56c76.entry.js → p-b7388aec.entry.js} +1 -1
- package/dist/ldf/{p-37ead536.entry.js → p-b78336d7.entry.js} +1 -1
- package/dist/ldf/{p-9282f514.entry.js → p-ba021918.entry.js} +1 -1
- package/dist/ldf/{p-65c80b87.entry.js → p-c1bcd0a9.entry.js} +1 -1
- package/dist/ldf/{p-4c825920.entry.js → p-c1df632d.entry.js} +1 -1
- package/dist/ldf/{p-a467efd9.entry.js → p-c3042920.entry.js} +1 -1
- package/dist/ldf/{p-860e2e8c.entry.js → p-c3807857.entry.js} +1 -1
- package/dist/ldf/{p-faf3cb15.entry.js → p-c3841978.entry.js} +1 -1
- package/dist/ldf/{p-b7fe7b29.entry.js → p-c41e055c.entry.js} +1 -1
- package/dist/ldf/{p-5cefe450.entry.js → p-c6163f81.entry.js} +1 -1
- package/dist/ldf/{p-944c44a7.entry.js → p-c6b42618.entry.js} +1 -1
- package/dist/ldf/{p-1d8e06c7.entry.js → p-c74d3fd0.entry.js} +1 -1
- package/dist/ldf/{p-741e1b4e.entry.js → p-c82dd468.entry.js} +1 -1
- package/dist/ldf/{p-342e45c0.entry.js → p-ca698b8f.entry.js} +1 -1
- package/dist/ldf/p-ca7e0de9.entry.js +1 -0
- package/dist/ldf/{p-059fcd05.entry.js → p-cbfbb80c.entry.js} +1 -1
- package/dist/ldf/{p-a8264864.entry.js → p-d195c957.entry.js} +1 -1
- package/dist/ldf/{p-664b2872.js → p-d282d4f9.js} +1 -1
- package/dist/ldf/{p-bc59e89e.entry.js → p-d7966e9b.entry.js} +1 -1
- package/dist/ldf/{p-f562ae50.js → p-d7f8c770.js} +1 -1
- package/dist/ldf/{p-396025ba.entry.js → p-d7fa99cc.entry.js} +1 -1
- package/dist/ldf/{p-ae136041.entry.js → p-db435131.entry.js} +1 -1
- package/dist/ldf/{p-ae287f67.entry.js → p-dc445c36.entry.js} +1 -1
- package/dist/ldf/{p-385a3ecf.entry.js → p-dd99e42a.entry.js} +1 -1
- package/dist/ldf/{p-b8a8f9c8.js → p-de5bb5ad.js} +1 -1
- package/dist/ldf/{p-7e388cb7.entry.js → p-e0e12ae3.entry.js} +1 -1
- package/dist/ldf/{p-128ac9e9.entry.js → p-e215fd02.entry.js} +1 -1
- package/dist/ldf/{p-4b7027b1.entry.js → p-e4be11ad.entry.js} +1 -1
- package/dist/ldf/{p-8d6f1d6b.entry.js → p-ea66c343.entry.js} +1 -1
- package/dist/ldf/{p-ac9a93aa.entry.js → p-ec5eecdc.entry.js} +1 -1
- package/dist/ldf/{p-64c46765.js → p-f2ce126e.js} +1 -1
- package/dist/ldf/{p-186eed18.entry.js → p-fe59a676.entry.js} +1 -1
- package/dist/ldf/p-ff51dbd0.entry.js +1 -0
- package/dist/types/components/liturgical-document/liturgical-document.d.ts +2 -0
- package/dist/types/components/prayers-and-thanksgivings/prayers-and-thanksgivings.d.ts +1 -1
- package/dist/types/components.d.ts +8 -0
- package/package.json +2 -2
- package/dist/cjs/ion-button_3.cjs.entry.js +0 -413
- package/dist/cjs/ion-buttons_6.cjs.entry.js +0 -584
- package/dist/cjs/ion-content.cjs.entry.js +0 -303
- package/dist/cjs/ion-item_2.cjs.entry.js +0 -168
- package/dist/cjs/ion-ripple-effect.cjs.entry.js +0 -93
- package/dist/cjs/ion-searchbar.cjs.entry.js +0 -330
- package/dist/cjs/ion-title.cjs.entry.js +0 -48
- package/dist/cjs/ldf-prayers-and-thanksgivings.cjs.entry.js +0 -108
- package/dist/esm/ion-button_3.entry.js +0 -407
- package/dist/esm/ion-buttons_6.entry.js +0 -575
- package/dist/esm/ion-content.entry.js +0 -299
- package/dist/esm/ion-item_2.entry.js +0 -163
- package/dist/esm/ion-ripple-effect.entry.js +0 -89
- package/dist/esm/ion-searchbar.entry.js +0 -326
- package/dist/esm/ion-title.entry.js +0 -44
- package/dist/esm/ldf-prayers-and-thanksgivings.entry.js +0 -104
- package/dist/ldf/p-01655d40.js +0 -1
- package/dist/ldf/p-07e48862.entry.js +0 -1
- package/dist/ldf/p-2471a9c7.entry.js +0 -1
- package/dist/ldf/p-356f9ee6.entry.js +0 -1
- package/dist/ldf/p-68f963c7.entry.js +0 -1
- package/dist/ldf/p-72718314.entry.js +0 -1
- package/dist/ldf/p-78ed7ef0.entry.js +0 -1
- package/dist/ldf/p-7aecb410.js +0 -1
- package/dist/ldf/p-7ccf2257.entry.js +0 -1
- package/dist/ldf/p-867f7c02.js +0 -1
- package/dist/ldf/p-8e1286c3.entry.js +0 -1
- package/dist/ldf/p-92461769.entry.js +0 -1
- package/dist/ldf/p-9382bbe1.entry.js +0 -1
- package/dist/ldf/p-96967103.entry.js +0 -1
- package/dist/ldf/p-accacaed.entry.js +0 -1
- package/dist/ldf/p-bcb82c8e.js +0 -1
- package/dist/ldf/p-c7c0acf1.entry.js +0 -1
- package/dist/ldf/p-cee7604d.entry.js +0 -1
- package/dist/ldf/p-e3ce57d7.entry.js +0 -1
- package/dist/ldf/p-ecb2e631.entry.js +0 -1
|
@@ -0,0 +1,1787 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-8fe0df8d.js');
|
|
6
|
+
const ionicGlobal = require('./ionic-global-581fb4f8.js');
|
|
7
|
+
const helpers = require('./helpers-41dfb43a.js');
|
|
8
|
+
const theme = require('./theme-81caa5b0.js');
|
|
9
|
+
const overlays = require('./overlays-eb464d6d.js');
|
|
10
|
+
require('./index-5e2cc9e9.js');
|
|
11
|
+
const change = require('./change-cdb1e8c0.js');
|
|
12
|
+
const locale = require('./locale-d4e925b1.js');
|
|
13
|
+
require('./hardware-back-button-8c2f48d2.js');
|
|
14
|
+
require('./_commonjsHelpers-bcc1208a.js');
|
|
15
|
+
|
|
16
|
+
const buttonIosCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:10px;--padding-top:0;--padding-bottom:0;--padding-start:1em;--padding-end:1em;--transition:background-color, opacity 100ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:2.8em;font-size:16px;font-weight:500;letter-spacing:-0.03em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:var(--ion-color-primary-shade, #3171e0);--background-focused:var(--ion-color-primary-shade, #3171e0);--background-hover:var(--ion-color-primary-tint, #4c8dff);--background-activated-opacity:1;--background-focused-opacity:1;--background-hover-opacity:1}:host(.button-outline){--border-radius:10px;--border-width:1px;--border-style:solid;--background-activated:var(--ion-color-primary, #3880ff);--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;--color-activated:var(--ion-color-primary-contrast, #fff)}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;font-size:17px;font-weight:normal;letter-spacing:0}:host(.button-large){--border-radius:12px;--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--border-radius:6px;--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-strong){font-weight:600}:host(.button-clear.ion-activated){opacity:0.4}:host(.button-outline.ion-activated.ion-color) .button-native{color:var(--ion-color-contrast)}:host(.button-outline.ion-activated.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-activated) .button-native::after{background:var(--ion-color-shade)}:host(.button-outline.ion-focused.ion-color) .button-native,:host(.button-clear.ion-focused.ion-color) .button-native{color:var(--ion-color-base)}:host(.button-outline.ion-focused.ion-color) .button-native::after,:host(.button-clear.ion-focused.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-shade)}@media (any-hover: hover){:host(.button-clear:hover),:host(.button-outline:hover){opacity:0.6}:host(.button-clear.ion-color:hover) .button-native,:host(.button-outline.ion-color:hover) .button-native{color:var(--ion-color-base)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:transparent}:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-tint)}:host(:hover.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native::after{background:#fff;opacity:0.1}}";
|
|
17
|
+
|
|
18
|
+
const buttonMdCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:4px;--padding-top:0;--padding-bottom:0;--padding-start:1.1em;--padding-end:1.1em;--transition:box-shadow 280ms cubic-bezier(.4, 0, .2, 1),\n background-color 15ms linear,\n color 15ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:36px;font-size:14px;font-weight:500;letter-spacing:0.06em;text-transform:uppercase}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:transparent;--background-hover:var(--ion-color-primary-contrast, #fff);--background-focused:var(--ion-color-primary-contrast, #fff);--background-activated-opacity:0;--background-focused-opacity:.24;--background-hover-opacity:.08;--box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}:host(.button-solid.ion-activated){--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12)}:host(.button-outline){--border-width:2px;--border-style:solid;--box-shadow:none;--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-outline.ion-activated.ion-color) .button-native{background:transparent}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-large){--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-strong){font-weight:bold}::slotted(ion-icon[slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-contrast);opacity:0.24}:host(.button-clear.ion-color.ion-focused) .button-native::after,:host(.button-outline.ion-color.ion-focused) .button-native::after{background:var(--ion-color-base);opacity:0.12}@media (any-hover: hover){:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-contrast);opacity:0.08}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:var(--ion-color-base);opacity:0.04}}";
|
|
19
|
+
|
|
20
|
+
const Button = class {
|
|
21
|
+
constructor(hostRef) {
|
|
22
|
+
index.registerInstance(this, hostRef);
|
|
23
|
+
this.ionFocus = index.createEvent(this, "ionFocus", 7);
|
|
24
|
+
this.ionBlur = index.createEvent(this, "ionBlur", 7);
|
|
25
|
+
this.inItem = false;
|
|
26
|
+
this.inListHeader = false;
|
|
27
|
+
this.inToolbar = false;
|
|
28
|
+
/**
|
|
29
|
+
* The type of button.
|
|
30
|
+
*/
|
|
31
|
+
this.buttonType = 'button';
|
|
32
|
+
/**
|
|
33
|
+
* If `true`, the user cannot interact with the button.
|
|
34
|
+
*/
|
|
35
|
+
this.disabled = false;
|
|
36
|
+
/**
|
|
37
|
+
* When using a router, it specifies the transition direction when navigating to
|
|
38
|
+
* another page using `href`.
|
|
39
|
+
*/
|
|
40
|
+
this.routerDirection = 'forward';
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, activates a button with a heavier font weight.
|
|
43
|
+
*/
|
|
44
|
+
this.strong = false;
|
|
45
|
+
/**
|
|
46
|
+
* The type of the button.
|
|
47
|
+
*/
|
|
48
|
+
this.type = 'button';
|
|
49
|
+
this.handleClick = (ev) => {
|
|
50
|
+
if (this.type === 'button') {
|
|
51
|
+
theme.openURL(this.href, ev, this.routerDirection);
|
|
52
|
+
}
|
|
53
|
+
else if (helpers.hasShadowDom(this.el)) {
|
|
54
|
+
// this button wants to specifically submit a form
|
|
55
|
+
// climb up the dom to see if we're in a <form>
|
|
56
|
+
// and if so, then use JS to submit it
|
|
57
|
+
const form = this.el.closest('form');
|
|
58
|
+
if (form) {
|
|
59
|
+
ev.preventDefault();
|
|
60
|
+
const fakeButton = document.createElement('button');
|
|
61
|
+
fakeButton.type = this.type;
|
|
62
|
+
fakeButton.style.display = 'none';
|
|
63
|
+
form.appendChild(fakeButton);
|
|
64
|
+
fakeButton.click();
|
|
65
|
+
fakeButton.remove();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.onFocus = () => {
|
|
70
|
+
this.ionFocus.emit();
|
|
71
|
+
};
|
|
72
|
+
this.onBlur = () => {
|
|
73
|
+
this.ionBlur.emit();
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
componentWillLoad() {
|
|
77
|
+
this.inToolbar = !!this.el.closest('ion-buttons');
|
|
78
|
+
this.inListHeader = !!this.el.closest('ion-list-header');
|
|
79
|
+
this.inItem = !!this.el.closest('ion-item') || !!this.el.closest('ion-item-divider');
|
|
80
|
+
}
|
|
81
|
+
get hasIconOnly() {
|
|
82
|
+
return !!this.el.querySelector('ion-icon[slot="icon-only"]');
|
|
83
|
+
}
|
|
84
|
+
get rippleType() {
|
|
85
|
+
const hasClearFill = this.fill === undefined || this.fill === 'clear';
|
|
86
|
+
// If the button is in a toolbar, has a clear fill (which is the default)
|
|
87
|
+
// and only has an icon we use the unbounded "circular" ripple effect
|
|
88
|
+
if (hasClearFill && this.hasIconOnly && this.inToolbar) {
|
|
89
|
+
return 'unbounded';
|
|
90
|
+
}
|
|
91
|
+
return 'bounded';
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
95
|
+
const { buttonType, type, disabled, rel, target, size, href, color, expand, hasIconOnly, shape, strong } = this;
|
|
96
|
+
const finalSize = size === undefined && this.inItem ? 'small' : size;
|
|
97
|
+
const TagType = href === undefined ? 'button' : 'a';
|
|
98
|
+
const attrs = (TagType === 'button')
|
|
99
|
+
? { type }
|
|
100
|
+
: {
|
|
101
|
+
download: this.download,
|
|
102
|
+
href,
|
|
103
|
+
rel,
|
|
104
|
+
target
|
|
105
|
+
};
|
|
106
|
+
let fill = this.fill;
|
|
107
|
+
if (fill === undefined) {
|
|
108
|
+
fill = this.inToolbar || this.inListHeader ? 'clear' : 'solid';
|
|
109
|
+
}
|
|
110
|
+
return (index.h(index.Host, { onClick: this.handleClick, "aria-disabled": disabled ? 'true' : null, class: Object.assign(Object.assign({}, theme.createColorClasses(color)), { [mode]: true, [buttonType]: true, [`${buttonType}-${expand}`]: expand !== undefined, [`${buttonType}-${finalSize}`]: finalSize !== undefined, [`${buttonType}-${shape}`]: shape !== undefined, [`${buttonType}-${fill}`]: true, [`${buttonType}-strong`]: strong, 'in-toolbar': theme.hostContext('ion-toolbar', this.el), 'in-toolbar-color': theme.hostContext('ion-toolbar[color]', this.el), 'button-has-icon-only': hasIconOnly, 'button-disabled': disabled, 'ion-activatable': true, 'ion-focusable': true }) }, index.h(TagType, Object.assign({}, attrs, { class: "button-native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur }), index.h("span", { class: "button-inner" }, index.h("slot", { name: "icon-only" }), index.h("slot", { name: "start" }), index.h("slot", null), index.h("slot", { name: "end" })), mode === 'md' && index.h("ion-ripple-effect", { type: this.rippleType }))));
|
|
111
|
+
}
|
|
112
|
+
get el() { return index.getElement(this); }
|
|
113
|
+
};
|
|
114
|
+
Button.style = {
|
|
115
|
+
ios: buttonIosCss,
|
|
116
|
+
md: buttonMdCss
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const buttonsIosCss = ".sc-ion-buttons-ios-h{display:flex;align-items:center;transform:translateZ(0);z-index:99}.sc-ion-buttons-ios-s ion-button{--padding-top:0;--padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-buttons-ios-s ion-button{--padding-start:5px;--padding-end:5px;margin-left:2px;margin-right:2px;height:32px;font-size:17px;font-weight:400}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-buttons-ios-s ion-button{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}.sc-ion-buttons-ios-s ion-button:not(.button-round){--border-radius:4px}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button{--color:initial;--border-color:initial;--background-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-solid,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-solid{--background:var(--ion-color-contrast);--background-focused:#000;--background-focused-opacity:.12;--background-activated:#000;--background-activated-opacity:.12;--background-hover:var(--ion-color-base);--background-hover-opacity:0.45;--color:var(--ion-color-base);--color-focused:var(--ion-color-base)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-clear,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-clear{--color-activated:var(--ion-color-contrast);--color-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-outline,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-outline{--color-activated:var(--ion-color-base);--color-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-s .button-clear,.sc-ion-buttons-ios-s .button-outline{--background-activated:transparent;--background-focused:currentColor;--background-hover:transparent}.sc-ion-buttons-ios-s .button-solid:not(.ion-color){--background-focused:#000;--background-focused-opacity:.12;--background-activated:#000;--background-activated-opacity:.12}.sc-ion-buttons-ios-s ion-icon[slot=start]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;margin-right:0.3em;font-size:24px;line-height:0.67}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-buttons-ios-s ion-icon[slot=start]{margin-right:unset;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}.sc-ion-buttons-ios-s ion-icon[slot=end]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;margin-left:0.4em;font-size:24px;line-height:0.67}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-buttons-ios-s ion-icon[slot=end]{margin-left:unset;-webkit-margin-start:0.4em;margin-inline-start:0.4em}}.sc-ion-buttons-ios-s ion-icon[slot=icon-only]{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;font-size:28px;line-height:0.67}";
|
|
120
|
+
|
|
121
|
+
const buttonsMdCss = ".sc-ion-buttons-md-h{display:flex;align-items:center;transform:translateZ(0);z-index:99}.sc-ion-buttons-md-s ion-button{--padding-top:0;--padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-buttons-md-s ion-button{--padding-top:0;--padding-bottom:0;--padding-start:8px;--padding-end:8px;--box-shadow:none;margin-left:2px;margin-right:2px;height:32px;font-size:14px;font-weight:500}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-buttons-md-s ion-button{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}.sc-ion-buttons-md-s ion-button:not(.button-round){--border-radius:2px}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button{--color:initial;--color-focused:var(--ion-color-contrast);--color-hover:var(--ion-color-contrast);--background-activated:transparent;--background-focused:var(--ion-color-contrast);--background-hover:var(--ion-color-contrast)}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button-solid,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button-solid{--background:var(--ion-color-contrast);--background-activated:transparent;--background-focused:var(--ion-color-shade);--background-hover:var(--ion-color-base);--color:var(--ion-color-base);--color-focused:var(--ion-color-base);--color-hover:var(--ion-color-base)}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button-outline,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button-outline{--border-color:var(--ion-color-contrast)}.sc-ion-buttons-md-s .button-has-icon-only.button-clear{--padding-top:12px;--padding-end:12px;--padding-bottom:12px;--padding-start:12px;--border-radius:50%;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;width:48px;height:48px}.sc-ion-buttons-md-s .button{--background-hover:currentColor}.sc-ion-buttons-md-s .button-solid{--color:var(--ion-toolbar-background, var(--ion-background-color, #fff));--background:var(--ion-toolbar-color, var(--ion-text-color, #424242));--background-activated:transparent;--background-focused:currentColor}.sc-ion-buttons-md-s .button-outline{--color:initial;--background:transparent;--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--border-color:currentColor}.sc-ion-buttons-md-s .button-clear{--color:initial;--background:transparent;--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor}.sc-ion-buttons-md-s ion-icon[slot=start]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;margin-right:0.3em;font-size:1.4em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-buttons-md-s ion-icon[slot=start]{margin-right:unset;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}.sc-ion-buttons-md-s ion-icon[slot=end]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;margin-left:0.4em;font-size:1.4em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-buttons-md-s ion-icon[slot=end]{margin-left:unset;-webkit-margin-start:0.4em;margin-inline-start:0.4em}}.sc-ion-buttons-md-s ion-icon[slot=icon-only]{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;font-size:1.8em}";
|
|
122
|
+
|
|
123
|
+
const Buttons = class {
|
|
124
|
+
constructor(hostRef) {
|
|
125
|
+
index.registerInstance(this, hostRef);
|
|
126
|
+
/**
|
|
127
|
+
* If true, buttons will disappear when its
|
|
128
|
+
* parent toolbar has fully collapsed if the toolbar
|
|
129
|
+
* is not the first toolbar. If the toolbar is the
|
|
130
|
+
* first toolbar, the buttons will be hidden and will
|
|
131
|
+
* only be shown once all toolbars have fully collapsed.
|
|
132
|
+
*
|
|
133
|
+
* Only applies in `ios` mode with `collapse` set to
|
|
134
|
+
* `true` on `ion-header`.
|
|
135
|
+
*
|
|
136
|
+
* Typically used for [Collapsible Large Titles](https://ionicframework.com/docs/api/title#collapsible-large-titles)
|
|
137
|
+
*/
|
|
138
|
+
this.collapse = false;
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
142
|
+
return (index.h(index.Host, { class: {
|
|
143
|
+
[mode]: true,
|
|
144
|
+
['buttons-collapse']: this.collapse
|
|
145
|
+
} }));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
Buttons.style = {
|
|
149
|
+
ios: buttonsIosCss,
|
|
150
|
+
md: buttonsMdCss
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const contentCss = ":host{--background:var(--ion-background-color, #fff);--color:var(--ion-text-color, #000);--padding-top:0px;--padding-bottom:0px;--padding-start:0px;--padding-end:0px;--keyboard-offset:0px;--offset-top:0px;--offset-bottom:0px;--overflow:auto;display:block;position:relative;flex:1;width:100%;height:100%;margin:0 !important;padding:0 !important;font-family:var(--ion-font-family, inherit);contain:size style}:host(.ion-color) .inner-scroll{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.outer-content){--background:var(--ion-color-step-50, #f2f2f2)}#background-content{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);position:absolute;background:var(--background)}.inner-scroll{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:calc(var(--padding-top) + var(--offset-top));padding-bottom:calc(var(--padding-bottom) + var(--keyboard-offset) + var(--offset-bottom));position:absolute;color:var(--color);box-sizing:border-box;overflow:hidden}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.inner-scroll{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.scroll-y,.scroll-x{-webkit-overflow-scrolling:touch;will-change:scroll-position}.scroll-y{touch-action:pan-y;overflow-y:var(--overflow);overscroll-behavior-y:contain}.scroll-x{touch-action:pan-x;overflow-x:var(--overflow);overscroll-behavior-x:contain}.scroll-x.scroll-y{touch-action:auto}.overscroll::before,.overscroll::after{position:absolute;width:1px;height:1px;content:\"\"}.overscroll::before{bottom:-1px}.overscroll::after{top:-1px}:host(.content-sizing){contain:none}:host(.content-sizing) .inner-scroll{position:relative}.transition-effect{display:none;position:absolute;left:-100%;width:100%;height:100%;opacity:0;pointer-events:none}.transition-cover{position:absolute;right:0;width:100%;height:100%;background:black;opacity:0.1}.transition-shadow{display:block;position:absolute;right:0;width:10px;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAYAAAAIXrg4AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTE3MDgzRkQ5QTkyMTFFOUEwNzQ5MkJFREE1NUY2MjQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTE3MDgzRkU5QTkyMTFFOUEwNzQ5MkJFREE1NUY2MjQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxMTcwODNGQjlBOTIxMUU5QTA3NDkyQkVEQTU1RjYyNCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxMTcwODNGQzlBOTIxMUU5QTA3NDkyQkVEQTU1RjYyNCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmePEuQAAABNSURBVHjaYvz//z8DIxAwMDAwATGMhmFmPDQuOSZks0AMmoJBaQHjkPfB0Lfg/2gQjVow+HPy/yHvg9GiYjQfjMbBqAWjFgy/4hogwADYqwdzxy5BuwAAAABJRU5ErkJggg==);background-repeat:repeat-y;background-size:10px 16px}::slotted([slot=fixed]){position:absolute}";
|
|
154
|
+
|
|
155
|
+
const Content = class {
|
|
156
|
+
constructor(hostRef) {
|
|
157
|
+
index.registerInstance(this, hostRef);
|
|
158
|
+
this.ionScrollStart = index.createEvent(this, "ionScrollStart", 7);
|
|
159
|
+
this.ionScroll = index.createEvent(this, "ionScroll", 7);
|
|
160
|
+
this.ionScrollEnd = index.createEvent(this, "ionScrollEnd", 7);
|
|
161
|
+
this.isScrolling = false;
|
|
162
|
+
this.lastScroll = 0;
|
|
163
|
+
this.queued = false;
|
|
164
|
+
this.cTop = -1;
|
|
165
|
+
this.cBottom = -1;
|
|
166
|
+
// Detail is used in a hot loop in the scroll event, by allocating it here
|
|
167
|
+
// V8 will be able to inline any read/write to it since it's a monomorphic class.
|
|
168
|
+
// https://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html
|
|
169
|
+
this.detail = {
|
|
170
|
+
scrollTop: 0,
|
|
171
|
+
scrollLeft: 0,
|
|
172
|
+
type: 'scroll',
|
|
173
|
+
event: undefined,
|
|
174
|
+
startX: 0,
|
|
175
|
+
startY: 0,
|
|
176
|
+
startTime: 0,
|
|
177
|
+
currentX: 0,
|
|
178
|
+
currentY: 0,
|
|
179
|
+
velocityX: 0,
|
|
180
|
+
velocityY: 0,
|
|
181
|
+
deltaX: 0,
|
|
182
|
+
deltaY: 0,
|
|
183
|
+
currentTime: 0,
|
|
184
|
+
data: undefined,
|
|
185
|
+
isScrolling: true,
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* If `true`, the content will scroll behind the headers
|
|
189
|
+
* and footers. This effect can easily be seen by setting the toolbar
|
|
190
|
+
* to transparent.
|
|
191
|
+
*/
|
|
192
|
+
this.fullscreen = false;
|
|
193
|
+
/**
|
|
194
|
+
* If you want to enable the content scrolling in the X axis, set this property to `true`.
|
|
195
|
+
*/
|
|
196
|
+
this.scrollX = false;
|
|
197
|
+
/**
|
|
198
|
+
* If you want to disable the content scrolling in the Y axis, set this property to `false`.
|
|
199
|
+
*/
|
|
200
|
+
this.scrollY = true;
|
|
201
|
+
/**
|
|
202
|
+
* Because of performance reasons, ionScroll events are disabled by default, in order to enable them
|
|
203
|
+
* and start listening from (ionScroll), set this property to `true`.
|
|
204
|
+
*/
|
|
205
|
+
this.scrollEvents = false;
|
|
206
|
+
}
|
|
207
|
+
disconnectedCallback() {
|
|
208
|
+
this.onScrollEnd();
|
|
209
|
+
}
|
|
210
|
+
onAppLoad() {
|
|
211
|
+
this.resize();
|
|
212
|
+
}
|
|
213
|
+
onClick(ev) {
|
|
214
|
+
if (this.isScrolling) {
|
|
215
|
+
ev.preventDefault();
|
|
216
|
+
ev.stopPropagation();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
shouldForceOverscroll() {
|
|
220
|
+
const { forceOverscroll } = this;
|
|
221
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
222
|
+
return forceOverscroll === undefined
|
|
223
|
+
? mode === 'ios' && ionicGlobal.isPlatform('ios')
|
|
224
|
+
: forceOverscroll;
|
|
225
|
+
}
|
|
226
|
+
resize() {
|
|
227
|
+
if (this.fullscreen) {
|
|
228
|
+
index.readTask(() => this.readDimensions());
|
|
229
|
+
}
|
|
230
|
+
else if (this.cTop !== 0 || this.cBottom !== 0) {
|
|
231
|
+
this.cTop = this.cBottom = 0;
|
|
232
|
+
index.forceUpdate(this);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
readDimensions() {
|
|
236
|
+
const page = getPageElement(this.el);
|
|
237
|
+
const top = Math.max(this.el.offsetTop, 0);
|
|
238
|
+
const bottom = Math.max(page.offsetHeight - top - this.el.offsetHeight, 0);
|
|
239
|
+
const dirty = top !== this.cTop || bottom !== this.cBottom;
|
|
240
|
+
if (dirty) {
|
|
241
|
+
this.cTop = top;
|
|
242
|
+
this.cBottom = bottom;
|
|
243
|
+
index.forceUpdate(this);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
onScroll(ev) {
|
|
247
|
+
const timeStamp = Date.now();
|
|
248
|
+
const shouldStart = !this.isScrolling;
|
|
249
|
+
this.lastScroll = timeStamp;
|
|
250
|
+
if (shouldStart) {
|
|
251
|
+
this.onScrollStart();
|
|
252
|
+
}
|
|
253
|
+
if (!this.queued && this.scrollEvents) {
|
|
254
|
+
this.queued = true;
|
|
255
|
+
index.readTask(ts => {
|
|
256
|
+
this.queued = false;
|
|
257
|
+
this.detail.event = ev;
|
|
258
|
+
updateScrollDetail(this.detail, this.scrollEl, ts, shouldStart);
|
|
259
|
+
this.ionScroll.emit(this.detail);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get the element where the actual scrolling takes place.
|
|
265
|
+
* This element can be used to subscribe to `scroll` events or manually modify
|
|
266
|
+
* `scrollTop`. However, it's recommended to use the API provided by `ion-content`:
|
|
267
|
+
*
|
|
268
|
+
* i.e. Using `ionScroll`, `ionScrollStart`, `ionScrollEnd` for scrolling events
|
|
269
|
+
* and `scrollToPoint()` to scroll the content into a certain point.
|
|
270
|
+
*/
|
|
271
|
+
getScrollElement() {
|
|
272
|
+
return Promise.resolve(this.scrollEl);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Scroll to the top of the component.
|
|
276
|
+
*
|
|
277
|
+
* @param duration The amount of time to take scrolling to the top. Defaults to `0`.
|
|
278
|
+
*/
|
|
279
|
+
scrollToTop(duration = 0) {
|
|
280
|
+
return this.scrollToPoint(undefined, 0, duration);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Scroll to the bottom of the component.
|
|
284
|
+
*
|
|
285
|
+
* @param duration The amount of time to take scrolling to the bottom. Defaults to `0`.
|
|
286
|
+
*/
|
|
287
|
+
scrollToBottom(duration = 0) {
|
|
288
|
+
const y = this.scrollEl.scrollHeight - this.scrollEl.clientHeight;
|
|
289
|
+
return this.scrollToPoint(undefined, y, duration);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Scroll by a specified X/Y distance in the component.
|
|
293
|
+
*
|
|
294
|
+
* @param x The amount to scroll by on the horizontal axis.
|
|
295
|
+
* @param y The amount to scroll by on the vertical axis.
|
|
296
|
+
* @param duration The amount of time to take scrolling by that amount.
|
|
297
|
+
*/
|
|
298
|
+
scrollByPoint(x, y, duration) {
|
|
299
|
+
return this.scrollToPoint(x + this.scrollEl.scrollLeft, y + this.scrollEl.scrollTop, duration);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Scroll to a specified X/Y location in the component.
|
|
303
|
+
*
|
|
304
|
+
* @param x The point to scroll to on the horizontal axis.
|
|
305
|
+
* @param y The point to scroll to on the vertical axis.
|
|
306
|
+
* @param duration The amount of time to take scrolling to that point. Defaults to `0`.
|
|
307
|
+
*/
|
|
308
|
+
async scrollToPoint(x, y, duration = 0) {
|
|
309
|
+
const el = this.scrollEl;
|
|
310
|
+
if (duration < 32) {
|
|
311
|
+
if (y != null) {
|
|
312
|
+
el.scrollTop = y;
|
|
313
|
+
}
|
|
314
|
+
if (x != null) {
|
|
315
|
+
el.scrollLeft = x;
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
let resolve;
|
|
320
|
+
let startTime = 0;
|
|
321
|
+
const promise = new Promise(r => resolve = r);
|
|
322
|
+
const fromY = el.scrollTop;
|
|
323
|
+
const fromX = el.scrollLeft;
|
|
324
|
+
const deltaY = y != null ? y - fromY : 0;
|
|
325
|
+
const deltaX = x != null ? x - fromX : 0;
|
|
326
|
+
// scroll loop
|
|
327
|
+
const step = (timeStamp) => {
|
|
328
|
+
const linearTime = Math.min(1, ((timeStamp - startTime) / duration)) - 1;
|
|
329
|
+
const easedT = Math.pow(linearTime, 3) + 1;
|
|
330
|
+
if (deltaY !== 0) {
|
|
331
|
+
el.scrollTop = Math.floor((easedT * deltaY) + fromY);
|
|
332
|
+
}
|
|
333
|
+
if (deltaX !== 0) {
|
|
334
|
+
el.scrollLeft = Math.floor((easedT * deltaX) + fromX);
|
|
335
|
+
}
|
|
336
|
+
if (easedT < 1) {
|
|
337
|
+
// do not use DomController here
|
|
338
|
+
// must use nativeRaf in order to fire in the next frame
|
|
339
|
+
// TODO: remove as any
|
|
340
|
+
requestAnimationFrame(step);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
resolve();
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
// chill out for a frame first
|
|
347
|
+
requestAnimationFrame(ts => {
|
|
348
|
+
startTime = ts;
|
|
349
|
+
step(ts);
|
|
350
|
+
});
|
|
351
|
+
return promise;
|
|
352
|
+
}
|
|
353
|
+
onScrollStart() {
|
|
354
|
+
this.isScrolling = true;
|
|
355
|
+
this.ionScrollStart.emit({
|
|
356
|
+
isScrolling: true
|
|
357
|
+
});
|
|
358
|
+
if (this.watchDog) {
|
|
359
|
+
clearInterval(this.watchDog);
|
|
360
|
+
}
|
|
361
|
+
// watchdog
|
|
362
|
+
this.watchDog = setInterval(() => {
|
|
363
|
+
if (this.lastScroll < Date.now() - 120) {
|
|
364
|
+
this.onScrollEnd();
|
|
365
|
+
}
|
|
366
|
+
}, 100);
|
|
367
|
+
}
|
|
368
|
+
onScrollEnd() {
|
|
369
|
+
clearInterval(this.watchDog);
|
|
370
|
+
this.watchDog = null;
|
|
371
|
+
if (this.isScrolling) {
|
|
372
|
+
this.isScrolling = false;
|
|
373
|
+
this.ionScrollEnd.emit({
|
|
374
|
+
isScrolling: false
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
render() {
|
|
379
|
+
const { scrollX, scrollY } = this;
|
|
380
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
381
|
+
const forceOverscroll = this.shouldForceOverscroll();
|
|
382
|
+
const transitionShadow = (mode === 'ios' && ionicGlobal.config.getBoolean('experimentalTransitionShadow', true));
|
|
383
|
+
this.resize();
|
|
384
|
+
return (index.h(index.Host, { class: Object.assign(Object.assign({}, theme.createColorClasses(this.color)), { [mode]: true, 'content-sizing': theme.hostContext('ion-popover', this.el), 'overscroll': forceOverscroll }), style: {
|
|
385
|
+
'--offset-top': `${this.cTop}px`,
|
|
386
|
+
'--offset-bottom': `${this.cBottom}px`,
|
|
387
|
+
} }, index.h("div", { id: "background-content", part: "background" }), index.h("main", { class: {
|
|
388
|
+
'inner-scroll': true,
|
|
389
|
+
'scroll-x': scrollX,
|
|
390
|
+
'scroll-y': scrollY,
|
|
391
|
+
'overscroll': (scrollX || scrollY) && forceOverscroll
|
|
392
|
+
}, ref: el => this.scrollEl = el, onScroll: (this.scrollEvents) ? ev => this.onScroll(ev) : undefined, part: "scroll" }, index.h("slot", null)), transitionShadow ? (index.h("div", { class: "transition-effect" }, index.h("div", { class: "transition-cover" }), index.h("div", { class: "transition-shadow" }))) : null, index.h("slot", { name: "fixed" })));
|
|
393
|
+
}
|
|
394
|
+
get el() { return index.getElement(this); }
|
|
395
|
+
};
|
|
396
|
+
const getParentElement = (el) => {
|
|
397
|
+
if (el.parentElement) {
|
|
398
|
+
// normal element with a parent element
|
|
399
|
+
return el.parentElement;
|
|
400
|
+
}
|
|
401
|
+
if (el.parentNode && el.parentNode.host) {
|
|
402
|
+
// shadow dom's document fragment
|
|
403
|
+
return el.parentNode.host;
|
|
404
|
+
}
|
|
405
|
+
return null;
|
|
406
|
+
};
|
|
407
|
+
const getPageElement = (el) => {
|
|
408
|
+
const tabs = el.closest('ion-tabs');
|
|
409
|
+
if (tabs) {
|
|
410
|
+
return tabs;
|
|
411
|
+
}
|
|
412
|
+
const page = el.closest('ion-app,ion-page,.ion-page,page-inner');
|
|
413
|
+
if (page) {
|
|
414
|
+
return page;
|
|
415
|
+
}
|
|
416
|
+
return getParentElement(el);
|
|
417
|
+
};
|
|
418
|
+
// ******** DOM READ ****************
|
|
419
|
+
const updateScrollDetail = (detail, el, timestamp, shouldStart) => {
|
|
420
|
+
const prevX = detail.currentX;
|
|
421
|
+
const prevY = detail.currentY;
|
|
422
|
+
const prevT = detail.currentTime;
|
|
423
|
+
const currentX = el.scrollLeft;
|
|
424
|
+
const currentY = el.scrollTop;
|
|
425
|
+
const timeDelta = timestamp - prevT;
|
|
426
|
+
if (shouldStart) {
|
|
427
|
+
// remember the start positions
|
|
428
|
+
detail.startTime = timestamp;
|
|
429
|
+
detail.startX = currentX;
|
|
430
|
+
detail.startY = currentY;
|
|
431
|
+
detail.velocityX = detail.velocityY = 0;
|
|
432
|
+
}
|
|
433
|
+
detail.currentTime = timestamp;
|
|
434
|
+
detail.currentX = detail.scrollLeft = currentX;
|
|
435
|
+
detail.currentY = detail.scrollTop = currentY;
|
|
436
|
+
detail.deltaX = currentX - detail.startX;
|
|
437
|
+
detail.deltaY = currentY - detail.startY;
|
|
438
|
+
if (timeDelta > 0 && timeDelta < 100) {
|
|
439
|
+
const velocityX = (currentX - prevX) / timeDelta;
|
|
440
|
+
const velocityY = (currentY - prevY) / timeDelta;
|
|
441
|
+
detail.velocityX = velocityX * 0.7 + detail.velocityX * 0.3;
|
|
442
|
+
detail.velocityY = velocityY * 0.7 + detail.velocityY * 0.3;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
Content.style = contentCss;
|
|
446
|
+
|
|
447
|
+
const TRANSITION = 'all 0.2s ease-in-out';
|
|
448
|
+
const cloneElement = (tagName) => {
|
|
449
|
+
const getCachedEl = document.querySelector(`${tagName}.ion-cloned-element`);
|
|
450
|
+
if (getCachedEl !== null) {
|
|
451
|
+
return getCachedEl;
|
|
452
|
+
}
|
|
453
|
+
const clonedEl = document.createElement(tagName);
|
|
454
|
+
clonedEl.classList.add('ion-cloned-element');
|
|
455
|
+
clonedEl.style.setProperty('display', 'none');
|
|
456
|
+
document.body.appendChild(clonedEl);
|
|
457
|
+
return clonedEl;
|
|
458
|
+
};
|
|
459
|
+
const createHeaderIndex = (headerEl) => {
|
|
460
|
+
if (!headerEl) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const toolbars = headerEl.querySelectorAll('ion-toolbar');
|
|
464
|
+
return {
|
|
465
|
+
el: headerEl,
|
|
466
|
+
toolbars: Array.from(toolbars).map((toolbar) => {
|
|
467
|
+
const ionTitleEl = toolbar.querySelector('ion-title');
|
|
468
|
+
return {
|
|
469
|
+
el: toolbar,
|
|
470
|
+
background: toolbar.shadowRoot.querySelector('.toolbar-background'),
|
|
471
|
+
ionTitleEl,
|
|
472
|
+
innerTitleEl: (ionTitleEl) ? ionTitleEl.shadowRoot.querySelector('.toolbar-title') : null,
|
|
473
|
+
ionButtonsEl: Array.from(toolbar.querySelectorAll('ion-buttons')) || []
|
|
474
|
+
};
|
|
475
|
+
}) || []
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
const handleContentScroll = (scrollEl, scrollHeaderIndex, contentEl) => {
|
|
479
|
+
index.readTask(() => {
|
|
480
|
+
const scrollTop = scrollEl.scrollTop;
|
|
481
|
+
const scale = helpers.clamp(1, 1 + (-scrollTop / 500), 1.1);
|
|
482
|
+
// Native refresher should not cause titles to scale
|
|
483
|
+
const nativeRefresher = contentEl.querySelector('ion-refresher.refresher-native');
|
|
484
|
+
if (nativeRefresher === null) {
|
|
485
|
+
index.writeTask(() => {
|
|
486
|
+
scaleLargeTitles(scrollHeaderIndex.toolbars, scale);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
const setToolbarBackgroundOpacity = (toolbar, opacity) => {
|
|
492
|
+
if (opacity === undefined) {
|
|
493
|
+
toolbar.background.style.removeProperty('--opacity');
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
toolbar.background.style.setProperty('--opacity', opacity.toString());
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
const handleToolbarBorderIntersection = (ev, mainHeaderIndex) => {
|
|
500
|
+
if (!ev[0].isIntersecting) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* There is a bug in Safari where overflow scrolling on a non-body element
|
|
505
|
+
* does not always reset the scrollTop position to 0 when letting go. It will
|
|
506
|
+
* set to 1 once the rubber band effect has ended. This causes the background to
|
|
507
|
+
* appear slightly on certain app setups.
|
|
508
|
+
*/
|
|
509
|
+
const scale = (ev[0].intersectionRatio > 0.9) ? 0 : ((1 - ev[0].intersectionRatio) * 100) / 75;
|
|
510
|
+
mainHeaderIndex.toolbars.forEach(toolbar => {
|
|
511
|
+
setToolbarBackgroundOpacity(toolbar, (scale === 1) ? undefined : scale);
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
515
|
+
* If toolbars are intersecting, hide the scrollable toolbar content
|
|
516
|
+
* and show the primary toolbar content. If the toolbars are not intersecting,
|
|
517
|
+
* hide the primary toolbar content and show the scrollable toolbar content
|
|
518
|
+
*/
|
|
519
|
+
const handleToolbarIntersection = (ev, mainHeaderIndex, scrollHeaderIndex) => {
|
|
520
|
+
index.writeTask(() => {
|
|
521
|
+
handleToolbarBorderIntersection(ev, mainHeaderIndex);
|
|
522
|
+
const event = ev[0];
|
|
523
|
+
const intersection = event.intersectionRect;
|
|
524
|
+
const intersectionArea = intersection.width * intersection.height;
|
|
525
|
+
const rootArea = event.rootBounds.width * event.rootBounds.height;
|
|
526
|
+
const isPageHidden = intersectionArea === 0 && rootArea === 0;
|
|
527
|
+
const leftDiff = Math.abs(intersection.left - event.boundingClientRect.left);
|
|
528
|
+
const rightDiff = Math.abs(intersection.right - event.boundingClientRect.right);
|
|
529
|
+
const isPageTransitioning = intersectionArea > 0 && (leftDiff >= 5 || rightDiff >= 5);
|
|
530
|
+
if (isPageHidden || isPageTransitioning) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
if (event.isIntersecting) {
|
|
534
|
+
setHeaderActive(mainHeaderIndex, false);
|
|
535
|
+
setHeaderActive(scrollHeaderIndex);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
/**
|
|
539
|
+
* There is a bug with IntersectionObserver on Safari
|
|
540
|
+
* where `event.isIntersecting === false` when cancelling
|
|
541
|
+
* a swipe to go back gesture. Checking the intersection
|
|
542
|
+
* x, y, width, and height provides a workaround. This bug
|
|
543
|
+
* does not happen when using Safari + Web Animations,
|
|
544
|
+
* only Safari + CSS Animations.
|
|
545
|
+
*/
|
|
546
|
+
const hasValidIntersection = (intersection.x === 0 && intersection.y === 0) || (intersection.width !== 0 && intersection.height !== 0);
|
|
547
|
+
if (hasValidIntersection) {
|
|
548
|
+
setHeaderActive(mainHeaderIndex);
|
|
549
|
+
setHeaderActive(scrollHeaderIndex, false);
|
|
550
|
+
setToolbarBackgroundOpacity(mainHeaderIndex.toolbars[0]);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
const setHeaderActive = (headerIndex, active = true) => {
|
|
556
|
+
if (active) {
|
|
557
|
+
headerIndex.el.classList.remove('header-collapse-condense-inactive');
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
headerIndex.el.classList.add('header-collapse-condense-inactive');
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
const scaleLargeTitles = (toolbars = [], scale = 1, transition = false) => {
|
|
564
|
+
toolbars.forEach(toolbar => {
|
|
565
|
+
const ionTitle = toolbar.ionTitleEl;
|
|
566
|
+
const titleDiv = toolbar.innerTitleEl;
|
|
567
|
+
if (!ionTitle || ionTitle.size !== 'large') {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
titleDiv.style.transformOrigin = 'left center';
|
|
571
|
+
titleDiv.style.transition = (transition) ? TRANSITION : '';
|
|
572
|
+
titleDiv.style.transform = `scale3d(${scale}, ${scale}, 1)`;
|
|
573
|
+
});
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
const headerIosCss = "ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports (backdrop-filter: blur(0)){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:7px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}";
|
|
577
|
+
|
|
578
|
+
const headerMdCss = "ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md::after{left:0;bottom:-5px;background-position:left 0 top -2px;position:absolute;width:100%;height:5px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAHBAMAAADzDtBxAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMUCS0gBIh/TXEAAAAaSURBVAjXYxCEAgY4UIICBmMogMsgFLtAAQCNSwXZKOdPxgAAAABJRU5ErkJggg==);background-repeat:repeat-x;content:\"\"}[dir=rtl] .header-md::after,:host-context([dir=rtl]) .header-md::after{left:unset;right:unset;right:0}[dir=rtl] .header-md::after,:host-context([dir=rtl]) .header-md::after{background-position:right 0 top -2px}.header-collapse-condense{display:none}.header-md.ion-no-border::after{display:none}";
|
|
579
|
+
|
|
580
|
+
const Header = class {
|
|
581
|
+
constructor(hostRef) {
|
|
582
|
+
index.registerInstance(this, hostRef);
|
|
583
|
+
this.collapsibleHeaderInitialized = false;
|
|
584
|
+
/**
|
|
585
|
+
* If `true`, the header will be translucent.
|
|
586
|
+
* Only applies when the mode is `"ios"` and the device supports
|
|
587
|
+
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
|
|
588
|
+
*
|
|
589
|
+
* Note: In order to scroll content behind the header, the `fullscreen`
|
|
590
|
+
* attribute needs to be set on the content.
|
|
591
|
+
*/
|
|
592
|
+
this.translucent = false;
|
|
593
|
+
}
|
|
594
|
+
async componentDidLoad() {
|
|
595
|
+
await this.checkCollapsibleHeader();
|
|
596
|
+
}
|
|
597
|
+
async componentDidUpdate() {
|
|
598
|
+
await this.checkCollapsibleHeader();
|
|
599
|
+
}
|
|
600
|
+
componentDidUnload() {
|
|
601
|
+
this.destroyCollapsibleHeader();
|
|
602
|
+
}
|
|
603
|
+
async checkCollapsibleHeader() {
|
|
604
|
+
// Determine if the header can collapse
|
|
605
|
+
const hasCollapse = this.collapse === 'condense';
|
|
606
|
+
const canCollapse = (hasCollapse && ionicGlobal.getIonMode(this) === 'ios') ? hasCollapse : false;
|
|
607
|
+
if (!canCollapse && this.collapsibleHeaderInitialized) {
|
|
608
|
+
this.destroyCollapsibleHeader();
|
|
609
|
+
}
|
|
610
|
+
else if (canCollapse && !this.collapsibleHeaderInitialized) {
|
|
611
|
+
const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
|
|
612
|
+
const contentEl = (pageEl) ? pageEl.querySelector('ion-content') : null;
|
|
613
|
+
await this.setupCollapsibleHeader(contentEl, pageEl);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
destroyCollapsibleHeader() {
|
|
617
|
+
if (this.intersectionObserver) {
|
|
618
|
+
this.intersectionObserver.disconnect();
|
|
619
|
+
this.intersectionObserver = undefined;
|
|
620
|
+
}
|
|
621
|
+
if (this.scrollEl && this.contentScrollCallback) {
|
|
622
|
+
this.scrollEl.removeEventListener('scroll', this.contentScrollCallback);
|
|
623
|
+
this.contentScrollCallback = undefined;
|
|
624
|
+
}
|
|
625
|
+
if (this.collapsibleMainHeader) {
|
|
626
|
+
this.collapsibleMainHeader.classList.remove('header-collapse-main');
|
|
627
|
+
this.collapsibleMainHeader = undefined;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
async setupCollapsibleHeader(contentEl, pageEl) {
|
|
631
|
+
if (!contentEl || !pageEl) {
|
|
632
|
+
console.error('ion-header requires a content to collapse, make sure there is an ion-content.');
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
this.scrollEl = await contentEl.getScrollElement();
|
|
636
|
+
const headers = pageEl.querySelectorAll('ion-header');
|
|
637
|
+
this.collapsibleMainHeader = Array.from(headers).find((header) => header.collapse !== 'condense');
|
|
638
|
+
if (!this.collapsibleMainHeader) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
const mainHeaderIndex = createHeaderIndex(this.collapsibleMainHeader);
|
|
642
|
+
const scrollHeaderIndex = createHeaderIndex(this.el);
|
|
643
|
+
if (!mainHeaderIndex || !scrollHeaderIndex) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
setHeaderActive(mainHeaderIndex, false);
|
|
647
|
+
mainHeaderIndex.toolbars.forEach(toolbar => {
|
|
648
|
+
setToolbarBackgroundOpacity(toolbar, 0);
|
|
649
|
+
});
|
|
650
|
+
/**
|
|
651
|
+
* Handle interaction between toolbar collapse and
|
|
652
|
+
* showing/hiding content in the primary ion-header
|
|
653
|
+
* as well as progressively showing/hiding the main header
|
|
654
|
+
* border as the top-most toolbar collapses or expands.
|
|
655
|
+
*/
|
|
656
|
+
const toolbarIntersection = (ev) => { handleToolbarIntersection(ev, mainHeaderIndex, scrollHeaderIndex); };
|
|
657
|
+
this.intersectionObserver = new IntersectionObserver(toolbarIntersection, { root: contentEl, threshold: [0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1] });
|
|
658
|
+
this.intersectionObserver.observe(scrollHeaderIndex.toolbars[scrollHeaderIndex.toolbars.length - 1].el);
|
|
659
|
+
/**
|
|
660
|
+
* Handle scaling of large iOS titles and
|
|
661
|
+
* showing/hiding border on last toolbar
|
|
662
|
+
* in primary header
|
|
663
|
+
*/
|
|
664
|
+
this.contentScrollCallback = () => { handleContentScroll(this.scrollEl, scrollHeaderIndex, contentEl); };
|
|
665
|
+
this.scrollEl.addEventListener('scroll', this.contentScrollCallback);
|
|
666
|
+
index.writeTask(() => {
|
|
667
|
+
const title = cloneElement('ion-title');
|
|
668
|
+
title.size = 'large';
|
|
669
|
+
cloneElement('ion-back-button');
|
|
670
|
+
if (this.collapsibleMainHeader !== undefined) {
|
|
671
|
+
this.collapsibleMainHeader.classList.add('header-collapse-main');
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
this.collapsibleHeaderInitialized = true;
|
|
675
|
+
}
|
|
676
|
+
render() {
|
|
677
|
+
const { translucent } = this;
|
|
678
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
679
|
+
const collapse = this.collapse || 'none';
|
|
680
|
+
return (index.h(index.Host, { role: "banner", class: {
|
|
681
|
+
[mode]: true,
|
|
682
|
+
// Used internally for styling
|
|
683
|
+
[`header-${mode}`]: true,
|
|
684
|
+
[`header-translucent`]: this.translucent,
|
|
685
|
+
[`header-collapse-${collapse}`]: true,
|
|
686
|
+
[`header-translucent-${mode}`]: this.translucent,
|
|
687
|
+
} }, mode === 'ios' && translucent &&
|
|
688
|
+
index.h("div", { class: "header-background" }), index.h("slot", null)));
|
|
689
|
+
}
|
|
690
|
+
get el() { return index.getElement(this); }
|
|
691
|
+
};
|
|
692
|
+
Header.style = {
|
|
693
|
+
ios: headerIosCss,
|
|
694
|
+
md: headerMdCss
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
let CACHED_MAP;
|
|
698
|
+
const getIconMap = () => {
|
|
699
|
+
if (typeof window === 'undefined') {
|
|
700
|
+
return new Map();
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
if (!CACHED_MAP) {
|
|
704
|
+
const win = window;
|
|
705
|
+
win.Ionicons = win.Ionicons || {};
|
|
706
|
+
CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
|
|
707
|
+
}
|
|
708
|
+
return CACHED_MAP;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
const getUrl = (i) => {
|
|
712
|
+
let url = getSrc(i.src);
|
|
713
|
+
if (url) {
|
|
714
|
+
return url;
|
|
715
|
+
}
|
|
716
|
+
url = getName(i.name, i.icon, i.mode, i.ios, i.md);
|
|
717
|
+
if (url) {
|
|
718
|
+
return getNamedUrl(url);
|
|
719
|
+
}
|
|
720
|
+
if (i.icon) {
|
|
721
|
+
url = getSrc(i.icon);
|
|
722
|
+
if (url) {
|
|
723
|
+
return url;
|
|
724
|
+
}
|
|
725
|
+
url = getSrc(i.icon[i.mode]);
|
|
726
|
+
if (url) {
|
|
727
|
+
return url;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return null;
|
|
731
|
+
};
|
|
732
|
+
const getNamedUrl = (iconName) => {
|
|
733
|
+
const url = getIconMap().get(iconName);
|
|
734
|
+
if (url) {
|
|
735
|
+
return url;
|
|
736
|
+
}
|
|
737
|
+
return index.getAssetPath(`svg/${iconName}.svg`);
|
|
738
|
+
};
|
|
739
|
+
const getName = (iconName, icon, mode, ios, md) => {
|
|
740
|
+
// default to "md" if somehow the mode wasn't set
|
|
741
|
+
mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
|
|
742
|
+
// if an icon was passed in using the ios or md attributes
|
|
743
|
+
// set the iconName to whatever was passed in
|
|
744
|
+
if (ios && mode === 'ios') {
|
|
745
|
+
iconName = toLower(ios);
|
|
746
|
+
}
|
|
747
|
+
else if (md && mode === 'md') {
|
|
748
|
+
iconName = toLower(md);
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
if (!iconName && icon && !isSrc(icon)) {
|
|
752
|
+
iconName = icon;
|
|
753
|
+
}
|
|
754
|
+
if (isStr(iconName)) {
|
|
755
|
+
iconName = toLower(iconName);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
if (!isStr(iconName) || iconName.trim() === '') {
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
761
|
+
// only allow alpha characters and dash
|
|
762
|
+
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
763
|
+
if (invalidChars !== '') {
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
return iconName;
|
|
767
|
+
};
|
|
768
|
+
const getSrc = (src) => {
|
|
769
|
+
if (isStr(src)) {
|
|
770
|
+
src = src.trim();
|
|
771
|
+
if (isSrc(src)) {
|
|
772
|
+
return src;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return null;
|
|
776
|
+
};
|
|
777
|
+
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
|
778
|
+
const isStr = (val) => typeof val === 'string';
|
|
779
|
+
const toLower = (val) => val.toLowerCase();
|
|
780
|
+
|
|
781
|
+
const validateContent = (svgContent) => {
|
|
782
|
+
if (svgContent && typeof document !== 'undefined') {
|
|
783
|
+
const div = document.createElement('div');
|
|
784
|
+
div.innerHTML = svgContent;
|
|
785
|
+
// setup this way to ensure it works on our buddy IE
|
|
786
|
+
for (let i = div.childNodes.length - 1; i >= 0; i--) {
|
|
787
|
+
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
|
|
788
|
+
div.removeChild(div.childNodes[i]);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
// must only have 1 root element
|
|
792
|
+
const svgElm = div.firstElementChild;
|
|
793
|
+
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
|
|
794
|
+
const svgClass = svgElm.getAttribute('class') || '';
|
|
795
|
+
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
|
|
796
|
+
// root element must be an svg
|
|
797
|
+
// lets double check we've got valid elements
|
|
798
|
+
// do not allow scripts
|
|
799
|
+
if (isValid(svgElm)) {
|
|
800
|
+
return div.innerHTML;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return '';
|
|
805
|
+
};
|
|
806
|
+
const isValid = (elm) => {
|
|
807
|
+
if (elm.nodeType === 1) {
|
|
808
|
+
if (elm.nodeName.toLowerCase() === 'script') {
|
|
809
|
+
return false;
|
|
810
|
+
}
|
|
811
|
+
for (let i = 0; i < elm.attributes.length; i++) {
|
|
812
|
+
const val = elm.attributes[i].value;
|
|
813
|
+
if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {
|
|
814
|
+
return false;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
for (let i = 0; i < elm.childNodes.length; i++) {
|
|
818
|
+
if (!isValid(elm.childNodes[i])) {
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return true;
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
const ioniconContent = new Map();
|
|
827
|
+
const requests = new Map();
|
|
828
|
+
const getSvgContent = (url) => {
|
|
829
|
+
// see if we already have a request for this url
|
|
830
|
+
let req = requests.get(url);
|
|
831
|
+
if (!req) {
|
|
832
|
+
if (typeof fetch !== 'undefined') {
|
|
833
|
+
// we don't already have a request
|
|
834
|
+
req = fetch(url).then(rsp => {
|
|
835
|
+
if (rsp.ok) {
|
|
836
|
+
return rsp.text().then(svgContent => {
|
|
837
|
+
ioniconContent.set(url, validateContent(svgContent));
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
ioniconContent.set(url, '');
|
|
841
|
+
});
|
|
842
|
+
// cache for the same requests
|
|
843
|
+
requests.set(url, req);
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
// set to empty for ssr scenarios and resolve promise
|
|
847
|
+
ioniconContent.set(url, '');
|
|
848
|
+
return Promise.resolve();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return req;
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
const iconCss = ":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";
|
|
855
|
+
|
|
856
|
+
const Icon = class {
|
|
857
|
+
constructor(hostRef) {
|
|
858
|
+
index.registerInstance(this, hostRef);
|
|
859
|
+
this.isVisible = false;
|
|
860
|
+
/**
|
|
861
|
+
* The mode determines which platform styles to use.
|
|
862
|
+
*/
|
|
863
|
+
this.mode = getIonMode();
|
|
864
|
+
/**
|
|
865
|
+
* If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
|
|
866
|
+
* Default, `false`.
|
|
867
|
+
*/
|
|
868
|
+
this.lazy = false;
|
|
869
|
+
}
|
|
870
|
+
connectedCallback() {
|
|
871
|
+
// purposely do not return the promise here because loading
|
|
872
|
+
// the svg file should not hold up loading the app
|
|
873
|
+
// only load the svg if it's visible
|
|
874
|
+
this.waitUntilVisible(this.el, '50px', () => {
|
|
875
|
+
this.isVisible = true;
|
|
876
|
+
this.loadIcon();
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
disconnectedCallback() {
|
|
880
|
+
if (this.io) {
|
|
881
|
+
this.io.disconnect();
|
|
882
|
+
this.io = undefined;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
waitUntilVisible(el, rootMargin, cb) {
|
|
886
|
+
if (this.lazy && typeof window !== 'undefined' && window.IntersectionObserver) {
|
|
887
|
+
const io = this.io = new window.IntersectionObserver((data) => {
|
|
888
|
+
if (data[0].isIntersecting) {
|
|
889
|
+
io.disconnect();
|
|
890
|
+
this.io = undefined;
|
|
891
|
+
cb();
|
|
892
|
+
}
|
|
893
|
+
}, { rootMargin });
|
|
894
|
+
io.observe(el);
|
|
895
|
+
}
|
|
896
|
+
else {
|
|
897
|
+
// browser doesn't support IntersectionObserver
|
|
898
|
+
// so just fallback to always show it
|
|
899
|
+
cb();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
loadIcon() {
|
|
903
|
+
if (this.isVisible) {
|
|
904
|
+
const url = getUrl(this);
|
|
905
|
+
if (url) {
|
|
906
|
+
if (ioniconContent.has(url)) {
|
|
907
|
+
// sync if it's already loaded
|
|
908
|
+
this.svgContent = ioniconContent.get(url);
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
// async if it hasn't been loaded
|
|
912
|
+
getSvgContent(url).then(() => this.svgContent = ioniconContent.get(url));
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
if (!this.ariaLabel) {
|
|
917
|
+
const label = getName(this.name, this.icon, this.mode, this.ios, this.md);
|
|
918
|
+
// user did not provide a label
|
|
919
|
+
// come up with the label based on the icon name
|
|
920
|
+
if (label) {
|
|
921
|
+
this.ariaLabel = label.replace(/\-/g, ' ');
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
render() {
|
|
926
|
+
const mode = this.mode || 'md';
|
|
927
|
+
const flipRtl = this.flipRtl || (this.ariaLabel && (this.ariaLabel.indexOf('arrow') > -1 || this.ariaLabel.indexOf('chevron') > -1) && this.flipRtl !== false);
|
|
928
|
+
return (index.h(index.Host, { role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': !!flipRtl && this.el.ownerDocument.dir === 'rtl' }) }, ((this.svgContent)
|
|
929
|
+
? index.h("div", { class: "icon-inner", innerHTML: this.svgContent })
|
|
930
|
+
: index.h("div", { class: "icon-inner" }))));
|
|
931
|
+
}
|
|
932
|
+
static get assetsDirs() { return ["svg"]; }
|
|
933
|
+
get el() { return index.getElement(this); }
|
|
934
|
+
static get watchers() { return {
|
|
935
|
+
"name": ["loadIcon"],
|
|
936
|
+
"src": ["loadIcon"],
|
|
937
|
+
"icon": ["loadIcon"]
|
|
938
|
+
}; }
|
|
939
|
+
};
|
|
940
|
+
const getIonMode = () => (typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
|
|
941
|
+
const createColorClasses = (color) => {
|
|
942
|
+
return (color) ? {
|
|
943
|
+
'ion-color': true,
|
|
944
|
+
[`ion-color-${color}`]: true
|
|
945
|
+
} : null;
|
|
946
|
+
};
|
|
947
|
+
Icon.style = iconCss;
|
|
948
|
+
|
|
949
|
+
const itemIosCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;box-sizing:border-box;overflow:hidden}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-native,:host(.ion-color) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label){flex:1}:host([vertical-align-top]),:host(.item-input){align-items:flex-start}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden;box-sizing:border-box}:host(.item-label-stacked) .item-native,:host(.item-label-floating) .item-native{align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;bottom:0;position:absolute;background:var(--highlight-background);z-index:1}.item-highlight{height:var(--full-highlight-height)}.item-inner-highlight{height:var(--inset-highlight-height)}:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:44px;--transition:background-color 200ms linear, opacity 200ms linear;--padding-start:20px;--inner-padding-end:10px;--inner-border-width:0px 0px 0.55px 0px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:#000;--background-focused:#000;--background-hover:currentColor;--background-activated-opacity:.12;--background-focused-opacity:.15;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));--color:var(--ion-item-color, var(--ion-text-color, #000));--highlight-height:0;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:17px}:host(.ion-activated){--transition:none}:host(.ion-color.ion-focused) .item-native::after{background:#000;opacity:0.15}:host(.ion-color.ion-activated) .item-native::after{background:#000;opacity:0.12}:host(.item-interactive){--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-full){--border-width:0px 0px 0.55px 0px;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0px 0px 0.55px 0px;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0px;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0px;--show-inset-highlight:0}::slotted([slot=start]){margin-left:0;margin-right:20px;margin-top:2px;margin-bottom:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:20px;margin-inline-end:20px}}::slotted([slot=end]){margin-left:10px;margin-right:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}::slotted(.button-small){--padding-top:0px;--padding-bottom:0px;--padding-start:.5em;--padding-end:.5em;height:24px;font-size:13px}::slotted(ion-avatar){width:36px;height:36px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:0px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0px;margin-inline-start:0px}}::slotted(ion-label){margin-left:0;margin-right:8px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-label){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px}}:host(.item-label-floating),:host(.item-label-stacked){--min-height:68px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0px}";
|
|
950
|
+
|
|
951
|
+
const itemMdCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;box-sizing:border-box;overflow:hidden}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-native,:host(.ion-color) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label){flex:1}:host([vertical-align-top]),:host(.item-input){align-items:flex-start}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden;box-sizing:border-box}:host(.item-label-stacked) .item-native,:host(.item-label-floating) .item-native{align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;bottom:0;position:absolute;background:var(--highlight-background);z-index:1}.item-highlight{height:var(--full-highlight-height)}.item-inner-highlight{height:var(--inset-highlight-height)}:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:48px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--color:var(--ion-item-color, var(--ion-text-color, #000));--transition:opacity 15ms linear, background-color 15ms linear;--padding-start:16px;--color:var(--ion-item-color, var(--ion-text-color, #000));--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--inner-padding-end:16px;--inner-border-width:0 0 1px 0;--highlight-height:2px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:16px;font-weight:normal;text-transform:none}:host(.ion-color.ion-activated) .item-native::after{background:transparent}:host(.item-interactive){--border-width:0 0 1px 0;--inner-border-width:0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-full){--border-width:0 0 1px 0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0;--show-inset-highlight:0}:host(.item-multi-line) ::slotted([slot=start]),:host(.item-multi-line) ::slotted([slot=end]){margin-top:16px;margin-bottom:16px;align-self:flex-start}::slotted([slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:11px;margin-bottom:10px}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}::slotted(.button-small){--padding-top:0;--padding-bottom:0;--padding-start:.6em;--padding-end:.6em;height:25px;font-size:12px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0}:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating){color:var(--ion-color-primary, #3880ff)}";
|
|
952
|
+
|
|
953
|
+
const Item = class {
|
|
954
|
+
constructor(hostRef) {
|
|
955
|
+
index.registerInstance(this, hostRef);
|
|
956
|
+
this.itemStyles = new Map();
|
|
957
|
+
this.multipleInputs = false;
|
|
958
|
+
/**
|
|
959
|
+
* If `true`, a button tag will be rendered and the item will be tappable.
|
|
960
|
+
*/
|
|
961
|
+
this.button = false;
|
|
962
|
+
/**
|
|
963
|
+
* The icon to use when `detail` is set to `true`.
|
|
964
|
+
*/
|
|
965
|
+
this.detailIcon = 'chevron-forward';
|
|
966
|
+
/**
|
|
967
|
+
* If `true`, the user cannot interact with the item.
|
|
968
|
+
*/
|
|
969
|
+
this.disabled = false;
|
|
970
|
+
/**
|
|
971
|
+
* When using a router, it specifies the transition direction when navigating to
|
|
972
|
+
* another page using `href`.
|
|
973
|
+
*/
|
|
974
|
+
this.routerDirection = 'forward';
|
|
975
|
+
/**
|
|
976
|
+
* The type of the button. Only used when an `onclick` or `button` property is present.
|
|
977
|
+
*/
|
|
978
|
+
this.type = 'button';
|
|
979
|
+
}
|
|
980
|
+
itemStyle(ev) {
|
|
981
|
+
ev.stopPropagation();
|
|
982
|
+
const tagName = ev.target.tagName;
|
|
983
|
+
const updatedStyles = ev.detail;
|
|
984
|
+
const newStyles = {};
|
|
985
|
+
const childStyles = this.itemStyles.get(tagName) || {};
|
|
986
|
+
let hasStyleChange = false;
|
|
987
|
+
Object.keys(updatedStyles).forEach(key => {
|
|
988
|
+
if (updatedStyles[key]) {
|
|
989
|
+
const itemKey = `item-${key}`;
|
|
990
|
+
if (!childStyles[itemKey]) {
|
|
991
|
+
hasStyleChange = true;
|
|
992
|
+
}
|
|
993
|
+
newStyles[itemKey] = true;
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
if (!hasStyleChange && Object.keys(newStyles).length !== Object.keys(childStyles).length) {
|
|
997
|
+
hasStyleChange = true;
|
|
998
|
+
}
|
|
999
|
+
if (hasStyleChange) {
|
|
1000
|
+
this.itemStyles.set(tagName, newStyles);
|
|
1001
|
+
index.forceUpdate(this);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
componentDidLoad() {
|
|
1005
|
+
// The following elements have a clickable cover that is relative to the entire item
|
|
1006
|
+
const covers = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
|
|
1007
|
+
// The following elements can accept focus alongside the previous elements
|
|
1008
|
+
// therefore if these elements are also a child of item, we don't want the
|
|
1009
|
+
// input cover on top of those interfering with their clicks
|
|
1010
|
+
const inputs = this.el.querySelectorAll('ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle');
|
|
1011
|
+
// The following elements should also stay clickable when an input with cover is present
|
|
1012
|
+
const clickables = this.el.querySelectorAll('ion-anchor, ion-button, a, button');
|
|
1013
|
+
// Check for multiple inputs to change the position of the input cover to relative
|
|
1014
|
+
// for all of the covered inputs above
|
|
1015
|
+
this.multipleInputs = covers.length + inputs.length > 1
|
|
1016
|
+
|| covers.length + clickables.length > 1
|
|
1017
|
+
|| covers.length > 0 && this.isClickable();
|
|
1018
|
+
}
|
|
1019
|
+
// If the item contains an input including a checkbox, datetime, select, or radio
|
|
1020
|
+
// then the item will have a clickable input cover that covers the item
|
|
1021
|
+
// that should get the hover, focused and activated states UNLESS it has multiple
|
|
1022
|
+
// inputs, then those need to individually get each click
|
|
1023
|
+
hasCover() {
|
|
1024
|
+
const inputs = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
|
|
1025
|
+
return inputs.length === 1 && !this.multipleInputs;
|
|
1026
|
+
}
|
|
1027
|
+
// If the item has an href or button property it will render a native
|
|
1028
|
+
// anchor or button that is clickable
|
|
1029
|
+
isClickable() {
|
|
1030
|
+
return (this.href !== undefined || this.button);
|
|
1031
|
+
}
|
|
1032
|
+
canActivate() {
|
|
1033
|
+
return (this.isClickable() || this.hasCover());
|
|
1034
|
+
}
|
|
1035
|
+
render() {
|
|
1036
|
+
const { detail, detailIcon, download, lines, disabled, href, rel, target, routerDirection } = this;
|
|
1037
|
+
const childStyles = {};
|
|
1038
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1039
|
+
const clickable = this.isClickable();
|
|
1040
|
+
const canActivate = this.canActivate();
|
|
1041
|
+
const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
|
|
1042
|
+
const attrs = (TagType === 'button')
|
|
1043
|
+
? { type: this.type }
|
|
1044
|
+
: {
|
|
1045
|
+
download,
|
|
1046
|
+
href,
|
|
1047
|
+
rel,
|
|
1048
|
+
target
|
|
1049
|
+
};
|
|
1050
|
+
const showDetail = detail !== undefined ? detail : mode === 'ios' && clickable;
|
|
1051
|
+
this.itemStyles.forEach(value => {
|
|
1052
|
+
Object.assign(childStyles, value);
|
|
1053
|
+
});
|
|
1054
|
+
return (index.h(index.Host, { "aria-disabled": disabled ? 'true' : null, class: Object.assign(Object.assign(Object.assign({}, childStyles), theme.createColorClasses(this.color)), { 'item': true, [mode]: true, [`item-lines-${lines}`]: lines !== undefined, 'item-disabled': disabled, 'in-list': theme.hostContext('ion-list', this.el), 'item-multiple-inputs': this.multipleInputs, 'ion-activatable': canActivate, 'ion-focusable': true }) }, index.h(TagType, Object.assign({}, attrs, { class: "item-native", disabled: disabled, onClick: (ev) => theme.openURL(href, ev, routerDirection) }), index.h("slot", { name: "start" }), index.h("div", { class: "item-inner" }, index.h("div", { class: "input-wrapper" }, index.h("slot", null)), index.h("slot", { name: "end" }), showDetail && index.h("ion-icon", { icon: detailIcon, lazy: false, class: "item-detail-icon", part: "detail-icon" }), index.h("div", { class: "item-inner-highlight" })), canActivate && mode === 'md' && index.h("ion-ripple-effect", null)), index.h("div", { class: "item-highlight" })));
|
|
1055
|
+
}
|
|
1056
|
+
get el() { return index.getElement(this); }
|
|
1057
|
+
};
|
|
1058
|
+
Item.style = {
|
|
1059
|
+
ios: itemIosCss,
|
|
1060
|
+
md: itemMdCss
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
const labelIosCss = ".item.sc-ion-label-ios-h,.item .sc-ion-label-ios-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-ios-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{white-space:normal}.item-interactive-disabled.sc-ion-label-ios-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-ios-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-ios-h,.item-input .sc-ion-label-ios-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-ios-h,.item-textarea .sc-ion-label-ios-h{align-self:baseline}.label-fixed.sc-ion-label-ios-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-ios-h,.label-floating.sc-ion-label-ios-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-ios-h{transition:none}.sc-ion-label-ios-s h1,.sc-ion-label-ios-s h2,.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{font-size:14px;line-height:1.5}.label-stacked.sc-ion-label-ios-h{margin-bottom:4px;font-size:14px}.label-floating.sc-ion-label-ios-h{margin-bottom:0;transform:translate3d(0, 27px, 0);transform-origin:left top;transition:transform 150ms ease-in-out}[dir=rtl].sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl] .sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl].label-floating.sc-ion-label-ios-h,[dir=rtl] .label-floating.sc-ion-label-ios-h{transform-origin:right top}.item-has-focus.label-floating.sc-ion-label-ios-h,.item-has-focus .label-floating.sc-ion-label-ios-h,.item-has-placeholder.label-floating.sc-ion-label-ios-h,.item-has-placeholder .label-floating.sc-ion-label-ios-h,.item-has-value.label-floating.sc-ion-label-ios-h,.item-has-value .label-floating.sc-ion-label-ios-h{transform:translate3d(0, 0, 0) scale(0.82)}.sc-ion-label-ios-s h1{margin-left:0;margin-right:0;margin-top:3px;margin-bottom:2px;font-size:22px;font-weight:normal}.sc-ion-label-ios-s h2{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-ios-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}.sc-ion-label-ios-s>p{color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4)}.sc-ion-label-ios-h.ion-color.sc-ion-label-ios-s>p,.ion-color .sc-ion-label-ios-h.sc-ion-label-ios-s>p{color:inherit}.sc-ion-label-ios-s h2:last-child,.sc-ion-label-ios-s h3:last-child,.sc-ion-label-ios-s h4:last-child,.sc-ion-label-ios-s h5:last-child,.sc-ion-label-ios-s h6:last-child,.sc-ion-label-ios-s p:last-child{margin-bottom:0}";
|
|
1064
|
+
|
|
1065
|
+
const labelMdCss = ".item.sc-ion-label-md-h,.item .sc-ion-label-md-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-md-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{white-space:normal}.item-interactive-disabled.sc-ion-label-md-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-md-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-md-h,.item-input .sc-ion-label-md-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-md-h,.item-textarea .sc-ion-label-md-h{align-self:baseline}.label-fixed.sc-ion-label-md-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-md-h{transition:none}.sc-ion-label-md-s h1,.sc-ion-label-md-s h2,.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{line-height:1.5}.label-stacked.sc-ion-label-md-h{transform-origin:left top;transform:translate3d(0, 50%, 0) scale(0.75);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1)}[dir=rtl].sc-ion-label-md-h -no-combinator.label-stacked.sc-ion-label-md-h,[dir=rtl] .sc-ion-label-md-h -no-combinator.label-stacked.sc-ion-label-md-h,[dir=rtl].label-stacked.sc-ion-label-md-h,[dir=rtl] .label-stacked.sc-ion-label-md-h{transform-origin:right top}.label-floating.sc-ion-label-md-h{transform:translate3d(0, 96%, 0);transform-origin:left top;transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1)}[dir=rtl].sc-ion-label-md-h -no-combinator.label-floating.sc-ion-label-md-h,[dir=rtl] .sc-ion-label-md-h -no-combinator.label-floating.sc-ion-label-md-h,[dir=rtl].label-floating.sc-ion-label-md-h,[dir=rtl] .label-floating.sc-ion-label-md-h{transform-origin:right top}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.item-select.label-floating.sc-ion-label-md-h,.item-select .label-floating.sc-ion-label-md-h{transform:translate3d(0, 130%, 0)}.item-has-focus.label-floating.sc-ion-label-md-h,.item-has-focus .label-floating.sc-ion-label-md-h,.item-has-placeholder.label-floating.sc-ion-label-md-h,.item-has-placeholder .label-floating.sc-ion-label-md-h,.item-has-value.label-floating.sc-ion-label-md-h,.item-has-value .label-floating.sc-ion-label-md-h{transform:translate3d(0, 50%, 0) scale(0.75)}.item-has-focus.label-stacked.sc-ion-label-md-h,.item-has-focus .label-stacked.sc-ion-label-md-h,.item-has-focus.label-floating.sc-ion-label-md-h,.item-has-focus .label-floating.sc-ion-label-md-h{color:var(--ion-color-primary, #3880ff)}.sc-ion-label-md-s h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.sc-ion-label-md-s h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-md-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:20px;text-overflow:inherit;overflow:inherit}.sc-ion-label-md-s>p{color:var(--ion-color-step-600, #666666)}.sc-ion-label-md-h.ion-color.sc-ion-label-md-s>p,.ion-color .sc-ion-label-md-h.sc-ion-label-md-s>p{color:inherit}";
|
|
1066
|
+
|
|
1067
|
+
const Label = class {
|
|
1068
|
+
constructor(hostRef) {
|
|
1069
|
+
index.registerInstance(this, hostRef);
|
|
1070
|
+
this.ionStyle = index.createEvent(this, "ionStyle", 7);
|
|
1071
|
+
this.noAnimate = false;
|
|
1072
|
+
}
|
|
1073
|
+
componentWillLoad() {
|
|
1074
|
+
this.noAnimate = (this.position === 'floating');
|
|
1075
|
+
this.emitStyle();
|
|
1076
|
+
}
|
|
1077
|
+
componentDidLoad() {
|
|
1078
|
+
if (this.noAnimate) {
|
|
1079
|
+
setTimeout(() => {
|
|
1080
|
+
this.noAnimate = false;
|
|
1081
|
+
}, 1000);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
positionChanged() {
|
|
1085
|
+
this.emitStyle();
|
|
1086
|
+
}
|
|
1087
|
+
emitStyle() {
|
|
1088
|
+
const position = this.position;
|
|
1089
|
+
this.ionStyle.emit({
|
|
1090
|
+
'label': true,
|
|
1091
|
+
[`label-${position}`]: position !== undefined
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
render() {
|
|
1095
|
+
const position = this.position;
|
|
1096
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1097
|
+
return (index.h(index.Host, { class: Object.assign(Object.assign({}, theme.createColorClasses(this.color)), { [mode]: true, [`label-${position}`]: position !== undefined, [`label-no-animate`]: (this.noAnimate) }) }));
|
|
1098
|
+
}
|
|
1099
|
+
get el() { return index.getElement(this); }
|
|
1100
|
+
static get watchers() { return {
|
|
1101
|
+
"position": ["positionChanged"]
|
|
1102
|
+
}; }
|
|
1103
|
+
};
|
|
1104
|
+
Label.style = {
|
|
1105
|
+
ios: labelIosCss,
|
|
1106
|
+
md: labelMdCss
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
const listIosCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-ios{background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-ios.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.list-ios.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-ios.list-inset ion-item{--border-width:0 0 1px 0;--inner-border-width:0}.list-ios.list-inset ion-item:last-child{--border-width:0;--inner-border-width:0}.list-ios.list-inset+ion-list.list-inset{margin-top:0}.list-ios-lines-none .item{--border-width:0;--inner-border-width:0}.list-ios-lines-full .item,.list-ios .item-lines-full{--border-width:0 0 0.55px 0}.list-ios-lines-full .item{--inner-border-width:0}.list-ios-lines-inset .item,.list-ios .item-lines-inset{--inner-border-width:0 0 0.55px 0}.list-ios .item-lines-inset{--border-width:0}.list-ios .item-lines-full{--inner-border-width:0}.list-ios .item-lines-none{--border-width:0;--inner-border-width:0}ion-card .list-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
|
|
1110
|
+
|
|
1111
|
+
const listMdCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-md>.input:last-child::after{left:0}[dir=rtl] .list-md>.input:last-child::after,:host-context([dir=rtl]) .list-md>.input:last-child::after{left:unset;right:unset;right:0}.list-md.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.list-md.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-md.list-inset ion-item:first-child{--border-radius:2px 2px 0 0;--border-width:0 0 1px 0}.list-md.list-inset ion-item:last-child{--border-radius:0 0 2px, 2px;--border-width:0}.list-md.list-inset .item-interactive{--padding-start:0;--padding-end:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item{--border-width:0;--inner-border-width:0}.list-md-lines-full .item,.list-md .item-lines-full{--border-width:0 0 1px 0}.list-md-lines-full .item{--inner-border-width:0}.list-md-lines-inset .item,.list-md .item-lines-inset{--inner-border-width:0 0 1px 0}.list-md .item-lines-inset{--border-width:0}.list-md .item-lines-full{--inner-border-width:0}.list-md .item-lines-none{--border-width:0;--inner-border-width:0}ion-card .list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
|
|
1112
|
+
|
|
1113
|
+
const List = class {
|
|
1114
|
+
constructor(hostRef) {
|
|
1115
|
+
index.registerInstance(this, hostRef);
|
|
1116
|
+
/**
|
|
1117
|
+
* If `true`, the list will have margin around it and rounded corners.
|
|
1118
|
+
*/
|
|
1119
|
+
this.inset = false;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* If `ion-item-sliding` are used inside the list, this method closes
|
|
1123
|
+
* any open sliding item.
|
|
1124
|
+
*
|
|
1125
|
+
* Returns `true` if an actual `ion-item-sliding` is closed.
|
|
1126
|
+
*/
|
|
1127
|
+
async closeSlidingItems() {
|
|
1128
|
+
const item = this.el.querySelector('ion-item-sliding');
|
|
1129
|
+
if (item && item.closeOpened) {
|
|
1130
|
+
return item.closeOpened();
|
|
1131
|
+
}
|
|
1132
|
+
return false;
|
|
1133
|
+
}
|
|
1134
|
+
render() {
|
|
1135
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1136
|
+
const { lines, inset } = this;
|
|
1137
|
+
return (index.h(index.Host, { class: {
|
|
1138
|
+
[mode]: true,
|
|
1139
|
+
// Used internally for styling
|
|
1140
|
+
[`list-${mode}`]: true,
|
|
1141
|
+
'list-inset': inset,
|
|
1142
|
+
[`list-lines-${lines}`]: lines !== undefined,
|
|
1143
|
+
[`list-${mode}-lines-${lines}`]: lines !== undefined
|
|
1144
|
+
} }));
|
|
1145
|
+
}
|
|
1146
|
+
get el() { return index.getElement(this); }
|
|
1147
|
+
};
|
|
1148
|
+
List.style = {
|
|
1149
|
+
ios: listIosCss,
|
|
1150
|
+
md: listMdCss
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
const rippleEffectCss = ":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{transform:translate(var(--translate-end)) scale(var(--final-scale, 1));animation:150ms fadeOutAnimation forwards}@keyframes rippleAnimation{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(1)}to{transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes fadeInAnimation{from{animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeOutAnimation{from{animation-timing-function:linear;opacity:0.16}to{opacity:0}}";
|
|
1154
|
+
|
|
1155
|
+
const RippleEffect = class {
|
|
1156
|
+
constructor(hostRef) {
|
|
1157
|
+
index.registerInstance(this, hostRef);
|
|
1158
|
+
/**
|
|
1159
|
+
* Sets the type of ripple-effect:
|
|
1160
|
+
*
|
|
1161
|
+
* - `bounded`: the ripple effect expands from the user's click position
|
|
1162
|
+
* - `unbounded`: the ripple effect expands from the center of the button and overflows the container.
|
|
1163
|
+
*
|
|
1164
|
+
* NOTE: Surfaces for bounded ripples should have the overflow property set to hidden,
|
|
1165
|
+
* while surfaces for unbounded ripples should have it set to visible.
|
|
1166
|
+
*/
|
|
1167
|
+
this.type = 'bounded';
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Adds the ripple effect to the parent element.
|
|
1171
|
+
*
|
|
1172
|
+
* @param x The horizontal coordinate of where the ripple should start.
|
|
1173
|
+
* @param y The vertical coordinate of where the ripple should start.
|
|
1174
|
+
*/
|
|
1175
|
+
async addRipple(x, y) {
|
|
1176
|
+
return new Promise(resolve => {
|
|
1177
|
+
index.readTask(() => {
|
|
1178
|
+
const rect = this.el.getBoundingClientRect();
|
|
1179
|
+
const width = rect.width;
|
|
1180
|
+
const height = rect.height;
|
|
1181
|
+
const hypotenuse = Math.sqrt(width * width + height * height);
|
|
1182
|
+
const maxDim = Math.max(height, width);
|
|
1183
|
+
const maxRadius = this.unbounded ? maxDim : hypotenuse + PADDING;
|
|
1184
|
+
const initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);
|
|
1185
|
+
const finalScale = maxRadius / initialSize;
|
|
1186
|
+
let posX = x - rect.left;
|
|
1187
|
+
let posY = y - rect.top;
|
|
1188
|
+
if (this.unbounded) {
|
|
1189
|
+
posX = width * 0.5;
|
|
1190
|
+
posY = height * 0.5;
|
|
1191
|
+
}
|
|
1192
|
+
const styleX = posX - initialSize * 0.5;
|
|
1193
|
+
const styleY = posY - initialSize * 0.5;
|
|
1194
|
+
const moveX = width * 0.5 - posX;
|
|
1195
|
+
const moveY = height * 0.5 - posY;
|
|
1196
|
+
index.writeTask(() => {
|
|
1197
|
+
const div = document.createElement('div');
|
|
1198
|
+
div.classList.add('ripple-effect');
|
|
1199
|
+
const style = div.style;
|
|
1200
|
+
style.top = styleY + 'px';
|
|
1201
|
+
style.left = styleX + 'px';
|
|
1202
|
+
style.width = style.height = initialSize + 'px';
|
|
1203
|
+
style.setProperty('--final-scale', `${finalScale}`);
|
|
1204
|
+
style.setProperty('--translate-end', `${moveX}px, ${moveY}px`);
|
|
1205
|
+
const container = this.el.shadowRoot || this.el;
|
|
1206
|
+
container.appendChild(div);
|
|
1207
|
+
setTimeout(() => {
|
|
1208
|
+
resolve(() => {
|
|
1209
|
+
removeRipple(div);
|
|
1210
|
+
});
|
|
1211
|
+
}, 225 + 100);
|
|
1212
|
+
});
|
|
1213
|
+
});
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
get unbounded() {
|
|
1217
|
+
return this.type === 'unbounded';
|
|
1218
|
+
}
|
|
1219
|
+
render() {
|
|
1220
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1221
|
+
return (index.h(index.Host, { role: "presentation", class: {
|
|
1222
|
+
[mode]: true,
|
|
1223
|
+
'unbounded': this.unbounded
|
|
1224
|
+
} }));
|
|
1225
|
+
}
|
|
1226
|
+
get el() { return index.getElement(this); }
|
|
1227
|
+
};
|
|
1228
|
+
const removeRipple = (ripple) => {
|
|
1229
|
+
ripple.classList.add('fade-out');
|
|
1230
|
+
setTimeout(() => {
|
|
1231
|
+
ripple.remove();
|
|
1232
|
+
}, 200);
|
|
1233
|
+
};
|
|
1234
|
+
const PADDING = 10;
|
|
1235
|
+
const INITIAL_ORIGIN_SCALE = 0.5;
|
|
1236
|
+
RippleEffect.style = rippleEffectCss;
|
|
1237
|
+
|
|
1238
|
+
const searchbarIosCss = ".sc-ion-searchbar-ios-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}.ion-color.sc-ion-searchbar-ios-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:inherit}.searchbar-search-icon.sc-ion-searchbar-ios{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-ios{display:block;position:relative;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-ios{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;border:0;outline:none;background:var(--background);font-family:inherit;box-shadow:var(--box-shadow);box-sizing:border-box;appearance:none}.searchbar-input.sc-ion-searchbar-ios::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-ios::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-ios>div.sc-ion-searchbar-ios{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);appearance:none}.searchbar-has-value.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{display:block}.searchbar-disabled.sc-ion-searchbar-ios-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-ios-h{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.07);--border-radius:10px;--box-shadow:none;--cancel-button-color:var(--ion-color-primary, #3880ff);--clear-button-color:var(--ion-color-step-600, #666666);--color:var(--ion-text-color, #000);--icon-color:var(--ion-color-step-600, #666666);padding-left:12px;padding-right:12px;padding-top:12px;padding-bottom:12px;height:60px;contain:strict}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-searchbar-ios-h{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}.searchbar-input-container.sc-ion-searchbar-ios{height:36px}.searchbar-search-icon.sc-ion-searchbar-ios{margin-left:calc(50% - 60px);left:5px;top:0;position:absolute;width:22px;height:100%;contain:strict}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-search-icon.sc-ion-searchbar-ios{margin-left:unset;-webkit-margin-start:calc(50% - 60px);margin-inline-start:calc(50% - 60px)}}[dir=rtl].sc-ion-searchbar-ios .searchbar-search-icon.sc-ion-searchbar-ios,[dir=rtl].sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,[dir=rtl] .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{left:unset;right:unset;right:5px}.searchbar-input.sc-ion-searchbar-ios{padding-left:28px;padding-right:28px;padding-top:0;padding-bottom:0;height:100%;font-size:17px;font-weight:400;contain:strict}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-input.sc-ion-searchbar-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:28px;padding-inline-start:28px;-webkit-padding-end:28px;padding-inline-end:28px}}.searchbar-clear-button.sc-ion-searchbar-ios{right:0;top:0;background-position:center;position:absolute;width:30px;height:100%;border:0;background-color:transparent}[dir=rtl].sc-ion-searchbar-ios .searchbar-clear-button.sc-ion-searchbar-ios,[dir=rtl].sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,[dir=rtl] .sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{left:unset;right:unset;left:0}.searchbar-clear-icon.sc-ion-searchbar-ios{width:18px;height:100%}.searchbar-cancel-button.sc-ion-searchbar-ios{padding-left:8px;padding-right:0;padding-top:0;padding-bottom:0;flex-shrink:0;background-color:transparent;font-size:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-cancel-button.sc-ion-searchbar-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:0;padding-inline-end:0}}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{padding-left:30px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{padding-left:unset;-webkit-padding-start:30px;padding-inline-start:30px}}.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{display:block}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{transition:all 300ms ease}.searchbar-animated.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{opacity:1;pointer-events:auto}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{margin-right:-100%;transform:translate3d(0, 0, 0);transition:all 300ms ease;opacity:0;pointer-events:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{margin-right:unset;-webkit-margin-end:-100%;margin-inline-end:-100%}}.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{transition-duration:0ms}.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{color:var(--ion-color-base)}@media (any-hover: hover){.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios:hover{color:var(--ion-color-tint)}}ion-toolbar.sc-ion-searchbar-ios-h,ion-toolbar .sc-ion-searchbar-ios-h{padding-top:1px;padding-bottom:15px;height:52px}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color),ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color){color:inherit}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios{color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios{background:rgba(var(--ion-color-contrast-rgb), 0.07);color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}";
|
|
1239
|
+
|
|
1240
|
+
const searchbarMdCss = ".sc-ion-searchbar-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}.ion-color.sc-ion-searchbar-md-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{color:inherit}.searchbar-search-icon.sc-ion-searchbar-md{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-md{display:block;position:relative;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-md{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;border:0;outline:none;background:var(--background);font-family:inherit;box-shadow:var(--box-shadow);box-sizing:border-box;appearance:none}.searchbar-input.sc-ion-searchbar-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-md::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-md>div.sc-ion-searchbar-md{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);appearance:none}.searchbar-has-value.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{display:block}.searchbar-disabled.sc-ion-searchbar-md-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-md-h{--background:var(--ion-background-color, #fff);--border-radius:2px;--box-shadow:0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--cancel-button-color:var(--ion-color-step-900, #1a1a1a);--clear-button-color:initial;--color:var(--ion-color-step-850, #262626);--icon-color:var(--ion-color-step-600, #666666);padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;background:inherit}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.sc-ion-searchbar-md-h{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}.searchbar-search-icon.sc-ion-searchbar-md{left:16px;top:11px;width:21px;height:21px}[dir=rtl].sc-ion-searchbar-md .searchbar-search-icon.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{left:unset;right:unset;right:16px}.searchbar-cancel-button.sc-ion-searchbar-md{left:5px;top:0;background-color:transparent;font-size:1.6em}[dir=rtl].sc-ion-searchbar-md .searchbar-cancel-button.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{left:unset;right:unset;right:5px}.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-cancel-button.sc-ion-searchbar-md{position:absolute}.searchbar-search-icon.ion-activated.sc-ion-searchbar-md,.searchbar-cancel-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-input.sc-ion-searchbar-md{padding-left:55px;padding-right:55px;padding-top:6px;padding-bottom:6px;background-position:left 8px center;height:auto;font-size:16px;font-weight:400;line-height:30px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.searchbar-input.sc-ion-searchbar-md{padding-left:unset;padding-right:unset;-webkit-padding-start:55px;padding-inline-start:55px;-webkit-padding-end:55px;padding-inline-end:55px}}[dir=rtl].sc-ion-searchbar-md .searchbar-input.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background-position:right 8px center}.searchbar-clear-button.sc-ion-searchbar-md{right:13px;top:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;position:absolute;height:100%;border:0;background-color:transparent}[dir=rtl].sc-ion-searchbar-md .searchbar-clear-button.sc-ion-searchbar-md,[dir=rtl].sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{left:unset;right:unset;left:13px}.searchbar-clear-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-clear-icon.sc-ion-searchbar-md{width:22px;height:100%}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md{display:none}ion-toolbar.sc-ion-searchbar-md-h,ion-toolbar .sc-ion-searchbar-md-h{padding-left:7px;padding-right:7px;padding-top:3px;padding-bottom:3px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){ion-toolbar.sc-ion-searchbar-md-h,ion-toolbar .sc-ion-searchbar-md-h{padding-left:unset;padding-right:unset;-webkit-padding-start:7px;padding-inline-start:7px;-webkit-padding-end:7px;padding-inline-end:7px}}";
|
|
1241
|
+
|
|
1242
|
+
const Searchbar = class {
|
|
1243
|
+
constructor(hostRef) {
|
|
1244
|
+
index.registerInstance(this, hostRef);
|
|
1245
|
+
this.ionInput = index.createEvent(this, "ionInput", 7);
|
|
1246
|
+
this.ionChange = index.createEvent(this, "ionChange", 7);
|
|
1247
|
+
this.ionCancel = index.createEvent(this, "ionCancel", 7);
|
|
1248
|
+
this.ionClear = index.createEvent(this, "ionClear", 7);
|
|
1249
|
+
this.ionBlur = index.createEvent(this, "ionBlur", 7);
|
|
1250
|
+
this.ionFocus = index.createEvent(this, "ionFocus", 7);
|
|
1251
|
+
this.ionStyle = index.createEvent(this, "ionStyle", 7);
|
|
1252
|
+
this.isCancelVisible = false;
|
|
1253
|
+
this.shouldAlignLeft = true;
|
|
1254
|
+
this.focused = false;
|
|
1255
|
+
this.noAnimate = true;
|
|
1256
|
+
/**
|
|
1257
|
+
* If `true`, enable searchbar animation.
|
|
1258
|
+
*/
|
|
1259
|
+
this.animated = false;
|
|
1260
|
+
/**
|
|
1261
|
+
* Set the input's autocomplete property.
|
|
1262
|
+
*/
|
|
1263
|
+
this.autocomplete = 'off';
|
|
1264
|
+
/**
|
|
1265
|
+
* Set the input's autocorrect property.
|
|
1266
|
+
*/
|
|
1267
|
+
this.autocorrect = 'off';
|
|
1268
|
+
/**
|
|
1269
|
+
* Set the cancel button icon. Only applies to `md` mode.
|
|
1270
|
+
* Defaults to `"arrow-back-sharp"`.
|
|
1271
|
+
*/
|
|
1272
|
+
this.cancelButtonIcon = ionicGlobal.config.get('backButtonIcon', 'arrow-back-sharp');
|
|
1273
|
+
/**
|
|
1274
|
+
* Set the the cancel button text. Only applies to `ios` mode.
|
|
1275
|
+
*/
|
|
1276
|
+
this.cancelButtonText = 'Cancel';
|
|
1277
|
+
/**
|
|
1278
|
+
* Set the amount of time, in milliseconds, to wait to trigger the `ionChange` event after each keystroke.
|
|
1279
|
+
*/
|
|
1280
|
+
this.debounce = 250;
|
|
1281
|
+
/**
|
|
1282
|
+
* If `true`, the user cannot interact with the input.
|
|
1283
|
+
*/
|
|
1284
|
+
this.disabled = false;
|
|
1285
|
+
/**
|
|
1286
|
+
* Set the input's placeholder.
|
|
1287
|
+
* `placeholder` can accept either plaintext or HTML as a string.
|
|
1288
|
+
* To display characters normally reserved for HTML, they
|
|
1289
|
+
* must be escaped. For example `<Ionic>` would become
|
|
1290
|
+
* `<Ionic>`
|
|
1291
|
+
*
|
|
1292
|
+
* For more information: [Security Documentation](https://ionicframework.com/docs/faq/security)
|
|
1293
|
+
*/
|
|
1294
|
+
this.placeholder = 'Search';
|
|
1295
|
+
/**
|
|
1296
|
+
* Sets the behavior for the cancel button. Defaults to `"never"`.
|
|
1297
|
+
* Setting to `"focus"` shows the cancel button on focus.
|
|
1298
|
+
* Setting to `"never"` hides the cancel button.
|
|
1299
|
+
* Setting to `"always"` shows the cancel button regardless
|
|
1300
|
+
* of focus state.
|
|
1301
|
+
*/
|
|
1302
|
+
this.showCancelButton = 'never';
|
|
1303
|
+
/**
|
|
1304
|
+
* If `true`, enable spellcheck on the input.
|
|
1305
|
+
*/
|
|
1306
|
+
this.spellcheck = false;
|
|
1307
|
+
/**
|
|
1308
|
+
* Set the type of the input.
|
|
1309
|
+
*/
|
|
1310
|
+
this.type = 'search';
|
|
1311
|
+
/**
|
|
1312
|
+
* the value of the searchbar.
|
|
1313
|
+
*/
|
|
1314
|
+
this.value = '';
|
|
1315
|
+
/**
|
|
1316
|
+
* Clears the input field and triggers the control change.
|
|
1317
|
+
*/
|
|
1318
|
+
this.onClearInput = (ev) => {
|
|
1319
|
+
this.ionClear.emit();
|
|
1320
|
+
if (ev) {
|
|
1321
|
+
ev.preventDefault();
|
|
1322
|
+
ev.stopPropagation();
|
|
1323
|
+
}
|
|
1324
|
+
// setTimeout() fixes https://github.com/ionic-team/ionic/issues/7527
|
|
1325
|
+
// wait for 4 frames
|
|
1326
|
+
setTimeout(() => {
|
|
1327
|
+
const value = this.getValue();
|
|
1328
|
+
if (value !== '') {
|
|
1329
|
+
this.value = '';
|
|
1330
|
+
this.ionInput.emit();
|
|
1331
|
+
}
|
|
1332
|
+
}, 16 * 4);
|
|
1333
|
+
};
|
|
1334
|
+
/**
|
|
1335
|
+
* Clears the input field and tells the input to blur since
|
|
1336
|
+
* the clearInput function doesn't want the input to blur
|
|
1337
|
+
* then calls the custom cancel function if the user passed one in.
|
|
1338
|
+
*/
|
|
1339
|
+
this.onCancelSearchbar = (ev) => {
|
|
1340
|
+
if (ev) {
|
|
1341
|
+
ev.preventDefault();
|
|
1342
|
+
ev.stopPropagation();
|
|
1343
|
+
}
|
|
1344
|
+
this.ionCancel.emit();
|
|
1345
|
+
this.onClearInput();
|
|
1346
|
+
if (this.nativeInput) {
|
|
1347
|
+
this.nativeInput.blur();
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
/**
|
|
1351
|
+
* Update the Searchbar input value when the input changes
|
|
1352
|
+
*/
|
|
1353
|
+
this.onInput = (ev) => {
|
|
1354
|
+
const input = ev.target;
|
|
1355
|
+
if (input) {
|
|
1356
|
+
this.value = input.value;
|
|
1357
|
+
}
|
|
1358
|
+
this.ionInput.emit(ev);
|
|
1359
|
+
};
|
|
1360
|
+
/**
|
|
1361
|
+
* Sets the Searchbar to not focused and checks if it should align left
|
|
1362
|
+
* based on whether there is a value in the searchbar or not.
|
|
1363
|
+
*/
|
|
1364
|
+
this.onBlur = () => {
|
|
1365
|
+
this.focused = false;
|
|
1366
|
+
this.ionBlur.emit();
|
|
1367
|
+
this.positionElements();
|
|
1368
|
+
};
|
|
1369
|
+
/**
|
|
1370
|
+
* Sets the Searchbar to focused and active on input focus.
|
|
1371
|
+
*/
|
|
1372
|
+
this.onFocus = () => {
|
|
1373
|
+
this.focused = true;
|
|
1374
|
+
this.ionFocus.emit();
|
|
1375
|
+
this.positionElements();
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
debounceChanged() {
|
|
1379
|
+
this.ionChange = helpers.debounceEvent(this.ionChange, this.debounce);
|
|
1380
|
+
}
|
|
1381
|
+
valueChanged() {
|
|
1382
|
+
const inputEl = this.nativeInput;
|
|
1383
|
+
const value = this.getValue();
|
|
1384
|
+
if (inputEl && inputEl.value !== value) {
|
|
1385
|
+
inputEl.value = value;
|
|
1386
|
+
}
|
|
1387
|
+
this.ionChange.emit({ value });
|
|
1388
|
+
}
|
|
1389
|
+
showCancelButtonChanged() {
|
|
1390
|
+
requestAnimationFrame(() => {
|
|
1391
|
+
this.positionElements();
|
|
1392
|
+
index.forceUpdate(this);
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
connectedCallback() {
|
|
1396
|
+
this.emitStyle();
|
|
1397
|
+
}
|
|
1398
|
+
componentDidLoad() {
|
|
1399
|
+
this.positionElements();
|
|
1400
|
+
this.debounceChanged();
|
|
1401
|
+
setTimeout(() => {
|
|
1402
|
+
this.noAnimate = false;
|
|
1403
|
+
}, 300);
|
|
1404
|
+
}
|
|
1405
|
+
emitStyle() {
|
|
1406
|
+
this.ionStyle.emit({
|
|
1407
|
+
'searchbar': true
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Sets focus on the specified `ion-searchbar`. Use this method instead of the global
|
|
1412
|
+
* `input.focus()`.
|
|
1413
|
+
*/
|
|
1414
|
+
async setFocus() {
|
|
1415
|
+
if (this.nativeInput) {
|
|
1416
|
+
this.nativeInput.focus();
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Returns the native `<input>` element used under the hood.
|
|
1421
|
+
*/
|
|
1422
|
+
getInputElement() {
|
|
1423
|
+
return Promise.resolve(this.nativeInput);
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Positions the input search icon, placeholder, and the cancel button
|
|
1427
|
+
* based on the input value and if it is focused. (ios only)
|
|
1428
|
+
*/
|
|
1429
|
+
positionElements() {
|
|
1430
|
+
const value = this.getValue();
|
|
1431
|
+
const prevAlignLeft = this.shouldAlignLeft;
|
|
1432
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1433
|
+
const shouldAlignLeft = (!this.animated || value.trim() !== '' || !!this.focused);
|
|
1434
|
+
this.shouldAlignLeft = shouldAlignLeft;
|
|
1435
|
+
if (mode !== 'ios') {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
if (prevAlignLeft !== shouldAlignLeft) {
|
|
1439
|
+
this.positionPlaceholder();
|
|
1440
|
+
}
|
|
1441
|
+
if (this.animated) {
|
|
1442
|
+
this.positionCancelButton();
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Positions the input placeholder
|
|
1447
|
+
*/
|
|
1448
|
+
positionPlaceholder() {
|
|
1449
|
+
const inputEl = this.nativeInput;
|
|
1450
|
+
if (!inputEl) {
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
const isRTL = document.dir === 'rtl';
|
|
1454
|
+
const iconEl = (this.el.shadowRoot || this.el).querySelector('.searchbar-search-icon');
|
|
1455
|
+
if (this.shouldAlignLeft) {
|
|
1456
|
+
inputEl.removeAttribute('style');
|
|
1457
|
+
iconEl.removeAttribute('style');
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
// Create a dummy span to get the placeholder width
|
|
1461
|
+
const doc = document;
|
|
1462
|
+
const tempSpan = doc.createElement('span');
|
|
1463
|
+
tempSpan.innerText = this.placeholder || '';
|
|
1464
|
+
doc.body.appendChild(tempSpan);
|
|
1465
|
+
// Get the width of the span then remove it
|
|
1466
|
+
helpers.raf(() => {
|
|
1467
|
+
const textWidth = tempSpan.offsetWidth;
|
|
1468
|
+
tempSpan.remove();
|
|
1469
|
+
// Calculate the input padding
|
|
1470
|
+
const inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';
|
|
1471
|
+
// Calculate the icon margin
|
|
1472
|
+
const iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';
|
|
1473
|
+
// Set the input padding start and icon margin start
|
|
1474
|
+
if (isRTL) {
|
|
1475
|
+
inputEl.style.paddingRight = inputLeft;
|
|
1476
|
+
iconEl.style.marginRight = iconLeft;
|
|
1477
|
+
}
|
|
1478
|
+
else {
|
|
1479
|
+
inputEl.style.paddingLeft = inputLeft;
|
|
1480
|
+
iconEl.style.marginLeft = iconLeft;
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Show the iOS Cancel button on focus, hide it offscreen otherwise
|
|
1487
|
+
*/
|
|
1488
|
+
positionCancelButton() {
|
|
1489
|
+
const isRTL = document.dir === 'rtl';
|
|
1490
|
+
const cancelButton = (this.el.shadowRoot || this.el).querySelector('.searchbar-cancel-button');
|
|
1491
|
+
const shouldShowCancel = this.shouldShowCancelButton();
|
|
1492
|
+
if (cancelButton && shouldShowCancel !== this.isCancelVisible) {
|
|
1493
|
+
const cancelStyle = cancelButton.style;
|
|
1494
|
+
this.isCancelVisible = shouldShowCancel;
|
|
1495
|
+
if (shouldShowCancel) {
|
|
1496
|
+
if (isRTL) {
|
|
1497
|
+
cancelStyle.marginLeft = '0';
|
|
1498
|
+
}
|
|
1499
|
+
else {
|
|
1500
|
+
cancelStyle.marginRight = '0';
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
else {
|
|
1504
|
+
const offset = cancelButton.offsetWidth;
|
|
1505
|
+
if (offset > 0) {
|
|
1506
|
+
if (isRTL) {
|
|
1507
|
+
cancelStyle.marginLeft = -offset + 'px';
|
|
1508
|
+
}
|
|
1509
|
+
else {
|
|
1510
|
+
cancelStyle.marginRight = -offset + 'px';
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
getValue() {
|
|
1517
|
+
return this.value || '';
|
|
1518
|
+
}
|
|
1519
|
+
hasValue() {
|
|
1520
|
+
return this.getValue() !== '';
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Determines whether or not the cancel button should be visible onscreen.
|
|
1524
|
+
* Cancel button should be shown if one of two conditions applies:
|
|
1525
|
+
* 1. `showCancelButton` is set to `always`.
|
|
1526
|
+
* 2. `showCancelButton` is set to `focus`, and the searchbar has been focused.
|
|
1527
|
+
*/
|
|
1528
|
+
shouldShowCancelButton() {
|
|
1529
|
+
if ((this.showCancelButton === 'never') || (this.showCancelButton === 'focus' && !this.focused)) {
|
|
1530
|
+
return false;
|
|
1531
|
+
}
|
|
1532
|
+
return true;
|
|
1533
|
+
}
|
|
1534
|
+
render() {
|
|
1535
|
+
const { cancelButtonText } = this;
|
|
1536
|
+
const animated = this.animated && ionicGlobal.config.getBoolean('animated', true);
|
|
1537
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1538
|
+
const clearIcon = this.clearIcon || (mode === 'ios' ? 'close-circle' : 'close-sharp');
|
|
1539
|
+
const searchIcon = this.searchIcon || (mode === 'ios' ? 'search-outline' : 'search-sharp');
|
|
1540
|
+
const shouldShowCancelButton = this.shouldShowCancelButton();
|
|
1541
|
+
const cancelButton = (this.showCancelButton !== 'never') && (index.h("button", { "aria-label": cancelButtonText, "aria-hidden": shouldShowCancelButton ? undefined : 'true', type: "button", tabIndex: mode === 'ios' && !shouldShowCancelButton ? -1 : undefined, onMouseDown: this.onCancelSearchbar, onTouchStart: this.onCancelSearchbar, class: "searchbar-cancel-button" }, index.h("div", { "aria-hidden": "true" }, mode === 'md'
|
|
1542
|
+
? index.h("ion-icon", { "aria-hidden": "true", mode: mode, icon: this.cancelButtonIcon, lazy: false })
|
|
1543
|
+
: cancelButtonText)));
|
|
1544
|
+
return (index.h(index.Host, { role: "search", "aria-disabled": this.disabled ? 'true' : null, class: Object.assign(Object.assign({}, theme.createColorClasses(this.color)), { [mode]: true, 'searchbar-animated': animated, 'searchbar-disabled': this.disabled, 'searchbar-no-animate': animated && this.noAnimate, 'searchbar-has-value': this.hasValue(), 'searchbar-left-aligned': this.shouldAlignLeft, 'searchbar-has-focus': this.focused, 'searchbar-should-show-cancel': this.shouldShowCancelButton() }) }, index.h("div", { class: "searchbar-input-container" }, index.h("input", { "aria-label": "search text", disabled: this.disabled, ref: el => this.nativeInput = el, class: "searchbar-input", inputMode: this.inputmode, enterKeyHint: this.enterkeyhint, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, placeholder: this.placeholder, type: this.type, value: this.getValue(), autoComplete: this.autocomplete, autoCorrect: this.autocorrect, spellCheck: this.spellcheck }), mode === 'md' && cancelButton, index.h("ion-icon", { "aria-hidden": "true", mode: mode, icon: searchIcon, lazy: false, class: "searchbar-search-icon" }), index.h("button", { "aria-label": "reset", type: "button", "no-blur": true, class: "searchbar-clear-button", onMouseDown: this.onClearInput, onTouchStart: this.onClearInput }, index.h("ion-icon", { "aria-hidden": "true", mode: mode, icon: clearIcon, lazy: false, class: "searchbar-clear-icon" }))), mode === 'ios' && cancelButton));
|
|
1545
|
+
}
|
|
1546
|
+
get el() { return index.getElement(this); }
|
|
1547
|
+
static get watchers() { return {
|
|
1548
|
+
"debounce": ["debounceChanged"],
|
|
1549
|
+
"value": ["valueChanged"],
|
|
1550
|
+
"showCancelButton": ["showCancelButtonChanged"]
|
|
1551
|
+
}; }
|
|
1552
|
+
};
|
|
1553
|
+
Searchbar.style = {
|
|
1554
|
+
ios: searchbarIosCss,
|
|
1555
|
+
md: searchbarMdCss
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
const titleIosCss = ":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{left:0;top:0;padding-left:90px;padding-right:90px;padding-top:0;padding-bottom:0;position:absolute;width:100%;height:100%;transform:translateZ(0);font-size:17px;font-weight:600;text-align:center;box-sizing:border-box;pointer-events:none}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:90px;padding-inline-start:90px;-webkit-padding-end:90px;padding-inline-end:90px}}:host(.title-small){padding-left:9px;padding-right:9px;padding-top:6px;padding-bottom:16px;position:relative;font-size:13px;font-weight:normal}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-small){padding-left:unset;padding-right:unset;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px}}:host(.title-large){padding-left:16px;padding-right:16px;padding-top:0;padding-bottom:0;bottom:0;align-items:flex-end;min-width:100%;padding-bottom:6px;font-size:34px;font-weight:700;text-align:start}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-large){padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host(.title-large.ion-cloned-element){--color:var(--ion-text-color, #000)}";
|
|
1559
|
+
|
|
1560
|
+
const titleMdCss = ":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{padding-left:20px;padding-right:20px;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;letter-spacing:0.0125em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}:host(.title-small){width:100%;height:100%;font-size:15px;font-weight:normal}";
|
|
1561
|
+
|
|
1562
|
+
const ToolbarTitle = class {
|
|
1563
|
+
constructor(hostRef) {
|
|
1564
|
+
index.registerInstance(this, hostRef);
|
|
1565
|
+
this.ionStyle = index.createEvent(this, "ionStyle", 7);
|
|
1566
|
+
}
|
|
1567
|
+
sizeChanged() {
|
|
1568
|
+
this.emitStyle();
|
|
1569
|
+
}
|
|
1570
|
+
connectedCallback() {
|
|
1571
|
+
this.emitStyle();
|
|
1572
|
+
}
|
|
1573
|
+
emitStyle() {
|
|
1574
|
+
const size = this.getSize();
|
|
1575
|
+
this.ionStyle.emit({
|
|
1576
|
+
[`title-${size}`]: true
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
getSize() {
|
|
1580
|
+
return (this.size !== undefined) ? this.size : 'default';
|
|
1581
|
+
}
|
|
1582
|
+
render() {
|
|
1583
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1584
|
+
const size = this.getSize();
|
|
1585
|
+
return (index.h(index.Host, { class: Object.assign({ [mode]: true, [`title-${size}`]: true }, theme.createColorClasses(this.color)) }, index.h("div", { class: "toolbar-title" }, index.h("slot", null))));
|
|
1586
|
+
}
|
|
1587
|
+
get el() { return index.getElement(this); }
|
|
1588
|
+
static get watchers() { return {
|
|
1589
|
+
"size": ["sizeChanged"]
|
|
1590
|
+
}; }
|
|
1591
|
+
};
|
|
1592
|
+
ToolbarTitle.style = {
|
|
1593
|
+
ios: titleIosCss,
|
|
1594
|
+
md: titleMdCss
|
|
1595
|
+
};
|
|
1596
|
+
|
|
1597
|
+
const toolbarIosCss = ":host{--border-width:0;--border-style:solid;--opacity:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.toolbar-container{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:var(--opacity);z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-color-step-50, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #000));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.2))));--padding-top:3px;--padding-bottom:3px;--padding-start:4px;--padding-end:4px;--min-height:44px}.toolbar-content{flex:1;order:4;min-width:0}:host(.toolbar-segment) .toolbar-content{display:inline-flex}:host(.toolbar-searchbar) .toolbar-container{padding-top:0;padding-bottom:0}:host(.toolbar-searchbar) ::slotted(*){align-self:start}:host(.toolbar-searchbar) ::slotted(ion-chip){margin-top:3px}:host(.toolbar-searchbar) ::slotted(ion-back-button){height:38px}::slotted(ion-buttons){min-height:38px}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:3}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}:host(.toolbar-title-large) .toolbar-container{flex-wrap:wrap;align-items:flex-start}:host(.toolbar-title-large) .toolbar-content ion-title{flex:1;order:8;min-width:100%}";
|
|
1598
|
+
|
|
1599
|
+
const toolbarMdCss = ":host{--border-width:0;--border-style:solid;--opacity:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.toolbar-container{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:var(--opacity);z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-background-color, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #424242));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, #c1c4cd)));--padding-top:0;--padding-bottom:0;--padding-start:0;--padding-end:0;--min-height:56px}.toolbar-content{flex:1;order:3;min-width:0;max-width:100%}::slotted(ion-segment){min-height:var(--min-height)}::slotted(.buttons-first-slot){margin-left:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(.buttons-first-slot){margin-left:unset;-webkit-margin-start:4px;margin-inline-start:4px}}::slotted(.buttons-last-slot){margin-right:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(.buttons-last-slot){margin-right:unset;-webkit-margin-end:4px;margin-inline-end:4px}}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:4}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}";
|
|
1600
|
+
|
|
1601
|
+
const Toolbar = class {
|
|
1602
|
+
constructor(hostRef) {
|
|
1603
|
+
index.registerInstance(this, hostRef);
|
|
1604
|
+
this.childrenStyles = new Map();
|
|
1605
|
+
}
|
|
1606
|
+
componentWillLoad() {
|
|
1607
|
+
const buttons = Array.from(this.el.querySelectorAll('ion-buttons'));
|
|
1608
|
+
const firstButtons = buttons.find(button => {
|
|
1609
|
+
return button.slot === 'start';
|
|
1610
|
+
});
|
|
1611
|
+
if (firstButtons) {
|
|
1612
|
+
firstButtons.classList.add('buttons-first-slot');
|
|
1613
|
+
}
|
|
1614
|
+
const buttonsReversed = buttons.reverse();
|
|
1615
|
+
const lastButtons = buttonsReversed.find(button => button.slot === 'end') ||
|
|
1616
|
+
buttonsReversed.find(button => button.slot === 'primary') ||
|
|
1617
|
+
buttonsReversed.find(button => button.slot === 'secondary');
|
|
1618
|
+
if (lastButtons) {
|
|
1619
|
+
lastButtons.classList.add('buttons-last-slot');
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
childrenStyle(ev) {
|
|
1623
|
+
ev.stopPropagation();
|
|
1624
|
+
const tagName = ev.target.tagName;
|
|
1625
|
+
const updatedStyles = ev.detail;
|
|
1626
|
+
const newStyles = {};
|
|
1627
|
+
const childStyles = this.childrenStyles.get(tagName) || {};
|
|
1628
|
+
let hasStyleChange = false;
|
|
1629
|
+
Object.keys(updatedStyles).forEach(key => {
|
|
1630
|
+
const childKey = `toolbar-${key}`;
|
|
1631
|
+
const newValue = updatedStyles[key];
|
|
1632
|
+
if (newValue !== childStyles[childKey]) {
|
|
1633
|
+
hasStyleChange = true;
|
|
1634
|
+
}
|
|
1635
|
+
if (newValue) {
|
|
1636
|
+
newStyles[childKey] = true;
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
if (hasStyleChange) {
|
|
1640
|
+
this.childrenStyles.set(tagName, newStyles);
|
|
1641
|
+
index.forceUpdate(this);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
render() {
|
|
1645
|
+
const mode = ionicGlobal.getIonMode(this);
|
|
1646
|
+
const childStyles = {};
|
|
1647
|
+
this.childrenStyles.forEach(value => {
|
|
1648
|
+
Object.assign(childStyles, value);
|
|
1649
|
+
});
|
|
1650
|
+
return (index.h(index.Host, { class: Object.assign(Object.assign({ 'in-toolbar': theme.hostContext('ion-toolbar', this.el), [mode]: true }, childStyles), theme.createColorClasses(this.color)) }, index.h("div", { class: "toolbar-background" }), index.h("div", { class: "toolbar-container" }, index.h("slot", { name: "start" }), index.h("slot", { name: "secondary" }), index.h("div", { class: "toolbar-content" }, index.h("slot", null)), index.h("slot", { name: "primary" }), index.h("slot", { name: "end" }))));
|
|
1651
|
+
}
|
|
1652
|
+
get el() { return index.getElement(this); }
|
|
1653
|
+
};
|
|
1654
|
+
Toolbar.style = {
|
|
1655
|
+
ios: toolbarIosCss,
|
|
1656
|
+
md: toolbarMdCss
|
|
1657
|
+
};
|
|
1658
|
+
|
|
1659
|
+
const title = "Prayers and Thanksgivings";
|
|
1660
|
+
const EN = {
|
|
1661
|
+
title: title
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
const prayersAndThanksgivingsCss = ".padded.sc-ldf-prayers-and-thanksgivings{padding-left:14px}";
|
|
1665
|
+
|
|
1666
|
+
const LOCALE = {
|
|
1667
|
+
'en': EN,
|
|
1668
|
+
};
|
|
1669
|
+
const PrayersAndThanksgivingsComponent = class {
|
|
1670
|
+
constructor(hostRef) {
|
|
1671
|
+
index.registerInstance(this, hostRef);
|
|
1672
|
+
this.ldfAskForPrayersAndThanksgivings = index.createEvent(this, "ldfAskForPrayersAndThanksgivings", 7);
|
|
1673
|
+
this.localeStrings = {};
|
|
1674
|
+
this.filter = '';
|
|
1675
|
+
}
|
|
1676
|
+
optionsChange(newOptions) {
|
|
1677
|
+
console.log("new options");
|
|
1678
|
+
this.currentOptions = newOptions;
|
|
1679
|
+
}
|
|
1680
|
+
/** Set the list of available prayers */
|
|
1681
|
+
async setOptions(options) {
|
|
1682
|
+
this.optionsChange(options);
|
|
1683
|
+
if (this.loading) {
|
|
1684
|
+
this.loading.dismiss();
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
// Lifecycle events
|
|
1688
|
+
async componentWillLoad() {
|
|
1689
|
+
this.ldfAskForPrayersAndThanksgivings.emit(true);
|
|
1690
|
+
this.loadLocaleStrings();
|
|
1691
|
+
}
|
|
1692
|
+
// Private methods
|
|
1693
|
+
async loadLocaleStrings() {
|
|
1694
|
+
try {
|
|
1695
|
+
this.localeStrings = LOCALE[locale.getComponentClosestLanguage(this.element)];
|
|
1696
|
+
}
|
|
1697
|
+
catch (e) {
|
|
1698
|
+
console.warn(e);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
async addPrayer(value) {
|
|
1702
|
+
var _a;
|
|
1703
|
+
// if passed a parent, send the message to it that we should insert this doc
|
|
1704
|
+
if (this.parent) {
|
|
1705
|
+
this.parent.ldfDocShouldChange.emit(new change.Change({
|
|
1706
|
+
path: this.base,
|
|
1707
|
+
op: [{
|
|
1708
|
+
type: 'insertAt',
|
|
1709
|
+
index: this.index,
|
|
1710
|
+
value
|
|
1711
|
+
}]
|
|
1712
|
+
}));
|
|
1713
|
+
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.dismiss();
|
|
1714
|
+
}
|
|
1715
|
+
// otherwise, just pop up the text
|
|
1716
|
+
else {
|
|
1717
|
+
const popover = await overlays.popoverController.create({
|
|
1718
|
+
backdropDismiss: true,
|
|
1719
|
+
component: "ldf-liturgical-document",
|
|
1720
|
+
componentProps: {
|
|
1721
|
+
doc: Object.assign(Object.assign({}, value), { value: value.value.map(line => typeof line === "string" ? line.replace(" ", " ") : line) }),
|
|
1722
|
+
padding: "1em"
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
await popover.present();
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
buildTree() {
|
|
1729
|
+
function groupBy(list, keyGetter) {
|
|
1730
|
+
const map = new Map();
|
|
1731
|
+
list.forEach((item) => {
|
|
1732
|
+
const key = keyGetter(item);
|
|
1733
|
+
const collection = map.get(key);
|
|
1734
|
+
if (!collection) {
|
|
1735
|
+
map.set(key, [item]);
|
|
1736
|
+
}
|
|
1737
|
+
else {
|
|
1738
|
+
collection.push(item);
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
return map;
|
|
1742
|
+
}
|
|
1743
|
+
const options = !this.filter ? this.currentOptions || [] :
|
|
1744
|
+
(this.currentOptions || []).filter(doc => { var _a, _b, _c, _d; return ((_b = (_a = doc.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(this.filter.toLowerCase())) || ((_d = (_c = (doc.value || [])[0]) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.includes(this.filter.toLowerCase())); });
|
|
1745
|
+
const categories = Array.from(groupBy(options, (item) => (item.category || [])[1]));
|
|
1746
|
+
const subcategories = categories.map(([categoryLabel, values]) => [categoryLabel, Array.from(groupBy(values, (item) => (item.category || [])[2]))]);
|
|
1747
|
+
return subcategories;
|
|
1748
|
+
}
|
|
1749
|
+
// Render
|
|
1750
|
+
render() {
|
|
1751
|
+
const localeStrings = this.localeStrings || {};
|
|
1752
|
+
const tree = this.buildTree(), list = index.h("ion-list", null, index.h("ion-searchbar", { debounce: 100, onIonChange: (ev) => this.filter = ev.detail.value }), tree.map(([category, values]) => [
|
|
1753
|
+
index.h("h2", { class: "padded" }, category),
|
|
1754
|
+
...values.map(([subcategory, subvalues]) => [
|
|
1755
|
+
index.h("h3", { class: "padded" }, subcategory),
|
|
1756
|
+
...subvalues
|
|
1757
|
+
.sort((a, b) => { var _a, _b; return Number((_a = a.label) === null || _a === void 0 ? void 0 : _a.split('.')[0]) < Number((_b = b.label) === null || _b === void 0 ? void 0 : _b.split('.')[0]) ? -1 : 1; })
|
|
1758
|
+
.map(option => index.h("ion-item", { button: true, onClick: () => this.addPrayer(option) }, index.h("ion-label", null, index.h("h3", null, option.label), index.h("p", null, option.value[0].replace(/\*/g, '').replace(" ", " ")))))
|
|
1759
|
+
])
|
|
1760
|
+
]));
|
|
1761
|
+
return this.modal
|
|
1762
|
+
? [
|
|
1763
|
+
index.h("ion-header", null, index.h("ion-toolbar", null, index.h("ion-title", null, localeStrings.title), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { onClick: () => this.modal.dismiss() }, index.h("ion-icon", { slot: "icon-only", name: "close" }))))),
|
|
1764
|
+
index.h("ion-content", { class: "ion-padding" }, list)
|
|
1765
|
+
]
|
|
1766
|
+
: [list];
|
|
1767
|
+
}
|
|
1768
|
+
get element() { return index.getElement(this); }
|
|
1769
|
+
static get watchers() { return {
|
|
1770
|
+
"options": ["optionsChange"]
|
|
1771
|
+
}; }
|
|
1772
|
+
};
|
|
1773
|
+
PrayersAndThanksgivingsComponent.style = prayersAndThanksgivingsCss;
|
|
1774
|
+
|
|
1775
|
+
exports.ion_button = Button;
|
|
1776
|
+
exports.ion_buttons = Buttons;
|
|
1777
|
+
exports.ion_content = Content;
|
|
1778
|
+
exports.ion_header = Header;
|
|
1779
|
+
exports.ion_icon = Icon;
|
|
1780
|
+
exports.ion_item = Item;
|
|
1781
|
+
exports.ion_label = Label;
|
|
1782
|
+
exports.ion_list = List;
|
|
1783
|
+
exports.ion_ripple_effect = RippleEffect;
|
|
1784
|
+
exports.ion_searchbar = Searchbar;
|
|
1785
|
+
exports.ion_title = ToolbarTitle;
|
|
1786
|
+
exports.ion_toolbar = Toolbar;
|
|
1787
|
+
exports.ldf_prayers_and_thanksgivings = PrayersAndThanksgivingsComponent;
|