legalesign-document-viewer 0.3.2 → 0.3.4
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/{index-DruwRbfl.js → index-BpMnxZQ4.js} +14 -3
- package/dist/cjs/index-BpMnxZQ4.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{ls-document-options_39.cjs.entry.js → ls-document-options_40.cjs.entry.js} +1711 -190
- package/dist/cjs/ls-document-options_40.cjs.entry.js.map +1 -0
- package/dist/cjs/ls-document-viewer.cjs.js +2 -2
- package/dist/cjs/ls-field-properties-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/ls-formfield.cjs.entry.js +1 -1
- package/dist/cjs/ls-number-input_5.cjs.entry.js +1 -1
- package/dist/collection/components/ls-document-options/ls-document-options.js +8 -2
- package/dist/collection/components/ls-document-options/ls-document-options.js.map +1 -1
- package/dist/collection/components/ls-document-viewer/editorCalculator.js +2 -0
- package/dist/collection/components/ls-document-viewer/editorCalculator.js.map +1 -1
- package/dist/collection/components/ls-document-viewer/editorUtils.js +8 -3
- package/dist/collection/components/ls-document-viewer/editorUtils.js.map +1 -1
- package/dist/collection/components/ls-document-viewer/ls-document-viewer.js +19 -12
- package/dist/collection/components/ls-document-viewer/ls-document-viewer.js.map +1 -1
- package/dist/collection/components/ls-document-viewer/validator.js +2 -2
- package/dist/collection/components/ls-document-viewer/validator.js.map +1 -1
- package/dist/collection/components/ls-field-content/ls-field-content.js +6 -2
- package/dist/collection/components/ls-field-content/ls-field-content.js.map +1 -1
- package/dist/collection/components/ls-tooltip/ls-tooltip.css +22 -5
- package/dist/collection/components/ls-tooltip/ls-tooltip.js +59 -34
- package/dist/collection/components/ls-tooltip/ls-tooltip.js.map +1 -1
- package/dist/collection/components/ls-validation-tag/ls-validation-tag.js +11 -2
- package/dist/collection/components/ls-validation-tag/ls-validation-tag.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/ls-document-options.js +1 -1
- package/dist/components/ls-document-viewer.js +150 -207
- package/dist/components/ls-document-viewer.js.map +1 -1
- package/dist/components/ls-editor-field.js +1 -1
- package/dist/components/ls-editor-table.js +1 -1
- package/dist/components/ls-feature-column.js +1 -1
- package/dist/components/ls-field-alignment.js +1 -1
- package/dist/components/ls-field-content.js +1 -1
- package/dist/components/ls-field-dimensions.js +1 -1
- package/dist/components/ls-field-distribute.js +1 -1
- package/dist/components/ls-field-footer.js +1 -1
- package/dist/components/ls-field-format.js +1 -1
- package/dist/components/ls-field-placement.js +1 -1
- package/dist/components/ls-field-properties-advanced.js +1 -1
- package/dist/components/ls-field-properties-autosign.js +1 -1
- package/dist/components/ls-field-properties-container.js +1 -1
- package/dist/components/ls-field-properties-date.js +1 -1
- package/dist/components/ls-field-properties-dropdown.js +12 -12
- package/dist/components/ls-field-properties-email.js +1 -1
- package/dist/components/ls-field-properties-file.js +1 -1
- package/dist/components/ls-field-properties-general.js +1 -1
- package/dist/components/ls-field-properties-image.js +1 -1
- package/dist/components/ls-field-properties-multiple.js +1 -1
- package/dist/components/ls-field-properties-number.js +1 -1
- package/dist/components/ls-field-properties-signature.js +1 -1
- package/dist/components/ls-field-properties-text.js +1 -1
- package/dist/components/ls-field-properties.js +1 -1
- package/dist/components/ls-field-size.js +1 -1
- package/dist/components/ls-field-type-display.js +1 -1
- package/dist/components/ls-formfield.js +7 -7
- package/dist/components/ls-icon.js +1 -1
- package/dist/components/ls-input-wrapper.js +1 -1
- package/dist/components/ls-number-input.js +1 -1
- package/dist/components/ls-page-loader.js +1 -1
- package/dist/components/ls-participant-card.js +1 -1
- package/dist/components/ls-participant-manager.js +1 -1
- package/dist/components/ls-participant-select.js +1 -1
- package/dist/components/ls-props-section.js +1 -1
- package/dist/components/ls-radio-input.js +1 -1
- package/dist/components/ls-select-input.js +1 -1
- package/dist/components/ls-statusbar.js +1 -1
- package/dist/components/ls-text-input.js +1 -1
- package/dist/components/ls-textarea-input.js +1 -1
- package/dist/components/ls-toggle.js +1 -1
- package/dist/components/ls-toolbar.js +1 -1
- package/dist/components/ls-toolbox-field.js +1 -1
- package/dist/components/ls-tooltip.js +1 -1587
- package/dist/components/ls-tooltip.js.map +1 -1
- package/dist/components/ls-validation-tag.js +1 -1
- package/dist/components/{p-CVxA0mrX.js → p-14owczyX.js} +8 -8
- package/dist/components/{p-CVxA0mrX.js.map → p-14owczyX.js.map} +1 -1
- package/dist/components/{p-Dhknldsv.js → p-1wdCYLqw.js} +12 -12
- package/dist/components/{p-Dhknldsv.js.map → p-1wdCYLqw.js.map} +1 -1
- package/dist/components/{p-D990IL5t.js → p-6LFAGg6D.js} +4 -4
- package/dist/components/{p-D990IL5t.js.map → p-6LFAGg6D.js.map} +1 -1
- package/dist/components/{p-CcUFZYwZ.js → p-9WKoGwO0.js} +4 -4
- package/dist/components/{p-CcUFZYwZ.js.map → p-9WKoGwO0.js.map} +1 -1
- package/dist/components/{p-BNMjQBPT.js → p-B0uVP8it.js} +14 -14
- package/dist/components/{p-BNMjQBPT.js.map → p-B0uVP8it.js.map} +1 -1
- package/dist/components/{p-Cfl2rRxL.js → p-B3lY01RV.js} +4 -4
- package/dist/components/{p-Cfl2rRxL.js.map → p-B3lY01RV.js.map} +1 -1
- package/dist/components/{p-HaIHVR-P.js → p-BArjC51C.js} +3 -3
- package/dist/components/{p-HaIHVR-P.js.map → p-BArjC51C.js.map} +1 -1
- package/dist/components/{p-DORxxjtg.js → p-BBuk6A32.js} +14 -14
- package/dist/components/{p-DORxxjtg.js.map → p-BBuk6A32.js.map} +1 -1
- package/dist/components/{p-BaMR8ksy.js → p-BLUUNyDx.js} +3 -3
- package/dist/components/{p-BaMR8ksy.js.map → p-BLUUNyDx.js.map} +1 -1
- package/dist/components/{p-Ovur85Of.js → p-BMpnAxqv.js} +114 -55
- package/dist/components/p-BMpnAxqv.js.map +1 -0
- package/dist/components/{p-_dj7MCcU.js → p-BOKGHQS9.js} +5 -5
- package/dist/components/{p-_dj7MCcU.js.map → p-BOKGHQS9.js.map} +1 -1
- package/dist/components/{p-wy6ar5D3.js → p-BOz4DYOB.js} +5 -5
- package/dist/components/{p-wy6ar5D3.js.map → p-BOz4DYOB.js.map} +1 -1
- package/dist/components/{p-7V9_3fXA.js → p-BXKYpxgM.js} +4 -4
- package/dist/components/{p-7V9_3fXA.js.map → p-BXKYpxgM.js.map} +1 -1
- package/dist/components/{p-DrWlEpVu.js → p-Ba_8GAK2.js} +4 -4
- package/dist/components/{p-DrWlEpVu.js.map → p-Ba_8GAK2.js.map} +1 -1
- package/dist/components/{p-ClYIDEKN.js → p-BcfP7mSQ.js} +6 -6
- package/dist/components/{p-ClYIDEKN.js.map → p-BcfP7mSQ.js.map} +1 -1
- package/dist/{esm/ls-tooltip.entry.js → components/p-Bt5gnPRz.js} +177 -216
- package/dist/components/p-Bt5gnPRz.js.map +1 -0
- package/dist/components/{p-BWLt02JN.js → p-BvHSBTD8.js} +14 -3
- package/dist/components/p-BvHSBTD8.js.map +1 -0
- package/dist/components/{p-Dp-vgKJq.js → p-Bxutt9rC.js} +4 -4
- package/dist/components/{p-Dp-vgKJq.js.map → p-Bxutt9rC.js.map} +1 -1
- package/dist/components/{p-CCMS_IvP.js → p-C0t7MuwE.js} +14 -14
- package/dist/components/{p-CCMS_IvP.js.map → p-C0t7MuwE.js.map} +1 -1
- package/dist/components/{p-CpiX4Tih.js → p-C6NnNmx5.js} +4 -4
- package/dist/components/{p-CpiX4Tih.js.map → p-C6NnNmx5.js.map} +1 -1
- package/dist/components/{p-h3hsXDzk.js → p-CTXoPKrw.js} +4 -4
- package/dist/components/{p-h3hsXDzk.js.map → p-CTXoPKrw.js.map} +1 -1
- package/dist/components/{p-C8kySYH4.js → p-CdGtJRZm.js} +3 -3
- package/dist/components/{p-C8kySYH4.js.map → p-CdGtJRZm.js.map} +1 -1
- package/dist/components/{p-Lx7PwjNC.js → p-CktqjOO6.js} +15 -11
- package/dist/components/p-CktqjOO6.js.map +1 -0
- package/dist/components/{p-Crkl9bKZ.js → p-Co6xLkEu.js} +4 -4
- package/dist/components/{p-Crkl9bKZ.js.map → p-Co6xLkEu.js.map} +1 -1
- package/dist/components/{p-DgMfXwXc.js → p-CpYbd6qt.js} +5 -5
- package/dist/components/{p-DgMfXwXc.js.map → p-CpYbd6qt.js.map} +1 -1
- package/dist/components/{p-Bg6wsr_z.js → p-Cv4qCy2p.js} +4 -4
- package/dist/components/{p-Bg6wsr_z.js.map → p-Cv4qCy2p.js.map} +1 -1
- package/dist/components/{p-GJYwAar9.js → p-CvqT5MA7.js} +14 -14
- package/dist/components/{p-GJYwAar9.js.map → p-CvqT5MA7.js.map} +1 -1
- package/dist/components/{p-gvEf2mjl.js → p-Cw8qsoOq.js} +4 -4
- package/dist/components/{p-gvEf2mjl.js.map → p-Cw8qsoOq.js.map} +1 -1
- package/dist/components/{p-DOCp-M5v.js → p-CzySwvIU.js} +5 -5
- package/dist/components/{p-DOCp-M5v.js.map → p-CzySwvIU.js.map} +1 -1
- package/dist/components/{p-C6cWElQ7.js → p-DDWmD8TQ.js} +14 -14
- package/dist/components/{p-C6cWElQ7.js.map → p-DDWmD8TQ.js.map} +1 -1
- package/dist/components/{p-BPayWH9u.js → p-DM3pnD5z.js} +3 -3
- package/dist/components/{p-BPayWH9u.js.map → p-DM3pnD5z.js.map} +1 -1
- package/dist/components/{p-D5cswwR_.js → p-DUVCAq-W.js} +4 -4
- package/dist/components/{p-D5cswwR_.js.map → p-DUVCAq-W.js.map} +1 -1
- package/dist/components/{p-5I9rEf1F.js → p-Dprl580c.js} +21 -9
- package/dist/components/p-Dprl580c.js.map +1 -0
- package/dist/components/{p-ChCIuJg0.js → p-DqEap43n.js} +3 -3
- package/dist/components/{p-ChCIuJg0.js.map → p-DqEap43n.js.map} +1 -1
- package/dist/components/{p-Bsc25fvn.js → p-DxGzQ3Lc.js} +4 -4
- package/dist/components/{p-Bsc25fvn.js.map → p-DxGzQ3Lc.js.map} +1 -1
- package/dist/components/{p-YrxZXlJ1.js → p-DyE9zKT7.js} +14 -6
- package/dist/components/p-DyE9zKT7.js.map +1 -0
- package/dist/components/{p-CwKpqq1h.js → p-JFkSKN19.js} +14 -14
- package/dist/components/{p-CwKpqq1h.js.map → p-JFkSKN19.js.map} +1 -1
- package/dist/components/{p-D0PX7hpQ.js → p-Yrg6B_xb.js} +4 -4
- package/dist/components/{p-D0PX7hpQ.js.map → p-Yrg6B_xb.js.map} +1 -1
- package/dist/components/{p-CjciOPPE.js → p-bNVYQ-ag.js} +14 -14
- package/dist/components/{p-CjciOPPE.js.map → p-bNVYQ-ag.js.map} +1 -1
- package/dist/components/{p-C0afavmo.js → p-hUeqWmAs.js} +27 -27
- package/dist/components/{p-C0afavmo.js.map → p-hUeqWmAs.js.map} +1 -1
- package/dist/components/{p-DmenFbeU.js → p-i5LoDKK3.js} +4 -4
- package/dist/components/{p-DmenFbeU.js.map → p-i5LoDKK3.js.map} +1 -1
- package/dist/components/{p-BpXqwLh3.js → p-iwXLSFLX.js} +4 -4
- package/dist/components/{p-BpXqwLh3.js.map → p-iwXLSFLX.js.map} +1 -1
- package/dist/components/{p-DEArdusa.js → p-ji6hTzlP.js} +14 -14
- package/dist/components/{p-DEArdusa.js.map → p-ji6hTzlP.js.map} +1 -1
- package/dist/components/{p-CozH0k34.js → p-o7kGA8FM.js} +5 -5
- package/dist/components/{p-CozH0k34.js.map → p-o7kGA8FM.js.map} +1 -1
- package/dist/components/{p-C4Go47Ak.js → p-ozlIyuZ1.js} +6 -6
- package/dist/components/{p-C4Go47Ak.js.map → p-ozlIyuZ1.js.map} +1 -1
- package/dist/components/{p-DWqgZCMh.js → p-vV0A8m2N.js} +3 -3
- package/dist/components/{p-DWqgZCMh.js.map → p-vV0A8m2N.js.map} +1 -1
- package/dist/esm/{index-CjW5NqdW.js → index-BzcAlD18.js} +14 -3
- package/dist/esm/index-BzcAlD18.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{ls-document-options_39.entry.js → ls-document-options_40.entry.js} +1711 -191
- package/dist/esm/ls-document-options_40.entry.js.map +1 -0
- package/dist/esm/ls-document-viewer.js +3 -3
- package/dist/esm/ls-field-properties-dropdown.entry.js +1 -1
- package/dist/esm/ls-formfield.entry.js +1 -1
- package/dist/esm/ls-number-input_5.entry.js +1 -1
- package/dist/ls-document-viewer/ls-document-viewer.esm.js +1 -1
- package/dist/ls-document-viewer/{p-646325ae.entry.js → p-0b9016eb.entry.js} +2 -2
- package/dist/ls-document-viewer/{p-d2df7881.entry.js → p-3dae15c9.entry.js} +2 -2
- package/dist/ls-document-viewer/{p-063541d8.entry.js → p-5c27684b.entry.js} +6 -6
- package/dist/ls-document-viewer/p-5c27684b.entry.js.map +1 -0
- package/dist/ls-document-viewer/p-BzcAlD18.js +3 -0
- package/dist/ls-document-viewer/p-BzcAlD18.js.map +1 -0
- package/dist/ls-document-viewer/{p-d7109cdd.entry.js → p-be7a03ca.entry.js} +2 -2
- package/dist/types/components/ls-document-options/ls-document-options.d.ts +1 -0
- package/dist/types/components/ls-document-viewer/ls-document-viewer.d.ts +1 -0
- package/dist/types/components/ls-document-viewer/validator.d.ts +2 -2
- package/dist/types/components/ls-field-content/ls-field-content.d.ts +1 -0
- package/dist/types/components/ls-tooltip/ls-tooltip.d.ts +2 -4
- package/dist/types/components/ls-validation-tag/ls-validation-tag.d.ts +1 -0
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/cjs/index-DruwRbfl.js.map +0 -1
- package/dist/cjs/ls-document-options_39.cjs.entry.js.map +0 -1
- package/dist/cjs/ls-tooltip.cjs.entry.js +0 -1575
- package/dist/cjs/ls-tooltip.cjs.entry.js.map +0 -1
- package/dist/cjs/ls-tooltip.entry.cjs.js.map +0 -1
- package/dist/components/p-5I9rEf1F.js.map +0 -1
- package/dist/components/p-BWLt02JN.js.map +0 -1
- package/dist/components/p-Lx7PwjNC.js.map +0 -1
- package/dist/components/p-Ovur85Of.js.map +0 -1
- package/dist/components/p-YrxZXlJ1.js.map +0 -1
- package/dist/esm/index-CjW5NqdW.js.map +0 -1
- package/dist/esm/ls-document-options_39.entry.js.map +0 -1
- package/dist/esm/ls-tooltip.entry.js.map +0 -1
- package/dist/ls-document-viewer/ls-tooltip.entry.esm.js.map +0 -1
- package/dist/ls-document-viewer/p-063541d8.entry.js.map +0 -1
- package/dist/ls-document-viewer/p-CjW5NqdW.js +0 -3
- package/dist/ls-document-viewer/p-CjW5NqdW.js.map +0 -1
- package/dist/ls-document-viewer/p-fee3434a.entry.js +0 -2
- package/dist/ls-document-viewer/p-fee3434a.entry.js.map +0 -1
- /package/dist/ls-document-viewer/{p-646325ae.entry.js.map → p-0b9016eb.entry.js.map} +0 -0
- /package/dist/ls-document-viewer/{p-d2df7881.entry.js.map → p-3dae15c9.entry.js.map} +0 -0
- /package/dist/ls-document-viewer/{p-d7109cdd.entry.js.map → p-be7a03ca.entry.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-BzcAlD18.js';
|
|
2
2
|
|
|
3
3
|
const lsDocumentOptionsCss = "*{box-sizing:border-box;margin:0;padding:0}:host{display:block}.ls-editor-infobox{padding:2px 8px 2px 8px}.toolbox-section-title{color:var(--gray-100, #45484d);font-size:1.125rem;font-style:normal;font-weight:500;line-height:1.75rem;}.toolbox-section-description{color:var(--gray-80, #5e6066);font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem}.template-details{display:flex;flex-direction:column;gap:0.75rem}.template-detail-section{position:relative;display:flex;padding:0.75rem;align-items:center;gap:0.5rem;border-radius:1rem;border:1px solid var(--gray-30, #e0e2e5);background:var(--white, #fff)}.template-detail-section-title{color:var(--gray-80, #6c6e73);font-size:0.875rem;font-style:normal;font-weight:500;line-height:1.25rem;width:100%}.template-detail-section-info{color:var(--gray-70);font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem;width:100%}.column{display:flex;flex-direction:column;align-items:flex-start}.editButton{position:absolute;top:0.75rem;right:0.75rem;margin:0px;padding:0px;max-height:1.25rem !important;max-width:1.25rem !important;background-color:transparent;border:none;cursor:pointer;color:var(--gray-70, #2134dc)}.editButton:hover{color:var(--gray-80)}p{color:var(--gray-80, #6c6e73);font-family:var(--font-family);font-size:var(--text-sm);font-style:normal;font-weight:400;line-height:var(--text-sm-line-height)}a{color:var(--primary-60, #4456f6);font-size:var(--text-sm);font-style:normal;font-weight:400;line-height:var(--text-sm-line-height);cursor:pointer}a:hover{text-decoration:underline;color:var(--primary-70, #2134dc)}.button-link,.button-link:hover{all:unset}select{appearance:none;height:36px}.input-wrapper{position:relative;width:fit-content}#selectorIcon{position:absolute;top:50%;right:0.675rem;transform:translateY(-50%);pointer-events:none;color:var(--gray-80, #6c6e73)}#selectLeadingIcon{position:absolute;top:50%;left:0.675rem;transform:translateY(-50%);pointer-events:none;color:var(--gray-80, #6c6e73)}.has-leading-icon{padding-left:2.5rem}input,select,textarea{border:1px solid var(--gray-40, #d8d9dc);box-shadow:0 1px 0.125rem rgba(0, 0, 0, 0.05);padding:0.5rem 0.75rem;font-family:var(--font-family);font-size:var(--text-sm);border-radius:0.5rem;color:var(--gray-100, #45484d);font-weight:400}input::placeholder,select::placeholder,textarea::placeholder{color:var(--gray-60, #afb0b2)}input:hover,select:hover,textarea:hover{border-color:var(--gray-50, #c8c9cc);background-color:var(--white, #fff)}input:focus,select:focus,textarea:focus{outline:none;box-shadow:0 0 0 0.25rem var(--primary-40, #79adfc);border-color:var(--primary-60, #4456f6);background-color:var(--white, #fff)}input:active,select:active,textarea:active{border-color:var(--primary-50, #5185ff)}input:disabled,select:disabled,textarea:disabled{cursor:not-allowed;background-color:var(--gray-10, #f7f8fa)}input[type='checkbox']{appearance:none;position:relative;height:1rem;width:1rem;padding:0.25rem;border-radius:var(--radius-sm);border:1px solid #d1d5db;background-color:#ffffff;cursor:pointer}input[type='checkbox']:checked,input[type='checkbox'].indeterminate{background-color:var(--primary-60, #4456f6);border:none}input[type='checkbox']:checked::after{content:'';position:absolute;top:45%;left:50%;transform:translate(-50%, -50%) rotate(-45deg) scale(-1, 1);width:0.5rem;height:0.25rem;border-bottom:0.125rem solid white;border-right:0.125rem solid white}input[type='checkbox'].indeterminate::after{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.5rem;height:0.125rem;background-color:white}input[type='checkbox']:checked:hover,input[type='checkbox'].indeterminate:hover{background-color:var(--primary-70, #2134dc);border:none}input[type='checkbox']:hover{border:1px solid #9ca3af}input[type='checkbox']:focus,input[type='checkbox']:active{outline:none;box-shadow:0 0 0 0.25rem var(--primary-20, #c7ddff);background-color:#f0f4f8}input[type='checkbox']:disabled{background-color:#f3f4f6;outline:none;cursor:not-allowed}input[type='checkbox']:disabled:checked{background-color:#e5e7eb;border:none;outline:none;cursor:not-allowed}.checkbox-container{display:flex;gap:0.5rem;width:100%}.checkbox-label{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:400;line-height:1rem}.form-label{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:500;line-height:1.5rem}.form-field{display:flex;flex-direction:column;gap:0.25rem;width:100%}.loading-box{display:flex;justify-content:center;align-items:center;width:100%;height:100vh;color:var(--primary-60, #0c7cba)}button{border:0;appearance:button;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-lg);background-color:var(--primary-60, #4456f6);color:white;text-transform:capitalize;min-height:2.25rem;min-width:2.25rem}button.tertiaryGrey{border:1px solid var(--gray-40, #d8d9dc);background-color:white;color:var(--gray-80, #787a80)}button.tertiaryGrey:hover{border:1px solid var(--gray-50, #c8c9cc);background:var(--gray-10, #f7f8fa)}.button-group{display:flex;border-radius:0.5rem;border:1px solid var(--gray-30, #e0e2e5);background:var(--white, #ffffff);overflow:clip}.button-group button{display:flex;background:transparent;border-radius:unset;padding:0.25rem 0.75rem;min-width:2.156rem;min-height:unset;color:var(--gray-80, #6c6e73)}.button-group button:hover{background:var(--gray-10, #f7f8fa)}.button-group>:first-child{border-radius:0.5rem 0 0 0.5rem}.button-group>:last-child{border-radius:0 0.5rem 0.5rem 0}.button-group>:not(:first-child){border-left:1px solid var(--gray-30, #e0e2e5)}";
|
|
4
4
|
|
|
@@ -37,6 +37,7 @@ const LsDocumentOptions = class {
|
|
|
37
37
|
this.mutate.emit(diffs);
|
|
38
38
|
}, delay);
|
|
39
39
|
}
|
|
40
|
+
editNameBtn;
|
|
40
41
|
render() {
|
|
41
42
|
function formatDate(isoString) {
|
|
42
43
|
const date = new Date(isoString);
|
|
@@ -49,7 +50,11 @@ const LsDocumentOptions = class {
|
|
|
49
50
|
}
|
|
50
51
|
return (h(Host, null, h("div", { class: "ls-editor-infobox" }, h("h2", { class: "toolbox-section-title" }, "Template Details"), h("p", { class: "toolbox-section-description" }, "Details and insights about the Template.")), h("div", { class: 'template-details' }, h("div", { class: 'template-detail-section column' }, h("p", { class: "template-detail-section-title" }, "Name"), h("div", { class: "editButton", onClick: () => {
|
|
51
52
|
this.editTitle = !this.editTitle;
|
|
52
|
-
} }, h("ls-icon", { name: this.editTitle ? 'check' : 'pencil-alt', size: "18"
|
|
53
|
+
} }, h("ls-icon", { name: this.editTitle ? 'check' : 'pencil-alt', size: "18", id: "edit-name-btn", ref: el => {
|
|
54
|
+
if (el && el !== this.editNameBtn) {
|
|
55
|
+
this.editNameBtn = el;
|
|
56
|
+
}
|
|
57
|
+
} }), h("ls-tooltip", { referenceElement: this.editNameBtn }, this.editTitle ? 'Save' : 'Edit Name')), this.editTitle ? (h("input", { value: this.template?.title, style: { width: '100%' }, onInput: e => {
|
|
53
58
|
e.preventDefault();
|
|
54
59
|
this.alter({ title: e.target.value });
|
|
55
60
|
}, onKeyUp: e => {
|
|
@@ -19879,6 +19884,8 @@ const findIn = (fields, selector, restyle = false, additive = false) => {
|
|
|
19879
19884
|
};
|
|
19880
19885
|
// Used to append new fields (dropped or loaded from template data)
|
|
19881
19886
|
function addField(frame, data) {
|
|
19887
|
+
const fields = this._template.elementConnection.templateElements;
|
|
19888
|
+
this._template = { ...this._template, elementConnection: { ...this._template.elementConnection, templateElements: [...fields, data] } };
|
|
19882
19889
|
const node = document.createElement('ls-editor-field');
|
|
19883
19890
|
node.setAttribute('type', data.formElementType);
|
|
19884
19891
|
node.setAttribute('id', 'ls-field-' + data.id);
|
|
@@ -19951,60 +19958,40 @@ const recalculateCoordinates = (d) => {
|
|
|
19951
19958
|
};
|
|
19952
19959
|
|
|
19953
19960
|
// Add a role
|
|
19954
|
-
const
|
|
19955
|
-
const newParent = role?.signerParent ? `"${role.signerParent}"` : 'null';
|
|
19956
|
-
return `
|
|
19957
|
-
mutation LDVAddRole {
|
|
19958
|
-
createTemplateRole(input: {
|
|
19959
|
-
templateId: "${role.templateId}"
|
|
19960
|
-
signerIndex: ${role.signerIndex}
|
|
19961
|
-
signerParent: ${newParent}
|
|
19962
|
-
name: ${JSON.stringify(role.name)}
|
|
19963
|
-
ordinal: ${role.ordinal}
|
|
19964
|
-
roleType: ${role.roleType}
|
|
19965
|
-
experience: "${role.experience}"
|
|
19966
|
-
})
|
|
19967
|
-
}`;
|
|
19968
|
-
};
|
|
19969
|
-
// Remove a role
|
|
19970
|
-
const deleteRole = (role) => {
|
|
19971
|
-
return `
|
|
19972
|
-
mutation LDVremoveRole {
|
|
19973
|
-
deleteTemplateRole(input: {
|
|
19974
|
-
templateRoleId: "${role.id}"
|
|
19975
|
-
})
|
|
19976
|
-
}`;
|
|
19977
|
-
};
|
|
19978
|
-
// Save any changes to an role
|
|
19979
|
-
const updateRole = (role) => {
|
|
19980
|
-
const newParent = role?.signerParent ? `"${role.signerParent}"` : 'null';
|
|
19981
|
-
return `
|
|
19982
|
-
mutation LDVupdateRole {
|
|
19983
|
-
updateTemplateRole(input: {
|
|
19984
|
-
templateRoleId: "${role.id}"
|
|
19985
|
-
signerIndex: ${role.signerIndex}
|
|
19986
|
-
ordinal: ${role.ordinal}
|
|
19987
|
-
signerParent: ${newParent}
|
|
19988
|
-
name: ${JSON.stringify(role.name)}
|
|
19989
|
-
roleType: ${role.roleType}
|
|
19990
|
-
experience: "${role.experience}"
|
|
19991
|
-
})
|
|
19992
|
-
}`;
|
|
19993
|
-
};
|
|
19994
|
-
// swap two adjacent roles
|
|
19995
|
-
const swapRoles = (roleId1, roleId2) => {
|
|
19961
|
+
const updateTemplate = template => {
|
|
19996
19962
|
return `
|
|
19997
|
-
mutation
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
19963
|
+
mutation LDVupdateTemplate {
|
|
19964
|
+
updateTemplate(input: {
|
|
19965
|
+
templateId: "${template.id}",
|
|
19966
|
+
title: "${template.title}",
|
|
19967
|
+
locked: ${template.locked},
|
|
19968
|
+
autoArchive: ${template.autoArchive},
|
|
19969
|
+
fixSignatureScale: ${template.fixSignatureScale ? template.fixSignatureScale : false}
|
|
19970
|
+
})
|
|
19971
|
+
}
|
|
19972
|
+
`;
|
|
20003
19973
|
};
|
|
20004
|
-
const
|
|
19974
|
+
const getTemplate = (id) => {
|
|
20005
19975
|
return `
|
|
20006
19976
|
query LDVGetTemplate {
|
|
20007
|
-
template(id: "${id}") {
|
|
19977
|
+
template(id: "${id}") {
|
|
19978
|
+
id
|
|
19979
|
+
title
|
|
19980
|
+
fileName
|
|
19981
|
+
pageDimensions
|
|
19982
|
+
pageCount
|
|
19983
|
+
modified
|
|
19984
|
+
link
|
|
19985
|
+
valid
|
|
19986
|
+
locked
|
|
19987
|
+
autoArchive
|
|
19988
|
+
archived
|
|
19989
|
+
tags
|
|
19990
|
+
created
|
|
19991
|
+
createdBy
|
|
19992
|
+
lastSent
|
|
19993
|
+
fixSignatureScale
|
|
19994
|
+
groupId
|
|
20008
19995
|
roles{
|
|
20009
19996
|
id
|
|
20010
19997
|
name
|
|
@@ -20014,11 +20001,86 @@ const getTemplateRoles = (id) => {
|
|
|
20014
20001
|
signerParent
|
|
20015
20002
|
experience
|
|
20016
20003
|
}
|
|
20004
|
+
elementConnection {
|
|
20005
|
+
templateElements {
|
|
20006
|
+
align
|
|
20007
|
+
ax
|
|
20008
|
+
ay
|
|
20009
|
+
bx
|
|
20010
|
+
by
|
|
20011
|
+
elementType
|
|
20012
|
+
formElementType
|
|
20013
|
+
fieldOrder
|
|
20014
|
+
fontName
|
|
20015
|
+
fontSize
|
|
20016
|
+
helpText
|
|
20017
|
+
hideBorder
|
|
20018
|
+
id
|
|
20019
|
+
label
|
|
20020
|
+
labelExtra
|
|
20021
|
+
logicAction
|
|
20022
|
+
logicGroup
|
|
20023
|
+
mapTo
|
|
20024
|
+
options
|
|
20025
|
+
optional
|
|
20026
|
+
page
|
|
20027
|
+
role
|
|
20028
|
+
signer
|
|
20029
|
+
substantive
|
|
20030
|
+
validation
|
|
20031
|
+
value
|
|
20032
|
+
}
|
|
20033
|
+
totalCount
|
|
20034
|
+
}
|
|
20035
|
+
userSignatureConnection {
|
|
20036
|
+
userSignatureElements {
|
|
20037
|
+
id
|
|
20038
|
+
userId
|
|
20039
|
+
ax
|
|
20040
|
+
ay
|
|
20041
|
+
bx
|
|
20042
|
+
by
|
|
20043
|
+
page
|
|
20044
|
+
link
|
|
20045
|
+
}
|
|
20046
|
+
}
|
|
20017
20047
|
}
|
|
20018
20048
|
}
|
|
20019
20049
|
`;
|
|
20020
20050
|
};
|
|
20021
20051
|
|
|
20052
|
+
/**
|
|
20053
|
+
* This module contains all the rules required to mark a template
|
|
20054
|
+
* as valid.
|
|
20055
|
+
*
|
|
20056
|
+
*/
|
|
20057
|
+
function validate(t) {
|
|
20058
|
+
var errors = [];
|
|
20059
|
+
// Check for missing signatures
|
|
20060
|
+
t.roles.forEach(tr => {
|
|
20061
|
+
if (t.elementConnection.templateElements.filter(e => e.formElementType === 'signature' && e.signer === tr.signerIndex && tr.roleType !== 'APPROVER').length === 0) {
|
|
20062
|
+
errors.push({
|
|
20063
|
+
id: tr.id,
|
|
20064
|
+
title: 'Missing signature.',
|
|
20065
|
+
description: `{tr.name} is missing a signature.`,
|
|
20066
|
+
role: tr,
|
|
20067
|
+
});
|
|
20068
|
+
}
|
|
20069
|
+
});
|
|
20070
|
+
// Check for missing multi-select options
|
|
20071
|
+
t.elementConnection.templateElements.forEach(element => {
|
|
20072
|
+
if (element.validation === 20 && (!element.options || element.options.length === 0)) {
|
|
20073
|
+
errors.push({
|
|
20074
|
+
id: element.id,
|
|
20075
|
+
title: 'Missing options',
|
|
20076
|
+
description: `Drop down field "${element.label}" is missing options.`,
|
|
20077
|
+
element: element,
|
|
20078
|
+
});
|
|
20079
|
+
}
|
|
20080
|
+
});
|
|
20081
|
+
return errors;
|
|
20082
|
+
}
|
|
20083
|
+
|
|
20022
20084
|
/**
|
|
20023
20085
|
* These utils are used to make document-viewer more readable
|
|
20024
20086
|
* but they must be called using the bind() function so that
|
|
@@ -20064,19 +20126,23 @@ function matchData(data) {
|
|
|
20064
20126
|
fi.setAttribute('id', 'ls-field-' + id);
|
|
20065
20127
|
fi.dataItem = { ...data.obj, id };
|
|
20066
20128
|
}
|
|
20129
|
+
this.validationErrors = validate.bind(this)(this._template);
|
|
20067
20130
|
}
|
|
20068
20131
|
if (prefix === 'rol') {
|
|
20069
20132
|
syncRoles.bind(this)();
|
|
20070
20133
|
}
|
|
20071
20134
|
if (prefix === 'tpl') {
|
|
20072
20135
|
this._template = { ...this._template, ...data.obj };
|
|
20136
|
+
this.validationErrors = validate.bind(this)(this._template);
|
|
20073
20137
|
}
|
|
20074
20138
|
}
|
|
20075
20139
|
async function syncRoles() {
|
|
20076
20140
|
var participantManager = this.component.shadowRoot.getElementById('ls-participant-manager');
|
|
20077
|
-
const
|
|
20078
|
-
this.
|
|
20141
|
+
const tresult = (await this.adapter.execute(this.token, getTemplate(this.templateid)));
|
|
20142
|
+
this.parseTemplate(JSON.stringify(tresult.template));
|
|
20079
20143
|
participantManager.template = this._template;
|
|
20144
|
+
this.generateFields();
|
|
20145
|
+
this.validationErrors = validate.bind(this)(this._template);
|
|
20080
20146
|
}
|
|
20081
20147
|
// Utility function which extracts the type from any API id
|
|
20082
20148
|
function getApiType(obj) {
|
|
@@ -24477,95 +24543,55 @@ const deleteElement = obj => {
|
|
|
24477
24543
|
};
|
|
24478
24544
|
|
|
24479
24545
|
// Add a role
|
|
24480
|
-
const
|
|
24546
|
+
const createRole = (role) => {
|
|
24547
|
+
const newParent = role?.signerParent ? `"${role.signerParent}"` : 'null';
|
|
24481
24548
|
return `
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24549
|
+
mutation LDVAddRole {
|
|
24550
|
+
createTemplateRole(input: {
|
|
24551
|
+
templateId: "${role.templateId}"
|
|
24552
|
+
signerIndex: ${role.signerIndex}
|
|
24553
|
+
signerParent: ${newParent}
|
|
24554
|
+
name: ${JSON.stringify(role.name)}
|
|
24555
|
+
ordinal: ${role.ordinal}
|
|
24556
|
+
roleType: ${role.roleType}
|
|
24557
|
+
experience: "${role.experience}"
|
|
24558
|
+
})
|
|
24559
|
+
}`;
|
|
24492
24560
|
};
|
|
24493
|
-
|
|
24561
|
+
// Remove a role
|
|
24562
|
+
const deleteRole = (role) => {
|
|
24494
24563
|
return `
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24504
|
-
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
ax
|
|
24527
|
-
ay
|
|
24528
|
-
bx
|
|
24529
|
-
by
|
|
24530
|
-
elementType
|
|
24531
|
-
formElementType
|
|
24532
|
-
fieldOrder
|
|
24533
|
-
fontName
|
|
24534
|
-
fontSize
|
|
24535
|
-
helpText
|
|
24536
|
-
hideBorder
|
|
24537
|
-
id
|
|
24538
|
-
label
|
|
24539
|
-
labelExtra
|
|
24540
|
-
logicAction
|
|
24541
|
-
logicGroup
|
|
24542
|
-
mapTo
|
|
24543
|
-
options
|
|
24544
|
-
optional
|
|
24545
|
-
page
|
|
24546
|
-
role
|
|
24547
|
-
signer
|
|
24548
|
-
substantive
|
|
24549
|
-
validation
|
|
24550
|
-
value
|
|
24551
|
-
}
|
|
24552
|
-
totalCount
|
|
24553
|
-
}
|
|
24554
|
-
userSignatureConnection {
|
|
24555
|
-
userSignatureElements {
|
|
24556
|
-
id
|
|
24557
|
-
userId
|
|
24558
|
-
ax
|
|
24559
|
-
ay
|
|
24560
|
-
bx
|
|
24561
|
-
by
|
|
24562
|
-
page
|
|
24563
|
-
link
|
|
24564
|
-
}
|
|
24565
|
-
}
|
|
24566
|
-
}
|
|
24567
|
-
}
|
|
24568
|
-
`;
|
|
24564
|
+
mutation LDVremoveRole {
|
|
24565
|
+
deleteTemplateRole(input: {
|
|
24566
|
+
templateRoleId: "${role.id}"
|
|
24567
|
+
})
|
|
24568
|
+
}`;
|
|
24569
|
+
};
|
|
24570
|
+
// Save any changes to an role
|
|
24571
|
+
const updateRole = (role) => {
|
|
24572
|
+
const newParent = role?.signerParent ? `"${role.signerParent}"` : 'null';
|
|
24573
|
+
return `
|
|
24574
|
+
mutation LDVupdateRole {
|
|
24575
|
+
updateTemplateRole(input: {
|
|
24576
|
+
templateRoleId: "${role.id}"
|
|
24577
|
+
signerIndex: ${role.signerIndex}
|
|
24578
|
+
ordinal: ${role.ordinal}
|
|
24579
|
+
signerParent: ${newParent}
|
|
24580
|
+
name: ${JSON.stringify(role.name)}
|
|
24581
|
+
roleType: ${role.roleType}
|
|
24582
|
+
experience: "${role.experience}"
|
|
24583
|
+
})
|
|
24584
|
+
}`;
|
|
24585
|
+
};
|
|
24586
|
+
// swap two adjacent roles
|
|
24587
|
+
const swapRoles = (roleId1, roleId2) => {
|
|
24588
|
+
return `
|
|
24589
|
+
mutation LDVswapRole {
|
|
24590
|
+
swapRoles(input: {
|
|
24591
|
+
roleId1: "${roleId1.id}"
|
|
24592
|
+
roleId2: "${roleId2.id}"
|
|
24593
|
+
})
|
|
24594
|
+
}`;
|
|
24569
24595
|
};
|
|
24570
24596
|
|
|
24571
24597
|
class LsDocumentAdapter {
|
|
@@ -24746,38 +24772,6 @@ const getGroupData = (id) => {
|
|
|
24746
24772
|
`;
|
|
24747
24773
|
};
|
|
24748
24774
|
|
|
24749
|
-
/**
|
|
24750
|
-
* This module contains all the rules required to mark a template
|
|
24751
|
-
* as valid.
|
|
24752
|
-
*
|
|
24753
|
-
*/
|
|
24754
|
-
function validate(t) {
|
|
24755
|
-
var errors = [];
|
|
24756
|
-
// Check for missing signatures
|
|
24757
|
-
t.roles.forEach(tr => {
|
|
24758
|
-
if (t.elementConnection.templateElements.filter(e => e.formElementType === 'signature' && e.signer === tr.signerIndex && tr.roleType !== 'APPROVER').length === 0) {
|
|
24759
|
-
errors.push({
|
|
24760
|
-
id: tr.id,
|
|
24761
|
-
title: 'Missing signature.',
|
|
24762
|
-
description: `{tr.name} is missing a signature.`,
|
|
24763
|
-
role: tr
|
|
24764
|
-
});
|
|
24765
|
-
}
|
|
24766
|
-
});
|
|
24767
|
-
// Check for missing multi-select options
|
|
24768
|
-
t.elementConnection.templateElements.forEach(element => {
|
|
24769
|
-
if (element.validation === 20 && (!element.options || element.options.length === 0)) {
|
|
24770
|
-
errors.push({
|
|
24771
|
-
id: element.id,
|
|
24772
|
-
title: 'Missing options',
|
|
24773
|
-
description: `Drop down field "${element.label}" is missing options.`,
|
|
24774
|
-
element: element
|
|
24775
|
-
});
|
|
24776
|
-
}
|
|
24777
|
-
});
|
|
24778
|
-
return errors;
|
|
24779
|
-
}
|
|
24780
|
-
|
|
24781
24775
|
const lsDocumentViewerCss = "*,*::before,*::after{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion: no-preference){html{interpolate-size:allow-keywords}}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate}:host{display:flex;flex-direction:row;width:100vw;height:100vh;margin:0px;padding:0px}.validation-tag-wrapper{position:fixed;top:0.375rem;right:0.375rem;z-index:2000}#my-field-panel{position:relative;height:calc(100% - 4.313rem)}.leftBox{position:relative;border-radius:16px;border:1px solid var(--gray-30, #edeff2);background:var(--white, #fff);box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);width:21.25rem;margin:1rem;min-width:21.25rem;max-height:100%;z-index:1000;left:0;top:0}.left-box-inner{position:relative;display:flex;height:100%;padding:0.75rem;gap:0.75rem}.rightBox{width:200px;border:1px gray solid;width:470px;min-width:390px;padding:4px;font-family:inherit}.toolbox{display:flex;flex-direction:column;width:100%;height:100%;border-radius:8px;border:1px solid var(--gray-30, #e0e2e5);background:var(--gray-10, #f7f8fa);padding:0.75rem;gap:1rem;overflow-y:auto}.ls-editor-infobox{padding:2px 8px 2px 8px}#pdf-canvas{top:0px;left:0px;width:100px;height:100px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.12)}#ls-mid-area{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;width:100vw;height:100%}.document-frame-wrapper{display:flex;flex-direction:column;justify-content:start;align-items:start;overflow:visible;max-height:100%;width:100vw;overflow:scroll;padding:5rem 380px 2rem 380px}#ls-document-frame{position:relative;height:98vh;margin-right:auto;margin-left:auto}.prevButton{position:relative;bottom:30px}.nextButton{position:relative;bottom:30px}.fieldBox{z-index:1000}#ls-box-selector{position:absolute;visibility:hidden;background-color:transparent;border:1px rgba(71, 71, 71, 0.716) dashed}#ls-editor-form{display:flex;width:100vw;height:calc(100vh - 2.25rem);position:relative;background:var(--gray-10, #f7f8fa);box-shadow:0 2px 6px 0 rgba(0, 0, 0, 0.04) inset, 0 10px 15px 0 rgba(0, 0, 0, 0.04) inset}.hidden{visibility:hidden;display:none;width:0px}.toolbox-section-title{color:var(--gray-100, #45484d);font-size:1.125rem;font-style:normal;font-weight:500;line-height:1.75rem;}.toolbox-section-description{color:var(--gray-80, #5e6066);font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem}.fields-box{display:flex;flex-direction:column;gap:0.75rem}.page-header{display:flex;height:2.25rem;gap:0.5rem;padding:0.25rem 0.75rem;justify-content:center;align-items:center}.header-text-1{color:var(--gray-100, #45484d);font-size:0.875rem;font-style:normal;font-weight:500;line-height:1.25rem}.header-text-2{color:var(--gray-100, #45484d);font-size:0.875rem;font-style:normal;font-weight:400;line-height:1.25rem}.properties-header{display:flex;padding:1rem;gap:0.75rem;align-items:center;border-bottom:1px solid var(--gray-20, #edeff2)}.properties-header-title{color:var(--gray-100, #45484d);width:100%;font-size:1.5rem;font-style:normal;font-weight:500;line-height:2rem;}.properties-header-icon{display:flex;padding:0.5rem;border-radius:0.625rem;background:var(--primary-10, #eff4ff);color:var(--primary-60, #4456f6)}.expand-fields-row{display:flex;align-items:center;gap:0.5rem;padding:0.5rem;cursor:pointer;color:var(--gray-80, #6c6e73);font-size:0.875rem;font-style:normal;font-weight:500;line-height:1.25rem;}.expand-fields-row p{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:500;line-height:1.5rem;}p{color:var(--gray-80, #6c6e73);font-family:var(--font-family);font-size:var(--text-sm);font-style:normal;font-weight:400;line-height:var(--text-sm-line-height)}a{color:var(--primary-60, #4456f6);font-size:var(--text-sm);font-style:normal;font-weight:400;line-height:var(--text-sm-line-height);cursor:pointer}a:hover{text-decoration:underline;color:var(--primary-70, #2134dc)}.button-link,.button-link:hover{all:unset}select{appearance:none;height:36px}.input-wrapper{position:relative;width:fit-content}#selectorIcon{position:absolute;top:50%;right:0.675rem;transform:translateY(-50%);pointer-events:none;color:var(--gray-80, #6c6e73)}#selectLeadingIcon{position:absolute;top:50%;left:0.675rem;transform:translateY(-50%);pointer-events:none;color:var(--gray-80, #6c6e73)}.has-leading-icon{padding-left:2.5rem}input,select,textarea{border:1px solid var(--gray-40, #d8d9dc);box-shadow:0 1px 0.125rem rgba(0, 0, 0, 0.05);padding:0.5rem 0.75rem;font-family:var(--font-family);font-size:var(--text-sm);border-radius:0.5rem;color:var(--gray-100, #45484d);font-weight:400}input::placeholder,select::placeholder,textarea::placeholder{color:var(--gray-60, #afb0b2)}input:hover,select:hover,textarea:hover{border-color:var(--gray-50, #c8c9cc);background-color:var(--white, #fff)}input:focus,select:focus,textarea:focus{outline:none;box-shadow:0 0 0 0.25rem var(--primary-40, #79adfc);border-color:var(--primary-60, #4456f6);background-color:var(--white, #fff)}input:active,select:active,textarea:active{border-color:var(--primary-50, #5185ff)}input:disabled,select:disabled,textarea:disabled{cursor:not-allowed;background-color:var(--gray-10, #f7f8fa)}input[type='checkbox']{appearance:none;position:relative;height:1rem;width:1rem;padding:0.25rem;border-radius:var(--radius-sm);border:1px solid #d1d5db;background-color:#ffffff;cursor:pointer}input[type='checkbox']:checked,input[type='checkbox'].indeterminate{background-color:var(--primary-60, #4456f6);border:none}input[type='checkbox']:checked::after{content:'';position:absolute;top:45%;left:50%;transform:translate(-50%, -50%) rotate(-45deg) scale(-1, 1);width:0.5rem;height:0.25rem;border-bottom:0.125rem solid white;border-right:0.125rem solid white}input[type='checkbox'].indeterminate::after{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.5rem;height:0.125rem;background-color:white}input[type='checkbox']:checked:hover,input[type='checkbox'].indeterminate:hover{background-color:var(--primary-70, #2134dc);border:none}input[type='checkbox']:hover{border:1px solid #9ca3af}input[type='checkbox']:focus,input[type='checkbox']:active{outline:none;box-shadow:0 0 0 0.25rem var(--primary-20, #c7ddff);background-color:#f0f4f8}input[type='checkbox']:disabled{background-color:#f3f4f6;outline:none;cursor:not-allowed}input[type='checkbox']:disabled:checked{background-color:#e5e7eb;border:none;outline:none;cursor:not-allowed}.checkbox-container{display:flex;gap:0.5rem;width:100%}.checkbox-label{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:400;line-height:1rem}.form-label{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:500;line-height:1.5rem}.form-field{display:flex;flex-direction:column;gap:0.25rem;width:100%}.field-properties-outer{position:relative;height:100%}.loading-box{display:flex;justify-content:center;align-items:center;width:100%;height:100vh;color:var(--primary-60, #0c7cba)}button{border:0;appearance:button;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-lg);background-color:var(--primary-60, #4456f6);color:white;text-transform:capitalize;min-height:2.25rem;min-width:2.25rem}button.tertiaryGrey{border:1px solid var(--gray-40, #d8d9dc);background-color:white;color:var(--gray-80, #787a80)}button.tertiaryGrey:hover{border:1px solid var(--gray-50, #c8c9cc);background:var(--gray-10, #f7f8fa)}.button-group{display:flex;border-radius:0.5rem;border:1px solid var(--gray-30, #e0e2e5);background:var(--white, #ffffff);overflow:clip}.button-group button{display:flex;background:transparent;border-radius:unset;padding:0.25rem 0.75rem;min-width:2.156rem;min-height:unset;color:var(--gray-80, #6c6e73)}.button-group button:hover{background:var(--gray-10, #f7f8fa)}.button-group>:first-child{border-radius:0.5rem 0 0 0.5rem}.button-group>:last-child{border-radius:0 0.5rem 0.5rem 0}.button-group>:not(:first-child){border-left:1px solid var(--gray-30, #e0e2e5)}";
|
|
24782
24776
|
|
|
24783
24777
|
pdfExports.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.5.207/pdf.worker.min.js';
|
|
@@ -24954,13 +24948,11 @@ const LsDocumentViewer = class {
|
|
|
24954
24948
|
mutateHandler(event) {
|
|
24955
24949
|
if (this.token && this.adapter)
|
|
24956
24950
|
event.detail.forEach(me => this.adapter.handleEvent(me, this.token).then(result => matchData.bind(this)(result)));
|
|
24957
|
-
this.validationErrors = validate.bind(this)(this._template);
|
|
24958
24951
|
}
|
|
24959
24952
|
// Updates are internal event between LS controls not to be confused with mutate
|
|
24960
24953
|
updateHandler(event) {
|
|
24961
24954
|
if (event.detail)
|
|
24962
24955
|
event.detail.forEach(fx => this.syncChange(fx));
|
|
24963
|
-
this.validationErrors = validate.bind(this)(this._template);
|
|
24964
24956
|
}
|
|
24965
24957
|
// Updates are internal event between LS controls not to be confused with mutate
|
|
24966
24958
|
addParticpantHandler(event) {
|
|
@@ -25107,7 +25099,6 @@ const LsDocumentViewer = class {
|
|
|
25107
25099
|
elementConnection: { ...newTemplate.elementConnection, templateElements: fields },
|
|
25108
25100
|
roles: preparedRoles,
|
|
25109
25101
|
};
|
|
25110
|
-
console.log(this._template);
|
|
25111
25102
|
}
|
|
25112
25103
|
/**
|
|
25113
25104
|
* Render the page based on pageNumber
|
|
@@ -25193,6 +25184,8 @@ const LsDocumentViewer = class {
|
|
|
25193
25184
|
}
|
|
25194
25185
|
else if (update.action === 'delete') {
|
|
25195
25186
|
const fi = this.component.shadowRoot.getElementById('ls-field-' + update.data.id);
|
|
25187
|
+
const fields = this._template.elementConnection.templateElements;
|
|
25188
|
+
this._template = { ...this._template, elementConnection: { ...this._template.elementConnection, templateElements: fields.filter(f => f.id !== update.data.id) } };
|
|
25196
25189
|
this.component.shadowRoot.getElementById('ls-document-frame').removeChild(fi);
|
|
25197
25190
|
this.selected = [];
|
|
25198
25191
|
}
|
|
@@ -25200,6 +25193,7 @@ const LsDocumentViewer = class {
|
|
|
25200
25193
|
console.warn('Unrecognised action, check Legalesign documentation. `create`, `update` and `delete` allowed.');
|
|
25201
25194
|
}
|
|
25202
25195
|
}
|
|
25196
|
+
this.validationErrors = validate.bind(this)(this._template);
|
|
25203
25197
|
}
|
|
25204
25198
|
initViewer() {
|
|
25205
25199
|
// Generate a canvas to draw the background PDF on.
|
|
@@ -25223,7 +25217,14 @@ const LsDocumentViewer = class {
|
|
|
25223
25217
|
event.preventDefault();
|
|
25224
25218
|
});
|
|
25225
25219
|
dropTarget.addEventListener('drop', mouseDrop.bind(this));
|
|
25226
|
-
|
|
25220
|
+
this.generateFields();
|
|
25221
|
+
}
|
|
25222
|
+
// Generate all the field HTML elements that are required (for every page)
|
|
25223
|
+
generateFields(clearExisting = true) {
|
|
25224
|
+
if (clearExisting) {
|
|
25225
|
+
const fields = this.component.shadowRoot.querySelectorAll('ls-editor-field');
|
|
25226
|
+
fields.forEach(fi => this.component.shadowRoot.getElementById('ls-document-frame').removeChild(fi));
|
|
25227
|
+
}
|
|
25227
25228
|
this._template.elementConnection.templateElements.forEach(te => {
|
|
25228
25229
|
addField.bind(this)(this.component.shadowRoot.getElementById('ls-document-frame'), this.prepareElement(te));
|
|
25229
25230
|
});
|
|
@@ -25266,7 +25267,7 @@ const LsDocumentViewer = class {
|
|
|
25266
25267
|
});
|
|
25267
25268
|
}
|
|
25268
25269
|
render() {
|
|
25269
|
-
return (h(Host, { key: '
|
|
25270
|
+
return (h(Host, { key: '81fb162f62eee08b7e9608ab01a662b8692ced19' }, h(h.Fragment, null, this.isLoading && h("ls-page-loader", { key: '8d72275abac9bf7b7c60dc0f3bf359b61da2bfa8' }), h("div", { key: '9403504084bfeee0569896524971a8b0b1e7a227', class: 'validation-tag-wrapper' }, h("ls-validation-tag", { key: '989610b8316de91ccbde6ad01c13e8159edc584c', validationErrors: this.validationErrors })), h("div", { key: 'f22196cecc91276d4df7c632b5c4a9412f2a53eb', class: "page-header" }, h("p", { key: '5bda0c223072135232f648d28e59bd79145fe349', class: "header-text-1" }, "Template Creation"), h("p", { key: '129f5a82ea8e5afb4a992687e121bde326908b97' }, "/"), h("p", { key: 'e1f00b84543a3e8a9baee098742c6519d7d2bcde', class: "header-text-2" }, this._template?.title)), h("form", { key: '38f0cbd650c8f45a4b415ee20b5fc2dd73345442', id: "ls-editor-form" }, this.showtoolbox === true ? (h("div", { id: "ls-left-box", class: "leftBox" }, h("div", { class: !this.selected || this.selected.length === 0 ? 'left-box-inner' : 'hidden' }, h("ls-feature-column", { onManage: manager => {
|
|
25270
25271
|
if (manager.detail === 'document') {
|
|
25271
25272
|
var documentManager = this.component.shadowRoot.getElementById('ls-document-options');
|
|
25272
25273
|
documentManager.template = this._template;
|
|
@@ -25280,17 +25281,17 @@ const LsDocumentViewer = class {
|
|
|
25280
25281
|
this.handleSelectedField.bind(this)(event);
|
|
25281
25282
|
} })) : (h("ls-toolbox-field", { elementType: "auto sign", formElementType: "auto sign", label: "Auto Sign", defaultHeight: 27, defaultWidth: 120, validation: 3000, icon: "auto-sign", signer: this.signer, onSelected: event => {
|
|
25282
25283
|
this.handleSelectedField.bind(this)(event);
|
|
25283
|
-
} })), h("ls-toolbox-field", { elementType: "
|
|
25284
|
-
this.handleSelectedField.bind(this)(event);
|
|
25285
|
-
} }), h("ls-toolbox-field", { elementType: "date", formElementType: "date", label: "Date", defaultHeight: 27, defaultWidth: 80, validation: 2, icon: "calender", signer: this.signer, onSelected: event => {
|
|
25284
|
+
} })), h("ls-toolbox-field", { elementType: "text", formElementType: "text", label: "Text", defaultHeight: 27, defaultWidth: 100, validation: 0, icon: "text", signer: this.signer, onSelected: event => {
|
|
25286
25285
|
this.handleSelectedField.bind(this)(event);
|
|
25287
25286
|
} }), h("ls-toolbox-field", { elementType: "signing date", formElementType: "signing date", label: "Signing Date", defaultHeight: 27, defaultWidth: 120, validation: 30, icon: "auto-date", signer: this.signer, onSelected: event => {
|
|
25288
25287
|
this.handleSelectedField.bind(this)(event);
|
|
25288
|
+
} }), h("ls-toolbox-field", { elementType: "date", formElementType: "date", label: "Date", defaultHeight: 27, defaultWidth: 80, validation: 2, icon: "calender", signer: this.signer, onSelected: event => {
|
|
25289
|
+
this.handleSelectedField.bind(this)(event);
|
|
25289
25290
|
} }), h("ls-toolbox-field", { elementType: "email", formElementType: "email", label: "Email", defaultHeight: 27, defaultWidth: 120, validation: 1, icon: "at-symbol", signer: this.signer, onSelected: event => {
|
|
25290
25291
|
this.handleSelectedField.bind(this)(event);
|
|
25291
|
-
} }), h("ls-toolbox-field", { elementType: "
|
|
25292
|
+
} }), h("ls-toolbox-field", { elementType: "initials", formElementType: "initials", label: "Initials", defaultHeight: 27, defaultWidth: 120, validation: 2000, icon: "initials", signer: this.signer, onSelected: event => {
|
|
25292
25293
|
this.handleSelectedField.bind(this)(event);
|
|
25293
|
-
} }), h("div", { class:
|
|
25294
|
+
} }), h("div", { class: "fields-box" }, h("ls-toolbox-field", { elementType: "number", formElementType: "number", label: "Number", defaultHeight: 27, defaultWidth: 80, validation: 50, icon: "hashtag", signer: this.signer, onSelected: event => {
|
|
25294
25295
|
this.handleSelectedField.bind(this)(event);
|
|
25295
25296
|
} }), h("ls-toolbox-field", { elementType: "dropdown", formElementType: "dropdown", label: "Dropdown", defaultHeight: 27, defaultWidth: 80, validation: 20, icon: "hashtag", signer: this.signer, onSelected: event => {
|
|
25296
25297
|
this.handleSelectedField.bind(this)(event);
|
|
@@ -25302,10 +25303,10 @@ const LsDocumentViewer = class {
|
|
|
25302
25303
|
this.handleSelectedField.bind(this)(event);
|
|
25303
25304
|
} }), h("ls-toolbox-field", { elementType: "file", formElementType: "file", label: "File", defaultHeight: 27, defaultWidth: 120, validation: 74, icon: "upload", signer: this.signer, onSelected: event => {
|
|
25304
25305
|
this.handleSelectedField.bind(this)(event);
|
|
25305
|
-
} }))))
|
|
25306
|
+
} })))), h("ls-participant-manager", { id: "ls-participant-manager", class: this.manager === 'participant' ? 'toolbox' : 'hidden', editor: this }), h("ls-document-options", { id: "ls-document-options", class: this.manager === 'document' ? 'toolbox' : 'hidden' })), !this.displayTable && (h("div", { class: this.selected.length > 0 ? 'field-properties-outer' : 'hidden' }, h("div", { class: 'properties-header' }, h("div", { class: 'properties-header-icon' }, h("ls-icon", { name: "pre-filled-content" })), h("h1", { class: 'properties-header-title' }, "Field Properties"), h("button", { class: 'tertiaryGrey', onClick: e => {
|
|
25306
25307
|
this.selected = [];
|
|
25307
25308
|
e.preventDefault();
|
|
25308
|
-
} }, h("ls-icon", { name: "x", size: "20" }))), h("ls-field-properties", { id: "my-field-panel" }), h("slot", null))))) : (h(h.Fragment, null)), h("ls-toolbar", { key: '
|
|
25309
|
+
} }, h("ls-icon", { name: "x", size: "20" }))), h("ls-field-properties", { id: "my-field-panel" }), h("slot", null))))) : (h(h.Fragment, null)), h("ls-toolbar", { key: 'f64bad623489b4f7b56c08d7c1e1fbd2264df854', id: "ls-toolbar", template: this._template, editor: this, groupInfo: this.groupInfo }), h("div", { key: 'b1d691f755d4ea7a913ab5bf3b6d22bcc02e9464', id: "ls-mid-area" }, h("div", { key: '985b96b3b721d206a0e099ffef062f502d633b32', class: 'document-frame-wrapper', id: "document-frame-wrapper" }, h("div", { key: '85db5a30105e084d55e962c1a9d74b267d2a332f', id: "ls-document-frame" }, h("canvas", { key: '39041d335b556218f7fb2718e26d018ec596afe7', id: "pdf-canvas", class: this.displayTable || this.isLoading ? 'hidden' : '' }), h("ls-editor-table", { key: '1580ed3da6d3fd5a5ca81b0da0fb733e6a6ced1f', editor: this, class: this.displayTable ? '' : 'hidden' }), h("div", { key: '6282c570b3d0051adcf46642999516694f3f7996', id: "ls-box-selector" }))), h("ls-statusbar", { key: '236c388bea733eb6eef71e3ae0f8e97e20822261', editor: this }))))));
|
|
25309
25310
|
}
|
|
25310
25311
|
static get watchers() { return {
|
|
25311
25312
|
"mode": ["modeHandler"],
|
|
@@ -25893,10 +25894,14 @@ const LsFieldContent = class {
|
|
|
25893
25894
|
this.update.emit(diffs);
|
|
25894
25895
|
}, delay);
|
|
25895
25896
|
}
|
|
25897
|
+
supportsValue() {
|
|
25898
|
+
const typesWithValue = ["signature", "intials", "image", "file", "signing", "date", "autosign", "regex"];
|
|
25899
|
+
return !typesWithValue.includes(this.dataItem?.elementType);
|
|
25900
|
+
}
|
|
25896
25901
|
render() {
|
|
25897
|
-
return (h(Host, { key: '
|
|
25902
|
+
return (h(Host, { key: '20ce159dc4152f65e0b0210eccb2eab973af8241' }, h("ls-props-section", { key: 'c9d8025b354e166b16699ac10a7699d6a3780c03', sectionTitle: "Field Type", sectionDescription: "The Field you currently have selected" }, h("ls-field-type-display", { key: 'ff03c5571b4b19a22059d34eeea633568635bb9f', fieldType: this.dataItem?.elementType, assignee: this.dataItem?.signer })), h("ls-props-section", { key: '1dc8dd9b52e20ca794b8a326250ddf81b6bf9355', sectionTitle: "Required Field", row: true }, h("ls-toggle", { key: '1406c81a96e437b9f4757f6bd1654f7508387b61', id: "toggle-required", checked: !this.dataItem?.optional, onValueChange: (ev) => this.alter({ optional: !ev.detail }) })), h("ls-props-section", { key: 'e247625d206cf48ce9903f213bc3568d333e7b98', sectionTitle: "Field Label", sectionDescription: "Add a label to clarify the information required from the Recipient." }, h("input", { key: '8e94c624afc3af83fc448aed69af434cb9c43e35', value: this.dataItem?.label, placeholder: "eg. Sign Here", onInput: (e) => this.alter({ label: e.target.value }) })), this.supportsValue() && (h("ls-props-section", { key: 'b729f4eea9b1a6097f7efbb62178d8684c4fbca4', sectionTitle: "Value", sectionDescription: "A prefilled value that can be altered by the signer." }, h("input", { key: 'ac48703e8da2d666c6804ba050483255432bdb7c', value: this.dataItem?.value, placeholder: "e.g. Gordon Smith", onInput: (e) => this.alter({ value: e.target.value }) }))), this.dataItem.validation === 20 && (h("ls-props-section", { key: '9226d7ebef28ee13f365eb8d6e756a783550898e', sectionTitle: "Options", sectionDescription: "Define the options available in the dropdown. One option per line." }, h("textarea", { key: '0238600016c642bc0b9e3a44c083086bab56c063', value: this.dataItem?.options, placeholder: "Option 1\nOption 2\nOption 3", onInput: (e) => this.alter({ options: e.target.value }) }))), this.showValidationTypes && (h("ls-props-section", { key: '4651e3e667c092921f227badbb4286ff1b3c54ef', sectionTitle: "Content Format", sectionDescription: "Select the specific format you want the Recipient to enter." }, h("ls-input-wrapper", { key: 'b66ae98ebd1a27180c6099346fad20aafe677e5e', select: true }, h("select", { key: 'fec14e36d47672718cf656542c2447abd9358967', onChange: (ev) => this.alter({ validation: parseInt(ev.target.value) }) }, validationTypes
|
|
25898
25903
|
.filter(type => type.formType === this.dataItem?.elementType)
|
|
25899
|
-
.map(type => (h("option", { selected: this.dataItem?.validation === type.id, value: type.id }, type.description))))))), h("slot", { key: '
|
|
25904
|
+
.map(type => (h("option", { selected: this.dataItem?.validation === type.id, value: type.id }, type.description))))))), h("slot", { key: '8b96944ac071c6b4041d3389cefe8e4712c984fb' })));
|
|
25900
25905
|
}
|
|
25901
25906
|
};
|
|
25902
25907
|
LsFieldContent.style = lsFieldContentCss;
|
|
@@ -34275,6 +34280,1515 @@ const LsToolboxField = class {
|
|
|
34275
34280
|
};
|
|
34276
34281
|
LsToolboxField.style = lsToolboxFieldCss;
|
|
34277
34282
|
|
|
34283
|
+
/**
|
|
34284
|
+
* Custom positioning reference element.
|
|
34285
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
34286
|
+
*/
|
|
34287
|
+
|
|
34288
|
+
const min = Math.min;
|
|
34289
|
+
const max = Math.max;
|
|
34290
|
+
const round = Math.round;
|
|
34291
|
+
const createCoords = v => ({
|
|
34292
|
+
x: v,
|
|
34293
|
+
y: v
|
|
34294
|
+
});
|
|
34295
|
+
const oppositeSideMap = {
|
|
34296
|
+
left: 'right',
|
|
34297
|
+
right: 'left',
|
|
34298
|
+
bottom: 'top',
|
|
34299
|
+
top: 'bottom'
|
|
34300
|
+
};
|
|
34301
|
+
const oppositeAlignmentMap = {
|
|
34302
|
+
start: 'end',
|
|
34303
|
+
end: 'start'
|
|
34304
|
+
};
|
|
34305
|
+
function clamp(start, value, end) {
|
|
34306
|
+
return max(start, min(value, end));
|
|
34307
|
+
}
|
|
34308
|
+
function evaluate(value, param) {
|
|
34309
|
+
return typeof value === 'function' ? value(param) : value;
|
|
34310
|
+
}
|
|
34311
|
+
function getSide(placement) {
|
|
34312
|
+
return placement.split('-')[0];
|
|
34313
|
+
}
|
|
34314
|
+
function getAlignment(placement) {
|
|
34315
|
+
return placement.split('-')[1];
|
|
34316
|
+
}
|
|
34317
|
+
function getOppositeAxis(axis) {
|
|
34318
|
+
return axis === 'x' ? 'y' : 'x';
|
|
34319
|
+
}
|
|
34320
|
+
function getAxisLength(axis) {
|
|
34321
|
+
return axis === 'y' ? 'height' : 'width';
|
|
34322
|
+
}
|
|
34323
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
34324
|
+
function getSideAxis(placement) {
|
|
34325
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
34326
|
+
}
|
|
34327
|
+
function getAlignmentAxis(placement) {
|
|
34328
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
34329
|
+
}
|
|
34330
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
34331
|
+
if (rtl === void 0) {
|
|
34332
|
+
rtl = false;
|
|
34333
|
+
}
|
|
34334
|
+
const alignment = getAlignment(placement);
|
|
34335
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
34336
|
+
const length = getAxisLength(alignmentAxis);
|
|
34337
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
34338
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
34339
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
34340
|
+
}
|
|
34341
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
34342
|
+
}
|
|
34343
|
+
function getExpandedPlacements(placement) {
|
|
34344
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
34345
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
34346
|
+
}
|
|
34347
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
34348
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
34349
|
+
}
|
|
34350
|
+
const lrPlacement = ['left', 'right'];
|
|
34351
|
+
const rlPlacement = ['right', 'left'];
|
|
34352
|
+
const tbPlacement = ['top', 'bottom'];
|
|
34353
|
+
const btPlacement = ['bottom', 'top'];
|
|
34354
|
+
function getSideList(side, isStart, rtl) {
|
|
34355
|
+
switch (side) {
|
|
34356
|
+
case 'top':
|
|
34357
|
+
case 'bottom':
|
|
34358
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
34359
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
34360
|
+
case 'left':
|
|
34361
|
+
case 'right':
|
|
34362
|
+
return isStart ? tbPlacement : btPlacement;
|
|
34363
|
+
default:
|
|
34364
|
+
return [];
|
|
34365
|
+
}
|
|
34366
|
+
}
|
|
34367
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
34368
|
+
const alignment = getAlignment(placement);
|
|
34369
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
34370
|
+
if (alignment) {
|
|
34371
|
+
list = list.map(side => side + "-" + alignment);
|
|
34372
|
+
if (flipAlignment) {
|
|
34373
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
34374
|
+
}
|
|
34375
|
+
}
|
|
34376
|
+
return list;
|
|
34377
|
+
}
|
|
34378
|
+
function getOppositePlacement(placement) {
|
|
34379
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
34380
|
+
}
|
|
34381
|
+
function expandPaddingObject(padding) {
|
|
34382
|
+
return {
|
|
34383
|
+
top: 0,
|
|
34384
|
+
right: 0,
|
|
34385
|
+
bottom: 0,
|
|
34386
|
+
left: 0,
|
|
34387
|
+
...padding
|
|
34388
|
+
};
|
|
34389
|
+
}
|
|
34390
|
+
function getPaddingObject(padding) {
|
|
34391
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
34392
|
+
top: padding,
|
|
34393
|
+
right: padding,
|
|
34394
|
+
bottom: padding,
|
|
34395
|
+
left: padding
|
|
34396
|
+
};
|
|
34397
|
+
}
|
|
34398
|
+
function rectToClientRect(rect) {
|
|
34399
|
+
const {
|
|
34400
|
+
x,
|
|
34401
|
+
y,
|
|
34402
|
+
width,
|
|
34403
|
+
height
|
|
34404
|
+
} = rect;
|
|
34405
|
+
return {
|
|
34406
|
+
width,
|
|
34407
|
+
height,
|
|
34408
|
+
top: y,
|
|
34409
|
+
left: x,
|
|
34410
|
+
right: x + width,
|
|
34411
|
+
bottom: y + height,
|
|
34412
|
+
x,
|
|
34413
|
+
y
|
|
34414
|
+
};
|
|
34415
|
+
}
|
|
34416
|
+
|
|
34417
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
34418
|
+
let {
|
|
34419
|
+
reference,
|
|
34420
|
+
floating
|
|
34421
|
+
} = _ref;
|
|
34422
|
+
const sideAxis = getSideAxis(placement);
|
|
34423
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
34424
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
34425
|
+
const side = getSide(placement);
|
|
34426
|
+
const isVertical = sideAxis === 'y';
|
|
34427
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
34428
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
34429
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
34430
|
+
let coords;
|
|
34431
|
+
switch (side) {
|
|
34432
|
+
case 'top':
|
|
34433
|
+
coords = {
|
|
34434
|
+
x: commonX,
|
|
34435
|
+
y: reference.y - floating.height
|
|
34436
|
+
};
|
|
34437
|
+
break;
|
|
34438
|
+
case 'bottom':
|
|
34439
|
+
coords = {
|
|
34440
|
+
x: commonX,
|
|
34441
|
+
y: reference.y + reference.height
|
|
34442
|
+
};
|
|
34443
|
+
break;
|
|
34444
|
+
case 'right':
|
|
34445
|
+
coords = {
|
|
34446
|
+
x: reference.x + reference.width,
|
|
34447
|
+
y: commonY
|
|
34448
|
+
};
|
|
34449
|
+
break;
|
|
34450
|
+
case 'left':
|
|
34451
|
+
coords = {
|
|
34452
|
+
x: reference.x - floating.width,
|
|
34453
|
+
y: commonY
|
|
34454
|
+
};
|
|
34455
|
+
break;
|
|
34456
|
+
default:
|
|
34457
|
+
coords = {
|
|
34458
|
+
x: reference.x,
|
|
34459
|
+
y: reference.y
|
|
34460
|
+
};
|
|
34461
|
+
}
|
|
34462
|
+
switch (getAlignment(placement)) {
|
|
34463
|
+
case 'start':
|
|
34464
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
34465
|
+
break;
|
|
34466
|
+
case 'end':
|
|
34467
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
34468
|
+
break;
|
|
34469
|
+
}
|
|
34470
|
+
return coords;
|
|
34471
|
+
}
|
|
34472
|
+
|
|
34473
|
+
/**
|
|
34474
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
34475
|
+
* next to a given reference element.
|
|
34476
|
+
*
|
|
34477
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
34478
|
+
* write one for the platform you are using Floating UI with.
|
|
34479
|
+
*/
|
|
34480
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
34481
|
+
const {
|
|
34482
|
+
placement = 'bottom',
|
|
34483
|
+
strategy = 'absolute',
|
|
34484
|
+
middleware = [],
|
|
34485
|
+
platform
|
|
34486
|
+
} = config;
|
|
34487
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
34488
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
34489
|
+
let rects = await platform.getElementRects({
|
|
34490
|
+
reference,
|
|
34491
|
+
floating,
|
|
34492
|
+
strategy
|
|
34493
|
+
});
|
|
34494
|
+
let {
|
|
34495
|
+
x,
|
|
34496
|
+
y
|
|
34497
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
34498
|
+
let statefulPlacement = placement;
|
|
34499
|
+
let middlewareData = {};
|
|
34500
|
+
let resetCount = 0;
|
|
34501
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
34502
|
+
const {
|
|
34503
|
+
name,
|
|
34504
|
+
fn
|
|
34505
|
+
} = validMiddleware[i];
|
|
34506
|
+
const {
|
|
34507
|
+
x: nextX,
|
|
34508
|
+
y: nextY,
|
|
34509
|
+
data,
|
|
34510
|
+
reset
|
|
34511
|
+
} = await fn({
|
|
34512
|
+
x,
|
|
34513
|
+
y,
|
|
34514
|
+
initialPlacement: placement,
|
|
34515
|
+
placement: statefulPlacement,
|
|
34516
|
+
strategy,
|
|
34517
|
+
middlewareData,
|
|
34518
|
+
rects,
|
|
34519
|
+
platform,
|
|
34520
|
+
elements: {
|
|
34521
|
+
reference,
|
|
34522
|
+
floating
|
|
34523
|
+
}
|
|
34524
|
+
});
|
|
34525
|
+
x = nextX != null ? nextX : x;
|
|
34526
|
+
y = nextY != null ? nextY : y;
|
|
34527
|
+
middlewareData = {
|
|
34528
|
+
...middlewareData,
|
|
34529
|
+
[name]: {
|
|
34530
|
+
...middlewareData[name],
|
|
34531
|
+
...data
|
|
34532
|
+
}
|
|
34533
|
+
};
|
|
34534
|
+
if (reset && resetCount <= 50) {
|
|
34535
|
+
resetCount++;
|
|
34536
|
+
if (typeof reset === 'object') {
|
|
34537
|
+
if (reset.placement) {
|
|
34538
|
+
statefulPlacement = reset.placement;
|
|
34539
|
+
}
|
|
34540
|
+
if (reset.rects) {
|
|
34541
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
34542
|
+
reference,
|
|
34543
|
+
floating,
|
|
34544
|
+
strategy
|
|
34545
|
+
}) : reset.rects;
|
|
34546
|
+
}
|
|
34547
|
+
({
|
|
34548
|
+
x,
|
|
34549
|
+
y
|
|
34550
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
34551
|
+
}
|
|
34552
|
+
i = -1;
|
|
34553
|
+
}
|
|
34554
|
+
}
|
|
34555
|
+
return {
|
|
34556
|
+
x,
|
|
34557
|
+
y,
|
|
34558
|
+
placement: statefulPlacement,
|
|
34559
|
+
strategy,
|
|
34560
|
+
middlewareData
|
|
34561
|
+
};
|
|
34562
|
+
};
|
|
34563
|
+
|
|
34564
|
+
/**
|
|
34565
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
34566
|
+
* element is overflowing a given clipping boundary on each side.
|
|
34567
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
34568
|
+
* - negative = how many pixels left before it will overflow
|
|
34569
|
+
* - 0 = lies flush with the boundary
|
|
34570
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
34571
|
+
*/
|
|
34572
|
+
async function detectOverflow(state, options) {
|
|
34573
|
+
var _await$platform$isEle;
|
|
34574
|
+
if (options === void 0) {
|
|
34575
|
+
options = {};
|
|
34576
|
+
}
|
|
34577
|
+
const {
|
|
34578
|
+
x,
|
|
34579
|
+
y,
|
|
34580
|
+
platform,
|
|
34581
|
+
rects,
|
|
34582
|
+
elements,
|
|
34583
|
+
strategy
|
|
34584
|
+
} = state;
|
|
34585
|
+
const {
|
|
34586
|
+
boundary = 'clippingAncestors',
|
|
34587
|
+
rootBoundary = 'viewport',
|
|
34588
|
+
elementContext = 'floating',
|
|
34589
|
+
altBoundary = false,
|
|
34590
|
+
padding = 0
|
|
34591
|
+
} = evaluate(options, state);
|
|
34592
|
+
const paddingObject = getPaddingObject(padding);
|
|
34593
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
34594
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
34595
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
34596
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
34597
|
+
boundary,
|
|
34598
|
+
rootBoundary,
|
|
34599
|
+
strategy
|
|
34600
|
+
}));
|
|
34601
|
+
const rect = elementContext === 'floating' ? {
|
|
34602
|
+
x,
|
|
34603
|
+
y,
|
|
34604
|
+
width: rects.floating.width,
|
|
34605
|
+
height: rects.floating.height
|
|
34606
|
+
} : rects.reference;
|
|
34607
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
34608
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
34609
|
+
x: 1,
|
|
34610
|
+
y: 1
|
|
34611
|
+
} : {
|
|
34612
|
+
x: 1,
|
|
34613
|
+
y: 1
|
|
34614
|
+
};
|
|
34615
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
34616
|
+
elements,
|
|
34617
|
+
rect,
|
|
34618
|
+
offsetParent,
|
|
34619
|
+
strategy
|
|
34620
|
+
}) : rect);
|
|
34621
|
+
return {
|
|
34622
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
34623
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
34624
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
34625
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
34626
|
+
};
|
|
34627
|
+
}
|
|
34628
|
+
|
|
34629
|
+
/**
|
|
34630
|
+
* Provides data to position an inner element of the floating element so that it
|
|
34631
|
+
* appears centered to the reference element.
|
|
34632
|
+
* @see https://floating-ui.com/docs/arrow
|
|
34633
|
+
*/
|
|
34634
|
+
const arrow$1 = options => ({
|
|
34635
|
+
name: 'arrow',
|
|
34636
|
+
options,
|
|
34637
|
+
async fn(state) {
|
|
34638
|
+
const {
|
|
34639
|
+
x,
|
|
34640
|
+
y,
|
|
34641
|
+
placement,
|
|
34642
|
+
rects,
|
|
34643
|
+
platform,
|
|
34644
|
+
elements,
|
|
34645
|
+
middlewareData
|
|
34646
|
+
} = state;
|
|
34647
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
34648
|
+
const {
|
|
34649
|
+
element,
|
|
34650
|
+
padding = 0
|
|
34651
|
+
} = evaluate(options, state) || {};
|
|
34652
|
+
if (element == null) {
|
|
34653
|
+
return {};
|
|
34654
|
+
}
|
|
34655
|
+
const paddingObject = getPaddingObject(padding);
|
|
34656
|
+
const coords = {
|
|
34657
|
+
x,
|
|
34658
|
+
y
|
|
34659
|
+
};
|
|
34660
|
+
const axis = getAlignmentAxis(placement);
|
|
34661
|
+
const length = getAxisLength(axis);
|
|
34662
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
34663
|
+
const isYAxis = axis === 'y';
|
|
34664
|
+
const minProp = isYAxis ? 'top' : 'left';
|
|
34665
|
+
const maxProp = isYAxis ? 'bottom' : 'right';
|
|
34666
|
+
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
|
|
34667
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
34668
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
34669
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
34670
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
34671
|
+
|
|
34672
|
+
// DOM platform can return `window` as the `offsetParent`.
|
|
34673
|
+
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
|
|
34674
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
34675
|
+
}
|
|
34676
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
34677
|
+
|
|
34678
|
+
// If the padding is large enough that it causes the arrow to no longer be
|
|
34679
|
+
// centered, modify the padding so that it is centered.
|
|
34680
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
34681
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
34682
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
34683
|
+
|
|
34684
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
34685
|
+
// point is outside the floating element's bounds.
|
|
34686
|
+
const min$1 = minPadding;
|
|
34687
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
34688
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
34689
|
+
const offset = clamp(min$1, center, max);
|
|
34690
|
+
|
|
34691
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
34692
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
34693
|
+
// floating element itself. To ensure `shift()` continues to take action,
|
|
34694
|
+
// a single reset is performed when this is true.
|
|
34695
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
34696
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
34697
|
+
return {
|
|
34698
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
34699
|
+
data: {
|
|
34700
|
+
[axis]: offset,
|
|
34701
|
+
centerOffset: center - offset - alignmentOffset,
|
|
34702
|
+
...(shouldAddOffset && {
|
|
34703
|
+
alignmentOffset
|
|
34704
|
+
})
|
|
34705
|
+
},
|
|
34706
|
+
reset: shouldAddOffset
|
|
34707
|
+
};
|
|
34708
|
+
}
|
|
34709
|
+
});
|
|
34710
|
+
|
|
34711
|
+
/**
|
|
34712
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
34713
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
34714
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
34715
|
+
* @see https://floating-ui.com/docs/flip
|
|
34716
|
+
*/
|
|
34717
|
+
const flip$1 = function (options) {
|
|
34718
|
+
if (options === void 0) {
|
|
34719
|
+
options = {};
|
|
34720
|
+
}
|
|
34721
|
+
return {
|
|
34722
|
+
name: 'flip',
|
|
34723
|
+
options,
|
|
34724
|
+
async fn(state) {
|
|
34725
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
34726
|
+
const {
|
|
34727
|
+
placement,
|
|
34728
|
+
middlewareData,
|
|
34729
|
+
rects,
|
|
34730
|
+
initialPlacement,
|
|
34731
|
+
platform,
|
|
34732
|
+
elements
|
|
34733
|
+
} = state;
|
|
34734
|
+
const {
|
|
34735
|
+
mainAxis: checkMainAxis = true,
|
|
34736
|
+
crossAxis: checkCrossAxis = true,
|
|
34737
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
34738
|
+
fallbackStrategy = 'bestFit',
|
|
34739
|
+
fallbackAxisSideDirection = 'none',
|
|
34740
|
+
flipAlignment = true,
|
|
34741
|
+
...detectOverflowOptions
|
|
34742
|
+
} = evaluate(options, state);
|
|
34743
|
+
|
|
34744
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
34745
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
34746
|
+
// work.
|
|
34747
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
34748
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
34749
|
+
return {};
|
|
34750
|
+
}
|
|
34751
|
+
const side = getSide(placement);
|
|
34752
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
34753
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
34754
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
34755
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
34756
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
34757
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
34758
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
34759
|
+
}
|
|
34760
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
34761
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
34762
|
+
const overflows = [];
|
|
34763
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
34764
|
+
if (checkMainAxis) {
|
|
34765
|
+
overflows.push(overflow[side]);
|
|
34766
|
+
}
|
|
34767
|
+
if (checkCrossAxis) {
|
|
34768
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
34769
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
34770
|
+
}
|
|
34771
|
+
overflowsData = [...overflowsData, {
|
|
34772
|
+
placement,
|
|
34773
|
+
overflows
|
|
34774
|
+
}];
|
|
34775
|
+
|
|
34776
|
+
// One or more sides is overflowing.
|
|
34777
|
+
if (!overflows.every(side => side <= 0)) {
|
|
34778
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
34779
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
34780
|
+
const nextPlacement = placements[nextIndex];
|
|
34781
|
+
if (nextPlacement) {
|
|
34782
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
34783
|
+
if (!ignoreCrossAxisOverflow ||
|
|
34784
|
+
// We leave the current main axis only if every placement on that axis
|
|
34785
|
+
// overflows the main axis.
|
|
34786
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
34787
|
+
// Try next placement and re-run the lifecycle.
|
|
34788
|
+
return {
|
|
34789
|
+
data: {
|
|
34790
|
+
index: nextIndex,
|
|
34791
|
+
overflows: overflowsData
|
|
34792
|
+
},
|
|
34793
|
+
reset: {
|
|
34794
|
+
placement: nextPlacement
|
|
34795
|
+
}
|
|
34796
|
+
};
|
|
34797
|
+
}
|
|
34798
|
+
}
|
|
34799
|
+
|
|
34800
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
34801
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
34802
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
34803
|
+
|
|
34804
|
+
// Otherwise fallback.
|
|
34805
|
+
if (!resetPlacement) {
|
|
34806
|
+
switch (fallbackStrategy) {
|
|
34807
|
+
case 'bestFit':
|
|
34808
|
+
{
|
|
34809
|
+
var _overflowsData$filter2;
|
|
34810
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
34811
|
+
if (hasFallbackAxisSideDirection) {
|
|
34812
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
34813
|
+
return currentSideAxis === initialSideAxis ||
|
|
34814
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
34815
|
+
// reading directions favoring greater width.
|
|
34816
|
+
currentSideAxis === 'y';
|
|
34817
|
+
}
|
|
34818
|
+
return true;
|
|
34819
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
34820
|
+
if (placement) {
|
|
34821
|
+
resetPlacement = placement;
|
|
34822
|
+
}
|
|
34823
|
+
break;
|
|
34824
|
+
}
|
|
34825
|
+
case 'initialPlacement':
|
|
34826
|
+
resetPlacement = initialPlacement;
|
|
34827
|
+
break;
|
|
34828
|
+
}
|
|
34829
|
+
}
|
|
34830
|
+
if (placement !== resetPlacement) {
|
|
34831
|
+
return {
|
|
34832
|
+
reset: {
|
|
34833
|
+
placement: resetPlacement
|
|
34834
|
+
}
|
|
34835
|
+
};
|
|
34836
|
+
}
|
|
34837
|
+
}
|
|
34838
|
+
return {};
|
|
34839
|
+
}
|
|
34840
|
+
};
|
|
34841
|
+
};
|
|
34842
|
+
|
|
34843
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
34844
|
+
|
|
34845
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
34846
|
+
// Derivable.
|
|
34847
|
+
|
|
34848
|
+
async function convertValueToCoords(state, options) {
|
|
34849
|
+
const {
|
|
34850
|
+
placement,
|
|
34851
|
+
platform,
|
|
34852
|
+
elements
|
|
34853
|
+
} = state;
|
|
34854
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
34855
|
+
const side = getSide(placement);
|
|
34856
|
+
const alignment = getAlignment(placement);
|
|
34857
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
34858
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
34859
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
34860
|
+
const rawValue = evaluate(options, state);
|
|
34861
|
+
|
|
34862
|
+
// eslint-disable-next-line prefer-const
|
|
34863
|
+
let {
|
|
34864
|
+
mainAxis,
|
|
34865
|
+
crossAxis,
|
|
34866
|
+
alignmentAxis
|
|
34867
|
+
} = typeof rawValue === 'number' ? {
|
|
34868
|
+
mainAxis: rawValue,
|
|
34869
|
+
crossAxis: 0,
|
|
34870
|
+
alignmentAxis: null
|
|
34871
|
+
} : {
|
|
34872
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
34873
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
34874
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
34875
|
+
};
|
|
34876
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
34877
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
34878
|
+
}
|
|
34879
|
+
return isVertical ? {
|
|
34880
|
+
x: crossAxis * crossAxisMulti,
|
|
34881
|
+
y: mainAxis * mainAxisMulti
|
|
34882
|
+
} : {
|
|
34883
|
+
x: mainAxis * mainAxisMulti,
|
|
34884
|
+
y: crossAxis * crossAxisMulti
|
|
34885
|
+
};
|
|
34886
|
+
}
|
|
34887
|
+
|
|
34888
|
+
/**
|
|
34889
|
+
* Modifies the placement by translating the floating element along the
|
|
34890
|
+
* specified axes.
|
|
34891
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
34892
|
+
* object may be passed.
|
|
34893
|
+
* @see https://floating-ui.com/docs/offset
|
|
34894
|
+
*/
|
|
34895
|
+
const offset$1 = function (options) {
|
|
34896
|
+
if (options === void 0) {
|
|
34897
|
+
options = 0;
|
|
34898
|
+
}
|
|
34899
|
+
return {
|
|
34900
|
+
name: 'offset',
|
|
34901
|
+
options,
|
|
34902
|
+
async fn(state) {
|
|
34903
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
34904
|
+
const {
|
|
34905
|
+
x,
|
|
34906
|
+
y,
|
|
34907
|
+
placement,
|
|
34908
|
+
middlewareData
|
|
34909
|
+
} = state;
|
|
34910
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
34911
|
+
|
|
34912
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
34913
|
+
// then we don't need to change the positioning coordinates.
|
|
34914
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
34915
|
+
return {};
|
|
34916
|
+
}
|
|
34917
|
+
return {
|
|
34918
|
+
x: x + diffCoords.x,
|
|
34919
|
+
y: y + diffCoords.y,
|
|
34920
|
+
data: {
|
|
34921
|
+
...diffCoords,
|
|
34922
|
+
placement
|
|
34923
|
+
}
|
|
34924
|
+
};
|
|
34925
|
+
}
|
|
34926
|
+
};
|
|
34927
|
+
};
|
|
34928
|
+
|
|
34929
|
+
/**
|
|
34930
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
34931
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
34932
|
+
* @see https://floating-ui.com/docs/shift
|
|
34933
|
+
*/
|
|
34934
|
+
const shift$1 = function (options) {
|
|
34935
|
+
if (options === void 0) {
|
|
34936
|
+
options = {};
|
|
34937
|
+
}
|
|
34938
|
+
return {
|
|
34939
|
+
name: 'shift',
|
|
34940
|
+
options,
|
|
34941
|
+
async fn(state) {
|
|
34942
|
+
const {
|
|
34943
|
+
x,
|
|
34944
|
+
y,
|
|
34945
|
+
placement
|
|
34946
|
+
} = state;
|
|
34947
|
+
const {
|
|
34948
|
+
mainAxis: checkMainAxis = true,
|
|
34949
|
+
crossAxis: checkCrossAxis = false,
|
|
34950
|
+
limiter = {
|
|
34951
|
+
fn: _ref => {
|
|
34952
|
+
let {
|
|
34953
|
+
x,
|
|
34954
|
+
y
|
|
34955
|
+
} = _ref;
|
|
34956
|
+
return {
|
|
34957
|
+
x,
|
|
34958
|
+
y
|
|
34959
|
+
};
|
|
34960
|
+
}
|
|
34961
|
+
},
|
|
34962
|
+
...detectOverflowOptions
|
|
34963
|
+
} = evaluate(options, state);
|
|
34964
|
+
const coords = {
|
|
34965
|
+
x,
|
|
34966
|
+
y
|
|
34967
|
+
};
|
|
34968
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
34969
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
34970
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
34971
|
+
let mainAxisCoord = coords[mainAxis];
|
|
34972
|
+
let crossAxisCoord = coords[crossAxis];
|
|
34973
|
+
if (checkMainAxis) {
|
|
34974
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
34975
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
34976
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
34977
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
34978
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
34979
|
+
}
|
|
34980
|
+
if (checkCrossAxis) {
|
|
34981
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
34982
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
34983
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
34984
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
34985
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
34986
|
+
}
|
|
34987
|
+
const limitedCoords = limiter.fn({
|
|
34988
|
+
...state,
|
|
34989
|
+
[mainAxis]: mainAxisCoord,
|
|
34990
|
+
[crossAxis]: crossAxisCoord
|
|
34991
|
+
});
|
|
34992
|
+
return {
|
|
34993
|
+
...limitedCoords,
|
|
34994
|
+
data: {
|
|
34995
|
+
x: limitedCoords.x - x,
|
|
34996
|
+
y: limitedCoords.y - y,
|
|
34997
|
+
enabled: {
|
|
34998
|
+
[mainAxis]: checkMainAxis,
|
|
34999
|
+
[crossAxis]: checkCrossAxis
|
|
35000
|
+
}
|
|
35001
|
+
}
|
|
35002
|
+
};
|
|
35003
|
+
}
|
|
35004
|
+
};
|
|
35005
|
+
};
|
|
35006
|
+
|
|
35007
|
+
function hasWindow() {
|
|
35008
|
+
return typeof window !== 'undefined';
|
|
35009
|
+
}
|
|
35010
|
+
function getNodeName(node) {
|
|
35011
|
+
if (isNode(node)) {
|
|
35012
|
+
return (node.nodeName || '').toLowerCase();
|
|
35013
|
+
}
|
|
35014
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
35015
|
+
// returning `#document` an infinite loop won't occur.
|
|
35016
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
35017
|
+
return '#document';
|
|
35018
|
+
}
|
|
35019
|
+
function getWindow(node) {
|
|
35020
|
+
var _node$ownerDocument;
|
|
35021
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
35022
|
+
}
|
|
35023
|
+
function getDocumentElement(node) {
|
|
35024
|
+
var _ref;
|
|
35025
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
35026
|
+
}
|
|
35027
|
+
function isNode(value) {
|
|
35028
|
+
if (!hasWindow()) {
|
|
35029
|
+
return false;
|
|
35030
|
+
}
|
|
35031
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
35032
|
+
}
|
|
35033
|
+
function isElement(value) {
|
|
35034
|
+
if (!hasWindow()) {
|
|
35035
|
+
return false;
|
|
35036
|
+
}
|
|
35037
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
35038
|
+
}
|
|
35039
|
+
function isHTMLElement(value) {
|
|
35040
|
+
if (!hasWindow()) {
|
|
35041
|
+
return false;
|
|
35042
|
+
}
|
|
35043
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
35044
|
+
}
|
|
35045
|
+
function isShadowRoot(value) {
|
|
35046
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
35047
|
+
return false;
|
|
35048
|
+
}
|
|
35049
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
35050
|
+
}
|
|
35051
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
35052
|
+
function isOverflowElement(element) {
|
|
35053
|
+
const {
|
|
35054
|
+
overflow,
|
|
35055
|
+
overflowX,
|
|
35056
|
+
overflowY,
|
|
35057
|
+
display
|
|
35058
|
+
} = getComputedStyle$1(element);
|
|
35059
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
35060
|
+
}
|
|
35061
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
35062
|
+
function isTableElement(element) {
|
|
35063
|
+
return tableElements.has(getNodeName(element));
|
|
35064
|
+
}
|
|
35065
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
35066
|
+
function isTopLayer(element) {
|
|
35067
|
+
return topLayerSelectors.some(selector => {
|
|
35068
|
+
try {
|
|
35069
|
+
return element.matches(selector);
|
|
35070
|
+
} catch (_e) {
|
|
35071
|
+
return false;
|
|
35072
|
+
}
|
|
35073
|
+
});
|
|
35074
|
+
}
|
|
35075
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
35076
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
35077
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
35078
|
+
function isContainingBlock(elementOrCss) {
|
|
35079
|
+
const webkit = isWebKit();
|
|
35080
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
35081
|
+
|
|
35082
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
35083
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
35084
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
35085
|
+
}
|
|
35086
|
+
function getContainingBlock(element) {
|
|
35087
|
+
let currentNode = getParentNode(element);
|
|
35088
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
35089
|
+
if (isContainingBlock(currentNode)) {
|
|
35090
|
+
return currentNode;
|
|
35091
|
+
} else if (isTopLayer(currentNode)) {
|
|
35092
|
+
return null;
|
|
35093
|
+
}
|
|
35094
|
+
currentNode = getParentNode(currentNode);
|
|
35095
|
+
}
|
|
35096
|
+
return null;
|
|
35097
|
+
}
|
|
35098
|
+
function isWebKit() {
|
|
35099
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
35100
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
35101
|
+
}
|
|
35102
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
35103
|
+
function isLastTraversableNode(node) {
|
|
35104
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
35105
|
+
}
|
|
35106
|
+
function getComputedStyle$1(element) {
|
|
35107
|
+
return getWindow(element).getComputedStyle(element);
|
|
35108
|
+
}
|
|
35109
|
+
function getNodeScroll(element) {
|
|
35110
|
+
if (isElement(element)) {
|
|
35111
|
+
return {
|
|
35112
|
+
scrollLeft: element.scrollLeft,
|
|
35113
|
+
scrollTop: element.scrollTop
|
|
35114
|
+
};
|
|
35115
|
+
}
|
|
35116
|
+
return {
|
|
35117
|
+
scrollLeft: element.scrollX,
|
|
35118
|
+
scrollTop: element.scrollY
|
|
35119
|
+
};
|
|
35120
|
+
}
|
|
35121
|
+
function getParentNode(node) {
|
|
35122
|
+
if (getNodeName(node) === 'html') {
|
|
35123
|
+
return node;
|
|
35124
|
+
}
|
|
35125
|
+
const result =
|
|
35126
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
35127
|
+
node.assignedSlot ||
|
|
35128
|
+
// DOM Element detected.
|
|
35129
|
+
node.parentNode ||
|
|
35130
|
+
// ShadowRoot detected.
|
|
35131
|
+
isShadowRoot(node) && node.host ||
|
|
35132
|
+
// Fallback.
|
|
35133
|
+
getDocumentElement(node);
|
|
35134
|
+
return isShadowRoot(result) ? result.host : result;
|
|
35135
|
+
}
|
|
35136
|
+
function getNearestOverflowAncestor(node) {
|
|
35137
|
+
const parentNode = getParentNode(node);
|
|
35138
|
+
if (isLastTraversableNode(parentNode)) {
|
|
35139
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
35140
|
+
}
|
|
35141
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
35142
|
+
return parentNode;
|
|
35143
|
+
}
|
|
35144
|
+
return getNearestOverflowAncestor(parentNode);
|
|
35145
|
+
}
|
|
35146
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
35147
|
+
var _node$ownerDocument2;
|
|
35148
|
+
if (list === void 0) {
|
|
35149
|
+
list = [];
|
|
35150
|
+
}
|
|
35151
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
35152
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
35153
|
+
const win = getWindow(scrollableAncestor);
|
|
35154
|
+
if (isBody) {
|
|
35155
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], []);
|
|
35156
|
+
}
|
|
35157
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, []));
|
|
35158
|
+
}
|
|
35159
|
+
function getFrameElement(win) {
|
|
35160
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
35161
|
+
}
|
|
35162
|
+
|
|
35163
|
+
function getCssDimensions(element) {
|
|
35164
|
+
const css = getComputedStyle$1(element);
|
|
35165
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
35166
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
35167
|
+
let width = parseFloat(css.width) || 0;
|
|
35168
|
+
let height = parseFloat(css.height) || 0;
|
|
35169
|
+
const hasOffset = isHTMLElement(element);
|
|
35170
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
35171
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
35172
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
35173
|
+
if (shouldFallback) {
|
|
35174
|
+
width = offsetWidth;
|
|
35175
|
+
height = offsetHeight;
|
|
35176
|
+
}
|
|
35177
|
+
return {
|
|
35178
|
+
width,
|
|
35179
|
+
height,
|
|
35180
|
+
$: shouldFallback
|
|
35181
|
+
};
|
|
35182
|
+
}
|
|
35183
|
+
|
|
35184
|
+
function unwrapElement(element) {
|
|
35185
|
+
return !isElement(element) ? element.contextElement : element;
|
|
35186
|
+
}
|
|
35187
|
+
|
|
35188
|
+
function getScale(element) {
|
|
35189
|
+
const domElement = unwrapElement(element);
|
|
35190
|
+
if (!isHTMLElement(domElement)) {
|
|
35191
|
+
return createCoords(1);
|
|
35192
|
+
}
|
|
35193
|
+
const rect = domElement.getBoundingClientRect();
|
|
35194
|
+
const {
|
|
35195
|
+
width,
|
|
35196
|
+
height,
|
|
35197
|
+
$
|
|
35198
|
+
} = getCssDimensions(domElement);
|
|
35199
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
35200
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
35201
|
+
|
|
35202
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
35203
|
+
|
|
35204
|
+
if (!x || !Number.isFinite(x)) {
|
|
35205
|
+
x = 1;
|
|
35206
|
+
}
|
|
35207
|
+
if (!y || !Number.isFinite(y)) {
|
|
35208
|
+
y = 1;
|
|
35209
|
+
}
|
|
35210
|
+
return {
|
|
35211
|
+
x,
|
|
35212
|
+
y
|
|
35213
|
+
};
|
|
35214
|
+
}
|
|
35215
|
+
|
|
35216
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
35217
|
+
function getVisualOffsets(element) {
|
|
35218
|
+
const win = getWindow(element);
|
|
35219
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
35220
|
+
return noOffsets;
|
|
35221
|
+
}
|
|
35222
|
+
return {
|
|
35223
|
+
x: win.visualViewport.offsetLeft,
|
|
35224
|
+
y: win.visualViewport.offsetTop
|
|
35225
|
+
};
|
|
35226
|
+
}
|
|
35227
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
35228
|
+
if (isFixed === void 0) {
|
|
35229
|
+
isFixed = false;
|
|
35230
|
+
}
|
|
35231
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
35232
|
+
return false;
|
|
35233
|
+
}
|
|
35234
|
+
return isFixed;
|
|
35235
|
+
}
|
|
35236
|
+
|
|
35237
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
35238
|
+
if (includeScale === void 0) {
|
|
35239
|
+
includeScale = false;
|
|
35240
|
+
}
|
|
35241
|
+
if (isFixedStrategy === void 0) {
|
|
35242
|
+
isFixedStrategy = false;
|
|
35243
|
+
}
|
|
35244
|
+
const clientRect = element.getBoundingClientRect();
|
|
35245
|
+
const domElement = unwrapElement(element);
|
|
35246
|
+
let scale = createCoords(1);
|
|
35247
|
+
if (includeScale) {
|
|
35248
|
+
if (offsetParent) {
|
|
35249
|
+
if (isElement(offsetParent)) {
|
|
35250
|
+
scale = getScale(offsetParent);
|
|
35251
|
+
}
|
|
35252
|
+
} else {
|
|
35253
|
+
scale = getScale(element);
|
|
35254
|
+
}
|
|
35255
|
+
}
|
|
35256
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
35257
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
35258
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
35259
|
+
let width = clientRect.width / scale.x;
|
|
35260
|
+
let height = clientRect.height / scale.y;
|
|
35261
|
+
if (domElement) {
|
|
35262
|
+
const win = getWindow(domElement);
|
|
35263
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
35264
|
+
let currentWin = win;
|
|
35265
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
35266
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
35267
|
+
const iframeScale = getScale(currentIFrame);
|
|
35268
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
35269
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
35270
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
35271
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
35272
|
+
x *= iframeScale.x;
|
|
35273
|
+
y *= iframeScale.y;
|
|
35274
|
+
width *= iframeScale.x;
|
|
35275
|
+
height *= iframeScale.y;
|
|
35276
|
+
x += left;
|
|
35277
|
+
y += top;
|
|
35278
|
+
currentWin = getWindow(currentIFrame);
|
|
35279
|
+
currentIFrame = getFrameElement(currentWin);
|
|
35280
|
+
}
|
|
35281
|
+
}
|
|
35282
|
+
return rectToClientRect({
|
|
35283
|
+
width,
|
|
35284
|
+
height,
|
|
35285
|
+
x,
|
|
35286
|
+
y
|
|
35287
|
+
});
|
|
35288
|
+
}
|
|
35289
|
+
|
|
35290
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
35291
|
+
// incorrect for RTL.
|
|
35292
|
+
function getWindowScrollBarX(element, rect) {
|
|
35293
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
35294
|
+
if (!rect) {
|
|
35295
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
35296
|
+
}
|
|
35297
|
+
return rect.left + leftScroll;
|
|
35298
|
+
}
|
|
35299
|
+
|
|
35300
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
35301
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
35302
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
35303
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
35304
|
+
return {
|
|
35305
|
+
x,
|
|
35306
|
+
y
|
|
35307
|
+
};
|
|
35308
|
+
}
|
|
35309
|
+
|
|
35310
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
35311
|
+
let {
|
|
35312
|
+
elements,
|
|
35313
|
+
rect,
|
|
35314
|
+
offsetParent,
|
|
35315
|
+
strategy
|
|
35316
|
+
} = _ref;
|
|
35317
|
+
const isFixed = strategy === 'fixed';
|
|
35318
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
35319
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
35320
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
35321
|
+
return rect;
|
|
35322
|
+
}
|
|
35323
|
+
let scroll = {
|
|
35324
|
+
scrollLeft: 0,
|
|
35325
|
+
scrollTop: 0
|
|
35326
|
+
};
|
|
35327
|
+
let scale = createCoords(1);
|
|
35328
|
+
const offsets = createCoords(0);
|
|
35329
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
35330
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
35331
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
35332
|
+
scroll = getNodeScroll(offsetParent);
|
|
35333
|
+
}
|
|
35334
|
+
if (isHTMLElement(offsetParent)) {
|
|
35335
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
35336
|
+
scale = getScale(offsetParent);
|
|
35337
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
35338
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
35339
|
+
}
|
|
35340
|
+
}
|
|
35341
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
35342
|
+
return {
|
|
35343
|
+
width: rect.width * scale.x,
|
|
35344
|
+
height: rect.height * scale.y,
|
|
35345
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
35346
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
35347
|
+
};
|
|
35348
|
+
}
|
|
35349
|
+
|
|
35350
|
+
function getClientRects(element) {
|
|
35351
|
+
return Array.from(element.getClientRects());
|
|
35352
|
+
}
|
|
35353
|
+
|
|
35354
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
35355
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
35356
|
+
function getDocumentRect(element) {
|
|
35357
|
+
const html = getDocumentElement(element);
|
|
35358
|
+
const scroll = getNodeScroll(element);
|
|
35359
|
+
const body = element.ownerDocument.body;
|
|
35360
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
35361
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
35362
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
35363
|
+
const y = -scroll.scrollTop;
|
|
35364
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
35365
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
35366
|
+
}
|
|
35367
|
+
return {
|
|
35368
|
+
width,
|
|
35369
|
+
height,
|
|
35370
|
+
x,
|
|
35371
|
+
y
|
|
35372
|
+
};
|
|
35373
|
+
}
|
|
35374
|
+
|
|
35375
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
35376
|
+
// calculation is affected by unusual styles.
|
|
35377
|
+
// Most scrollbars leave 15-18px of space.
|
|
35378
|
+
const SCROLLBAR_MAX = 25;
|
|
35379
|
+
function getViewportRect(element, strategy) {
|
|
35380
|
+
const win = getWindow(element);
|
|
35381
|
+
const html = getDocumentElement(element);
|
|
35382
|
+
const visualViewport = win.visualViewport;
|
|
35383
|
+
let width = html.clientWidth;
|
|
35384
|
+
let height = html.clientHeight;
|
|
35385
|
+
let x = 0;
|
|
35386
|
+
let y = 0;
|
|
35387
|
+
if (visualViewport) {
|
|
35388
|
+
width = visualViewport.width;
|
|
35389
|
+
height = visualViewport.height;
|
|
35390
|
+
const visualViewportBased = isWebKit();
|
|
35391
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
35392
|
+
x = visualViewport.offsetLeft;
|
|
35393
|
+
y = visualViewport.offsetTop;
|
|
35394
|
+
}
|
|
35395
|
+
}
|
|
35396
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
35397
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
35398
|
+
// visual width of the <html> but this is not considered in the size
|
|
35399
|
+
// of `html.clientWidth`.
|
|
35400
|
+
if (windowScrollbarX <= 0) {
|
|
35401
|
+
const doc = html.ownerDocument;
|
|
35402
|
+
const body = doc.body;
|
|
35403
|
+
const bodyStyles = getComputedStyle(body);
|
|
35404
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
35405
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
35406
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
35407
|
+
width -= clippingStableScrollbarWidth;
|
|
35408
|
+
}
|
|
35409
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
35410
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
35411
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
35412
|
+
width += windowScrollbarX;
|
|
35413
|
+
}
|
|
35414
|
+
return {
|
|
35415
|
+
width,
|
|
35416
|
+
height,
|
|
35417
|
+
x,
|
|
35418
|
+
y
|
|
35419
|
+
};
|
|
35420
|
+
}
|
|
35421
|
+
|
|
35422
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
35423
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
35424
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
35425
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
35426
|
+
const top = clientRect.top + element.clientTop;
|
|
35427
|
+
const left = clientRect.left + element.clientLeft;
|
|
35428
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
35429
|
+
const width = element.clientWidth * scale.x;
|
|
35430
|
+
const height = element.clientHeight * scale.y;
|
|
35431
|
+
const x = left * scale.x;
|
|
35432
|
+
const y = top * scale.y;
|
|
35433
|
+
return {
|
|
35434
|
+
width,
|
|
35435
|
+
height,
|
|
35436
|
+
x,
|
|
35437
|
+
y
|
|
35438
|
+
};
|
|
35439
|
+
}
|
|
35440
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
35441
|
+
let rect;
|
|
35442
|
+
if (clippingAncestor === 'viewport') {
|
|
35443
|
+
rect = getViewportRect(element, strategy);
|
|
35444
|
+
} else if (clippingAncestor === 'document') {
|
|
35445
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
35446
|
+
} else if (isElement(clippingAncestor)) {
|
|
35447
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
35448
|
+
} else {
|
|
35449
|
+
const visualOffsets = getVisualOffsets(element);
|
|
35450
|
+
rect = {
|
|
35451
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
35452
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
35453
|
+
width: clippingAncestor.width,
|
|
35454
|
+
height: clippingAncestor.height
|
|
35455
|
+
};
|
|
35456
|
+
}
|
|
35457
|
+
return rectToClientRect(rect);
|
|
35458
|
+
}
|
|
35459
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
35460
|
+
const parentNode = getParentNode(element);
|
|
35461
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
35462
|
+
return false;
|
|
35463
|
+
}
|
|
35464
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
35465
|
+
}
|
|
35466
|
+
|
|
35467
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
35468
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
35469
|
+
// of the given element up the tree.
|
|
35470
|
+
function getClippingElementAncestors(element, cache) {
|
|
35471
|
+
const cachedResult = cache.get(element);
|
|
35472
|
+
if (cachedResult) {
|
|
35473
|
+
return cachedResult;
|
|
35474
|
+
}
|
|
35475
|
+
let result = getOverflowAncestors(element, []).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
35476
|
+
let currentContainingBlockComputedStyle = null;
|
|
35477
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
35478
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
35479
|
+
|
|
35480
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
35481
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
35482
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
35483
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
35484
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
35485
|
+
currentContainingBlockComputedStyle = null;
|
|
35486
|
+
}
|
|
35487
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
35488
|
+
if (shouldDropCurrentNode) {
|
|
35489
|
+
// Drop non-containing blocks.
|
|
35490
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
35491
|
+
} else {
|
|
35492
|
+
// Record last containing block for next iteration.
|
|
35493
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
35494
|
+
}
|
|
35495
|
+
currentNode = getParentNode(currentNode);
|
|
35496
|
+
}
|
|
35497
|
+
cache.set(element, result);
|
|
35498
|
+
return result;
|
|
35499
|
+
}
|
|
35500
|
+
|
|
35501
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
35502
|
+
// clipping ancestors.
|
|
35503
|
+
function getClippingRect(_ref) {
|
|
35504
|
+
let {
|
|
35505
|
+
element,
|
|
35506
|
+
boundary,
|
|
35507
|
+
rootBoundary,
|
|
35508
|
+
strategy
|
|
35509
|
+
} = _ref;
|
|
35510
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
35511
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
35512
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
35513
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
35514
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
35515
|
+
accRect.top = max(rect.top, accRect.top);
|
|
35516
|
+
accRect.right = min(rect.right, accRect.right);
|
|
35517
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
35518
|
+
accRect.left = max(rect.left, accRect.left);
|
|
35519
|
+
return accRect;
|
|
35520
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
35521
|
+
return {
|
|
35522
|
+
width: clippingRect.right - clippingRect.left,
|
|
35523
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
35524
|
+
x: clippingRect.left,
|
|
35525
|
+
y: clippingRect.top
|
|
35526
|
+
};
|
|
35527
|
+
}
|
|
35528
|
+
|
|
35529
|
+
function getDimensions(element) {
|
|
35530
|
+
const {
|
|
35531
|
+
width,
|
|
35532
|
+
height
|
|
35533
|
+
} = getCssDimensions(element);
|
|
35534
|
+
return {
|
|
35535
|
+
width,
|
|
35536
|
+
height
|
|
35537
|
+
};
|
|
35538
|
+
}
|
|
35539
|
+
|
|
35540
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
35541
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
35542
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
35543
|
+
const isFixed = strategy === 'fixed';
|
|
35544
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
35545
|
+
let scroll = {
|
|
35546
|
+
scrollLeft: 0,
|
|
35547
|
+
scrollTop: 0
|
|
35548
|
+
};
|
|
35549
|
+
const offsets = createCoords(0);
|
|
35550
|
+
|
|
35551
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
35552
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
35553
|
+
function setLeftRTLScrollbarOffset() {
|
|
35554
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
35555
|
+
}
|
|
35556
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
35557
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
35558
|
+
scroll = getNodeScroll(offsetParent);
|
|
35559
|
+
}
|
|
35560
|
+
if (isOffsetParentAnElement) {
|
|
35561
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
35562
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
35563
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
35564
|
+
} else if (documentElement) {
|
|
35565
|
+
setLeftRTLScrollbarOffset();
|
|
35566
|
+
}
|
|
35567
|
+
}
|
|
35568
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
35569
|
+
setLeftRTLScrollbarOffset();
|
|
35570
|
+
}
|
|
35571
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
35572
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
35573
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
35574
|
+
return {
|
|
35575
|
+
x,
|
|
35576
|
+
y,
|
|
35577
|
+
width: rect.width,
|
|
35578
|
+
height: rect.height
|
|
35579
|
+
};
|
|
35580
|
+
}
|
|
35581
|
+
|
|
35582
|
+
function isStaticPositioned(element) {
|
|
35583
|
+
return getComputedStyle$1(element).position === 'static';
|
|
35584
|
+
}
|
|
35585
|
+
|
|
35586
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
35587
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
35588
|
+
return null;
|
|
35589
|
+
}
|
|
35590
|
+
if (polyfill) {
|
|
35591
|
+
return polyfill(element);
|
|
35592
|
+
}
|
|
35593
|
+
let rawOffsetParent = element.offsetParent;
|
|
35594
|
+
|
|
35595
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
35596
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
35597
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
35598
|
+
// non-static.
|
|
35599
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
35600
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
35601
|
+
}
|
|
35602
|
+
return rawOffsetParent;
|
|
35603
|
+
}
|
|
35604
|
+
|
|
35605
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
35606
|
+
// such as table ancestors and cross browser bugs.
|
|
35607
|
+
function getOffsetParent(element, polyfill) {
|
|
35608
|
+
const win = getWindow(element);
|
|
35609
|
+
if (isTopLayer(element)) {
|
|
35610
|
+
return win;
|
|
35611
|
+
}
|
|
35612
|
+
if (!isHTMLElement(element)) {
|
|
35613
|
+
let svgOffsetParent = getParentNode(element);
|
|
35614
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
35615
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
35616
|
+
return svgOffsetParent;
|
|
35617
|
+
}
|
|
35618
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
35619
|
+
}
|
|
35620
|
+
return win;
|
|
35621
|
+
}
|
|
35622
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
35623
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
35624
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
35625
|
+
}
|
|
35626
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
35627
|
+
return win;
|
|
35628
|
+
}
|
|
35629
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
35630
|
+
}
|
|
35631
|
+
|
|
35632
|
+
const getElementRects = async function (data) {
|
|
35633
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
35634
|
+
const getDimensionsFn = this.getDimensions;
|
|
35635
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
35636
|
+
return {
|
|
35637
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
35638
|
+
floating: {
|
|
35639
|
+
x: 0,
|
|
35640
|
+
y: 0,
|
|
35641
|
+
width: floatingDimensions.width,
|
|
35642
|
+
height: floatingDimensions.height
|
|
35643
|
+
}
|
|
35644
|
+
};
|
|
35645
|
+
};
|
|
35646
|
+
|
|
35647
|
+
function isRTL(element) {
|
|
35648
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
35649
|
+
}
|
|
35650
|
+
|
|
35651
|
+
const platform = {
|
|
35652
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
35653
|
+
getDocumentElement,
|
|
35654
|
+
getClippingRect,
|
|
35655
|
+
getOffsetParent,
|
|
35656
|
+
getElementRects,
|
|
35657
|
+
getClientRects,
|
|
35658
|
+
getDimensions,
|
|
35659
|
+
getScale,
|
|
35660
|
+
isElement,
|
|
35661
|
+
isRTL
|
|
35662
|
+
};
|
|
35663
|
+
|
|
35664
|
+
/**
|
|
35665
|
+
* Modifies the placement by translating the floating element along the
|
|
35666
|
+
* specified axes.
|
|
35667
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
35668
|
+
* object may be passed.
|
|
35669
|
+
* @see https://floating-ui.com/docs/offset
|
|
35670
|
+
*/
|
|
35671
|
+
const offset = offset$1;
|
|
35672
|
+
|
|
35673
|
+
/**
|
|
35674
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
35675
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
35676
|
+
* @see https://floating-ui.com/docs/shift
|
|
35677
|
+
*/
|
|
35678
|
+
const shift = shift$1;
|
|
35679
|
+
|
|
35680
|
+
/**
|
|
35681
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
35682
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
35683
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
35684
|
+
* @see https://floating-ui.com/docs/flip
|
|
35685
|
+
*/
|
|
35686
|
+
const flip = flip$1;
|
|
35687
|
+
|
|
35688
|
+
/**
|
|
35689
|
+
* Provides data to position an inner element of the floating element so that it
|
|
35690
|
+
* appears centered to the reference element.
|
|
35691
|
+
* @see https://floating-ui.com/docs/arrow
|
|
35692
|
+
*/
|
|
35693
|
+
const arrow = arrow$1;
|
|
35694
|
+
|
|
35695
|
+
/**
|
|
35696
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
35697
|
+
* next to a given reference element.
|
|
35698
|
+
*/
|
|
35699
|
+
const computePosition = (reference, floating, options) => {
|
|
35700
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
35701
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
35702
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
35703
|
+
const cache = new Map();
|
|
35704
|
+
const mergedOptions = {
|
|
35705
|
+
platform,
|
|
35706
|
+
...options
|
|
35707
|
+
};
|
|
35708
|
+
const platformWithCache = {
|
|
35709
|
+
...mergedOptions.platform,
|
|
35710
|
+
_c: cache
|
|
35711
|
+
};
|
|
35712
|
+
return computePosition$1(reference, floating, {
|
|
35713
|
+
...mergedOptions,
|
|
35714
|
+
platform: platformWithCache
|
|
35715
|
+
});
|
|
35716
|
+
};
|
|
35717
|
+
|
|
35718
|
+
const lsTooltipCss = ".tooltip{display:none;position:absolute;border-radius:0.5rem;background:var(--gray-100, #45484d);color:var(--white, #fff);font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem;padding:0.5rem 0.75rem;max-width:300px;width:max-content;z-index:1000;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 -1px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);transition:all 0.2s ease}#arrow{position:absolute;background:var(--gray-100, #45484d);width:0.625rem;height:0.625rem;transform:rotate(45deg);border-radius:0.125rem}";
|
|
35719
|
+
|
|
35720
|
+
const LsTooltip = class {
|
|
35721
|
+
constructor(hostRef) {
|
|
35722
|
+
registerInstance(this, hostRef);
|
|
35723
|
+
}
|
|
35724
|
+
get el() { return getElement(this); }
|
|
35725
|
+
referenceElement;
|
|
35726
|
+
placement = 'top';
|
|
35727
|
+
tooltipEl;
|
|
35728
|
+
tooltipLocked = false;
|
|
35729
|
+
componentDidLoad() {
|
|
35730
|
+
this.tooltipEl = this.el.shadowRoot.querySelector('.tooltip');
|
|
35731
|
+
const arrowElement = this.el.shadowRoot.querySelector('#arrow'); // use shadowRoot for internal elements
|
|
35732
|
+
if (!this.tooltipEl || !this.referenceElement)
|
|
35733
|
+
return;
|
|
35734
|
+
const update = () => {
|
|
35735
|
+
computePosition(this.referenceElement, this.tooltipEl, {
|
|
35736
|
+
placement: this.placement,
|
|
35737
|
+
middleware: [offset(6), flip(), shift({ padding: 5 }), arrow({ element: arrowElement })],
|
|
35738
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
35739
|
+
Object.assign(this.tooltipEl.style, {
|
|
35740
|
+
left: `${x}px`,
|
|
35741
|
+
top: `${y}px`,
|
|
35742
|
+
});
|
|
35743
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow || {};
|
|
35744
|
+
const staticSide = {
|
|
35745
|
+
top: 'bottom',
|
|
35746
|
+
right: 'left',
|
|
35747
|
+
bottom: 'top',
|
|
35748
|
+
left: 'right',
|
|
35749
|
+
}[placement.split('-')[0]];
|
|
35750
|
+
Object.assign(arrowElement.style, {
|
|
35751
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
|
35752
|
+
top: arrowY != null ? `${arrowY}px` : '',
|
|
35753
|
+
right: '',
|
|
35754
|
+
bottom: '',
|
|
35755
|
+
[staticSide]: '-4px',
|
|
35756
|
+
});
|
|
35757
|
+
});
|
|
35758
|
+
};
|
|
35759
|
+
const showTooltip = () => {
|
|
35760
|
+
if (this.tooltipLocked)
|
|
35761
|
+
return;
|
|
35762
|
+
this.tooltipEl.style.display = 'block';
|
|
35763
|
+
update();
|
|
35764
|
+
};
|
|
35765
|
+
const hideTooltip = () => {
|
|
35766
|
+
if (this.tooltipLocked)
|
|
35767
|
+
return;
|
|
35768
|
+
this.tooltipEl.style.display = 'none';
|
|
35769
|
+
};
|
|
35770
|
+
[
|
|
35771
|
+
['mouseenter', showTooltip],
|
|
35772
|
+
['mouseleave', hideTooltip],
|
|
35773
|
+
['focus', showTooltip],
|
|
35774
|
+
['blur', hideTooltip],
|
|
35775
|
+
].forEach(([event, listener]) => {
|
|
35776
|
+
this.referenceElement.addEventListener(event, listener);
|
|
35777
|
+
});
|
|
35778
|
+
this.referenceElement.addEventListener('click', () => {
|
|
35779
|
+
hideTooltip();
|
|
35780
|
+
this.tooltipLocked = true;
|
|
35781
|
+
setTimeout(() => {
|
|
35782
|
+
this.tooltipLocked = false;
|
|
35783
|
+
}, 500);
|
|
35784
|
+
});
|
|
35785
|
+
}
|
|
35786
|
+
render() {
|
|
35787
|
+
return (h("div", { key: '9daf5991d54ab56094ae8a28203d7b896ce2dd81', class: "tooltip", role: "tooltip" }, h("div", { key: 'e483907ce2f3ca0ee927f9b1fc116c3d957a575e', id: "arrow" }), h("slot", { key: '176202c5c2d38da7236e6b4519f93cf1d7cc1e87' })));
|
|
35788
|
+
}
|
|
35789
|
+
};
|
|
35790
|
+
LsTooltip.style = lsTooltipCss;
|
|
35791
|
+
|
|
34278
35792
|
const lsValidationTagCss = ":host{position:relative}*{box-sizing:border-box;margin:0}.valid-label{display:flex;padding:2px 0.5rem;justify-content:center;align-items:center;gap:0.25rem;border-radius:1rem;font-size:0.75rem;font-style:normal;font-weight:500;line-height:1.25rem;width:fit-content}.valid{background-color:var(--green-30, #9df5d4);color:var(--green-100, #125241)}.invalid{background:var(--yellow-20, #fff3c2);color:var(--yellow-90, #8a3f0e)}.field-counter{display:flex;padding:0.125rem;justify-content:center;align-items:center;border-radius:1rem;font-size:0.625rem;line-height:0.75rem;font-style:normal;font-weight:500;color:var(--yellow-20, #fff3c2);background:#e17100;min-width:1rem}.field-dropdown{position:absolute;top:2rem;right:0;background:white;display:flex;flex-direction:column;gap:0.75rem;width:20rem;padding:1rem;border-radius:1rem;border:1px solid #e5e7eb;background:#fff;box-shadow:0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);max-height:20rem;overflow-y:auto;flex-direction:column;align-items:flex-start;z-index:1000}.required-field{position:relative;display:flex;width:100%;justify-content:space-between;align-items:center;gap:0.5rem;border-radius:0.75rem;padding:0.5rem 0.5rem 0.5rem 1rem;background:var(--field-background);color:var(--field-text-color);border:1px solid var(--field-border-color);transition:all 0.1s ease-in-out}.required-field:hover{background:var(--field-background-hover);color:var(--field-text-color-hover);border:1px solid var(--field-border-color-hover);box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)}.required-field-items-left{display:flex;gap:0.5rem;align-items:center;width:100%}.required-field-items-left p{font-size:0.875rem;font-style:normal;font-weight:500;line-height:0.875rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dot{height:0.5rem;width:0.5rem;border-radius:50%}.role-label{display:flex;padding:2px 3px;justify-content:center;align-items:center;border-radius:0.25rem;font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem;text-transform:capitalize}.dropdown-header h2{color:var(--gray-100, #45484d);font-size:0.875rem;font-style:normal;font-weight:500;line-height:1.25rem;margin-bottom:0.125rem}.dropdown-header p{color:var(--gray-80, #6c6e73);font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem;}";
|
|
34279
35793
|
|
|
34280
35794
|
const LsValidationTag = class {
|
|
@@ -34284,8 +35798,11 @@ const LsValidationTag = class {
|
|
|
34284
35798
|
status = 'Invalid';
|
|
34285
35799
|
validationErrors = [];
|
|
34286
35800
|
isExpanded = false;
|
|
35801
|
+
validateChange(newValue) {
|
|
35802
|
+
console.log(newValue);
|
|
35803
|
+
}
|
|
34287
35804
|
render() {
|
|
34288
|
-
return (h(Host, { key: '
|
|
35805
|
+
return (h(Host, { key: '81f7243eb9ac2099bac672ce98f26e4da6bb8fed' }, h("div", { key: '33e7174b2032cc6282f84b26a4f943e1baac6dd9', class: `valid-label ${this.validationErrors.length === 0 ? 'valid' : 'invalid'}`, onClick: this.validationErrors.length && (() => (this.isExpanded = !this.isExpanded)) }, this.validationErrors.length === 0 ? 'Ready to Send' : `Requires Fields`, this.validationErrors.length > 0 && h("div", { key: '6b820c6a30a090d656c5a6a06b66c8c3cda8fa2c', class: 'field-counter' }, this.validationErrors.length), this.validationErrors.length > 0 && (h("ls-icon", { key: 'b4404382dea2c84c042dd1b330b2f0be823b643e', name: this.isExpanded ? 'chevron-up' : 'chevron-down', style: { cursor: 'pointer', scale: '0.60', margin: '0 -0.25rem' } }))), this.isExpanded && this.validationErrors.length !== 0 && (h("div", { key: 'eca209963d0acadbef0764909f15bb4a0350f4c6', class: 'field-dropdown' }, h("div", { key: '5a57240e85f7826049b12bda0f2cbfc72599c6b9', class: 'dropdown-header' }, h("h2", { key: '34bb3c2fac8a092cc424a4ebdce49137d6dcd384' }, "Signature Fields Required"), h("p", { key: 'cedda6d0383cd029efdd33fa7edfcd22c0cf65e2' }, this.validationErrors.length, " ", this.validationErrors.length === 1 ? 'Recipient needs a Signature Field' : 'Recipients need Signature Fields', " placed for them")), this.validationErrors.map((field, idx) => {
|
|
34289
35806
|
const signerIndex = field?.role?.signerIndex ? field?.role?.signerIndex % 100 : null;
|
|
34290
35807
|
const pallette = defaultRolePalette[signerIndex || field?.element?.signer || 0];
|
|
34291
35808
|
return (h("div", { key: idx, class: 'required-field', style: {
|
|
@@ -34295,13 +35812,16 @@ const LsValidationTag = class {
|
|
|
34295
35812
|
'--field-text-color': pallette.s70,
|
|
34296
35813
|
'--field-text-color-hover': pallette.s80,
|
|
34297
35814
|
'--field-border-color-hover': pallette.s60,
|
|
34298
|
-
} }, h("div", { class: 'required-field-items-left' }, h("div", { class: 'dot', style: { background: pallette.s60 } }), field?.role && (h("div", { class: 'required-field-items-left' }, h("p", { style: { color: pallette.s80 } }, field.role?.name || `Signer ${field?.role?.signerIndex + 1}`), h("div", { class: 'role-label', style: { background: pallette.s30, color: pallette.s70 } }, field.role?.roleType.toLowerCase() || `Signer ${field.role?.signerIndex + 1}`))), field?.element && (h(h.Fragment, null, h("p", { style: { color: pallette.s80 } }, field.role?.name || `${field.element.formElementType} ${field?.element?.label + 1}`), h("div", { class: 'role-label', style: { background: pallette.s30, color: pallette.s70 } }, field.description))))
|
|
35815
|
+
} }, h("div", { class: 'required-field-items-left' }, h("div", { class: 'dot', style: { background: pallette.s60 } }), field?.role && (h("div", { class: 'required-field-items-left' }, h("p", { style: { color: pallette.s80 } }, field.role?.name || `Signer ${field?.role?.signerIndex + 1}`), h("div", { class: 'role-label', style: { background: pallette.s30, color: pallette.s70 } }, field.role?.roleType.toLowerCase() || `Signer ${field.role?.signerIndex + 1}`))), field?.element && (h(h.Fragment, null, h("p", { style: { color: pallette.s80 } }, field.role?.name || `${field.element.formElementType} ${field?.element?.label + 1}`), h("div", { class: 'role-label', style: { background: pallette.s30, color: pallette.s70 } }, field.description))))));
|
|
34299
35816
|
})))));
|
|
34300
35817
|
}
|
|
35818
|
+
static get watchers() { return {
|
|
35819
|
+
"validationErrors": ["validateChange"]
|
|
35820
|
+
}; }
|
|
34301
35821
|
};
|
|
34302
35822
|
LsValidationTag.style = lsValidationTagCss;
|
|
34303
35823
|
|
|
34304
|
-
export { LsDocumentOptions as ls_document_options, LsDocumentViewer as ls_document_viewer, LsEditorField as ls_editor_field, LsEditorTable as ls_editor_table, LsFeatureColoumn as ls_feature_column, LsFieldAlignment as ls_field_alignment, LsFieldContent as ls_field_content, LsFieldDimensions as ls_field_dimensions, LsFieldDistribute as ls_field_distribute, LsFieldFooter as ls_field_footer, LsFieldFormat as ls_field_format, LsFieldPlacement as ls_field_placement, LsFieldProperties as ls_field_properties, LsFieldPropertiesAdvanced as ls_field_properties_advanced, LsFieldPropertiesAutosign as ls_field_properties_autosign, LsFieldPropertiesContainer as ls_field_properties_container, LsFieldPropertiesDate as ls_field_properties_date, LsFieldPropertiesEmail as ls_field_properties_email, LsFieldPropertiesFile as ls_field_properties_file, LsFieldPropertiesGeneral as ls_field_properties_general, LsFieldPropertiesImage as ls_field_properties_image, LsFieldPropertiesMultiple as ls_field_properties_multiple, LsFieldPropertiesNumber as ls_field_properties_number, LsFieldPropertiesSignature as ls_field_properties_signature, LsFieldPropertiesText as ls_field_properties_text, LsFieldSize as ls_field_size, LsFieldTypeDisplay as ls_field_type_display, LsIcon as ls_icon, LsInputWrapper as ls_input_wrapper, LsPageLoader as ls_page_loader, LsParticipantCard as ls_participant_card, LsParticipantManager as ls_participant_manager, LsParticipantSelect as ls_participant_select, LsPropsSection as ls_props_section, LsStatusbar as ls_statusbar, LsToggle as ls_toggle, LsToolbar as ls_toolbar, LsToolboxField as ls_toolbox_field, LsValidationTag as ls_validation_tag };
|
|
34305
|
-
//# sourceMappingURL=ls-document-options.ls-document-viewer.ls-editor-field.ls-editor-table.ls-feature-column.ls-field-alignment.ls-field-content.ls-field-dimensions.ls-field-distribute.ls-field-footer.ls-field-format.ls-field-placement.ls-field-properties.ls-field-properties-advanced.ls-field-properties-autosign.ls-field-properties-container.ls-field-properties-date.ls-field-properties-email.ls-field-properties-file.ls-field-properties-general.ls-field-properties-image.ls-field-properties-multiple.ls-field-properties-number.ls-field-properties-signature.ls-field-properties-text.ls-field-size.ls-field-type-display.ls-icon.ls-input-wrapper.ls-page-loader.ls-participant-card.ls-participant-manager.ls-participant-select.ls-props-section.ls-statusbar.ls-toggle.ls-toolbar.ls-toolbox-field.ls-validation-tag.entry.js.map
|
|
35824
|
+
export { LsDocumentOptions as ls_document_options, LsDocumentViewer as ls_document_viewer, LsEditorField as ls_editor_field, LsEditorTable as ls_editor_table, LsFeatureColoumn as ls_feature_column, LsFieldAlignment as ls_field_alignment, LsFieldContent as ls_field_content, LsFieldDimensions as ls_field_dimensions, LsFieldDistribute as ls_field_distribute, LsFieldFooter as ls_field_footer, LsFieldFormat as ls_field_format, LsFieldPlacement as ls_field_placement, LsFieldProperties as ls_field_properties, LsFieldPropertiesAdvanced as ls_field_properties_advanced, LsFieldPropertiesAutosign as ls_field_properties_autosign, LsFieldPropertiesContainer as ls_field_properties_container, LsFieldPropertiesDate as ls_field_properties_date, LsFieldPropertiesEmail as ls_field_properties_email, LsFieldPropertiesFile as ls_field_properties_file, LsFieldPropertiesGeneral as ls_field_properties_general, LsFieldPropertiesImage as ls_field_properties_image, LsFieldPropertiesMultiple as ls_field_properties_multiple, LsFieldPropertiesNumber as ls_field_properties_number, LsFieldPropertiesSignature as ls_field_properties_signature, LsFieldPropertiesText as ls_field_properties_text, LsFieldSize as ls_field_size, LsFieldTypeDisplay as ls_field_type_display, LsIcon as ls_icon, LsInputWrapper as ls_input_wrapper, LsPageLoader as ls_page_loader, LsParticipantCard as ls_participant_card, LsParticipantManager as ls_participant_manager, LsParticipantSelect as ls_participant_select, LsPropsSection as ls_props_section, LsStatusbar as ls_statusbar, LsToggle as ls_toggle, LsToolbar as ls_toolbar, LsToolboxField as ls_toolbox_field, LsTooltip as ls_tooltip, LsValidationTag as ls_validation_tag };
|
|
35825
|
+
//# sourceMappingURL=ls-document-options.ls-document-viewer.ls-editor-field.ls-editor-table.ls-feature-column.ls-field-alignment.ls-field-content.ls-field-dimensions.ls-field-distribute.ls-field-footer.ls-field-format.ls-field-placement.ls-field-properties.ls-field-properties-advanced.ls-field-properties-autosign.ls-field-properties-container.ls-field-properties-date.ls-field-properties-email.ls-field-properties-file.ls-field-properties-general.ls-field-properties-image.ls-field-properties-multiple.ls-field-properties-number.ls-field-properties-signature.ls-field-properties-text.ls-field-size.ls-field-type-display.ls-icon.ls-input-wrapper.ls-page-loader.ls-participant-card.ls-participant-manager.ls-participant-select.ls-props-section.ls-statusbar.ls-toggle.ls-toolbar.ls-toolbox-field.ls-tooltip.ls-validation-tag.entry.js.map
|
|
34306
35826
|
|
|
34307
|
-
//# sourceMappingURL=ls-document-
|
|
35827
|
+
//# sourceMappingURL=ls-document-options_40.entry.js.map
|