@watermarkinsights/ripple 3.34.0 → 3.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chartFunctions-0010d74f.js → chartFunctions-d7346750.js} +1 -1
- package/dist/cjs/{functions-1a2b8101.js → functions-c04da856.js} +3 -3
- package/dist/cjs/{global-c2fa8270.js → global-bec6779d.js} +1 -1
- package/dist/cjs/{intl-b77a35bb.js → intl-1bd6b02d.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-chart-popover.cjs.entry.js +1 -1
- package/dist/cjs/priv-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
- package/dist/cjs/wm-button.cjs.entry.js +3 -3
- package/dist/cjs/wm-chart.cjs.entry.js +3 -3
- package/dist/cjs/wm-datepicker.cjs.entry.js +3 -3
- package/dist/cjs/wm-file.cjs.entry.js +1 -1
- package/dist/cjs/wm-input.cjs.entry.js +4 -4
- package/dist/cjs/wm-line-chart.cjs.entry.js +3 -3
- package/dist/cjs/wm-modal-header.cjs.entry.js +2 -2
- package/dist/cjs/wm-modal.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigation_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
- package/dist/cjs/wm-network-uploader.cjs.entry.js +2 -2
- package/dist/cjs/wm-option_2.cjs.entry.js +4 -4
- package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +4 -4
- package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +2 -2
- package/dist/cjs/wm-timepicker.cjs.entry.js +3 -3
- package/dist/cjs/wm-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/wm-uploader.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/wm-button/wm-button.js +3 -3
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +3 -3
- package/dist/collection/components/wm-input/wm-input.js +3 -3
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +1 -1
- package/dist/collection/components/wm-search/wm-search.js +3 -3
- package/dist/collection/components/wm-select/wm-select.js +3 -3
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +1 -1
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +3 -3
- package/dist/collection/dev/scripts.js +2 -2
- package/dist/collection/global/functions.js +1 -1
- package/dist/esm/{chartFunctions-5f009626.js → chartFunctions-1396e181.js} +1 -1
- package/dist/esm/{functions-abbff9c1.js → functions-e8b2c205.js} +3 -3
- package/dist/esm/{global-555a7740.js → global-9470ff16.js} +1 -1
- package/dist/esm/{intl-7c8d2db9.js → intl-3b652186.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-chart-popover.entry.js +1 -1
- package/dist/esm/priv-datepicker.entry.js +1 -1
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-action-menu_2.entry.js +2 -2
- package/dist/esm/wm-button.entry.js +3 -3
- package/dist/esm/wm-chart.entry.js +3 -3
- package/dist/esm/wm-datepicker.entry.js +3 -3
- package/dist/esm/wm-file.entry.js +1 -1
- package/dist/esm/wm-input.entry.js +4 -4
- package/dist/esm/wm-line-chart.entry.js +3 -3
- package/dist/esm/wm-modal-header.entry.js +2 -2
- package/dist/esm/wm-modal.entry.js +1 -1
- package/dist/esm/wm-navigation_3.entry.js +2 -2
- package/dist/esm/wm-navigator.entry.js +1 -1
- package/dist/esm/wm-network-uploader.entry.js +2 -2
- package/dist/esm/wm-option_2.entry.js +4 -4
- package/dist/esm/wm-pagination.entry.js +1 -1
- package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +4 -4
- package/dist/esm/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-tab-item_3.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +2 -2
- package/dist/esm/wm-timepicker.entry.js +3 -3
- package/dist/esm/wm-toggletip.entry.js +1 -1
- package/dist/esm/wm-uploader.entry.js +2 -2
- package/dist/esm-es5/{chartFunctions-5f009626.js → chartFunctions-1396e181.js} +1 -1
- package/dist/esm-es5/{functions-abbff9c1.js → functions-e8b2c205.js} +1 -1
- package/dist/esm-es5/{global-555a7740.js → global-9470ff16.js} +1 -1
- package/dist/esm-es5/{intl-7c8d2db9.js → intl-3b652186.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-f789cc9d.system.entry.js → p-02c7bac4.system.entry.js} +1 -1
- package/dist/ripple/{p-b8647588.system.entry.js → p-070e8297.system.entry.js} +1 -1
- package/dist/ripple/{p-de3cd573.system.entry.js → p-07cc4bde.system.entry.js} +1 -1
- package/dist/ripple/{p-2e964a0e.system.entry.js → p-08ffca75.system.entry.js} +1 -1
- package/dist/ripple/p-09f2e5c4.entry.js +1 -0
- package/dist/ripple/{p-4c2896a3.entry.js → p-0abf0275.entry.js} +1 -1
- package/dist/ripple/{p-512ca131.system.entry.js → p-0b917733.system.entry.js} +1 -1
- package/dist/ripple/{p-6c6b3615.entry.js → p-0e92084b.entry.js} +1 -1
- package/dist/ripple/{p-677373d0.system.entry.js → p-0ed9d5e8.system.entry.js} +1 -1
- package/dist/ripple/{p-6eee89db.entry.js → p-11d1d573.entry.js} +1 -1
- package/dist/ripple/{p-aed5926e.js → p-17b2f69d.js} +1 -1
- package/dist/ripple/{p-393dd362.entry.js → p-19956e58.entry.js} +1 -1
- package/dist/ripple/{p-254653ac.system.entry.js → p-2161e595.system.entry.js} +1 -1
- package/dist/ripple/{p-ca7d5733.system.entry.js → p-2af10ba0.system.entry.js} +1 -1
- package/dist/ripple/{p-b099128b.system.js → p-3cb0e8c7.system.js} +1 -1
- package/dist/ripple/{p-562e3e45.system.entry.js → p-3e2ff6d5.system.entry.js} +1 -1
- package/dist/ripple/{p-1d828440.entry.js → p-470e9feb.entry.js} +1 -1
- package/dist/ripple/{p-83d30acd.js → p-47f737b1.js} +1 -1
- package/dist/ripple/{p-843f2019.entry.js → p-51f74249.entry.js} +1 -1
- package/dist/ripple/{p-b6bd28ac.system.js → p-54a05f1f.system.js} +1 -1
- package/dist/ripple/{p-6b693f1e.entry.js → p-573ea7ae.entry.js} +1 -1
- package/dist/ripple/{p-1156b88b.system.entry.js → p-5b2dd6bb.system.entry.js} +1 -1
- package/dist/ripple/{p-d8fc05b6.js → p-5fb9bbd0.js} +1 -1
- package/dist/ripple/{p-65b98dbf.system.entry.js → p-6d02bd81.system.entry.js} +1 -1
- package/dist/ripple/{p-84b4babb.entry.js → p-6df89f8e.entry.js} +1 -1
- package/dist/ripple/{p-29793740.entry.js → p-7694b605.entry.js} +1 -1
- package/dist/ripple/{p-c38d9572.system.entry.js → p-771c4eb5.system.entry.js} +1 -1
- package/dist/ripple/{p-d4d497a9.system.entry.js → p-78a66f3d.system.entry.js} +1 -1
- package/dist/ripple/{p-ea554345.entry.js → p-796fe11c.entry.js} +1 -1
- package/dist/ripple/{p-db9e44e8.system.entry.js → p-8146136b.system.entry.js} +1 -1
- package/dist/ripple/{p-3732917e.system.js → p-814ceaf0.system.js} +1 -1
- package/dist/ripple/{p-b9602c56.system.entry.js → p-81f817ed.system.entry.js} +1 -1
- package/dist/ripple/{p-9607ed27.entry.js → p-84ff71d5.entry.js} +1 -1
- package/dist/ripple/{p-f2562e66.entry.js → p-88e8c8f7.entry.js} +1 -1
- package/dist/ripple/{p-86ef5702.system.entry.js → p-8acf0392.system.entry.js} +1 -1
- package/dist/ripple/p-8cbf86ff.entry.js +1 -0
- package/dist/ripple/{p-5ead62e4.entry.js → p-96410de4.entry.js} +1 -1
- package/dist/ripple/{p-aa87c040.system.entry.js → p-98dc7e08.system.entry.js} +1 -1
- package/dist/ripple/{p-47307b3f.entry.js → p-9ed1c752.entry.js} +1 -1
- package/dist/ripple/{p-466f4311.system.entry.js → p-a44bbac9.system.entry.js} +1 -1
- package/dist/ripple/{p-20595c66.entry.js → p-aab02c19.entry.js} +1 -1
- package/dist/ripple/{p-57f027d7.system.js → p-ae6c31e0.system.js} +1 -1
- package/dist/ripple/{p-399d0b3c.system.entry.js → p-b03f3793.system.entry.js} +1 -1
- package/dist/ripple/{p-f0270184.entry.js → p-b2241d54.entry.js} +1 -1
- package/dist/ripple/{p-9b9680fb.entry.js → p-b3b8543e.entry.js} +1 -1
- package/dist/ripple/{p-6374bb0f.entry.js → p-b6f39766.entry.js} +1 -1
- package/dist/ripple/{p-f6a8e13f.system.entry.js → p-b865cc30.system.entry.js} +1 -1
- package/dist/ripple/{p-ba330240.entry.js → p-baeeb9cd.entry.js} +1 -1
- package/dist/ripple/{p-7204124a.system.entry.js → p-baf62843.system.entry.js} +1 -1
- package/dist/ripple/p-c50c53e2.js +1 -0
- package/dist/ripple/{p-1563ae0b.entry.js → p-c67b552f.entry.js} +1 -1
- package/dist/ripple/p-d27481cb.entry.js +1 -0
- package/dist/ripple/{p-ec084d4c.system.entry.js → p-dccce0d8.system.entry.js} +1 -1
- package/dist/ripple/{p-9702734e.system.entry.js → p-e5f278cf.system.entry.js} +1 -1
- package/dist/ripple/{p-89cbe5f9.system.js → p-ec275c46.system.js} +1 -1
- package/dist/ripple/{p-c939d6c7.entry.js → p-ef9a558f.entry.js} +1 -1
- package/dist/ripple/{p-27bd00f8.system.entry.js → p-fc49b015.system.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/global/functions.d.ts +1 -1
- package/package.json +1 -1
- package/dist/ripple/p-14d2d250.entry.js +0 -1
- package/dist/ripple/p-15bdfaf6.entry.js +0 -1
- package/dist/ripple/p-53128182.entry.js +0 -1
- package/dist/ripple/p-bc5f1923.js +0 -1
- package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +0 -11
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +0 -138
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,H as Host,g as getElement}from"./index-294d486f.js";import{g as getIconCodeFromName}from"./interfaces-61c6305b.js";import{g as generateId,t as toBool,h as hideTooltip,r as removeDisabledAttribute,s as showTooltip,a as triggerFormSubmit}from"./functions-abbff9c1.js";var wmButtonCss=':host .wm-button{-ms-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-moz-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;width:100%;border:2px solid transparent;font-family:inherit;font-size:0.75rem;font-weight:700;min-height:2.75rem;padding:12px 1.3333333333em;cursor:pointer;position:relative;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;text-decoration:none;text-transform:uppercase;letter-spacing:0.01875rem;overflow-wrap:break-word;-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 48rem){:host .wm-button{min-height:3.3333333333em}}:host .wm-button.nowrap{display:inline-block;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host .wm-button:focus{outline:none;-webkit-box-shadow:none;box-shadow:none}:host .wm-button::-moz-focus-inner{border:0;outline:none}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark){-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus)}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark)::-moz-focus-inner{border:0}:host .wm-button.dark.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled).dark{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus-ondark);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus-ondark);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus-ondark);outline:none}:host .wm-button:active:not(:disabled):not(.disabled):not(.-textonly):not(.-actionbutton):not(.displayedoption){-ms-transform:scale(0.9, 0.9);-webkit-transform:scale(0.9, 0.9);-moz-transform:scale(0.9, 0.9);transform:scale(0.9, 0.9)}:host .wm-button .mdi{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:host .wm-button:not(.-icononly):not(.-navigational) .mdi{margin-right:0.3125rem;font-size:0.875rem}:host .wm-button[dir=RTL] :not(.-icononly) .mdi{margin-left:0.3125rem;margin-right:0}:host .wm-button.-primary:not(.-textonly){background:var(--wmcolor-button-background-primary);color:var(--wmcolor-button-text-primary)}:host .wm-button.-primary:not(.-textonly):not(:focus){-webkit-box-shadow:0 0 4px 0 rgba(0, 0, 0, 0.14), 0 3px 4px 0 rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2);box-shadow:0 0 4px 0 rgba(0, 0, 0, 0.14), 0 3px 4px 0 rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2)}:host .wm-button.-primary:not(.-textonly):hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-primary-hover)}:host .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-primary-ondark);background:var(--wmcolor-button-background-primary-ondark)}:host .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled):hover{background:var(--wmcolor-button-background-primary-hover-ondark)}:host .wm-button.-secondary{color:var(--wmcolor-button-text-secondary);border:2px solid var(--wmcolor-button-border-secondary);background:var(--wmcolor-button-background-secondary)}:host .wm-button.-secondary:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-secondary-hover);color:var(--wmcolor-button-text-secondary-hover);border-color:transparent}:host .wm-button.-secondary.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-secondary-ondark);background:var(--wmcolor-button-background-secondary-ondark);border-color:var(--wmcolor-button-border-secondary-ondark)}:host .wm-button.-secondary.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-text-secondary-hover-ondark);background:var(--wmcolor-button-background-secondary-hover-ondark);border-color:transparent}:host .wm-button.-textonly{color:var(--wmcolor-button-text-textonly);-webkit-box-shadow:none;box-shadow:none;display:inline-block;letter-spacing:0;text-transform:none;text-align:initial;font-size:0.875rem;border:none;background:transparent;padding:0;height:auto;min-height:unset;border-radius:0;line-height:1;overflow-wrap:anywhere}:host .wm-button.-textonly+.-textonly{margin-left:0.3125rem}:host .wm-button.-textonly:focus{outline:none}:host .wm-button.-textonly::-moz-focus-inner{border:0;outline:none}:host .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled) .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, var(--wmcolor-interactive-focus-textonly)), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, var(--wmcolor-interactive-focus-textonly) 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled).dark .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, var(--wmcolor-interactive-focus-textonly-ondark)), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, var(--wmcolor-interactive-focus-textonly-ondark) 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.-textonly.small{font-size:0.625rem}:host .wm-button.-textonly:hover:not(:disabled):not(.disabled):not(.-permanentlydelete){text-decoration:underline}:host .wm-button.-textonly.dark{color:var(--wmcolor-button-text-textonly-ondark)}:host .wm-button.-textonly.dark:hover:not(:disabled):not(.disabled){text-decoration:underline}:host .wm-button.-textonly.-permanentlydelete{color:var(--wmcolor-button-background-delete)}:host .wm-button.-textonly.-permanentlydelete:hover:not(:disabled):not(.disabled):not(.dark){text-decoration:underline}:host .wm-button.-textonly.-permanentlydelete.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-textonly-ondark)}:host .wm-button.-icononly,:host .wm-button.-navigational{-webkit-border-radius:50%;-moz-border-radius:50%;-ms-border-radius:50%;border-radius:50%;font-size:1rem;padding:0;height:auto;line-height:1;min-width:2.75rem;min-height:2.75rem;text-align:center;letter-spacing:normal}:host .wm-button.-icononly:not(:focus),:host .wm-button.-navigational:not(:focus){-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 48rem){:host .wm-button.-icononly,:host .wm-button.-navigational{min-width:2.5rem;min-height:2.5rem}}:host .wm-button.-icononly .mdi,:host .wm-button.-navigational .mdi{font-size:1.12rem}:host .wm-button.-icononly{border-width:1px !important;color:var(--wmcolor-button-icon-icononly);border-color:var(--wmcolor-button-border-icononly);background-color:var(--wmcolor-button-background-icononly)}:host .wm-button.-icononly:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:host .wm-button.-icononly:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-icononly-hover);color:var(--wmcolor-button-icon-icononly-hover);border-color:transparent}:host .wm-button.-icononly.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-icon-icononly-ondark);background:var(--wmcolor-button-background-icononly-ondark);border-color:var(--wmcolor-button-border-icononly-ondark)}:host .wm-button.-icononly.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-icon-icononly-hover-ondark);background:var(--wmcolor-button-background-icononly-hover-ondark);border-color:transparent}:host .wm-button.-navigational{border:none !important;background-color:var(--wmcolor-button-background-navigational)}:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled){color:var(--wmcolor-button-icon-navigational)}:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled):hover,:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled).selected{background-color:var(--wmcolor-button-background-navigational-hover)}:host .wm-button.-navigational:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:host .wm-button.-navigational.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-icon-navigational-ondark);background:var(--wmcolor-button-background-navigational-ondark)}:host .wm-button.-navigational.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-icon-navigational-hover-ondark);background:var(--wmcolor-button-background-navigational-hover-ondark)}:host .wm-button.-permanentlydelete:not(.-textonly){background:var(--wmcolor-button-background-delete);border-color:var(--wmcolor-button-background-delete);color:var(--wmcolor-button-text-delete)}:host .wm-button.-permanentlydelete:not(.-textonly):hover:not(:disabled):not(.disabled):not(.dark){background:var(--wmcolor-button-background-delete-hover);border-color:var(--wmcolor-button-background-delete-hover)}:host .wm-button.-permanentlydelete:not(.-textonly).dark:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-delete);border-color:var(--wmcolor-button-background-delete);color:var(--wmcolor-button-text-delete)}:host .wm-button.-permanentlydelete:not(.-textonly).dark:not(:disabled):not(.disabled):hover{background:var(--wmcolor-button-background-delete-hover);border-color:var(--wmcolor-button-background-delete-hover)}:host .wm-button.-pairnegative{background:var(--wmcolor-button-background-negative);border-color:var(--wmcolor-button-background-negative);color:var(--wmcolor-button-text-negative)}:host .wm-button.-pairnegative:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-negative-hover);border-color:var(--wmcolor-button-background-negative-hover)}:host .wm-button.-pairpositive{background:var(--wmcolor-button-background-positive);border-color:var(--wmcolor-button-background-positive);color:var(--wmcolor-button-text-positive)}:host .wm-button.-pairpositive:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-positive-hover);border-color:var(--wmcolor-button-background-positive-hover)}:host .wm-button.-selector,:host .wm-button.-selector-primary{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:block;border-radius:3px;height:2.75rem;min-width:11.4375rem;padding:0 1.875rem 0 0.9375rem;line-height:normal;font-family:inherit;font-weight:700;font-size:0.75rem;text-transform:uppercase;letter-spacing:0.01875rem;text-align:left}@media screen and (min-width: 48rem){:host .wm-button.-selector,:host .wm-button.-selector-primary{height:2.5rem}}:host .wm-button.-selector:before,:host .wm-button.-selector-primary:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f140";position:absolute;right:0.5625rem;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:1.12rem;font-weight:700;pointer-events:none}:host .wm-button.-selector:active,:host .wm-button.-selector-primary:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}:host .wm-button.-selector::-moz-focus-inner,:host .wm-button.-selector-primary::-moz-focus-inner{border:0}:host .wm-button.-selector .overflowcontrol,:host .wm-button.-selector-primary .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:visible}:host .wm-button.-selector{background:var(--wmcolor-button-background-selector);color:var(--wmcolor-button-text-selector);border-color:var(--wmcolor-button-border-selector)}:host .wm-button.-selector:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-selector-hover);color:var(--wmcolor-button-text-selector-hover);border-color:transparent}:host .wm-button.-selector.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-selector-ondark);border-color:var(--wmcolor-button-border-selector-ondark);background:var(--wmcolor-button-background-selector-ondark)}:host .wm-button.-selector.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-text-selector-hover-ondark);background:var(--wmcolor-button-background-selector-hover-ondark);border-color:transparent}:host .wm-button.-selector-primary{background:var(--wmcolor-button-background-selectorprimary);color:var(--wmcolor-button-text-selectorprimary)}:host .wm-button.-selector-primary:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-selectorprimary-hover)}:host .wm-button.-selector-primary.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-selectorprimary-ondark);background:var(--wmcolor-button-background-selectorprimary-ondark)}:host .wm-button.-selector-primary.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-text-selectorprimary-hover-ondark);background:var(--wmcolor-button-background-selectorprimary-hover-ondark)}:host .wm-button:disabled,:host .wm-button.disabled{cursor:default;pointer-events:none}:host .wm-button:disabled.-secondary:not(.-permanentlydelete),:host .wm-button.disabled.-secondary:not(.-permanentlydelete){-webkit-box-shadow:none;box-shadow:none;border-color:var(--wmcolor-button-border-secondary-disabled);color:var(--wmcolor-button-text-secondary-disabled)}:host .wm-button:disabled.-primary,:host .wm-button.disabled.-primary{background:var(--wmcolor-button-background-primary-disabled);color:var(--wmcolor-button-text-primary-disabled)}:host .wm-button:disabled.-permanentlydelete,:host .wm-button.disabled.-permanentlydelete{background:var(--wmcolor-button-background-delete-disabled);color:var(--wmcolor-button-text-delete-disabled);border-color:var(--wmcolor-button-background-delete-disabled)}:host .wm-button:disabled.-pairnegative,:host .wm-button.disabled.-pairnegative{background:var(--wmcolor-button-background-negative-disabled);border-color:var(--wmcolor-button-background-negative-disabled);color:var(--wmcolor-button-text-negative-disabled)}:host .wm-button:disabled.-pairpositive,:host .wm-button.disabled.-pairpositive{background:var(--wmcolor-button-background-positive-disabled);border-color:var(--wmcolor-button-background-positive-disabled);color:var(--wmcolor-button-text-positive-disabled)}:host .wm-button:disabled.-selector,:host .wm-button.disabled.-selector{color:var(--wmcolor-button-text-selector-disabled);border-color:var(--wmcolor-button-border-selector-disabled)}:host .wm-button:disabled.-selector-primary,:host .wm-button.disabled.-selector-primary{background:var(--wmcolor-button-background-selectorprimary-disabled);color:var(--wmcolor-button-text-selectorprimary-disabled)}:host .wm-button:disabled.-navigational,:host .wm-button.disabled.-navigational{color:var(--wmcolor-button-icon-navigational-disabled)}:host .wm-button:disabled.-icononly,:host .wm-button.disabled.-icononly{color:var(--wmcolor-button-icon-icononly-disabled);border-color:var(--wmcolor-button-border-icononly-disabled)}:host .wm-button:disabled.-textonly,:host .wm-button.disabled.-textonly{color:var(--wmcolor-button-text-textonly-disabled);background:transparent}:host .wm-button:disabled.dark.-icononly,:host .wm-button.disabled.dark.-icononly{background:transparent;color:var(--wmcolor-button-icon-icononly-disabled-ondark);border-color:var(--wmcolor-button-border-icononly-disabled-ondark)}:host .wm-button:disabled.dark.-navigational,:host .wm-button.disabled.dark.-navigational{color:var(--wmcolor-button-icon-navigational-disabled-ondark)}:host .wm-button:disabled.dark.-textonly,:host .wm-button.disabled.dark.-textonly{color:var(--wmcolor-button-text-textonly-disabled-ondark)}:host .wm-button:disabled.dark.-primary,:host .wm-button.disabled.dark.-primary{color:var(--wmcolor-button-text-primary-disabled-ondark);background:var(--wmcolor-button-background-primary-disabled-ondark)}:host .wm-button:disabled.dark.-secondary,:host .wm-button.disabled.dark.-secondary{background:transparent;color:var(--wmcolor-button-text-secondary-disabled-ondark);border-color:var(--wmcolor-button-border-secondary-disabled-ondark)}:host .wm-button:disabled.dark.-selector,:host .wm-button.disabled.dark.-selector{color:var(--wmcolor-button-text-selector-disabled-ondark);border-color:var(--wmcolor-button-border-selector-disabled-ondark);background:var(--wmcolor-button-background-selector-disabled-ondark)}:host .wm-button:disabled.dark.-selector-primary,:host .wm-button.disabled.dark.-selector-primary{color:var(--wmcolor-button-text-selectorprimary-disabled-ondark);background:var(--wmcolor-button-background-selectorprimary-disabled-ondark)}:host .wm-button:disabled.dark.-permanentlydelete:not(.-textonly),:host .wm-button.disabled.dark.-permanentlydelete:not(.-textonly){background:var(--wmcolor-button-background-delete-disabled-ondark);color:var(--wmcolor-button-text-delete-disabled-ondark)}:host a.wm-button,:host label.wm-button{height:auto;padding-top:0.75rem;padding-bottom:0.75rem}:host([disabled]),:host(.button-disabled){pointer-events:none}:host([disabled=false]){pointer-events:initial}:host{display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:100%;min-width:-webkit-min-content;min-width:-moz-min-content;min-width:min-content;position:relative;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host(.-textonly){min-width:0}';var Button=function(){function o(o){registerInstance(this,o);this.id=generateId();this.ariaPopup=false;this.disabled=false;this.buttonType=null;this.buttonStyle=null;this.icon=undefined;this.iconSize=undefined;this.iconRotate=undefined;this.iconFlip=undefined;this.tooltip=undefined;this.labelForIdenticalButtons=undefined;this.tooltipPosition="bottom-right";this.permanentlyDelete=false;this.textWrap=true;this.customBackground=undefined;this.isSubmit=false;this.isTabbing=false}Object.defineProperty(o.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"tempButtonType",{get:function(){return this.buttonType||this.buttonStyle||"secondary"},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"isTruncated",{get:function(){return!!this.buttonEl&&this.tempButtonType==="textonly"&&this.buttonEl.offsetWidth<this.buttonEl.scrollWidth},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"hasTooltip",{get:function(){return["icononly","navigational"].includes(this.tempButtonType)||this.isTruncated},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"buttonClasses",{get:function(){var o="wm-button";o+=this.permanentlyDelete?" -permanentlydelete":"";o+=this.tempButtonType?" -"+this.tempButtonType:" -secondary";o+=this.textWrap?"":" nowrap";o+=this.isTabbing?" user-is-tabbing":"";o+=this.isTruncated?" -truncated":"";o+=this.customBackground==="dark"?" dark":"";return o},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"iconStyles",{get:function(){var o="";o+=this.iconRotate?"rotate(".concat(this.iconRotate,"deg)"):"";o+=this.iconFlip==="horizontal"?"scaleX(-1)":"";o+=this.iconFlip==="vertical"?"scaleY(-1)":"";return Object.assign(Object.assign({},this.iconSize&&{fontSize:this.iconSize}),(this.iconRotate||this.iconFlip)&&{transform:o})},enumerable:false,configurable:true});o.prototype.toggleTabbingOn=function(){this.isTabbing=true};o.prototype.toggleTabbingOff=function(){this.isTabbing=false};o.prototype.handleScroll=function(){hideTooltip()};o.prototype.validateType=function(o){var t=["primary","secondary","textonly","icononly","navigational","selector","selector-primary","pairpositive","pairnegative"].includes(o);if(!t){this.buttonType="secondary"}this.validateIcon()};o.prototype.validateDeprecatedType=function(o){var t=["primary","secondary","textonly","icononly","navigational","selector"].includes(o);if(!t){this.buttonStyle="secondary"}this.validateIcon()};o.prototype.updateIcon=function(){this.icon=getIconCodeFromName(this.icon)};o.prototype.handleDisabledChange=function(){removeDisabledAttribute(this.el,this.isDisabled)};o.prototype.validateIcon=function(){switch(this.tempButtonType){case"icononly":case"navigational":if(!this.icon){console.error("wm-button should have a valid 'icon' property when button-type is set to 'icononly' or 'navigational'.")}if(!this.tooltip){console.error("wm-button should have a valid 'tooltip' property when button-type is set to 'icononly' or 'navigational'.")}break;case"pairpositive":this.icon="f12c";break;case"pairnegative":this.icon="f739";break}};o.prototype.handleKeydown=function(o){switch(o.key){case"Enter":o.preventDefault();if(!this.isDisabled){this.el.click()}break}};o.prototype.handleMouseEnter=function(o){if(this.hasTooltip){var t="";if(this.isTruncated&&this.el.textContent){t=this.el.textContent}else if(this.tooltip){t=this.tooltip}showTooltip(this.tooltipPosition,o.target,t)}};o.prototype.handleFocus=function(o){if(this.hasTooltip&&this.isTabbing){var t="";if(this.isTruncated&&this.el.textContent){t=this.el.textContent}else if(this.tooltip){t=this.tooltip}showTooltip(this.tooltipPosition,o.target,t)}};o.prototype.componentWillLoad=function(){if(this.buttonStyle){console.warn("wm-button: button-style has been deprecated as of v3.1.0. Please use button-type instead.")}this.validateType(this.tempButtonType);if(this.icon){this.icon=this.icon=getIconCodeFromName(this.icon)}removeDisabledAttribute(this.el,this.isDisabled)};o.prototype.componentDidLoad=function(){var o=this;if(document.body.classList.contains("wmcl-user-is-tabbing")){this.toggleTabbingOn()}this.isSubmit&&this.el.addEventListener("click",(function(){return triggerFormSubmit(o.el.closest("form"))}));this.ariaPopup=!!this.el.getAttribute("aria-haspopup")};o.prototype.getAriaLabel=function(){if(this.tempButtonType==="icononly"||this.tempButtonType==="navigational"){return this.labelForIdenticalButtons||this.tooltip}if(this.labelForIdenticalButtons){return this.labelForIdenticalButtons}};o.prototype.render=function(){var o=this;return h(Host,{class:"".concat(this.isDisabled?"button-disabled":""," -").concat(this.tempButtonType)},h("button",{id:this.id,class:"".concat(this.buttonClasses),disabled:this.isDisabled,ref:function(t){return o.buttonEl=t},"aria-label":this.getAriaLabel(),"aria-hasPopup":this.ariaPopup?"menu":null,onMouseEnter:function(t){return o.handleMouseEnter(t)},onMouseLeave:function(){return hideTooltip()},onFocus:function(t){return o.handleFocus(t)},onBlur:function(){return hideTooltip()},onClick:function(){return hideTooltip()}},this.icon&&h("span",{class:"mdi",style:this.iconStyles,"aria-hidden":"true"},String.fromCodePoint(parseInt("0x".concat(this.icon)))),h("span",{class:"button-text"},h("slot",null))))};Object.defineProperty(o,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{buttonType:["validateType"],buttonStyle:["validateDeprecatedType"],icon:["updateIcon"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return o}();Button.style=wmButtonCss;export{Button as wm_button};
|
|
1
|
+
import{r as registerInstance,h,H as Host,g as getElement}from"./index-294d486f.js";import{g as getIconCodeFromName}from"./interfaces-61c6305b.js";import{g as generateId,t as toBool,h as hideTooltip,a as handleDisabledAttribute,s as showTooltip,b as triggerFormSubmit}from"./functions-e8b2c205.js";var wmButtonCss=':host .wm-button{-ms-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-moz-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1), border 500ms cubic-bezier(0.4, 0, 0.2, 1);-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;border-radius:5px;width:100%;border:2px solid transparent;font-family:inherit;font-size:0.75rem;font-weight:700;min-height:2.75rem;padding:12px 1.3333333333em;cursor:pointer;position:relative;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;text-decoration:none;text-transform:uppercase;letter-spacing:0.01875rem;overflow-wrap:break-word;-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 48rem){:host .wm-button{min-height:3.3333333333em}}:host .wm-button.nowrap{display:inline-block;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host .wm-button:focus{outline:none;-webkit-box-shadow:none;box-shadow:none}:host .wm-button::-moz-focus-inner{border:0;outline:none}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark){-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus)}:host .wm-button.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled):not(.dark)::-moz-focus-inner{border:0}:host .wm-button.dark.user-is-tabbing:focus:not(.-textonly):not(:disabled):not(.disabled).dark{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus-ondark);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus-ondark);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus-ondark);outline:none}:host .wm-button:active:not(:disabled):not(.disabled):not(.-textonly):not(.-actionbutton):not(.displayedoption){-ms-transform:scale(0.9, 0.9);-webkit-transform:scale(0.9, 0.9);-moz-transform:scale(0.9, 0.9);transform:scale(0.9, 0.9)}:host .wm-button .mdi{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:host .wm-button:not(.-icononly):not(.-navigational) .mdi{margin-right:0.3125rem;font-size:0.875rem}:host .wm-button[dir=RTL] :not(.-icononly) .mdi{margin-left:0.3125rem;margin-right:0}:host .wm-button.-primary:not(.-textonly){background:var(--wmcolor-button-background-primary);color:var(--wmcolor-button-text-primary)}:host .wm-button.-primary:not(.-textonly):not(:focus){-webkit-box-shadow:0 0 4px 0 rgba(0, 0, 0, 0.14), 0 3px 4px 0 rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2);box-shadow:0 0 4px 0 rgba(0, 0, 0, 0.14), 0 3px 4px 0 rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2)}:host .wm-button.-primary:not(.-textonly):hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-primary-hover)}:host .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-primary-ondark);background:var(--wmcolor-button-background-primary-ondark)}:host .wm-button.-primary:not(.-textonly).dark:not(:disabled):not(.disabled):hover{background:var(--wmcolor-button-background-primary-hover-ondark)}:host .wm-button.-secondary{color:var(--wmcolor-button-text-secondary);border:2px solid var(--wmcolor-button-border-secondary);background:var(--wmcolor-button-background-secondary)}:host .wm-button.-secondary:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-secondary-hover);color:var(--wmcolor-button-text-secondary-hover);border-color:transparent}:host .wm-button.-secondary.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-secondary-ondark);background:var(--wmcolor-button-background-secondary-ondark);border-color:var(--wmcolor-button-border-secondary-ondark)}:host .wm-button.-secondary.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-text-secondary-hover-ondark);background:var(--wmcolor-button-background-secondary-hover-ondark);border-color:transparent}:host .wm-button.-textonly{color:var(--wmcolor-button-text-textonly);-webkit-box-shadow:none;box-shadow:none;display:inline-block;letter-spacing:0;text-transform:none;text-align:initial;font-size:0.875rem;border:none;background:transparent;padding:0;height:auto;min-height:unset;border-radius:0;line-height:1;overflow-wrap:anywhere}:host .wm-button.-textonly+.-textonly{margin-left:0.3125rem}:host .wm-button.-textonly:focus{outline:none}:host .wm-button.-textonly::-moz-focus-inner{border:0;outline:none}:host .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled) .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, var(--wmcolor-interactive-focus-textonly)), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, var(--wmcolor-interactive-focus-textonly) 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.-textonly.user-is-tabbing:focus:not(:disabled):not(.disabled).dark .button-text{background:-webkit-gradient(linear, left top, right top, color-stop(66%, var(--wmcolor-interactive-focus-textonly-ondark)), color-stop(0, transparent)) repeat-x;background:linear-gradient(90deg, var(--wmcolor-interactive-focus-textonly-ondark) 66%, transparent 0) repeat-x;background-size:6px 3px;background-position:0 1em;border-radius:0;line-height:normal}:host .wm-button.-textonly.small{font-size:0.625rem}:host .wm-button.-textonly:hover:not(:disabled):not(.disabled):not(.-permanentlydelete){text-decoration:underline}:host .wm-button.-textonly.dark{color:var(--wmcolor-button-text-textonly-ondark)}:host .wm-button.-textonly.dark:hover:not(:disabled):not(.disabled){text-decoration:underline}:host .wm-button.-textonly.-permanentlydelete{color:var(--wmcolor-button-background-delete)}:host .wm-button.-textonly.-permanentlydelete:hover:not(:disabled):not(.disabled):not(.dark){text-decoration:underline}:host .wm-button.-textonly.-permanentlydelete.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-textonly-ondark)}:host .wm-button.-icononly,:host .wm-button.-navigational{-webkit-border-radius:50%;-moz-border-radius:50%;-ms-border-radius:50%;border-radius:50%;font-size:1rem;padding:0;height:auto;line-height:1;min-width:2.75rem;min-height:2.75rem;text-align:center;letter-spacing:normal}:host .wm-button.-icononly:not(:focus),:host .wm-button.-navigational:not(:focus){-webkit-box-shadow:none;box-shadow:none}@media screen and (min-width: 48rem){:host .wm-button.-icononly,:host .wm-button.-navigational{min-width:2.5rem;min-height:2.5rem}}:host .wm-button.-icononly .mdi,:host .wm-button.-navigational .mdi{font-size:1.12rem}:host .wm-button.-icononly{border-width:1px !important;color:var(--wmcolor-button-icon-icononly);border-color:var(--wmcolor-button-border-icononly);background-color:var(--wmcolor-button-background-icononly)}:host .wm-button.-icononly:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:host .wm-button.-icononly:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-icononly-hover);color:var(--wmcolor-button-icon-icononly-hover);border-color:transparent}:host .wm-button.-icononly.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-icon-icononly-ondark);background:var(--wmcolor-button-background-icononly-ondark);border-color:var(--wmcolor-button-border-icononly-ondark)}:host .wm-button.-icononly.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-icon-icononly-hover-ondark);background:var(--wmcolor-button-background-icononly-hover-ondark);border-color:transparent}:host .wm-button.-navigational{border:none !important;background-color:var(--wmcolor-button-background-navigational)}:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled){color:var(--wmcolor-button-icon-navigational)}:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled):hover,:host .wm-button.-navigational:not(.dark):not(:disabled):not(.disabled).selected{background-color:var(--wmcolor-button-background-navigational-hover)}:host .wm-button.-navigational:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:host .wm-button.-navigational.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-icon-navigational-ondark);background:var(--wmcolor-button-background-navigational-ondark)}:host .wm-button.-navigational.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-icon-navigational-hover-ondark);background:var(--wmcolor-button-background-navigational-hover-ondark)}:host .wm-button.-permanentlydelete:not(.-textonly){background:var(--wmcolor-button-background-delete);border-color:var(--wmcolor-button-background-delete);color:var(--wmcolor-button-text-delete)}:host .wm-button.-permanentlydelete:not(.-textonly):hover:not(:disabled):not(.disabled):not(.dark){background:var(--wmcolor-button-background-delete-hover);border-color:var(--wmcolor-button-background-delete-hover)}:host .wm-button.-permanentlydelete:not(.-textonly).dark:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-delete);border-color:var(--wmcolor-button-background-delete);color:var(--wmcolor-button-text-delete)}:host .wm-button.-permanentlydelete:not(.-textonly).dark:not(:disabled):not(.disabled):hover{background:var(--wmcolor-button-background-delete-hover);border-color:var(--wmcolor-button-background-delete-hover)}:host .wm-button.-pairnegative{background:var(--wmcolor-button-background-negative);border-color:var(--wmcolor-button-background-negative);color:var(--wmcolor-button-text-negative)}:host .wm-button.-pairnegative:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-negative-hover);border-color:var(--wmcolor-button-background-negative-hover)}:host .wm-button.-pairpositive{background:var(--wmcolor-button-background-positive);border-color:var(--wmcolor-button-background-positive);color:var(--wmcolor-button-text-positive)}:host .wm-button.-pairpositive:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-positive-hover);border-color:var(--wmcolor-button-background-positive-hover)}:host .wm-button.-selector,:host .wm-button.-selector-primary{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:block;border-radius:3px;height:2.75rem;min-width:11.4375rem;padding:0 1.875rem 0 0.9375rem;line-height:normal;font-family:inherit;font-weight:700;font-size:0.75rem;text-transform:uppercase;letter-spacing:0.01875rem;text-align:left}@media screen and (min-width: 48rem){:host .wm-button.-selector,:host .wm-button.-selector-primary{height:2.5rem}}:host .wm-button.-selector:before,:host .wm-button.-selector-primary:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f140";position:absolute;right:0.5625rem;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:1.12rem;font-weight:700;pointer-events:none}:host .wm-button.-selector:active,:host .wm-button.-selector-primary:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}:host .wm-button.-selector::-moz-focus-inner,:host .wm-button.-selector-primary::-moz-focus-inner{border:0}:host .wm-button.-selector .overflowcontrol,:host .wm-button.-selector-primary .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:visible}:host .wm-button.-selector{background:var(--wmcolor-button-background-selector);color:var(--wmcolor-button-text-selector);border-color:var(--wmcolor-button-border-selector)}:host .wm-button.-selector:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-selector-hover);color:var(--wmcolor-button-text-selector-hover);border-color:transparent}:host .wm-button.-selector.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-selector-ondark);border-color:var(--wmcolor-button-border-selector-ondark);background:var(--wmcolor-button-background-selector-ondark)}:host .wm-button.-selector.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-text-selector-hover-ondark);background:var(--wmcolor-button-background-selector-hover-ondark);border-color:transparent}:host .wm-button.-selector-primary{background:var(--wmcolor-button-background-selectorprimary);color:var(--wmcolor-button-text-selectorprimary)}:host .wm-button.-selector-primary:hover:not(:disabled):not(.disabled){background:var(--wmcolor-button-background-selectorprimary-hover)}:host .wm-button.-selector-primary.dark:not(:disabled):not(.disabled){color:var(--wmcolor-button-text-selectorprimary-ondark);background:var(--wmcolor-button-background-selectorprimary-ondark)}:host .wm-button.-selector-primary.dark:not(:disabled):not(.disabled):hover{color:var(--wmcolor-button-text-selectorprimary-hover-ondark);background:var(--wmcolor-button-background-selectorprimary-hover-ondark)}:host .wm-button:disabled,:host .wm-button.disabled{cursor:default;pointer-events:none}:host .wm-button:disabled.-secondary:not(.-permanentlydelete),:host .wm-button.disabled.-secondary:not(.-permanentlydelete){-webkit-box-shadow:none;box-shadow:none;border-color:var(--wmcolor-button-border-secondary-disabled);color:var(--wmcolor-button-text-secondary-disabled)}:host .wm-button:disabled.-primary,:host .wm-button.disabled.-primary{background:var(--wmcolor-button-background-primary-disabled);color:var(--wmcolor-button-text-primary-disabled)}:host .wm-button:disabled.-permanentlydelete,:host .wm-button.disabled.-permanentlydelete{background:var(--wmcolor-button-background-delete-disabled);color:var(--wmcolor-button-text-delete-disabled);border-color:var(--wmcolor-button-background-delete-disabled)}:host .wm-button:disabled.-pairnegative,:host .wm-button.disabled.-pairnegative{background:var(--wmcolor-button-background-negative-disabled);border-color:var(--wmcolor-button-background-negative-disabled);color:var(--wmcolor-button-text-negative-disabled)}:host .wm-button:disabled.-pairpositive,:host .wm-button.disabled.-pairpositive{background:var(--wmcolor-button-background-positive-disabled);border-color:var(--wmcolor-button-background-positive-disabled);color:var(--wmcolor-button-text-positive-disabled)}:host .wm-button:disabled.-selector,:host .wm-button.disabled.-selector{color:var(--wmcolor-button-text-selector-disabled);border-color:var(--wmcolor-button-border-selector-disabled)}:host .wm-button:disabled.-selector-primary,:host .wm-button.disabled.-selector-primary{background:var(--wmcolor-button-background-selectorprimary-disabled);color:var(--wmcolor-button-text-selectorprimary-disabled)}:host .wm-button:disabled.-navigational,:host .wm-button.disabled.-navigational{color:var(--wmcolor-button-icon-navigational-disabled)}:host .wm-button:disabled.-icononly,:host .wm-button.disabled.-icononly{color:var(--wmcolor-button-icon-icononly-disabled);border-color:var(--wmcolor-button-border-icononly-disabled)}:host .wm-button:disabled.-textonly,:host .wm-button.disabled.-textonly{color:var(--wmcolor-button-text-textonly-disabled);background:transparent}:host .wm-button:disabled.dark.-icononly,:host .wm-button.disabled.dark.-icononly{background:transparent;color:var(--wmcolor-button-icon-icononly-disabled-ondark);border-color:var(--wmcolor-button-border-icononly-disabled-ondark)}:host .wm-button:disabled.dark.-navigational,:host .wm-button.disabled.dark.-navigational{color:var(--wmcolor-button-icon-navigational-disabled-ondark)}:host .wm-button:disabled.dark.-textonly,:host .wm-button.disabled.dark.-textonly{color:var(--wmcolor-button-text-textonly-disabled-ondark)}:host .wm-button:disabled.dark.-primary,:host .wm-button.disabled.dark.-primary{color:var(--wmcolor-button-text-primary-disabled-ondark);background:var(--wmcolor-button-background-primary-disabled-ondark)}:host .wm-button:disabled.dark.-secondary,:host .wm-button.disabled.dark.-secondary{background:transparent;color:var(--wmcolor-button-text-secondary-disabled-ondark);border-color:var(--wmcolor-button-border-secondary-disabled-ondark)}:host .wm-button:disabled.dark.-selector,:host .wm-button.disabled.dark.-selector{color:var(--wmcolor-button-text-selector-disabled-ondark);border-color:var(--wmcolor-button-border-selector-disabled-ondark);background:var(--wmcolor-button-background-selector-disabled-ondark)}:host .wm-button:disabled.dark.-selector-primary,:host .wm-button.disabled.dark.-selector-primary{color:var(--wmcolor-button-text-selectorprimary-disabled-ondark);background:var(--wmcolor-button-background-selectorprimary-disabled-ondark)}:host .wm-button:disabled.dark.-permanentlydelete:not(.-textonly),:host .wm-button.disabled.dark.-permanentlydelete:not(.-textonly){background:var(--wmcolor-button-background-delete-disabled-ondark);color:var(--wmcolor-button-text-delete-disabled-ondark)}:host a.wm-button,:host label.wm-button{height:auto;padding-top:0.75rem;padding-bottom:0.75rem}:host([disabled]),:host(.button-disabled){pointer-events:none}:host([disabled=false]){pointer-events:initial}:host{display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:100%;min-width:-webkit-min-content;min-width:-moz-min-content;min-width:min-content;position:relative;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host(.-textonly){min-width:0}';var Button=function(){function o(o){registerInstance(this,o);this.id=generateId();this.ariaPopup=false;this.disabled=false;this.buttonType=null;this.buttonStyle=null;this.icon=undefined;this.iconSize=undefined;this.iconRotate=undefined;this.iconFlip=undefined;this.tooltip=undefined;this.labelForIdenticalButtons=undefined;this.tooltipPosition="bottom-right";this.permanentlyDelete=false;this.textWrap=true;this.customBackground=undefined;this.isSubmit=false;this.isTabbing=false}Object.defineProperty(o.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"tempButtonType",{get:function(){return this.buttonType||this.buttonStyle||"secondary"},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"isTruncated",{get:function(){return!!this.buttonEl&&this.tempButtonType==="textonly"&&this.buttonEl.offsetWidth<this.buttonEl.scrollWidth},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"hasTooltip",{get:function(){return["icononly","navigational"].includes(this.tempButtonType)||this.isTruncated},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"buttonClasses",{get:function(){var o="wm-button";o+=this.permanentlyDelete?" -permanentlydelete":"";o+=this.tempButtonType?" -"+this.tempButtonType:" -secondary";o+=this.textWrap?"":" nowrap";o+=this.isTabbing?" user-is-tabbing":"";o+=this.isTruncated?" -truncated":"";o+=this.customBackground==="dark"?" dark":"";return o},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"iconStyles",{get:function(){var o="";o+=this.iconRotate?"rotate(".concat(this.iconRotate,"deg)"):"";o+=this.iconFlip==="horizontal"?"scaleX(-1)":"";o+=this.iconFlip==="vertical"?"scaleY(-1)":"";return Object.assign(Object.assign({},this.iconSize&&{fontSize:this.iconSize}),(this.iconRotate||this.iconFlip)&&{transform:o})},enumerable:false,configurable:true});o.prototype.toggleTabbingOn=function(){this.isTabbing=true};o.prototype.toggleTabbingOff=function(){this.isTabbing=false};o.prototype.handleScroll=function(){hideTooltip()};o.prototype.validateType=function(o){var t=["primary","secondary","textonly","icononly","navigational","selector","selector-primary","pairpositive","pairnegative"].includes(o);if(!t){this.buttonType="secondary"}this.validateIcon()};o.prototype.validateDeprecatedType=function(o){var t=["primary","secondary","textonly","icononly","navigational","selector"].includes(o);if(!t){this.buttonStyle="secondary"}this.validateIcon()};o.prototype.updateIcon=function(){this.icon=getIconCodeFromName(this.icon)};o.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};o.prototype.validateIcon=function(){switch(this.tempButtonType){case"icononly":case"navigational":if(!this.icon){console.error("wm-button should have a valid 'icon' property when button-type is set to 'icononly' or 'navigational'.")}if(!this.tooltip){console.error("wm-button should have a valid 'tooltip' property when button-type is set to 'icononly' or 'navigational'.")}break;case"pairpositive":this.icon="f12c";break;case"pairnegative":this.icon="f739";break}};o.prototype.handleKeydown=function(o){switch(o.key){case"Enter":o.preventDefault();if(!this.isDisabled){this.el.click()}break}};o.prototype.handleMouseEnter=function(o){if(this.hasTooltip){var t="";if(this.isTruncated&&this.el.textContent){t=this.el.textContent}else if(this.tooltip){t=this.tooltip}showTooltip(this.tooltipPosition,o.target,t)}};o.prototype.handleFocus=function(o){if(this.hasTooltip&&this.isTabbing){var t="";if(this.isTruncated&&this.el.textContent){t=this.el.textContent}else if(this.tooltip){t=this.tooltip}showTooltip(this.tooltipPosition,o.target,t)}};o.prototype.componentWillLoad=function(){if(this.buttonStyle){console.warn("wm-button: button-style has been deprecated as of v3.1.0. Please use button-type instead.")}this.validateType(this.tempButtonType);if(this.icon){this.icon=this.icon=getIconCodeFromName(this.icon)}handleDisabledAttribute(this.el,this.isDisabled)};o.prototype.componentDidLoad=function(){var o=this;if(document.body.classList.contains("wmcl-user-is-tabbing")){this.toggleTabbingOn()}this.isSubmit&&this.el.addEventListener("click",(function(){return triggerFormSubmit(o.el.closest("form"))}));this.ariaPopup=!!this.el.getAttribute("aria-haspopup")};o.prototype.getAriaLabel=function(){if(this.tempButtonType==="icononly"||this.tempButtonType==="navigational"){return this.labelForIdenticalButtons||this.tooltip}if(this.labelForIdenticalButtons){return this.labelForIdenticalButtons}};o.prototype.render=function(){var o=this;return h(Host,{class:"".concat(this.isDisabled?"button-disabled":""," -").concat(this.tempButtonType)},h("button",{id:this.id,class:"".concat(this.buttonClasses),disabled:this.isDisabled,ref:function(t){return o.buttonEl=t},"aria-label":this.getAriaLabel(),"aria-hasPopup":this.ariaPopup?"menu":null,onMouseEnter:function(t){return o.handleMouseEnter(t)},onMouseLeave:function(){return hideTooltip()},onFocus:function(t){return o.handleFocus(t)},onBlur:function(){return hideTooltip()},onClick:function(){return hideTooltip()}},this.icon&&h("span",{class:"mdi",style:this.iconStyles,"aria-hidden":"true"},String.fromCodePoint(parseInt("0x".concat(this.icon)))),h("span",{class:"button-text"},h("slot",null))))};Object.defineProperty(o,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{buttonType:["validateType"],buttonStyle:["validateDeprecatedType"],icon:["updateIcon"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return o}();Button.style=wmButtonCss;export{Button as wm_button};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,n){function p(e){try{s(o.next(e))}catch(e){n(e)}}function i(e){try{s(o["throw"](e))}catch(e){n(e)}}function s(e){e.done?r(e.value):a(e.value).then(p,i)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,a,n,p;return p={next:i(0),throw:i(1),return:i(2)},typeof Symbol==="function"&&(p[Symbol.iterator]=function(){return this}),p;function i(e){return function(t){return s([e,t])}}function s(i){if(o)throw new TypeError("Generator is already executing.");while(p&&(p=0,i[0]&&(r=0)),r)try{if(o=1,a&&(n=i[0]&2?a["return"]:i[0]?a["throw"]||((n=a["return"])&&n.call(a),0):a.next)&&!(n=n.call(a,i[1])).done)return n;if(a=0,n)i=[i[0]&2,n.value];switch(i[0]){case 0:case 1:n=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;a=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(n=r.trys,n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1];n=i;break}if(n&&r.label<n[2]){r.label=n[2];r.ops.push(i);break}if(n[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];a=0}finally{o=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-294d486f.js";import{g as generateId,d as debounce}from"./functions-abbff9c1.js";import{g as getDetails,a as allChartsDetails,h as handleChartKeydown,b as amountToPercent,r as renderSimpleBar,c as renderStackedBar,d as renderDoughnut,e as renderInstructionsText,f as renderLegend,i as renderCompletionMessage,j as renderHiddenValuesMessage,k as exitChart}from"./chartFunctions-5f009626.js";import{c as chartMessages}from"./intl-7c8d2db9.js";var wmChartCss=":host{--wmcolor-chart-label-text-negative:var(--wmcolor-text-negative);--wmcolor-chart-label-text-positive:var(--wmcolor-text-positive);--wmcolor-chart-label-text:var(--wmcolor-text);--wmcolor-chart-subinfo-text:var(--wmcolor-text);--wmcolor-chart-value-text:var(--wmcolor-text);display:block}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;font-size:0.875rem;position:relative;outline:none;}:host .component-wrapper .label{display:block;margin:0;padding-bottom:0.25rem;font-weight:600;position:relative}:host .component-wrapper .label .subinfo{display:block;font-weight:normal;font-style:italic;bottom:0.25rem;width:100%;color:var(--wmcolor-chart-subinfo-text)}:host .component-wrapper .label.custom-width{width:var(--custom-label-width)}:host .component-wrapper .label.--none{display:none}:host .component-wrapper .doughnut-svg,:host .component-wrapper .inner-stacked-bar-wrapper{overflow:visible}:host .component-wrapper .bar-wrapper{-ms-flex-positive:1;flex-grow:1;width:100%}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper{width:100%}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .values{display:-ms-flexbox;display:flex}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .stacked-bar-segments-wrapper{display:-ms-flexbox;display:flex}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .stacked-bar-segments-wrapper .stacked-bar-segment{height:30px;cursor:pointer}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .stacked-bar-segments-wrapper .stacked-bar-segment:not(.zero):not(:last-of-type){margin-right:2px}:host .component-wrapper .doughnut-wrapper{-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px}:host .component-wrapper .doughnut-wrapper .doughnut-segment{cursor:pointer}:host .component-wrapper .value-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .component-wrapper .value-wrapper:not(:last-of-type){margin-right:2px}:host .component-wrapper .value-wrapper .value.hidden{visibility:hidden}:host .component-wrapper path:active,:host .component-wrapper path:hover,:host .component-wrapper path:focus,:host .component-wrapper .stacked-bar-segment:active,:host .component-wrapper .stacked-bar-segment:hover,:host .component-wrapper .stacked-bar-segment:focus{outline:none}:host .component-wrapper .stacked-bar-segment:active.stacked-bar-segment,:host .component-wrapper .stacked-bar-segment:hover.stacked-bar-segment,:host .component-wrapper .stacked-bar-segment:focus.stacked-bar-segment{-webkit-box-shadow:0px 0px 6px #333;-moz-box-shadow:0px 0px 6px #333;box-shadow:0px 0px 6px #333}:host .component-wrapper path:active.doughnut-segment,:host .component-wrapper path:hover.doughnut-segment,:host .component-wrapper path:focus.doughnut-segment,:host .component-wrapper .stacked-bar-segment:active.doughnut-segment,:host .component-wrapper .stacked-bar-segment:hover.doughnut-segment,:host .component-wrapper .stacked-bar-segment:focus.doughnut-segment{-webkit-filter:url(#wmHoverDropShadow);filter:url(#wmHoverDropShadow)}:host .component-wrapper path::-moz-focus-inner,:host .component-wrapper .stacked-bar-segment::-moz-focus-inner{border:0;outline:none}:host .component-wrapper.doughnut{width:300px}:host .component-wrapper.doughnut1 label,:host .component-wrapper.doughnut1 .label-text,:host .component-wrapper.doughnut2 label,:host .component-wrapper.doughnut2 .label-text,:host .component-wrapper.doughnut2b label,:host .component-wrapper.doughnut2b .label-text,:host .component-wrapper.doughnut3 label,:host .component-wrapper.doughnut3 .label-text{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .component-wrapper.doughnut0,:host .component-wrapper.doughnut{-ms-flex-align:center;align-items:center}:host .component-wrapper.doughnut0 label,:host .component-wrapper.doughnut label{text-align:center;width:100%;padding-bottom:1.5rem}:host .component-wrapper.doughnut0 label .subinfo,:host .component-wrapper.doughnut label .subinfo{position:absolute}:host .component-wrapper.doughnut0 .completion-message,:host .component-wrapper.doughnut .completion-message{padding-top:0.625rem}:host .component-wrapper.bar1,:host .component-wrapper.bar{padding:1.25rem;-ms-flex-align:start;align-items:flex-start}:host .component-wrapper.bar1 label,:host .component-wrapper.bar label{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .component-wrapper.bar1 label .subinfo,:host .component-wrapper.bar label .subinfo{position:initial}:host .component-wrapper.bar1 .chart-wrapper,:host .component-wrapper.bar .chart-wrapper{display:-ms-flexbox;display:flex}:host .component-wrapper.bar1 .chart-wrapper .single-perc,:host .component-wrapper.bar .chart-wrapper .single-perc{width:4rem;-ms-flex:none;flex:none;display:-ms-flexbox;display:flex;height:30px;-ms-flex-align:center;align-items:center}:host .component-wrapper.bar1 .chart-wrapper .inner-stacked-bar-wrapper,:host .component-wrapper.bar .chart-wrapper .inner-stacked-bar-wrapper{-ms-flex:1;flex:1}:host .component-wrapper.bar1 .chart-wrapper .completion-message,:host .component-wrapper.bar .chart-wrapper .completion-message{width:100%;text-align:right;margin-top:0.25rem}@media screen and (min-width: 768px){:host .component-wrapper.bar1,:host .component-wrapper.bar{-ms-flex-direction:row;flex-direction:row}:host .component-wrapper.bar1 label,:host .component-wrapper.bar label{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;min-height:30px;width:12rem;text-align:left;padding-right:1.25rem;padding-bottom:0;-ms-flex:none;flex:none}:host .component-wrapper.bar1 .bar-wrapper,:host .component-wrapper.bar .bar-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host .component-wrapper.bar1 .bar-wrapper .single-perc,:host .component-wrapper.bar .bar-wrapper .single-perc{text-align:center;padding-left:0.5rem;-ms-flex-pack:center;justify-content:center}}:host .component-wrapper.bar2,:host .component-wrapper.bar2b,:host .component-wrapper.bar3,:host .component-wrapper.bar4,:host .component-wrapper.bar5{-ms-flex-align:start;align-items:flex-start}:host .component-wrapper.bar2 .inner-stacked-bar-wrapper,:host .component-wrapper.bar2b .inner-stacked-bar-wrapper,:host .component-wrapper.bar4 .inner-stacked-bar-wrapper,:host .component-wrapper.bar5 .inner-stacked-bar-wrapper{height:30px;margin-bottom:0}:host .component-wrapper.bar2 .inner-stacked-bar-wrapper.show-values,:host .component-wrapper.bar2b .inner-stacked-bar-wrapper.show-values,:host .component-wrapper.bar4 .inner-stacked-bar-wrapper.show-values,:host .component-wrapper.bar5 .inner-stacked-bar-wrapper.show-values{height:60px;margin-top:0}:host .component-wrapper.bar3 .chart-wrapper{position:relative;height:100px}:host .component-wrapper.bar3 .chart-wrapper .inner-stacked-bar-wrapper{position:absolute;top:35px;left:0;right:0;bottom:0;height:30px}:host .component-wrapper.bar3 .chart-wrapper .axis{position:absolute;top:0;left:0;height:90px;width:100%;overflow:visible;-webkit-transform:translateY(90px);transform:translateY(90px)}:host .component-wrapper.bar3 .chart-wrapper .axis line{stroke:var(--wmcolor-chart-gridline);stroke-width:1px}:host .component-wrapper.bar3 .chart-wrapper .axis text{-webkit-transform:translate(4px, 24px);transform:translate(4px, 24px);text-anchor:middle}:host .component-wrapper.bar3 .hidden-values-warning{margin-top:1.25rem}:host .component-wrapper.bar6,:host .component-wrapper.bar7{--chartPadding:48px;-ms-flex-align:start;align-items:flex-start}:host .component-wrapper.bar6 .chart-wrapper,:host .component-wrapper.bar7 .chart-wrapper{width:100%}:host .component-wrapper.bar6 .chart,:host .component-wrapper.bar7 .chart{position:relative;padding-right:var(--chartPadding)}:host .component-wrapper.bar6 .gridlines,:host .component-wrapper.bar7 .gridlines{position:absolute;left:var(--labelWidth);right:var(--chartPadding);top:0;bottom:0;background-image:linear-gradient(90deg, var(--wmcolor-chart-gridline) 1px, transparent 1px);background-position:-1px;border-left:1px solid var(--wmcolor-chart-gridline);border-bottom:1px solid var(--wmcolor-chart-gridline);background-size:var(--backgroundSize)}:host .component-wrapper.bar6 .rows,:host .component-wrapper.bar7 .rows{display:grid;grid-template-columns:var(--labelWidth) auto;grid-auto-rows:minmax(30px, 1fr);-ms-flex-align:center;align-items:center;position:relative;z-index:1}:host .component-wrapper.bar6 .rows .label,:host .component-wrapper.bar7 .rows .label{font-weight:400;padding:0 0.75rem 0 0;text-align:right;margin:0.75rem 0}:host .component-wrapper.bar6 .rows .label.hidden,:host .component-wrapper.bar7 .rows .label.hidden{visibility:hidden;white-space:nowrap}:host .component-wrapper.bar6 .bar,:host .component-wrapper.bar7 .bar{height:30px;position:relative}:host .component-wrapper.bar6 .bar .value,:host .component-wrapper.bar7 .bar .value{position:absolute;top:50%;right:-0.5rem;-webkit-transform:translate(100%, -50%);transform:translate(100%, -50%)}:host .component-wrapper.bar6 .x-axis,:host .component-wrapper.bar7 .x-axis{margin-left:var(--labelWidth);margin-right:var(--chartPadding);display:-ms-flexbox;display:flex;postion:relative}:host .component-wrapper.bar6 .tick,:host .component-wrapper.bar7 .tick{-ms-flex:1;flex:1;text-align:right}:host .component-wrapper.bar6 .tick span,:host .component-wrapper.bar7 .tick span{-webkit-transform:translateX(50%);transform:translateX(50%);display:inline-block}:host .component-wrapper.bar6 .zero,:host .component-wrapper.bar7 .zero{position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%)}:host .component-wrapper.bar6 .bar:active,:host .component-wrapper.bar6 .bar:hover,:host .component-wrapper.bar6 .bar:focus,:host .component-wrapper.bar7 .bar:active,:host .component-wrapper.bar7 .bar:hover,:host .component-wrapper.bar7 .bar:focus{outline:none}:host .component-wrapper.bar6 .bar:active.bar,:host .component-wrapper.bar6 .bar:hover.bar,:host .component-wrapper.bar6 .bar:focus.bar,:host .component-wrapper.bar7 .bar:active.bar,:host .component-wrapper.bar7 .bar:hover.bar,:host .component-wrapper.bar7 .bar:focus.bar{-webkit-box-shadow:0px 0px 6px #333;-moz-box-shadow:0px 0px 6px #333;box-shadow:0px 0px 6px #333}:host .component-wrapper.left-label{-ms-flex-direction:row;flex-direction:row}:host .component-wrapper.left-label .label{width:12rem;padding-right:1.25rem;-ms-flex:none;flex:none;-ms-flex-item-align:end;align-self:flex-end;min-height:30px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .component-wrapper .hidden-values-warning{font-size:0.75rem;font-style:italic;max-width:100%}:host #chart-instructions{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .component-wrapper .legend-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;text-align:center}:host .component-wrapper .legend-wrapper .legend{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;text-align:center;padding-top:0.25rem;padding-bottom:0.75rem;-webkit-box-sizing:border-box;box-sizing:border-box}:host .component-wrapper .legend-wrapper .legend.bar1,:host .component-wrapper .legend-wrapper .legend.bar6{display:none}:host .component-wrapper .legend-wrapper .legend.--top{margin-top:-0.75rem}:host .component-wrapper .legend-wrapper .legend.--top .legend-item{padding-top:0.75rem}:host .component-wrapper .legend-wrapper .legend.--top .legend-color{top:0.75rem}:host .component-wrapper .legend-wrapper .legend.--bottom{margin-bottom:-0.75rem}:host .component-wrapper .legend-wrapper .legend.--bottom .legend-item{padding-bottom:0.75rem}:host .component-wrapper .legend-wrapper .legend.--bottom .legend-color{top:-0.75rem}:host .component-wrapper .legend-wrapper .legend .legend-item{position:relative}:host .component-wrapper .legend-wrapper .legend .legend-item:not(:last-of-type){padding-right:1.25rem}:host .component-wrapper .legend-wrapper .legend .legend-text{font-size:0.875rem;padding-left:1rem;line-height:1}:host .component-wrapper .legend-wrapper .legend .legend-color{position:absolute;left:0;bottom:0;margin:auto;width:0.6875rem;height:0.6875rem}:host .component-wrapper .legend-wrapper .legend.bar3{padding-bottom:1.25rem}:host(:focus){outline:none}:host(:focus) .component-wrapper.user-is-tabbing .stacked-bar-segments-wrapper,:host(:focus) .component-wrapper.user-is-tabbing .simple-bar-wrapper,:host(:focus) .component-wrapper.user-is-tabbing .doughnut-wrapper{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus)}:host(:focus) .component-wrapper.user-is-tabbing .stacked-bar-segments-wrapper::-moz-focus-inner,:host(:focus) .component-wrapper.user-is-tabbing .simple-bar-wrapper::-moz-focus-inner,:host(:focus) .component-wrapper.user-is-tabbing .doughnut-wrapper::-moz-focus-inner{border:0}";var Chart=function(){function e(e){var t=this;registerInstance(this,e);this.uid=generateId();this.slicesDetails=[];this.handleStackedBarResize=debounce((function(){return __awaiter(t,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(a){e=false;t=this.el.shadowRoot.querySelectorAll(".value");if(t.length){r=t.length?t[0].getBoundingClientRect().right:0;o=4;t.forEach((function(t,a){if(a>0){var n=t.getBoundingClientRect();if(n.left-o<r&&t.textContent!==""){t.classList.add("hidden");e=true}else{t.classList.remove("hidden");r=n.right}}}))}this.hasHiddenBarValue=e;return[2]}))}))}),100);this.debouncedUpdate=debounce((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){forceUpdate(this.el);return[2]}))}))}),10);this.debouncedSliceUpdate=debounce((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,getDetails.call(this,this.currentChartType)];case 1:e.sent();forceUpdate(this.el);return[2]}}))}))}),100);this.chartType="doughnut1";this.label=undefined;this.labelWidth="150px";this.subinfo=undefined;this.completionMessage=undefined;this.valueFormat=undefined;this.showValues=undefined;this.showGrid=true;this.showLegend=true;this.showBarLegend=false;this.notStartedColor=false;this.labelPosition="top";this.isTabbing=false;this.userIsNavigating=false;this.hasHiddenBarValue=false}Object.defineProperty(e.prototype,"tempValueFormat",{get:function(){return this.valueFormat||this.showValues||"none"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hybridType",{get:function(){return window.innerWidth>1340?"doughnut0":"bar1"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"popoverEl",{get:function(){return this.el.shadowRoot.querySelector("priv-chart-popover")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sliceEls",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll(".segment"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentChartType",{get:function(){var e=this.chartType;if(this.chartType==="hybrid"){e=this.hybridType}else if(this.chartType==="doughnut2"&&this.el.children.length>3){e="doughnut2b"}else if(this.chartType==="bar2"&&this.el.children.length>4){e="bar2b"}return e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"chartDetails",{get:function(){return allChartsDetails[this.currentChartType]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ariaLabelText",{get:function(){var e="".concat(this.label);if(this.subinfo){e+=" ".concat(this.subinfo)}return e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDoughnut",{get:function(){return this.chartDetails.category==="doughnut"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isStackedBar",{get:function(){return this.chartDetails.category==="stackedBar"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isSimpleBar",{get:function(){return this.chartDetails.category==="simpleBar"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isBar",{get:function(){return this.isStackedBar||this.isSimpleBar},enumerable:false,configurable:true});e.prototype.toggleTabbingOn=function(){this.isTabbing=true};e.prototype.toggleTabbingOff=function(){this.isTabbing=false};e.prototype.handleKeydown=function(e){handleChartKeydown.call(this,e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!this.label){throw new Error("For accessibility purposes, you must provide a label for the chart. See https://components.watermarkinsights.com/chart for more information.")}if(this.showValues){console.warn("wm-chart: show-values has been deprecated as of v3.1.0. Please use value-format instead.")}return[4,getDetails.call(this,this.currentChartType)];case 1:r.sent();if(this.chartType==="hybrid"||!this.isDoughnut){e=new ResizeObserver((function(){t.isStackedBar?t.handleStackedBarResize():t.debouncedUpdate()}));e.observe(this.el)}return[2]}}))}))};e.prototype.handleSliceUpdate=function(){this.debouncedSliceUpdate()};e.prototype.renderBarText=function(e,t){var r;if(this.tempValueFormat==="percentage"){r=e.perc===0&&e.amount>0?"<1%":"".concat(e.perc,"%")}else if(this.tempValueFormat==="amount"){r=e.amount}return h("div",{class:"value-wrapper",style:{width:"calc(".concat(amountToPercent(e.amount,this.total,false),"%\n ").concat(t!==this.slicesDetails.length-1?" - 2px":"")}},h("span",{class:"value"},e.amount>0&&r))};e.prototype.drawAxis=function(){if(this.currentChartType==="bar3"){return h("svg",{class:"axis"},h("line",{x1:"0",x2:"100%",y1:"0",y2:"0"}),h("line",{x1:"0",x2:"0",y1:"0",y2:"-85px"}),h("line",{class:"tick",x1:"0.5",x2:"0.5",y1:"0",y2:"6"}),h("text",{x:"0.5",y:"-6"},"0%"),h("line",{class:"tick",x1:"100%",x2:"100%",y1:"0",y2:"6"}),h("text",{x:"100%",y:"-6"},"100%"))}};e.prototype.renderChart=function(){if(this.isSimpleBar){return renderSimpleBar.call(this,this.currentChartType)}else if(this.isStackedBar&&this.total>0){return renderStackedBar.call(this,this.currentChartType)}else if(this.isDoughnut&&this.total>0){return renderDoughnut.call(this,this.currentChartType)}};e.prototype.render=function(){var e=this;return h(Host,{onBlur:function(){return exitChart.call(e)}},h("div",{ref:function(t){return e.componentWrapperEl=t},class:"component-wrapper ".concat(this.currentChartType," ").concat(this.isTabbing&&!this.userIsNavigating?"user-is-tabbing":""," ").concat(this.labelPosition==="left"&&this.currentChartType==="bar4"?"left-label":""),role:"application","aria-label":this.ariaLabelText,tabindex:0,"aria-roledescription":chartMessages.interactiveChart,"aria-describedby":"chart-instructions"},h("label",{id:"label-".concat(this.uid),class:"label --".concat(this.labelPosition),htmlFor:"graphic-".concat(this.uid)},h("span",{class:"label-text"},this.label),this.subinfo?h("span",{class:"subinfo"},this.subinfo):""),this.isBar&&renderLegend.call(this,this.currentChartType),this.renderChart(),this.isDoughnut&&renderLegend.call(this,this.currentChartType),h("priv-chart-popover",{class:this.isTabbing?"user-is-tabbing":""}),this.currentChartType==="doughnut0"?renderCompletionMessage.call(this):"",this.hasHiddenBarValue&&renderHiddenValuesMessage()),renderInstructionsText())};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();Chart.style=wmChartCss;export{Chart as wm_chart};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,n){function p(e){try{s(o.next(e))}catch(e){n(e)}}function i(e){try{s(o["throw"](e))}catch(e){n(e)}}function s(e){e.done?r(e.value):a(e.value).then(p,i)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,a,n,p;return p={next:i(0),throw:i(1),return:i(2)},typeof Symbol==="function"&&(p[Symbol.iterator]=function(){return this}),p;function i(e){return function(t){return s([e,t])}}function s(i){if(o)throw new TypeError("Generator is already executing.");while(p&&(p=0,i[0]&&(r=0)),r)try{if(o=1,a&&(n=i[0]&2?a["return"]:i[0]?a["throw"]||((n=a["return"])&&n.call(a),0):a.next)&&!(n=n.call(a,i[1])).done)return n;if(a=0,n)i=[i[0]&2,n.value];switch(i[0]){case 0:case 1:n=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;a=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(n=r.trys,n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1];n=i;break}if(n&&r.label<n[2]){r.label=n[2];r.ops.push(i);break}if(n[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];a=0}finally{o=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-294d486f.js";import{g as generateId,d as debounce}from"./functions-e8b2c205.js";import{g as getDetails,a as allChartsDetails,h as handleChartKeydown,b as amountToPercent,r as renderSimpleBar,c as renderStackedBar,d as renderDoughnut,e as renderInstructionsText,f as renderLegend,i as renderCompletionMessage,j as renderHiddenValuesMessage,k as exitChart}from"./chartFunctions-1396e181.js";import{c as chartMessages}from"./intl-3b652186.js";var wmChartCss=":host{--wmcolor-chart-label-text-negative:var(--wmcolor-text-negative);--wmcolor-chart-label-text-positive:var(--wmcolor-text-positive);--wmcolor-chart-label-text:var(--wmcolor-text);--wmcolor-chart-subinfo-text:var(--wmcolor-text);--wmcolor-chart-value-text:var(--wmcolor-text);display:block}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;font-size:0.875rem;position:relative;outline:none;}:host .component-wrapper .label{display:block;margin:0;padding-bottom:0.25rem;font-weight:600;position:relative}:host .component-wrapper .label .subinfo{display:block;font-weight:normal;font-style:italic;bottom:0.25rem;width:100%;color:var(--wmcolor-chart-subinfo-text)}:host .component-wrapper .label.custom-width{width:var(--custom-label-width)}:host .component-wrapper .label.--none{display:none}:host .component-wrapper .doughnut-svg,:host .component-wrapper .inner-stacked-bar-wrapper{overflow:visible}:host .component-wrapper .bar-wrapper{-ms-flex-positive:1;flex-grow:1;width:100%}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper{width:100%}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .values{display:-ms-flexbox;display:flex}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .stacked-bar-segments-wrapper{display:-ms-flexbox;display:flex}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .stacked-bar-segments-wrapper .stacked-bar-segment{height:30px;cursor:pointer}:host .component-wrapper .bar-wrapper .inner-stacked-bar-wrapper .stacked-bar-segments-wrapper .stacked-bar-segment:not(.zero):not(:last-of-type){margin-right:2px}:host .component-wrapper .doughnut-wrapper{-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px}:host .component-wrapper .doughnut-wrapper .doughnut-segment{cursor:pointer}:host .component-wrapper .value-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .component-wrapper .value-wrapper:not(:last-of-type){margin-right:2px}:host .component-wrapper .value-wrapper .value.hidden{visibility:hidden}:host .component-wrapper path:active,:host .component-wrapper path:hover,:host .component-wrapper path:focus,:host .component-wrapper .stacked-bar-segment:active,:host .component-wrapper .stacked-bar-segment:hover,:host .component-wrapper .stacked-bar-segment:focus{outline:none}:host .component-wrapper .stacked-bar-segment:active.stacked-bar-segment,:host .component-wrapper .stacked-bar-segment:hover.stacked-bar-segment,:host .component-wrapper .stacked-bar-segment:focus.stacked-bar-segment{-webkit-box-shadow:0px 0px 6px #333;-moz-box-shadow:0px 0px 6px #333;box-shadow:0px 0px 6px #333}:host .component-wrapper path:active.doughnut-segment,:host .component-wrapper path:hover.doughnut-segment,:host .component-wrapper path:focus.doughnut-segment,:host .component-wrapper .stacked-bar-segment:active.doughnut-segment,:host .component-wrapper .stacked-bar-segment:hover.doughnut-segment,:host .component-wrapper .stacked-bar-segment:focus.doughnut-segment{-webkit-filter:url(#wmHoverDropShadow);filter:url(#wmHoverDropShadow)}:host .component-wrapper path::-moz-focus-inner,:host .component-wrapper .stacked-bar-segment::-moz-focus-inner{border:0;outline:none}:host .component-wrapper.doughnut{width:300px}:host .component-wrapper.doughnut1 label,:host .component-wrapper.doughnut1 .label-text,:host .component-wrapper.doughnut2 label,:host .component-wrapper.doughnut2 .label-text,:host .component-wrapper.doughnut2b label,:host .component-wrapper.doughnut2b .label-text,:host .component-wrapper.doughnut3 label,:host .component-wrapper.doughnut3 .label-text{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .component-wrapper.doughnut0,:host .component-wrapper.doughnut{-ms-flex-align:center;align-items:center}:host .component-wrapper.doughnut0 label,:host .component-wrapper.doughnut label{text-align:center;width:100%;padding-bottom:1.5rem}:host .component-wrapper.doughnut0 label .subinfo,:host .component-wrapper.doughnut label .subinfo{position:absolute}:host .component-wrapper.doughnut0 .completion-message,:host .component-wrapper.doughnut .completion-message{padding-top:0.625rem}:host .component-wrapper.bar1,:host .component-wrapper.bar{padding:1.25rem;-ms-flex-align:start;align-items:flex-start}:host .component-wrapper.bar1 label,:host .component-wrapper.bar label{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .component-wrapper.bar1 label .subinfo,:host .component-wrapper.bar label .subinfo{position:initial}:host .component-wrapper.bar1 .chart-wrapper,:host .component-wrapper.bar .chart-wrapper{display:-ms-flexbox;display:flex}:host .component-wrapper.bar1 .chart-wrapper .single-perc,:host .component-wrapper.bar .chart-wrapper .single-perc{width:4rem;-ms-flex:none;flex:none;display:-ms-flexbox;display:flex;height:30px;-ms-flex-align:center;align-items:center}:host .component-wrapper.bar1 .chart-wrapper .inner-stacked-bar-wrapper,:host .component-wrapper.bar .chart-wrapper .inner-stacked-bar-wrapper{-ms-flex:1;flex:1}:host .component-wrapper.bar1 .chart-wrapper .completion-message,:host .component-wrapper.bar .chart-wrapper .completion-message{width:100%;text-align:right;margin-top:0.25rem}@media screen and (min-width: 768px){:host .component-wrapper.bar1,:host .component-wrapper.bar{-ms-flex-direction:row;flex-direction:row}:host .component-wrapper.bar1 label,:host .component-wrapper.bar label{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;min-height:30px;width:12rem;text-align:left;padding-right:1.25rem;padding-bottom:0;-ms-flex:none;flex:none}:host .component-wrapper.bar1 .bar-wrapper,:host .component-wrapper.bar .bar-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host .component-wrapper.bar1 .bar-wrapper .single-perc,:host .component-wrapper.bar .bar-wrapper .single-perc{text-align:center;padding-left:0.5rem;-ms-flex-pack:center;justify-content:center}}:host .component-wrapper.bar2,:host .component-wrapper.bar2b,:host .component-wrapper.bar3,:host .component-wrapper.bar4,:host .component-wrapper.bar5{-ms-flex-align:start;align-items:flex-start}:host .component-wrapper.bar2 .inner-stacked-bar-wrapper,:host .component-wrapper.bar2b .inner-stacked-bar-wrapper,:host .component-wrapper.bar4 .inner-stacked-bar-wrapper,:host .component-wrapper.bar5 .inner-stacked-bar-wrapper{height:30px;margin-bottom:0}:host .component-wrapper.bar2 .inner-stacked-bar-wrapper.show-values,:host .component-wrapper.bar2b .inner-stacked-bar-wrapper.show-values,:host .component-wrapper.bar4 .inner-stacked-bar-wrapper.show-values,:host .component-wrapper.bar5 .inner-stacked-bar-wrapper.show-values{height:60px;margin-top:0}:host .component-wrapper.bar3 .chart-wrapper{position:relative;height:100px}:host .component-wrapper.bar3 .chart-wrapper .inner-stacked-bar-wrapper{position:absolute;top:35px;left:0;right:0;bottom:0;height:30px}:host .component-wrapper.bar3 .chart-wrapper .axis{position:absolute;top:0;left:0;height:90px;width:100%;overflow:visible;-webkit-transform:translateY(90px);transform:translateY(90px)}:host .component-wrapper.bar3 .chart-wrapper .axis line{stroke:var(--wmcolor-chart-gridline);stroke-width:1px}:host .component-wrapper.bar3 .chart-wrapper .axis text{-webkit-transform:translate(4px, 24px);transform:translate(4px, 24px);text-anchor:middle}:host .component-wrapper.bar3 .hidden-values-warning{margin-top:1.25rem}:host .component-wrapper.bar6,:host .component-wrapper.bar7{--chartPadding:48px;-ms-flex-align:start;align-items:flex-start}:host .component-wrapper.bar6 .chart-wrapper,:host .component-wrapper.bar7 .chart-wrapper{width:100%}:host .component-wrapper.bar6 .chart,:host .component-wrapper.bar7 .chart{position:relative;padding-right:var(--chartPadding)}:host .component-wrapper.bar6 .gridlines,:host .component-wrapper.bar7 .gridlines{position:absolute;left:var(--labelWidth);right:var(--chartPadding);top:0;bottom:0;background-image:linear-gradient(90deg, var(--wmcolor-chart-gridline) 1px, transparent 1px);background-position:-1px;border-left:1px solid var(--wmcolor-chart-gridline);border-bottom:1px solid var(--wmcolor-chart-gridline);background-size:var(--backgroundSize)}:host .component-wrapper.bar6 .rows,:host .component-wrapper.bar7 .rows{display:grid;grid-template-columns:var(--labelWidth) auto;grid-auto-rows:minmax(30px, 1fr);-ms-flex-align:center;align-items:center;position:relative;z-index:1}:host .component-wrapper.bar6 .rows .label,:host .component-wrapper.bar7 .rows .label{font-weight:400;padding:0 0.75rem 0 0;text-align:right;margin:0.75rem 0}:host .component-wrapper.bar6 .rows .label.hidden,:host .component-wrapper.bar7 .rows .label.hidden{visibility:hidden;white-space:nowrap}:host .component-wrapper.bar6 .bar,:host .component-wrapper.bar7 .bar{height:30px;position:relative}:host .component-wrapper.bar6 .bar .value,:host .component-wrapper.bar7 .bar .value{position:absolute;top:50%;right:-0.5rem;-webkit-transform:translate(100%, -50%);transform:translate(100%, -50%)}:host .component-wrapper.bar6 .x-axis,:host .component-wrapper.bar7 .x-axis{margin-left:var(--labelWidth);margin-right:var(--chartPadding);display:-ms-flexbox;display:flex;postion:relative}:host .component-wrapper.bar6 .tick,:host .component-wrapper.bar7 .tick{-ms-flex:1;flex:1;text-align:right}:host .component-wrapper.bar6 .tick span,:host .component-wrapper.bar7 .tick span{-webkit-transform:translateX(50%);transform:translateX(50%);display:inline-block}:host .component-wrapper.bar6 .zero,:host .component-wrapper.bar7 .zero{position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%)}:host .component-wrapper.bar6 .bar:active,:host .component-wrapper.bar6 .bar:hover,:host .component-wrapper.bar6 .bar:focus,:host .component-wrapper.bar7 .bar:active,:host .component-wrapper.bar7 .bar:hover,:host .component-wrapper.bar7 .bar:focus{outline:none}:host .component-wrapper.bar6 .bar:active.bar,:host .component-wrapper.bar6 .bar:hover.bar,:host .component-wrapper.bar6 .bar:focus.bar,:host .component-wrapper.bar7 .bar:active.bar,:host .component-wrapper.bar7 .bar:hover.bar,:host .component-wrapper.bar7 .bar:focus.bar{-webkit-box-shadow:0px 0px 6px #333;-moz-box-shadow:0px 0px 6px #333;box-shadow:0px 0px 6px #333}:host .component-wrapper.left-label{-ms-flex-direction:row;flex-direction:row}:host .component-wrapper.left-label .label{width:12rem;padding-right:1.25rem;-ms-flex:none;flex:none;-ms-flex-item-align:end;align-self:flex-end;min-height:30px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .component-wrapper .hidden-values-warning{font-size:0.75rem;font-style:italic;max-width:100%}:host #chart-instructions{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .component-wrapper .legend-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;text-align:center}:host .component-wrapper .legend-wrapper .legend{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;text-align:center;padding-top:0.25rem;padding-bottom:0.75rem;-webkit-box-sizing:border-box;box-sizing:border-box}:host .component-wrapper .legend-wrapper .legend.bar1,:host .component-wrapper .legend-wrapper .legend.bar6{display:none}:host .component-wrapper .legend-wrapper .legend.--top{margin-top:-0.75rem}:host .component-wrapper .legend-wrapper .legend.--top .legend-item{padding-top:0.75rem}:host .component-wrapper .legend-wrapper .legend.--top .legend-color{top:0.75rem}:host .component-wrapper .legend-wrapper .legend.--bottom{margin-bottom:-0.75rem}:host .component-wrapper .legend-wrapper .legend.--bottom .legend-item{padding-bottom:0.75rem}:host .component-wrapper .legend-wrapper .legend.--bottom .legend-color{top:-0.75rem}:host .component-wrapper .legend-wrapper .legend .legend-item{position:relative}:host .component-wrapper .legend-wrapper .legend .legend-item:not(:last-of-type){padding-right:1.25rem}:host .component-wrapper .legend-wrapper .legend .legend-text{font-size:0.875rem;padding-left:1rem;line-height:1}:host .component-wrapper .legend-wrapper .legend .legend-color{position:absolute;left:0;bottom:0;margin:auto;width:0.6875rem;height:0.6875rem}:host .component-wrapper .legend-wrapper .legend.bar3{padding-bottom:1.25rem}:host(:focus){outline:none}:host(:focus) .component-wrapper.user-is-tabbing .stacked-bar-segments-wrapper,:host(:focus) .component-wrapper.user-is-tabbing .simple-bar-wrapper,:host(:focus) .component-wrapper.user-is-tabbing .doughnut-wrapper{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus)}:host(:focus) .component-wrapper.user-is-tabbing .stacked-bar-segments-wrapper::-moz-focus-inner,:host(:focus) .component-wrapper.user-is-tabbing .simple-bar-wrapper::-moz-focus-inner,:host(:focus) .component-wrapper.user-is-tabbing .doughnut-wrapper::-moz-focus-inner{border:0}";var Chart=function(){function e(e){var t=this;registerInstance(this,e);this.uid=generateId();this.slicesDetails=[];this.handleStackedBarResize=debounce((function(){return __awaiter(t,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(a){e=false;t=this.el.shadowRoot.querySelectorAll(".value");if(t.length){r=t.length?t[0].getBoundingClientRect().right:0;o=4;t.forEach((function(t,a){if(a>0){var n=t.getBoundingClientRect();if(n.left-o<r&&t.textContent!==""){t.classList.add("hidden");e=true}else{t.classList.remove("hidden");r=n.right}}}))}this.hasHiddenBarValue=e;return[2]}))}))}),100);this.debouncedUpdate=debounce((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){forceUpdate(this.el);return[2]}))}))}),10);this.debouncedSliceUpdate=debounce((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,getDetails.call(this,this.currentChartType)];case 1:e.sent();forceUpdate(this.el);return[2]}}))}))}),100);this.chartType="doughnut1";this.label=undefined;this.labelWidth="150px";this.subinfo=undefined;this.completionMessage=undefined;this.valueFormat=undefined;this.showValues=undefined;this.showGrid=true;this.showLegend=true;this.showBarLegend=false;this.notStartedColor=false;this.labelPosition="top";this.isTabbing=false;this.userIsNavigating=false;this.hasHiddenBarValue=false}Object.defineProperty(e.prototype,"tempValueFormat",{get:function(){return this.valueFormat||this.showValues||"none"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hybridType",{get:function(){return window.innerWidth>1340?"doughnut0":"bar1"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"popoverEl",{get:function(){return this.el.shadowRoot.querySelector("priv-chart-popover")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"sliceEls",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll(".segment"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentChartType",{get:function(){var e=this.chartType;if(this.chartType==="hybrid"){e=this.hybridType}else if(this.chartType==="doughnut2"&&this.el.children.length>3){e="doughnut2b"}else if(this.chartType==="bar2"&&this.el.children.length>4){e="bar2b"}return e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"chartDetails",{get:function(){return allChartsDetails[this.currentChartType]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ariaLabelText",{get:function(){var e="".concat(this.label);if(this.subinfo){e+=" ".concat(this.subinfo)}return e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDoughnut",{get:function(){return this.chartDetails.category==="doughnut"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isStackedBar",{get:function(){return this.chartDetails.category==="stackedBar"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isSimpleBar",{get:function(){return this.chartDetails.category==="simpleBar"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isBar",{get:function(){return this.isStackedBar||this.isSimpleBar},enumerable:false,configurable:true});e.prototype.toggleTabbingOn=function(){this.isTabbing=true};e.prototype.toggleTabbingOff=function(){this.isTabbing=false};e.prototype.handleKeydown=function(e){handleChartKeydown.call(this,e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!this.label){throw new Error("For accessibility purposes, you must provide a label for the chart. See https://components.watermarkinsights.com/chart for more information.")}if(this.showValues){console.warn("wm-chart: show-values has been deprecated as of v3.1.0. Please use value-format instead.")}return[4,getDetails.call(this,this.currentChartType)];case 1:r.sent();if(this.chartType==="hybrid"||!this.isDoughnut){e=new ResizeObserver((function(){t.isStackedBar?t.handleStackedBarResize():t.debouncedUpdate()}));e.observe(this.el)}return[2]}}))}))};e.prototype.handleSliceUpdate=function(){this.debouncedSliceUpdate()};e.prototype.renderBarText=function(e,t){var r;if(this.tempValueFormat==="percentage"){r=e.perc===0&&e.amount>0?"<1%":"".concat(e.perc,"%")}else if(this.tempValueFormat==="amount"){r=e.amount}return h("div",{class:"value-wrapper",style:{width:"calc(".concat(amountToPercent(e.amount,this.total,false),"%\n ").concat(t!==this.slicesDetails.length-1?" - 2px":"")}},h("span",{class:"value"},e.amount>0&&r))};e.prototype.drawAxis=function(){if(this.currentChartType==="bar3"){return h("svg",{class:"axis"},h("line",{x1:"0",x2:"100%",y1:"0",y2:"0"}),h("line",{x1:"0",x2:"0",y1:"0",y2:"-85px"}),h("line",{class:"tick",x1:"0.5",x2:"0.5",y1:"0",y2:"6"}),h("text",{x:"0.5",y:"-6"},"0%"),h("line",{class:"tick",x1:"100%",x2:"100%",y1:"0",y2:"6"}),h("text",{x:"100%",y:"-6"},"100%"))}};e.prototype.renderChart=function(){if(this.isSimpleBar){return renderSimpleBar.call(this,this.currentChartType)}else if(this.isStackedBar&&this.total>0){return renderStackedBar.call(this,this.currentChartType)}else if(this.isDoughnut&&this.total>0){return renderDoughnut.call(this,this.currentChartType)}};e.prototype.render=function(){var e=this;return h(Host,{onBlur:function(){return exitChart.call(e)}},h("div",{ref:function(t){return e.componentWrapperEl=t},class:"component-wrapper ".concat(this.currentChartType," ").concat(this.isTabbing&&!this.userIsNavigating?"user-is-tabbing":""," ").concat(this.labelPosition==="left"&&this.currentChartType==="bar4"?"left-label":""),role:"application","aria-label":this.ariaLabelText,tabindex:0,"aria-roledescription":chartMessages.interactiveChart,"aria-describedby":"chart-instructions"},h("label",{id:"label-".concat(this.uid),class:"label --".concat(this.labelPosition),htmlFor:"graphic-".concat(this.uid)},h("span",{class:"label-text"},this.label),this.subinfo?h("span",{class:"subinfo"},this.subinfo):""),this.isBar&&renderLegend.call(this,this.currentChartType),this.renderChart(),this.isDoughnut&&renderLegend.call(this,this.currentChartType),h("priv-chart-popover",{class:this.isTabbing?"user-is-tabbing":""}),this.currentChartType==="doughnut0"?renderCompletionMessage.call(this):"",this.hasHiddenBarValue&&renderHiddenValuesMessage()),renderInstructionsText())};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();Chart.style=wmChartCss;export{Chart as wm_chart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-294d486f.js";import{i as intl,t as toBool,r as removeDisabledAttribute,e as isRelatedTarget,j as checkForFocusableElInShadow,g as generateId}from"./functions-abbff9c1.js";var wmDatepickerCss=':host{--wmcolor-datepicker-background:var(--wmcolor-background);--wmcolor-datepicker-day-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-datepicker-day-background-selected:var(--wmcolor-interactive);--wmcolor-datepicker-day-text-outside:var(--wmcolor-interactive-disabled);--wmcolor-datepicker-day-text-selected:var(--wmcolor-interactive-text-selected);--wmcolor-datepicker-day-text:var(--wmcolor-text);--wmcolor-datepicker-input-background-disabled:var(--wmcolor-input-background-disabled);--wmcolor-datepicker-input-background:var(--wmcolor-input-background);--wmcolor-datepicker-input-border:var(--wmcolor-input-border);--wmcolor-datepicker-input-text-disabled:var(--wmcolor-input-text-disabled);--wmcolor-datepicker-input-text:var(--wmcolor-input-text);--wmcolor-datepicker-month-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-datepicker-month-background-selected:var(--wmcolor-interactive);--wmcolor-datepicker-month-background:var(--wmcolor-text);--wmcolor-datepicker-month-border:var(--wmcolor-border-light);--wmcolor-datepicker-month-text-selected:var(--wmcolor-text-ondark);--wmcolor-datepicker-month-text:var(--wmcolor-interactive);--wmcolor-datepicker-navigation-background-hover:var(--wmcolor-button-background-navigational-hover);--wmcolor-datepicker-navigation-background:var(--wmcolor-button-background-navigational);--wmcolor-datepicker-navigation-text:var(--wmcolor-button-icon-navigational);--wmcolor-datepicker-selector-background:var(--wmcolor-button-background-secondary);--wmcolor-datepicker-selector-border:var(--wmcolor-button-border-secondary);--wmcolor-datepicker-selector-text:var(--wmcolor-button-text-secondary);--wmcolor-datepicker-toggle-background-disabled:var(--wmcolor-input-background-disabled);--wmcolor-datepicker-toggle-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-datepicker-toggle-background:var(--wmcolor-input-background);--wmcolor-datepicker-toggle-icon-disabled:var(--wmcolor-interactive-disabled);--wmcolor-datepicker-toggle-icon:var(--wmcolor-interactive);--wmcolor-datepicker-weekdays-background:var(--wmcolor-table-header-background);--wmcolor-datepicker-weekdays-text:var(--wmcolor-text);font-family:inherit}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper{position:relative}:host .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid;border-color:var(--wmcolor-datepicker-input-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper .date-input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;color:var(--wmcolor-datepicker-input-text);font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0;background-color:var(--wmcolor-datepicker-input-background)}:host .wrapper .inner-wrapper .date-input:disabled{background-color:var(--wmcolor-datepicker-input-background-disabled);color:var(--wmcolor-datepicker-input-text-disabled)}:host .wrapper .inner-wrapper .date-input:focus{outline:none}:host .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper.invalid .error{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem;margin-bottom:4px;top:100%;left:0}:host .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);outline:none;border-color:var(--wmcolor-input-border-focus)}:host .user-is-tabbing .toggle:focus:not(:active){border:none;z-index:11}';var DatePicker=function(){function e(e){registerInstance(this,e);this.wmDatepickerNewValidValue=createEvent(this,"wmDatepickerNewValidValue",7);this.lastCommittedValue=this.value;this.parsableEntry=/^(\d{1}|\d{2}|\d{4})[\-\.\/]\d{1,2}[\-\.\/](\d{1}|\d{2}|\d{4})$/;this.isoEntry=/^\d\d\d\d[-]\d\d[-]\d\d$/;this.eightDigitsEntry=/^\d{8}$/;this.dateFormats={US:intl.formatMessage({id:"date.formatUS",defaultMessage:"mm/dd/yyyy"}),INT:intl.formatMessage({id:"date.formatINT",defaultMessage:"dd/mm/yyyy"}),ISO:intl.formatMessage({id:"date.formatISO",defaultMessage:"yyyy/mm/dd"})};this.value="";this.disabled=false;this.dateFormat="US";this.errorMessage="";this.labelPosition="top";this.label="";this.requiredField=false;this.requiredFieldMessage=undefined;this.preventValidation=undefined;this.displayError=""}Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});e.prototype.handleTabbingOn=function(){this.dpWrapper&&this.dpWrapper.classList.add("user-is-tabbing")};e.prototype.handleTabbingOff=function(){this.dpWrapper&&this.dpWrapper.classList.remove("user-is-tabbing")};e.prototype.handleError=function(){if(this.errorMessage){this.generateError()}else{this.clearError();this.processInput()}};e.prototype.handleDisabledChange=function(){removeDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleInput=function(e){this.value=e.target.value};e.prototype.handleBlur=function(e){var t=this.preventValidation&&isRelatedTarget(e,this.preventValidation);if(!t){this.processInput()}this.dpWrapper.classList.remove("focus")};e.prototype.focusHandler=function(){this.dpWrapper.classList.add("focus")};e.prototype.handlePopupBlurred=function(e){if(e.detail.relatedTarget!==this.el){var t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget;this.el.dispatchEvent(t)}};e.prototype.getActiveElement=function(){return checkForFocusableElInShadow(document.activeElement)};e.prototype.handleCellTriggered=function(e){var t=e.detail;var r=t.getAttribute("data-year")+"-"+t.getAttribute("data-month")+"-"+t.textContent;this.inputEl.value=this.reformatDate(this.dateFormat,r);this.processInput();var a=new CustomEvent("input");this.el.dispatchEvent(a)};e.prototype.processInput=function(e){var t=!e&&this.requiredField;var r=this.inputEl.value;if(this.eightDigitsEntry.test(this.inputEl.value)){this.inputEl.value=this.addSlashes(this.inputEl.value)}if(this.parsableEntry.test(this.inputEl.value)){r=this.reformatDate("ISO",this.inputEl.value);this.inputEl.value=this.reformatDate(this.dateFormat,r);if(this.isValidDate(r)){if(this.errorMessage){this.generateError()}else{this.clearError()}}else if(this.inputEl.value.length){this.generateError()}}else if(this.inputEl.value.length||t||this.errorMessage){this.generateError()}else if(!this.inputEl.value.length&&!t){this.clearError()}this.value=r;if(r!==this.lastCommittedValue){var a=new CustomEvent("change");this.el.dispatchEvent(a);this.lastCommittedValue=this.value}if(this.isValidDate(r)&&r!==this.lastValidValue){this.wmDatepickerNewValidValue.emit();this.lastValidValue=r}};e.prototype.reformatDate=function(e,t){if(!t){return""}else if(!this.parsableEntry.test(t)){return t}else{var r=t.replace(/[\-\.]/gi,"/").split("/");switch(e){case"US":case this.dateFormats["US"]:return r[1].padStart(2,"0")+"/"+r[2].padStart(2,"0")+"/"+r[0].padStart(4,"20");case"INT":case this.dateFormats["INT"]:return r[2].padStart(2,"0")+"/"+r[1].padStart(2,"0")+"/"+r[0].padStart(4,"20");case"ISO":case this.dateFormats["ISO"]:if(this.dateFormat==="US"||this.dateFormat===this.dateFormats["US"]){return r[2].padStart(4,"20")+"-"+r[0].padStart(2,"0")+"-"+r[1].padStart(2,"0")}else if(this.dateFormat==="INT"||this.dateFormat===this.dateFormats["INT"]){return r[2].padStart(4,"20")+"-"+r[1].padStart(2,"0")+"-"+r[0].padStart(2,"0")}else if(this.dateFormat==="ISO"||this.dateFormat===this.dateFormats["ISO"]){return r[0].padStart(4,"20")+"-"+r[1].padStart(2,"0")+"-"+r[2].padStart(2,"0")}default:return r.join("/")}}};e.prototype.isValidDate=function(e){if(!e||!this.isoEntry.test(e)){return false}else{var t=e.split("-");var r=parseInt(t[2],10);var a=parseInt(t[1],10);var i=parseInt(t[0],10);if(i<1e3||i>3e3||a==0||a>12)return false;var o=[31,28,31,30,31,30,31,31,30,31,30,31];if(i%400==0||i%100!=0&&i%4==0)o[1]=29;return r>0&&r<=o[a-1]}};e.prototype.generateError=function(){var e=this.requiredFieldMessage||intl.formatMessage({id:"date.requiredDateError",defaultMessage:"A date is required."});var t=intl.formatMessage({id:"date.invalidDate",defaultMessage:"Please enter a valid date in the format {dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}."},{dateFormat:this.dateFormat.toLowerCase()});if(this.errorMessage){this.displayError=this.errorMessage}else if(this.inputEl.value.length){this.displayError=t}else if(!this.inputEl.value.length&&this.requiredField){this.displayError=e}};e.prototype.clearError=function(){this.displayError=""};e.prototype.addSlashes=function(e){if(this.dateFormat==="ISO"||this.dateFormat===this.dateFormats["ISO"]){return e.substring(0,4)+"/"+e.substring(4,6)+"/"+e.substring(6)}else{return e.substring(0,2)+"/"+e.substring(2,4)+"/"+e.substring(4)}};e.prototype.componentWillLoad=function(){if(this.label===""){console.error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none.")}if(this.errorMessage){this.generateError()}this.uid=this.el.id?this.el.id:generateId();if(this.value&&this.isValidDate(this.value)){this.lastValidValue=this.value}removeDisabledAttribute(this.el,this.isDisabled)};e.prototype.componentDidLoad=function(){this.inputEl.value=this.reformatDate(this.dateFormat,this.value);this.processInput(true)};e.prototype.render=function(){var e=this;var t=intl.formatMessage({id:"date.format",defaultMessage:"{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}"},{dateFormat:this.dateFormat.toLowerCase()});return h(Host,{id:this.uid,"aria-busy":"false",class:"".concat(this.displayError?"invalid":""),invalid:this.displayError?"true":null},h("div",{ref:function(t){return e.dpWrapper=t},class:"wrapper label-".concat(this.labelPosition," ").concat(this.displayError?"invalid":"")},h("div",{class:"label-wrapper"},this.labelPosition!=="none"&&h("label",{id:"datepickerLabel-".concat(this.uid),htmlFor:"date-input-".concat(this.uid),class:"label",title:"".concat(this.label," (").concat(t,")")},this.label,this.requiredField&&h("span",{"aria-hidden":"true",class:"required"},"*"))),h("div",null,h("div",{class:"inner-wrapper"},h("input",{disabled:this.isDisabled,type:"text",id:"date-input-".concat(this.uid),class:"date-input",name:"date",placeholder:t,onFocus:this.focusHandler.bind(this),onInput:function(t){return e.handleInput(t)},onBlur:function(t){return e.handleBlur(t)},ref:function(t){return e.inputEl=t},"aria-describedby":"error-".concat(this.uid),"aria-controls":"popup-".concat(this.uid),"aria-label":this.label,"aria-required":this.requiredField?"true":null}),h("priv-datepicker",{disabled:this.isDisabled,date:this.lastValidValue?new Date(this.lastValidValue):new Date,parentId:this.uid})),h("div",{id:"error-".concat(this.uid),class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayError))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["handleError"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();DatePicker.style=wmDatepickerCss;export{DatePicker as wm_datepicker};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-294d486f.js";import{i as intl,t as toBool,a as handleDisabledAttribute,j as isRelatedTarget,k as checkForFocusableElInShadow,g as generateId}from"./functions-e8b2c205.js";var wmDatepickerCss=':host{--wmcolor-datepicker-background:var(--wmcolor-background);--wmcolor-datepicker-day-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-datepicker-day-background-selected:var(--wmcolor-interactive);--wmcolor-datepicker-day-text-outside:var(--wmcolor-interactive-disabled);--wmcolor-datepicker-day-text-selected:var(--wmcolor-interactive-text-selected);--wmcolor-datepicker-day-text:var(--wmcolor-text);--wmcolor-datepicker-input-background-disabled:var(--wmcolor-input-background-disabled);--wmcolor-datepicker-input-background:var(--wmcolor-input-background);--wmcolor-datepicker-input-border:var(--wmcolor-input-border);--wmcolor-datepicker-input-text-disabled:var(--wmcolor-input-text-disabled);--wmcolor-datepicker-input-text:var(--wmcolor-input-text);--wmcolor-datepicker-month-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-datepicker-month-background-selected:var(--wmcolor-interactive);--wmcolor-datepicker-month-background:var(--wmcolor-text);--wmcolor-datepicker-month-border:var(--wmcolor-border-light);--wmcolor-datepicker-month-text-selected:var(--wmcolor-text-ondark);--wmcolor-datepicker-month-text:var(--wmcolor-interactive);--wmcolor-datepicker-navigation-background-hover:var(--wmcolor-button-background-navigational-hover);--wmcolor-datepicker-navigation-background:var(--wmcolor-button-background-navigational);--wmcolor-datepicker-navigation-text:var(--wmcolor-button-icon-navigational);--wmcolor-datepicker-selector-background:var(--wmcolor-button-background-secondary);--wmcolor-datepicker-selector-border:var(--wmcolor-button-border-secondary);--wmcolor-datepicker-selector-text:var(--wmcolor-button-text-secondary);--wmcolor-datepicker-toggle-background-disabled:var(--wmcolor-input-background-disabled);--wmcolor-datepicker-toggle-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-datepicker-toggle-background:var(--wmcolor-input-background);--wmcolor-datepicker-toggle-icon-disabled:var(--wmcolor-interactive-disabled);--wmcolor-datepicker-toggle-icon:var(--wmcolor-interactive);--wmcolor-datepicker-weekdays-background:var(--wmcolor-table-header-background);--wmcolor-datepicker-weekdays-text:var(--wmcolor-text);font-family:inherit}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper{position:relative}:host .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:2.5rem;border:1px solid;border-color:var(--wmcolor-datepicker-input-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;-ms-flex-pack:justify;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper .date-input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;color:var(--wmcolor-datepicker-input-text);font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;-ms-flex:1;flex:1;margin:0;background-color:var(--wmcolor-datepicker-input-background)}:host .wrapper .inner-wrapper .date-input:disabled{background-color:var(--wmcolor-datepicker-input-background-disabled);color:var(--wmcolor-datepicker-input-text-disabled)}:host .wrapper .inner-wrapper .date-input:focus{outline:none}:host .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper.invalid .error{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem;margin-bottom:4px;top:100%;left:0}:host .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);outline:none;border-color:var(--wmcolor-input-border-focus)}:host .user-is-tabbing .toggle:focus:not(:active){border:none;z-index:11}';var DatePicker=function(){function e(e){registerInstance(this,e);this.wmDatepickerNewValidValue=createEvent(this,"wmDatepickerNewValidValue",7);this.lastCommittedValue=this.value;this.parsableEntry=/^(\d{1}|\d{2}|\d{4})[\-\.\/]\d{1,2}[\-\.\/](\d{1}|\d{2}|\d{4})$/;this.isoEntry=/^\d\d\d\d[-]\d\d[-]\d\d$/;this.eightDigitsEntry=/^\d{8}$/;this.dateFormats={US:intl.formatMessage({id:"date.formatUS",defaultMessage:"mm/dd/yyyy"}),INT:intl.formatMessage({id:"date.formatINT",defaultMessage:"dd/mm/yyyy"}),ISO:intl.formatMessage({id:"date.formatISO",defaultMessage:"yyyy/mm/dd"})};this.value="";this.disabled=false;this.dateFormat="US";this.errorMessage="";this.labelPosition="top";this.label="";this.requiredField=false;this.requiredFieldMessage=undefined;this.preventValidation=undefined;this.displayError=""}Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});e.prototype.handleTabbingOn=function(){this.dpWrapper&&this.dpWrapper.classList.add("user-is-tabbing")};e.prototype.handleTabbingOff=function(){this.dpWrapper&&this.dpWrapper.classList.remove("user-is-tabbing")};e.prototype.handleError=function(){if(this.errorMessage){this.generateError()}else{this.clearError();this.processInput()}};e.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleInput=function(e){this.value=e.target.value};e.prototype.handleBlur=function(e){var t=this.preventValidation&&isRelatedTarget(e,this.preventValidation);if(!t){this.processInput()}this.dpWrapper.classList.remove("focus")};e.prototype.focusHandler=function(){this.dpWrapper.classList.add("focus")};e.prototype.handlePopupBlurred=function(e){if(e.detail.relatedTarget!==this.el){var t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget;this.el.dispatchEvent(t)}};e.prototype.getActiveElement=function(){return checkForFocusableElInShadow(document.activeElement)};e.prototype.handleCellTriggered=function(e){var t=e.detail;var r=t.getAttribute("data-year")+"-"+t.getAttribute("data-month")+"-"+t.textContent;this.inputEl.value=this.reformatDate(this.dateFormat,r);this.processInput();var a=new CustomEvent("input");this.el.dispatchEvent(a)};e.prototype.processInput=function(e){var t=!e&&this.requiredField;var r=this.inputEl.value;if(this.eightDigitsEntry.test(this.inputEl.value)){this.inputEl.value=this.addSlashes(this.inputEl.value)}if(this.parsableEntry.test(this.inputEl.value)){r=this.reformatDate("ISO",this.inputEl.value);this.inputEl.value=this.reformatDate(this.dateFormat,r);if(this.isValidDate(r)){if(this.errorMessage){this.generateError()}else{this.clearError()}}else if(this.inputEl.value.length){this.generateError()}}else if(this.inputEl.value.length||t||this.errorMessage){this.generateError()}else if(!this.inputEl.value.length&&!t){this.clearError()}this.value=r;if(r!==this.lastCommittedValue){var a=new CustomEvent("change");this.el.dispatchEvent(a);this.lastCommittedValue=this.value}if(this.isValidDate(r)&&r!==this.lastValidValue){this.wmDatepickerNewValidValue.emit();this.lastValidValue=r}};e.prototype.reformatDate=function(e,t){if(!t){return""}else if(!this.parsableEntry.test(t)){return t}else{var r=t.replace(/[\-\.]/gi,"/").split("/");switch(e){case"US":case this.dateFormats["US"]:return r[1].padStart(2,"0")+"/"+r[2].padStart(2,"0")+"/"+r[0].padStart(4,"20");case"INT":case this.dateFormats["INT"]:return r[2].padStart(2,"0")+"/"+r[1].padStart(2,"0")+"/"+r[0].padStart(4,"20");case"ISO":case this.dateFormats["ISO"]:if(this.dateFormat==="US"||this.dateFormat===this.dateFormats["US"]){return r[2].padStart(4,"20")+"-"+r[0].padStart(2,"0")+"-"+r[1].padStart(2,"0")}else if(this.dateFormat==="INT"||this.dateFormat===this.dateFormats["INT"]){return r[2].padStart(4,"20")+"-"+r[1].padStart(2,"0")+"-"+r[0].padStart(2,"0")}else if(this.dateFormat==="ISO"||this.dateFormat===this.dateFormats["ISO"]){return r[0].padStart(4,"20")+"-"+r[1].padStart(2,"0")+"-"+r[2].padStart(2,"0")}default:return r.join("/")}}};e.prototype.isValidDate=function(e){if(!e||!this.isoEntry.test(e)){return false}else{var t=e.split("-");var r=parseInt(t[2],10);var a=parseInt(t[1],10);var i=parseInt(t[0],10);if(i<1e3||i>3e3||a==0||a>12)return false;var o=[31,28,31,30,31,30,31,31,30,31,30,31];if(i%400==0||i%100!=0&&i%4==0)o[1]=29;return r>0&&r<=o[a-1]}};e.prototype.generateError=function(){var e=this.requiredFieldMessage||intl.formatMessage({id:"date.requiredDateError",defaultMessage:"A date is required."});var t=intl.formatMessage({id:"date.invalidDate",defaultMessage:"Please enter a valid date in the format {dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}."},{dateFormat:this.dateFormat.toLowerCase()});if(this.errorMessage){this.displayError=this.errorMessage}else if(this.inputEl.value.length){this.displayError=t}else if(!this.inputEl.value.length&&this.requiredField){this.displayError=e}};e.prototype.clearError=function(){this.displayError=""};e.prototype.addSlashes=function(e){if(this.dateFormat==="ISO"||this.dateFormat===this.dateFormats["ISO"]){return e.substring(0,4)+"/"+e.substring(4,6)+"/"+e.substring(6)}else{return e.substring(0,2)+"/"+e.substring(2,4)+"/"+e.substring(4)}};e.prototype.componentWillLoad=function(){if(this.label===""){console.error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none.")}if(this.errorMessage){this.generateError()}this.uid=this.el.id?this.el.id:generateId();if(this.value&&this.isValidDate(this.value)){this.lastValidValue=this.value}handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.componentDidLoad=function(){this.inputEl.value=this.reformatDate(this.dateFormat,this.value);this.processInput(true)};e.prototype.render=function(){var e=this;var t=intl.formatMessage({id:"date.format",defaultMessage:"{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} other {yyyy/mm/dd}}"},{dateFormat:this.dateFormat.toLowerCase()});return h(Host,{id:this.uid,"aria-busy":"false",class:"".concat(this.displayError?"invalid":""),invalid:this.displayError?"true":null},h("div",{ref:function(t){return e.dpWrapper=t},class:"wrapper label-".concat(this.labelPosition," ").concat(this.displayError?"invalid":"")},h("div",{class:"label-wrapper"},this.labelPosition!=="none"&&h("label",{id:"datepickerLabel-".concat(this.uid),htmlFor:"date-input-".concat(this.uid),class:"label",title:"".concat(this.label," (").concat(t,")")},this.label,this.requiredField&&h("span",{"aria-hidden":"true",class:"required"},"*"))),h("div",null,h("div",{class:"inner-wrapper"},h("input",{disabled:this.isDisabled,type:"text",id:"date-input-".concat(this.uid),class:"date-input",name:"date",placeholder:t,onFocus:this.focusHandler.bind(this),onInput:function(t){return e.handleInput(t)},onBlur:function(t){return e.handleBlur(t)},ref:function(t){return e.inputEl=t},"aria-describedby":"error-".concat(this.uid),"aria-controls":"popup-".concat(this.uid),"aria-label":this.label,"aria-required":this.requiredField?"true":null}),h("priv-datepicker",{disabled:this.isDisabled,date:this.lastValidValue?new Date(this.lastValidValue):new Date,parentId:this.uid})),h("div",{id:"error-".concat(this.uid),class:"error","aria-live":"assertive","aria-atomic":"true"},this.displayError))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["handleError"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();DatePicker.style=wmDatepickerCss;export{DatePicker as wm_datepicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,f as forceUpdate,h,H as Host,g as getElement}from"./index-294d486f.js";import{d as debounce,i as intl,k as truncateText,s as showTooltip,h as hideTooltip}from"./functions-abbff9c1.js";var wmFileCss=':host{--wmcolor-file-background-error:var(--wmcolor-background-error);--wmcolor-file-background:var(--wmcolor-background-readonly);--wmcolor-file-border-error:var(--wmcolor-border-error);--wmcolor-file-border:var(--wmcolor-border);--wmcolor-file-checkmark-icon:var(--wmcolor-positive);--wmcolor-file-progress:var(--wmcolor-progress);display:block;width:100%}.file-wrapper{font-size:0.875rem;position:relative;list-style:none}.file-wrapper .file{min-width:300px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;height:3.5rem;padding:0 1.25rem;position:relative;background:var(--wmcolor-file-background);border:1px solid var(--wmcolor-file-border);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}.file-wrapper .file .filename{display:inline-block;white-space:nowrap}.file-wrapper .file .left-group{overflow:hidden}.file-wrapper .file .right-group{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:5rem;gap:1rem}.file-wrapper .file .right-group.condensed{padding-left:2.5rem}.file-wrapper .file .right-group .file-controls{display:-ms-flexbox;display:flex;gap:1rem}.file-wrapper .file .right-group .file-info{white-space:nowrap}.file-wrapper .file.--error{border:1px solid var(--wmcolor-file-border-error);background-color:var(--wmcolor-file-background-error);height:3.75rem}.file-wrapper.checked .file:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f133";position:absolute;right:-44px;color:var(--wmcolor-file-checkmark-icon);font-size:28px;line-height:1}.name-wrapper{overflow:hidden}.progress{position:absolute;left:0;top:0;right:0;height:8px}.error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var File=function(){function e(e){var t=this;registerInstance(this,e);this.wmIntFilePreviewed=createEvent(this,"wmIntFilePreviewed",7);this.wmIntFileDownloaded=createEvent(this,"wmIntFileDownloaded",7);this.wmIntFileDeleted=createEvent(this,"wmIntFileDeleted",7);this.wmFileClearErrorClicked=createEvent(this,"wmFileClearErrorClicked",7);this.isWithinLegacyUploader=false;this.debouncedResize=debounce((function(){t.isCondensed=t.el.clientWidth<500;forceUpdate(t.el)}),50);this.file=undefined;this.showInfo="time";this.errorMessage=undefined;this.isCondensed=false}Object.defineProperty(e.prototype,"fileData",{get:function(){var e=this.file?JSON.parse(this.file):null;if(e&&e.progress&&typeof e.progress==="string"&&e.progress.match(/^[0-9]+$/)){e.progress=parseInt(e.progress.toString())}return e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isUploading",{get:function(){return this.fileData&&this.fileData.hasOwnProperty("progress")&&this.fileData.progress<100},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previewButtonTooltip",{get:function(){return intl.formatMessage({id:"file.previewButtonTooltip",defaultMessage:"Preview",description:"Tooltip of a button that triggers a file to be previewed"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"downloadButtonTooltip",{get:function(){return intl.formatMessage({id:"file.downloadButtonTooltip",defaultMessage:"Download",description:"Tooltip of a button that triggers a file to be downloaded"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"deleteButtonTooltip",{get:function(){return intl.formatMessage({id:"file.deleteButtonTooltip",defaultMessage:"Delete",description:"Tooltip of a button that triggers a file to be deleted"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previewActionMessage",{get:function(){return intl.formatMessage({id:"file.previewAction",defaultMessage:"Preview File",description:"Label of a button that triggers a file to be previewed"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"downloadActionMessage",{get:function(){return intl.formatMessage({id:"file.downloadAction",defaultMessage:"Download File",description:"Label of a button that triggers a file to be downloaded"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"deleteActionMessage",{get:function(){return intl.formatMessage({id:"file.deleteAction",defaultMessage:"Delete File",description:"Label of a button that triggers a file to be delete"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"actionMenuLabel",{get:function(){return intl.formatMessage({id:"file.actionMenuLabel",defaultMessage:"Actions",description:"Label of a button that opens a menu of file actions"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"clearButtonText",{get:function(){return intl.formatMessage({id:"file.clearErrorText",defaultMessage:"Clear",description:"Text for a button used to clear an error"})},enumerable:false,configurable:true});e.prototype.generateClearButtonLabel=function(e){return intl.formatMessage({id:"file.clearErrorLabel",defaultMessage:"Clear {fileName} error",description:"Label for a button used to clear an error, including filename"},{fileName:e})};e.prototype.componentWillLoad=function(){var e=this;var t=this.el.getRootNode().host;if(t&&t.nodeName==="WM-UPLOADER"){if(t.type||t.uploaderType){this.isWithinLegacyUploader=true}}var o=new ResizeObserver((function(){return e.debouncedResize()}));o.observe(this.el)};e.prototype.componentDidRender=function(){var e=this.el.shadowRoot.querySelector(".filename");var t=this.el.shadowRoot.querySelector(".left-group").getBoundingClientRect().left;var o=this.el.shadowRoot.querySelector(".right-group");var r=o?o.getBoundingClientRect().left:this.el.shadowRoot.querySelector(".file-wrapper").getBoundingClientRect().right-20;e.textContent=truncateText(e,e.dataset.filename,r-t,7)};e.prototype.previewFile=function(e){this.wmIntFilePreviewed.emit(e.id)};e.prototype.downloadFile=function(e){this.wmIntFileDownloaded.emit(e.id)};e.prototype.deleteFile=function(e){this.wmIntFileDeleted.emit(e.id)};e.prototype.handleFilenameMouseEnter=function(e,t){if(e.target.textContent.includes("...")){showTooltip("bottom",e.target,t)}};e.prototype.renderFileName=function(e,t){var o=this;return h("div",{class:"left-group"},h("div",{class:"name-wrapper"},h("span",{class:"sr-only"},e),h("span",{"aria-hidden":"true",class:"filename","data-filename":e,onMouseEnter:function(t){return o.handleFilenameMouseEnter(t,e)},onMouseLeave:function(){return hideTooltip()}}),t&&h("span",{class:"sr-only"},"uploading")))};e.prototype.renderFileInfo=function(e,t){var o="";if(t==="time"&&e.lastUpdated){o=e.lastUpdated}else if(t==="size"&&e.size){o=e.size}return h("div",{class:"file-info"},o)};e.prototype.renderActionMenu=function(e){var t=this;var o="download delete";var r=e.fileActions||o;var i=h("wm-menuitem",{icon:"f208",onClick:function(){return t.previewFile(e)}},this.previewActionMessage);var n=h("wm-menuitem",{icon:"f1da",onClick:function(){return t.downloadFile(e)}},this.downloadActionMessage);var l=h("wm-menuitem",{icon:"f1c0",onClick:function(){return t.deleteFile(e)}},this.deleteActionMessage);return h("wm-action-menu",{"action-menu-type":"icon",tooltip:this.actionMenuLabel,"tooltip-position":"bottom","label-for-identical-buttons":"".concat(e.name," ").concat(this.actionMenuLabel)},r.includes("preview")&&i,r.includes("download")&&n,r.includes("delete")&&l)};e.prototype.renderFileActionButtons=function(e){var t=this;var o="download delete";var r=e.fileActions||o;var i=h("wm-button",{class:"preview-button","button-type":"icononly",tooltip:this.previewButtonTooltip,"tooltip-position":"bottom","label-for-identical-buttons":"preview ".concat(e.name),icon:"f208",onClick:function(){return t.previewFile(e)}});var n=h("wm-button",{class:"download-button","button-type":"icononly",tooltip:this.downloadButtonTooltip,"tooltip-position":"bottom","label-for-identical-buttons":"download ".concat(e.name),icon:"f1da",onClick:function(){return t.downloadFile(e)}});var l=h("wm-button",{class:"delete-button","button-type":"icononly",tooltip:this.deleteButtonTooltip,"tooltip-position":"bottom","label-for-identical-buttons":"delete ".concat(e.name),icon:"f1c0",onClick:function(){return t.deleteFile(e)}});return h("div",{class:"file-controls"},r.includes("preview")&&i,r.includes("download")&&n,r.includes("delete")&&l)};e.prototype.renderFileInProgress=function(e){var t=e.type?"".concat(e.name,".").concat(e.type):e.name;return h("div",{class:"file-wrapper"},h("div",{class:"file --progress"},h("div",{class:"progress",style:{background:"linear-gradient(to right, var(--wmcolor-file-progress) ".concat(e.progress,"%, transparent ").concat(e.progress,"%)")}}),this.renderFileName(t,this.isUploading)))};e.prototype.renderFileControls=function(e){var t=e.fileActions&&e.fileActions.split(" ").length===1;var o=this.isCondensed&&!t;return o?this.renderActionMenu(e):this.renderFileActionButtons(e)};e.prototype.renderFile=function(e){var t=this;var o=e.type?"".concat(e.name,".").concat(e.type):e.name;var r=!this.isWithinLegacyUploader&&e.progress===100;return h("div",{class:"file-wrapper ".concat(r?"checked":"")},h("div",{class:"file ".concat(this.errorMessage?"--error":"")},this.renderFileName(o,this.isUploading),!this.errorMessage&&h("div",{class:"right-group ".concat(this.isCondensed?"condensed":"")},this.showInfo!=="none"&&this.renderFileInfo(e,this.showInfo),e.fileActions!==""&&this.renderFileControls(e)),this.errorMessage&&h("wm-button",{"permanently-delete":true,"button-type":"textonly","label-for-identical-buttons":this.generateClearButtonLabel(e.name),onClick:function(){return t.wmFileClearErrorClicked.emit({name:e.name})}},this.clearButtonText)),this.errorMessage&&h("div",{class:"error-message"},this.errorMessage))};e.prototype.render=function(){return h(Host,{role:"listitem"},this.isUploading?this.renderFileInProgress(this.fileData):this.renderFile(this.fileData))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();File.style=wmFileCss;export{File as wm_file};
|
|
1
|
+
import{r as registerInstance,c as createEvent,f as forceUpdate,h,H as Host,g as getElement}from"./index-294d486f.js";import{d as debounce,i as intl,l as truncateText,s as showTooltip,h as hideTooltip}from"./functions-e8b2c205.js";var wmFileCss=':host{--wmcolor-file-background-error:var(--wmcolor-background-error);--wmcolor-file-background:var(--wmcolor-background-readonly);--wmcolor-file-border-error:var(--wmcolor-border-error);--wmcolor-file-border:var(--wmcolor-border);--wmcolor-file-checkmark-icon:var(--wmcolor-positive);--wmcolor-file-progress:var(--wmcolor-progress);display:block;width:100%}.file-wrapper{font-size:0.875rem;position:relative;list-style:none}.file-wrapper .file{min-width:300px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;height:3.5rem;padding:0 1.25rem;position:relative;background:var(--wmcolor-file-background);border:1px solid var(--wmcolor-file-border);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}.file-wrapper .file .filename{display:inline-block;white-space:nowrap}.file-wrapper .file .left-group{overflow:hidden}.file-wrapper .file .right-group{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-left:5rem;gap:1rem}.file-wrapper .file .right-group.condensed{padding-left:2.5rem}.file-wrapper .file .right-group .file-controls{display:-ms-flexbox;display:flex;gap:1rem}.file-wrapper .file .right-group .file-info{white-space:nowrap}.file-wrapper .file.--error{border:1px solid var(--wmcolor-file-border-error);background-color:var(--wmcolor-file-background-error);height:3.75rem}.file-wrapper.checked .file:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f133";position:absolute;right:-44px;color:var(--wmcolor-file-checkmark-icon);font-size:28px;line-height:1}.name-wrapper{overflow:hidden}.progress{position:absolute;left:0;top:0;right:0;height:8px}.error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var File=function(){function e(e){var t=this;registerInstance(this,e);this.wmIntFilePreviewed=createEvent(this,"wmIntFilePreviewed",7);this.wmIntFileDownloaded=createEvent(this,"wmIntFileDownloaded",7);this.wmIntFileDeleted=createEvent(this,"wmIntFileDeleted",7);this.wmFileClearErrorClicked=createEvent(this,"wmFileClearErrorClicked",7);this.isWithinLegacyUploader=false;this.debouncedResize=debounce((function(){t.isCondensed=t.el.clientWidth<500;forceUpdate(t.el)}),50);this.file=undefined;this.showInfo="time";this.errorMessage=undefined;this.isCondensed=false}Object.defineProperty(e.prototype,"fileData",{get:function(){var e=this.file?JSON.parse(this.file):null;if(e&&e.progress&&typeof e.progress==="string"&&e.progress.match(/^[0-9]+$/)){e.progress=parseInt(e.progress.toString())}return e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isUploading",{get:function(){return this.fileData&&this.fileData.hasOwnProperty("progress")&&this.fileData.progress<100},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previewButtonTooltip",{get:function(){return intl.formatMessage({id:"file.previewButtonTooltip",defaultMessage:"Preview",description:"Tooltip of a button that triggers a file to be previewed"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"downloadButtonTooltip",{get:function(){return intl.formatMessage({id:"file.downloadButtonTooltip",defaultMessage:"Download",description:"Tooltip of a button that triggers a file to be downloaded"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"deleteButtonTooltip",{get:function(){return intl.formatMessage({id:"file.deleteButtonTooltip",defaultMessage:"Delete",description:"Tooltip of a button that triggers a file to be deleted"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"previewActionMessage",{get:function(){return intl.formatMessage({id:"file.previewAction",defaultMessage:"Preview File",description:"Label of a button that triggers a file to be previewed"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"downloadActionMessage",{get:function(){return intl.formatMessage({id:"file.downloadAction",defaultMessage:"Download File",description:"Label of a button that triggers a file to be downloaded"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"deleteActionMessage",{get:function(){return intl.formatMessage({id:"file.deleteAction",defaultMessage:"Delete File",description:"Label of a button that triggers a file to be delete"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"actionMenuLabel",{get:function(){return intl.formatMessage({id:"file.actionMenuLabel",defaultMessage:"Actions",description:"Label of a button that opens a menu of file actions"})},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"clearButtonText",{get:function(){return intl.formatMessage({id:"file.clearErrorText",defaultMessage:"Clear",description:"Text for a button used to clear an error"})},enumerable:false,configurable:true});e.prototype.generateClearButtonLabel=function(e){return intl.formatMessage({id:"file.clearErrorLabel",defaultMessage:"Clear {fileName} error",description:"Label for a button used to clear an error, including filename"},{fileName:e})};e.prototype.componentWillLoad=function(){var e=this;var t=this.el.getRootNode().host;if(t&&t.nodeName==="WM-UPLOADER"){if(t.type||t.uploaderType){this.isWithinLegacyUploader=true}}var o=new ResizeObserver((function(){return e.debouncedResize()}));o.observe(this.el)};e.prototype.componentDidRender=function(){var e=this.el.shadowRoot.querySelector(".filename");var t=this.el.shadowRoot.querySelector(".left-group").getBoundingClientRect().left;var o=this.el.shadowRoot.querySelector(".right-group");var r=o?o.getBoundingClientRect().left:this.el.shadowRoot.querySelector(".file-wrapper").getBoundingClientRect().right-20;e.textContent=truncateText(e,e.dataset.filename,r-t,7)};e.prototype.previewFile=function(e){this.wmIntFilePreviewed.emit(e.id)};e.prototype.downloadFile=function(e){this.wmIntFileDownloaded.emit(e.id)};e.prototype.deleteFile=function(e){this.wmIntFileDeleted.emit(e.id)};e.prototype.handleFilenameMouseEnter=function(e,t){if(e.target.textContent.includes("...")){showTooltip("bottom",e.target,t)}};e.prototype.renderFileName=function(e,t){var o=this;return h("div",{class:"left-group"},h("div",{class:"name-wrapper"},h("span",{class:"sr-only"},e),h("span",{"aria-hidden":"true",class:"filename","data-filename":e,onMouseEnter:function(t){return o.handleFilenameMouseEnter(t,e)},onMouseLeave:function(){return hideTooltip()}}),t&&h("span",{class:"sr-only"},"uploading")))};e.prototype.renderFileInfo=function(e,t){var o="";if(t==="time"&&e.lastUpdated){o=e.lastUpdated}else if(t==="size"&&e.size){o=e.size}return h("div",{class:"file-info"},o)};e.prototype.renderActionMenu=function(e){var t=this;var o="download delete";var r=e.fileActions||o;var i=h("wm-menuitem",{icon:"f208",onClick:function(){return t.previewFile(e)}},this.previewActionMessage);var n=h("wm-menuitem",{icon:"f1da",onClick:function(){return t.downloadFile(e)}},this.downloadActionMessage);var l=h("wm-menuitem",{icon:"f1c0",onClick:function(){return t.deleteFile(e)}},this.deleteActionMessage);return h("wm-action-menu",{"action-menu-type":"icon",tooltip:this.actionMenuLabel,"tooltip-position":"bottom","label-for-identical-buttons":"".concat(e.name," ").concat(this.actionMenuLabel)},r.includes("preview")&&i,r.includes("download")&&n,r.includes("delete")&&l)};e.prototype.renderFileActionButtons=function(e){var t=this;var o="download delete";var r=e.fileActions||o;var i=h("wm-button",{class:"preview-button","button-type":"icononly",tooltip:this.previewButtonTooltip,"tooltip-position":"bottom","label-for-identical-buttons":"preview ".concat(e.name),icon:"f208",onClick:function(){return t.previewFile(e)}});var n=h("wm-button",{class:"download-button","button-type":"icononly",tooltip:this.downloadButtonTooltip,"tooltip-position":"bottom","label-for-identical-buttons":"download ".concat(e.name),icon:"f1da",onClick:function(){return t.downloadFile(e)}});var l=h("wm-button",{class:"delete-button","button-type":"icononly",tooltip:this.deleteButtonTooltip,"tooltip-position":"bottom","label-for-identical-buttons":"delete ".concat(e.name),icon:"f1c0",onClick:function(){return t.deleteFile(e)}});return h("div",{class:"file-controls"},r.includes("preview")&&i,r.includes("download")&&n,r.includes("delete")&&l)};e.prototype.renderFileInProgress=function(e){var t=e.type?"".concat(e.name,".").concat(e.type):e.name;return h("div",{class:"file-wrapper"},h("div",{class:"file --progress"},h("div",{class:"progress",style:{background:"linear-gradient(to right, var(--wmcolor-file-progress) ".concat(e.progress,"%, transparent ").concat(e.progress,"%)")}}),this.renderFileName(t,this.isUploading)))};e.prototype.renderFileControls=function(e){var t=e.fileActions&&e.fileActions.split(" ").length===1;var o=this.isCondensed&&!t;return o?this.renderActionMenu(e):this.renderFileActionButtons(e)};e.prototype.renderFile=function(e){var t=this;var o=e.type?"".concat(e.name,".").concat(e.type):e.name;var r=!this.isWithinLegacyUploader&&e.progress===100;return h("div",{class:"file-wrapper ".concat(r?"checked":"")},h("div",{class:"file ".concat(this.errorMessage?"--error":"")},this.renderFileName(o,this.isUploading),!this.errorMessage&&h("div",{class:"right-group ".concat(this.isCondensed?"condensed":"")},this.showInfo!=="none"&&this.renderFileInfo(e,this.showInfo),e.fileActions!==""&&this.renderFileControls(e)),this.errorMessage&&h("wm-button",{"permanently-delete":true,"button-type":"textonly","label-for-identical-buttons":this.generateClearButtonLabel(e.name),onClick:function(){return t.wmFileClearErrorClicked.emit({name:e.name})}},this.clearButtonText)),this.errorMessage&&h("div",{class:"error-message"},this.errorMessage))};e.prototype.render=function(){return h(Host,{role:"listitem"},this.isUploading?this.renderFileInProgress(this.fileData):this.renderFile(this.fileData))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();File.style=wmFileCss;export{File as wm_file};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-294d486f.js";import{i as intl,t as toBool,g as generateId,r as removeDisabledAttribute,a as triggerFormSubmit,e as isRelatedTarget}from"./functions-abbff9c1.js";import{g as globalMessages}from"./intl-7c8d2db9.js";var wmInputCss=':host{font-family:inherit;width:100%}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper{width:100%}:host .wrapper .text-after-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px}:host .wrapper .text-after{-ms-flex:0 1 fit-content;flex:0 1 fit-content}:host .wrapper .inputfield-wrapper{height:2.5rem;min-width:6.25rem;border:1px solid var(--wmcolor-input-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:-ms-flexbox;display:flex}:host .wrapper .inputfield-wrapper.disabled{background-color:var(--wmcolor-input-background-disabled);color:var(--wmcolor-input-text-disabled)}:host .wrapper .inputfield-wrapper.disabled .symbol{background:none}:host .wrapper .symbol{display:-ms-flexbox;display:flex;background-color:var(--wmcolor-input-unit-background);-ms-flex:0 0 44px;flex:0 0 44px;padding-inline:8px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .wrapper .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-input-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .wrapper input{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:none;font-family:inherit;font-size:0.875rem;height:100%;-ms-flex:1;flex:1;padding:0.75rem 1rem;width:100%}:host .wrapper input:focus{outline:none}:host .wrapper input[type=number]{padding-right:0}:host .wrapper .info{font-style:italic;line-height:100%;margin:4px 0}:host .wrapper.invalid .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper.invalid .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem;line-height:100%}:host .wrapper:focus .inputfield-wrapper,:host .wrapper.focus .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);outline:none;border-color:var(--wmcolor-input-border-focus)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var Input=function(){function e(e){registerInstance(this,e);this.wmInputValueChanged=createEvent(this,"wmInputValueChanged",7);this.uid="";this.previousBlurredValue="";this.numberErrorMessage=intl.formatMessage({id:"input.numberError",defaultMessage:"Please enter a valid number."});this.label=undefined;this.labelPosition="top";this.value="";this.disabled=false;this.info=undefined;this.inputWidth="";this.placeholder="";this.requiredField=false;this.requiredFieldMessage=undefined;this.errorMessage=undefined;this.characterLimit=undefined;this.symbolBefore=undefined;this.symbolAfter=undefined;this.textAfter=undefined;this.preventValidation=undefined;this.type="text";this.step=1;this.min=undefined;this.max=undefined;this.isSubmit=false;this.announcement="";this.displayedErrorMessage=""}e.prototype.getInputWidth=function(){return this.inputWidth?{width:this.inputWidth}:{flex:"1"}};Object.defineProperty(e.prototype,"charCount",{get:function(){return this.value.length},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});e.prototype.componentWillLoad=function(){this.uid=this.el.id?this.el.id:generateId();if(!this.label){console.error("wm-input requires the label property")}removeDisabledAttribute(this.el,this.isDisabled)};e.prototype.componentDidLoad=function(){if(this.value){this.inputEl.value=this.value;this.previousBlurredValue=this.inputEl.value}};e.prototype.handleErrorMessage=function(e){this.displayedErrorMessage=e};e.prototype.handleDisabledChange=function(){removeDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleKeyDown=function(e){var t=e.ctrlKey||e.metaKey||e.altKey;var r=/^.$/.test(e.key)&&!t;var i=r&&this.characterLimit&&this.inputEl.value.length>=this.characterLimit;if(i){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}if(e.key==="Enter"){this.isSubmit&&triggerFormSubmit(this.el.closest("form"))}};e.prototype.handleBlur=function(e){if(this.value!==this.previousBlurredValue){this.wmInputValueChanged.emit({value:this.value})}this.previousBlurredValue=this.value;var t=this.preventValidation&&isRelatedTarget(e,this.preventValidation);if(!t){this.displayedErrorMessage=this.validate()}this.inputWrapperEl.classList.remove("focus")};e.prototype.handleInput=function(e){this.value=e.target.value;if(this.characterLimit&&this.charCount>=this.characterLimit-5){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}};e.prototype.handleFocus=function(){this.inputWrapperEl.classList.add("focus")};e.prototype.validate=function(){var e=[this.validateNumber.bind(this),this.validateRequired.bind(this)];if(this.errorMessage){return this.errorMessage}else{return e.reduce((function(e,t){return e?e:t()}),"")}};e.prototype.validateRequired=function(){var e=this.requiredFieldMessage||globalMessages.requiredError;return this.requiredField&&this.value===""?e:""};e.prototype.validateNumber=function(){return this.type==="number"&&this.inputEl.validity.badInput?this.numberErrorMessage:""};e.prototype.announce=function(e){if(this.liveRegionEl.textContent===e){e+=" "}this.announcement=e};e.prototype.generateCharacterLimitWarning=function(e,t){var r=globalMessages.getCharactersEntered(e,t);if(e>=t){r+=" ".concat(globalMessages.characterLimitReached)}return r};e.prototype.descriptors=function(){return this.symbolBefore||this.symbolAfter||this.textAfter?"symbol-before-".concat(this.uid," inputfield-").concat(this.uid," symbol-after-").concat(this.uid," text-after-").concat(this.uid," info-").concat(this.uid," error-").concat(this.uid):"info-".concat(this.uid," error-").concat(this.uid)};e.prototype.renderErrorMessage=function(){return this.errorMessage||this.displayedErrorMessage};e.prototype.render=function(){var e=this;return h(Host,{id:this.uid},h("div",{class:"wrapper label-".concat(this.labelPosition," ").concat(this.errorMessage||this.displayedErrorMessage?"invalid":""),ref:function(t){return e.inputWrapperEl=t}},h("div",{class:"label-wrapper"},h("label",{htmlFor:"inputfield-".concat(this.uid),class:"label"},this.label,this.characterLimit&&h("span",{class:"sr-only"}," ",globalMessages.getCharacterLimit(this.characterLimit)),this.requiredField&&h("span",{class:"required","aria-hidden":"true"},"*"))),h("div",{class:"inner-wrapper"},h("div",{class:"text-after-wrapper"},h("div",{class:"inputfield-wrapper ".concat(this.isDisabled?"disabled":""),style:this.getInputWidth()},this.symbolBefore&&h("span",{class:"symbol",id:"symbol-before-".concat(this.uid)},this.symbolBefore),h("input",{ref:function(t){return e.inputEl=t},id:"inputfield-".concat(this.uid),disabled:this.isDisabled,"aria-describedby":this.descriptors(),onInput:function(t){return e.handleInput(t)},onKeyDown:function(t){return e.handleKeyDown(t)},onBlur:function(t){return e.handleBlur(t)},onFocus:this.handleFocus.bind(this),placeholder:this.placeholder,autocomplete:"off","aria-required":this.requiredField?"true":null,maxLength:this.characterLimit||undefined,type:this.type,step:this.step,max:this.max,min:this.min}),this.symbolAfter&&h("span",{class:"symbol",id:"symbol-after-".concat(this.uid)},this.symbolAfter),this.characterLimit&&typeof this.characterLimit==="number"?h("div",{class:"character-count"},this.charCount,"/",this.characterLimit):""),this.textAfter&&h("span",{class:"text-after",id:"text-after-".concat(this.uid)},this.textAfter)),this.info&&h("div",{id:"info-".concat(this.uid),class:"info"},this.info),h("div",{id:"error-".concat(this.uid),"aria-live":"assertive",class:"error-message","aria-atomic":"true"},this.renderErrorMessage()),h("div",{class:"sr-only","aria-live":"polite","aria-atomic":"true",ref:function(t){return e.liveRegionEl=t}},this.announcement))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["handleErrorMessage"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();Input.style=wmInputCss;export{Input as wm_input};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-294d486f.js";import{i as intl,t as toBool,g as generateId,a as handleDisabledAttribute,b as triggerFormSubmit,j as isRelatedTarget}from"./functions-e8b2c205.js";import{g as globalMessages}from"./intl-3b652186.js";var wmInputCss=':host{font-family:inherit;width:100%}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper{width:100%}:host .wrapper .text-after-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px}:host .wrapper .text-after{-ms-flex:0 1 fit-content;flex:0 1 fit-content}:host .wrapper .inputfield-wrapper{height:2.5rem;min-width:6.25rem;border:1px solid var(--wmcolor-input-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:-ms-flexbox;display:flex}:host .wrapper .inputfield-wrapper.disabled{background-color:var(--wmcolor-input-background-disabled);color:var(--wmcolor-input-text-disabled)}:host .wrapper .inputfield-wrapper.disabled .symbol{background:none}:host .wrapper .symbol{display:-ms-flexbox;display:flex;background-color:var(--wmcolor-input-unit-background);-ms-flex:0 0 44px;flex:0 0 44px;padding-inline:8px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .wrapper .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-input-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .wrapper input{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:none;font-family:inherit;font-size:0.875rem;height:100%;-ms-flex:1;flex:1;padding:0.75rem 1rem;width:100%}:host .wrapper input:focus{outline:none}:host .wrapper input[type=number]{padding-right:0}:host .wrapper .info{font-style:italic;line-height:100%;margin:4px 0}:host .wrapper.invalid .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper.invalid .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem;line-height:100%}:host .wrapper:focus .inputfield-wrapper,:host .wrapper.focus .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);outline:none;border-color:var(--wmcolor-input-border-focus)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var Input=function(){function e(e){registerInstance(this,e);this.wmInputValueChanged=createEvent(this,"wmInputValueChanged",7);this.uid="";this.previousBlurredValue="";this.numberErrorMessage=intl.formatMessage({id:"input.numberError",defaultMessage:"Please enter a valid number."});this.label=undefined;this.labelPosition="top";this.value="";this.disabled=false;this.info=undefined;this.inputWidth="";this.placeholder="";this.requiredField=false;this.requiredFieldMessage=undefined;this.errorMessage=undefined;this.characterLimit=undefined;this.symbolBefore=undefined;this.symbolAfter=undefined;this.textAfter=undefined;this.preventValidation=undefined;this.type="text";this.step=1;this.min=undefined;this.max=undefined;this.isSubmit=false;this.announcement="";this.displayedErrorMessage=""}e.prototype.getInputWidth=function(){return this.inputWidth?{width:this.inputWidth}:{flex:"1"}};Object.defineProperty(e.prototype,"charCount",{get:function(){return this.value.length},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});e.prototype.componentWillLoad=function(){this.uid=this.el.id?this.el.id:generateId();if(!this.label){console.error("wm-input requires the label property")}handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.componentDidLoad=function(){if(this.value){this.inputEl.value=this.value;this.previousBlurredValue=this.inputEl.value}};e.prototype.handleErrorMessage=function(e){this.displayedErrorMessage=e};e.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleKeyDown=function(e){var t=e.ctrlKey||e.metaKey||e.altKey;var r=/^.$/.test(e.key)&&!t;var i=r&&this.characterLimit&&this.inputEl.value.length>=this.characterLimit;if(i){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}if(e.key==="Enter"){this.isSubmit&&triggerFormSubmit(this.el.closest("form"))}};e.prototype.handleBlur=function(e){if(this.value!==this.previousBlurredValue){this.wmInputValueChanged.emit({value:this.value})}this.previousBlurredValue=this.value;var t=this.preventValidation&&isRelatedTarget(e,this.preventValidation);if(!t){this.displayedErrorMessage=this.validate()}this.inputWrapperEl.classList.remove("focus")};e.prototype.handleInput=function(e){this.value=e.target.value;if(this.characterLimit&&this.charCount>=this.characterLimit-5){this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit))}};e.prototype.handleFocus=function(){this.inputWrapperEl.classList.add("focus")};e.prototype.validate=function(){var e=[this.validateNumber.bind(this),this.validateRequired.bind(this)];if(this.errorMessage){return this.errorMessage}else{return e.reduce((function(e,t){return e?e:t()}),"")}};e.prototype.validateRequired=function(){var e=this.requiredFieldMessage||globalMessages.requiredError;return this.requiredField&&this.value===""?e:""};e.prototype.validateNumber=function(){return this.type==="number"&&this.inputEl.validity.badInput?this.numberErrorMessage:""};e.prototype.announce=function(e){if(this.liveRegionEl.textContent===e){e+=" "}this.announcement=e};e.prototype.generateCharacterLimitWarning=function(e,t){var r=globalMessages.getCharactersEntered(e,t);if(e>=t){r+=" ".concat(globalMessages.characterLimitReached)}return r};e.prototype.descriptors=function(){return this.symbolBefore||this.symbolAfter||this.textAfter?"symbol-before-".concat(this.uid," inputfield-").concat(this.uid," symbol-after-").concat(this.uid," text-after-").concat(this.uid," info-").concat(this.uid," error-").concat(this.uid):"info-".concat(this.uid," error-").concat(this.uid)};e.prototype.renderErrorMessage=function(){return this.errorMessage||this.displayedErrorMessage};e.prototype.render=function(){var e=this;return h(Host,{id:this.uid},h("div",{class:"wrapper label-".concat(this.labelPosition," ").concat(this.errorMessage||this.displayedErrorMessage?"invalid":""),ref:function(t){return e.inputWrapperEl=t}},h("div",{class:"label-wrapper"},h("label",{htmlFor:"inputfield-".concat(this.uid),class:"label"},this.label,this.characterLimit&&h("span",{class:"sr-only"}," ",globalMessages.getCharacterLimit(this.characterLimit)),this.requiredField&&h("span",{class:"required","aria-hidden":"true"},"*"))),h("div",{class:"inner-wrapper"},h("div",{class:"text-after-wrapper"},h("div",{class:"inputfield-wrapper ".concat(this.isDisabled?"disabled":""),style:this.getInputWidth()},this.symbolBefore&&h("span",{class:"symbol",id:"symbol-before-".concat(this.uid)},this.symbolBefore),h("input",{ref:function(t){return e.inputEl=t},id:"inputfield-".concat(this.uid),disabled:this.isDisabled,"aria-describedby":this.descriptors(),onInput:function(t){return e.handleInput(t)},onKeyDown:function(t){return e.handleKeyDown(t)},onBlur:function(t){return e.handleBlur(t)},onFocus:this.handleFocus.bind(this),placeholder:this.placeholder,autocomplete:"off","aria-required":this.requiredField?"true":null,maxLength:this.characterLimit||undefined,type:this.type,step:this.step,max:this.max,min:this.min}),this.symbolAfter&&h("span",{class:"symbol",id:"symbol-after-".concat(this.uid)},this.symbolAfter),this.characterLimit&&typeof this.characterLimit==="number"?h("div",{class:"character-count"},this.charCount,"/",this.characterLimit):""),this.textAfter&&h("span",{class:"text-after",id:"text-after-".concat(this.uid)},this.textAfter)),this.info&&h("div",{id:"info-".concat(this.uid),class:"info"},this.info),h("div",{id:"error-".concat(this.uid),"aria-live":"assertive",class:"error-message","aria-atomic":"true"},this.renderErrorMessage()),h("div",{class:"sr-only","aria-live":"polite","aria-atomic":"true",ref:function(t){return e.liveRegionEl=t}},this.announcement))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["handleErrorMessage"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();Input.style=wmInputCss;export{Input as wm_input};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{l(n.next(t))}catch(t){o(t)}}function s(t){try{l(n["throw"](t))}catch(t){o(t)}}function l(t){t.done?i(t.value):r(t.value).then(a,s)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return l([t,e])}}function l(s){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(i=0)),i)try{if(n=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(s[0]===6&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}if(o[2])i.ops.pop();i.trys.pop();continue}s=e.call(t,i)}catch(t){s=[6,t];r=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-294d486f.js";import{d as debounce,A as transposeMatrix,u as csvToArray,B as wrapAround,C as getSmallestSkipInterval,D as calcPercentageInRange}from"./functions-abbff9c1.js";import{m as abbrNumber,n as getInterval}from"./chartFunctions-5f009626.js";import{l as lineChartMessages,c as chartMessages,g as globalMessages}from"./intl-7c8d2db9.js";var wmLineChartCss=':host{--wmcolor-linechart-currentposition:var(--wmcolor-lavender);--wmcolor-linechart-delta-text-negative:var(--wmcolor-text-negative);--wmcolor-linechart-delta-text-positive:var(--wmcolor-text-positive);--wmcolor-linechart-gridline:var(--wmcolor-chart-gridline);--wmcolor-linechart-highlight-background:var(--wmcolor-background-highlight);--wmcolor-linechart-popover-background:var(--wmcolor-chart-popover-background);display:block;height:500px;width:100%;font-size:14px;overflow-y:visible;overflow-x:auto}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:562px;width:100%;height:100%;outline:none}:host .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;position:relative;color:var(--iconColor);-webkit-transform:var(--translation, unset);transform:var(--translation, unset)}:host .icon:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:var(--icon);padding:0 3px;z-index:1}:host .icon:after{color:white;position:absolute;left:3px;-webkit-transform:scale(180%);transform:scale(180%);display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:var(--icon);z-index:0}:host .legend{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px 16px;margin-top:4px;margin-bottom:16px}:host .legend .legend-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:default;font-weight:600}:host .legend .legend-label.faded{opacity:0.3}:host .legend .legend-label .icon{margin-right:4px}:host .legend .visibility-toggle{margin-left:4px}:host .chart-wrapper{position:relative;-ms-flex-positive:1;flex-grow:1;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:1fr auto auto;margin-right:16px}:host .chart-label{font-size:14px;font-weight:600}:host .chart-label.--y-axis{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:var(--labelWidth);align-self:center;margin-right:16px;grid-area:1/1/2/2;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}:host .chart-label.--x-axis{margin-top:16px;text-align:center;grid-area:3/3/4/4}:host .y-intervals{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;grid-area:1/2/2/3;margin-right:4px}:host .y-intervals .y-interval{text-align:right}:host .x-intervals{display:grid;grid-template-columns:var(--columns);grid-area:2/3/3/4;line-height:1;margin-top:4px}:host .x-intervals .x-interval{text-align:center}:host .x-intervals .x-interval:first-child{text-align:left}:host .x-intervals .x-interval:last-child{text-align:right}:host .x-intervals .x-interval.hidden{visibility:hidden}:host .plot-area{position:relative;grid-area:1/3/2/4;background-image:linear-gradient(90deg, var(--wmcolor-linechart-gridline) 1px, transparent 1px);border-bottom:1px solid var(--wmcolor-linechart-gridline);background-size:var(--backgroundSize)}:host .plot-area.right-border{border-right:1px solid var(--wmcolor-linechart-gridline)}:host .line{position:absolute;width:100%;height:100%}:host .line .icon{position:absolute;-webkit-transform:var(--translation);transform:var(--translation);left:var(--xPosition);top:var(--yPosition);z-index:1}:host .line .icon:focus{z-index:2;outline:none}:host .line .icon:focus:before{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);border-radius:3px}:host .line .icon:focus:before::-moz-focus-inner{border:0}:host .line .line-svg{height:100%;width:100%}:host .line.faded{opacity:0.3}:host .line.focused{z-index:1}:host .line.hidden{visibility:hidden}:host .hover-area-wrapper{position:absolute;width:100%;height:100%;top:0;left:0;display:grid;grid-template-rows:1fr;grid-template-columns:var(--columns)}:host .hover-indicator{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;height:100%;width:2px;border:1px solid var(--wmcolor-linechart-currentposition);-webkit-transform:translateX(-50%);transform:translateX(-50%);left:var(--xPosition);grid-column:3/4;grid-row:1/2;pointer-events:none}:host .popover{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;background-color:var(--wmcolor-linechart-popover-background);position:absolute;top:var(--topPosition, 0);left:var(--leftPosition, unset);right:var(--rightPosition, unset);padding:16px;border-radius:5px;-webkit-box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);-webkit-transform:translateY(-50%);transform:translateY(-50%);line-height:1;z-index:3;grid-column:3/4;grid-row:1/2;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box}:host .popover .title{font-size:16px;font-weight:600}:host .popover .comparison-title{font-style:italic;margin-top:4px}:host .popover .unit{font-size:12px;font-weight:600}:host .popover .unit.--x{margin-left:4px}:host .popover .popover-table{margin-top:16px}:host .popover .popover-table .popover-row{line-height:1}:host .popover .popover-table .popover-row:not(:last-child) td{padding-bottom:8px}:host .popover .popover-table .popover-row .row-label{font-weight:600;padding-right:16px;overflow-wrap:anywhere}:host .popover .popover-table .popover-row .row-label .icon{margin-right:4px}:host .popover .popover-table .popover-row .row-value,:host .popover .popover-table .popover-row .delta{text-align:right;white-space:nowrap}:host .popover .popover-table .popover-row .delta{padding-left:12px;font-weight:600}:host .popover .popover-table .popover-row .delta.--positive{color:var(--wmcolor-linechart-delta-text-positive)}:host .popover .popover-table .popover-row .delta.--negative{color:var(--wmcolor-linechart-delta-text-negative)}:host .highlight{position:absolute;height:100%;background-color:color-mix(in srgb, var(--wmcolor-linechart-highlight-background) 60%, transparent);left:var(--startPercentage);right:var(--endPercentage)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var LineChart=function(){function t(t){var e=this;registerInstance(this,t);this.minTickWidth=120;this.popoverData=[];this.focusedDataPoint=[0,0];this.dataPointMatrix=[];this.xIntervals=[];this.displayedXIntervals=[];this.yIntervals=[];this.lineStyles=[{color:"#8b86ca",icon:"f536"},{color:"#2e1b46",icon:"f12f"},{color:"#0089e4",icon:"f763"},{color:"#088000",icon:"f4ce"},{color:"#ea8500",icon:"f70a"},{color:"#d54f41",icon:"f536"},{color:"#146ca9",icon:"f6ff"}];this.debouncedResize=debounce((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(t){this.displayedXIntervals=this.determineDisplayedXIntervals();return[2]}))}))}),100);this.label=undefined;this.description="";this.xAxisLabel=undefined;this.yAxisLabel=undefined;this.lineData=undefined;this.units="null,null";this.labelWidth="120px";this.highlightQualifier="highlighted";this.highlightStart=undefined;this.highlightEnd=undefined;this.visibilityToggles=false;this.showDeltas=false;this.yRange=undefined;this.parsedLineData={};this.displayedPopover=-1;this.focusedLine=-1;this.hiddenLines=[];this.isTabbing=false;this.intervalSkip=0;this.announcement=""}t.prototype.parseData=function(){var t=this;this.parsedLineData=JSON.parse(this.lineData);this.yIntervals=this.calcYIntervals().reverse();this.xIntervals=Object.keys(Object.values(this.parsedLineData)[0]);this.displayedXIntervals=this.determineDisplayedXIntervals();this.dataPointMatrix=Object.entries(this.parsedLineData).map((function(e){return t.buildLineDataPointDetails(e[0],e[1])}));this.popoverData=transposeMatrix(this.dataPointMatrix)};t.prototype.handleIntervalSkip=function(){this.parseData()};Object.defineProperty(t.prototype,"hasPartialInterval",{get:function(){return this.intervalSkip>0&&this.xIntervals.length%2===0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parsedUnits",{get:function(){return csvToArray(this.units).map((function(t){return t==="null"?null:t}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"visibilityToggleEls",{get:function(){return this.legendEl.querySelectorAll("wm-button")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lineEls",{get:function(){return this.plotAreaEl.querySelectorAll(".line")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstVisibleLineIdx",{get:function(){var t=0;while(this.hiddenLines.includes(t)){t++}return t<this.dataPointMatrix.length?t:-1},enumerable:false,configurable:true});t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.componentWillLoad=function(){this.parseData()};t.prototype.componentDidLoad=function(){var t=this;var e=new ResizeObserver((function(){return t.debouncedResize()}));e.observe(this.el)};t.prototype.handleVisibilityToggleKeydown=function(t,e){switch(t.key){case"Tab":if(!t.shiftKey&&this.firstVisibleLineIdx!==-1){t.preventDefault();this.announce(this.lineFocusMessage(this.firstVisibleLineIdx));this.focusDataPoint(this.firstVisibleLineIdx,0)}break;case"ArrowUp":case"ArrowLeft":t.preventDefault();var i=wrapAround(e,-1,this.dataPointMatrix.length-1);this.visibilityToggleEls[i].focus();break;case"ArrowDown":case"ArrowRight":t.preventDefault();var n=wrapAround(e,1,this.dataPointMatrix.length-1);this.visibilityToggleEls[n].focus();break}};t.prototype.handleDataPointKeydown=function(t){var e=this.focusedDataPoint,i=e[0],n=e[1];var r=this.lineEls[i].querySelectorAll(".point").length;var o=this.dataPointMatrix.length;switch(t.key){case"Tab":if(t.shiftKey&&this.visibilityToggles){t.preventDefault();this.visibilityToggleEls[0].focus()}break;case"ArrowUp":t.preventDefault();var a=i;do{a=wrapAround(a,-1,o-1)}while(this.hiddenLines.includes(a));this.announce(this.lineFocusMessage(a));this.focusDataPoint(a,n);break;case"ArrowDown":t.preventDefault();var s=i;do{s=wrapAround(s,1,o-1)}while(this.hiddenLines.includes(s));this.announce(this.lineFocusMessage(s));this.focusDataPoint(s,n);break;case"ArrowLeft":t.preventDefault();var l=wrapAround(n,-1,r-1);this.focusDataPoint(i,l);break;case"ArrowRight":t.preventDefault();var c=wrapAround(n,1,r-1);this.focusDataPoint(i,c);break}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.lineFocusMessage=function(t){var e=this.dataPointMatrix[t][0].lineLabel;var i=this.dataPointMatrix[t].filter((function(t){return t.yValue!==null})).length;return"".concat(e,", line ").concat(t+1," of ").concat(this.dataPointMatrix.length," with ").concat(i," data points")};t.prototype.focusDataPoint=function(t,e){var i=this.lineEls[t];var n=i.querySelectorAll(".point")[e];var r=this.plotAreaEl.querySelectorAll(".point");r.forEach((function(t){return t.tabIndex=-1}));n.tabIndex=0;n.focus();this.focusedDataPoint=[t,e]};t.prototype.focusDataPointByEl=function(t){var e=parseInt(t.dataset.lineidx);var i=Array.from(t.parentElement.querySelectorAll(".point")).indexOf(t);var n=this.plotAreaEl.querySelectorAll(".point");n.forEach((function(t){return t.tabIndex=-1}));t.tabIndex=0;t.focus();this.focusedDataPoint=[e,i]};t.prototype.calcYIntervals=function(){var t=[];if(this.yRange){t=csvToArray(this.yRange).map((function(t){return parseInt(t)}))}else{var e=[];var i=Object.values(this.parsedLineData).flat();i.forEach((function(t){return e.push.apply(e,Object.values(t))}));var n=e.filter((function(t){return t!==null}));var r=Math.min.apply(Math,n);var o=Math.max.apply(Math,n);var a=getInterval(o-r,4);var s=a;while(r%a!==0&&s>0){r--;s--}a=getInterval(o-r,4);var l=r;while(l<=o+a){t.push(l);l+=a}}return t};t.prototype.determineDisplayedXIntervals=function(){var t=this.plotAreaEl&&this.plotAreaEl.clientWidth>0?Math.round(this.plotAreaEl.clientWidth/this.minTickWidth):this.xIntervals.length;var e=getSmallestSkipInterval(this.xIntervals,t),i=e.skipInterval,n=e.skippedList;this.intervalSkip=i;return n};t.prototype.buildLineDataPointDetails=function(t,e){var i=this;var n=[];var r=Object.entries(e);var o;r.forEach((function(e,a){var s=e[0],l=e[1];var c=100/(r.length-1)*a;var h=l===null?null:100-calcPercentageInRange(l,i.yIntervals[i.yIntervals.length-1],i.yIntervals[0]);if(a===0){c+=i.plotAreaEl&&i.plotAreaEl.clientWidth>0?8/i.plotAreaEl.clientWidth*100:1}if(s===i.highlightStart&&!o){o=true}n.push({lineLabel:t,xValue:s,yValue:l,xPositionPercent:c,yPositionPercent:h,highlighted:o});if(s===i.highlightEnd&&o){o=false}}));return n};t.prototype.toggleLineVisibility=function(t){if(this.hiddenLines.includes(t)){this.hiddenLines=this.hiddenLines.filter((function(e){return e!==t}))}else{this.hiddenLines.push(t)}forceUpdate(this.el)};t.prototype.resetDataPointFocus=function(){this.displayedPopover=-1;var t=this.plotAreaEl.querySelectorAll(".point");t.forEach((function(t){return t.tabIndex=-1}));if(this.firstVisibleLineIdx!==-1){var e=this.lineEls[this.firstVisibleLineIdx];var i=e.querySelectorAll(".point")[0];i.tabIndex=0;this.focusedDataPoint=[this.firstVisibleLineIdx,0]}};t.prototype.calcDelta=function(t,e){var i;if(t.yValue===null||e.yValue===null){i=lineChartMessages.noData}else if(t.yValue==e.yValue){i="0%"}else if(e.yValue==0){i="-"}else{var n=(t.yValue-e.yValue)/e.yValue*100;var r=Math.round(n*100)/100;i="".concat(r>0?"+":"").concat(r,"%")}return i};t.prototype.renderLegend=function(){var t=this;var e=Object.keys(this.parsedLineData);return h("div",{ref:function(e){return t.legendEl=e},class:"legend"},e.map((function(e,i){var n=t.hiddenLines.includes(i);var r=t.focusedLine!==-1&&t.focusedLine!==i;return h("div",{id:"legend-label-".concat(i),class:"legend-label ".concat(r?"faded":""),onMouseEnter:function(){return t.focusedLine=n?-1:i},onMouseLeave:function(){return t.focusedLine=-1}},t.renderIcon(i),e,t.visibilityToggles&&t.renderVisibilityToggle(e,i,n))})))};t.prototype.renderVisibilityToggle=function(t,e,i){var n=this;return h("wm-button",{id:"visibility-button-".concat(e),class:"visibility-toggle","label-for-identical-buttons":"".concat(e===0?"Toggle line visibility list with ".concat(this.dataPointMatrix.length," items"):""," ").concat(i?globalMessages.show:globalMessages.hide," ").concat(t," toggle ").concat(i?"pressed":""),"button-type":"navigational",tooltip:i?globalMessages.show:globalMessages.hide,tooltipPosition:"bottom",icon:i?"f209":"f208",onClick:function(){return n.toggleLineVisibility(e)},onKeyDown:function(t){return n.handleVisibilityToggleKeydown(t,e)},onFocus:function(){return n.displayedPopover=-1}})};t.prototype.renderIcon=function(t){var e=this.lineStyles[t],i=e.color,n=e.icon;var r={"--iconColor":i,"--icon":'"\\'.concat(n,'"'),"--translation":t===5?"rotate(180deg)":"unset"};return h("span",{class:"icon",style:r})};t.prototype.renderXIntervals=function(){var t=this;var e={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"x-intervals",style:e},this.xIntervals.map((function(e){return h("span",{class:"x-interval ".concat(t.displayedXIntervals.includes(e)?"":"hidden")},e)})))};t.prototype.renderYIntervals=function(){var t=this;return h("div",{ref:function(e){return t.yIntervalsEl=e},class:"y-intervals"},this.yIntervals.map((function(t){return h("span",{class:"y-interval"},abbrNumber(t))})))};t.prototype.renderData=function(){var t=this;return this.dataPointMatrix.map((function(e,i){var n=t.focusedLine===i?"focused":"faded";var r=t.hiddenLines.includes(i);return h("div",{class:"line ".concat(t.focusedLine!==-1?n:""," ").concat(r?"hidden":"")},t.renderLines(i),t.renderPoints(i))}))};t.prototype.renderPoints=function(t){var e=this;var i=this.dataPointMatrix[t];return h("div",{class:"line-icons"},i.map((function(n,r){var o=n.lineLabel,a=n.xValue,s=n.yValue,l=n.xPositionPercent,c=n.yPositionPercent,p=n.highlighted;if(s!==null){var d=e.lineStyles[t],u=d.color,v=d.icon;var f=t===0&&r===0?0:undefined;var g={"--icon":'"\\'.concat(v,'"'),"--iconColor":u,"--xPosition":l+"%","--yPosition":c+"%","--translation":t===5?"translate(-50%, -50%) rotate(180deg)":"translate(-50%, -50%)"};var b="".concat(o," ").concat(p?e.highlightQualifier:""," ").concat(e.xAxisLabel," ").concat(a+(e.parsedUnits[0]?e.parsedUnits[0]:""),", ").concat(e.yAxisLabel,": ").concat(s+(e.parsedUnits[1]?e.parsedUnits[1]:""));if(e.showDeltas&&r>0){var x=i[r-1];var y=lineChartMessages.getChangeSince(x.xValue);b+=", ".concat(y," ").concat(e.calcDelta(n,x))}return h("span",{id:"".concat(o,"-").concat(r),role:"img","aria-label":b,tabIndex:f,class:"point icon",style:g,"data-lineidx":t,"data-xvalue":a,onKeyDown:function(t){return e.handleDataPointKeydown(t)},onFocus:function(){return e.displayedPopover=r},onClick:function(t){return e.focusDataPointByEl(t.target)},onMouseEnter:function(){return e.displayedPopover=r}})}})))};t.prototype.renderLines=function(t){var e=this;var i=this.dataPointMatrix[t];return h("svg",{class:"line-svg"},i.map((function(n,r){var o=n.yValue!==null&&r!==i.length-1&&i[r+1].yValue!==null;if(o){var a=e.lineStyles[t].color;var s=n.xPositionPercent,l=n.yPositionPercent;var c=i[r+1],p=c.xPositionPercent,d=c.yPositionPercent;return h("line",{x1:s+"%",y1:l+"%",x2:p+"%",y2:d+"%",stroke:a,"stroke-width":"2px"})}})))};t.prototype.renderHoverAreas=function(){var t=this;var e={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"hover-area-wrapper",style:e,onMouseLeave:function(){return t.displayedPopover=-1}},this.xIntervals.map((function(e,i){return h("div",{onMouseEnter:function(){return t.displayedPopover=i}})})))};t.prototype.renderPopover=function(){var t=this;var e=this.popoverData[this.displayedPopover];var i=e[0].xPositionPercent;var n=e.map((function(t){return t.yPositionPercent})).filter((function(t){return t!==null}));var r=n.reduce((function(t,e){return t+e}),0)/n.length;var o=this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.displayedPopover].xValue,'"]'));var a=this.el.getBoundingClientRect();var s=o.getBoundingClientRect();var l=a.right-s.right;var c=s.left-a.left;var p=l>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var d=c>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var u=8/this.plotAreaEl.clientWidth*100;var v={"--leftPosition":p?i+u+"%":"unset","--rightPosition":d?100-i+u+"%":"unset","--topPosition":r+"%",transform:"translateY(-50%)"};if(!d&&!p){var f="0px - ".concat(this.labelWidth," - 20px - ").concat(this.yIntervalsEl.clientWidth+"px"," + ").concat(this.el.scrollLeft+"px"," + 2px");v={"--leftPosition":"0%","--topPosition":"0%",maxWidth:Math.min(this.el.clientWidth-2,400)+"px",transform:"translateX(calc(".concat(f,"))")}}return h("div",{ref:function(e){return t.popoverEl=e},class:"popover",style:v},h("div",{class:"title"},e[0].xValue,this.parsedUnits[0]&&h("span",{class:"unit --x"},"(",this.parsedUnits[0],")")),this.showDeltas&&this.displayedPopover>0&&h("div",{class:"comparison-title"},lineChartMessages.getChangeSince(this.popoverData[this.displayedPopover-1][0].xValue)),this.renderPopoverTable())};t.prototype.renderPopoverTable=function(){var t=this;var e=this.popoverData[this.displayedPopover];return h("table",{class:"popover-table"},e.map((function(e,i){if(!t.hiddenLines.includes(i)){var n=e.lineLabel,r=e.yValue;var o=t.displayedPopover>0?t.popoverData[t.displayedPopover-1][i]:null;var a=r!==null?(new Intl.NumberFormat).format(r):null;return h("tr",{class:"popover-row"},h("td",null,t.renderIcon(i)),h("td",{class:"row-label"},n),h("td",{class:"row-value"},r===null?lineChartMessages.noData:a,r!==null&&t.parsedUnits[1]&&h("span",{class:"unit --y"},t.parsedUnits[1])),t.showDeltas&&o&&t.renderDeltas(e,o))}})))};t.prototype.renderDeltas=function(t,e){var i=this.calcDelta(t,e);var n=i.toString()[0]=="+"||i=="-"?"positive":i.toString()[0]=="-"?"negative":"";return e&&h("td",{class:"delta --".concat(n)},i)};t.prototype.renderHoverIndicator=function(){var t=this.dataPointMatrix[0][this.displayedPopover].xPositionPercent;var e={"--xPosition":t+"%"};return h("div",{class:"hover-indicator",style:e})};t.prototype.renderHighlight=function(){var t=this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightStart)].xPositionPercent;var e=this.highlightEnd?100-this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightEnd)].xPositionPercent:0;var i={"--startPercentage":t+"%","--endPercentage":e+"%"};return h("div",{class:"highlight",style:i})};t.prototype.render=function(){var t=this;return h(Host,{onBlur:function(){return t.resetDataPointFocus()},onMouseLeave:function(){return t.displayedPopover=-1}},h("div",{class:"component-wrapper",role:"application","aria-roledescription":chartMessages.interactiveChart,"aria-label":this.label,"aria-describedby":"chart-description"},this.renderLegend(),h("div",{class:"chart-wrapper"},h("div",{class:"chart-label --y-axis",style:{"--labelWidth":this.labelWidth}},this.yAxisLabel,this.parsedUnits[1]&&" (".concat(this.parsedUnits[1],")")),this.renderYIntervals(),h("div",{ref:function(e){return t.plotAreaEl=e},class:"plot-area ".concat(this.hasPartialInterval?"":"right-border"),style:{"--backgroundSize":"".concat(this.dataPointMatrix[0][this.xIntervals.indexOf(this.displayedXIntervals[1])].xPositionPercent,"%")}},this.highlightStart&&this.renderHighlight(),this.renderData(),this.renderHoverAreas()),this.displayedPopover!==-1&&this.renderHoverIndicator(),this.displayedPopover!==-1&&this.renderPopover(),this.renderXIntervals(),h("div",{class:"chart-label --x-axis"},this.xAxisLabel,this.parsedUnits[0]&&" (".concat(this.parsedUnits[0],")"))),h("div",{id:"chart-description",class:"sr-only"},"".concat(lineChartMessages.instructions," ").concat(this.description)),h("div",{ref:function(e){return t.liveRegionEl=e},"aria-live":"polite",class:"sr-only"},this.announcement)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{lineData:["parseData"],intervalSkip:["handleIntervalSkip"]}},enumerable:false,configurable:true});return t}();LineChart.style=wmLineChartCss;export{LineChart as wm_line_chart};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{l(n.next(t))}catch(t){o(t)}}function s(t){try{l(n["throw"](t))}catch(t){o(t)}}function l(t){t.done?i(t.value):r(t.value).then(a,s)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return l([t,e])}}function l(s){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(i=0)),i)try{if(n=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(s[0]===6&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}if(o[2])i.ops.pop();i.trys.pop();continue}s=e.call(t,i)}catch(t){s=[6,t];r=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-294d486f.js";import{d as debounce,A as transposeMatrix,u as csvToArray,B as wrapAround,C as getSmallestSkipInterval,D as calcPercentageInRange}from"./functions-e8b2c205.js";import{m as abbrNumber,n as getInterval}from"./chartFunctions-1396e181.js";import{l as lineChartMessages,c as chartMessages,g as globalMessages}from"./intl-3b652186.js";var wmLineChartCss=':host{--wmcolor-linechart-currentposition:var(--wmcolor-lavender);--wmcolor-linechart-delta-text-negative:var(--wmcolor-text-negative);--wmcolor-linechart-delta-text-positive:var(--wmcolor-text-positive);--wmcolor-linechart-gridline:var(--wmcolor-chart-gridline);--wmcolor-linechart-highlight-background:var(--wmcolor-background-highlight);--wmcolor-linechart-popover-background:var(--wmcolor-chart-popover-background);display:block;height:500px;width:100%;font-size:14px;overflow-y:visible;overflow-x:auto}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:562px;width:100%;height:100%;outline:none}:host .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;position:relative;color:var(--iconColor);-webkit-transform:var(--translation, unset);transform:var(--translation, unset)}:host .icon:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:var(--icon);padding:0 3px;z-index:1}:host .icon:after{color:white;position:absolute;left:3px;-webkit-transform:scale(180%);transform:scale(180%);display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:var(--icon);z-index:0}:host .legend{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px 16px;margin-top:4px;margin-bottom:16px}:host .legend .legend-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:default;font-weight:600}:host .legend .legend-label.faded{opacity:0.3}:host .legend .legend-label .icon{margin-right:4px}:host .legend .visibility-toggle{margin-left:4px}:host .chart-wrapper{position:relative;-ms-flex-positive:1;flex-grow:1;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:1fr auto auto;margin-right:16px}:host .chart-label{font-size:14px;font-weight:600}:host .chart-label.--y-axis{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:var(--labelWidth);align-self:center;margin-right:16px;grid-area:1/1/2/2;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}:host .chart-label.--x-axis{margin-top:16px;text-align:center;grid-area:3/3/4/4}:host .y-intervals{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;grid-area:1/2/2/3;margin-right:4px}:host .y-intervals .y-interval{text-align:right}:host .x-intervals{display:grid;grid-template-columns:var(--columns);grid-area:2/3/3/4;line-height:1;margin-top:4px}:host .x-intervals .x-interval{text-align:center}:host .x-intervals .x-interval:first-child{text-align:left}:host .x-intervals .x-interval:last-child{text-align:right}:host .x-intervals .x-interval.hidden{visibility:hidden}:host .plot-area{position:relative;grid-area:1/3/2/4;background-image:linear-gradient(90deg, var(--wmcolor-linechart-gridline) 1px, transparent 1px);border-bottom:1px solid var(--wmcolor-linechart-gridline);background-size:var(--backgroundSize)}:host .plot-area.right-border{border-right:1px solid var(--wmcolor-linechart-gridline)}:host .line{position:absolute;width:100%;height:100%}:host .line .icon{position:absolute;-webkit-transform:var(--translation);transform:var(--translation);left:var(--xPosition);top:var(--yPosition);z-index:1}:host .line .icon:focus{z-index:2;outline:none}:host .line .icon:focus:before{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px var(--wmcolor-interactive-focus);border-radius:3px}:host .line .icon:focus:before::-moz-focus-inner{border:0}:host .line .line-svg{height:100%;width:100%}:host .line.faded{opacity:0.3}:host .line.focused{z-index:1}:host .line.hidden{visibility:hidden}:host .hover-area-wrapper{position:absolute;width:100%;height:100%;top:0;left:0;display:grid;grid-template-rows:1fr;grid-template-columns:var(--columns)}:host .hover-indicator{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;height:100%;width:2px;border:1px solid var(--wmcolor-linechart-currentposition);-webkit-transform:translateX(-50%);transform:translateX(-50%);left:var(--xPosition);grid-column:3/4;grid-row:1/2;pointer-events:none}:host .popover{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;background-color:var(--wmcolor-linechart-popover-background);position:absolute;top:var(--topPosition, 0);left:var(--leftPosition, unset);right:var(--rightPosition, unset);padding:16px;border-radius:5px;-webkit-box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);-webkit-transform:translateY(-50%);transform:translateY(-50%);line-height:1;z-index:3;grid-column:3/4;grid-row:1/2;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box}:host .popover .title{font-size:16px;font-weight:600}:host .popover .comparison-title{font-style:italic;margin-top:4px}:host .popover .unit{font-size:12px;font-weight:600}:host .popover .unit.--x{margin-left:4px}:host .popover .popover-table{margin-top:16px}:host .popover .popover-table .popover-row{line-height:1}:host .popover .popover-table .popover-row:not(:last-child) td{padding-bottom:8px}:host .popover .popover-table .popover-row .row-label{font-weight:600;padding-right:16px;overflow-wrap:anywhere}:host .popover .popover-table .popover-row .row-label .icon{margin-right:4px}:host .popover .popover-table .popover-row .row-value,:host .popover .popover-table .popover-row .delta{text-align:right;white-space:nowrap}:host .popover .popover-table .popover-row .delta{padding-left:12px;font-weight:600}:host .popover .popover-table .popover-row .delta.--positive{color:var(--wmcolor-linechart-delta-text-positive)}:host .popover .popover-table .popover-row .delta.--negative{color:var(--wmcolor-linechart-delta-text-negative)}:host .highlight{position:absolute;height:100%;background-color:color-mix(in srgb, var(--wmcolor-linechart-highlight-background) 60%, transparent);left:var(--startPercentage);right:var(--endPercentage)}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}';var LineChart=function(){function t(t){var e=this;registerInstance(this,t);this.minTickWidth=120;this.popoverData=[];this.focusedDataPoint=[0,0];this.dataPointMatrix=[];this.xIntervals=[];this.displayedXIntervals=[];this.yIntervals=[];this.lineStyles=[{color:"#8b86ca",icon:"f536"},{color:"#2e1b46",icon:"f12f"},{color:"#0089e4",icon:"f763"},{color:"#088000",icon:"f4ce"},{color:"#ea8500",icon:"f70a"},{color:"#d54f41",icon:"f536"},{color:"#146ca9",icon:"f6ff"}];this.debouncedResize=debounce((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(t){this.displayedXIntervals=this.determineDisplayedXIntervals();return[2]}))}))}),100);this.label=undefined;this.description="";this.xAxisLabel=undefined;this.yAxisLabel=undefined;this.lineData=undefined;this.units="null,null";this.labelWidth="120px";this.highlightQualifier="highlighted";this.highlightStart=undefined;this.highlightEnd=undefined;this.visibilityToggles=false;this.showDeltas=false;this.yRange=undefined;this.parsedLineData={};this.displayedPopover=-1;this.focusedLine=-1;this.hiddenLines=[];this.isTabbing=false;this.intervalSkip=0;this.announcement=""}t.prototype.parseData=function(){var t=this;this.parsedLineData=JSON.parse(this.lineData);this.yIntervals=this.calcYIntervals().reverse();this.xIntervals=Object.keys(Object.values(this.parsedLineData)[0]);this.displayedXIntervals=this.determineDisplayedXIntervals();this.dataPointMatrix=Object.entries(this.parsedLineData).map((function(e){return t.buildLineDataPointDetails(e[0],e[1])}));this.popoverData=transposeMatrix(this.dataPointMatrix)};t.prototype.handleIntervalSkip=function(){this.parseData()};Object.defineProperty(t.prototype,"hasPartialInterval",{get:function(){return this.intervalSkip>0&&this.xIntervals.length%2===0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parsedUnits",{get:function(){return csvToArray(this.units).map((function(t){return t==="null"?null:t}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"visibilityToggleEls",{get:function(){return this.legendEl.querySelectorAll("wm-button")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lineEls",{get:function(){return this.plotAreaEl.querySelectorAll(".line")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstVisibleLineIdx",{get:function(){var t=0;while(this.hiddenLines.includes(t)){t++}return t<this.dataPointMatrix.length?t:-1},enumerable:false,configurable:true});t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.componentWillLoad=function(){this.parseData()};t.prototype.componentDidLoad=function(){var t=this;var e=new ResizeObserver((function(){return t.debouncedResize()}));e.observe(this.el)};t.prototype.handleVisibilityToggleKeydown=function(t,e){switch(t.key){case"Tab":if(!t.shiftKey&&this.firstVisibleLineIdx!==-1){t.preventDefault();this.announce(this.lineFocusMessage(this.firstVisibleLineIdx));this.focusDataPoint(this.firstVisibleLineIdx,0)}break;case"ArrowUp":case"ArrowLeft":t.preventDefault();var i=wrapAround(e,-1,this.dataPointMatrix.length-1);this.visibilityToggleEls[i].focus();break;case"ArrowDown":case"ArrowRight":t.preventDefault();var n=wrapAround(e,1,this.dataPointMatrix.length-1);this.visibilityToggleEls[n].focus();break}};t.prototype.handleDataPointKeydown=function(t){var e=this.focusedDataPoint,i=e[0],n=e[1];var r=this.lineEls[i].querySelectorAll(".point").length;var o=this.dataPointMatrix.length;switch(t.key){case"Tab":if(t.shiftKey&&this.visibilityToggles){t.preventDefault();this.visibilityToggleEls[0].focus()}break;case"ArrowUp":t.preventDefault();var a=i;do{a=wrapAround(a,-1,o-1)}while(this.hiddenLines.includes(a));this.announce(this.lineFocusMessage(a));this.focusDataPoint(a,n);break;case"ArrowDown":t.preventDefault();var s=i;do{s=wrapAround(s,1,o-1)}while(this.hiddenLines.includes(s));this.announce(this.lineFocusMessage(s));this.focusDataPoint(s,n);break;case"ArrowLeft":t.preventDefault();var l=wrapAround(n,-1,r-1);this.focusDataPoint(i,l);break;case"ArrowRight":t.preventDefault();var c=wrapAround(n,1,r-1);this.focusDataPoint(i,c);break}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.lineFocusMessage=function(t){var e=this.dataPointMatrix[t][0].lineLabel;var i=this.dataPointMatrix[t].filter((function(t){return t.yValue!==null})).length;return"".concat(e,", line ").concat(t+1," of ").concat(this.dataPointMatrix.length," with ").concat(i," data points")};t.prototype.focusDataPoint=function(t,e){var i=this.lineEls[t];var n=i.querySelectorAll(".point")[e];var r=this.plotAreaEl.querySelectorAll(".point");r.forEach((function(t){return t.tabIndex=-1}));n.tabIndex=0;n.focus();this.focusedDataPoint=[t,e]};t.prototype.focusDataPointByEl=function(t){var e=parseInt(t.dataset.lineidx);var i=Array.from(t.parentElement.querySelectorAll(".point")).indexOf(t);var n=this.plotAreaEl.querySelectorAll(".point");n.forEach((function(t){return t.tabIndex=-1}));t.tabIndex=0;t.focus();this.focusedDataPoint=[e,i]};t.prototype.calcYIntervals=function(){var t=[];if(this.yRange){t=csvToArray(this.yRange).map((function(t){return parseInt(t)}))}else{var e=[];var i=Object.values(this.parsedLineData).flat();i.forEach((function(t){return e.push.apply(e,Object.values(t))}));var n=e.filter((function(t){return t!==null}));var r=Math.min.apply(Math,n);var o=Math.max.apply(Math,n);var a=getInterval(o-r,4);var s=a;while(r%a!==0&&s>0){r--;s--}a=getInterval(o-r,4);var l=r;while(l<=o+a){t.push(l);l+=a}}return t};t.prototype.determineDisplayedXIntervals=function(){var t=this.plotAreaEl&&this.plotAreaEl.clientWidth>0?Math.round(this.plotAreaEl.clientWidth/this.minTickWidth):this.xIntervals.length;var e=getSmallestSkipInterval(this.xIntervals,t),i=e.skipInterval,n=e.skippedList;this.intervalSkip=i;return n};t.prototype.buildLineDataPointDetails=function(t,e){var i=this;var n=[];var r=Object.entries(e);var o;r.forEach((function(e,a){var s=e[0],l=e[1];var c=100/(r.length-1)*a;var h=l===null?null:100-calcPercentageInRange(l,i.yIntervals[i.yIntervals.length-1],i.yIntervals[0]);if(a===0){c+=i.plotAreaEl&&i.plotAreaEl.clientWidth>0?8/i.plotAreaEl.clientWidth*100:1}if(s===i.highlightStart&&!o){o=true}n.push({lineLabel:t,xValue:s,yValue:l,xPositionPercent:c,yPositionPercent:h,highlighted:o});if(s===i.highlightEnd&&o){o=false}}));return n};t.prototype.toggleLineVisibility=function(t){if(this.hiddenLines.includes(t)){this.hiddenLines=this.hiddenLines.filter((function(e){return e!==t}))}else{this.hiddenLines.push(t)}forceUpdate(this.el)};t.prototype.resetDataPointFocus=function(){this.displayedPopover=-1;var t=this.plotAreaEl.querySelectorAll(".point");t.forEach((function(t){return t.tabIndex=-1}));if(this.firstVisibleLineIdx!==-1){var e=this.lineEls[this.firstVisibleLineIdx];var i=e.querySelectorAll(".point")[0];i.tabIndex=0;this.focusedDataPoint=[this.firstVisibleLineIdx,0]}};t.prototype.calcDelta=function(t,e){var i;if(t.yValue===null||e.yValue===null){i=lineChartMessages.noData}else if(t.yValue==e.yValue){i="0%"}else if(e.yValue==0){i="-"}else{var n=(t.yValue-e.yValue)/e.yValue*100;var r=Math.round(n*100)/100;i="".concat(r>0?"+":"").concat(r,"%")}return i};t.prototype.renderLegend=function(){var t=this;var e=Object.keys(this.parsedLineData);return h("div",{ref:function(e){return t.legendEl=e},class:"legend"},e.map((function(e,i){var n=t.hiddenLines.includes(i);var r=t.focusedLine!==-1&&t.focusedLine!==i;return h("div",{id:"legend-label-".concat(i),class:"legend-label ".concat(r?"faded":""),onMouseEnter:function(){return t.focusedLine=n?-1:i},onMouseLeave:function(){return t.focusedLine=-1}},t.renderIcon(i),e,t.visibilityToggles&&t.renderVisibilityToggle(e,i,n))})))};t.prototype.renderVisibilityToggle=function(t,e,i){var n=this;return h("wm-button",{id:"visibility-button-".concat(e),class:"visibility-toggle","label-for-identical-buttons":"".concat(e===0?"Toggle line visibility list with ".concat(this.dataPointMatrix.length," items"):""," ").concat(i?globalMessages.show:globalMessages.hide," ").concat(t," toggle ").concat(i?"pressed":""),"button-type":"navigational",tooltip:i?globalMessages.show:globalMessages.hide,tooltipPosition:"bottom",icon:i?"f209":"f208",onClick:function(){return n.toggleLineVisibility(e)},onKeyDown:function(t){return n.handleVisibilityToggleKeydown(t,e)},onFocus:function(){return n.displayedPopover=-1}})};t.prototype.renderIcon=function(t){var e=this.lineStyles[t],i=e.color,n=e.icon;var r={"--iconColor":i,"--icon":'"\\'.concat(n,'"'),"--translation":t===5?"rotate(180deg)":"unset"};return h("span",{class:"icon",style:r})};t.prototype.renderXIntervals=function(){var t=this;var e={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"x-intervals",style:e},this.xIntervals.map((function(e){return h("span",{class:"x-interval ".concat(t.displayedXIntervals.includes(e)?"":"hidden")},e)})))};t.prototype.renderYIntervals=function(){var t=this;return h("div",{ref:function(e){return t.yIntervalsEl=e},class:"y-intervals"},this.yIntervals.map((function(t){return h("span",{class:"y-interval"},abbrNumber(t))})))};t.prototype.renderData=function(){var t=this;return this.dataPointMatrix.map((function(e,i){var n=t.focusedLine===i?"focused":"faded";var r=t.hiddenLines.includes(i);return h("div",{class:"line ".concat(t.focusedLine!==-1?n:""," ").concat(r?"hidden":"")},t.renderLines(i),t.renderPoints(i))}))};t.prototype.renderPoints=function(t){var e=this;var i=this.dataPointMatrix[t];return h("div",{class:"line-icons"},i.map((function(n,r){var o=n.lineLabel,a=n.xValue,s=n.yValue,l=n.xPositionPercent,c=n.yPositionPercent,p=n.highlighted;if(s!==null){var d=e.lineStyles[t],u=d.color,v=d.icon;var f=t===0&&r===0?0:undefined;var g={"--icon":'"\\'.concat(v,'"'),"--iconColor":u,"--xPosition":l+"%","--yPosition":c+"%","--translation":t===5?"translate(-50%, -50%) rotate(180deg)":"translate(-50%, -50%)"};var b="".concat(o," ").concat(p?e.highlightQualifier:""," ").concat(e.xAxisLabel," ").concat(a+(e.parsedUnits[0]?e.parsedUnits[0]:""),", ").concat(e.yAxisLabel,": ").concat(s+(e.parsedUnits[1]?e.parsedUnits[1]:""));if(e.showDeltas&&r>0){var x=i[r-1];var y=lineChartMessages.getChangeSince(x.xValue);b+=", ".concat(y," ").concat(e.calcDelta(n,x))}return h("span",{id:"".concat(o,"-").concat(r),role:"img","aria-label":b,tabIndex:f,class:"point icon",style:g,"data-lineidx":t,"data-xvalue":a,onKeyDown:function(t){return e.handleDataPointKeydown(t)},onFocus:function(){return e.displayedPopover=r},onClick:function(t){return e.focusDataPointByEl(t.target)},onMouseEnter:function(){return e.displayedPopover=r}})}})))};t.prototype.renderLines=function(t){var e=this;var i=this.dataPointMatrix[t];return h("svg",{class:"line-svg"},i.map((function(n,r){var o=n.yValue!==null&&r!==i.length-1&&i[r+1].yValue!==null;if(o){var a=e.lineStyles[t].color;var s=n.xPositionPercent,l=n.yPositionPercent;var c=i[r+1],p=c.xPositionPercent,d=c.yPositionPercent;return h("line",{x1:s+"%",y1:l+"%",x2:p+"%",y2:d+"%",stroke:a,"stroke-width":"2px"})}})))};t.prototype.renderHoverAreas=function(){var t=this;var e={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"hover-area-wrapper",style:e,onMouseLeave:function(){return t.displayedPopover=-1}},this.xIntervals.map((function(e,i){return h("div",{onMouseEnter:function(){return t.displayedPopover=i}})})))};t.prototype.renderPopover=function(){var t=this;var e=this.popoverData[this.displayedPopover];var i=e[0].xPositionPercent;var n=e.map((function(t){return t.yPositionPercent})).filter((function(t){return t!==null}));var r=n.reduce((function(t,e){return t+e}),0)/n.length;var o=this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.displayedPopover].xValue,'"]'));var a=this.el.getBoundingClientRect();var s=o.getBoundingClientRect();var l=a.right-s.right;var c=s.left-a.left;var p=l>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var d=c>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var u=8/this.plotAreaEl.clientWidth*100;var v={"--leftPosition":p?i+u+"%":"unset","--rightPosition":d?100-i+u+"%":"unset","--topPosition":r+"%",transform:"translateY(-50%)"};if(!d&&!p){var f="0px - ".concat(this.labelWidth," - 20px - ").concat(this.yIntervalsEl.clientWidth+"px"," + ").concat(this.el.scrollLeft+"px"," + 2px");v={"--leftPosition":"0%","--topPosition":"0%",maxWidth:Math.min(this.el.clientWidth-2,400)+"px",transform:"translateX(calc(".concat(f,"))")}}return h("div",{ref:function(e){return t.popoverEl=e},class:"popover",style:v},h("div",{class:"title"},e[0].xValue,this.parsedUnits[0]&&h("span",{class:"unit --x"},"(",this.parsedUnits[0],")")),this.showDeltas&&this.displayedPopover>0&&h("div",{class:"comparison-title"},lineChartMessages.getChangeSince(this.popoverData[this.displayedPopover-1][0].xValue)),this.renderPopoverTable())};t.prototype.renderPopoverTable=function(){var t=this;var e=this.popoverData[this.displayedPopover];return h("table",{class:"popover-table"},e.map((function(e,i){if(!t.hiddenLines.includes(i)){var n=e.lineLabel,r=e.yValue;var o=t.displayedPopover>0?t.popoverData[t.displayedPopover-1][i]:null;var a=r!==null?(new Intl.NumberFormat).format(r):null;return h("tr",{class:"popover-row"},h("td",null,t.renderIcon(i)),h("td",{class:"row-label"},n),h("td",{class:"row-value"},r===null?lineChartMessages.noData:a,r!==null&&t.parsedUnits[1]&&h("span",{class:"unit --y"},t.parsedUnits[1])),t.showDeltas&&o&&t.renderDeltas(e,o))}})))};t.prototype.renderDeltas=function(t,e){var i=this.calcDelta(t,e);var n=i.toString()[0]=="+"||i=="-"?"positive":i.toString()[0]=="-"?"negative":"";return e&&h("td",{class:"delta --".concat(n)},i)};t.prototype.renderHoverIndicator=function(){var t=this.dataPointMatrix[0][this.displayedPopover].xPositionPercent;var e={"--xPosition":t+"%"};return h("div",{class:"hover-indicator",style:e})};t.prototype.renderHighlight=function(){var t=this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightStart)].xPositionPercent;var e=this.highlightEnd?100-this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightEnd)].xPositionPercent:0;var i={"--startPercentage":t+"%","--endPercentage":e+"%"};return h("div",{class:"highlight",style:i})};t.prototype.render=function(){var t=this;return h(Host,{onBlur:function(){return t.resetDataPointFocus()},onMouseLeave:function(){return t.displayedPopover=-1}},h("div",{class:"component-wrapper",role:"application","aria-roledescription":chartMessages.interactiveChart,"aria-label":this.label,"aria-describedby":"chart-description"},this.renderLegend(),h("div",{class:"chart-wrapper"},h("div",{class:"chart-label --y-axis",style:{"--labelWidth":this.labelWidth}},this.yAxisLabel,this.parsedUnits[1]&&" (".concat(this.parsedUnits[1],")")),this.renderYIntervals(),h("div",{ref:function(e){return t.plotAreaEl=e},class:"plot-area ".concat(this.hasPartialInterval?"":"right-border"),style:{"--backgroundSize":"".concat(this.dataPointMatrix[0][this.xIntervals.indexOf(this.displayedXIntervals[1])].xPositionPercent,"%")}},this.highlightStart&&this.renderHighlight(),this.renderData(),this.renderHoverAreas()),this.displayedPopover!==-1&&this.renderHoverIndicator(),this.displayedPopover!==-1&&this.renderPopover(),this.renderXIntervals(),h("div",{class:"chart-label --x-axis"},this.xAxisLabel,this.parsedUnits[0]&&" (".concat(this.parsedUnits[0],")"))),h("div",{id:"chart-description",class:"sr-only"},"".concat(lineChartMessages.instructions," ").concat(this.description)),h("div",{ref:function(e){return t.liveRegionEl=e},"aria-live":"polite",class:"sr-only"},this.announcement)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{lineData:["parseData"],intervalSkip:["handleIntervalSkip"]}},enumerable:false,configurable:true});return t}();LineChart.style=wmLineChartCss;export{LineChart as wm_line_chart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,H as Host,g as getElement}from"./index-294d486f.js";import{g as globalMessages}from"./intl-
|
|
1
|
+
import{r as registerInstance,h,H as Host,g as getElement}from"./index-294d486f.js";import{g as globalMessages}from"./intl-3b652186.js";import"./functions-e8b2c205.js";var wmModalHeaderCss="wm-modal-header{-webkit-border-radius:5px 5px 0 0px;-moz-border-radius:5px 5px 0 0px;-ms-border-radius:5px 5px 0 0px;border-radius:5px 5px 0 0px;margin-bottom:-1px}wm-modal-header .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}wm-modal-header .wm-wrapper .title{margin:0;font-weight:600;font-size:1.125rem;color:var(--wmcolor-modal-heading);line-height:normal}wm-modal-header .wm-wrapper .title .subtitle{display:block;font-size:0.875rem;font-weight:normal}wm-modal-header .wm-wrapper .title:focus{outline:none}";var ModalHeader=function(){function e(e){registerInstance(this,e);this.heading="";this.subheading=""}e.prototype.componentWillLoad=function(){var e=this;this.uid=this.el.parentElement.uid;this.el.parentElement.addEventListener("focusFirstElement",(function(){e.closeButtonEl.focus()}))};e.prototype.emitParentCloseEvent=function(){var e=this.el.parentElement;e.emitCloseEvent()};e.prototype.render=function(){var e=this;return h(Host,null,h("div",{class:"wm-wrapper"},h("div",null,h("h2",{class:"title",id:"wm-modal-heading-text-".concat(this.uid)},this.heading,h("span",{class:"subtitle"},this.subheading))),h("wm-button",{"button-type":"navigational",icon:"f156",tooltip:globalMessages.close,"tooltip-position":"left",id:"wm-modal-close-".concat(this.uid),ref:function(t){return e.closeButtonEl=t},onClick:function(){return e.emitParentCloseEvent()}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalHeader.style=wmModalHeaderCss;export{ModalHeader as wm_modal_header};
|