@sourceloop/search-element 8.1.0 → 8.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2023] [SourceFuse]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -19,16 +19,16 @@ npm i @sourceloop/search-client
19
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 }
20
20
 
21
21
  ```ts
22
- import { Component } from '@angular/core';
23
- import { SearchComponent, SEARCH_SERVICE_TOKEN } from '@sourceloop/search-client';
24
- 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';
25
25
 
26
26
  @Component({
27
27
  selector: 'app-root',
28
28
  standalone: true,
29
29
  imports: [SearchComponent],
30
30
  templateUrl: './app.component.html',
31
- providers: [{ provide: SEARCH_SERVICE_TOKEN, useClass: SearchService }],
31
+ providers: [{provide: SEARCH_SERVICE_TOKEN, useClass: SearchService}],
32
32
  })
33
33
  export class AppComponent {}
34
34
  ```
@@ -74,7 +74,6 @@ Apart from these there are some optional properties that you can give:
74
74
  - **noResultMessage (string) :** Message to display in dropdown incase no matching result found.
75
75
  - **searchIconClass (string) :** Can be used to give custom icon for search in search bar.
76
76
  - **crossIconClass (string) :** Can be used to give custom icon for clearing text input in search bar.
77
- - **dropDownButtonIconClass (string) :** Can be used to give custom icon for category drop down button.
78
77
  - **recentSearchIconClass (string) :** Can be used to give custom icon for recent searches displayed in the search dropdown.
79
78
 
80
79
  Your component might look something like
@@ -147,6 +146,45 @@ To use the default icons you will have to import the following in your styles.sc
147
146
 
148
147
  You can also choose to use your own icons by providing classes for icons in the configuration.
149
148
 
149
+ ### Required Global Styles
150
+
151
+ The search component uses Angular CDK overlays for the dropdown, which require global styles to function properly.
152
+
153
+ ### Styling and Theming
154
+
155
+ 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.
156
+
157
+ #### Available CSS Variables
158
+
159
+ ````scss
160
+ sourceloop-search {
161
+ --search-background: #f7f7f7; /* Background of the search container */
162
+ --search-input-background: #f1f3f4; /* Background of the input field */
163
+ --search-input-text-color: #6b6b6b; /* Text color in the input field */
164
+ --search-border-hover: #a53159; /* Border color on hover */
165
+ --search-border-focus: #90003b; /* Border color when focused */
166
+ --search-dropdown-background: #90003b; /* Background of the category dropdown (on hover/focus) */
167
+ --search-dropdown-text-color: #ffffff; /* Text color in the category dropdown (on hover/focus) */
168
+ --search-highlight-bg: #fee8e8; /* Background color for highlighted suggestions */
169
+ --search-heading-color: #9c9c9c; /* Color of category headings */
170
+ --search-text-color: #333; /* General text color */
171
+ --search-icon-color: #33333380; /* Color of icons */
172
+ }
173
+
174
+ ####Example: Custom Theming To customize the search component, add the following
175
+ to your `component.scss` ```scss
176
+
177
+ // Customize component colors
178
+
179
+ :host ::ng-deep sourceloop-search {
180
+ --search-border-hover: #5c26f1 !important;
181
+ --search-border-focus: #5c26f1 !important;
182
+ --search-dropdown-background: #5c26f2 !important;
183
+ }
184
+ ````
185
+
186
+ This allows you to match the search component's appearance with your application's design system.
187
+
150
188
  ## Web Component
151
189
 
152
190
  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": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "A global search element for search microservice. ",
5
5
  "main": "./search-element.js",
6
6
  "private": false,
@@ -19,5 +19,6 @@
19
19
  },
20
20
  "author": "Sourcefuse",
21
21
  "license": "MIT",
22
- "hash": "046c911416e7350e4b96c2eff7d6bdf4b9c27db569ec74fedd5501c9a890ca86"
23
- }
22
+ "hash": "87fb4982242cfb0161a93476898886eb78a1242b4d50619ccfcffdaabb95a622",
23
+ "gitHead": "afc109afbd7163fdfb98b49fc6f2633fee8bf2e1"
24
+ }