Skip to content

Commit

Permalink
Version 1.5.0 (#428)
Browse files Browse the repository at this point in the history
### Features
- Added support for React 18 (#423)
- Added an optional `onDropdownInputChange` prop to `FilterSearch` (#421)

### Fixes
- Addressed vulnerabilities (#422)
  • Loading branch information
nmanu1 committed Feb 23, 2024
2 parents d9e5ff4 + 0e7ab56 commit 5dd6935
Show file tree
Hide file tree
Showing 73 changed files with 5,863 additions and 2,479 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,36 @@ name: Run Tests
on: [push, pull_request]

jobs:
call_run_tests-react-18:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
node_matrix: '["16.x", "18.x"]'
secrets:
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}

call_run_tests-react-17:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
# We have to install these swc libraries manually because
# the post install script doesn't seem to run properly
# after we install specific versions of packages.
# More info at https://github.com/swc-project/swc/issues/5616#issuecomment-1651214641
build_script: |
npm i \
react@^17.0.2 \
react-dom@^17.0.2 \
@testing-library/react@^12.1.3 \
@testing-library/react-hooks@^8.0.0
npm install --save-optional \
"@swc/core-linux-arm-gnueabihf" \
"@swc/core-linux-arm64-gnu" \
"@swc/core-linux-arm64-musl" \
"@swc/core-linux-x64-gnu" \
"@swc/core-linux-x64-musl" \
"@swc/core-win32-arm64-msvc" \
"@swc/core-win32-ia32-msvc" \
"@swc/core-win32-x64-msvc"
npm run build
node_matrix: '["16.x", "18.x"]'
secrets:
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}
Expand All @@ -17,7 +44,20 @@ jobs:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: |
npm i -D react@16.14 react-dom@16.14
npm i \
react@^16.14 \
react-dom@^16.14 \
@testing-library/react@^12.1.3 \
@testing-library/react-hooks@^8.0.0
npm install --save-optional \
"@swc/core-linux-arm-gnueabihf" \
"@swc/core-linux-arm64-gnu" \
"@swc/core-linux-arm64-musl" \
"@swc/core-linux-x64-gnu" \
"@swc/core-linux-x64-musl" \
"@swc/core-win32-arm64-msvc" \
"@swc/core-win32-ia32-msvc" \
"@swc/core-win32-x64-msvc"
npm run build
node_matrix: '["16.x", "18.x"]'
secrets:
Expand Down
4 changes: 3 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { StorybookConfig } from '@storybook/react-webpack5';
import React from 'react';

const config: StorybookConfig = {
stories: [
Expand Down Expand Up @@ -39,7 +40,8 @@ const config: StorybookConfig = {
'./SearchCore': require.resolve('../tests/__fixtures__/core/SearchCore.ts'),
'../utils/location-operations': require.resolve('../tests/__fixtures__/utils/location-operations.ts')
},
}
},
...(!React.version.startsWith('18') && { externals: ["react-dom/client"] })
}),

env: (config) => {
Expand Down
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--multiple-pins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--primary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 19 additions & 50 deletions THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -328,36 +328,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

The following NPM packages may be included in this product:

- @reach/auto-id@0.18.0
- @reach/utils@0.18.0

These packages each contain the following license and notice below:

The MIT License (MIT)

Copyright (c) 2018-2022, React Training LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

The following NPM package may be included in this product:

- @react-aria/ssr@3.8.0
Expand Down Expand Up @@ -2777,7 +2747,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

The following NPM package may be included in this product:

- nanoid@3.3.6
- nanoid@3.3.7

This package contains the following license and notice below:

Expand Down Expand Up @@ -3195,7 +3165,7 @@ OTHER DEALINGS IN THE SOFTWARE.

The following NPM package may be included in this product:

- postcss@8.4.30
- postcss@8.4.35

This package contains the following license and notice below:

Expand Down Expand Up @@ -3357,40 +3327,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

The following NPM package may be included in this product:

- react-collapsed@3.6.0
- react-collapsed@4.1.2

This package contains the following license and notice below:

MIT License
The MIT License (MIT)

Copyright (c) 2019-2020 Rogin Farrer
Copyright (c) 2019-2023, Rogin Farrer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----------

The following NPM packages may be included in this product:

- react-dom@17.0.2
- react-dom@18.2.0
- react-is@16.13.1
- react@17.0.2
- scheduler@0.20.2
- react@18.2.0
- scheduler@0.23.0
- use-sync-external-store@1.2.0

These packages each contain the following license and notice below:
Expand Down
4 changes: 2 additions & 2 deletions docs/search-ui-react.filtersearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ A component which allows a user to search for filters associated with specific e
**Signature:**

```typescript
declare function FilterSearch({ searchFields, label, placeholder, searchOnSelect, onSelect, sectioned, customCssClasses }: FilterSearchProps): JSX.Element;
declare function FilterSearch({ searchFields, label, placeholder, searchOnSelect, onSelect, onDropdownInputChange, sectioned, customCssClasses }: FilterSearchProps): JSX.Element;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| { searchFields, label, placeholder, searchOnSelect, onSelect, sectioned, customCssClasses } | [FilterSearchProps](./search-ui-react.filtersearchprops.md) | |
| { searchFields, label, placeholder, searchOnSelect, onSelect, onDropdownInputChange, sectioned, customCssClasses } | [FilterSearchProps](./search-ui-react.filtersearchprops.md) | |

**Returns:**

Expand Down
1 change: 1 addition & 0 deletions docs/search-ui-react.filtersearchprops.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface FilterSearchProps
| --- | --- | --- | --- |
| [customCssClasses?](./search-ui-react.filtersearchprops.customcssclasses.md) | | [FilterSearchCssClasses](./search-ui-react.filtersearchcssclasses.md) | _(Optional)_ CSS classes for customizing the component styling. |
| [label?](./search-ui-react.filtersearchprops.label.md) | | string | _(Optional)_ The display label for the component. |
| [onDropdownInputChange?](./search-ui-react.filtersearchprops.ondropdowninputchange.md) | | (params: [OnDropdownInputChangeProps](./search-ui-react.ondropdowninputchangeprops.md)<!-- -->) =&gt; void | _(Optional)_ A function which is called when the input element's value changes. Replaces the default behavior. |
| [onSelect?](./search-ui-react.filtersearchprops.onselect.md) | | (params: [OnSelectParams](./search-ui-react.onselectparams.md)<!-- -->) =&gt; void | _(Optional)_ A function which is called when a filter is selected. |
| [placeholder?](./search-ui-react.filtersearchprops.placeholder.md) | | string | _(Optional)_ The search input's placeholder text when no text has been entered by the user. Defaults to "Search here...". |
| [searchFields](./search-ui-react.filtersearchprops.searchfields.md) | | Omit&lt;SearchParameterField, 'fetchEntities'&gt;\[\] | An array of fieldApiName and entityType which indicates what to perform the filter search against. |
Expand Down
13 changes: 13 additions & 0 deletions docs/search-ui-react.filtersearchprops.ondropdowninputchange.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-ui-react](./search-ui-react.md) &gt; [FilterSearchProps](./search-ui-react.filtersearchprops.md) &gt; [onDropdownInputChange](./search-ui-react.filtersearchprops.ondropdowninputchange.md)

## FilterSearchProps.onDropdownInputChange property

A function which is called when the input element's value changes. Replaces the default behavior.

**Signature:**

```typescript
onDropdownInputChange?: (params: OnDropdownInputChangeProps) => void;
```
4 changes: 2 additions & 2 deletions docs/search-ui-react.mapboxmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ A component that renders a map with markers to show result locations using Mapbo
**Signature:**

```typescript
declare function MapboxMap<T>({ mapboxAccessToken, mapboxOptions, PinComponent, getCoordinate, onDrag }: MapboxMapProps<T>): JSX.Element;
declare function MapboxMap<T>({ mapboxAccessToken, mapboxOptions, PinComponent, renderPin, getCoordinate, onDrag }: MapboxMapProps<T>): JSX.Element;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| { mapboxAccessToken, mapboxOptions, PinComponent, getCoordinate, onDrag } | [MapboxMapProps](./search-ui-react.mapboxmapprops.md)<!-- -->&lt;T&gt; | |
| { mapboxAccessToken, mapboxOptions, PinComponent, renderPin, getCoordinate, onDrag } | [MapboxMapProps](./search-ui-react.mapboxmapprops.md)<!-- -->&lt;T&gt; | |

**Returns:**

Expand Down
3 changes: 2 additions & 1 deletion docs/search-ui-react.mapboxmapprops.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ interface MapboxMapProps<T>
| [mapboxAccessToken](./search-ui-react.mapboxmapprops.mapboxaccesstoken.md) | | string | Mapbox access token. |
| [mapboxOptions?](./search-ui-react.mapboxmapprops.mapboxoptions.md) | | Omit&lt;mapboxgl.MapboxOptions, 'container'&gt; | _(Optional)_ Interface for map customization derived from Mapbox GL's Map options. |
| [onDrag?](./search-ui-react.mapboxmapprops.ondrag.md) | | [OnDragHandler](./search-ui-react.ondraghandler.md) | _(Optional)_ A function which is called when user drag the map. |
| [PinComponent?](./search-ui-react.mapboxmapprops.pincomponent.md) | | [PinComponent](./search-ui-react.pincomponent.md)<!-- -->&lt;T&gt; | _(Optional)_ Custom Pin component to render for markers on the map. By default, the built-in marker image from Mapbox GL is used. |
| [PinComponent?](./search-ui-react.mapboxmapprops.pincomponent.md) | | [PinComponent](./search-ui-react.pincomponent.md)<!-- -->&lt;T&gt; | _(Optional)_ Custom Pin component to render for markers on the map. By default, the built-in marker image from Mapbox GL is used. This prop should not be used with [renderPin](./search-ui-react.mapboxmapprops.renderpin.md)<!-- -->. If both are provided, only PinComponent will be used. |
| [renderPin?](./search-ui-react.mapboxmapprops.renderpin.md) | | (props: [PinComponentProps](./search-ui-react.pincomponentprops.md)<!-- -->&lt;T&gt; &amp; { container: HTMLElement; }) =&gt; void | _(Optional)_ Render function for a custom marker on the map. This function takes in an HTML element and is responible for rendering the pin into that element, which will be used as the marker. By default, the built-in marker image from Mapbox GL is used. This prop should not be used with [PinComponent](./search-ui-react.mapboxmapprops.pincomponent.md)<!-- -->. If both are provided, only PinComponent will be used. |

2 changes: 1 addition & 1 deletion docs/search-ui-react.mapboxmapprops.pincomponent.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## MapboxMapProps.PinComponent property

Custom Pin component to render for markers on the map. By default, the built-in marker image from Mapbox GL is used.
Custom Pin component to render for markers on the map. By default, the built-in marker image from Mapbox GL is used. This prop should not be used with [renderPin](./search-ui-react.mapboxmapprops.renderpin.md)<!-- -->. If both are provided, only PinComponent will be used.

**Signature:**

Expand Down
15 changes: 15 additions & 0 deletions docs/search-ui-react.mapboxmapprops.renderpin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-ui-react](./search-ui-react.md) &gt; [MapboxMapProps](./search-ui-react.mapboxmapprops.md) &gt; [renderPin](./search-ui-react.mapboxmapprops.renderpin.md)

## MapboxMapProps.renderPin property

Render function for a custom marker on the map. This function takes in an HTML element and is responible for rendering the pin into that element, which will be used as the marker. By default, the built-in marker image from Mapbox GL is used. This prop should not be used with [PinComponent](./search-ui-react.mapboxmapprops.pincomponent.md)<!-- -->. If both are provided, only PinComponent will be used.

**Signature:**

```typescript
renderPin?: (props: PinComponentProps<T> & {
container: HTMLElement;
}) => void;
```
6 changes: 4 additions & 2 deletions docs/search-ui-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
| [executeSearch(searchActions)](./search-ui-react.executesearch.md) | Executes a universal/vertical search. |
| [Facets(props)](./search-ui-react.facets.md) | A component that displays all facets applicable to the current vertical search. |
| [FilterDivider({ className })](./search-ui-react.filterdivider.md) | A divider component used to separate NumericalFacets, HierarchicalFacets, StandardFacets, and StaticFilters. |
| [FilterSearch({ searchFields, label, placeholder, searchOnSelect, onSelect, sectioned, customCssClasses })](./search-ui-react.filtersearch.md) | A component which allows a user to search for filters associated with specific entities and fields. |
| [FilterSearch({ searchFields, label, placeholder, searchOnSelect, onSelect, onDropdownInputChange, sectioned, customCssClasses })](./search-ui-react.filtersearch.md) | A component which allows a user to search for filters associated with specific entities and fields. |
| [Geolocation\_2({ geolocationOptions, radius, label, GeolocationIcon, handleClick, customCssClasses, })](./search-ui-react.geolocation_2.md) | A React Component which collects location information to create a location filter and perform a new search. |
| [getSearchIntents(searchActions)](./search-ui-react.getsearchintents.md) | Get search intents of the current query stored in headless using autocomplete request. |
| [getUserLocation(geolocationOptions)](./search-ui-react.getuserlocation.md) | Retrieves user's location using navigator.geolocation API. |
| [HierarchicalFacet(props)](./search-ui-react.hierarchicalfacet.md) | A component that displays a single hierarchical facet, in a tree level structure, applicable to the current vertical search. Use this to override the default rendering. |
| [HierarchicalFacets({ searchOnChange, collapsible, defaultExpanded, includedFieldIds, customCssClasses, delimiter, showMoreLimit })](./search-ui-react.hierarchicalfacets.md) | A component that displays hierarchical facets, in a tree level structure, applicable to the current vertical search. |
| [isCtaData(data)](./search-ui-react.isctadata.md) | Type guard for CtaData. |
| [LocationBias({ geolocationOptions, customCssClasses })](./search-ui-react.locationbias.md) | A React Component which displays and collects location information in order to bias searches. |
| [MapboxMap({ mapboxAccessToken, mapboxOptions, PinComponent, getCoordinate, onDrag })](./search-ui-react.mapboxmap.md) | A component that renders a map with markers to show result locations using Mapbox GL. |
| [MapboxMap({ mapboxAccessToken, mapboxOptions, PinComponent, renderPin, getCoordinate, onDrag })](./search-ui-react.mapboxmap.md) | A component that renders a map with markers to show result locations using Mapbox GL. |
| [NumericalFacet(props)](./search-ui-react.numericalfacet.md) | A component that displays a single numerical facet. Use this to override the default rendering. |
| [NumericalFacets({ searchOnChange, includedFieldIds, getFilterDisplayName, inputPrefix, customCssClasses, ...filterGroupProps })](./search-ui-react.numericalfacets.md) | A component that displays numerical facets applicable to the current vertical search. |
| [Pagination(props)](./search-ui-react.pagination.md) | Renders a component that divide a series of vertical results into chunks across multiple pages and enable user to navigate between those pages. |
Expand Down Expand Up @@ -84,6 +84,7 @@
| [NumericalFacetProps](./search-ui-react.numericalfacetprops.md) | Props for the [StandardFacet()](./search-ui-react.standardfacet.md) component. |
| [NumericalFacetsCssClasses](./search-ui-react.numericalfacetscssclasses.md) | The CSS class interface for [NumericalFacets()](./search-ui-react.numericalfacets.md)<!-- -->. |
| [NumericalFacetsProps](./search-ui-react.numericalfacetsprops.md) | Props for the [NumericalFacets()](./search-ui-react.numericalfacets.md) component. |
| [OnDropdownInputChangeProps](./search-ui-react.ondropdowninputchangeprops.md) | The parameters that are passed into [FilterSearchProps.onDropdownInputChange](./search-ui-react.filtersearchprops.ondropdowninputchange.md)<!-- -->. |
| [OnSelectParams](./search-ui-react.onselectparams.md) | The parameters that are passed into [FilterSearchProps.onSelect](./search-ui-react.filtersearchprops.onselect.md)<!-- -->. |
| [PaginationCssClasses](./search-ui-react.paginationcssclasses.md) | The CSS classes used for pagination. |
| [PaginationProps](./search-ui-react.paginationprops.md) | Props for [Pagination()](./search-ui-react.pagination.md) component |
Expand Down Expand Up @@ -141,6 +142,7 @@
| [OnDragHandler](./search-ui-react.ondraghandler.md) | A function which is called when user drag the map. |
| [onSearchFunc](./search-ui-react.onsearchfunc.md) | The interface of a function which is called on a search. |
| [PinComponent](./search-ui-react.pincomponent.md) | A functional component that can be used to render a custom marker on the map. |
| [PinComponentProps](./search-ui-react.pincomponentprops.md) | Props for rendering a custom marker on the map. |
| [RenderEntityPreviews](./search-ui-react.renderentitypreviews.md) | The type of a functional React component which renders entity previews using a map of vertical key to the corresponding VerticalResults data. |
| [SectionComponent](./search-ui-react.sectioncomponent.md) | A component that can be used to render a section template for vertical results. |
| [StaticFilterOptionConfig](./search-ui-react.staticfilteroptionconfig.md) | The configuration data for a field value static filter option. |
Expand Down
Loading

0 comments on commit 5dd6935

Please sign in to comment.