@nyaruka/temba-components 0.113.0 → 0.114.1

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 (130) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/demo/index.html +1 -1
  3. package/dist/temba-components.js +793 -966
  4. package/dist/temba-components.js.map +1 -1
  5. package/out-tsc/src/aliaseditor/AliasEditor.js.map +1 -1
  6. package/out-tsc/src/button/Button.js +6 -2
  7. package/out-tsc/src/button/Button.js.map +1 -1
  8. package/out-tsc/src/chat/Chat.js +29 -7
  9. package/out-tsc/src/chat/Chat.js.map +1 -1
  10. package/out-tsc/src/compose/Compose.js +10 -5
  11. package/out-tsc/src/compose/Compose.js.map +1 -1
  12. package/out-tsc/src/contacts/ContactChat.js +240 -114
  13. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  14. package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
  15. package/out-tsc/src/contacts/events.js.map +1 -1
  16. package/out-tsc/src/contacts/helpers.js +5 -1
  17. package/out-tsc/src/contacts/helpers.js.map +1 -1
  18. package/out-tsc/src/contactsearch/ContactSearch.js +1 -1
  19. package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
  20. package/out-tsc/src/dropdown/Dropdown.js +121 -108
  21. package/out-tsc/src/dropdown/Dropdown.js.map +1 -1
  22. package/out-tsc/src/interfaces.js +2 -0
  23. package/out-tsc/src/interfaces.js.map +1 -1
  24. package/out-tsc/src/list/ContentMenu.js +11 -8
  25. package/out-tsc/src/list/ContentMenu.js.map +1 -1
  26. package/out-tsc/src/list/RunList.js.map +1 -1
  27. package/out-tsc/src/list/TembaList.js +21 -14
  28. package/out-tsc/src/list/TembaList.js.map +1 -1
  29. package/out-tsc/src/list/TembaMenu.js +11 -12
  30. package/out-tsc/src/list/TembaMenu.js.map +1 -1
  31. package/out-tsc/src/list/TicketList.js +10 -0
  32. package/out-tsc/src/list/TicketList.js.map +1 -1
  33. package/out-tsc/src/omnibox/Omnibox.js +33 -90
  34. package/out-tsc/src/omnibox/Omnibox.js.map +1 -1
  35. package/out-tsc/src/options/Options.js +49 -47
  36. package/out-tsc/src/options/Options.js.map +1 -1
  37. package/out-tsc/src/select/PopupSelect.js +57 -0
  38. package/out-tsc/src/select/PopupSelect.js.map +1 -0
  39. package/out-tsc/src/select/Select.js +194 -144
  40. package/out-tsc/src/select/Select.js.map +1 -1
  41. package/out-tsc/src/select/UserSelect.js +67 -0
  42. package/out-tsc/src/select/UserSelect.js.map +1 -0
  43. package/out-tsc/src/store/Store.js +65 -14
  44. package/out-tsc/src/store/Store.js.map +1 -1
  45. package/out-tsc/src/tabpane/TabPane.js +72 -115
  46. package/out-tsc/src/tabpane/TabPane.js.map +1 -1
  47. package/out-tsc/src/textinput/TextInput.js +1 -0
  48. package/out-tsc/src/textinput/TextInput.js.map +1 -1
  49. package/out-tsc/src/user/TembaUser.js +24 -37
  50. package/out-tsc/src/user/TembaUser.js.map +1 -1
  51. package/out-tsc/src/utils/index.js +13 -6
  52. package/out-tsc/src/utils/index.js.map +1 -1
  53. package/out-tsc/temba-modules.js +4 -2
  54. package/out-tsc/temba-modules.js.map +1 -1
  55. package/out-tsc/test/temba-omnibox.test.js +43 -4
  56. package/out-tsc/test/temba-omnibox.test.js.map +1 -1
  57. package/out-tsc/test/temba-select.test.js +121 -65
  58. package/out-tsc/test/temba-select.test.js.map +1 -1
  59. package/out-tsc/test/utils.test.js +4 -0
  60. package/out-tsc/test/utils.test.js.map +1 -1
  61. package/package.json +1 -1
  62. package/screenshots/truth/compose/attachments-tab.png +0 -0
  63. package/screenshots/truth/compose/attachments-with-files-focused.png +0 -0
  64. package/screenshots/truth/compose/attachments-with-files.png +0 -0
  65. package/screenshots/truth/compose/intial-text.png +0 -0
  66. package/screenshots/truth/compose/no-counter.png +0 -0
  67. package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
  68. package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
  69. package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
  70. package/screenshots/truth/contacts/chat-failure.png +0 -0
  71. package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
  72. package/screenshots/truth/contacts/chat-for-archived-contact.png +0 -0
  73. package/screenshots/truth/contacts/chat-for-blocked-contact.png +0 -0
  74. package/screenshots/truth/contacts/chat-for-stopped-contact.png +0 -0
  75. package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
  76. package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
  77. package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
  78. package/screenshots/truth/content-menu/item-no-buttons.png +0 -0
  79. package/screenshots/truth/content-menu/items-and-buttons.png +0 -0
  80. package/screenshots/truth/omnibox/selected.png +0 -0
  81. package/screenshots/truth/select/enabled-multi-selection.png +0 -0
  82. package/screenshots/truth/select/endpoint-initial-value-updated.png +0 -0
  83. package/screenshots/truth/select/endpoint-initial-value.png +0 -0
  84. package/screenshots/truth/select/expressions.png +0 -0
  85. package/screenshots/truth/select/functions.png +0 -0
  86. package/screenshots/truth/select/initial-value.png +0 -0
  87. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  88. package/screenshots/truth/select/multiple-initial-values.png +0 -0
  89. package/screenshots/truth/select/selected-multi-test.png +0 -0
  90. package/screenshots/truth/select/static-initial-value.png +0 -0
  91. package/screenshots/truth/select/static-initial-via-selected.png +0 -0
  92. package/screenshots/truth/select/value-initial.png +0 -0
  93. package/src/aliaseditor/AliasEditor.ts +1 -1
  94. package/src/button/Button.ts +6 -2
  95. package/src/chat/Chat.ts +28 -6
  96. package/src/compose/Compose.ts +11 -6
  97. package/src/contacts/ContactChat.ts +260 -118
  98. package/src/contacts/ContactFieldEditor.ts +1 -1
  99. package/src/contacts/events.ts +1 -0
  100. package/src/contacts/helpers.ts +8 -1
  101. package/src/contactsearch/ContactSearch.ts +3 -3
  102. package/src/dropdown/Dropdown.ts +142 -103
  103. package/src/interfaces.ts +4 -1
  104. package/src/list/ContentMenu.ts +11 -9
  105. package/src/list/RunList.ts +3 -1
  106. package/src/list/TembaList.ts +24 -14
  107. package/src/list/TembaMenu.ts +14 -15
  108. package/src/list/TicketList.ts +11 -0
  109. package/src/omnibox/Omnibox.ts +34 -95
  110. package/src/options/Options.ts +57 -60
  111. package/src/select/PopupSelect.ts +53 -0
  112. package/src/select/Select.ts +182 -112
  113. package/src/select/UserSelect.ts +71 -0
  114. package/src/store/Store.ts +72 -21
  115. package/src/tabpane/TabPane.ts +79 -113
  116. package/src/textinput/TextInput.ts +1 -0
  117. package/src/user/TembaUser.ts +30 -41
  118. package/src/utils/index.ts +12 -8
  119. package/temba-modules.ts +4 -2
  120. package/test/temba-omnibox.test.ts +56 -4
  121. package/test/temba-select.test.ts +170 -56
  122. package/test/utils.test.ts +5 -0
  123. package/test-assets/select/omnibox.json +55 -0
  124. package/web-test-runner.config.mjs +16 -4
  125. package/out-tsc/src/contacts/ContactTickets.js +0 -462
  126. package/out-tsc/src/contacts/ContactTickets.js.map +0 -1
  127. package/out-tsc/test/temba-contact-tickets.test.js +0 -36
  128. package/out-tsc/test/temba-contact-tickets.test.js.map +0 -1
  129. package/src/contacts/ContactTickets.ts +0 -490
  130. package/test/temba-contact-tickets.test.ts +0 -52
@@ -1 +1 @@
1
- {"version":3,"file":"ContactSearch.js","sourceRoot":"","sources":["../../../src/contactsearch/ContactSearch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAoB,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAExE,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAW,eAAe,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAA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B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAChB;AAGX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDACF;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACpB;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACnC;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;iDACI;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACV;AAcV;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACJ","sourcesContent":["import { TemplateResult, html, css, PropertyValueMap } from 'lit';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport { property } from 'lit/decorators.js';\nimport { getClasses, postJSON, stopEvent, WebResponse } from '../utils';\nimport { TextInput } from '../textinput/TextInput';\nimport '../alert/Alert';\nimport { Contact, CustomEventType } from '../interfaces';\nimport { FormElement } from '../FormElement';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { msg } from '@lit/localize';\nimport { OmniOption } from '../omnibox/Omnibox';\nimport { Select } from '../select/Select';\n\nconst QUEIT_MILLIS = 2000;\n\ninterface SummaryResponse {\n total: number;\n sample: Contact[];\n query: string;\n fields: { [uuid: string]: { label: string; type: string } };\n error?: string;\n warnings: string[];\n blockers: string[];\n}\n\nexport class ContactSearch extends FormElement {\n static get styles() {\n return css`\n :host {\n color: var(--color-text);\n }\n\n .urn {\n width: 120px;\n }\n\n .name {\n width: 160px;\n }\n\n .date {\n text-align: right;\n }\n\n .field-header {\n font-size: 80%;\n color: var(--color-text-dark);\n }\n\n .field-header.date {\n text-align: right;\n }\n\n .more {\n font-size: 90%;\n padding-top: 5px;\n padding-right: 3px;\n text-align: right;\n width: 100px;\n vertical-align: top;\n }\n\n table {\n width: 100%;\n }\n\n .contact td {\n border-bottom: 1px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .table-footer td {\n padding: 10px 3px;\n }\n\n .query-replaced,\n .count-replaced {\n display: inline-block;\n background: var(--color-primary-light);\n color: var(--color-text-dark);\n padding: 3px 6px;\n border-radius: var(--curvature);\n font-size: 85%;\n margin: 0px 3px;\n }\n\n temba-loading {\n transform: scale(0);\n max-width: 0;\n opacity: 0;\n transition: transform 200ms ease-in-out;\n }\n\n .fetching temba-loading {\n transform: scale(1);\n max-width: 500px;\n opacity: 1;\n display: block;\n }\n\n .error {\n margin-top: 10px;\n }\n\n .match-count {\n padding: 4px;\n margin-top: 6px;\n }\n\n .linked {\n color: var(--color-link-primary);\n text-decoration: none;\n cursor: pointer;\n }\n\n .header td {\n border-bottom: 0px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .expanded .header td {\n border-bottom: 2px solid var(--color-borders);\n }\n\n td.field-header,\n tr.table-footer,\n tr.contact {\n display: none;\n }\n\n .expanded td.field-header {\n display: table-cell;\n }\n\n .expanded tr.contact,\n .expanded tr.table-footer {\n display: table-row;\n }\n\n .query {\n display: var(--contact-search-query-display);\n margin-bottom: 10px;\n }\n\n .results {\n display: none;\n }\n\n .summary {\n min-height: 2.2em;\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n\n .summary .result-count {\n flex-grow: 1;\n }\n\n .results.empty {\n display: none !important;\n }\n\n .results.initialized {\n display: flex;\n align-items: center;\n margin-top: 0.5em;\n margin-left: 0.6em;\n }\n\n .advanced-icon {\n cursor: pointer;\n margin-right: 0.5em;\n }\n\n .query .advanced-icon {\n margin-top: 1em;\n margin-right: 1em;\n }\n\n .advanced-icon:hover {\n --icon-color: var(--color-link-primary-hover) !important;\n }\n\n .query {\n --textarea-height: 5em;\n }\n\n #recipients {\n margin-bottom: 1em;\n display: block;\n }\n\n temba-alert {\n margin: 1em 0;\n }\n\n temba-select[name='not_seen_since_days'] {\n margin-bottom: 1em;\n display: block;\n }\n\n .activity-select {\n display: flex;\n align-items: center;\n padding: var(--checkbox-padding, 10px);\n border-radius: var(--curvature);\n cursor: pointer;\n }\n\n .activity-select:hover {\n background: #f9f9f9;\n }\n\n .small-select {\n --temba-select-selected-padding: 0px 0.5em;\n --temba-select-selected-line-height: 1em;\n --temba-select-selected-font-size: 1em;\n --search-input-height: 0px !important;\n --temba-select-min-height: 1.8em;\n min-width: 100px;\n }\n\n .filters {\n padding: 1em;\n border: 1px solid var(--color-borders);\n border-radius: var(--curvature);\n }\n `;\n }\n\n @property({ type: Boolean })\n in_a_flow: boolean;\n\n @property({ type: Boolean })\n started_previously: boolean;\n\n @property({ type: Boolean })\n not_seen_since_days: boolean;\n\n @property({ type: Boolean })\n fetching: boolean;\n\n @property({ type: Boolean })\n expanded: boolean;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: String })\n query = '';\n\n @property({ type: Number })\n inactiveThreshold = 1000;\n\n @property({ type: Number })\n inactiveDays = 90;\n\n @property({ type: Object, attribute: false })\n summary: SummaryResponse;\n\n @property({ type: Object, attribute: false })\n flow: any;\n\n @property({ type: Array })\n recipients: OmniOption[] = [];\n\n @property({ type: Boolean })\n advanced = false;\n\n @property({ type: String })\n refreshKey = '0';\n\n public refresh(): void {\n if (this.advanced || this.recipients.length > 0) {\n this.refreshKey = 'requested_' + new Date().getTime();\n } else {\n this.summary = null;\n this.fetching = false;\n this.requestUpdate();\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n }\n }\n\n @property({ type: Object })\n public exclusions = {};\n\n private lastQuery: number;\n private initialized = false;\n\n public firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changes);\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('recipients')) {\n this.handleRecipientsChanged();\n }\n\n // if we remove the in_a_flow option, make sure it's not part of our exclusions\n if (changedProperties.has('in_a_flow') && !this.in_a_flow) {\n delete this.exclusions['in_a_flow'];\n this.requestUpdate('exclusions');\n }\n\n if (\n (changedProperties.has('query') && this.advanced) ||\n (changedProperties.has('refreshKey') && this.refreshKey !== '0')\n ) {\n this.summary = null;\n // this.errors = [];\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n if (this.lastQuery) {\n window.clearTimeout(this.lastQuery);\n this.fetching = false;\n }\n\n if (this.query.trim().length > 0 || this.recipients.length > 0) {\n this.fetching = true;\n this.lastQuery = window.setTimeout(() => {\n this.fetchSummary();\n }, QUEIT_MILLIS);\n }\n }\n }\n\n public fetchSummary(): any {\n if (this.endpoint) {\n const group_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'group')\n .map((value: OmniOption) => value.id);\n\n const contact_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'contact')\n .map((value: OmniOption) => value.id);\n\n postJSON(this.endpoint, {\n include: this.advanced\n ? { query: this.query }\n : { contact_uuids, group_uuids },\n\n exclude: this.exclusions\n }).then((response: WebResponse) => {\n this.fetching = false;\n this.initialized = true;\n if (this.recipients.length == 0 && !this.advanced) {\n return;\n }\n if (response.status === 200) {\n this.summary = response.json as SummaryResponse;\n if (!this.advanced) {\n this.query = this.summary.query;\n }\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n\n if (this.summary.error) {\n this.errors = [this.summary.error];\n } else {\n this.errors = [];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n } else {\n this.summary = response.json as SummaryResponse;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n }\n });\n }\n }\n\n private handleAdvancedToggle(evt: MouseEvent) {\n stopEvent(evt);\n this.recipients = [];\n this.exclusions = {};\n if (this.advanced) {\n this.query = '';\n this.value = null;\n }\n this.advanced = !this.advanced;\n\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n }\n\n private handleQueryChange(evt: KeyboardEvent) {\n const input = evt.target as TextInput;\n this.query = input.inputElement.value;\n }\n\n private handleRecipientsChanged() {\n if (!this.endpoint) {\n return;\n }\n\n if (this.recipients && (this.refreshKey !== '0' || this.initialized)) {\n this.refresh();\n } else {\n this.initialized = true;\n }\n }\n\n private handleActivityLevelChanged(evt: any) {\n const select = evt.target as Select;\n const option = select.values[0];\n if (option) {\n if (this.exclusions['not_seen_since_days']) {\n this.exclusions['not_seen_since_days'] = parseInt(option.value);\n this.refresh();\n }\n }\n }\n\n private handleActivityLabelClicked(evt: any) {\n if (\n evt.target &&\n evt.target.tagName !== 'TEMBA-CHECKBOX' &&\n evt.target.tagName !== 'TEMBA-SELECT' &&\n !evt.target.disabled\n ) {\n const checkbox = evt.currentTarget.querySelector('temba-checkbox');\n checkbox.checked = !checkbox.checked;\n }\n }\n\n private handleExclusionChanged(evt: any) {\n if (evt.target.tagName === 'TEMBA-CHECKBOX') {\n const ex = JSON.stringify(this.exclusions);\n const checkbox = evt.target as Checkbox;\n let value = checkbox.checked as any;\n\n // if we check the activity box, look inside the select for the value\n if (checkbox.name === 'not_seen_since_days' && value) {\n const select = checkbox.parentElement.querySelector(\n 'temba-select'\n ) as Select;\n if (select.values[0]) {\n value = parseInt(select.values[0].value);\n } else {\n value = this.exclusions[checkbox.name];\n }\n }\n\n if (!value) {\n delete this.exclusions[checkbox.name];\n } else {\n this.exclusions[checkbox.name] = value;\n }\n\n if (ex !== JSON.stringify(this.exclusions) && this.endpoint) {\n this.refresh();\n }\n }\n }\n\n public render(): TemplateResult {\n let summary: TemplateResult;\n if (this.summary) {\n if (!this.summary.error) {\n const count = this.summary.total || 0;\n\n summary = html`\n <div class=\"result-count\">\n Found\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(this.summary.query)}\"\n >\n ${count.toLocaleString()}\n </a>\n contact${count !== 1 ? 's' : ''}\n </div>\n <temba-button\n class=\"edit\"\n name=\"edit\"\n secondary\n small\n @click=${this.handleAdvancedToggle}\n >\n <div slot=\"name\">\n <div style=\"display: flex; align-items: center;\">\n ${this.advanced\n ? html` <temba-icon\n name=\"reset\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Start Over`\n : html` <temba-icon\n name=\"edit\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Edit Query`}\n </div>\n </div>\n </temba-button>\n `;\n }\n }\n\n const notSeenSinceDays = this.exclusions['not_seen_since_days'];\n let blockers = null;\n\n if (\n this.summary &&\n this.summary.blockers &&\n this.summary.blockers.length > 0\n ) {\n blockers = html`${this.summary.blockers.map(\n (error) =>\n html`<temba-alert level=\"error\">${unsafeHTML(error)}</temba-alert>`\n )}`;\n }\n\n return html`\n ${\n this.advanced\n ? html`<div class=\"query\">\n <temba-textinput\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n .errors=${this.errors}\n name=${this.name}\n .inputRoot=${this}\n @input=${this.handleQueryChange}\n placeholder=${this.placeholder}\n .value=${this.query}\n textarea\n autogrow\n >\n </temba-textinput>\n </div>`\n : html`<temba-omnibox\n placeholder=\"Search for contacts or groups\"\n widget_only=\"\"\n groups=\"\"\n contacts=\"\"\n label=\"Recipients\"\n help_text=\"The contacts to send the message to.\"\n .errors=${this.errors}\n id=\"recipients\"\n name=\"recipients\"\n .value=${this.recipients}\n endpoint=\"/contact/omnibox/?\"\n @change=${this.handleRecipientsChanged}\n >\n </temba-omnibox>\n\n ${this.not_seen_since_days ||\n this.in_a_flow ||\n this.started_previously\n ? html`\n <div class=\"filters\">\n <div\n style=\"display:flex;font-size:1em;margin-bottom:0.5em\"\n >\n <temba-icon size=\"1\" name=\"filter\"></temba-icon>\n <div style=\"margin-left:0.5em\">\n Only include contacts who...\n </div>\n </div>\n ${this.in_a_flow\n ? html`<temba-checkbox\n name=\"in_a_flow\"\n label=\"${msg('Are not currently in a flow')}\"\n ?checked=${this.exclusions['in_a_flow']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n ${this.not_seen_since_days\n ? html`\n <div\n class=\"activity-select\"\n @click=${this.handleActivityLabelClicked}\n >\n <temba-checkbox\n style=\"display:inline;\"\n name=\"not_seen_since_days\"\n ?checked=${notSeenSinceDays}\n @change=${this.handleExclusionChanged}\n >\n </temba-checkbox>\n\n <div style=\"margin-left:0.5em\">\n ${msg('Have sent a message in the last')}\n </div>\n\n <temba-select\n style=\"margin-left:0.5em\"\n class=\"small-select\"\n @change=${this.handleActivityLevelChanged}\n ?disabled=${!notSeenSinceDays}\n >\n <temba-option\n name=\"90 days\"\n value=\"90\"\n ?selected=${notSeenSinceDays === 90}\n ></temba-option>\n <temba-option\n name=\"180 days\"\n value=\"180\"\n ?selected=${notSeenSinceDays === 180}\n ></temba-option>\n <temba-option\n name=\"Year\"\n value=\"365\"\n ?selected=${notSeenSinceDays === 365}\n ></temba-option>\n </temba-select>\n <div></div>\n </div>\n `\n : null}\n ${this.started_previously\n ? html`<temba-checkbox\n name=\"started_previously\"\n label=\"${msg(\n 'Have not started this flow in the last 90 days'\n )}\"\n ?checked=${this.exclusions['started_previously']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n </div>\n `\n : null} `\n }\n </div>\n <div\n class=\"results ${getClasses({\n fetching: this.fetching,\n initialized: this.initialized || this.fetching,\n empty:\n ((this.summary && this.summary.error) || !this.summary) &&\n !this.fetching\n })}\"\n >\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n <div class=\"summary ${this.expanded ? 'expanded' : ''}\">${summary}</div>\n </div>\n ${blockers}\n ${\n !blockers && this.summary && this.summary.warnings\n ? this.summary.warnings.map(\n (warning) =>\n html`<temba-alert level=\"warning\"\n >${unsafeHTML(warning)}</temba-alert\n >`\n )\n : ``\n }\n\n\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"ContactSearch.js","sourceRoot":"","sources":["../../../src/contactsearch/ContactSearch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAoB,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAExE,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAW,eAAe,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,MAAM,YAAY,GAAG,IAAI,CAAC;AAY1B,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QAiOE,gBAAW,GAAG,EAAE,CAAC;QAGjB,SAAI,GAAG,EAAE,CAAC;QAGV,UAAK,GAAG,EAAE,CAAC;QAGX,sBAAiB,GAAG,IAAI,CAAC;QAGzB,iBAAY,GAAG,EAAE,CAAC;QASlB,eAAU,GAAiB,EAAE,CAAC;QAG9B,aAAQ,GAAG,KAAK,CAAC;QAGjB,eAAU,G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EAAE,CAAC;wDACF;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACpB;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACnC;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;iDACI;AAG9B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACV;AAcV;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACJ","sourcesContent":["import { TemplateResult, html, css, PropertyValueMap } from 'lit';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport { property } from 'lit/decorators.js';\nimport { getClasses, postJSON, stopEvent, WebResponse } from '../utils';\nimport { TextInput } from '../textinput/TextInput';\nimport '../alert/Alert';\nimport { Contact, CustomEventType } from '../interfaces';\nimport { FormElement } from '../FormElement';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { msg } from '@lit/localize';\nimport { OmniOption } from '../omnibox/Omnibox';\nimport { Select } from '../select/Select';\n\nconst QUEIT_MILLIS = 2000;\n\ninterface SummaryResponse {\n total: number;\n sample: Contact[];\n query: string;\n fields: { [uuid: string]: { label: string; type: string } };\n error?: string;\n warnings: string[];\n blockers: string[];\n}\n\nexport class ContactSearch extends FormElement {\n static get styles() {\n return css`\n :host {\n color: var(--color-text);\n }\n\n .urn {\n width: 120px;\n }\n\n .name {\n width: 160px;\n }\n\n .date {\n text-align: right;\n }\n\n .field-header {\n font-size: 80%;\n color: var(--color-text-dark);\n }\n\n .field-header.date {\n text-align: right;\n }\n\n .more {\n font-size: 90%;\n padding-top: 5px;\n padding-right: 3px;\n text-align: right;\n width: 100px;\n vertical-align: top;\n }\n\n table {\n width: 100%;\n }\n\n .contact td {\n border-bottom: 1px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .table-footer td {\n padding: 10px 3px;\n }\n\n .query-replaced,\n .count-replaced {\n display: inline-block;\n background: var(--color-primary-light);\n color: var(--color-text-dark);\n padding: 3px 6px;\n border-radius: var(--curvature);\n font-size: 85%;\n margin: 0px 3px;\n }\n\n temba-loading {\n transform: scale(0);\n max-width: 0;\n opacity: 0;\n transition: transform 200ms ease-in-out;\n }\n\n .fetching temba-loading {\n transform: scale(1);\n max-width: 500px;\n opacity: 1;\n display: block;\n }\n\n .error {\n margin-top: 10px;\n }\n\n .match-count {\n padding: 4px;\n margin-top: 6px;\n }\n\n .linked {\n color: var(--color-link-primary);\n text-decoration: none;\n cursor: pointer;\n }\n\n .header td {\n border-bottom: 0px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .expanded .header td {\n border-bottom: 2px solid var(--color-borders);\n }\n\n td.field-header,\n tr.table-footer,\n tr.contact {\n display: none;\n }\n\n .expanded td.field-header {\n display: table-cell;\n }\n\n .expanded tr.contact,\n .expanded tr.table-footer {\n display: table-row;\n }\n\n .query {\n display: var(--contact-search-query-display);\n margin-bottom: 10px;\n }\n\n .results {\n display: none;\n }\n\n .summary {\n min-height: 2.2em;\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n\n .summary .result-count {\n flex-grow: 1;\n }\n\n .results.empty {\n display: none !important;\n }\n\n .results.initialized {\n display: flex;\n align-items: center;\n margin-top: 0.5em;\n margin-left: 0.6em;\n }\n\n .advanced-icon {\n cursor: pointer;\n margin-right: 0.5em;\n }\n\n .query .advanced-icon {\n margin-top: 1em;\n margin-right: 1em;\n }\n\n .advanced-icon:hover {\n --icon-color: var(--color-link-primary-hover) !important;\n }\n\n .query {\n --textarea-height: 5em;\n }\n\n #recipients {\n margin-bottom: 1em;\n display: block;\n }\n\n temba-alert {\n margin: 1em 0;\n }\n\n temba-select[name='not_seen_since_days'] {\n margin-bottom: 1em;\n display: block;\n }\n\n .activity-select {\n display: flex;\n align-items: center;\n padding: var(--checkbox-padding, 10px);\n border-radius: var(--curvature);\n cursor: pointer;\n }\n\n .activity-select:hover {\n background: #f9f9f9;\n }\n\n .small-select {\n --temba-select-selected-padding: 0px 0.5em;\n --temba-select-selected-line-height: 1em;\n --temba-select-selected-font-size: 1em;\n --search-input-height: 0px !important;\n --temba-select-min-height: 1.8em;\n min-width: 100px;\n }\n\n .filters {\n padding: 1em;\n border: 1px solid var(--color-borders);\n border-radius: var(--curvature);\n }\n `;\n }\n\n @property({ type: Boolean })\n in_a_flow: boolean;\n\n @property({ type: Boolean })\n started_previously: boolean;\n\n @property({ type: Boolean })\n not_seen_since_days: boolean;\n\n @property({ type: Boolean })\n fetching: boolean;\n\n @property({ type: Boolean })\n expanded: boolean;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: String })\n query = '';\n\n @property({ type: Number })\n inactiveThreshold = 1000;\n\n @property({ type: Number })\n inactiveDays = 90;\n\n @property({ type: Object, attribute: false })\n summary: SummaryResponse;\n\n @property({ type: Object, attribute: false })\n flow: any;\n\n @property({ type: Array })\n recipients: OmniOption[] = [];\n\n @property({ type: Boolean })\n advanced = false;\n\n @property({ type: String })\n refreshKey = '0';\n\n public refresh(): void {\n if (this.advanced || this.recipients.length > 0) {\n this.refreshKey = 'requested_' + new Date().getTime();\n } else {\n this.summary = null;\n this.fetching = false;\n this.requestUpdate();\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n }\n }\n\n @property({ type: Object })\n public exclusions = {};\n\n private lastQuery: number;\n private initialized = false;\n\n public firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changes);\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('recipients')) {\n this.handleRecipientsChanged();\n }\n\n // if we remove the in_a_flow option, make sure it's not part of our exclusions\n if (changedProperties.has('in_a_flow') && !this.in_a_flow) {\n delete this.exclusions['in_a_flow'];\n this.requestUpdate('exclusions');\n }\n\n if (\n (changedProperties.has('query') && this.advanced) ||\n (changedProperties.has('refreshKey') && this.refreshKey !== '0')\n ) {\n this.summary = null;\n // this.errors = [];\n this.fireCustomEvent(CustomEventType.ContentChanged, { reset: true });\n if (this.lastQuery) {\n window.clearTimeout(this.lastQuery);\n this.fetching = false;\n }\n\n if (this.query.trim().length > 0 || this.recipients.length > 0) {\n this.fetching = true;\n this.lastQuery = window.setTimeout(() => {\n this.fetchSummary();\n }, QUEIT_MILLIS);\n }\n }\n }\n\n public fetchSummary(): any {\n if (this.endpoint) {\n const group_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'group')\n .map((value: OmniOption) => value.id);\n\n const contact_uuids = this.recipients\n .filter((value: OmniOption) => value.type === 'contact')\n .map((value: OmniOption) => value.id);\n\n postJSON(this.endpoint, {\n include: this.advanced\n ? { query: this.query }\n : { contact_uuids, group_uuids },\n\n exclude: this.exclusions\n }).then((response: WebResponse) => {\n this.fetching = false;\n this.initialized = true;\n if (this.recipients.length == 0 && !this.advanced) {\n return;\n }\n if (response.status === 200) {\n this.summary = response.json as SummaryResponse;\n if (!this.advanced) {\n this.query = this.summary.query;\n }\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n\n if (this.summary.error) {\n this.errors = [this.summary.error];\n } else {\n this.errors = [];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n } else {\n this.summary = response.json as SummaryResponse;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n }\n });\n }\n }\n\n private handleAdvancedToggle(evt: MouseEvent) {\n stopEvent(evt);\n this.recipients = [];\n this.exclusions = {};\n if (this.advanced) {\n this.query = '';\n this.value = null;\n }\n this.advanced = !this.advanced;\n\n this.setValue({\n advanced: this.advanced,\n query: this.query,\n exclusions: this.exclusions,\n recipients: this.recipients\n });\n }\n\n private handleQueryChange(evt: KeyboardEvent) {\n const input = evt.target as TextInput;\n this.query = input.inputElement.value;\n }\n\n private handleRecipientsChanged() {\n if (!this.endpoint) {\n return;\n }\n\n if (this.recipients && (this.refreshKey !== '0' || this.initialized)) {\n this.refresh();\n } else {\n this.initialized = true;\n }\n }\n\n private handleActivityLevelChanged(evt: any) {\n const select = evt.target as Select<any>;\n const option = select.values[0];\n if (option) {\n if (this.exclusions['not_seen_since_days']) {\n this.exclusions['not_seen_since_days'] = parseInt(option.value);\n this.refresh();\n }\n }\n }\n\n private handleActivityLabelClicked(evt: any) {\n if (\n evt.target &&\n evt.target.tagName !== 'TEMBA-CHECKBOX' &&\n evt.target.tagName !== 'TEMBA-SELECT' &&\n !evt.target.disabled\n ) {\n const checkbox = evt.currentTarget.querySelector('temba-checkbox');\n checkbox.checked = !checkbox.checked;\n }\n }\n\n private handleExclusionChanged(evt: any) {\n if (evt.target.tagName === 'TEMBA-CHECKBOX') {\n const ex = JSON.stringify(this.exclusions);\n const checkbox = evt.target as Checkbox;\n let value = checkbox.checked as any;\n\n // if we check the activity box, look inside the select for the value\n if (checkbox.name === 'not_seen_since_days' && value) {\n const select = checkbox.parentElement.querySelector(\n 'temba-select'\n ) as Select<any>;\n if (select.values[0]) {\n value = parseInt(select.values[0].value);\n } else {\n value = this.exclusions[checkbox.name];\n }\n }\n\n if (!value) {\n delete this.exclusions[checkbox.name];\n } else {\n this.exclusions[checkbox.name] = value;\n }\n\n if (ex !== JSON.stringify(this.exclusions) && this.endpoint) {\n this.refresh();\n }\n }\n }\n\n public render(): TemplateResult {\n let summary: TemplateResult;\n if (this.summary) {\n if (!this.summary.error) {\n const count = this.summary.total || 0;\n\n summary = html`\n <div class=\"result-count\">\n Found\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(this.summary.query)}\"\n >\n ${count.toLocaleString()}\n </a>\n contact${count !== 1 ? 's' : ''}\n </div>\n <temba-button\n class=\"edit\"\n name=\"edit\"\n secondary\n small\n @click=${this.handleAdvancedToggle}\n >\n <div slot=\"name\">\n <div style=\"display: flex; align-items: center;\">\n ${this.advanced\n ? html` <temba-icon\n name=\"reset\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Start Over`\n : html` <temba-icon\n name=\"edit\"\n style=\"margin-right:0.5em\"\n ></temba-icon>\n Edit Query`}\n </div>\n </div>\n </temba-button>\n `;\n }\n }\n\n const notSeenSinceDays = this.exclusions['not_seen_since_days'];\n let blockers = null;\n\n if (\n this.summary &&\n this.summary.blockers &&\n this.summary.blockers.length > 0\n ) {\n blockers = html`${this.summary.blockers.map(\n (error) =>\n html`<temba-alert level=\"error\">${unsafeHTML(error)}</temba-alert>`\n )}`;\n }\n\n return html`\n ${\n this.advanced\n ? html`<div class=\"query\">\n <temba-textinput\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n .errors=${this.errors}\n name=${this.name}\n .inputRoot=${this}\n @input=${this.handleQueryChange}\n placeholder=${this.placeholder}\n .value=${this.query}\n textarea\n autogrow\n >\n </temba-textinput>\n </div>`\n : html`<temba-omnibox\n placeholder=\"Search for contacts or groups\"\n widget_only=\"\"\n groups=\"\"\n contacts=\"\"\n label=\"Recipients\"\n help_text=\"The contacts to send the message to.\"\n .errors=${this.errors}\n id=\"recipients\"\n name=\"recipients\"\n .values=${this.recipients}\n endpoint=\"/contact/omnibox/?\"\n @change=${this.handleRecipientsChanged}\n >\n </temba-omnibox>\n\n ${this.not_seen_since_days ||\n this.in_a_flow ||\n this.started_previously\n ? html`\n <div class=\"filters\">\n <div\n style=\"display:flex;font-size:1em;margin-bottom:0.5em\"\n >\n <temba-icon size=\"1\" name=\"filter\"></temba-icon>\n <div style=\"margin-left:0.5em\">\n Only include contacts who...\n </div>\n </div>\n ${this.in_a_flow\n ? html`<temba-checkbox\n name=\"in_a_flow\"\n label=\"${msg('Are not currently in a flow')}\"\n ?checked=${this.exclusions['in_a_flow']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n ${this.not_seen_since_days\n ? html`\n <div\n class=\"activity-select\"\n @click=${this.handleActivityLabelClicked}\n >\n <temba-checkbox\n style=\"display:inline;\"\n name=\"not_seen_since_days\"\n ?checked=${notSeenSinceDays}\n @change=${this.handleExclusionChanged}\n >\n </temba-checkbox>\n\n <div style=\"margin-left:0.5em\">\n ${msg('Have sent a message in the last')}\n </div>\n\n <temba-select\n style=\"margin-left:0.5em\"\n class=\"small-select\"\n @change=${this.handleActivityLevelChanged}\n ?disabled=${!notSeenSinceDays}\n >\n <temba-option\n name=\"90 days\"\n value=\"90\"\n ?selected=${notSeenSinceDays === 90}\n ></temba-option>\n <temba-option\n name=\"180 days\"\n value=\"180\"\n ?selected=${notSeenSinceDays === 180}\n ></temba-option>\n <temba-option\n name=\"Year\"\n value=\"365\"\n ?selected=${notSeenSinceDays === 365}\n ></temba-option>\n </temba-select>\n <div></div>\n </div>\n `\n : null}\n ${this.started_previously\n ? html`<temba-checkbox\n name=\"started_previously\"\n label=\"${msg(\n 'Have not started this flow in the last 90 days'\n )}\"\n ?checked=${this.exclusions['started_previously']}\n @change=${this.handleExclusionChanged}\n ></temba-checkbox>`\n : null}\n </div>\n `\n : null} `\n }\n </div>\n <div\n class=\"results ${getClasses({\n fetching: this.fetching,\n initialized: this.initialized || this.fetching,\n empty:\n ((this.summary && this.summary.error) || !this.summary) &&\n !this.fetching\n })}\"\n >\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n <div class=\"summary ${this.expanded ? 'expanded' : ''}\">${summary}</div>\n </div>\n ${blockers}\n ${\n !blockers && this.summary && this.summary.warnings\n ? this.summary.warnings.map(\n (warning) =>\n html`<temba-alert level=\"warning\"\n >${unsafeHTML(warning)}</temba-alert\n >`\n )\n : ``\n }\n\n\n `;\n }\n}\n"]}
@@ -3,9 +3,14 @@ import { css, html } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
4
  import { RapidElement } from '../RapidElement';
5
5
  import { getClasses } from '../utils';
6
+ import { CustomEventType } from '../interfaces';
7
+ import { styleMap } from 'lit-html/directives/style-map.js';
6
8
  export class Dropdown extends RapidElement {
7
9
  static get styles() {
8
10
  return css `
11
+ :host {
12
+ }
13
+
9
14
  .wrapper {
10
15
  position: relative;
11
16
  }
@@ -19,15 +24,20 @@ export class Dropdown extends RapidElement {
19
24
  overflow: auto;
20
25
  }
21
26
 
27
+ .dropdown:focus {
28
+ }
29
+
30
+ .dropdown.dormant {
31
+ pointer-events: none;
32
+ }
33
+
22
34
  .dropdown {
23
- position: absolute;
24
- opacity: 0;
35
+ position: fixed;
25
36
  z-index: 2;
26
- pointer-events: none;
27
37
  padding: 0;
38
+ opacity: 0;
28
39
  border-radius: var(--curvature);
29
40
  background: #fff;
30
- transform: translateY(1em) scale(0.9);
31
41
  transition: all calc(0.8 * var(--transition-speed)) var(--bounce);
32
42
  user-select: none;
33
43
  margin-top: 0px;
@@ -64,7 +74,7 @@ export class Dropdown extends RapidElement {
64
74
  right: 0;
65
75
  bottom: 0;
66
76
  background: rgba(0, 0, 0, 0.7);
67
- opacity: 0;
77
+ opacity: 0.5;
68
78
  transition: opacity var(--transition-speed) ease-in-out;
69
79
  pointer-events: none;
70
80
  z-index: 1;
@@ -83,121 +93,136 @@ export class Dropdown extends RapidElement {
83
93
  constructor() {
84
94
  super();
85
95
  this.open = false;
86
- this.top = false;
87
- this.bottom = false;
88
- this.left = false;
89
- this.right = false;
90
- this.arrowSize = 6;
91
- this.arrowOffset = this.arrowSize * 2;
92
- this.offsetX = 0;
93
- this.offsetY = 0;
96
+ this.dormant = true;
97
+ this.arrowSize = 8;
98
+ this.margin = 10;
94
99
  this.mask = false;
95
- this.ensureOnScreen = this.ensureOnScreen.bind(this);
100
+ this.dropdownStyle = {};
101
+ this.arrowStyle = {};
102
+ this.calculatePosition = this.calculatePosition.bind(this);
96
103
  }
97
104
  firstUpdated(props) {
98
105
  super.firstUpdated(props);
99
- const arrow = this.shadowRoot.querySelector('.arrow');
100
- arrow.style.borderWidth = this.arrowSize + 'px';
101
- arrow.style.top = '-' + this.arrowSize + 'px';
102
- if (this.arrowOffset < 0) {
103
- arrow.style.right = Math.abs(this.arrowOffset) + 'px';
106
+ this.resetBlurHandler();
107
+ }
108
+ resetBlurHandler() {
109
+ const dropdown = this.shadowRoot.querySelector('.dropdown');
110
+ if (this.activeFocus) {
111
+ this.activeFocus.removeEventListener('blur', this.blurHandler);
112
+ }
113
+ this.activeFocus = dropdown;
114
+ this.blurHandler = this.handleBlur.bind(this);
115
+ this.activeFocus.addEventListener('blur', this.blurHandler);
116
+ }
117
+ handleBlur(event) {
118
+ const newTarget = event.relatedTarget;
119
+ if (this.contains(newTarget)) {
120
+ newTarget.addEventListener('blur', this.blurHandler);
121
+ this.activeFocus = newTarget;
104
122
  }
105
123
  else {
106
- arrow.style.left = this.arrowOffset + 'px';
124
+ this.closeDropdown();
107
125
  }
126
+ }
127
+ openDropdown() {
128
+ this.open = true;
129
+ this.dormant = false;
130
+ this.resetBlurHandler();
108
131
  const dropdown = this.shadowRoot.querySelector('.dropdown');
109
- dropdown.addEventListener('blur', () => {
110
- // we nest this to deal with clicking the toggle to close
111
- // as we don't want it to toggle an immediate open, probably
112
- // a better way to deal with this
113
- window.setTimeout(() => {
114
- this.open = false;
115
- // blur our host element too
116
- this.shadowRoot.host.blur();
117
- }, 200);
118
- });
132
+ dropdown.focus();
133
+ dropdown.click();
134
+ this.fireCustomEvent(CustomEventType.Opened);
135
+ }
136
+ closeDropdown() {
137
+ this.activeFocus.removeEventListener('blur', this.blurHandler);
138
+ this.open = false;
139
+ this.resetBlurHandler();
140
+ window.setTimeout(() => {
141
+ this.dormant = true;
142
+ }, 250);
143
+ this.blur();
119
144
  }
120
145
  updated(changedProperties) {
121
146
  super.updated(changedProperties);
122
- const dropdown = this.shadowRoot.querySelector('.dropdown');
123
- if (changedProperties.has('offsetY') || changedProperties.has('offsetX')) {
124
- dropdown.style.marginTop = this.offsetY + 'px';
125
- if (dropdown.offsetLeft + dropdown.clientWidth > window.outerWidth) {
126
- dropdown.style.marginLeft =
127
- '-' + (dropdown.clientWidth - this.clientWidth - this.offsetX) + 'px';
128
- }
129
- else {
130
- if (this.right) {
131
- dropdown.style.marginRight = this.offsetX + 'px';
132
- }
133
- else {
134
- dropdown.style.marginLeft = this.offsetX + 'px';
135
- }
136
- }
137
- }
138
147
  if (changedProperties.has('open')) {
139
- // check right away if we are on the screen, and then again moments after render
140
- window.setTimeout(this.ensureOnScreen, 0);
141
- window.setTimeout(this.ensureOnScreen, 100);
148
+ this.dropdownStyle = {};
149
+ }
150
+ if (changedProperties.has('dropdownStyle')) {
151
+ if (Object.keys(this.dropdownStyle).length === 0) {
152
+ this.calculatePosition();
153
+ }
142
154
  }
143
155
  }
144
- ensureOnScreen() {
156
+ calculatePosition() {
145
157
  const dropdown = this.shadowRoot.querySelector('.dropdown');
146
- if (dropdown) {
147
- // dropdown will go off the screen, let's push it up
148
- const toggle = this.querySelector('div[slot="toggle"]');
158
+ const toggle = this.querySelector('div[slot="toggle"]');
159
+ const arrow = this.shadowRoot.querySelector('.arrow');
160
+ let bumpedUp = false;
161
+ let bumpedLeft = false;
162
+ if (dropdown && toggle) {
163
+ const dropdownBounds = dropdown.getBoundingClientRect();
164
+ const toggleBounds = toggle.getBoundingClientRect();
165
+ const arrowBounds = arrow.getBoundingClientRect();
149
166
  if (!toggle) {
150
167
  return;
151
168
  }
152
- if (dropdown.getBoundingClientRect().bottom > window.innerHeight - 100) {
153
- if (this.bottom) {
154
- dropdown.style.top = toggle.clientHeight + 'px';
155
- }
156
- else {
157
- dropdown.style.top = '';
158
- dropdown.style.bottom = toggle.clientHeight + 'px';
159
- }
169
+ const dropdownStyle = {
170
+ border: '1px solid rgba(0,0,0,0.1)',
171
+ marginTop: '0.5em'
172
+ };
173
+ // if off the the right, bump it left
174
+ if (dropdownBounds.right > window.innerWidth) {
175
+ dropdownStyle['left'] =
176
+ toggleBounds.right - dropdownBounds.width + 'px';
177
+ delete dropdownStyle['right'];
178
+ bumpedLeft = true;
160
179
  }
161
- else if (dropdown.getBoundingClientRect().top < 0) {
162
- if (this.bottom) {
163
- dropdown.style.top = toggle.clientHeight + 'px';
164
- }
165
- else {
166
- dropdown.style.top = toggle.clientHeight + 'px';
167
- dropdown.style.bottom = '';
168
- }
180
+ // if off to the bottom, bump it up
181
+ if (dropdownBounds.bottom > window.innerHeight) {
182
+ dropdownStyle['top'] = toggleBounds.top - dropdownBounds.height + 'px';
183
+ dropdownStyle['margin-top'] = '-0.5em';
184
+ bumpedUp = true;
169
185
  }
170
- if (dropdown.getBoundingClientRect().right > window.innerWidth) {
171
- dropdown.style.left = '';
172
- dropdown.style.right = '0px';
186
+ const arrowStyle = {
187
+ left: toggleBounds.width / 2 - arrowBounds.width / 2 + 'px',
188
+ borderWidth: this.arrowSize + 'px',
189
+ top: '-' + this.arrowSize + 'px'
190
+ };
191
+ if (bumpedUp) {
192
+ // rotate our arrow 180 degrees
193
+ arrowStyle['transform'] = 'rotate(180deg)';
194
+ // and place it at the bottom of the dropdown
195
+ arrowStyle['top'] = 'auto';
196
+ arrowStyle['bottom'] = '-' + this.arrowSize + 'px';
173
197
  }
174
- else if (dropdown.getBoundingClientRect().left < 0) {
175
- dropdown.style.left = 0 + 'px';
176
- dropdown.style.right = '';
198
+ if (bumpedLeft) {
199
+ arrowStyle['right'] =
200
+ toggleBounds.width / 2 - arrowBounds.width / 2 + 'px';
201
+ delete arrowStyle['left'];
177
202
  }
203
+ this.arrowStyle = arrowStyle;
204
+ this.dropdownStyle = dropdownStyle;
178
205
  }
206
+ this.requestUpdate();
179
207
  }
180
208
  handleToggleClicked(event) {
181
209
  event.preventDefault();
182
210
  event.stopPropagation();
183
- if (!this.open) {
184
- this.open = true;
185
- const dropdown = this.shadowRoot.querySelector('.dropdown');
186
- dropdown.focus();
211
+ if (!this.open && this.dormant) {
212
+ this.openDropdown();
187
213
  }
188
214
  }
189
- handleDropdownMouseDown(event) {
190
- // block mouse down when clicking inside dropdown so we don't lose focus yet
191
- event.preventDefault();
192
- event.stopPropagation();
193
- }
194
215
  render() {
195
216
  return html `
196
217
  ${this.mask
197
218
  ? html `<div class="mask ${this.open ? 'open' : ''}" />`
198
219
  : null}
199
220
 
200
- <div class="wrapper ${this.open ? 'open' : ''}">
221
+ <div
222
+ class="wrapper ${getClasses({
223
+ open: this.open
224
+ })}"
225
+ >
201
226
  <slot
202
227
  name="toggle"
203
228
  class="toggle"
@@ -206,15 +231,12 @@ export class Dropdown extends RapidElement {
206
231
  <div
207
232
  class="${getClasses({
208
233
  dropdown: true,
209
- right: this.right,
210
- left: this.left,
211
- top: this.top,
212
- bottom: this.bottom
234
+ dormant: this.dormant
213
235
  })}"
236
+ style=${styleMap(this.dropdownStyle)}
214
237
  tabindex="0"
215
- @mousedown=${this.handleDropdownMouseDown}
216
238
  >
217
- <div class="arrow"></div>
239
+ <div class="arrow" style=${styleMap(this.arrowStyle)}></div>
218
240
  <div class="dropdown-wrapper">
219
241
  <slot name="dropdown" tabindex="1"></slot>
220
242
  </div>
@@ -228,29 +250,20 @@ __decorate([
228
250
  ], Dropdown.prototype, "open", void 0);
229
251
  __decorate([
230
252
  property({ type: Boolean })
231
- ], Dropdown.prototype, "top", void 0);
232
- __decorate([
233
- property({ type: Boolean })
234
- ], Dropdown.prototype, "bottom", void 0);
235
- __decorate([
236
- property({ type: Boolean })
237
- ], Dropdown.prototype, "left", void 0);
238
- __decorate([
239
- property({ type: Boolean })
240
- ], Dropdown.prototype, "right", void 0);
253
+ ], Dropdown.prototype, "dormant", void 0);
241
254
  __decorate([
242
255
  property({ type: Number })
243
256
  ], Dropdown.prototype, "arrowSize", void 0);
244
257
  __decorate([
245
258
  property({ type: Number })
246
- ], Dropdown.prototype, "arrowOffset", void 0);
247
- __decorate([
248
- property({ type: Number })
249
- ], Dropdown.prototype, "offsetX", void 0);
250
- __decorate([
251
- property({ type: Number })
252
- ], Dropdown.prototype, "offsetY", void 0);
259
+ ], Dropdown.prototype, "margin", void 0);
253
260
  __decorate([
254
261
  property({ type: Boolean })
255
262
  ], Dropdown.prototype, "mask", void 0);
263
+ __decorate([
264
+ property({ type: Object, attribute: false })
265
+ ], Dropdown.prototype, "dropdownStyle", void 0);
266
+ __decorate([
267
+ property({ type: Object, attribute: false })
268
+ ], Dropdown.prototype, "arrowStyle", void 0);
256
269
  //# sourceMappingURL=Dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/dropdown/Dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,OAAO,QAAS,SAAQ,YAAY;IACxC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyET,CAAC;IACJ,CAAC;IAgCD;QACE,KAAK,EAAE,CAAC;QA9BV,SAAI,GAAG,KAAK,CAAC;QAGb,QAAG,GAAG,KAAK,CAAC;QAGZ,WAAM,GAAG,KAAK,CAAC;QAGf,SAAI,GAAG,KAAK,CAAC;QAGb,UAAK,GAAG,KAAK,CAAC;QAGd,cAAS,GAAG,CAAC,CAAC;QAGd,gBAAW,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QAGjC,YAAO,GAAG,CAAC,CAAC;QAGZ,YAAO,GAAG,CAAC,CAAC;QAGZ,SAAI,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AC;qCAChB;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACb;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACf;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACd;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACM;AAGjC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACf","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { RapidElement } from '../RapidElement';\nimport { getClasses } from '../utils';\n\nexport class Dropdown extends RapidElement {\n static get styles() {\n return css`\n .wrapper {\n position: relative;\n }\n\n .toggle {\n cursor: pointer;\n }\n\n .dropdown-wrapper {\n position: relative;\n overflow: auto;\n }\n\n .dropdown {\n position: absolute;\n opacity: 0;\n z-index: 2;\n pointer-events: none;\n padding: 0;\n border-radius: var(--curvature);\n background: #fff;\n transform: translateY(1em) scale(0.9);\n transition: all calc(0.8 * var(--transition-speed)) var(--bounce);\n user-select: none;\n margin-top: 0px;\n margin-left: 0px;\n box-shadow: var(--dropdown-shadow);\n }\n\n .dropdown:focus {\n outline: none;\n }\n\n .arrow {\n content: '';\n width: 0px;\n height: 0;\n top: -6px;\n z-index: 10;\n position: absolute;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid white;\n }\n\n .open .dropdown {\n opacity: 1;\n pointer-events: auto;\n transform: translateY(0.5em) scale(1);\n }\n\n .mask {\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.7);\n opacity: 0;\n transition: opacity var(--transition-speed) ease-in-out;\n pointer-events: none;\n z-index: 1;\n }\n\n .mask.open {\n opacity: 1;\n pointer-events: auto;\n }\n\n .right {\n right: 0;\n }\n `;\n }\n\n @property({ type: Boolean })\n open = false;\n\n @property({ type: Boolean })\n top = false;\n\n @property({ type: Boolean })\n bottom = false;\n\n @property({ type: Boolean })\n left = false;\n\n @property({ type: Boolean })\n right = false;\n\n @property({ type: Number })\n arrowSize = 6;\n\n @property({ type: Number })\n arrowOffset = this.arrowSize * 2;\n\n @property({ type: Number })\n offsetX = 0;\n\n @property({ type: Number })\n offsetY = 0;\n\n @property({ type: Boolean })\n mask = false;\n\n constructor() {\n super();\n this.ensureOnScreen = this.ensureOnScreen.bind(this);\n }\n\n public firstUpdated(props: any) {\n super.firstUpdated(props);\n\n const arrow = this.shadowRoot.querySelector('.arrow') as HTMLDivElement;\n arrow.style.borderWidth = this.arrowSize + 'px';\n arrow.style.top = '-' + this.arrowSize + 'px';\n\n if (this.arrowOffset < 0) {\n arrow.style.right = Math.abs(this.arrowOffset) + 'px';\n } else {\n arrow.style.left = this.arrowOffset + 'px';\n }\n\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n\n dropdown.addEventListener('blur', () => {\n // we nest this to deal with clicking the toggle to close\n // as we don't want it to toggle an immediate open, probably\n // a better way to deal with this\n window.setTimeout(() => {\n this.open = false;\n // blur our host element too\n (this.shadowRoot.host as HTMLDivElement).blur();\n }, 200);\n });\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n\n if (changedProperties.has('offsetY') || changedProperties.has('offsetX')) {\n dropdown.style.marginTop = this.offsetY + 'px';\n if (dropdown.offsetLeft + dropdown.clientWidth > window.outerWidth) {\n dropdown.style.marginLeft =\n '-' + (dropdown.clientWidth - this.clientWidth - this.offsetX) + 'px';\n } else {\n if (this.right) {\n dropdown.style.marginRight = this.offsetX + 'px';\n } else {\n dropdown.style.marginLeft = this.offsetX + 'px';\n }\n }\n }\n\n if (changedProperties.has('open')) {\n // check right away if we are on the screen, and then again moments after render\n window.setTimeout(this.ensureOnScreen, 0);\n window.setTimeout(this.ensureOnScreen, 100);\n }\n }\n\n public ensureOnScreen() {\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n\n if (dropdown) {\n // dropdown will go off the screen, let's push it up\n const toggle = this.querySelector('div[slot=\"toggle\"]');\n\n if (!toggle) {\n return;\n }\n\n if (dropdown.getBoundingClientRect().bottom > window.innerHeight - 100) {\n if (this.bottom) {\n dropdown.style.top = toggle.clientHeight + 'px';\n } else {\n dropdown.style.top = '';\n dropdown.style.bottom = toggle.clientHeight + 'px';\n }\n } else if (dropdown.getBoundingClientRect().top < 0) {\n if (this.bottom) {\n dropdown.style.top = toggle.clientHeight + 'px';\n } else {\n dropdown.style.top = toggle.clientHeight + 'px';\n dropdown.style.bottom = '';\n }\n }\n\n if (dropdown.getBoundingClientRect().right > window.innerWidth) {\n dropdown.style.left = '';\n dropdown.style.right = '0px';\n } else if (dropdown.getBoundingClientRect().left < 0) {\n dropdown.style.left = 0 + 'px';\n dropdown.style.right = '';\n }\n }\n }\n\n public handleToggleClicked(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n if (!this.open) {\n this.open = true;\n\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n dropdown.focus();\n }\n }\n\n private handleDropdownMouseDown(event: MouseEvent): void {\n // block mouse down when clicking inside dropdown so we don't lose focus yet\n event.preventDefault();\n event.stopPropagation();\n }\n\n public render(): TemplateResult {\n return html`\n ${this.mask\n ? html`<div class=\"mask ${this.open ? 'open' : ''}\" />`\n : null}\n\n <div class=\"wrapper ${this.open ? 'open' : ''}\">\n <slot\n name=\"toggle\"\n class=\"toggle\"\n @click=${this.handleToggleClicked}\n ></slot>\n <div\n class=\"${getClasses({\n dropdown: true,\n right: this.right,\n left: this.left,\n top: this.top,\n bottom: this.bottom\n })}\"\n tabindex=\"0\"\n @mousedown=${this.handleDropdownMouseDown}\n >\n <div class=\"arrow\"></div>\n <div class=\"dropdown-wrapper\">\n <slot name=\"dropdown\" tabindex=\"1\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/dropdown/Dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,MAAM,OAAO,QAAS,SAAQ,YAAY;IACxC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFT,CAAC;IACJ,CAAC;IAuBD;QACE,KAAK,EAAE,CAAC;QArBV,SAAI,GAAG,KAAK,CAAC;QAGb,YAAO,GAAG,IAAI,CAAC;QAGf,cAAS,GAAG,CAAC,CAAC;QAGd,WAAM,GAAG,EAAE,CAAC;QAGZ,SAAI,GAAG,KAAK,CAAC;QAGb,kBAAa,GAAG,EAAE,CAAC;QAGnB,eAAU,GAAG,EAAE,CAAC;QAId,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAKM,Y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,EAAE,OAAO,EAAE,CAAC;sCACf;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACb;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACf;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAC1B;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAC7B","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { RapidElement } from '../RapidElement';\nimport { getClasses } from '../utils';\nimport { CustomEventType } from '../interfaces';\n\nimport { styleMap } from 'lit-html/directives/style-map.js';\n\nexport class Dropdown extends RapidElement {\n static get styles() {\n return css`\n :host {\n }\n\n .wrapper {\n position: relative;\n }\n\n .toggle {\n cursor: pointer;\n }\n\n .dropdown-wrapper {\n position: relative;\n overflow: auto;\n }\n\n .dropdown:focus {\n }\n\n .dropdown.dormant {\n pointer-events: none;\n }\n\n .dropdown {\n position: fixed;\n z-index: 2;\n padding: 0;\n opacity: 0;\n border-radius: var(--curvature);\n background: #fff;\n transition: all calc(0.8 * var(--transition-speed)) var(--bounce);\n user-select: none;\n margin-top: 0px;\n margin-left: 0px;\n box-shadow: var(--dropdown-shadow);\n }\n\n .dropdown:focus {\n outline: none;\n }\n\n .arrow {\n content: '';\n width: 0px;\n height: 0;\n top: -6px;\n z-index: 10;\n position: absolute;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid white;\n }\n\n .open .dropdown {\n opacity: 1;\n pointer-events: auto;\n transform: translateY(0.5em) scale(1);\n }\n\n .mask {\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n transition: opacity var(--transition-speed) ease-in-out;\n pointer-events: none;\n z-index: 1;\n }\n\n .mask.open {\n opacity: 1;\n pointer-events: auto;\n }\n\n .right {\n right: 0;\n }\n `;\n }\n\n @property({ type: Boolean })\n open = false;\n\n @property({ type: Boolean })\n dormant = true;\n\n @property({ type: Number })\n arrowSize = 8;\n\n @property({ type: Number })\n margin = 10;\n\n @property({ type: Boolean })\n mask = false;\n\n @property({ type: Object, attribute: false })\n dropdownStyle = {};\n\n @property({ type: Object, attribute: false })\n arrowStyle = {};\n\n constructor() {\n super();\n this.calculatePosition = this.calculatePosition.bind(this);\n }\n\n private activeFocus: any;\n private blurHandler: any;\n\n public firstUpdated(props: any) {\n super.firstUpdated(props);\n this.resetBlurHandler();\n }\n\n private resetBlurHandler() {\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n\n if (this.activeFocus) {\n this.activeFocus.removeEventListener('blur', this.blurHandler);\n }\n\n this.activeFocus = dropdown;\n this.blurHandler = this.handleBlur.bind(this);\n\n this.activeFocus.addEventListener('blur', this.blurHandler);\n }\n\n private handleBlur(event: FocusEvent) {\n const newTarget = event.relatedTarget as any;\n\n if (this.contains(newTarget)) {\n newTarget.addEventListener('blur', this.blurHandler);\n this.activeFocus = newTarget;\n } else {\n this.closeDropdown();\n }\n }\n\n private openDropdown() {\n this.open = true;\n this.dormant = false;\n this.resetBlurHandler();\n\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n dropdown.focus();\n dropdown.click();\n\n this.fireCustomEvent(CustomEventType.Opened);\n }\n\n private closeDropdown() {\n this.activeFocus.removeEventListener('blur', this.blurHandler);\n\n this.open = false;\n this.resetBlurHandler();\n\n window.setTimeout(() => {\n this.dormant = true;\n }, 250);\n\n this.blur();\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('open')) {\n this.dropdownStyle = {};\n }\n\n if (changedProperties.has('dropdownStyle')) {\n if (Object.keys(this.dropdownStyle).length === 0) {\n this.calculatePosition();\n }\n }\n }\n\n public calculatePosition() {\n const dropdown = this.shadowRoot.querySelector(\n '.dropdown'\n ) as HTMLDivElement;\n const toggle = this.querySelector('div[slot=\"toggle\"]');\n\n const arrow = this.shadowRoot.querySelector('.arrow') as HTMLDivElement;\n\n let bumpedUp = false;\n let bumpedLeft = false;\n\n if (dropdown && toggle) {\n const dropdownBounds = dropdown.getBoundingClientRect();\n const toggleBounds = toggle.getBoundingClientRect();\n const arrowBounds = arrow.getBoundingClientRect();\n\n if (!toggle) {\n return;\n }\n\n const dropdownStyle = {\n border: '1px solid rgba(0,0,0,0.1)',\n marginTop: '0.5em'\n };\n\n // if off the the right, bump it left\n if (dropdownBounds.right > window.innerWidth) {\n dropdownStyle['left'] =\n toggleBounds.right - dropdownBounds.width + 'px';\n delete dropdownStyle['right'];\n bumpedLeft = true;\n }\n\n // if off to the bottom, bump it up\n if (dropdownBounds.bottom > window.innerHeight) {\n dropdownStyle['top'] = toggleBounds.top - dropdownBounds.height + 'px';\n dropdownStyle['margin-top'] = '-0.5em';\n bumpedUp = true;\n }\n\n const arrowStyle = {\n left: toggleBounds.width / 2 - arrowBounds.width / 2 + 'px',\n borderWidth: this.arrowSize + 'px',\n top: '-' + this.arrowSize + 'px'\n };\n\n if (bumpedUp) {\n // rotate our arrow 180 degrees\n arrowStyle['transform'] = 'rotate(180deg)';\n\n // and place it at the bottom of the dropdown\n arrowStyle['top'] = 'auto';\n arrowStyle['bottom'] = '-' + this.arrowSize + 'px';\n }\n\n if (bumpedLeft) {\n arrowStyle['right'] =\n toggleBounds.width / 2 - arrowBounds.width / 2 + 'px';\n delete arrowStyle['left'];\n }\n\n this.arrowStyle = arrowStyle;\n this.dropdownStyle = dropdownStyle;\n }\n this.requestUpdate();\n }\n\n public handleToggleClicked(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n if (!this.open && this.dormant) {\n this.openDropdown();\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${this.mask\n ? html`<div class=\"mask ${this.open ? 'open' : ''}\" />`\n : null}\n\n <div\n class=\"wrapper ${getClasses({\n open: this.open\n })}\"\n >\n <slot\n name=\"toggle\"\n class=\"toggle\"\n @click=${this.handleToggleClicked}\n ></slot>\n <div\n class=\"${getClasses({\n dropdown: true,\n dormant: this.dormant\n })}\"\n style=${styleMap(this.dropdownStyle)}\n tabindex=\"0\"\n >\n <div class=\"arrow\" style=${styleMap(this.arrowStyle)}></div>\n <div class=\"dropdown-wrapper\">\n <slot name=\"dropdown\" tabindex=\"1\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -42,5 +42,7 @@ export var CustomEventType;
42
42
  CustomEventType["DetailsChanged"] = "temba-details-changed";
43
43
  CustomEventType["Error"] = "temba-error";
44
44
  CustomEventType["Interrupt"] = "temba-interrupt";
45
+ CustomEventType["Opened"] = "temba-opened";
46
+ CustomEventType["TicketUpdated"] = "temba-ticket-updated";
45
47
  })(CustomEventType || (CustomEventType = {}));
46
48
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,mCAAsB,CAAA;IACtB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;AAC1B,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,sDAAgC,CAAA;IAChC,gEAA0C,CAAA;IAC1C,4DAAsC,CAAA;AACxC,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,iCAAiB,CAAA;AACnB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AA2ND,MAAM,CAAN,IAAY,eA0BX;AA1BD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,4CAAyB,CAAA;IACzB,8CAA2B,CAAA;IAC3B,yDAAsC,CAAA;IACtC,gDAA6B,CAAA;IAC7B,gDAA6B,CAAA;IAC7B,yDAAsC,CAAA;IACtC,uDAAoC,CAAA;IACpC,6DAA0C,CAAA;IAC1C,2DAAwC,CAAA;IACxC,2DAAwC,CAAA;IACxC,yDAAsC,CAAA;IACtC,qDAAkC,CAAA;IAClC,gDAA6B,CAAA;IAC7B,kDAA+B,CAAA;IAC/B,2CAAwB,CAAA;IACxB,uDAAoC,CAAA;IACpC,wCAAqB,CAAA;IACrB,uDAAoC,CAAA;IACpC,iDAA8B,CAAA;IAC9B,+CAA4B,CAAA;IAC5B,4CAAyB,CAAA;IACzB,2DAAwC,CAAA;IACxC,wCAAqB,CAAA;IACrB,gDAA6B,CAAA;AAC/B,CAAC,EA1BW,eAAe,KAAf,eAAe,QA0B1B","sourcesContent":["export interface Workspace {\n uuid: string;\n name: string;\n country: string;\n languages: string[];\n timezone: string;\n date_style: DateStyle;\n anon: boolean;\n}\n\nexport interface Language {\n iso: string;\n name: string;\n}\n\nexport interface Attachment {\n uuid: string;\n content_type: string;\n url: string;\n filename: string;\n size: number;\n error: string;\n}\n\nexport enum DateStyle {\n DayFirst = 'day_first',\n MonthFirst = 'month_first',\n YearFirst = 'year_first'\n}\n\nexport enum ScheduledEventType {\n CampaignEvent = 'campaign_event',\n ScheduledBroadcast = 'scheduled_broadcast',\n ScheduledTrigger = 'scheduled_trigger'\n}\n\nexport enum TicketStatus {\n Open = 'open',\n Closed = 'closed'\n}\n\nexport interface ScheduledEvent {\n type: ScheduledEventType;\n scheduled: string;\n repeat_period: string;\n campaign?: ObjectReference;\n flow?: ObjectReference;\n message?: string;\n}\n\nexport interface NamedUser extends User {\n name: string;\n}\n\nexport interface User {\n id?: number;\n first_name?: string;\n last_name?: string;\n email?: string;\n role?: string;\n created_on?: string;\n avatar?: string;\n}\n\nexport interface Ticket {\n uuid: string;\n subject: string;\n body?: string;\n closed_on: string;\n opened_on: string;\n status: string;\n contact: ObjectReference;\n topic: ObjectReference;\n assignee?: { email: string; name: string; avatar?: string };\n}\n\nexport interface FlowResult {\n key: string;\n name: string;\n categories: string[];\n node_uuids: string[];\n}\n\nexport interface FlowDetails {\n name: string;\n results: FlowResult[];\n modified_on: string;\n runs: {\n active: number;\n completed: number;\n expired: number;\n interrupted: number;\n };\n}\n\nexport interface Msg {\n text: string;\n status: string;\n channel: ObjectReference;\n quick_replies: string[];\n urn: string;\n id: number;\n direction: string;\n type: string;\n attachments: string[];\n}\n\nexport interface ObjectReference {\n uuid: string;\n name: string;\n}\n\nexport interface Shortcut {\n uuid: string;\n name: string;\n text: string;\n modified_on: string;\n}\n\nexport interface ContactField {\n key: string;\n label: string;\n value_type: string;\n featured: boolean;\n priority: number;\n agent_access: string;\n type: string;\n usages: { campaign_events: number; flows: number; groups: number };\n}\n\nexport interface ContactGroup {\n uuid: string;\n count: number;\n name: string;\n query?: string;\n status: string;\n}\n\nexport interface URN {\n scheme: string;\n path: string;\n}\n\nexport interface Group {\n name: string;\n uuid: string;\n is_dynamic?: boolean;\n}\n\nexport interface ContactNote {\n text: string;\n created_on: string;\n created_by: NamedUser;\n}\n\nexport interface ContactTicket {\n name: string;\n uuid: string;\n status: string;\n\n contact: {\n uuid: string;\n name: string;\n created_on: Date;\n last_seen_on: Date;\n };\n}\n\nexport interface Contact {\n name: string;\n uuid: string;\n stopped: boolean;\n blocked: boolean;\n urns: string[];\n language?: string;\n fields: { [key: string]: string };\n groups: Group[];\n notes: ContactNote[];\n modified_on: string;\n created_on: string;\n last_seen_on: string;\n status: string;\n\n anon_display?: string;\n flow?: ObjectReference;\n last_msg?: Msg;\n direction?: string;\n ticket: {\n uuid: string;\n subject: string;\n closed_on?: string;\n last_activity_on: string;\n assignee?: User;\n topic?: ObjectReference;\n };\n}\n\nexport interface FeatureProperties {\n name: string;\n osm_id: string;\n level: number;\n children?: FeatureProperties[];\n has_children?: boolean;\n aliases?: string;\n parent_osm_id?: string;\n id?: number;\n path?: string;\n}\n\nexport interface Position {\n top: number;\n left: number;\n}\n\nexport interface FunctionExample {\n template: string;\n output: string;\n}\n\nexport interface CompletionOption {\n name?: string;\n summary: string;\n\n // functions\n signature?: string;\n detail?: string;\n examples?: FunctionExample[];\n}\n\nexport interface CompletionResult {\n anchorPosition: Position;\n query: string;\n options: CompletionOption[];\n currentFunction: CompletionOption;\n}\n\nexport interface CompletionProperty {\n key: string;\n help: string;\n type: string;\n}\n\nexport interface CompletionType {\n name: string;\n\n key_source?: string;\n property_template?: CompletionProperty;\n properties?: CompletionProperty[];\n}\n\nexport interface CompletionSchema {\n types: CompletionType[];\n root: CompletionProperty[];\n root_no_session: CompletionProperty[];\n}\n\nexport type KeyedAssets = { [assetType: string]: string[] };\n\nexport enum CustomEventType {\n Loaded = 'temba-loaded',\n Loading = 'temba-loading',\n Canceled = 'temba-canceled',\n CursorChanged = 'temba-cursor-changed',\n Refreshed = 'temba-refreshed',\n Selection = 'temba-selection',\n ButtonClicked = 'temba-button-clicked',\n DialogHidden = 'temba-dialog-hidden',\n ScrollThreshold = 'temba-scroll-threshold',\n ContentChanged = 'temba-content-changed',\n ContextChanged = 'temba-context-changed',\n FetchComplete = 'temba-fetch-complete',\n MessageSent = 'temba-message-sent',\n Submitted = 'temba-submitted',\n Redirected = 'temba-redirected',\n NoPath = 'temba-no-path',\n StoreUpdated = 'temba-store-updated',\n Ready = 'temba-ready',\n OrderChanged = 'temba-order-changed',\n DragStart = 'temba-drag-start',\n DragStop = 'temba-drag-stop',\n Resized = 'temba-resized',\n DetailsChanged = 'temba-details-changed',\n Error = 'temba-error',\n Interrupt = 'temba-interrupt'\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,mCAAsB,CAAA;IACtB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;AAC1B,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,sDAAgC,CAAA;IAChC,gEAA0C,CAAA;IAC1C,4DAAsC,CAAA;AACxC,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,iCAAiB,CAAA;AACnB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AA4ND,MAAM,CAAN,IAAY,eA4BX;AA5BD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,4CAAyB,CAAA;IACzB,8CAA2B,CAAA;IAC3B,yDAAsC,CAAA;IACtC,gDAA6B,CAAA;IAC7B,gDAA6B,CAAA;IAC7B,yDAAsC,CAAA;IACtC,uDAAoC,CAAA;IACpC,6DAA0C,CAAA;IAC1C,2DAAwC,CAAA;IACxC,2DAAwC,CAAA;IACxC,yDAAsC,CAAA;IACtC,qDAAkC,CAAA;IAClC,gDAA6B,CAAA;IAC7B,kDAA+B,CAAA;IAC/B,2CAAwB,CAAA;IACxB,uDAAoC,CAAA;IACpC,wCAAqB,CAAA;IACrB,uDAAoC,CAAA;IACpC,iDAA8B,CAAA;IAC9B,+CAA4B,CAAA;IAC5B,4CAAyB,CAAA;IACzB,2DAAwC,CAAA;IACxC,wCAAqB,CAAA;IACrB,gDAA6B,CAAA;IAC7B,0CAAuB,CAAA;IACvB,yDAAsC,CAAA;AACxC,CAAC,EA5BW,eAAe,KAAf,eAAe,QA4B1B","sourcesContent":["export interface Workspace {\n uuid: string;\n name: string;\n country: string;\n languages: string[];\n timezone: string;\n date_style: DateStyle;\n anon: boolean;\n}\n\nexport interface Language {\n iso: string;\n name: string;\n}\n\nexport interface Attachment {\n uuid: string;\n content_type: string;\n url: string;\n filename: string;\n size: number;\n error: string;\n}\n\nexport enum DateStyle {\n DayFirst = 'day_first',\n MonthFirst = 'month_first',\n YearFirst = 'year_first'\n}\n\nexport enum ScheduledEventType {\n CampaignEvent = 'campaign_event',\n ScheduledBroadcast = 'scheduled_broadcast',\n ScheduledTrigger = 'scheduled_trigger'\n}\n\nexport enum TicketStatus {\n Open = 'open',\n Closed = 'closed'\n}\n\nexport interface ScheduledEvent {\n type: ScheduledEventType;\n scheduled: string;\n repeat_period: string;\n campaign?: ObjectReference;\n flow?: ObjectReference;\n message?: string;\n}\n\nexport interface NamedUser extends User {\n name: string;\n}\n\nexport interface User {\n id?: number;\n first_name?: string;\n last_name?: string;\n name?: string;\n email?: string;\n role?: string;\n created_on?: string;\n avatar?: string;\n}\n\nexport interface Ticket {\n uuid: string;\n subject: string;\n body?: string;\n closed_on: string;\n opened_on: string;\n status: string;\n contact: ObjectReference;\n topic: ObjectReference;\n assignee?: { email: string; name: string; avatar?: string };\n}\n\nexport interface FlowResult {\n key: string;\n name: string;\n categories: string[];\n node_uuids: string[];\n}\n\nexport interface FlowDetails {\n name: string;\n results: FlowResult[];\n modified_on: string;\n runs: {\n active: number;\n completed: number;\n expired: number;\n interrupted: number;\n };\n}\n\nexport interface Msg {\n text: string;\n status: string;\n channel: ObjectReference;\n quick_replies: string[];\n urn: string;\n id: number;\n direction: string;\n type: string;\n attachments: string[];\n}\n\nexport interface ObjectReference {\n uuid: string;\n name: string;\n}\n\nexport interface Shortcut {\n uuid: string;\n name: string;\n text: string;\n modified_on: string;\n}\n\nexport interface ContactField {\n key: string;\n label: string;\n value_type: string;\n featured: boolean;\n priority: number;\n agent_access: string;\n type: string;\n usages: { campaign_events: number; flows: number; groups: number };\n}\n\nexport interface ContactGroup {\n uuid: string;\n count: number;\n name: string;\n query?: string;\n status: string;\n}\n\nexport interface URN {\n scheme: string;\n path: string;\n}\n\nexport interface Group {\n name: string;\n uuid: string;\n is_dynamic?: boolean;\n}\n\nexport interface ContactNote {\n text: string;\n created_on: string;\n created_by: NamedUser;\n}\n\nexport interface ContactTicket {\n name: string;\n uuid: string;\n status: string;\n\n contact: {\n uuid: string;\n name: string;\n created_on: Date;\n last_seen_on: Date;\n };\n}\n\nexport interface Contact {\n name: string;\n uuid: string;\n stopped: boolean;\n blocked: boolean;\n urns: string[];\n language?: string;\n fields: { [key: string]: string };\n groups: Group[];\n notes: ContactNote[];\n modified_on: string;\n created_on: string;\n last_seen_on: string;\n status: string;\n\n anon_display?: string;\n flow?: ObjectReference;\n last_msg?: Msg;\n direction?: string;\n ticket: {\n uuid: string;\n subject: string;\n closed_on?: string;\n last_activity_on: string;\n assignee?: User;\n topic?: ObjectReference;\n };\n}\n\nexport interface FeatureProperties {\n name: string;\n osm_id: string;\n level: number;\n children?: FeatureProperties[];\n has_children?: boolean;\n aliases?: string;\n parent_osm_id?: string;\n id?: number;\n path?: string;\n}\n\nexport interface Position {\n top: number;\n left: number;\n}\n\nexport interface FunctionExample {\n template: string;\n output: string;\n}\n\nexport interface CompletionOption {\n name?: string;\n summary: string;\n\n // functions\n signature?: string;\n detail?: string;\n examples?: FunctionExample[];\n}\n\nexport interface CompletionResult {\n anchorPosition: Position;\n query: string;\n options: CompletionOption[];\n currentFunction: CompletionOption;\n}\n\nexport interface CompletionProperty {\n key: string;\n help: string;\n type: string;\n}\n\nexport interface CompletionType {\n name: string;\n\n key_source?: string;\n property_template?: CompletionProperty;\n properties?: CompletionProperty[];\n}\n\nexport interface CompletionSchema {\n types: CompletionType[];\n root: CompletionProperty[];\n root_no_session: CompletionProperty[];\n}\n\nexport type KeyedAssets = { [assetType: string]: string[] };\n\nexport enum CustomEventType {\n Loaded = 'temba-loaded',\n Loading = 'temba-loading',\n Canceled = 'temba-canceled',\n CursorChanged = 'temba-cursor-changed',\n Refreshed = 'temba-refreshed',\n Selection = 'temba-selection',\n ButtonClicked = 'temba-button-clicked',\n DialogHidden = 'temba-dialog-hidden',\n ScrollThreshold = 'temba-scroll-threshold',\n ContentChanged = 'temba-content-changed',\n ContextChanged = 'temba-context-changed',\n FetchComplete = 'temba-fetch-complete',\n MessageSent = 'temba-message-sent',\n Submitted = 'temba-submitted',\n Redirected = 'temba-redirected',\n NoPath = 'temba-no-path',\n StoreUpdated = 'temba-store-updated',\n Ready = 'temba-ready',\n OrderChanged = 'temba-order-changed',\n DragStart = 'temba-drag-start',\n DragStop = 'temba-drag-stop',\n Resized = 'temba-resized',\n DetailsChanged = 'temba-details-changed',\n Error = 'temba-error',\n Interrupt = 'temba-interrupt',\n Opened = 'temba-opened',\n TicketUpdated = 'temba-ticket-updated'\n}\n"]}
@@ -24,10 +24,14 @@ export class ContentMenu extends RapidElement {
24
24
  }
25
25
  static get styles() {
26
26
  return css `
27
+ :host {
28
+ tabindex: 0;
29
+ }
27
30
  .container {
28
31
  --button-y: 0.4em;
29
32
  --button-x: 1em;
30
33
  display: flex;
34
+ align-items: center;
31
35
  }
32
36
 
33
37
  .button_item,
@@ -35,10 +39,12 @@ export class ContentMenu extends RapidElement {
35
39
  margin-left: 1rem;
36
40
  }
37
41
 
42
+ temba-button {
43
+ margin-right: 0.5rem;
44
+ }
38
45
  .toggle {
39
46
  --icon-color: rgb(102, 102, 102);
40
- padding: 0.5rem;
41
- margin-left: 0.5rem;
47
+ padding: 0.4em;
42
48
  }
43
49
 
44
50
  .toggle:hover {
@@ -52,6 +58,7 @@ export class ContentMenu extends RapidElement {
52
58
  color: rgb(45, 45, 45);
53
59
  z-index: 50;
54
60
  min-width: 200px;
61
+ tabindex: 0;
55
62
  }
56
63
 
57
64
  .divider {
@@ -65,6 +72,7 @@ export class ContentMenu extends RapidElement {
65
72
  font-size: 1.1rem;
66
73
  cursor: pointer;
67
74
  font-weight: 400;
75
+ tabindex: 0;
68
76
  }
69
77
 
70
78
  .item:hover {
@@ -134,12 +142,7 @@ export class ContentMenu extends RapidElement {
134
142
  </temba-button>`;
135
143
  })}
136
144
  ${this.items && this.items.length > 0
137
- ? html `<temba-dropdown
138
- arrowsize="8"
139
- arrowoffset="${this.arrowTopLeft ? '12' : '-12'}"
140
- offsety="6"
141
- bottom
142
- >
145
+ ? html `<temba-dropdown>
143
146
  <div slot="toggle" class="toggle">
144
147
  <temba-icon name="menu" size="1.5"></temba-icon>
145
148
  </div>