@sourceloop/search-element 9.0.0 → 9.0.3

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.
package/README.md CHANGED
@@ -4,8 +4,7 @@ An Angular module that exports a component that can enable users to search over
4
4
 
5
5
  ### Deprecation Notice
6
6
 
7
- Search-client now supports Angular v19, we will provide support for the older version that is based on Angular v19 till 30th
8
- June 2026 .
7
+ Search-client now supports Angular v20, we will provide support for the older version that is based on Angular v19 till 30th June 2026 .
9
8
 
10
9
  ## Angular Module
11
10
 
@@ -20,16 +19,16 @@ npm i @sourceloop/search-client
20
19
  Create a new Application using Angular CLI and import the `SearchComponent` in your application.SearchComponent is now a standalone component, so no NgModule is required.Also create a new service that implements the ISearchService interface exported by the search library. This service will be used by the exported component to make API calls whenever needed. You will have to update the providers section of your module with { provide: SEARCH_SERVICE_TOKEN, useExisting: Your_Service_Name }
21
20
 
22
21
  ```ts
23
- import { Component } from '@angular/core';
24
- import { SearchComponent, SEARCH_SERVICE_TOKEN } from '@sourceloop/search-client';
25
- import { SearchService } from './search.service';
22
+ import {Component} from '@angular/core';
23
+ import {SearchComponent, SEARCH_SERVICE_TOKEN} from '@sourceloop/search-client';
24
+ import {SearchService} from './search.service';
26
25
 
27
26
  @Component({
28
27
  selector: 'app-root',
29
28
  standalone: true,
30
29
  imports: [SearchComponent],
31
30
  templateUrl: './app.component.html',
32
- providers: [{ provide: SEARCH_SERVICE_TOKEN, useClass: SearchService }],
31
+ providers: [{provide: SEARCH_SERVICE_TOKEN, useClass: SearchService}],
33
32
  })
34
33
  export class AppComponent {}
35
34
  ```
@@ -75,7 +74,6 @@ Apart from these there are some optional properties that you can give:
75
74
  - **noResultMessage (string) :** Message to display in dropdown incase no matching result found.
76
75
  - **searchIconClass (string) :** Can be used to give custom icon for search in search bar.
77
76
  - **crossIconClass (string) :** Can be used to give custom icon for clearing text input in search bar.
78
- - **dropDownButtonIconClass (string) :** Can be used to give custom icon for category drop down button.
79
77
  - **recentSearchIconClass (string) :** Can be used to give custom icon for recent searches displayed in the search dropdown.
80
78
 
81
79
  Your component might look something like
@@ -148,6 +146,64 @@ To use the default icons you will have to import the following in your styles.sc
148
146
 
149
147
  You can also choose to use your own icons by providing classes for icons in the configuration.
150
148
 
149
+ ### Required Global Styles
150
+
151
+ The search component uses Angular CDK overlays for the dropdown, which require global styles to function properly. **You must import the library's stylesheet in your application:**
152
+
153
+ #### Option 1: Import in your `styles.scss`
154
+
155
+ ```scss
156
+ @import '@sourceloop/search-client/styles';
157
+ ```
158
+
159
+ #### Option 2: Add to `angular.json`
160
+
161
+ ```json
162
+ "styles": [
163
+ "node_modules/@sourceloop/search-client/styles.scss",
164
+ "src/styles.scss"
165
+ ]
166
+ ```
167
+
168
+ ### Styling and Theming
169
+
170
+ The search component uses CSS custom properties (CSS variables) for theming, allowing you to customize colors without modifying the library code. You can override these variables in your application's global styles or in a component-specific stylesheet.
171
+
172
+ #### Available CSS Variables
173
+
174
+ ````scss
175
+ sourceloop-search {
176
+ --search-background: #f7f7f7; /* Background of the search container */
177
+ --search-input-background: #f1f3f4; /* Background of the input field */
178
+ --search-input-text-color: #6b6b6b; /* Text color in the input field */
179
+ --search-border-hover: #a53159; /* Border color on hover */
180
+ --search-border-focus: #90003b; /* Border color when focused */
181
+ --search-dropdown-background: #90003b; /* Background of the category dropdown (on hover/focus) */
182
+ --search-dropdown-text-color: #ffffff; /* Text color in the category dropdown (on hover/focus) */
183
+ --search-highlight-bg: #fee8e8; /* Background color for highlighted suggestions */
184
+ --search-heading-color: #9c9c9c; /* Color of category headings */
185
+ --search-text-color: #333; /* General text color */
186
+ --search-icon-color: #33333380; /* Color of icons */
187
+ }
188
+
189
+ #### Example: Custom Theming
190
+
191
+ To customize the search component, add the following to your `styles.scss` (after importing the library styles):
192
+
193
+ ```scss
194
+ @import '@sourceloop/search-client/styles';
195
+
196
+ // Customize component colors
197
+ sourceloop-search {
198
+ --search-dropdown-background: #0056b3;
199
+ --search-dropdown-text-color: #ffffff;
200
+ --search-border-hover: #0056b3;
201
+ --search-border-focus: #003d82;
202
+ }
203
+ ````
204
+
205
+ This allows you to match the search component's appearance with your application's design system.
206
+
151
207
  ## Web Component
152
208
 
153
209
  This library is also available as a [Web Component](https://developer.mozilla.org/en-US/docs/Web/Web_Components) so users of frameworks like React and Vue can also integrate this search element in their application with minimal effort.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourceloop/search-element",
3
- "version": "9.0.0",
3
+ "version": "9.0.3",
4
4
  "description": "A global search element for search microservice. ",
5
5
  "main": "./search-element.js",
6
6
  "private": false,
@@ -19,6 +19,6 @@
19
19
  },
20
20
  "author": "Sourcefuse",
21
21
  "license": "MIT",
22
- "hash": "adbe715646a8cbd3ab73a84fcfbb804c861817bdfd7f3d407aa86efb0aa5f0f0",
23
- "gitHead": "b50931d75a9a3e6ffa57091c7f4f286ce24cde56"
22
+ "hash": "aaf134d1e02bc76d8e7158110c231c475142d2c8f091f831e43bcca14942a1cb",
23
+ "gitHead": "83f068c4ac6a36c7b71a89543b75beb5f3a6a17d"
24
24
  }