calcite-combobox.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.82
  5. */
  6. import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
  7. import { a as isSymbol, S as Symbol, d as debounce } from './debounce.js';
  8. import { i as isArray, f as forIn } from './forIn.js';
  9. import { f as filterComputedPlacements, u as updatePopper, c as createPopper, a as defaultMenuPlacement, p as popperMenuComputedPlacements, C as CSS } from './popper.js';
  10. import { g as guid } from './guid.js';
  11. import { T as TEXT, C as ComboboxChildSelector, g as getItemAncestors, a as getItemChildren, h as hasActiveChildren, b as ComboboxItem, c as ComboboxItemGroup } from './utils2.js';
  12. import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './label.js';
  13. import { s as submitForm, c as connectForm, a as afterConnectDefaultValueSet, d as disconnectForm, H as HiddenFormInputSlot } from './form.js';
  14. import { c as createObserver } from './observers.js';
  15. import { u as updateHostInteraction } from './interactive.js';
  16. import { t as toAriaBoolean } from './dom.js';
  17. import { d as defineCustomElement$3 } from './chip.js';
  18. import { d as defineCustomElement$2 } from './icon.js';
  19. /**
  20. * A specialized version of `_.map` for arrays without support for iteratee
  21. * shorthands.
  22. *
  23. * @private
  24. * @param {Array} [array] The array to iterate over.
  25. * @param {Function} iteratee The function invoked per iteration.
  26. * @returns {Array} Returns the new mapped array.
  27. */
  28. function arrayMap(array, iteratee) {
  29. var index = -1,
  30. length = array == null ? 0 : array.length,
  31. result = Array(length);
  32. while (++index < length) {
  33. result[index] = iteratee(array[index], index, array);
  34. }
  35. return result;
  36. }
  37. /** Used as references for various `Number` constants. */
  38. var INFINITY = 1 / 0;
  39. /** Used to convert symbols to primitives and strings. */
  40. var symbolProto = Symbol ? Symbol.prototype : undefined,
  41. symbolToString = symbolProto ? symbolProto.toString : undefined;
  42. /**
  43. * The base implementation of `_.toString` which doesn't convert nullish
  44. * values to empty strings.
  45. *
  46. * @private
  47. * @param {*} value The value to process.
  48. * @returns {string} Returns the string.
  49. */
  50. function baseToString(value) {
  51. // Exit early for strings to avoid a performance hit in some environments.
  52. if (typeof value == 'string') {
  53. return value;
  54. }
  55. if (isArray(value)) {
  56. // Recursively convert values (susceptible to call stack limits).
  57. return arrayMap(value, baseToString) + '';
  58. }
  59. if (isSymbol(value)) {
  60. return symbolToString ? symbolToString.call(value) : '';
  61. }
  62. var result = (value + '');
  63. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  64. }
  65. /**
  66. * Converts `value` to a string. An empty string is returned for `null`
  67. * and `undefined` values. The sign of `-0` is preserved.
  68. *
  69. * @static
  70. * @memberOf _
  71. * @since 4.0.0
  72. * @category Lang
  73. * @param {*} value The value to convert.
  74. * @returns {string} Returns the converted string.
  75. * @example
  76. *
  77. * _.toString(null);
  78. * // => ''
  79. *
  80. * _.toString(-0);
  81. * // => '-0'
  82. *
  83. * _.toString([1, 2, 3]);
  84. * // => '1,2,3'
  85. */
  86. function toString(value) {
  87. return value == null ? '' : baseToString(value);
  88. }
  89. /**
  90. * Used to match `RegExp`
  91. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  92. */
  93. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  94. reHasRegExpChar = RegExp(reRegExpChar.source);
  95. /**
  96. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  97. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  98. *
  99. * @static
  100. * @memberOf _
  101. * @since 3.0.0
  102. * @category String
  103. * @param {string} [string=''] The string to escape.
  104. * @returns {string} Returns the escaped string.
  105. * @example
  106. *
  107. * _.escapeRegExp('[lodash](https://lodash.com/)');
  108. * // => '\[lodash\]\(https://lodash\.com/\)'
  109. */
  110. function escapeRegExp(string) {
  111. string = toString(string);
  112. return (string && reHasRegExpChar.test(string))
  113. ? string.replace(reRegExpChar, '\\$&')
  114. : string;
  115. }
  116. const filter = (data, value) => {
  117. const escapedValue = escapeRegExp(value);
  118. const regex = new RegExp(escapedValue, "i");
  119. if (data.length === 0) {
  120. console.warn(`No data was passed to the filter function.
  121. The data argument should be an array of objects`);
  122. }
  123. const find = (input, RE) => {
  124. var _a;
  125. if ((_a = input) === null || _a === void 0 ? void 0 : _a.constant) {
  126. return true;
  127. }
  128. let found = false;
  129. forIn(input, (val) => {
  130. if (typeof val === "function" || val == null /* intentional == to catch undefined */) {
  131. return;
  132. }
  133. if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
  134. if (find(val, RE)) {
  135. found = true;
  136. }
  137. }
  138. else if (RE.test(val)) {
  139. found = true;
  140. }
  141. });
  142. return found;
  143. };
  144. const result = data.filter((item) => {
  145. return find(item, regex);
  146. });
  147. return result;
  148. };
  149. const comboboxCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;display:block}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}.wrapper{display:-ms-flexbox;display:flex;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);padding:calc(var(--calcite-combobox-item-spacing-unit-s) / 4) var(--calcite-combobox-item-spacing-unit-l)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.wrapper--single{padding:0 var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.grid-input{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}.input{-ms-flex-positive:1;flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;height:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-width:120px;margin-bottom:var(--calcite-combobox-item-spacing-unit-s)}.input:focus{outline:2px solid transparent;outline-offset:2px}.input--transparent{opacity:0}.input--single{margin-bottom:0px;margin-top:0px;padding:0px}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;width:0px;min-width:0px;opacity:0}.input--icon{padding:0 var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1}.input-wrap--single{-ms-flex:1 1 0%;flex:1 1 0%;overflow:hidden}.label{pointer-events:none;display:-ms-flexbox;display:flex;max-width:100%;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);height:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--spaced{padding-top:0px;padding-bottom:0px;padding-left:var(--calcite-combobox-item-spacing-unit-l);padding-right:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:-ms-flexbox;display:flex;width:1rem;cursor:pointer;-ms-flex-align:center;align-items:center}.icon-end{-ms-flex:none;flex:none}.popper-container{width:100%;display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0);visibility:hidden;pointer-events:none}.popper-container .calcite-popper-anim{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}.popper-container[data-popper-placement^=bottom] .calcite-popper-anim{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.popper-container[data-popper-placement^=top] .calcite-popper-anim{-webkit-transform:translateY(5px);transform:translateY(5px)}.popper-container[data-popper-placement^=left] .calcite-popper-anim{-webkit-transform:translateX(5px);transform:translateX(5px)}.popper-container[data-popper-placement^=right] .calcite-popper-anim{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.popper-container[data-popper-placement] .calcite-popper-anim--active{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}.popper-container--active{pointer-events:initial;visibility:visible}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-height:100vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);width:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{height:0px;overflow:hidden}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-width:100%}.chip--active{background-color:var(--calcite-ui-foreground-3)}.item{display:block}::slotted(input[slot=hidden-form-input]){bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
  150. const isGroup = (el) => el.tagName === ComboboxItemGroup;
  151. const itemUidPrefix = "combobox-item-";
  152. const chipUidPrefix = "combobox-chip-";
  153. const labelUidPrefix = "combobox-label-";
  154. const listboxUidPrefix = "combobox-listbox-";
  155. const inputUidPrefix = "combobox-input-";
  156. const Combobox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  157. constructor() {
  158. super();
  159. this.__registerHost();
  160. this.__attachShadow();
  161. this.calciteLookupChange = createEvent(this, "calciteLookupChange", 7);
  162. this.calciteComboboxChange = createEvent(this, "calciteComboboxChange", 7);
  163. this.calciteComboboxFilterChange = createEvent(this, "calciteComboboxFilterChange", 7);
  164. this.calciteComboboxChipDismiss = createEvent(this, "calciteComboboxChipDismiss", 7);
  165. this.calciteComboboxOpen = createEvent(this, "calciteComboboxOpen", 7);
  166. this.calciteComboboxClose = createEvent(this, "calciteComboboxClose", 7);
  167. //--------------------------------------------------------------------------
  168. //
  169. // Public Properties
  170. //
  171. //--------------------------------------------------------------------------
  172. /** Opens or closes the combobox */
  173. this.active = false;
  174. /** Disable combobox input */
  175. this.disabled = false;
  176. /** Specify the maximum number of combobox items (including nested children) to display before showing the scroller */
  177. this.maxItems = 0;
  178. /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
  179. this.overlayPositioning = "absolute";
  180. /**
  181. * When true, makes the component required for form-submission.
  182. *
  183. * @internal
  184. */
  185. this.required = false;
  186. /** specify the selection mode
  187. * - multi: allow any number of selected items (default)
  188. * - single: only one selection)
  189. * - ancestors: like multi, but show ancestors of selected items as selected, only deepest children shown in chips
  190. */
  191. this.selectionMode = "multi";
  192. /** Specify the scale of the combobox, defaults to m */
  193. this.scale = "m";
  194. /** The value(s) of the selectedItem(s) */
  195. this.value = null;
  196. /** string to override the English "Remove tag" text for when an item is selected.
  197. * @default "Remove tag"
  198. */
  199. this.intlRemoveTag = TEXT.removeTag;
  200. this.internalValueChangeFlag = false;
  201. this.items = [];
  202. this.groupItems = [];
  203. this.selectedItems = [];
  204. this.visibleItems = [];
  205. this.activeItemIndex = -1;
  206. this.activeChipIndex = -1;
  207. this.activeDescendant = "";
  208. this.text = "";
  209. this.textInput = null;
  210. this.mutationObserver = createObserver("mutation", () => this.updateItems());
  211. this.resizeObserver = createObserver("resize", () => this.setMaxScrollerHeight());
  212. this.guid = guid();
  213. this.inputHeight = 0;
  214. this.ignoreSelectedEventsFlag = false;
  215. this.activeTransitionProp = "opacity";
  216. // --------------------------------------------------------------------------
  217. //
  218. // Private Methods
  219. //
  220. // --------------------------------------------------------------------------
  221. this.setFilteredPlacements = () => {
  222. const { el, flipPlacements } = this;
  223. this.filteredFlipPlacements = flipPlacements
  224. ? filterComputedPlacements(flipPlacements, el)
  225. : null;
  226. };
  227. this.getValue = () => {
  228. const items = this.selectedItems.map((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.toString(); });
  229. return (items === null || items === void 0 ? void 0 : items.length) ? (items.length > 1 ? items : items[0]) : "";
  230. };
  231. this.onLabelClick = () => {
  232. this.setFocus();
  233. };
  234. this.keydownHandler = (event) => {
  235. const { key } = event;
  236. switch (key) {
  237. case "Tab":
  238. this.activeChipIndex = -1;
  239. this.activeItemIndex = -1;
  240. if (this.allowCustomValues && this.text) {
  241. this.addCustomChip(this.text, true);
  242. event.preventDefault();
  243. }
  244. else if (this.active) {
  245. this.active = false;
  246. event.preventDefault();
  247. }
  248. break;
  249. case "ArrowLeft":
  250. this.previousChip();
  251. break;
  252. case "ArrowRight":
  253. this.nextChip();
  254. break;
  255. case "ArrowUp":
  256. this.shiftActiveItemIndex(-1);
  257. if (!this.comboboxInViewport()) {
  258. this.el.scrollIntoView();
  259. }
  260. break;
  261. case "ArrowDown":
  262. if (!this.active) {
  263. event.preventDefault();
  264. this.active = true;
  265. }
  266. this.shiftActiveItemIndex(1);
  267. if (!this.comboboxInViewport()) {
  268. this.el.scrollIntoView();
  269. }
  270. break;
  271. case " ":
  272. if (!this.textInput.value) {
  273. event.preventDefault();
  274. this.active = true;
  275. this.shiftActiveItemIndex(1);
  276. }
  277. break;
  278. case "Home":
  279. if (this.active) {
  280. event.preventDefault();
  281. }
  282. this.updateActiveItemIndex(0);
  283. this.scrollToActiveItem();
  284. if (!this.comboboxInViewport()) {
  285. this.el.scrollIntoView();
  286. }
  287. break;
  288. case "End":
  289. if (this.active) {
  290. event.preventDefault();
  291. }
  292. this.updateActiveItemIndex(this.visibleItems.length - 1);
  293. this.scrollToActiveItem();
  294. if (!this.comboboxInViewport()) {
  295. this.el.scrollIntoView();
  296. }
  297. break;
  298. case "Escape":
  299. this.active = false;
  300. break;
  301. case "Enter":
  302. if (this.activeItemIndex > -1) {
  303. this.toggleSelection(this.visibleItems[this.activeItemIndex]);
  304. }
  305. else if (this.activeChipIndex > -1) {
  306. this.removeActiveChip();
  307. }
  308. else if (this.allowCustomValues && this.text) {
  309. this.addCustomChip(this.text, true);
  310. }
  311. else if (!event.defaultPrevented) {
  312. submitForm(this);
  313. }
  314. break;
  315. case "Delete":
  316. case "Backspace":
  317. if (this.activeChipIndex > -1) {
  318. this.removeActiveChip();
  319. }
  320. else if (!this.text && this.isMulti()) {
  321. this.removeLastChip();
  322. }
  323. break;
  324. }
  325. };
  326. this.toggleCloseEnd = () => {
  327. this.active = false;
  328. this.el.removeEventListener("calciteComboboxClose", this.toggleCloseEnd);
  329. };
  330. this.toggleOpenEnd = () => {
  331. this.active = true;
  332. this.el.removeEventListener("calciteComboboxOpen", this.toggleOpenEnd);
  333. };
  334. this.transitionEnd = (event) => {
  335. if (event.propertyName === this.activeTransitionProp) {
  336. this.active ? this.calciteComboboxOpen.emit() : this.calciteComboboxClose.emit();
  337. }
  338. };
  339. this.setMaxScrollerHeight = () => {
  340. const { active, listContainerEl } = this;
  341. if (!listContainerEl || !active) {
  342. return;
  343. }
  344. this.reposition();
  345. const maxScrollerHeight = this.getMaxScrollerHeight();
  346. listContainerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
  347. this.reposition();
  348. };
  349. this.calciteChipDismissHandler = (event, comboboxItem) => {
  350. this.active = false;
  351. const selection = this.items.find((item) => item === comboboxItem);
  352. if (selection) {
  353. this.toggleSelection(selection, false);
  354. }
  355. this.calciteComboboxChipDismiss.emit(event.detail);
  356. };
  357. this.clickHandler = (event) => {
  358. if (event.composedPath().some((node) => node.tagName === "CALCITE-CHIP")) {
  359. return;
  360. }
  361. this.active = !this.active;
  362. this.updateActiveItemIndex(0);
  363. this.setFocus();
  364. };
  365. this.setInactiveIfNotContained = (event) => {
  366. const composedPath = event.composedPath();
  367. if (!this.active || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
  368. return;
  369. }
  370. if (this.allowCustomValues && this.text.trim().length) {
  371. this.addCustomChip(this.text);
  372. }
  373. if (this.selectionMode === "single") {
  374. if (this.textInput) {
  375. this.textInput.value = "";
  376. }
  377. this.text = "";
  378. this.filterItems("");
  379. this.updateActiveItemIndex(-1);
  380. }
  381. this.active = false;
  382. };
  383. this.setMenuEl = (el) => {
  384. this.menuEl = el;
  385. };
  386. this.setListContainerEl = (el) => {
  387. this.resizeObserver.observe(el);
  388. this.listContainerEl = el;
  389. };
  390. this.setReferenceEl = (el) => {
  391. this.referenceEl = el;
  392. };
  393. this.inputHandler = (event) => {
  394. const value = event.target.value;
  395. this.text = value;
  396. this.filterItems(value);
  397. if (value) {
  398. this.activeChipIndex = -1;
  399. }
  400. };
  401. this.filterItems = (() => {
  402. const find = (item, filteredData) => item &&
  403. filteredData.some(({ label, value }) => {
  404. if (isGroup(item)) {
  405. return value === item.label;
  406. }
  407. return (value === item.textLabel ||
  408. value === item.value ||
  409. label === item.textLabel ||
  410. label === item.value);
  411. });
  412. return debounce((text) => {
  413. const filteredData = filter(this.data, text);
  414. const items = this.getCombinedItems();
  415. items.forEach((item) => {
  416. const hidden = !find(item, filteredData);
  417. item.hidden = hidden;
  418. const [parent, grandparent] = item.ancestors;
  419. if (find(parent, filteredData) || find(grandparent, filteredData)) {
  420. item.hidden = false;
  421. }
  422. if (!hidden) {
  423. item.ancestors.forEach((ancestor) => (ancestor.hidden = false));
  424. }
  425. });
  426. this.visibleItems = this.getVisibleItems();
  427. this.calciteComboboxFilterChange.emit({ visibleItems: [...this.visibleItems], text: text });
  428. }, 100);
  429. })();
  430. this.internalCalciteLookupChangeEvent = () => {
  431. this.calciteLookupChange.emit(this.selectedItems);
  432. };
  433. this.emitCalciteLookupChange = debounce(this.internalCalciteLookupChangeEvent, 0);
  434. this.internalComboboxChangeEvent = () => {
  435. const { selectedItems } = this;
  436. this.calciteComboboxChange.emit({ selectedItems });
  437. };
  438. this.emitComboboxChange = debounce(this.internalComboboxChangeEvent, 0);
  439. this.updateItems = () => {
  440. this.items = this.getItems();
  441. this.groupItems = this.getGroupItems();
  442. this.data = this.getData();
  443. this.selectedItems = this.getSelectedItems();
  444. this.visibleItems = this.getVisibleItems();
  445. this.needsIcon = this.getNeedsIcon();
  446. if (!this.allowCustomValues) {
  447. this.setMaxScrollerHeight();
  448. }
  449. };
  450. this.scrollToActiveItem = () => {
  451. const activeItem = this.visibleItems[this.activeItemIndex];
  452. const height = this.calculateSingleItemHeight(activeItem);
  453. const { offsetHeight, scrollTop } = this.listContainerEl;
  454. if (offsetHeight + scrollTop < activeItem.offsetTop + height) {
  455. this.listContainerEl.scrollTop = activeItem.offsetTop - offsetHeight + height;
  456. }
  457. else if (activeItem.offsetTop < scrollTop) {
  458. this.listContainerEl.scrollTop = activeItem.offsetTop;
  459. }
  460. };
  461. this.comboboxFocusHandler = () => {
  462. var _a;
  463. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  464. };
  465. this.comboboxBlurHandler = (event) => {
  466. this.setInactiveIfNotContained(event);
  467. };
  468. }
  469. activeHandler() {
  470. if (this.disabled) {
  471. this.active = false;
  472. return;
  473. }
  474. this.reposition();
  475. }
  476. handleDisabledChange(value) {
  477. if (!value) {
  478. this.active = false;
  479. }
  480. }
  481. maxItemsHandler() {
  482. this.setMaxScrollerHeight();
  483. }
  484. valueHandler(value) {
  485. if (!this.internalValueChangeFlag) {
  486. const items = this.getItems();
  487. if (Array.isArray(value)) {
  488. items.forEach((item) => (item.selected = value.includes(item.value)));
  489. }
  490. else if (value) {
  491. items.forEach((item) => (item.selected = value === item.value));
  492. }
  493. else {
  494. items.forEach((item) => (item.selected = false));
  495. }
  496. this.updateItems();
  497. }
  498. }
  499. flipPlacementsHandler() {
  500. this.setFilteredPlacements();
  501. }
  502. //--------------------------------------------------------------------------
  503. //
  504. // Event Listeners
  505. //
  506. //--------------------------------------------------------------------------
  507. documentClickHandler(event) {
  508. this.setInactiveIfNotContained(event);
  509. }
  510. calciteComboboxItemChangeHandler(event) {
  511. if (this.ignoreSelectedEventsFlag) {
  512. return;
  513. }
  514. const target = event.target;
  515. const newIndex = this.visibleItems.indexOf(target);
  516. this.updateActiveItemIndex(newIndex);
  517. this.toggleSelection(target, target.selected);
  518. }
  519. //--------------------------------------------------------------------------
  520. //
  521. // Public Methods
  522. //
  523. //--------------------------------------------------------------------------
  524. /** Updates the position of the component. */
  525. async reposition() {
  526. const { popper, menuEl } = this;
  527. const modifiers = this.getModifiers();
  528. popper
  529. ? await updatePopper({
  530. el: menuEl,
  531. modifiers,
  532. placement: defaultMenuPlacement,
  533. popper
  534. })
  535. : this.createPopper();
  536. }
  537. /** Sets focus on the component. */
  538. async setFocus() {
  539. var _a;
  540. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  541. this.activeChipIndex = -1;
  542. this.activeItemIndex = -1;
  543. }
  544. // --------------------------------------------------------------------------
  545. //
  546. // Lifecycle
  547. //
  548. // --------------------------------------------------------------------------
  549. connectedCallback() {
  550. var _a;
  551. this.internalValueChangeFlag = true;
  552. this.value = this.getValue();
  553. this.internalValueChangeFlag = false;
  554. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
  555. this.createPopper();
  556. connectLabel(this);
  557. connectForm(this);
  558. this.setFilteredPlacements();
  559. }
  560. componentWillLoad() {
  561. this.updateItems();
  562. }
  563. componentDidLoad() {
  564. afterConnectDefaultValueSet(this, this.getValue());
  565. }
  566. componentDidRender() {
  567. if (this.el.offsetHeight !== this.inputHeight) {
  568. this.reposition();
  569. this.inputHeight = this.el.offsetHeight;
  570. }
  571. updateHostInteraction(this);
  572. }
  573. disconnectedCallback() {
  574. var _a, _b;
  575. (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
  576. (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
  577. this.destroyPopper();
  578. disconnectLabel(this);
  579. disconnectForm(this);
  580. }
  581. selectedItemsHandler() {
  582. this.internalValueChangeFlag = true;
  583. this.value = this.getValue();
  584. this.internalValueChangeFlag = false;
  585. }
  586. /** when search text is cleared, reset active to */
  587. textHandler() {
  588. this.updateActiveItemIndex(-1);
  589. }
  590. comboboxInViewport() {
  591. const bounding = this.el.getBoundingClientRect();
  592. return (bounding.top >= 0 &&
  593. bounding.left >= 0 &&
  594. bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
  595. bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
  596. }
  597. getModifiers() {
  598. const flipModifier = {
  599. name: "flip",
  600. enabled: true
  601. };
  602. flipModifier.options = {
  603. fallbackPlacements: this.filteredFlipPlacements || popperMenuComputedPlacements
  604. };
  605. const eventListenerModifier = {
  606. name: "eventListeners",
  607. enabled: this.active
  608. };
  609. return [flipModifier, eventListenerModifier];
  610. }
  611. createPopper() {
  612. this.destroyPopper();
  613. const { menuEl, referenceEl, overlayPositioning } = this;
  614. const modifiers = this.getModifiers();
  615. this.popper = createPopper({
  616. el: menuEl,
  617. modifiers,
  618. overlayPositioning,
  619. placement: defaultMenuPlacement,
  620. referenceEl
  621. });
  622. }
  623. destroyPopper() {
  624. const { popper } = this;
  625. if (popper) {
  626. popper.destroy();
  627. }
  628. this.popper = null;
  629. }
  630. getMaxScrollerHeight() {
  631. const items = this.getCombinedItems().filter((item) => !item.hidden);
  632. const { maxItems } = this;
  633. let itemsToProcess = 0;
  634. let maxScrollerHeight = 0;
  635. if (items.length > maxItems) {
  636. items.forEach((item) => {
  637. if (itemsToProcess < maxItems && maxItems > 0) {
  638. const height = this.calculateSingleItemHeight(item);
  639. if (height > 0) {
  640. maxScrollerHeight += height;
  641. itemsToProcess++;
  642. }
  643. }
  644. });
  645. }
  646. return maxScrollerHeight;
  647. }
  648. calculateSingleItemHeight(item) {
  649. let height = item.offsetHeight;
  650. // if item has children items, don't count their height twice
  651. const children = Array.from(item.querySelectorAll(ComboboxChildSelector));
  652. children
  653. .map((child) => child === null || child === void 0 ? void 0 : child.offsetHeight)
  654. .forEach((offsetHeight) => {
  655. height -= offsetHeight;
  656. });
  657. return height;
  658. }
  659. getCombinedItems() {
  660. return [...this.groupItems, ...this.items];
  661. }
  662. toggleSelection(item, value = !item.selected) {
  663. if (!item) {
  664. return;
  665. }
  666. if (this.isMulti()) {
  667. item.selected = value;
  668. this.updateAncestors(item);
  669. this.selectedItems = this.getSelectedItems();
  670. this.emitCalciteLookupChange();
  671. this.emitComboboxChange();
  672. this.resetText();
  673. this.filterItems("");
  674. }
  675. else {
  676. this.ignoreSelectedEventsFlag = true;
  677. this.items.forEach((el) => (el.selected = el === item ? value : false));
  678. this.ignoreSelectedEventsFlag = false;
  679. this.selectedItems = this.getSelectedItems();
  680. this.emitComboboxChange();
  681. if (this.textInput) {
  682. this.textInput.value = item.textLabel;
  683. }
  684. this.active = false;
  685. this.updateActiveItemIndex(-1);
  686. this.resetText();
  687. this.filterItems("");
  688. }
  689. }
  690. updateAncestors(item) {
  691. if (this.selectionMode !== "ancestors") {
  692. return;
  693. }
  694. const ancestors = getItemAncestors(item);
  695. const children = getItemChildren(item);
  696. if (item.selected) {
  697. ancestors.forEach((el) => {
  698. el.selected = true;
  699. });
  700. }
  701. else {
  702. children.forEach((el) => (el.selected = false));
  703. [...ancestors].forEach((el) => {
  704. if (!hasActiveChildren(el)) {
  705. el.selected = false;
  706. }
  707. });
  708. }
  709. }
  710. getVisibleItems() {
  711. return this.items.filter((item) => !item.hidden);
  712. }
  713. getSelectedItems() {
  714. if (!this.isMulti()) {
  715. const match = this.items.find(({ selected }) => selected);
  716. return match ? [match] : [];
  717. }
  718. return (this.items
  719. .filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)))
  720. /** Preserve order of entered tags */
  721. .sort((a, b) => {
  722. const aIdx = this.selectedItems.indexOf(a);
  723. const bIdx = this.selectedItems.indexOf(b);
  724. if (aIdx > -1 && bIdx > -1) {
  725. return aIdx - bIdx;
  726. }
  727. return bIdx - aIdx;
  728. }));
  729. }
  730. getData() {
  731. return this.items.map((item) => ({
  732. constant: item.constant,
  733. value: item.value,
  734. label: item.textLabel
  735. }));
  736. }
  737. getNeedsIcon() {
  738. return this.selectionMode === "single" && this.items.some((item) => item.icon);
  739. }
  740. resetText() {
  741. if (this.textInput) {
  742. this.textInput.value = "";
  743. }
  744. this.text = "";
  745. }
  746. getItems() {
  747. const items = Array.from(this.el.querySelectorAll(ComboboxItem));
  748. return items.filter((item) => !item.disabled);
  749. }
  750. getGroupItems() {
  751. return Array.from(this.el.querySelectorAll(ComboboxItemGroup));
  752. }
  753. addCustomChip(value, focus) {
  754. const existingItem = this.items.find((el) => el.textLabel === value);
  755. if (existingItem) {
  756. this.toggleSelection(existingItem, true);
  757. }
  758. else {
  759. if (!this.isMulti()) {
  760. this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
  761. }
  762. const item = document.createElement(ComboboxItem);
  763. item.value = value;
  764. item.textLabel = value;
  765. item.selected = true;
  766. this.el.appendChild(item);
  767. this.resetText();
  768. if (focus) {
  769. this.setFocus();
  770. }
  771. this.updateItems();
  772. this.filterItems("");
  773. this.emitCalciteLookupChange();
  774. this.emitComboboxChange();
  775. }
  776. }
  777. removeActiveChip() {
  778. this.toggleSelection(this.selectedItems[this.activeChipIndex], false);
  779. this.setFocus();
  780. }
  781. removeLastChip() {
  782. this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
  783. this.setFocus();
  784. }
  785. previousChip() {
  786. if (this.text) {
  787. return;
  788. }
  789. const length = this.selectedItems.length - 1;
  790. const active = this.activeChipIndex;
  791. this.activeChipIndex = active === -1 ? length : Math.max(active - 1, 0);
  792. this.updateActiveItemIndex(-1);
  793. this.focusChip();
  794. }
  795. nextChip() {
  796. if (this.text || this.activeChipIndex === -1) {
  797. return;
  798. }
  799. const last = this.selectedItems.length - 1;
  800. const newIndex = this.activeChipIndex + 1;
  801. if (newIndex > last) {
  802. this.activeChipIndex = -1;
  803. this.setFocus();
  804. }
  805. else {
  806. this.activeChipIndex = newIndex;
  807. this.focusChip();
  808. }
  809. this.updateActiveItemIndex(-1);
  810. }
  811. focusChip() {
  812. var _a;
  813. const guid = (_a = this.selectedItems[this.activeChipIndex]) === null || _a === void 0 ? void 0 : _a.guid;
  814. const chip = guid
  815. ? this.referenceEl.querySelector(`#${chipUidPrefix}${guid}`)
  816. : null;
  817. chip === null || chip === void 0 ? void 0 : chip.setFocus();
  818. }
  819. shiftActiveItemIndex(delta) {
  820. const { length } = this.visibleItems;
  821. const newIndex = (this.activeItemIndex + length + delta) % length;
  822. this.updateActiveItemIndex(newIndex);
  823. this.scrollToActiveItem();
  824. }
  825. updateActiveItemIndex(index) {
  826. var _a;
  827. this.activeItemIndex = index;
  828. let activeDescendant = null;
  829. this.visibleItems.forEach((el, i) => {
  830. if (i === index) {
  831. el.active = true;
  832. activeDescendant = el.guid;
  833. }
  834. else {
  835. el.active = false;
  836. }
  837. });
  838. this.activeDescendant = activeDescendant;
  839. if (this.activeItemIndex > -1) {
  840. this.activeChipIndex = -1;
  841. (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
  842. }
  843. }
  844. isMulti() {
  845. return this.selectionMode !== "single";
  846. }
  847. //--------------------------------------------------------------------------
  848. //
  849. // Render Methods
  850. //
  851. //--------------------------------------------------------------------------
  852. renderChips() {
  853. const { activeChipIndex, scale, selectionMode, intlRemoveTag } = this;
  854. return this.selectedItems.map((item, i) => {
  855. const chipClasses = {
  856. chip: true,
  857. "chip--active": activeChipIndex === i
  858. };
  859. const ancestors = [...getItemAncestors(item)].reverse();
  860. const pathLabel = [...ancestors, item].map((el) => el.textLabel);
  861. const label = selectionMode !== "ancestors" ? item.textLabel : pathLabel.join(" / ");
  862. return (h("calcite-chip", { class: chipClasses, dismissLabel: intlRemoveTag, dismissible: true, icon: item.icon, id: item.guid ? `${chipUidPrefix}${item.guid}` : null, key: item.textLabel, onCalciteChipDismiss: (event) => this.calciteChipDismissHandler(event, item), scale: scale, title: label, value: item.value }, label));
  863. });
  864. }
  865. renderInput() {
  866. const { guid, active, disabled, placeholder, selectionMode, needsIcon, selectedItems } = this;
  867. const single = selectionMode === "single";
  868. const selectedItem = selectedItems[0];
  869. const showLabel = !active && single && !!selectedItem;
  870. return (h("span", { class: {
  871. "input-wrap": true,
  872. "input-wrap--single": single
  873. } }, showLabel && (h("span", { class: {
  874. label: true,
  875. "label--spaced": needsIcon
  876. }, key: "label" }, selectedItem.textLabel)), h("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-label": getLabelText(this), class: {
  877. input: true,
  878. "input--single": true,
  879. "input--transparent": this.activeChipIndex > -1,
  880. "input--hidden": showLabel,
  881. "input--icon": single && needsIcon
  882. }, disabled: disabled, id: `${inputUidPrefix}${guid}`, key: "input", onBlur: this.comboboxBlurHandler, onFocus: this.comboboxFocusHandler, onInput: this.inputHandler, placeholder: placeholder, ref: (el) => (this.textInput = el), type: "text" })));
  883. }
  884. renderListBoxOptions() {
  885. return this.visibleItems.map((item) => (h("li", { "aria-selected": toAriaBoolean(item.selected), id: item.guid ? `${itemUidPrefix}${item.guid}` : null, role: "option", tabindex: "-1" }, item.textLabel)));
  886. }
  887. renderPopperContainer() {
  888. const { active, setMenuEl, setListContainerEl } = this;
  889. const classes = {
  890. "list-container": true,
  891. [CSS.animation]: true,
  892. [CSS.animationActive]: active
  893. };
  894. return (h("div", { "aria-hidden": "true", class: { "popper-container": true, "popper-container--active": active }, ref: setMenuEl }, h("div", { class: classes, onTransitionEnd: this.transitionEnd, ref: setListContainerEl }, h("ul", { class: { list: true, "list--hide": !active } }, h("slot", null)))));
  895. }
  896. renderIconStart() {
  897. const { selectionMode, needsIcon, selectedItems } = this;
  898. const selectedItem = selectedItems[0];
  899. return (selectionMode === "single" &&
  900. needsIcon && (h("span", { class: "icon-start" }, (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon) && (h("calcite-icon", { class: "selected-icon", icon: selectedItem.icon, scale: "s" })))));
  901. }
  902. renderIconEnd() {
  903. const { active } = this;
  904. return (h("span", { class: "icon-end" }, h("calcite-icon", { icon: active ? "chevron-up" : "chevron-down", scale: "s" })));
  905. }
  906. render() {
  907. const { active, guid, label } = this;
  908. const single = this.selectionMode === "single";
  909. return (h(Host, { onKeyDown: this.keydownHandler }, h("div", { "aria-autocomplete": "list", "aria-expanded": toAriaBoolean(active), "aria-haspopup": "listbox", "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-owns": `${listboxUidPrefix}${guid}`, class: {
  910. wrapper: true,
  911. "wrapper--single": single || !this.selectedItems.length,
  912. "wrapper--active": active
  913. }, onClick: this.clickHandler, ref: this.setReferenceEl, role: "combobox" }, h("div", { class: "grid-input" }, this.renderIconStart(), !single && this.renderChips(), h("label", { class: "screen-readers-only", htmlFor: `${inputUidPrefix}${guid}`, id: `${labelUidPrefix}${guid}` }, label), this.renderInput()), this.renderIconEnd()), h("ul", { "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-multiselectable": "true", class: "screen-readers-only", id: `${listboxUidPrefix}${guid}`, role: "listbox", tabIndex: -1 }, this.renderListBoxOptions()), this.renderPopperContainer(), h(HiddenFormInputSlot, { component: this })));
  914. }
  915. get el() { return this; }
  916. static get watchers() { return {
  917. "active": ["activeHandler"],
  918. "disabled": ["handleDisabledChange"],
  919. "maxItems": ["maxItemsHandler"],
  920. "value": ["valueHandler"],
  921. "flipPlacements": ["flipPlacementsHandler"],
  922. "selectedItems": ["selectedItemsHandler"],
  923. "text": ["textHandler"]
  924. }; }
  925. static get style() { return comboboxCss; }
  926. }, [1, "calcite-combobox", {
  927. "active": [1540],
  928. "disabled": [516],
  929. "label": [1],
  930. "placeholder": [1],
  931. "maxItems": [2, "max-items"],
  932. "name": [513],
  933. "allowCustomValues": [4, "allow-custom-values"],
  934. "overlayPositioning": [1, "overlay-positioning"],
  935. "required": [4],
  936. "selectionMode": [513, "selection-mode"],
  937. "scale": [513],
  938. "value": [1025],
  939. "intlRemoveTag": [1, "intl-remove-tag"],
  940. "flipPlacements": [16],
  941. "items": [32],
  942. "groupItems": [32],
  943. "selectedItems": [32],
  944. "visibleItems": [32],
  945. "needsIcon": [32],
  946. "activeItemIndex": [32],
  947. "activeChipIndex": [32],
  948. "activeDescendant": [32],
  949. "text": [32],
  950. "reposition": [64],
  951. "setFocus": [64]
  952. }, [[4, "click", "documentClickHandler"], [0, "calciteComboboxItemChange", "calciteComboboxItemChangeHandler"]]]);
  953. function defineCustomElement$1() {
  954. if (typeof customElements === "undefined") {
  955. return;
  956. }
  957. const components = ["calcite-combobox", "calcite-chip", "calcite-icon"];
  958. components.forEach(tagName => { switch (tagName) {
  959. case "calcite-combobox":
  960. if (!customElements.get(tagName)) {
  961. customElements.define(tagName, Combobox);
  962. }
  963. break;
  964. case "calcite-chip":
  965. if (!customElements.get(tagName)) {
  966. defineCustomElement$3();
  967. }
  968. break;
  969. case "calcite-icon":
  970. if (!customElements.get(tagName)) {
  971. defineCustomElement$2();
  972. }
  973. break;
  974. } });
  975. }
  976. defineCustomElement$1();
  977. const CalciteCombobox = Combobox;
  978. const defineCustomElement = defineCustomElement$1;
  979. export { CalciteCombobox, defineCustomElement };