@nyaruka/temba-components 0.17.0 → 0.18.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/a525ddb7.js +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/sw.js +1 -1
  5. package/dist/sw.js.map +1 -1
  6. package/dist/templates/components-body.html +1 -1
  7. package/dist/templates/components-head.html +1 -1
  8. package/out-tsc/src/button/Button.js +1 -0
  9. package/out-tsc/src/button/Button.js.map +1 -1
  10. package/out-tsc/src/contacts/ContactChat.js +81 -33
  11. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  12. package/out-tsc/src/contacts/ContactDetails.js +22 -22
  13. package/out-tsc/src/contacts/ContactDetails.js.map +1 -1
  14. package/out-tsc/src/contacts/ContactHistory.js +131 -138
  15. package/out-tsc/src/contacts/ContactHistory.js.map +1 -1
  16. package/out-tsc/src/contacts/events.js +55 -44
  17. package/out-tsc/src/contacts/events.js.map +1 -1
  18. package/out-tsc/src/interfaces.js.map +1 -1
  19. package/out-tsc/src/list/ContactList.js +1 -1
  20. package/out-tsc/src/list/ContactList.js.map +1 -1
  21. package/out-tsc/src/list/TembaList.js +10 -3
  22. package/out-tsc/src/list/TembaList.js.map +1 -1
  23. package/out-tsc/src/list/TembaMenu.js +7 -2
  24. package/out-tsc/src/list/TembaMenu.js.map +1 -1
  25. package/out-tsc/src/loading/Loading.js +9 -1
  26. package/out-tsc/src/loading/Loading.js.map +1 -1
  27. package/out-tsc/src/options/Options.js +14 -2
  28. package/out-tsc/src/options/Options.js.map +1 -1
  29. package/out-tsc/src/tip/Tip.js +6 -0
  30. package/out-tsc/src/tip/Tip.js.map +1 -1
  31. package/out-tsc/src/vectoricon/VectorIcon.js +17 -5
  32. package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
  33. package/out-tsc/test/temba-contact-history.test.js +2 -2
  34. package/out-tsc/test/temba-contact-history.test.js.map +1 -1
  35. package/package.json +1 -1
  36. package/screenshots/truth/contacts/history-expanded.png +0 -0
  37. package/screenshots/truth/contacts/history.png +0 -0
  38. package/screenshots/truth/list/items-selected.png +0 -0
  39. package/screenshots/truth/list/items-updated.png +0 -0
  40. package/screenshots/truth/list/items.png +0 -0
  41. package/screenshots/truth/modax/simple.png +0 -0
  42. package/screenshots/truth/options/block.png +0 -0
  43. package/screenshots/truth/select/disabled-multi-selection.png +0 -0
  44. package/screenshots/truth/select/disabled-selection.png +0 -0
  45. package/screenshots/truth/select/disabled.png +0 -0
  46. package/screenshots/truth/select/embedded.png +0 -0
  47. package/screenshots/truth/select/expression-selected.png +0 -0
  48. package/screenshots/truth/select/expressions.png +0 -0
  49. package/screenshots/truth/select/functions.png +0 -0
  50. package/screenshots/truth/select/local-options.png +0 -0
  51. package/screenshots/truth/select/remote-options.png +0 -0
  52. package/screenshots/truth/select/search-enabled.png +0 -0
  53. package/screenshots/truth/select/search-multi-no-matches.png +0 -0
  54. package/screenshots/truth/select/search-selected-focus.png +0 -0
  55. package/screenshots/truth/select/search-selected.png +0 -0
  56. package/screenshots/truth/select/search-with-selected.png +0 -0
  57. package/screenshots/truth/select/searching.png +0 -0
  58. package/screenshots/truth/select/selected-multi.png +0 -0
  59. package/screenshots/truth/select/selected-single.png +0 -0
  60. package/screenshots/truth/select/with-placeholder.png +0 -0
  61. package/screenshots/truth/select/without-placeholder.png +0 -0
  62. package/screenshots/truth/textinput/date-form.png +0 -0
  63. package/screenshots/truth/textinput/input-disabled.png +0 -0
  64. package/screenshots/truth/textinput/input-form.png +0 -0
  65. package/screenshots/truth/textinput/input-placeholder.png +0 -0
  66. package/screenshots/truth/textinput/input-updated.png +0 -0
  67. package/screenshots/truth/textinput/input.png +0 -0
  68. package/screenshots/truth/textinput/textarea.png +0 -0
  69. package/screenshots/truth/tip/bottom.png +0 -0
  70. package/screenshots/truth/tip/left.png +0 -0
  71. package/screenshots/truth/tip/right.png +0 -0
  72. package/screenshots/truth/tip/top.png +0 -0
  73. package/src/button/Button.ts +1 -0
  74. package/src/contacts/ContactChat.ts +93 -33
  75. package/src/contacts/ContactDetails.ts +23 -23
  76. package/src/contacts/ContactHistory.ts +156 -159
  77. package/src/contacts/events.ts +59 -44
  78. package/src/interfaces.ts +1 -1
  79. package/src/list/ContactList.ts +1 -1
  80. package/src/list/TembaList.ts +13 -4
  81. package/src/list/TembaMenu.ts +7 -2
  82. package/src/loading/Loading.ts +8 -1
  83. package/src/options/Options.ts +14 -2
  84. package/src/tip/Tip.ts +6 -0
  85. package/src/vectoricon/VectorIcon.ts +17 -5
  86. package/test/temba-contact-history.test.ts +2 -2
  87. package/test-assets/style.css +4 -1
  88. package/dist/d59a9ae2.js +0 -1
@@ -48,11 +48,22 @@ export class Options extends RapidElement {
48
48
 
49
49
  :host([block]) .options-container {
50
50
  border: none;
51
- box-shadow: var(--options-block-shadow);
52
51
  height: 100%;
53
52
  z-index: 9000;
54
53
  visibility: visible;
55
54
  overflow-y: auto;
55
+ -webkit-mask-image: -webkit-radial-gradient(white, black);
56
+ }
57
+
58
+ :host([block]) {
59
+ box-shadow: var(--options-block-shadow);
60
+ border-radius: var(--curvature);
61
+ display: block;
62
+ height: 100%;
63
+ }
64
+
65
+ :host([block]) .options {
66
+ margin-bottom: 1.5em;
56
67
  }
57
68
 
58
69
  :host([collapsed]) temba-icon {
@@ -86,7 +97,7 @@ export class Options extends RapidElement {
86
97
  font-size: 14px;
87
98
  padding: 5px 10px;
88
99
  border-radius: 4px;
89
- margin: 3px;
100
+ margin: 0.3em;
90
101
  cursor: pointer;
91
102
  color: var(--color-text-dark);
92
103
  }
@@ -420,6 +431,7 @@ export class Options extends RapidElement {
420
431
  ${this.resolvedRenderOption(option, index === this.cursorIndex)}
421
432
  </div>`;
422
433
  })}
434
+ ${this.block ? html `<div style="height:0.1em"></div>` : null}
423
435
  </div>
424
436
  <slot></slot>
425
437
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"Options.js","sourceR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CACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wCACX;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CACP;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACZ;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACT;AAGnB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAG7B;AAGF;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDAG7B;AAGF;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACoC;AAGnE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACwC;AAGvE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDAC0C;AAGzE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACN","sourcesContent":["import { TemplateResult, html, property, css } from 'lit-element';\nimport { CustomEventType } from '../interfaces';\nimport { RapidElement, EventHandler } from '../RapidElement';\nimport { styleMap } from 'lit-html/directives/style-map';\nimport {\n getClasses,\n getScrollParent,\n isElementVisible,\n throttle,\n} from '../utils';\n\ninterface NameFunction {\n (option: any): string;\n}\n\nexport class Options extends RapidElement {\n static get styles() {\n return css`\n .options-container {\n visibility: hidden;\n border-radius: var(--curvature-widget);\n background: var(--color-widget-bg-focused);\n box-shadow: var(--options-shadow);\n border: 1px solid var(--color-widget-border);\n user-select: none;\n border-radius: var(--curvature-widget);\n overflow: hidden;\n margin-top: var(--options-margin-top);\n }\n\n .anchored {\n position: fixed;\n }\n\n :host([block]) .options-container {\n border: none;\n box-shadow: var(--options-block-shadow);\n height: 100%;\n z-index: 9000;\n visibility: visible;\n overflow-y: auto;\n }\n\n :host([collapsed]) temba-icon {\n flex-grow: 1;\n margin-right: 0px !important;\n padding-top: 0.25em;\n padding-bottom: 0.25em;\n }\n\n :host([collapsed]) .name {\n display: none;\n }\n\n :host([collapsed]) .count {\n display: none;\n }\n\n .options {\n border-radius: var(--curvature-widget);\n overflow-y: auto;\n max-height: 225px;\n border: none;\n }\n\n .show {\n visibility: visible;\n z-index: 10000;\n }\n\n .option {\n font-size: 14px;\n padding: 5px 10px;\n border-radius: 4px;\n margin: 3px;\n cursor: pointer;\n color: var(--color-text-dark);\n }\n\n .option * {\n user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n overflow-wrap: break-word;\n word-wrap: break-word;\n -ms-word-break: break-all;\n word-break: break-word;\n -ms-hyphens: auto;\n -moz-hyphens: auto;\n -webkit-hyphens: auto;\n hyphens: auto;\n }\n\n .option.focused {\n background: var(--color-selection);\n color: var(--color-text-dark);\n }\n\n .option .detail {\n font-size: 85%;\n color: rgba(0, 0, 0, 0.4);\n }\n\n code {\n background: rgba(0, 0, 0, 0.05);\n padding: 1px 5px;\n border-radius: var(--curvature-widget);\n }\n\n :host([block]) {\n position: relative;\n }\n\n :host([block]) .options {\n overflow-y: initial;\n }\n\n temba-loading {\n align-self: center;\n margin-top: 0.025em;\n }\n `;\n }\n\n @property({ type: Number })\n top: number;\n\n @property({ type: Number })\n left: number;\n\n @property({ type: Number })\n width: number;\n\n @property({ type: Number })\n marginHorizontal = 0;\n\n @property({ type: Number })\n marginVertical = 7;\n\n @property({ type: Object })\n anchorTo: HTMLElement;\n\n @property({ type: Boolean })\n visible: boolean;\n\n @property({ type: Boolean })\n block: boolean;\n\n @property({ type: Number })\n scrollPct = 75;\n\n @property({ type: Number })\n cursorIndex = -1;\n\n @property({ type: Array })\n options: any[];\n\n @property({ type: Boolean })\n poppedTop: boolean;\n\n @property({ type: Boolean })\n spaceSelect: boolean;\n\n @property({ type: String })\n nameKey = 'name';\n\n @property({ type: Boolean })\n loading = false;\n\n @property({ type: Boolean })\n collapsed: boolean;\n\n @property({ attribute: false })\n getName: { (option: any): string } = function (option: any) {\n return option[this.nameKey || 'name'];\n };\n\n @property({ attribute: false })\n renderInputOption: { (): TemplateResult } = function () {\n return null;\n };\n\n @property({ attribute: false })\n renderOption: { (option: any, selected: boolean): TemplateResult };\n\n @property({ attribute: false })\n renderOptionName: { (option: any, selected: boolean): TemplateResult };\n\n @property({ attribute: false })\n renderOptionDetail: { (option: any, selected: boolean): TemplateResult };\n\n @property({ type: Number })\n scrollHeight = 0;\n\n @property({ type: Boolean })\n triggerScroll = false;\n\n scrollParent: HTMLElement = null;\n\n resolvedRenderOption: { (option: any, selected: boolean): TemplateResult };\n\n public firstUpdated() {\n if (!this.block) {\n this.scrollParent = getScrollParent(this);\n this.calculatePosition = this.calculatePosition.bind(this);\n if (this.scrollParent) {\n this.scrollParent.addEventListener('scroll', this.calculatePosition);\n }\n this.calculatePosition();\n }\n\n this.resolvedRenderOption = (\n this.renderOption || this.renderOptionDefault\n ).bind(this);\n }\n\n public disconnectedCallback() {\n if (!this.block) {\n if (this.scrollParent) {\n this.scrollParent.removeEventListener('scroll', this.calculatePosition);\n }\n }\n }\n\n private isFocused() {\n const focused =\n this.closestElement(document.activeElement.tagName) ===\n document.activeElement;\n\n return focused;\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n // if our cursor changed, lets make sure our scrollbox is showing it\n if (changedProperties.has('cursorIndex')) {\n const focusedOption = this.shadowRoot.querySelector(\n `div[data-option-index=\"${this.cursorIndex}\"]`\n ) as HTMLDivElement;\n\n if (focusedOption) {\n const scrollBox = this.shadowRoot.querySelector('.options-container');\n const scrollBoxRect = scrollBox.getBoundingClientRect();\n const scrollBoxHeight = scrollBoxRect.height;\n const focusedEleHeight = focusedOption.getBoundingClientRect().height;\n\n if (\n focusedOption.offsetTop + focusedEleHeight >\n scrollBox.scrollTop + scrollBoxHeight - 5\n ) {\n const scrollTo =\n focusedOption.offsetTop - scrollBoxHeight + focusedEleHeight + 5;\n scrollBox.scrollTop = scrollTo;\n } else if (focusedOption.offsetTop < scrollBox.scrollTop) {\n const scrollTo = focusedOption.offsetTop - 5;\n scrollBox.scrollTop = scrollTo;\n }\n }\n\n this.fireCustomEvent(CustomEventType.CursorChanged, {\n index: this.cursorIndex,\n });\n }\n\n if (changedProperties.has('options')) {\n this.calculatePosition();\n const prevOptions = changedProperties.get('options');\n const previousCount = prevOptions ? prevOptions.length : 0;\n const newCount = this.options ? this.options.length : 0;\n\n if (\n this.cursorIndex === -1 ||\n newCount < previousCount ||\n (previousCount === 0 &&\n newCount > 0 &&\n !changedProperties.has('cursorIndex'))\n ) {\n if (!this.block) {\n this.cursorIndex = 0;\n } else {\n if (this.cursorIndex >= newCount) {\n this.cursorIndex = newCount - 1;\n }\n }\n\n if (this.block) {\n this.handleSelection(false);\n }\n }\n\n // if on initial load we don't have enough options to load, trigger a scroll\n // threshold event in case the page size is smaller than our control height\n const scrollBox = this.shadowRoot.querySelector('.options');\n if (scrollBox.scrollHeight == scrollBox.clientHeight) {\n this.fireCustomEvent(CustomEventType.ScrollThreshold);\n }\n }\n\n if (changedProperties.has('visible')) {\n window.setTimeout(() => {\n this.calculatePosition();\n }, 100);\n }\n }\n\n private renderOptionDefault(option: any, selected: boolean): TemplateResult {\n const renderOptionName = (\n this.renderOptionName || this.renderOptionNameDefault\n ).bind(this);\n const renderOptionDetail = (\n this.renderOptionDetail || this.renderOptionDetailDefault\n ).bind(this);\n\n if (selected) {\n return html`\n <div class=\"name\">${renderOptionName(option, selected)}</div>\n <div class=\"detail\">${renderOptionDetail(option, selected)}</div>\n `;\n } else {\n return html`\n <div class=\"name\">${renderOptionName(option, selected)}</div>\n `;\n }\n }\n\n private renderOptionNameDefault(option: any): TemplateResult {\n return html`<div style=\"display:flex; align-items:flex-start\">\n ${option.icon\n ? html`<temba-icon\n name=\"${option.icon}\"\n style=\"margin-right:0.5em; fill: var(--color-text-dark);\"\n ></temba-icon>`\n : null}\n <div style=\"flex-grow:1\">${option.prefix}${this.getName(option)}</div>\n </div>`;\n }\n\n private renderOptionDetailDefault(option: any): TemplateResult {\n return html` ${option.detail} `;\n }\n\n private handleSelection(tabbed = false, index = -1) {\n if (index === -1) {\n index = this.cursorIndex;\n }\n\n const selected = this.options[index];\n this.fireCustomEvent(CustomEventType.Selection, {\n selected,\n tabbed,\n index,\n });\n }\n\n private moveCursor(direction: number): void {\n const newIndex = Math.max(\n Math.min(this.cursorIndex + direction, this.options.length - 1),\n 0\n );\n this.setCursor(newIndex);\n }\n\n private setCursor: (index: number) => void = throttle(function (\n index: number\n ) {\n if (index !== this.cursorIndex) {\n this.cursorIndex = index;\n }\n },\n 50);\n\n private handleKeyDown(evt: KeyboardEvent) {\n if (this.block && !this.isFocused()) {\n return;\n }\n\n if (this.options && this.options.length > 0) {\n if ((evt.ctrlKey && evt.key === 'n') || evt.key === 'ArrowDown') {\n this.moveCursor(1);\n evt.preventDefault();\n evt.stopPropagation();\n if (this.block) {\n this.handleSelection(false);\n }\n } else if ((evt.ctrlKey && evt.key === 'p') || evt.key === 'ArrowUp') {\n this.moveCursor(-1);\n evt.preventDefault();\n if (this.block) {\n this.handleSelection(false);\n }\n } else if (\n evt.key === 'Enter' ||\n evt.key === 'Tab' ||\n (this.spaceSelect && evt.key === ' ')\n ) {\n evt.preventDefault();\n evt.stopPropagation();\n this.handleSelection(evt.key === 'Tab');\n }\n\n if (evt.key === 'Escape') {\n this.fireCustomEvent(CustomEventType.Canceled);\n }\n }\n }\n\n private handleInnerScroll(evt: Event) {\n const scrollbox = evt.target as HTMLDivElement;\n\n // scroll height has changed, enable scroll trigger\n if (scrollbox.scrollHeight > this.scrollHeight) {\n this.scrollHeight = scrollbox.scrollHeight;\n this.triggerScroll = true;\n }\n\n if (this.triggerScroll) {\n const scrollPct =\n scrollbox.scrollTop / (scrollbox.scrollHeight - scrollbox.clientHeight);\n if (scrollPct * 100 > this.scrollPct) {\n this.fireCustomEvent(CustomEventType.ScrollThreshold);\n this.triggerScroll = false;\n }\n }\n }\n\n private calculatePosition() {\n if (this.visible && !this.block) {\n const optionsBounds = this.shadowRoot\n .querySelector('.options-container')\n .getBoundingClientRect();\n\n if (this.anchorTo) {\n const anchorBounds = this.anchorTo.getBoundingClientRect();\n const topTop = anchorBounds.top - optionsBounds.height;\n\n if (this.anchorTo && this.scrollParent) {\n if (!isElementVisible(this.anchorTo, this.scrollParent)) {\n // console.log(\"Not visible canceling\");\n // this.fireCustomEvent(CustomEventType.Canceled);\n }\n }\n\n if (\n topTop > 0 &&\n anchorBounds.bottom + optionsBounds.height > window.innerHeight\n ) {\n this.top = topTop; // + window.pageYOffset;\n this.poppedTop = true;\n } else {\n this.top = anchorBounds.bottom; // + window.pageYOffset;\n this.poppedTop = false;\n }\n\n this.left = anchorBounds.left;\n this.width = anchorBounds.width - 2 - this.marginHorizontal * 2;\n }\n }\n }\n\n public getEventHandlers(): EventHandler[] {\n return [\n {\n event: 'keydown',\n method: this.handleKeyDown,\n isDocument: true,\n },\n {\n event: 'scroll',\n method: this.calculatePosition,\n isDocument: true,\n },\n ];\n }\n\n private handleMouseMove(evt: MouseEvent) {\n if (!this.block) {\n if (Math.abs(evt.movementX) + Math.abs(evt.movementY) > 0) {\n const index = (evt.currentTarget as HTMLElement).getAttribute(\n 'data-option-index'\n );\n this.setCursor(parseInt(index));\n }\n }\n }\n\n private handleOptionClick(evt: MouseEvent) {\n evt.preventDefault();\n evt.stopPropagation();\n\n const index = (evt.currentTarget as HTMLElement).getAttribute(\n 'data-option-index'\n );\n\n if (index) {\n const newIndex = parseInt(index);\n this.setCursor(newIndex);\n this.handleSelection(false, newIndex);\n }\n }\n\n public render(): TemplateResult {\n let vertical = this.block ? 0 : this.marginVertical;\n if (this.poppedTop) {\n vertical *= -1;\n }\n\n const containerStyle = {\n top: this.top ? `${this.top}px` : '0px',\n left: this.left ? `${this.left}px` : '0px',\n 'margin-left': `${this.marginHorizontal}px`,\n 'margin-top': `${vertical}px`,\n };\n\n const optionsStyle = {};\n if (this.width) {\n optionsStyle['width'] = `${this.width}px`;\n }\n\n const classes = getClasses({\n 'options-container': true,\n show: this.visible,\n top: this.poppedTop,\n anchored: !this.block,\n });\n\n const classesInner = getClasses({\n options: true,\n });\n\n const options = this.options || [];\n return html`\n <div\n id=\"wrapper\"\n @scroll=${throttle(this.handleInnerScroll, 100)}\n class=${classes}\n style=${styleMap(containerStyle)}\n >\n <div class=\"${classesInner}\" style=${styleMap(optionsStyle)}>\n ${this.loading\n ? html`<div\n style=\"padding: 1em;\n margin-bottom: 1;\n display: flex;\n flex-direction: column;\"\n >\n <temba-loading></temba-loading>\n </div>`\n : options.map((option, index) => {\n return html`<div\n data-option-index=\"${index}\"\n @mousemove=${this.handleMouseMove}\n @click=${this.handleOptionClick}\n class=\"option ${index === this.cursorIndex ? 'focused' : ''}\"\n >\n ${this.resolvedRenderOption(\n option,\n index === this.cursorIndex\n )}\n </div>`;\n })}\n </div>\n <slot></slot>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Options.js","sourceRoot":"","sources":["../../../src/options/Options.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,QAAQ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AAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CACP;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACZ;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACT;AAGnB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wCAG7B;AAGF;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDAG7B;AAGF;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACoC;AAGnE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACwC;AAGvE;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDAC0C;AAGzE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACN","sourcesContent":["import { TemplateResult, html, property, css } from 'lit-element';\nimport { CustomEventType } from '../interfaces';\nimport { RapidElement, EventHandler } from '../RapidElement';\nimport { styleMap } from 'lit-html/directives/style-map';\nimport {\n getClasses,\n getScrollParent,\n isElementVisible,\n throttle,\n} from '../utils';\n\ninterface NameFunction {\n (option: any): string;\n}\n\nexport class Options extends RapidElement {\n static get styles() {\n return css`\n .options-container {\n visibility: hidden;\n border-radius: var(--curvature-widget);\n background: var(--color-widget-bg-focused);\n box-shadow: var(--options-shadow);\n border: 1px solid var(--color-widget-border);\n user-select: none;\n border-radius: var(--curvature-widget);\n overflow: hidden;\n margin-top: var(--options-margin-top);\n }\n\n .anchored {\n position: fixed;\n }\n\n :host([block]) .options-container {\n border: none;\n height: 100%;\n z-index: 9000;\n visibility: visible;\n overflow-y: auto;\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n\n :host([block]) {\n box-shadow: var(--options-block-shadow);\n border-radius: var(--curvature);\n display: block;\n height: 100%;\n }\n\n :host([block]) .options {\n margin-bottom: 1.5em;\n }\n\n :host([collapsed]) temba-icon {\n flex-grow: 1;\n margin-right: 0px !important;\n padding-top: 0.25em;\n padding-bottom: 0.25em;\n }\n\n :host([collapsed]) .name {\n display: none;\n }\n\n :host([collapsed]) .count {\n display: none;\n }\n\n .options {\n border-radius: var(--curvature-widget);\n overflow-y: auto;\n max-height: 225px;\n border: none;\n }\n\n .show {\n visibility: visible;\n z-index: 10000;\n }\n\n .option {\n font-size: 14px;\n padding: 5px 10px;\n border-radius: 4px;\n margin: 0.3em;\n cursor: pointer;\n color: var(--color-text-dark);\n }\n\n .option * {\n user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n overflow-wrap: break-word;\n word-wrap: break-word;\n -ms-word-break: break-all;\n word-break: break-word;\n -ms-hyphens: auto;\n -moz-hyphens: auto;\n -webkit-hyphens: auto;\n hyphens: auto;\n }\n\n .option.focused {\n background: var(--color-selection);\n color: var(--color-text-dark);\n }\n\n .option .detail {\n font-size: 85%;\n color: rgba(0, 0, 0, 0.4);\n }\n\n code {\n background: rgba(0, 0, 0, 0.05);\n padding: 1px 5px;\n border-radius: var(--curvature-widget);\n }\n\n :host([block]) {\n position: relative;\n }\n\n :host([block]) .options {\n overflow-y: initial;\n }\n\n temba-loading {\n align-self: center;\n margin-top: 0.025em;\n }\n `;\n }\n\n @property({ type: Number })\n top: number;\n\n @property({ type: Number })\n left: number;\n\n @property({ type: Number })\n width: number;\n\n @property({ type: Number })\n marginHorizontal = 0;\n\n @property({ type: Number })\n marginVertical = 7;\n\n @property({ type: Object })\n anchorTo: HTMLElement;\n\n @property({ type: Boolean })\n visible: boolean;\n\n @property({ type: Boolean })\n block: boolean;\n\n @property({ type: Number })\n scrollPct = 75;\n\n @property({ type: Number })\n cursorIndex = -1;\n\n @property({ type: Array })\n options: any[];\n\n @property({ type: Boolean })\n poppedTop: boolean;\n\n @property({ type: Boolean })\n spaceSelect: boolean;\n\n @property({ type: String })\n nameKey = 'name';\n\n @property({ type: Boolean })\n loading = false;\n\n @property({ type: Boolean })\n collapsed: boolean;\n\n @property({ attribute: false })\n getName: { (option: any): string } = function (option: any) {\n return option[this.nameKey || 'name'];\n };\n\n @property({ attribute: false })\n renderInputOption: { (): TemplateResult } = function () {\n return null;\n };\n\n @property({ attribute: false })\n renderOption: { (option: any, selected: boolean): TemplateResult };\n\n @property({ attribute: false })\n renderOptionName: { (option: any, selected: boolean): TemplateResult };\n\n @property({ attribute: false })\n renderOptionDetail: { (option: any, selected: boolean): TemplateResult };\n\n @property({ type: Number })\n scrollHeight = 0;\n\n @property({ type: Boolean })\n triggerScroll = false;\n\n scrollParent: HTMLElement = null;\n\n resolvedRenderOption: { (option: any, selected: boolean): TemplateResult };\n\n public firstUpdated() {\n if (!this.block) {\n this.scrollParent = getScrollParent(this);\n this.calculatePosition = this.calculatePosition.bind(this);\n if (this.scrollParent) {\n this.scrollParent.addEventListener('scroll', this.calculatePosition);\n }\n this.calculatePosition();\n }\n\n this.resolvedRenderOption = (\n this.renderOption || this.renderOptionDefault\n ).bind(this);\n }\n\n public disconnectedCallback() {\n if (!this.block) {\n if (this.scrollParent) {\n this.scrollParent.removeEventListener('scroll', this.calculatePosition);\n }\n }\n }\n\n private isFocused() {\n const focused =\n this.closestElement(document.activeElement.tagName) ===\n document.activeElement;\n\n return focused;\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n // if our cursor changed, lets make sure our scrollbox is showing it\n if (changedProperties.has('cursorIndex')) {\n const focusedOption = this.shadowRoot.querySelector(\n `div[data-option-index=\"${this.cursorIndex}\"]`\n ) as HTMLDivElement;\n\n if (focusedOption) {\n const scrollBox = this.shadowRoot.querySelector('.options-container');\n const scrollBoxRect = scrollBox.getBoundingClientRect();\n const scrollBoxHeight = scrollBoxRect.height;\n const focusedEleHeight = focusedOption.getBoundingClientRect().height;\n\n if (\n focusedOption.offsetTop + focusedEleHeight >\n scrollBox.scrollTop + scrollBoxHeight - 5\n ) {\n const scrollTo =\n focusedOption.offsetTop - scrollBoxHeight + focusedEleHeight + 5;\n scrollBox.scrollTop = scrollTo;\n } else if (focusedOption.offsetTop < scrollBox.scrollTop) {\n const scrollTo = focusedOption.offsetTop - 5;\n scrollBox.scrollTop = scrollTo;\n }\n }\n\n this.fireCustomEvent(CustomEventType.CursorChanged, {\n index: this.cursorIndex,\n });\n }\n\n if (changedProperties.has('options')) {\n this.calculatePosition();\n const prevOptions = changedProperties.get('options');\n const previousCount = prevOptions ? prevOptions.length : 0;\n const newCount = this.options ? this.options.length : 0;\n\n if (\n this.cursorIndex === -1 ||\n newCount < previousCount ||\n (previousCount === 0 &&\n newCount > 0 &&\n !changedProperties.has('cursorIndex'))\n ) {\n if (!this.block) {\n this.cursorIndex = 0;\n } else {\n if (this.cursorIndex >= newCount) {\n this.cursorIndex = newCount - 1;\n }\n }\n\n if (this.block) {\n this.handleSelection(false);\n }\n }\n\n // if on initial load we don't have enough options to load, trigger a scroll\n // threshold event in case the page size is smaller than our control height\n const scrollBox = this.shadowRoot.querySelector('.options');\n if (scrollBox.scrollHeight == scrollBox.clientHeight) {\n this.fireCustomEvent(CustomEventType.ScrollThreshold);\n }\n }\n\n if (changedProperties.has('visible')) {\n window.setTimeout(() => {\n this.calculatePosition();\n }, 100);\n }\n }\n\n private renderOptionDefault(option: any, selected: boolean): TemplateResult {\n const renderOptionName = (\n this.renderOptionName || this.renderOptionNameDefault\n ).bind(this);\n const renderOptionDetail = (\n this.renderOptionDetail || this.renderOptionDetailDefault\n ).bind(this);\n\n if (selected) {\n return html`\n <div class=\"name\">${renderOptionName(option, selected)}</div>\n <div class=\"detail\">${renderOptionDetail(option, selected)}</div>\n `;\n } else {\n return html`\n <div class=\"name\">${renderOptionName(option, selected)}</div>\n `;\n }\n }\n\n private renderOptionNameDefault(option: any): TemplateResult {\n return html`<div style=\"display:flex; align-items:flex-start\">\n ${option.icon\n ? html`<temba-icon\n name=\"${option.icon}\"\n style=\"margin-right:0.5em; fill: var(--color-text-dark);\"\n ></temba-icon>`\n : null}\n <div style=\"flex-grow:1\">${option.prefix}${this.getName(option)}</div>\n </div>`;\n }\n\n private renderOptionDetailDefault(option: any): TemplateResult {\n return html` ${option.detail} `;\n }\n\n private handleSelection(tabbed = false, index = -1) {\n if (index === -1) {\n index = this.cursorIndex;\n }\n\n const selected = this.options[index];\n this.fireCustomEvent(CustomEventType.Selection, {\n selected,\n tabbed,\n index,\n });\n }\n\n private moveCursor(direction: number): void {\n const newIndex = Math.max(\n Math.min(this.cursorIndex + direction, this.options.length - 1),\n 0\n );\n this.setCursor(newIndex);\n }\n\n private setCursor: (index: number) => void = throttle(function (\n index: number\n ) {\n if (index !== this.cursorIndex) {\n this.cursorIndex = index;\n }\n },\n 50);\n\n private handleKeyDown(evt: KeyboardEvent) {\n if (this.block && !this.isFocused()) {\n return;\n }\n\n if (this.options && this.options.length > 0) {\n if ((evt.ctrlKey && evt.key === 'n') || evt.key === 'ArrowDown') {\n this.moveCursor(1);\n evt.preventDefault();\n evt.stopPropagation();\n if (this.block) {\n this.handleSelection(false);\n }\n } else if ((evt.ctrlKey && evt.key === 'p') || evt.key === 'ArrowUp') {\n this.moveCursor(-1);\n evt.preventDefault();\n if (this.block) {\n this.handleSelection(false);\n }\n } else if (\n evt.key === 'Enter' ||\n evt.key === 'Tab' ||\n (this.spaceSelect && evt.key === ' ')\n ) {\n evt.preventDefault();\n evt.stopPropagation();\n this.handleSelection(evt.key === 'Tab');\n }\n\n if (evt.key === 'Escape') {\n this.fireCustomEvent(CustomEventType.Canceled);\n }\n }\n }\n\n private handleInnerScroll(evt: Event) {\n const scrollbox = evt.target as HTMLDivElement;\n\n // scroll height has changed, enable scroll trigger\n if (scrollbox.scrollHeight > this.scrollHeight) {\n this.scrollHeight = scrollbox.scrollHeight;\n this.triggerScroll = true;\n }\n\n if (this.triggerScroll) {\n const scrollPct =\n scrollbox.scrollTop / (scrollbox.scrollHeight - scrollbox.clientHeight);\n if (scrollPct * 100 > this.scrollPct) {\n this.fireCustomEvent(CustomEventType.ScrollThreshold);\n this.triggerScroll = false;\n }\n }\n }\n\n private calculatePosition() {\n if (this.visible && !this.block) {\n const optionsBounds = this.shadowRoot\n .querySelector('.options-container')\n .getBoundingClientRect();\n\n if (this.anchorTo) {\n const anchorBounds = this.anchorTo.getBoundingClientRect();\n const topTop = anchorBounds.top - optionsBounds.height;\n\n if (this.anchorTo && this.scrollParent) {\n if (!isElementVisible(this.anchorTo, this.scrollParent)) {\n // console.log(\"Not visible canceling\");\n // this.fireCustomEvent(CustomEventType.Canceled);\n }\n }\n\n if (\n topTop > 0 &&\n anchorBounds.bottom + optionsBounds.height > window.innerHeight\n ) {\n this.top = topTop; // + window.pageYOffset;\n this.poppedTop = true;\n } else {\n this.top = anchorBounds.bottom; // + window.pageYOffset;\n this.poppedTop = false;\n }\n\n this.left = anchorBounds.left;\n this.width = anchorBounds.width - 2 - this.marginHorizontal * 2;\n }\n }\n }\n\n public getEventHandlers(): EventHandler[] {\n return [\n {\n event: 'keydown',\n method: this.handleKeyDown,\n isDocument: true,\n },\n {\n event: 'scroll',\n method: this.calculatePosition,\n isDocument: true,\n },\n ];\n }\n\n private handleMouseMove(evt: MouseEvent) {\n if (!this.block) {\n if (Math.abs(evt.movementX) + Math.abs(evt.movementY) > 0) {\n const index = (evt.currentTarget as HTMLElement).getAttribute(\n 'data-option-index'\n );\n this.setCursor(parseInt(index));\n }\n }\n }\n\n private handleOptionClick(evt: MouseEvent) {\n evt.preventDefault();\n evt.stopPropagation();\n\n const index = (evt.currentTarget as HTMLElement).getAttribute(\n 'data-option-index'\n );\n\n if (index) {\n const newIndex = parseInt(index);\n this.setCursor(newIndex);\n this.handleSelection(false, newIndex);\n }\n }\n\n public render(): TemplateResult {\n let vertical = this.block ? 0 : this.marginVertical;\n if (this.poppedTop) {\n vertical *= -1;\n }\n\n const containerStyle = {\n top: this.top ? `${this.top}px` : '0px',\n left: this.left ? `${this.left}px` : '0px',\n 'margin-left': `${this.marginHorizontal}px`,\n 'margin-top': `${vertical}px`,\n };\n\n const optionsStyle = {};\n if (this.width) {\n optionsStyle['width'] = `${this.width}px`;\n }\n\n const classes = getClasses({\n 'options-container': true,\n show: this.visible,\n top: this.poppedTop,\n anchored: !this.block,\n });\n\n const classesInner = getClasses({\n options: true,\n });\n\n const options = this.options || [];\n return html`\n <div\n id=\"wrapper\"\n @scroll=${throttle(this.handleInnerScroll, 100)}\n class=${classes}\n style=${styleMap(containerStyle)}\n >\n <div class=\"${classesInner}\" style=${styleMap(optionsStyle)}>\n ${this.loading\n ? html`<div\n style=\"padding: 1em;\n margin-bottom: 1;\n display: flex;\n flex-direction: column;\"\n >\n <temba-loading></temba-loading>\n </div>`\n : options.map((option, index) => {\n return html`<div\n data-option-index=\"${index}\"\n @mousemove=${this.handleMouseMove}\n @click=${this.handleOptionClick}\n class=\"option ${index === this.cursorIndex ? 'focused' : ''}\"\n >\n ${this.resolvedRenderOption(\n option,\n index === this.cursorIndex\n )}\n </div>`;\n })}\n ${this.block ? html`<div style=\"height:0.1em\"></div>` : null}\n </div>\n <slot></slot>\n </div>\n `;\n }\n}\n"]}
@@ -11,6 +11,7 @@ export class Tip extends RapidElement {
11
11
  this.visible = false;
12
12
  this.position = 'auto';
13
13
  this.lastEnter = 0;
14
+ this.failSafe = 0;
14
15
  }
15
16
  static get styles() {
16
17
  return css `
@@ -120,10 +121,14 @@ export class Tip extends RapidElement {
120
121
  handleMouseEnter() {
121
122
  this.lastEnter = window.setTimeout(() => {
122
123
  this.visible = true;
124
+ this.failSafe = window.setTimeout(() => {
125
+ this.visible = false;
126
+ }, 2000);
123
127
  }, 600);
124
128
  }
125
129
  handleMouseLeave() {
126
130
  window.clearTimeout(this.lastEnter);
131
+ window.clearTimeout(this.failSafe);
127
132
  this.visible = false;
128
133
  }
129
134
  render() {
@@ -147,6 +152,7 @@ export class Tip extends RapidElement {
147
152
  return html `
148
153
  <div
149
154
  class="slot"
155
+ @click=${this.handleMouseLeave}
150
156
  @mouseenter=${this.handleMouseEnter}
151
157
  @mouseleave=${this.handleMouseLeave}
152
158
  >
@@ -1 +1 @@
1
- {"version":3,"file":"Tip.js","sourceRoot":"","sources":["../../../src/tip/Tip.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,OAAO,GAAI,SAAQ,YAAY;IAArC;;QA4DE,YAAO,GAAG,KAAK,CAAC;QAGhB,aAAQ,GAAG,MAAM,CAAC;QAgFlB,cAAS,GAAG,CAAC,CAAC;IAmDhB,CAAC;IAjMC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoDT,CAAC;IACJ,CAAC;IA+BM,OAAO,CAAC,OAAyB;QACtC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;YACnE,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAC1B;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC5C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACtB;IACH,CAAC;IAEO,iBAAiB;QACv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AC;gCACjC;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iCAChC;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kCAC/B;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sCAC3B","sourcesContent":["import { css, property } from 'lit-element';\nimport { html, TemplateResult } from 'lit-html';\nimport { styleMap } from 'lit-html/directives/style-map';\nimport { RapidElement } from '../RapidElement';\nimport { getClasses } from '../utils';\nimport { getCenter, getMiddle } from './helpers';\n\nexport class Tip extends RapidElement {\n static get styles() {\n return css`\n .tip {\n transition: opacity 200ms ease-in-out;\n margin: 0px;\n position: fixed;\n opacity: 0;\n background: #fff;\n padding: 4px 8px;\n pointer-events: none;\n border-radius: var(--curvature-widget);\n box-shadow: 0 1px 10px 10px rgba(0, 0, 0, 0.035),\n 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n font-size: 14px;\n z-index: 10000;\n color: #333;\n }\n\n .tip.hide-on-change {\n transition: none;\n }\n\n .show {\n opacity: 1;\n }\n\n .slot {\n display: flex;\n flex-direction: column;\n }\n\n .arrow {\n position: absolute;\n color: #fff;\n font-size: 10px;\n line-height: 0px;\n }\n\n .◀ {\n text-shadow: -1px 2px 2px rgba(0, 0, 0, 0.1);\n }\n\n .▶ {\n text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.1);\n }\n\n .▼ {\n text-shadow: 0px 3px 3px rgba(0, 0, 0, 0.1);\n }\n\n .▲ {\n text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.1);\n }\n `;\n }\n @property({ type: String })\n text: string;\n\n @property({ type: Boolean })\n visible = false;\n\n @property({ type: String })\n position = 'auto';\n\n @property({ type: Boolean })\n hideOnChange: boolean;\n\n @property({ type: Number, attribute: false })\n top: number;\n\n @property({ type: Number, attribute: false })\n left: number;\n\n @property({ type: Number, attribute: false })\n width: number;\n\n @property({ type: Boolean, attribute: false })\n poppedTop: boolean;\n\n arrow: string;\n\n arrowTop: number;\n arrowLeft: number;\n arrowDirection: string;\n\n public updated(changed: Map<string, any>) {\n if ((changed.has('visible') || changed.has('text')) && this.visible) {\n this.calculatePosition();\n }\n\n if (changed.has('text') && this.hideOnChange) {\n this.visible = false;\n }\n }\n\n private calculatePosition() {\n if (this.visible) {\n const tipBounds = this.getDiv('.tip').getBoundingClientRect();\n const anchorBounds = this.getDiv('.slot').getBoundingClientRect();\n\n // TODO: pick a direction automatically\n let tipSide = this.position;\n if (tipSide === 'auto') {\n tipSide = 'left';\n }\n\n this.arrowLeft = 0;\n this.arrowTop = 0;\n\n if (tipSide === 'left') {\n this.left = anchorBounds.left - tipBounds.width - 16;\n this.top = getMiddle(anchorBounds, tipBounds);\n\n // position our arrow\n this.arrowTop = tipBounds.height / 2;\n this.arrowLeft = tipBounds.width - 1;\n this.arrow = '▶';\n } else if (tipSide === 'right') {\n this.left = anchorBounds.right + 12;\n this.top = getMiddle(anchorBounds, tipBounds);\n\n this.arrowTop = tipBounds.height / 2;\n this.arrowLeft = -8;\n this.arrow = '◀';\n } else if (tipSide === 'top') {\n this.top = anchorBounds.top - tipBounds.height - 12;\n this.left = getCenter(anchorBounds, tipBounds);\n\n this.arrowTop = tipBounds.height + 2;\n this.arrowLeft = tipBounds.width / 2 - 4;\n this.arrow = '▼';\n } else if (tipSide === 'bottom') {\n this.top = anchorBounds.bottom + 10;\n this.left = getCenter(anchorBounds, tipBounds);\n\n this.arrowTop = -2;\n this.arrowLeft = tipBounds.width / 2 - 3;\n this.arrow = '▲';\n }\n }\n }\n\n lastEnter = 0;\n\n private handleMouseEnter() {\n this.lastEnter = window.setTimeout(() => {\n this.visible = true;\n }, 600);\n }\n\n private handleMouseLeave() {\n window.clearTimeout(this.lastEnter);\n this.visible = false;\n }\n\n public render(): TemplateResult {\n const tipStyle: any = {\n top: this.top ? `${this.top}px` : '0px',\n left: this.left ? `${this.left}px` : '0px',\n };\n\n const arrowStyle: any = {\n top: this.arrowTop ? `${this.arrowTop}px` : '0px',\n left: this.arrowLeft ? `${this.arrowLeft}px` : '0px',\n };\n\n if (this.width) {\n tipStyle.width = `${this.width}px`;\n }\n\n const classes = getClasses({\n tip: true,\n show: this.visible,\n top: this.poppedTop,\n 'hide-on-change': this.hideOnChange,\n });\n\n return html`\n <div\n class=\"slot\"\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n >\n <slot></slot>\n </div>\n <div class=\"${classes}\" style=${styleMap(tipStyle)}>\n ${this.text}\n <div class=\"arrow ${this.arrow}\" style=${styleMap(arrowStyle)}>\n ${this.arrow}\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Tip.js","sourceRoot":"","sources":["../../../src/tip/Tip.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,OAAO,GAAI,SAAQ,YAAY;IAArC;;QA4DE,YAAO,GAAG,KAAK,CAAC;QAGhB,aAAQ,GAAG,MAAM,CAAC;QAgFlB,cAAS,GAAG,CAAC,CAAC;QACd,aAAQ,GAAG,CAAC,CAAC;IAwDf,CAAC;IAvMC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoDT,C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I,CAAC,gBAAgB;sBAChB,IAAI,CAAC,gBAAgB;sBACrB,IAAI,CAAC,gBAAgB;;;;oBAIvB,OAAO,WAAW,QAAQ,CAAC,QAAQ,CAAC;UAC9C,IAAI,CAAC,IAAI;4BACS,IAAI,CAAC,KAAK,WAAW,QAAQ,CAAC,UAAU,CAAC;YACzD,IAAI,CAAC,KAAK;;;KAGjB,CAAC;IACJ,CAAC;CACF;AA/IC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iCACd;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oCACZ;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACN;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gCACjC;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iCAChC;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kCAC/B;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sCAC3B","sourcesContent":["import { css, property } from 'lit-element';\nimport { html, TemplateResult } from 'lit-html';\nimport { styleMap } from 'lit-html/directives/style-map';\nimport { RapidElement } from '../RapidElement';\nimport { getClasses } from '../utils';\nimport { getCenter, getMiddle } from './helpers';\n\nexport class Tip extends RapidElement {\n static get styles() {\n return css`\n .tip {\n transition: opacity 200ms ease-in-out;\n margin: 0px;\n position: fixed;\n opacity: 0;\n background: #fff;\n padding: 4px 8px;\n pointer-events: none;\n border-radius: var(--curvature-widget);\n box-shadow: 0 1px 10px 10px rgba(0, 0, 0, 0.035),\n 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n font-size: 14px;\n z-index: 10000;\n color: #333;\n }\n\n .tip.hide-on-change {\n transition: none;\n }\n\n .show {\n opacity: 1;\n }\n\n .slot {\n display: flex;\n flex-direction: column;\n }\n\n .arrow {\n position: absolute;\n color: #fff;\n font-size: 10px;\n line-height: 0px;\n }\n\n .◀ {\n text-shadow: -1px 2px 2px rgba(0, 0, 0, 0.1);\n }\n\n .▶ {\n text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.1);\n }\n\n .▼ {\n text-shadow: 0px 3px 3px rgba(0, 0, 0, 0.1);\n }\n\n .▲ {\n text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.1);\n }\n `;\n }\n @property({ type: String })\n text: string;\n\n @property({ type: Boolean })\n visible = false;\n\n @property({ type: String })\n position = 'auto';\n\n @property({ type: Boolean })\n hideOnChange: boolean;\n\n @property({ type: Number, attribute: false })\n top: number;\n\n @property({ type: Number, attribute: false })\n left: number;\n\n @property({ type: Number, attribute: false })\n width: number;\n\n @property({ type: Boolean, attribute: false })\n poppedTop: boolean;\n\n arrow: string;\n\n arrowTop: number;\n arrowLeft: number;\n arrowDirection: string;\n\n public updated(changed: Map<string, any>) {\n if ((changed.has('visible') || changed.has('text')) && this.visible) {\n this.calculatePosition();\n }\n\n if (changed.has('text') && this.hideOnChange) {\n this.visible = false;\n }\n }\n\n private calculatePosition() {\n if (this.visible) {\n const tipBounds = this.getDiv('.tip').getBoundingClientRect();\n const anchorBounds = this.getDiv('.slot').getBoundingClientRect();\n\n // TODO: pick a direction automatically\n let tipSide = this.position;\n if (tipSide === 'auto') {\n tipSide = 'left';\n }\n\n this.arrowLeft = 0;\n this.arrowTop = 0;\n\n if (tipSide === 'left') {\n this.left = anchorBounds.left - tipBounds.width - 16;\n this.top = getMiddle(anchorBounds, tipBounds);\n\n // position our arrow\n this.arrowTop = tipBounds.height / 2;\n this.arrowLeft = tipBounds.width - 1;\n this.arrow = '▶';\n } else if (tipSide === 'right') {\n this.left = anchorBounds.right + 12;\n this.top = getMiddle(anchorBounds, tipBounds);\n\n this.arrowTop = tipBounds.height / 2;\n this.arrowLeft = -8;\n this.arrow = '◀';\n } else if (tipSide === 'top') {\n this.top = anchorBounds.top - tipBounds.height - 12;\n this.left = getCenter(anchorBounds, tipBounds);\n\n this.arrowTop = tipBounds.height + 2;\n this.arrowLeft = tipBounds.width / 2 - 4;\n this.arrow = '▼';\n } else if (tipSide === 'bottom') {\n this.top = anchorBounds.bottom + 10;\n this.left = getCenter(anchorBounds, tipBounds);\n\n this.arrowTop = -2;\n this.arrowLeft = tipBounds.width / 2 - 3;\n this.arrow = '▲';\n }\n }\n }\n\n lastEnter = 0;\n failSafe = 0;\n\n private handleMouseEnter() {\n this.lastEnter = window.setTimeout(() => {\n this.visible = true;\n this.failSafe = window.setTimeout(() => {\n this.visible = false;\n }, 2000);\n }, 600);\n }\n\n private handleMouseLeave() {\n window.clearTimeout(this.lastEnter);\n window.clearTimeout(this.failSafe);\n this.visible = false;\n }\n\n public render(): TemplateResult {\n const tipStyle: any = {\n top: this.top ? `${this.top}px` : '0px',\n left: this.left ? `${this.left}px` : '0px',\n };\n\n const arrowStyle: any = {\n top: this.arrowTop ? `${this.arrowTop}px` : '0px',\n left: this.arrowLeft ? `${this.arrowLeft}px` : '0px',\n };\n\n if (this.width) {\n tipStyle.width = `${this.width}px`;\n }\n\n const classes = getClasses({\n tip: true,\n show: this.visible,\n top: this.poppedTop,\n 'hide-on-change': this.hideOnChange,\n });\n\n return html`\n <div\n class=\"slot\"\n @click=${this.handleMouseLeave}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n >\n <slot></slot>\n </div>\n <div class=\"${classes}\" style=${styleMap(tipStyle)}>\n ${this.text}\n <div class=\"arrow ${this.arrow}\" style=${styleMap(arrowStyle)}>\n ${this.arrow}\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -23,9 +23,6 @@ export class VectorIcon extends LitElement {
23
23
  }
24
24
 
25
25
  svg {
26
- -webkit-transform: scale(1);
27
- transform: scale(1);
28
-
29
26
  fill: var(--icon-color);
30
27
  transition: fill 100ms ease-in-out,
31
28
  background 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),
@@ -64,13 +61,24 @@ export class VectorIcon extends LitElement {
64
61
  background: rgb(255, 255, 255);
65
62
  }
66
63
 
64
+ .circled {
65
+ background: rgb(240, 240, 240);
66
+ padding: 0.15em;
67
+ margin: -0.15em;
68
+ box-shadow: var(--shadow);
69
+ }
70
+
67
71
  .wrapper {
68
72
  display: flex;
69
73
  flex-direction: column;
70
74
  border-radius: 999px;
71
75
  transition: background 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),
72
- padding 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),
73
- margin 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
76
+ transform 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55),
77
+ padding 150ms linear, margin 150ms linear;
78
+ }
79
+
80
+ .wrapper.clickable {
81
+ transform: scale(1);
74
82
  }
75
83
 
76
84
  .wrapper.clickable:hover {
@@ -123,6 +131,7 @@ export class VectorIcon extends LitElement {
123
131
  <div
124
132
  class="wrapper ${getClasses({
125
133
  clickable: this.clickable,
134
+ circled: this.circled,
126
135
  animate: !!this.animateChange,
127
136
  })}"
128
137
  >
@@ -159,6 +168,9 @@ __decorate([
159
168
  __decorate([
160
169
  property({ type: Boolean })
161
170
  ], VectorIcon.prototype, "clickable", void 0);
171
+ __decorate([
172
+ property({ type: Boolean })
173
+ ], VectorIcon.prototype, "circled", void 0);
162
174
  __decorate([
163
175
  property({ type: String })
164
176
  ], VectorIcon.prototype, "animateChange", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"VectorIcon.js","sourceRoot":"","sources":["../../../src/vectoricon/VectorIcon.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,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Y,SAAS,IAAI;aAClE,QAAQ;YACX,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,EAAE;;;;KAId,CAAC;IACJ,CAAC;CACF;AAhLC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACd;AAIb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAChB;AAGX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAClB;AAGT;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACL;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACH;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCACnC;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACvB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACuB","sourcesContent":["import { property, LitElement, TemplateResult, html, css } from 'lit-element';\n\nimport { getClasses } from '../utils';\n\n// for cache busting, increase whenever the icon set changes\nconst ICON_VERSION = 2;\n\nexport class VectorIcon extends LitElement {\n @property({ type: String })\n name: string;\n\n // same as name but without implicit coloring\n @property({ type: String })\n id: string;\n\n @property({ type: Number })\n size = 1;\n\n @property({ type: Boolean })\n clickable: boolean;\n\n @property({ type: String })\n animateChange: string;\n\n @property({ type: Number })\n animationDuration = 200;\n\n @property({ type: Number, attribute: false })\n steps = 2;\n\n @property({ type: Number, attribute: false })\n animationStep: number;\n\n @property({ type: String })\n easing = 'cubic-bezier(0.68, -0.55, 0.265, 1.55)';\n\n static get styles() {\n return css`\n :host {\n margin: auto;\n }\n\n :host([id='flow']),\n :host([name='flow']) {\n padding-bottom: 0.2em;\n }\n\n svg {\n -webkit-transform: scale(1);\n transform: scale(1);\n\n fill: var(--icon-color);\n transition: fill 100ms ease-in-out,\n background 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n padding 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n margin 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);\n }\n\n svg.spin {\n transform: rotate(0deg);\n }\n\n svg.spin-1 {\n transform: rotate(180deg);\n }\n\n svg.spin-2 {\n transform: rotate(360deg);\n }\n\n svg.spin-3 {\n transform: rotate(0deg);\n transition-duration: 0ms !important;\n }\n\n svg.pulse {\n transform: scale(1);\n }\n\n svg.pulse-1 {\n transform: scale(1.2);\n }\n\n .clickable:hover {\n cursor: pointer;\n fill: var(--color-link-primary);\n background: rgb(255, 255, 255);\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n border-radius: 999px;\n transition: background 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n padding 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n margin 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);\n }\n\n .wrapper.clickable:hover {\n padding: 0.35em;\n margin: -0.35em;\n }\n `;\n }\n\n constructor() {\n super();\n }\n\n private lastName: string;\n\n public firstUpdated(changes: Map<string, any>) {\n super.firstUpdated(changes);\n if (changes.has('animateChange')) {\n // set our default duration if we need one\n if (!changes.has('animationDuration')) {\n this.animationDuration = this.steps * this.animationDuration;\n }\n\n if (this.animateChange === 'spin') {\n this.steps = 3;\n this.animationDuration = 400;\n this.easing = 'linear';\n }\n }\n }\n\n public updated(changes: Map<string, any>) {\n super.updated(changes);\n\n if (changes.has('animationStep')) {\n // if we are halfway through, change the icon\n if (this.lastName && this.animationStep >= this.steps / 2) {\n this.lastName = null;\n this.requestUpdate();\n }\n\n setTimeout(() => {\n if (this.animationStep > 0 && this.animationStep < this.steps) {\n this.animationStep++;\n } else {\n this.animationStep = 0;\n }\n }, this.animationDuration / this.steps);\n }\n\n if (changes.has('name') && this.animateChange) {\n this.lastName = changes.get('name');\n\n // our name changed, lets animate it\n if (this.lastName && this.animateChange) {\n this.animationStep = 1;\n }\n }\n }\n\n public render(): TemplateResult {\n return html`\n <div\n class=\"wrapper ${getClasses({\n clickable: this.clickable,\n animate: !!this.animateChange,\n })}\"\n >\n <svg\n style=\"height:${this.size}em;width:${this\n .size}em;transition:transform ${this.animationDuration /\n this.steps}ms\n ${this.easing}\"\n class=\"${getClasses({\n [this.animateChange]: !!this.animateChange,\n [this.animateChange + '-' + this.animationStep]:\n this.animationStep > 0,\n })}\"\n >\n <use\n href=\"/sitestatic/icons/symbol-defs.svg?v=${ICON_VERSION}#icon-${this\n .lastName ||\n this.name ||\n this.id}\"\n />\n </svg>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"VectorIcon.js","sourceRoot":"","sources":["../../../src/vectoricon/VectorIcon.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,4DAA4D;AAC5D,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,OAAO,UAAW,SAAQ,UAAU;IA6GxC;QACE,KAAK,EAAE,CAAC;QArGV,SAAI,GAAG,CAAC,CAAC;QAYT,sBAAiB,GAAG,GAAG,CAAC;QAGxB,UAAK,GAAG,CAAC,CAAC;QAMV,WAAM,GAAG,wCAAwC,CAAC;IAiFlD,CAAC;IA/ED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyET,CAAC;IACJ,CAAC;IAQM,YAAY,CAAC,OAAyB;QAC3C,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC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AAE,CAAC;qDACH;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCACnC;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDACvB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACuB","sourcesContent":["import { property, LitElement, TemplateResult, html, css } from 'lit-element';\n\nimport { getClasses } from '../utils';\n\n// for cache busting, increase whenever the icon set changes\nconst ICON_VERSION = 2;\n\nexport class VectorIcon extends LitElement {\n @property({ type: String })\n name: string;\n\n // same as name but without implicit coloring\n @property({ type: String })\n id: string;\n\n @property({ type: Number })\n size = 1;\n\n @property({ type: Boolean })\n clickable: boolean;\n\n @property({ type: Boolean })\n circled: boolean;\n\n @property({ type: String })\n animateChange: string;\n\n @property({ type: Number })\n animationDuration = 200;\n\n @property({ type: Number, attribute: false })\n steps = 2;\n\n @property({ type: Number, attribute: false })\n animationStep: number;\n\n @property({ type: String })\n easing = 'cubic-bezier(0.68, -0.55, 0.265, 1.55)';\n\n static get styles() {\n return css`\n :host {\n margin: auto;\n }\n\n :host([id='flow']),\n :host([name='flow']) {\n padding-bottom: 0.2em;\n }\n\n svg {\n fill: var(--icon-color);\n transition: fill 100ms ease-in-out,\n background 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n padding 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n margin 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);\n }\n\n svg.spin {\n transform: rotate(0deg);\n }\n\n svg.spin-1 {\n transform: rotate(180deg);\n }\n\n svg.spin-2 {\n transform: rotate(360deg);\n }\n\n svg.spin-3 {\n transform: rotate(0deg);\n transition-duration: 0ms !important;\n }\n\n svg.pulse {\n transform: scale(1);\n }\n\n svg.pulse-1 {\n transform: scale(1.2);\n }\n\n .clickable:hover {\n cursor: pointer;\n fill: var(--color-link-primary);\n background: rgb(255, 255, 255);\n }\n\n .circled {\n background: rgb(240, 240, 240);\n padding: 0.15em;\n margin: -0.15em;\n box-shadow: var(--shadow);\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n border-radius: 999px;\n transition: background 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n transform 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55),\n padding 150ms linear, margin 150ms linear;\n }\n\n .wrapper.clickable {\n transform: scale(1);\n }\n\n .wrapper.clickable:hover {\n padding: 0.35em;\n margin: -0.35em;\n }\n `;\n }\n\n constructor() {\n super();\n }\n\n private lastName: string;\n\n public firstUpdated(changes: Map<string, any>) {\n super.firstUpdated(changes);\n if (changes.has('animateChange')) {\n // set our default duration if we need one\n if (!changes.has('animationDuration')) {\n this.animationDuration = this.steps * this.animationDuration;\n }\n\n if (this.animateChange === 'spin') {\n this.steps = 3;\n this.animationDuration = 400;\n this.easing = 'linear';\n }\n }\n }\n\n public updated(changes: Map<string, any>) {\n super.updated(changes);\n\n if (changes.has('animationStep')) {\n // if we are halfway through, change the icon\n if (this.lastName && this.animationStep >= this.steps / 2) {\n this.lastName = null;\n this.requestUpdate();\n }\n\n setTimeout(() => {\n if (this.animationStep > 0 && this.animationStep < this.steps) {\n this.animationStep++;\n } else {\n this.animationStep = 0;\n }\n }, this.animationDuration / this.steps);\n }\n\n if (changes.has('name') && this.animateChange) {\n this.lastName = changes.get('name');\n\n // our name changed, lets animate it\n if (this.lastName && this.animateChange) {\n this.animationStep = 1;\n }\n }\n }\n\n public render(): TemplateResult {\n return html`\n <div\n class=\"wrapper ${getClasses({\n clickable: this.clickable,\n circled: this.circled,\n animate: !!this.animateChange,\n })}\"\n >\n <svg\n style=\"height:${this.size}em;width:${this\n .size}em;transition:transform ${this.animationDuration /\n this.steps}ms\n ${this.easing}\"\n class=\"${getClasses({\n [this.animateChange]: !!this.animateChange,\n [this.animateChange + '-' + this.animationStep]:\n this.animationStep > 0,\n })}\"\n >\n <use\n href=\"/sitestatic/icons/symbol-defs.svg?v=${ICON_VERSION}#icon-${this\n .lastName ||\n this.name ||\n this.id}\"\n />\n </svg>\n </div>\n `;\n }\n}\n"]}
@@ -44,9 +44,9 @@ describe('temba-contact-history', () => {
44
44
  // we should have scrolled to the bottom
45
45
  const events = history.shadowRoot.querySelector('.events');
46
46
  const top = events.scrollHeight - events.getBoundingClientRect().height;
47
- expect(top).to.equal(308);
47
+ expect(top).to.equal(218);
48
48
  // make sure we actually scrolled to there
49
- expect(events.scrollTop).to.equal(top);
49
+ expect(events.scrollTop).to.equal(top - 1);
50
50
  await assertScreenshot('contacts/history', getHistoryClip(history));
51
51
  });
52
52
  it('expands event groups', async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"temba-contact-history.test.js","sourceRoot":"","sources":["../../test/temba-contact-history.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjD,UAAU,CAAC,YAAY,CACrB,OAAO,EACP,8DAA8D,CAC/D,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAmB,CAAC;IAEvE,0CAA0C;IAC1C,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,OAAO,C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,GAAG,MAAM,aAAa,CACjC,cAAc,CAAC;YACb,IAAI,EAAE,MAAM;SACb,CAAC,CACH,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;QAEnB,wCAAwC;QACxC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACxE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE1B,0CAA0C;QAC1C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,OAAO,GAAG,MAAM,aAAa,CACjC,cAAc,CAAC;YACb,IAAI,EAAE,MAAM;SACb,CAAC,CACH,CAAC;QAEF,mCAAmC;QACnC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAC5C,sBAAsB,GAAG,IAAI,CACZ,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,CAAC;SACf;QAED,MAAM,gBAAgB,CACpB,2BAA2B,EAC3B,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, assert, expect } from '@open-wc/testing';\nimport sinon from 'sinon';\nimport { ContactHistory } from '../src/contacts/ContactHistory';\nimport { stubbable } from '../src/utils';\nimport {\n assertScreenshot,\n getClip,\n getHTML,\n mockGET,\n} from '../test/utils.test';\nimport './utils.test';\n\nexport const createHistory = async (def: string) => {\n const parentNode = document.createElement('div');\n parentNode.setAttribute(\n 'style',\n 'width: 500px;height:750px;display:flex;flex-direction:column'\n );\n const history = (await fixture(def, { parentNode })) as ContactHistory;\n\n // let history fetch start and wait for it\n await waitFor(0);\n await history.httpComplete;\n\n // wait for scroll update\n await waitFor(0);\n await history.httpComplete;\n\n return history;\n};\n\nconst getHistoryHTML = (attrs: any = {}) =>\n getHTML('temba-contact-history', attrs);\n\nconst getHistoryClip = (ele: ContactHistory) => {\n const clip = getClip(ele);\n clip.height = Math.min(clip.height, 750);\n clip.bottom = clip.top + clip.height;\n return clip;\n};\n\n// stub our current date for consistent screenshots\nsinon.stub(stubbable, 'getCurrentDate').callsFake(() => {\n return new Date('2021-03-31T00:00:00.000-00:00');\n});\n\ndescribe('temba-contact-history', () => {\n beforeEach(() => {\n mockGET(\n /\\/contact\\/history\\/1234\\/.*/,\n '/test-assets/contacts/history.json'\n );\n\n mockGET(\n /\\/api\\/v2\\/tickets\\.json\\?contact=1234/,\n '/test-assets/api/tickets.json'\n );\n });\n\n it('can be created', async () => {\n const history = await createHistory(getHistoryHTML());\n assert.instanceOf(history, ContactHistory);\n });\n\n it('renders history', async () => {\n const history = await createHistory(\n getHistoryHTML({\n uuid: '1234',\n })\n );\n\n await waitFor(500);\n\n // we should have scrolled to the bottom\n const events = history.shadowRoot.querySelector('.events');\n const top = events.scrollHeight - events.getBoundingClientRect().height;\n expect(top).to.equal(308);\n\n // make sure we actually scrolled to there\n expect(events.scrollTop).to.equal(top);\n\n await assertScreenshot('contacts/history', getHistoryClip(history));\n });\n\n it('expands event groups', async () => {\n const history = await createHistory(\n getHistoryHTML({\n uuid: '1234',\n })\n );\n\n // our groups with collapsed events\n const groups = [3, 11];\n for (const idx of groups) {\n const group = history.shadowRoot.querySelector(\n `[data-group-index='${idx}']`\n ) as HTMLDivElement;\n group.click();\n }\n\n await assertScreenshot(\n 'contacts/history-expanded',\n getHistoryClip(history)\n );\n });\n});\n"]}
1
+ {"version":3,"file":"temba-contact-history.test.js","sourceRoot":"","sources":["../../test/temba-contact-history.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjD,UAAU,CAAC,YAAY,CACrB,OAAO,EACP,8DAA8D,CAC/D,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAmB,CAAC;IAEvE,0CAA0C;IAC1C,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,OAAO,CAAC,YAAY,CAAC;IAE3B,yBAAyB;IACzB,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,OAAO,CAAC,YAAY,CAAC;IAE3B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,QAAa,EAAE,EAAE,EAAE,CACzC,OAAO,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;AAE1C,MAAM,cAAc,GAAG,CAAC,GAAmB,EAAE,EAAE;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAA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C,CAAC;QAE1B,0CAA0C;QAC1C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAE3C,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,OAAO,GAAG,MAAM,aAAa,CACjC,cAAc,CAAC;YACb,IAAI,EAAE,MAAM;SACb,CAAC,CACH,CAAC;QAEF,mCAAmC;QACnC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAC5C,sBAAsB,GAAG,IAAI,CACZ,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,CAAC;SACf;QAED,MAAM,gBAAgB,CACpB,2BAA2B,EAC3B,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, assert, expect } from '@open-wc/testing';\nimport sinon from 'sinon';\nimport { ContactHistory } from '../src/contacts/ContactHistory';\nimport { stubbable } from '../src/utils';\nimport {\n assertScreenshot,\n getClip,\n getHTML,\n mockGET,\n} from '../test/utils.test';\nimport './utils.test';\n\nexport const createHistory = async (def: string) => {\n const parentNode = document.createElement('div');\n parentNode.setAttribute(\n 'style',\n 'width: 500px;height:750px;display:flex;flex-direction:column'\n );\n const history = (await fixture(def, { parentNode })) as ContactHistory;\n\n // let history fetch start and wait for it\n await waitFor(0);\n await history.httpComplete;\n\n // wait for scroll update\n await waitFor(0);\n await history.httpComplete;\n\n return history;\n};\n\nconst getHistoryHTML = (attrs: any = {}) =>\n getHTML('temba-contact-history', attrs);\n\nconst getHistoryClip = (ele: ContactHistory) => {\n const clip = getClip(ele);\n clip.height = Math.min(clip.height, 750);\n clip.bottom = clip.top + clip.height;\n return clip;\n};\n\n// stub our current date for consistent screenshots\nsinon.stub(stubbable, 'getCurrentDate').callsFake(() => {\n return new Date('2021-03-31T00:00:00.000-00:00');\n});\n\ndescribe('temba-contact-history', () => {\n beforeEach(() => {\n mockGET(\n /\\/contact\\/history\\/1234\\/.*/,\n '/test-assets/contacts/history.json'\n );\n\n mockGET(\n /\\/api\\/v2\\/tickets\\.json\\?contact=1234/,\n '/test-assets/api/tickets.json'\n );\n });\n\n it('can be created', async () => {\n const history = await createHistory(getHistoryHTML());\n assert.instanceOf(history, ContactHistory);\n });\n\n it('renders history', async () => {\n const history = await createHistory(\n getHistoryHTML({\n uuid: '1234',\n })\n );\n\n await waitFor(500);\n\n // we should have scrolled to the bottom\n const events = history.shadowRoot.querySelector('.events');\n const top = events.scrollHeight - events.getBoundingClientRect().height;\n expect(top).to.equal(218);\n\n // make sure we actually scrolled to there\n expect(events.scrollTop).to.equal(top - 1);\n\n await assertScreenshot('contacts/history', getHistoryClip(history));\n });\n\n it('expands event groups', async () => {\n const history = await createHistory(\n getHistoryHTML({\n uuid: '1234',\n })\n );\n\n // our groups with collapsed events\n const groups = [3, 11];\n for (const idx of groups) {\n const group = history.shadowRoot.querySelector(\n `[data-group-index='${idx}']`\n ) as HTMLDivElement;\n group.click();\n }\n\n await assertScreenshot(\n 'contacts/history-expanded',\n getHistoryClip(history)\n );\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyaruka/temba-components",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Web components to support rapidpro and related projects",
5
5
  "author": "Nyaruka <code@nyaruka.coim>",
6
6
  "main": "dist/index.js",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -31,6 +31,7 @@ export class Button extends LitElement {
31
31
  }
32
32
 
33
33
  .button-name {
34
+ white-space: nowrap;
34
35
  }
35
36
 
36
37
  .secondary-button:hover .button-mask {