popover.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  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.97
  5. */
  6. import { forceUpdate, Host, h } from "@stencil/core";
  7. import { CSS, ARIA_CONTROLS, ARIA_EXPANDED, HEADING_LEVEL, TEXT, defaultPopoverPlacement } from "./resources";
  8. import { FloatingCSS, connectFloatingUI, disconnectFloatingUI, defaultOffsetDistance, filterComputedPlacements, reposition, updateAfterClose } from "../../utils/floating-ui";
  9. import { guid } from "../../utils/guid";
  10. import { queryElementRoots, toAriaBoolean } from "../../utils/dom";
  11. import { connectOpenCloseComponent, disconnectOpenCloseComponent } from "../../utils/openCloseComponent";
  12. import { Heading } from "../functional/Heading";
  13. import PopoverManager from "./PopoverManager";
  14. const manager = new PopoverManager();
  15. /**
  16. * @slot - A slot for adding custom content.
  17. */
  18. export class Popover {
  19. constructor() {
  20. // --------------------------------------------------------------------------
  21. //
  22. // Properties
  23. //
  24. // --------------------------------------------------------------------------
  25. /**
  26. * When `true`, clicking outside of the component automatically closes open `calcite-popover`s.
  27. */
  28. this.autoClose = false;
  29. /**
  30. * When `true`, a close button is added to the component.
  31. *
  32. * @deprecated use dismissible instead.
  33. */
  34. this.closeButton = false;
  35. /**
  36. * When `true`, a close button is added to the component.
  37. *
  38. * @deprecated use `closable` instead.
  39. */
  40. this.dismissible = false;
  41. /** When `true`, display a close button within the component. */
  42. this.closable = false;
  43. /**
  44. * When `true`, prevents flipping the component's placement when overlapping its `referenceElement`.
  45. */
  46. this.disableFlip = false;
  47. /**
  48. * When `true`, removes the caret pointer.
  49. */
  50. this.disablePointer = false;
  51. /**
  52. * Offsets the position of the component away from the `referenceElement`.
  53. *
  54. * @default 6
  55. */
  56. this.offsetDistance = defaultOffsetDistance;
  57. /**
  58. * Offsets the position of the component along the `referenceElement`.
  59. */
  60. this.offsetSkidding = 0;
  61. /**
  62. * When `true`, displays and positions the component.
  63. */
  64. this.open = false;
  65. /**
  66. * Determines the type of positioning to use for the overlaid content.
  67. *
  68. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  69. *
  70. * `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  71. *
  72. */
  73. this.overlayPositioning = "absolute";
  74. /**
  75. * Determines where the component will be positioned relative to the `referenceElement`.
  76. *
  77. * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
  78. */
  79. this.placement = defaultPopoverPlacement;
  80. /**
  81. * When `true`, disables automatically toggling the component when its `referenceElement` has been triggered.
  82. *
  83. * This property can be set to `true` to manage when the component is open.
  84. */
  85. this.triggerDisabled = false;
  86. /**
  87. * Accessible name for the component's close button.
  88. *
  89. * @default "Close"
  90. */
  91. this.intlClose = TEXT.close;
  92. this.guid = `calcite-popover-${guid()}`;
  93. this.openTransitionProp = "opacity";
  94. this.hasLoaded = false;
  95. // --------------------------------------------------------------------------
  96. //
  97. // Private Methods
  98. //
  99. // --------------------------------------------------------------------------
  100. this.setTransitionEl = (el) => {
  101. this.transitionEl = el;
  102. connectOpenCloseComponent(this);
  103. };
  104. this.setFilteredPlacements = () => {
  105. const { el, flipPlacements } = this;
  106. this.filteredFlipPlacements = flipPlacements
  107. ? filterComputedPlacements(flipPlacements, el)
  108. : null;
  109. };
  110. this.setUpReferenceElement = (warn = true) => {
  111. this.removeReferences();
  112. this.effectiveReferenceElement = this.getReferenceElement();
  113. connectFloatingUI(this, this.effectiveReferenceElement, this.el);
  114. const { el, referenceElement, effectiveReferenceElement } = this;
  115. if (warn && referenceElement && !effectiveReferenceElement) {
  116. console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
  117. el
  118. });
  119. }
  120. this.addReferences();
  121. };
  122. this.getId = () => {
  123. return this.el.id || this.guid;
  124. };
  125. this.setExpandedAttr = () => {
  126. const { effectiveReferenceElement, open } = this;
  127. if (!effectiveReferenceElement) {
  128. return;
  129. }
  130. if ("setAttribute" in effectiveReferenceElement) {
  131. effectiveReferenceElement.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
  132. }
  133. };
  134. this.addReferences = () => {
  135. const { effectiveReferenceElement } = this;
  136. if (!effectiveReferenceElement) {
  137. return;
  138. }
  139. const id = this.getId();
  140. if ("setAttribute" in effectiveReferenceElement) {
  141. effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
  142. }
  143. manager.registerElement(effectiveReferenceElement, this.el);
  144. this.setExpandedAttr();
  145. };
  146. this.removeReferences = () => {
  147. const { effectiveReferenceElement } = this;
  148. if (!effectiveReferenceElement) {
  149. return;
  150. }
  151. if ("removeAttribute" in effectiveReferenceElement) {
  152. effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
  153. effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
  154. }
  155. manager.unregisterElement(effectiveReferenceElement);
  156. };
  157. this.hide = () => {
  158. this.open = false;
  159. };
  160. this.storeArrowEl = (el) => {
  161. this.arrowEl = el;
  162. this.reposition(true);
  163. };
  164. }
  165. handleDismissible(value) {
  166. this.closable = value;
  167. }
  168. handleClosable(value) {
  169. this.dismissible = value;
  170. }
  171. flipPlacementsHandler() {
  172. this.setFilteredPlacements();
  173. this.reposition(true);
  174. }
  175. offsetDistanceOffsetHandler() {
  176. this.reposition(true);
  177. }
  178. offsetSkiddingHandler() {
  179. this.reposition(true);
  180. }
  181. openHandler(value) {
  182. if (value) {
  183. this.reposition(true);
  184. }
  185. else {
  186. updateAfterClose(this.el);
  187. }
  188. this.setExpandedAttr();
  189. }
  190. overlayPositioningHandler() {
  191. this.reposition(true);
  192. }
  193. placementHandler() {
  194. this.reposition(true);
  195. }
  196. referenceElementHandler() {
  197. this.setUpReferenceElement();
  198. this.reposition(true);
  199. }
  200. // --------------------------------------------------------------------------
  201. //
  202. // Lifecycle
  203. //
  204. // --------------------------------------------------------------------------
  205. connectedCallback() {
  206. this.setFilteredPlacements();
  207. connectOpenCloseComponent(this);
  208. const closable = this.closable || this.dismissible;
  209. if (closable) {
  210. this.handleDismissible(closable);
  211. }
  212. if (closable) {
  213. this.handleClosable(closable);
  214. }
  215. this.setUpReferenceElement(this.hasLoaded);
  216. }
  217. componentDidLoad() {
  218. if (this.referenceElement && !this.effectiveReferenceElement) {
  219. this.setUpReferenceElement();
  220. }
  221. this.reposition();
  222. this.hasLoaded = true;
  223. }
  224. disconnectedCallback() {
  225. this.removeReferences();
  226. disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
  227. disconnectOpenCloseComponent(this);
  228. }
  229. // --------------------------------------------------------------------------
  230. //
  231. // Public Methods
  232. //
  233. // --------------------------------------------------------------------------
  234. /**
  235. * Updates the position of the component.
  236. *
  237. * @param delayed
  238. */
  239. async reposition(delayed = false) {
  240. const { el, effectiveReferenceElement, placement, overlayPositioning, disableFlip, filteredFlipPlacements, offsetDistance, offsetSkidding, arrowEl } = this;
  241. return reposition(this, {
  242. floatingEl: el,
  243. referenceEl: effectiveReferenceElement,
  244. overlayPositioning,
  245. placement,
  246. disableFlip,
  247. flipPlacements: filteredFlipPlacements,
  248. offsetDistance,
  249. offsetSkidding,
  250. includeArrow: !this.disablePointer,
  251. arrowEl,
  252. type: "popover"
  253. }, delayed);
  254. }
  255. /**
  256. * Sets focus on the component.
  257. *
  258. * @param focusId
  259. */
  260. async setFocus(focusId) {
  261. var _a;
  262. const { closeButtonEl } = this;
  263. if (focusId === "close-button" && closeButtonEl) {
  264. forceUpdate(closeButtonEl);
  265. closeButtonEl.setFocus();
  266. return;
  267. }
  268. (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
  269. }
  270. /**
  271. * Toggles the component's open property.
  272. *
  273. * @param value
  274. */
  275. async toggle(value = !this.open) {
  276. this.open = value;
  277. }
  278. getReferenceElement() {
  279. const { referenceElement, el } = this;
  280. return ((typeof referenceElement === "string"
  281. ? queryElementRoots(el, { id: referenceElement })
  282. : referenceElement) || null);
  283. }
  284. onBeforeOpen() {
  285. this.calcitePopoverBeforeOpen.emit();
  286. }
  287. onOpen() {
  288. this.calcitePopoverOpen.emit();
  289. }
  290. onBeforeClose() {
  291. this.calcitePopoverBeforeClose.emit();
  292. }
  293. onClose() {
  294. this.calcitePopoverClose.emit();
  295. }
  296. // --------------------------------------------------------------------------
  297. //
  298. // Render Methods
  299. //
  300. // --------------------------------------------------------------------------
  301. renderCloseButton() {
  302. const { closeButton, intlClose, heading, closable } = this;
  303. return closable || closeButton ? (h("div", { class: CSS.closeButtonContainer }, h("calcite-action", { class: CSS.closeButton, onClick: this.hide, ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl), scale: heading ? "s" : "m", text: intlClose }, h("calcite-icon", { icon: "x", scale: heading ? "s" : "m" })))) : null;
  304. }
  305. renderHeader() {
  306. const { heading, headingLevel } = this;
  307. const headingNode = heading ? (h(Heading, { class: CSS.heading, level: headingLevel || HEADING_LEVEL }, heading)) : null;
  308. return headingNode ? (h("div", { class: CSS.header }, headingNode, this.renderCloseButton())) : null;
  309. }
  310. render() {
  311. const { effectiveReferenceElement, heading, label, open, disablePointer } = this;
  312. const displayed = effectiveReferenceElement && open;
  313. const hidden = !displayed;
  314. const arrowNode = !disablePointer ? h("div", { class: CSS.arrow, ref: this.storeArrowEl }) : null;
  315. return (h(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "dialog" }, h("div", { class: {
  316. [FloatingCSS.animation]: true,
  317. [FloatingCSS.animationActive]: displayed
  318. }, ref: this.setTransitionEl }, arrowNode, h("div", { class: {
  319. [CSS.hasHeader]: !!heading,
  320. [CSS.container]: true
  321. } }, this.renderHeader(), h("div", { class: CSS.content }, h("slot", null)), !heading ? this.renderCloseButton() : null))));
  322. }
  323. static get is() { return "calcite-popover"; }
  324. static get encapsulation() { return "shadow"; }
  325. static get originalStyleUrls() {
  326. return {
  327. "$": ["popover.scss"]
  328. };
  329. }
  330. static get styleUrls() {
  331. return {
  332. "$": ["popover.css"]
  333. };
  334. }
  335. static get properties() {
  336. return {
  337. "autoClose": {
  338. "type": "boolean",
  339. "mutable": false,
  340. "complexType": {
  341. "original": "boolean",
  342. "resolved": "boolean",
  343. "references": {}
  344. },
  345. "required": false,
  346. "optional": false,
  347. "docs": {
  348. "tags": [],
  349. "text": "When `true`, clicking outside of the component automatically closes open `calcite-popover`s."
  350. },
  351. "attribute": "auto-close",
  352. "reflect": true,
  353. "defaultValue": "false"
  354. },
  355. "closeButton": {
  356. "type": "boolean",
  357. "mutable": false,
  358. "complexType": {
  359. "original": "boolean",
  360. "resolved": "boolean",
  361. "references": {}
  362. },
  363. "required": false,
  364. "optional": false,
  365. "docs": {
  366. "tags": [{
  367. "name": "deprecated",
  368. "text": "use dismissible instead."
  369. }],
  370. "text": "When `true`, a close button is added to the component."
  371. },
  372. "attribute": "close-button",
  373. "reflect": true,
  374. "defaultValue": "false"
  375. },
  376. "dismissible": {
  377. "type": "boolean",
  378. "mutable": true,
  379. "complexType": {
  380. "original": "boolean",
  381. "resolved": "boolean",
  382. "references": {}
  383. },
  384. "required": false,
  385. "optional": false,
  386. "docs": {
  387. "tags": [{
  388. "name": "deprecated",
  389. "text": "use `closable` instead."
  390. }],
  391. "text": "When `true`, a close button is added to the component."
  392. },
  393. "attribute": "dismissible",
  394. "reflect": true,
  395. "defaultValue": "false"
  396. },
  397. "closable": {
  398. "type": "boolean",
  399. "mutable": true,
  400. "complexType": {
  401. "original": "boolean",
  402. "resolved": "boolean",
  403. "references": {}
  404. },
  405. "required": false,
  406. "optional": false,
  407. "docs": {
  408. "tags": [],
  409. "text": "When `true`, display a close button within the component."
  410. },
  411. "attribute": "closable",
  412. "reflect": true,
  413. "defaultValue": "false"
  414. },
  415. "disableFlip": {
  416. "type": "boolean",
  417. "mutable": false,
  418. "complexType": {
  419. "original": "boolean",
  420. "resolved": "boolean",
  421. "references": {}
  422. },
  423. "required": false,
  424. "optional": false,
  425. "docs": {
  426. "tags": [],
  427. "text": "When `true`, prevents flipping the component's placement when overlapping its `referenceElement`."
  428. },
  429. "attribute": "disable-flip",
  430. "reflect": true,
  431. "defaultValue": "false"
  432. },
  433. "disablePointer": {
  434. "type": "boolean",
  435. "mutable": false,
  436. "complexType": {
  437. "original": "boolean",
  438. "resolved": "boolean",
  439. "references": {}
  440. },
  441. "required": false,
  442. "optional": false,
  443. "docs": {
  444. "tags": [],
  445. "text": "When `true`, removes the caret pointer."
  446. },
  447. "attribute": "disable-pointer",
  448. "reflect": true,
  449. "defaultValue": "false"
  450. },
  451. "flipPlacements": {
  452. "type": "unknown",
  453. "mutable": false,
  454. "complexType": {
  455. "original": "EffectivePlacement[]",
  456. "resolved": "Placement[]",
  457. "references": {
  458. "EffectivePlacement": {
  459. "location": "import",
  460. "path": "../../utils/floating-ui"
  461. }
  462. }
  463. },
  464. "required": false,
  465. "optional": true,
  466. "docs": {
  467. "tags": [],
  468. "text": "Defines the available placements that can be used when a flip occurs."
  469. }
  470. },
  471. "heading": {
  472. "type": "string",
  473. "mutable": false,
  474. "complexType": {
  475. "original": "string",
  476. "resolved": "string",
  477. "references": {}
  478. },
  479. "required": false,
  480. "optional": true,
  481. "docs": {
  482. "tags": [],
  483. "text": "The component header text."
  484. },
  485. "attribute": "heading",
  486. "reflect": false
  487. },
  488. "headingLevel": {
  489. "type": "number",
  490. "mutable": false,
  491. "complexType": {
  492. "original": "HeadingLevel",
  493. "resolved": "1 | 2 | 3 | 4 | 5 | 6",
  494. "references": {
  495. "HeadingLevel": {
  496. "location": "import",
  497. "path": "../functional/Heading"
  498. }
  499. }
  500. },
  501. "required": false,
  502. "optional": false,
  503. "docs": {
  504. "tags": [],
  505. "text": "Specifies the number at which section headings should start."
  506. },
  507. "attribute": "heading-level",
  508. "reflect": true
  509. },
  510. "label": {
  511. "type": "string",
  512. "mutable": false,
  513. "complexType": {
  514. "original": "string",
  515. "resolved": "string",
  516. "references": {}
  517. },
  518. "required": true,
  519. "optional": false,
  520. "docs": {
  521. "tags": [],
  522. "text": "Accessible name for the component."
  523. },
  524. "attribute": "label",
  525. "reflect": false
  526. },
  527. "offsetDistance": {
  528. "type": "number",
  529. "mutable": false,
  530. "complexType": {
  531. "original": "number",
  532. "resolved": "number",
  533. "references": {}
  534. },
  535. "required": false,
  536. "optional": false,
  537. "docs": {
  538. "tags": [{
  539. "name": "default",
  540. "text": "6"
  541. }],
  542. "text": "Offsets the position of the component away from the `referenceElement`."
  543. },
  544. "attribute": "offset-distance",
  545. "reflect": true,
  546. "defaultValue": "defaultOffsetDistance"
  547. },
  548. "offsetSkidding": {
  549. "type": "number",
  550. "mutable": false,
  551. "complexType": {
  552. "original": "number",
  553. "resolved": "number",
  554. "references": {}
  555. },
  556. "required": false,
  557. "optional": false,
  558. "docs": {
  559. "tags": [],
  560. "text": "Offsets the position of the component along the `referenceElement`."
  561. },
  562. "attribute": "offset-skidding",
  563. "reflect": true,
  564. "defaultValue": "0"
  565. },
  566. "open": {
  567. "type": "boolean",
  568. "mutable": true,
  569. "complexType": {
  570. "original": "boolean",
  571. "resolved": "boolean",
  572. "references": {}
  573. },
  574. "required": false,
  575. "optional": false,
  576. "docs": {
  577. "tags": [],
  578. "text": "When `true`, displays and positions the component."
  579. },
  580. "attribute": "open",
  581. "reflect": true,
  582. "defaultValue": "false"
  583. },
  584. "overlayPositioning": {
  585. "type": "string",
  586. "mutable": false,
  587. "complexType": {
  588. "original": "OverlayPositioning",
  589. "resolved": "\"absolute\" | \"fixed\"",
  590. "references": {
  591. "OverlayPositioning": {
  592. "location": "import",
  593. "path": "../../utils/floating-ui"
  594. }
  595. }
  596. },
  597. "required": false,
  598. "optional": false,
  599. "docs": {
  600. "tags": [],
  601. "text": "Determines the type of positioning to use for the overlaid content.\n\nUsing `\"absolute\"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.\n\n`\"fixed\"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `\"fixed\"`."
  602. },
  603. "attribute": "overlay-positioning",
  604. "reflect": true,
  605. "defaultValue": "\"absolute\""
  606. },
  607. "placement": {
  608. "type": "string",
  609. "mutable": false,
  610. "complexType": {
  611. "original": "LogicalPlacement",
  612. "resolved": "Placement | VariationPlacement | AutoPlacement | DeprecatedPlacement",
  613. "references": {
  614. "LogicalPlacement": {
  615. "location": "import",
  616. "path": "../../utils/floating-ui"
  617. }
  618. }
  619. },
  620. "required": false,
  621. "optional": false,
  622. "docs": {
  623. "tags": [{
  624. "name": "see",
  625. "text": "[LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)"
  626. }],
  627. "text": "Determines where the component will be positioned relative to the `referenceElement`."
  628. },
  629. "attribute": "placement",
  630. "reflect": true,
  631. "defaultValue": "defaultPopoverPlacement"
  632. },
  633. "referenceElement": {
  634. "type": "string",
  635. "mutable": false,
  636. "complexType": {
  637. "original": "ReferenceElement | string",
  638. "resolved": "Element | VirtualElement | string",
  639. "references": {
  640. "ReferenceElement": {
  641. "location": "import",
  642. "path": "../../utils/floating-ui"
  643. }
  644. }
  645. },
  646. "required": true,
  647. "optional": false,
  648. "docs": {
  649. "tags": [],
  650. "text": "The `referenceElement` used to position the component according to its `placement` value. Setting to an `HTMLElement` is preferred so the component does not need to query the DOM. However, a string `id` of the reference element can also be used."
  651. },
  652. "attribute": "reference-element",
  653. "reflect": false
  654. },
  655. "triggerDisabled": {
  656. "type": "boolean",
  657. "mutable": false,
  658. "complexType": {
  659. "original": "boolean",
  660. "resolved": "boolean",
  661. "references": {}
  662. },
  663. "required": false,
  664. "optional": false,
  665. "docs": {
  666. "tags": [],
  667. "text": "When `true`, disables automatically toggling the component when its `referenceElement` has been triggered.\n\nThis property can be set to `true` to manage when the component is open."
  668. },
  669. "attribute": "trigger-disabled",
  670. "reflect": true,
  671. "defaultValue": "false"
  672. },
  673. "intlClose": {
  674. "type": "string",
  675. "mutable": false,
  676. "complexType": {
  677. "original": "string",
  678. "resolved": "string",
  679. "references": {}
  680. },
  681. "required": false,
  682. "optional": false,
  683. "docs": {
  684. "tags": [{
  685. "name": "default",
  686. "text": "\"Close\""
  687. }],
  688. "text": "Accessible name for the component's close button."
  689. },
  690. "attribute": "intl-close",
  691. "reflect": false,
  692. "defaultValue": "TEXT.close"
  693. }
  694. };
  695. }
  696. static get states() {
  697. return {
  698. "effectiveReferenceElement": {}
  699. };
  700. }
  701. static get events() {
  702. return [{
  703. "method": "calcitePopoverBeforeClose",
  704. "name": "calcitePopoverBeforeClose",
  705. "bubbles": true,
  706. "cancelable": false,
  707. "composed": true,
  708. "docs": {
  709. "tags": [],
  710. "text": "Fires when the component is requested to be closed and before the closing transition begins."
  711. },
  712. "complexType": {
  713. "original": "void",
  714. "resolved": "void",
  715. "references": {}
  716. }
  717. }, {
  718. "method": "calcitePopoverClose",
  719. "name": "calcitePopoverClose",
  720. "bubbles": true,
  721. "cancelable": false,
  722. "composed": true,
  723. "docs": {
  724. "tags": [],
  725. "text": "Fires when the component is closed and animation is complete."
  726. },
  727. "complexType": {
  728. "original": "void",
  729. "resolved": "void",
  730. "references": {}
  731. }
  732. }, {
  733. "method": "calcitePopoverBeforeOpen",
  734. "name": "calcitePopoverBeforeOpen",
  735. "bubbles": true,
  736. "cancelable": false,
  737. "composed": true,
  738. "docs": {
  739. "tags": [],
  740. "text": "Fires when the component is added to the DOM but not rendered, and before the opening transition begins."
  741. },
  742. "complexType": {
  743. "original": "void",
  744. "resolved": "void",
  745. "references": {}
  746. }
  747. }, {
  748. "method": "calcitePopoverOpen",
  749. "name": "calcitePopoverOpen",
  750. "bubbles": true,
  751. "cancelable": false,
  752. "composed": true,
  753. "docs": {
  754. "tags": [],
  755. "text": "Fires when the component is open and animation is complete."
  756. },
  757. "complexType": {
  758. "original": "void",
  759. "resolved": "void",
  760. "references": {}
  761. }
  762. }];
  763. }
  764. static get methods() {
  765. return {
  766. "reposition": {
  767. "complexType": {
  768. "signature": "(delayed?: boolean) => Promise<void>",
  769. "parameters": [{
  770. "tags": [{
  771. "name": "param",
  772. "text": "delayed"
  773. }],
  774. "text": ""
  775. }],
  776. "references": {
  777. "Promise": {
  778. "location": "global"
  779. }
  780. },
  781. "return": "Promise<void>"
  782. },
  783. "docs": {
  784. "text": "Updates the position of the component.",
  785. "tags": [{
  786. "name": "param",
  787. "text": "delayed"
  788. }]
  789. }
  790. },
  791. "setFocus": {
  792. "complexType": {
  793. "signature": "(focusId?: \"close-button\") => Promise<void>",
  794. "parameters": [{
  795. "tags": [{
  796. "name": "param",
  797. "text": "focusId"
  798. }],
  799. "text": ""
  800. }],
  801. "references": {
  802. "Promise": {
  803. "location": "global"
  804. }
  805. },
  806. "return": "Promise<void>"
  807. },
  808. "docs": {
  809. "text": "Sets focus on the component.",
  810. "tags": [{
  811. "name": "param",
  812. "text": "focusId"
  813. }]
  814. }
  815. },
  816. "toggle": {
  817. "complexType": {
  818. "signature": "(value?: boolean) => Promise<void>",
  819. "parameters": [{
  820. "tags": [{
  821. "name": "param",
  822. "text": "value"
  823. }],
  824. "text": ""
  825. }],
  826. "references": {
  827. "Promise": {
  828. "location": "global"
  829. }
  830. },
  831. "return": "Promise<void>"
  832. },
  833. "docs": {
  834. "text": "Toggles the component's open property.",
  835. "tags": [{
  836. "name": "param",
  837. "text": "value"
  838. }]
  839. }
  840. }
  841. };
  842. }
  843. static get elementRef() { return "el"; }
  844. static get watchers() {
  845. return [{
  846. "propName": "dismissible",
  847. "methodName": "handleDismissible"
  848. }, {
  849. "propName": "closable",
  850. "methodName": "handleClosable"
  851. }, {
  852. "propName": "flipPlacements",
  853. "methodName": "flipPlacementsHandler"
  854. }, {
  855. "propName": "offsetDistance",
  856. "methodName": "offsetDistanceOffsetHandler"
  857. }, {
  858. "propName": "offsetSkidding",
  859. "methodName": "offsetSkiddingHandler"
  860. }, {
  861. "propName": "open",
  862. "methodName": "openHandler"
  863. }, {
  864. "propName": "overlayPositioning",
  865. "methodName": "overlayPositioningHandler"
  866. }, {
  867. "propName": "placement",
  868. "methodName": "placementHandler"
  869. }, {
  870. "propName": "referenceElement",
  871. "methodName": "referenceElementHandler"
  872. }];
  873. }
  874. }