@empathyco/x-components 6.0.0-alpha.72 → 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; [isIOS](./x-components.isios.md)
4
+
5
+ ## isIOS variable
6
+
7
+ Checks if the user is on an iOS device (iPhone, iPad, or iPod).
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isIOS: () => boolean
13
+ ```
@@ -444,6 +444,7 @@ X-Components is a library usable everywhere not only for search experiences.
444
444
  | [increasePageAppendingResults](./x-components.increasepageappendingresults.md) | Default implementation for the [SearchActions.increasePageAppendingResults](./x-components.searchactions.increasepageappendingresults.md)<!-- -->. |
445
445
  | [increasePageAppendingResultsWire](./x-components.increasepageappendingresultswire.md) | Increases the current search state <code>page</code> by one. |
446
446
  | [infiniteScroll](./x-components.infinitescroll.md) | <p>Custom Vue directive for infinite scroll.</p><p>This directive uses the IntersectionObserver API to handle the intersection between the children and the scrollable container. The content of the children moves up on scroll and when it reaches the end, the IntersectionObserver triggers that both elements are intersecting.</p><p>How it works.</p><p>As a summary, if the scroll reaches the end, <code>UserReachedResultsListEnd</code> event is emitted to the xBus. If you provide a margin in the directive options, this function is triggered when the scroll reaches the end minus that amount of pixels. A default margin of 200px is set.</p><p>Usage.</p><p>The directive has to be set in the target element. It can receive an argument which will be used to determine the scrollable container. Possible values: <code>html</code>: will set the <html> as the scrollable container. <code>body</code>: will set the <body> as the scrollable container. ID: will set the DOM element with the provided id as the scrollable container.</p><p>If no argument is provided the scrollable container fallbacks to the viewport.</p> |
447
+ | [isIOS](./x-components.isios.md) | Checks if the user is on an iOS device (iPhone, iPad, or iPod). |
447
448
  | [ItemsList](./x-components.itemslist.md) | It renders a list of [ListItem](./x-components.listitem.md) providing a slot for each <code>slotName</code> which depends on the <code>modelName</code>of the item. |
448
449
  | [loadHistoryQueriesFromBrowserStorage](./x-components.loadhistoryqueriesfrombrowserstorage.md) | Default implementation for the [HistoryQueriesActions.loadHistoryQueriesFromBrowserStorage](./x-components.historyqueriesactions.loadhistoryqueriesfrombrowserstorage.md) action. |
449
450
  | [loadHistoryQueriesFromBrowserStorageWire](./x-components.loadhistoryqueriesfrombrowserstoragewire.md) | Loads the history queries from the browser storage, saving them to the [HistoryQueriesState.historyQueries](./x-components.historyqueriesstate.historyqueries.md)<!-- -->. |
@@ -507,6 +508,7 @@ X-Components is a library usable everywhere not only for search experiences.
507
508
  | [removeHistoryQuery](./x-components.removehistoryquery.md) | Removes a single history query from the history queries. |
508
509
  | [RemoveHistoryQuery](./x-components.removehistoryquery.md) | Button that when it is pressed emits the [HistoryQueriesXEvents.UserPressedRemoveHistoryQuery](./x-components.historyqueriesxevents.userpressedremovehistoryquery.md) event, expressing the user intention to remove a query in the history. |
509
510
  | [removeQueryPreviewInstanceWire](./x-components.removequerypreviewinstancewire.md) | Removes an instance in a query preview. |
511
+ | [removeSearchInputFocus](./x-components.removesearchinputfocus.md) | 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. |
510
512
  | [RenderlessExtraParams](./x-components.renderlessextraparams.md) | It emits a [ExtraParamsXEvents.UserChangedExtraParams](./x-components.extraparamsxevents.userchangedextraparams.md) when the <code>updateValue</code> is called. |
511
513
  | [RenderlessFilter](./x-components.renderlessfilter.md) | Renders default slot content. It binds to the default slot a [BooleanFilter](./x-types.booleanfilter.md)<!-- -->, the [XEvent](./x-components.xevent.md) that will be emitted when clicking the content, the CSS classes and if the content should be deactivated. |
512
514
  | [resetAppending](./x-components.resetappending.md) | Resets the search state <code>isAppendingResults</code>. |
@@ -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
+ ```
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.72",
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": "5ab432ce69a84c93cc56e7eca9eaa12ff77b5621"
145
+ "gitHead": "dd9bbc01c1d1078d0ebea9874c7c2287e41ca46b"
146
146
  }
@@ -36768,6 +36768,29 @@
36768
36768
  ],
36769
36769
  "name": "isInRange"
36770
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
+ },
36771
36794
  {
36772
36795
  "kind": "Function",
36773
36796
  "canonicalReference": "@empathyco/x-components!isNewQuery:function(1)",
@@ -55165,6 +55188,29 @@
55165
55188
  "endIndex": 4
55166
55189
  }
55167
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
+ },
55168
55214
  {
55169
55215
  "kind": "Variable",
55170
55216
  "canonicalReference": "@empathyco/x-components!RenderlessExtraParams:var",
@@ -4205,6 +4205,9 @@ export function isElementEqualOrContained(a: Element, b: Element): boolean;
4205
4205
  // @public
4206
4206
  export function isInRange(number: number, [min, max]: [number, number]): boolean;
4207
4207
 
4208
+ // @public
4209
+ export const isIOS: () => boolean;
4210
+
4208
4211
  // @public
4209
4212
  export function isNewQuery(newQuery: string, previousQuery: string): boolean;
4210
4213
 
@@ -6252,6 +6255,9 @@ queryPreviewHash: string;
6252
6255
  cache: boolean;
6253
6256
  }>;
6254
6257
 
6258
+ // @public
6259
+ export const removeSearchInputFocus: () => void;
6260
+
6255
6261
  // @public
6256
6262
  export const RenderlessExtraParams: DefineComponent< {
6257
6263
  name: {
@@ -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"}