@empathyco/x-components 6.0.0-alpha.71 → 6.0.0-alpha.73

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.
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [removeSearchInputFocus](./x-components.removesearchinputfocus.md)
4
+
5
+ ## removeSearchInputFocus variable
6
+
7
+ Removes focus from the search input element if it is currently focused. This function checks if the active element in the document matches the selector '.x-search-input' and, if so, blurs the element to remove focus.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ removeSearchInputFocus: () => void
13
+ ```
@@ -8,11 +8,11 @@ title: BaseTeleport
8
8
 
9
9
  ## Props
10
10
 
11
- | Name | Description | Type | Default |
12
- | ------------------------- | ----------- | -------------------- | ----------------- |
13
- | <code>target</code> | | <code>string</code> | <code></code> |
14
- | <code>hideSiblings</code> | | <code>boolean</code> | <code>true</code> |
15
- | <code>position</code> | | <code>number</code> | <code></code> |
11
+ | Name | Description | Type | Default |
12
+ | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------ |
13
+ | <code>target</code> | The element or css selector to which the component will be teleported. | <code>string \| Element</code> | <code></code> |
14
+ | <code>position</code> | The position relative to the target<br />- `beforebegin`: Before the target element.<br />- `afterbegin`: Inside the target element, before its first child.<br />- `beforeend`: Inside the target element, after its last child.<br />- `afterend`: After the target element.<br />- `onlychild`: Adds it as child and hides all other children of the target element. | <code>string</code> | <code>'onlychild'</code> |
15
+ | <code>disabled</code> | If disabled, the slot content will not be teleported | <code>boolean</code> | <code>false</code> |
16
16
 
17
17
  ## Slots
18
18
 
@@ -5,10 +5,11 @@ import _export_sfc from '../_virtual/_plugin-vue_export-helper.js';
5
5
 
6
6
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7
7
  return openBlock(), createBlock(Teleport, {
8
- to: `.${_ctx.teleportTarget}`
8
+ to: _ctx.teleportHost,
9
+ disabled: _ctx.disabled
9
10
  }, [
10
11
  renderSlot(_ctx.$slots, "default")
11
- ], 8, ["to"]);
12
+ ], 8, ["to", "disabled"]);
12
13
  }
13
14
  var baseTeleport = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
14
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"base-teleport.vue.js","sources":["../../../src/components/base-teleport.vue"],"sourcesContent":["<template>\n <Teleport :to=\"`.${teleportTarget}`\">\n <slot></slot>\n </Teleport>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'BaseTeleport',\n props: {\n target: {\n type: String,\n required: true,\n },\n hideSiblings: {\n type: Boolean,\n default: true,\n },\n position: {\n type: Number,\n required: false,\n },\n },\n setup(props) {\n const parentElement = document.querySelector(props.target)\n\n const teleportTarget = computed(() => `x-base-teleport--${props.target.replace(/[.#]/g, '')}`)\n\n if (parentElement) {\n const newTeleportElement = document.createElement('div')\n newTeleportElement.classList.add(teleportTarget.value)\n newTeleportElement.classList.add('x-base-teleport')\n if (props.hideSiblings) {\n newTeleportElement.classList.add('x-base-teleport--hide-siblings')\n }\n\n const children = parentElement.children\n const position = props.position ?? -1\n\n if (position >= children.length || position === -1) {\n parentElement.appendChild(newTeleportElement)\n } else {\n parentElement.insertBefore(newTeleportElement, children[position])\n }\n }\n\n return {\n teleportTarget,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n:has(> .x-base-teleport--hide-siblings) > *:not(.x-base-teleport) {\n display: none;\n}\n</style>\n"],"names":["teleportTarget"],"mappings":";;;;;AACe,SAAA,WAAA,CAAMA,IAAc,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;;IAC/B,EAAa,EAAA,CAAA,CAAA,EAAA,IAAA,CAAA,cAAA,CAAA,CAAA;AAAA,GAAA,EAAA;;;;;;;;"}
1
+ {"version":3,"file":"base-teleport.vue.js","sources":["../../../src/components/base-teleport.vue"],"sourcesContent":["<template>\n <Teleport :to=\"teleportHost\" :disabled>\n <slot></slot>\n </Teleport>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { defineComponent, watchEffect } from 'vue'\n\nexport default defineComponent({\n name: 'BaseTeleport',\n props: {\n /** The element or css selector to which the component will be teleported. */\n target: {\n type: [String, Element] as PropType<string | Element>,\n required: true,\n },\n /**\n * The position relative to the target\n * - `beforebegin`: Before the target element.\n * - `afterbegin`: Inside the target element, before its first child.\n * - `beforeend`: Inside the target element, after its last child.\n * - `afterend`: After the target element.\n * - `onlychild`: Adds it as child and hides all other children of the target element.\n */\n position: {\n type: String as PropType<\n 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'onlychild'\n >,\n default: 'onlychild',\n },\n /** If disabled, the slot content will not be teleported */\n disabled: {\n type: Boolean,\n default: false,\n },\n },\n setup(props) {\n const teleportHost = document.createElement('div')\n\n watchEffect(() => {\n if (props.disabled) {\n teleportHost.remove()\n return\n }\n teleportHost.className = `x-base-teleport x-base-teleport--${props.position}`\n const targetElement =\n typeof props.target === 'string' ? document.querySelector(props.target) : props.target\n if (!targetElement) {\n console.warn(`BaseTeleport: Target element \"${props.target}\" not found.`)\n return\n }\n const position = props.position === 'onlychild' ? 'beforeend' : props.position\n targetElement.insertAdjacentElement(position, teleportHost)\n })\n\n return { teleportHost }\n },\n})\n</script>\n\n<style lang=\"css\">\n:has(> .x-base-teleport--onlychild) > *:not(.x-base-teleport) {\n display: none;\n}\n</style>\n"],"names":["teleportHost","_openBlock","_createBlock","_Teleport"],"mappings":";;;;;SACiBA,WAAY,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;AAAG,EAAA,OAAAC,SAAA,EAAQ,EAAAC,WAAA,CAAAC,QAAA,EAAA;AAAA,IAAA,EAAA,EAAA,IAAA,CAAA,YAAA;IACpC,QAAa,EAAA,IAAA,CAAA,QAAA;AAAA,GAAA,EAAA;;;;;;;;"}
@@ -1,43 +1,48 @@
1
- import { defineComponent, computed } from 'vue';
1
+ import { defineComponent, watchEffect } from 'vue';
2
2
 
3
3
  var _sfc_main = defineComponent({
4
4
  name: 'BaseTeleport',
5
5
  props: {
6
+ /** The element or css selector to which the component will be teleported. */
6
7
  target: {
7
- type: String,
8
+ type: [String, Element],
8
9
  required: true,
9
10
  },
10
- hideSiblings: {
11
- type: Boolean,
12
- default: true,
13
- },
11
+ /**
12
+ * The position relative to the target
13
+ * - `beforebegin`: Before the target element.
14
+ * - `afterbegin`: Inside the target element, before its first child.
15
+ * - `beforeend`: Inside the target element, after its last child.
16
+ * - `afterend`: After the target element.
17
+ * - `onlychild`: Adds it as child and hides all other children of the target element.
18
+ */
14
19
  position: {
15
- type: Number,
16
- required: false,
20
+ type: String,
21
+ default: 'onlychild',
22
+ },
23
+ /** If disabled, the slot content will not be teleported */
24
+ disabled: {
25
+ type: Boolean,
26
+ default: false,
17
27
  },
18
28
  },
19
29
  setup(props) {
20
- const parentElement = document.querySelector(props.target);
21
- const teleportTarget = computed(() => `x-base-teleport--${props.target.replace(/[.#]/g, '')}`);
22
- if (parentElement) {
23
- const newTeleportElement = document.createElement('div');
24
- newTeleportElement.classList.add(teleportTarget.value);
25
- newTeleportElement.classList.add('x-base-teleport');
26
- if (props.hideSiblings) {
27
- newTeleportElement.classList.add('x-base-teleport--hide-siblings');
28
- }
29
- const children = parentElement.children;
30
- const position = props.position ?? -1;
31
- if (position >= children.length || position === -1) {
32
- parentElement.appendChild(newTeleportElement);
30
+ const teleportHost = document.createElement('div');
31
+ watchEffect(() => {
32
+ if (props.disabled) {
33
+ teleportHost.remove();
34
+ return;
33
35
  }
34
- else {
35
- parentElement.insertBefore(newTeleportElement, children[position]);
36
+ teleportHost.className = `x-base-teleport x-base-teleport--${props.position}`;
37
+ const targetElement = typeof props.target === 'string' ? document.querySelector(props.target) : props.target;
38
+ if (!targetElement) {
39
+ console.warn(`BaseTeleport: Target element "${props.target}" not found.`);
40
+ return;
36
41
  }
37
- }
38
- return {
39
- teleportTarget,
40
- };
42
+ const position = props.position === 'onlychild' ? 'beforeend' : props.position;
43
+ targetElement.insertAdjacentElement(position, teleportHost);
44
+ });
45
+ return { teleportHost };
41
46
  },
42
47
  });
43
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"base-teleport.vue2.js","sources":["../../../src/components/base-teleport.vue"],"sourcesContent":["<template>\n <Teleport :to=\"`.${teleportTarget}`\">\n <slot></slot>\n </Teleport>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'BaseTeleport',\n props: {\n target: {\n type: String,\n required: true,\n },\n hideSiblings: {\n type: Boolean,\n default: true,\n },\n position: {\n type: Number,\n required: false,\n },\n },\n setup(props) {\n const parentElement = document.querySelector(props.target)\n\n const teleportTarget = computed(() => `x-base-teleport--${props.target.replace(/[.#]/g, '')}`)\n\n if (parentElement) {\n const newTeleportElement = document.createElement('div')\n newTeleportElement.classList.add(teleportTarget.value)\n newTeleportElement.classList.add('x-base-teleport')\n if (props.hideSiblings) {\n newTeleportElement.classList.add('x-base-teleport--hide-siblings')\n }\n\n const children = parentElement.children\n const position = props.position ?? -1\n\n if (position >= children.length || position === -1) {\n parentElement.appendChild(newTeleportElement)\n } else {\n parentElement.insertBefore(newTeleportElement, children[position])\n }\n }\n\n return {\n teleportTarget,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n:has(> .x-base-teleport--hide-siblings) > *:not(.x-base-teleport) {\n display: none;\n}\n</style>\n"],"names":[],"mappings":";;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;AACL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,KAAK;AAChB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;QACT,MAAM,aAAY,GAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAA,CAAA;QAEzD,MAAM,iBAAiB,QAAQ,CAAC,MAAM,oBAAoB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA,CAAE,CAAA,CAAA;AAE7F,QAAA,IAAI,aAAa,EAAE;YACjB,MAAM,kBAAmB,GAAE,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAA,CAAA;YACvD,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAA,CAAA;AACrD,YAAA,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAA,CAAA;YAClD,IAAI,KAAK,CAAC,YAAY,EAAE;AACtB,gBAAA,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,gCAAgC,CAAA,CAAA;AACnE,aAAA;AAEA,YAAA,MAAM,QAAS,GAAE,aAAa,CAAC,QAAO,CAAA;YACtC,MAAM,QAAO,GAAI,KAAK,CAAC,QAAS,IAAG,CAAC,CAAA,CAAA;YAEpC,IAAI,YAAY,QAAQ,CAAC,UAAU,QAAS,KAAI,CAAC,CAAC,EAAE;AAClD,gBAAA,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAA,CAAA;AAC5C,aAAA;AAAK,iBAAA;gBACL,aAAa,CAAC,YAAY,CAAC,kBAAkB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA,CAAA;AACnE,aAAA;AACF,SAAA;QAEA,OAAO;YACL,cAAc;SAChB,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-teleport.vue2.js","sources":["../../../src/components/base-teleport.vue"],"sourcesContent":["<template>\n <Teleport :to=\"teleportHost\" :disabled>\n <slot></slot>\n </Teleport>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { defineComponent, watchEffect } from 'vue'\n\nexport default defineComponent({\n name: 'BaseTeleport',\n props: {\n /** The element or css selector to which the component will be teleported. */\n target: {\n type: [String, Element] as PropType<string | Element>,\n required: true,\n },\n /**\n * The position relative to the target\n * - `beforebegin`: Before the target element.\n * - `afterbegin`: Inside the target element, before its first child.\n * - `beforeend`: Inside the target element, after its last child.\n * - `afterend`: After the target element.\n * - `onlychild`: Adds it as child and hides all other children of the target element.\n */\n position: {\n type: String as PropType<\n 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'onlychild'\n >,\n default: 'onlychild',\n },\n /** If disabled, the slot content will not be teleported */\n disabled: {\n type: Boolean,\n default: false,\n },\n },\n setup(props) {\n const teleportHost = document.createElement('div')\n\n watchEffect(() => {\n if (props.disabled) {\n teleportHost.remove()\n return\n }\n teleportHost.className = `x-base-teleport x-base-teleport--${props.position}`\n const targetElement =\n typeof props.target === 'string' ? document.querySelector(props.target) : props.target\n if (!targetElement) {\n console.warn(`BaseTeleport: Target element \"${props.target}\" not found.`)\n return\n }\n const position = props.position === 'onlychild' ? 'beforeend' : props.position\n targetElement.insertAdjacentElement(position, teleportHost)\n })\n\n return { teleportHost }\n },\n})\n</script>\n\n<style lang=\"css\">\n:has(> .x-base-teleport--onlychild) > *:not(.x-base-teleport) {\n display: none;\n}\n</style>\n"],"names":[],"mappings":";;AAUA,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAA+B;AACrD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;;;AAOE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAEL;AACD,YAAA,OAAO,EAAE,WAAW;AACrB,SAAA;;AAED,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;QACT,MAAM,YAAW,GAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAA,CAAA;QAEjD,WAAW,CAAC,MAAM;YAChB,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,YAAY,CAAC,MAAM,EAAC,CAAA;gBACpB,OAAK;AACP,aAAA;YACA,YAAY,CAAC,SAAU,GAAE,CAAA,iCAAA,EAAoC,KAAK,CAAC,QAAQ,EAAC,CAAA;YAC5E,MAAM,aAAc,GAClB,OAAO,KAAK,CAAC,MAAO,KAAI,QAAO,GAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAA,GAAI,KAAK,CAAC,MAAK,CAAA;YACvF,IAAI,CAAC,aAAa,EAAE;gBAClB,OAAO,CAAC,IAAI,CAAC,CAAA,8BAAA,EAAiC,KAAK,CAAC,MAAM,CAAc,YAAA,CAAA,CAAA,CAAA;gBACxE,OAAK;AACP,aAAA;AACA,YAAA,MAAM,QAAO,GAAI,KAAK,CAAC,QAAS,KAAI,WAAU,GAAI,WAAY,GAAE,KAAK,CAAC,QAAO,CAAA;AAC7E,YAAA,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,YAAY,CAAA,CAAA;AAC5D,SAAC,CAAA,CAAA;QAED,OAAO,EAAE,YAAa,EAAA,CAAA;KACvB;AACF,CAAA,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import injectCss from '../../tools/inject-css.js';
2
2
 
3
- var css = ":has(>.x-base-teleport--hide-siblings)>:not(.x-base-teleport){display:none}";
3
+ var css = ":has(>.x-base-teleport--onlychild)>:not(.x-base-teleport){display:none}";
4
4
  injectCss(css);
5
5
 
6
6
  export { css, css as default };
package/js/index.js CHANGED
@@ -179,6 +179,7 @@ export { FOCUSABLE_SELECTORS } from './utils/focus.js';
179
179
  export { noOp } from './utils/function.js';
180
180
  export { getURLParameter } from './utils/get-url-parameters.js';
181
181
  export { getActiveElement, getTargetElement, isElementEqualOrContained } from './utils/html.js';
182
+ export { isIOS, removeSearchInputFocus } from './utils/ios-utils.js';
182
183
  export { SPLIT_WORDS_REGEX, isNewQuery } from './utils/is-new-query.js';
183
184
  export { normalizeString } from './utils/normalize.js';
184
185
  export { isInRange } from './utils/number.js';
package/js/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Checks if the user is on an iOS device (iPhone, iPad, or iPod).
3
+ *
4
+ * @returns `true` if the user is on iOS, `false` otherwise.
5
+ *
6
+ * @public
7
+ */
8
+ const isIOS = () => {
9
+ const userAgent = navigator.userAgent.toLowerCase();
10
+ return /iphone|ipad|ipod/.test(userAgent) && !/windows phone/.test(userAgent);
11
+ };
12
+ /**
13
+ * Removes focus from the search input element if it is currently focused.
14
+ * This function checks if the active element in the document matches the
15
+ * selector '.x-search-input' and, if so, blurs the element to remove focus.
16
+ *
17
+ * @public
18
+ */
19
+ const removeSearchInputFocus = () => {
20
+ const shadowHost = document.querySelector('.x-root-container');
21
+ if (shadowHost?.shadowRoot) {
22
+ shadowHost.shadowRoot.querySelector('.x-search-input')?.blur();
23
+ }
24
+ else if (document.activeElement?.matches('.x-search-input')) {
25
+ document.activeElement.blur();
26
+ }
27
+ };
28
+
29
+ export { isIOS, removeSearchInputFocus };
30
+ //# sourceMappingURL=ios-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ios-utils.js","sources":["../../../src/utils/ios-utils.ts"],"sourcesContent":["/**\n * Checks if the user is on an iOS device (iPhone, iPad, or iPod).\n *\n * @returns `true` if the user is on iOS, `false` otherwise.\n *\n * @public\n */\nexport const isIOS = (): boolean => {\n const userAgent = navigator.userAgent.toLowerCase()\n return /iphone|ipad|ipod/.test(userAgent) && !/windows phone/.test(userAgent)\n}\n\n/**\n * Removes focus from the search input element if it is currently focused.\n * This function checks if the active element in the document matches the\n * selector '.x-search-input' and, if so, blurs the element to remove focus.\n *\n * @public\n */\nexport const removeSearchInputFocus = (): void => {\n const shadowHost = document.querySelector('.x-root-container')\n if (shadowHost?.shadowRoot) {\n ;(shadowHost.shadowRoot.querySelector('.x-search-input') as HTMLInputElement)?.blur()\n } else if (document.activeElement?.matches('.x-search-input')) {\n ;(document.activeElement as HTMLElement).blur()\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;;AAMG;AACI,MAAM,KAAK,GAAG,MAAc;IACjC,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAA;AACnD,IAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAC/E,EAAC;AAED;;;;;;AAMG;AACI,MAAM,sBAAsB,GAAG,MAAW;IAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAA;IAC9D,IAAI,UAAU,EAAE,UAAU,EAAE;QACxB,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,iBAAiB,CAAsB,EAAE,IAAI,EAAE,CAAA;AACtF,KAAA;SAAM,IAAI,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAAE;AAC3D,QAAA,QAAQ,CAAC,aAA6B,CAAC,IAAI,EAAE,CAAA;AAChD,KAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "6.0.0-alpha.71",
3
+ "version": "6.0.0-alpha.73",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -142,5 +142,5 @@
142
142
  "access": "public",
143
143
  "directory": "dist"
144
144
  },
145
- "gitHead": "6c83f2c471cea8d15dbc321e617845f92ea710d9"
145
+ "gitHead": "dd9bbc01c1d1078d0ebea9874c7c2287e41ca46b"
146
146
  }
@@ -9994,39 +9994,48 @@
9994
9994
  },
9995
9995
  {
9996
9996
  "kind": "Reference",
9997
- "text": "StringConstructor",
9998
- "canonicalReference": "!StringConstructor:interface"
9997
+ "text": "PropType",
9998
+ "canonicalReference": "@vue/runtime-core!PropType:type"
9999
9999
  },
10000
10000
  {
10001
10001
  "kind": "Content",
10002
- "text": ";\n required: true;\n };\n hideSiblings: {\n type: "
10002
+ "text": "<string | "
10003
10003
  },
10004
10004
  {
10005
10005
  "kind": "Reference",
10006
- "text": "BooleanConstructor",
10007
- "canonicalReference": "!BooleanConstructor:interface"
10006
+ "text": "Element",
10007
+ "canonicalReference": "!Element:interface"
10008
10008
  },
10009
10009
  {
10010
10010
  "kind": "Content",
10011
- "text": ";\n default: boolean;\n };\n position: {\n type: "
10011
+ "text": ">;\n required: true;\n };\n position: {\n type: "
10012
10012
  },
10013
10013
  {
10014
10014
  "kind": "Reference",
10015
- "text": "NumberConstructor",
10016
- "canonicalReference": "!NumberConstructor:interface"
10015
+ "text": "PropType",
10016
+ "canonicalReference": "@vue/runtime-core!PropType:type"
10017
10017
  },
10018
10018
  {
10019
10019
  "kind": "Content",
10020
- "text": ";\n required: false;\n };\n}, {\n teleportTarget: import(\"vue\")."
10020
+ "text": "<\"beforebegin\" | \"afterbegin\" | \"beforeend\" | \"afterend\" | \"onlychild\">;\n default: string;\n };\n disabled: {\n type: "
10021
10021
  },
10022
10022
  {
10023
10023
  "kind": "Reference",
10024
- "text": "ComputedRef",
10025
- "canonicalReference": "@vue/reactivity!ComputedRef:interface"
10024
+ "text": "BooleanConstructor",
10025
+ "canonicalReference": "!BooleanConstructor:interface"
10026
10026
  },
10027
10027
  {
10028
10028
  "kind": "Content",
10029
- "text": "<string>;\n}, unknown, {}, {}, import(\"vue\")."
10029
+ "text": ";\n default: boolean;\n };\n}, {\n teleportHost: "
10030
+ },
10031
+ {
10032
+ "kind": "Reference",
10033
+ "text": "HTMLDivElement",
10034
+ "canonicalReference": "!HTMLDivElement:interface"
10035
+ },
10036
+ {
10037
+ "kind": "Content",
10038
+ "text": ";\n}, unknown, {}, {}, import(\"vue\")."
10030
10039
  },
10031
10040
  {
10032
10041
  "kind": "Reference",
@@ -10075,30 +10084,39 @@
10075
10084
  },
10076
10085
  {
10077
10086
  "kind": "Reference",
10078
- "text": "StringConstructor",
10079
- "canonicalReference": "!StringConstructor:interface"
10087
+ "text": "PropType",
10088
+ "canonicalReference": "@vue/runtime-core!PropType:type"
10080
10089
  },
10081
10090
  {
10082
10091
  "kind": "Content",
10083
- "text": ";\n required: true;\n };\n hideSiblings: {\n type: "
10092
+ "text": "<string | "
10084
10093
  },
10085
10094
  {
10086
10095
  "kind": "Reference",
10087
- "text": "BooleanConstructor",
10088
- "canonicalReference": "!BooleanConstructor:interface"
10096
+ "text": "Element",
10097
+ "canonicalReference": "!Element:interface"
10089
10098
  },
10090
10099
  {
10091
10100
  "kind": "Content",
10092
- "text": ";\n default: boolean;\n };\n position: {\n type: "
10101
+ "text": ">;\n required: true;\n };\n position: {\n type: "
10093
10102
  },
10094
10103
  {
10095
10104
  "kind": "Reference",
10096
- "text": "NumberConstructor",
10097
- "canonicalReference": "!NumberConstructor:interface"
10105
+ "text": "PropType",
10106
+ "canonicalReference": "@vue/runtime-core!PropType:type"
10107
+ },
10108
+ {
10109
+ "kind": "Content",
10110
+ "text": "<\"beforebegin\" | \"afterbegin\" | \"beforeend\" | \"afterend\" | \"onlychild\">;\n default: string;\n };\n disabled: {\n type: "
10111
+ },
10112
+ {
10113
+ "kind": "Reference",
10114
+ "text": "BooleanConstructor",
10115
+ "canonicalReference": "!BooleanConstructor:interface"
10098
10116
  },
10099
10117
  {
10100
10118
  "kind": "Content",
10101
- "text": ";\n required: false;\n };\n}>>, {\n hideSiblings: boolean;\n}, {}>"
10119
+ "text": ";\n default: boolean;\n };\n}>>, {\n position: \"beforebegin\" | \"afterbegin\" | \"beforeend\" | \"afterend\" | \"onlychild\";\n disabled: boolean;\n}, {}>"
10102
10120
  }
10103
10121
  ],
10104
10122
  "fileUrlPath": "dist/types/components/base-teleport.vue.d.ts",
@@ -10107,7 +10125,7 @@
10107
10125
  "name": "BaseTeleport",
10108
10126
  "variableTypeTokenRange": {
10109
10127
  "startIndex": 1,
10110
- "endIndex": 28
10128
+ "endIndex": 32
10111
10129
  }
10112
10130
  },
10113
10131
  {
@@ -36750,6 +36768,29 @@
36750
36768
  ],
36751
36769
  "name": "isInRange"
36752
36770
  },
36771
+ {
36772
+ "kind": "Variable",
36773
+ "canonicalReference": "@empathyco/x-components!isIOS:var",
36774
+ "docComment": "/**\n * Checks if the user is on an iOS device (iPhone, iPad, or iPod).\n *\n * @returns `true` if the user is on iOS, `false` otherwise.\n *\n * @public\n */\n",
36775
+ "excerptTokens": [
36776
+ {
36777
+ "kind": "Content",
36778
+ "text": "isIOS: "
36779
+ },
36780
+ {
36781
+ "kind": "Content",
36782
+ "text": "() => boolean"
36783
+ }
36784
+ ],
36785
+ "fileUrlPath": "src/utils/ios-utils.ts",
36786
+ "isReadonly": true,
36787
+ "releaseTag": "Public",
36788
+ "name": "isIOS",
36789
+ "variableTypeTokenRange": {
36790
+ "startIndex": 1,
36791
+ "endIndex": 2
36792
+ }
36793
+ },
36753
36794
  {
36754
36795
  "kind": "Function",
36755
36796
  "canonicalReference": "@empathyco/x-components!isNewQuery:function(1)",
@@ -55147,6 +55188,29 @@
55147
55188
  "endIndex": 4
55148
55189
  }
55149
55190
  },
55191
+ {
55192
+ "kind": "Variable",
55193
+ "canonicalReference": "@empathyco/x-components!removeSearchInputFocus:var",
55194
+ "docComment": "/**\n * Removes focus from the search input element if it is currently focused. This function checks if the active element in the document matches the selector '.x-search-input' and, if so, blurs the element to remove focus.\n *\n * @public\n */\n",
55195
+ "excerptTokens": [
55196
+ {
55197
+ "kind": "Content",
55198
+ "text": "removeSearchInputFocus: "
55199
+ },
55200
+ {
55201
+ "kind": "Content",
55202
+ "text": "() => void"
55203
+ }
55204
+ ],
55205
+ "fileUrlPath": "src/utils/ios-utils.ts",
55206
+ "isReadonly": true,
55207
+ "releaseTag": "Public",
55208
+ "name": "removeSearchInputFocus",
55209
+ "variableTypeTokenRange": {
55210
+ "startIndex": 1,
55211
+ "endIndex": 2
55212
+ }
55213
+ },
55150
55214
  {
55151
55215
  "kind": "Variable",
55152
55216
  "canonicalReference": "@empathyco/x-components!RenderlessExtraParams:var",
@@ -1477,34 +1477,35 @@ allowTabDeselect: boolean;
1477
1477
  // @public (undocumented)
1478
1478
  export const BaseTeleport: DefineComponent< {
1479
1479
  target: {
1480
- type: StringConstructor;
1480
+ type: PropType<string | Element>;
1481
1481
  required: true;
1482
1482
  };
1483
- hideSiblings: {
1483
+ position: {
1484
+ type: PropType<"beforebegin" | "afterbegin" | "beforeend" | "afterend" | "onlychild">;
1485
+ default: string;
1486
+ };
1487
+ disabled: {
1484
1488
  type: BooleanConstructor;
1485
1489
  default: boolean;
1486
1490
  };
1487
- position: {
1488
- type: NumberConstructor;
1489
- required: false;
1490
- };
1491
1491
  }, {
1492
- teleportTarget: ComputedRef<string>;
1492
+ teleportHost: HTMLDivElement;
1493
1493
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
1494
1494
  target: {
1495
- type: StringConstructor;
1495
+ type: PropType<string | Element>;
1496
1496
  required: true;
1497
1497
  };
1498
- hideSiblings: {
1498
+ position: {
1499
+ type: PropType<"beforebegin" | "afterbegin" | "beforeend" | "afterend" | "onlychild">;
1500
+ default: string;
1501
+ };
1502
+ disabled: {
1499
1503
  type: BooleanConstructor;
1500
1504
  default: boolean;
1501
1505
  };
1502
- position: {
1503
- type: NumberConstructor;
1504
- required: false;
1505
- };
1506
1506
  }>>, {
1507
- hideSiblings: boolean;
1507
+ position: "beforebegin" | "afterbegin" | "beforeend" | "afterend" | "onlychild";
1508
+ disabled: boolean;
1508
1509
  }, {}>;
1509
1510
 
1510
1511
  // @public
@@ -4204,6 +4205,9 @@ export function isElementEqualOrContained(a: Element, b: Element): boolean;
4204
4205
  // @public
4205
4206
  export function isInRange(number: number, [min, max]: [number, number]): boolean;
4206
4207
 
4208
+ // @public
4209
+ export const isIOS: () => boolean;
4210
+
4207
4211
  // @public
4208
4212
  export function isNewQuery(newQuery: string, previousQuery: string): boolean;
4209
4213
 
@@ -6251,6 +6255,9 @@ queryPreviewHash: string;
6251
6255
  cache: boolean;
6252
6256
  }>;
6253
6257
 
6258
+ // @public
6259
+ export const removeSearchInputFocus: () => void;
6260
+
6254
6261
  // @public
6255
6262
  export const RenderlessExtraParams: DefineComponent< {
6256
6263
  name: {
@@ -1,33 +1,55 @@
1
+ import type { PropType } from 'vue';
1
2
  declare const _default: import("vue").DefineComponent<{
3
+ /** The element or css selector to which the component will be teleported. */
2
4
  target: {
3
- type: StringConstructor;
5
+ type: PropType<string | Element>;
4
6
  required: true;
5
7
  };
6
- hideSiblings: {
8
+ /**
9
+ * The position relative to the target
10
+ * - `beforebegin`: Before the target element.
11
+ * - `afterbegin`: Inside the target element, before its first child.
12
+ * - `beforeend`: Inside the target element, after its last child.
13
+ * - `afterend`: After the target element.
14
+ * - `onlychild`: Adds it as child and hides all other children of the target element.
15
+ */
16
+ position: {
17
+ type: PropType<"beforebegin" | "afterbegin" | "beforeend" | "afterend" | "onlychild">;
18
+ default: string;
19
+ };
20
+ /** If disabled, the slot content will not be teleported */
21
+ disabled: {
7
22
  type: BooleanConstructor;
8
23
  default: boolean;
9
24
  };
10
- position: {
11
- type: NumberConstructor;
12
- required: false;
13
- };
14
25
  }, {
15
- teleportTarget: import("vue").ComputedRef<string>;
26
+ teleportHost: HTMLDivElement;
16
27
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
28
+ /** The element or css selector to which the component will be teleported. */
17
29
  target: {
18
- type: StringConstructor;
30
+ type: PropType<string | Element>;
19
31
  required: true;
20
32
  };
21
- hideSiblings: {
33
+ /**
34
+ * The position relative to the target
35
+ * - `beforebegin`: Before the target element.
36
+ * - `afterbegin`: Inside the target element, before its first child.
37
+ * - `beforeend`: Inside the target element, after its last child.
38
+ * - `afterend`: After the target element.
39
+ * - `onlychild`: Adds it as child and hides all other children of the target element.
40
+ */
41
+ position: {
42
+ type: PropType<"beforebegin" | "afterbegin" | "beforeend" | "afterend" | "onlychild">;
43
+ default: string;
44
+ };
45
+ /** If disabled, the slot content will not be teleported */
46
+ disabled: {
22
47
  type: BooleanConstructor;
23
48
  default: boolean;
24
49
  };
25
- position: {
26
- type: NumberConstructor;
27
- required: false;
28
- };
29
50
  }>>, {
30
- hideSiblings: boolean;
51
+ position: "beforebegin" | "afterbegin" | "beforeend" | "afterend" | "onlychild";
52
+ disabled: boolean;
31
53
  }, {}>;
32
54
  export default _default;
33
55
  //# sourceMappingURL=base-teleport.vue?vue&type=script&lang.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-teleport.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../src/components/base-teleport.vue?vue&type=script&lang.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBA2CE"}
1
+ {"version":3,"file":"base-teleport.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../src/components/base-teleport.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;;IAM/B,6EAA6E;;;;;IAK7E;;;;;;;OAOG;;;;;IAOH,2DAA2D;;;;;;;;IAnB3D,6EAA6E;;;;;IAK7E;;;;;;;OAOG;;;;;IAOH,2DAA2D;;;;;;;;;AAtB/D,wBAiDE"}
@@ -8,6 +8,7 @@ export * from './focus';
8
8
  export * from './function';
9
9
  export * from './get-url-parameters';
10
10
  export * from './html';
11
+ export * from './ios-utils';
11
12
  export * from './is-new-query';
12
13
  export * from './normalize';
13
14
  export * from './number';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,uBAAuB,CAAA;AACrC,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,uBAAuB,CAAA;AACrC,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,cAAc,SAAS,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Checks if the user is on an iOS device (iPhone, iPad, or iPod).
3
+ *
4
+ * @returns `true` if the user is on iOS, `false` otherwise.
5
+ *
6
+ * @public
7
+ */
8
+ export declare const isIOS: () => boolean;
9
+ /**
10
+ * Removes focus from the search input element if it is currently focused.
11
+ * This function checks if the active element in the document matches the
12
+ * selector '.x-search-input' and, if so, blurs the element to remove focus.
13
+ *
14
+ * @public
15
+ */
16
+ export declare const removeSearchInputFocus: () => void;
17
+ //# sourceMappingURL=ios-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ios-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/ios-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,QAAO,OAGxB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAAO,IAOzC,CAAA"}