Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .generatelicensefile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"inputs": ["./package.json"],
"output": "./THIRD-PARTY-NOTICES",
"overwrite": true,
"replace": {
"@mapbox/jsonlint-lines-primitives@2.0.2": "./licenses/jsonlint-lines-primitives.txt"
}
}
13 changes: 13 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Publish Package

on:
push:
tags:
- "*"

permissions:
id-token: write # Required for OIDC

jobs:
publish:
uses: yext/slapshot-reusable-workflows/.github/workflows/publish.yml@v1
32 changes: 27 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,42 @@ name: Run Tests
on: [push, pull_request]

jobs:
call_run_tests-react-19:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: |
npx playwright install
node_matrix: '["20.x"]'
secrets:
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}

call_run_tests-react-18:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: |
npm i \
react@^18.2.0 \
react-dom@^18.2.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"
npx playwright install
node_matrix: '["16.x", "18.x"]'
npm run build
node_matrix: '["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
# 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: |
Expand All @@ -39,7 +61,7 @@ jobs:
"@swc/core-win32-x64-msvc"
npx playwright install
npm run build
node_matrix: '["16.x", "18.x"]'
node_matrix: '["18.x"]'
secrets:
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}

Expand All @@ -63,6 +85,6 @@ jobs:
"@swc/core-win32-x64-msvc"
npx playwright install
npm run build
node_matrix: '["16.x", "18.x"]'
node_matrix: '["18.x"]'
secrets:
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}
2 changes: 2 additions & 0 deletions .github/workflows/third_party_notices_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ jobs:
uses: yext/slapshot-reusable-workflows/.github/workflows/third_party_notices_check.yml@v1
with:
environment: macos-latest
generate_license_args: "--config .generatelicensefile.json"
generate_license_version: "4"
secrets:
REPO_SCOPED_TOKEN: ${{ secrets.BOT_REPO_SCOPED_TOKEN }}
11 changes: 0 additions & 11 deletions .github/workflows/version_update.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ dist/
/coverage
/storybook-static

.npm-cache/
test-site/yext-search-ui-react-*.tgz

.env
test-site/.env
.idea/

# misc
.DS_Store
.DS_Store
77 changes: 55 additions & 22 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
// .storybook/main.ts
import type { StorybookConfig } from '@storybook/react-webpack5';
import React from 'react';
import path from 'path';

const reactMajorVersion = Number(React.version.split('.')[0]);
const isLegacyReact = Number.isNaN(reactMajorVersion) ? false : reactMajorVersion < 18;

const config: StorybookConfig = {
stories: [
'../tests/**/*.stories.tsx'
],
features: {
storyStoreV7: false,
},
addons: [
'@etchteam/storybook-addon-status',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
{
name: '@storybook/addon-coverage',
options: {
istanbul: {
include: ['src/components/**']
}
}
},
// NOTE: not using @storybook/addon-coverage preset (it triggers import.meta.resolve)
],

framework: {
Expand All @@ -31,18 +26,56 @@ const config: StorybookConfig = {

staticDirs: ['./public'],

webpackFinal: async (config) => ({
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve?.alias,
'./SearchCore': require.resolve('../tests/__fixtures__/core/SearchCore.ts'),
'../utils/location-operations': require.resolve('../tests/__fixtures__/utils/location-operations.ts')
webpackFinal: async (config) => {
const final = {
...config,
resolve: {
...config.resolve,
extensions: [
...(config.resolve?.extensions ?? []),
'.ts',
'.tsx',
],
alias: {
...config.resolve?.alias,
'./SearchCore': require.resolve('../tests/__fixtures__/core/SearchCore.ts'),
'../utils/location-operations': require.resolve('../tests/__fixtures__/utils/location-operations.ts')
},
},
...(isLegacyReact && { externals: ['react-dom/client'] }),
module: {
...config.module,
rules: [
...(config.module?.rules ?? []),
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
cacheDirectory: true,
presets: [
require.resolve('@babel/preset-env'),
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-typescript'),
],
// ALWAYS include babel-plugin-istanbul so coverage is available by default.
// This avoids requiring a runtime flag or env var.
plugins: [
require.resolve('babel-plugin-istanbul'),
],
},
},
],
},
// no istanbul-instrumenter-loader here (incompatible with webpack5)
],
},
},
...(!React.version.startsWith('18') && { externals: ["react-dom/client"] })
}),
};

return final;
},

env: (config) => {
const mapboxApiKey = process.env.MAPBOX_API_KEY || process.env.REACT_APP_MAPBOX_API_KEY;
Expand Down
5 changes: 3 additions & 2 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { addons } from '@storybook/addons';
import { addons } from '@storybook/manager-api';
import yextTheme from './yextTheme';

addons.setConfig({
theme: require('./yextTheme.ts')
theme: yextTheme,
});
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.
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__/appliedfilters--primary.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.
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__/directanswer--loading.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.
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.
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.
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__/facets--primary.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.
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.
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.
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__/filtersearch--primary.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__/geolocation--primary.png
Binary file modified .storybook/snapshots/__snapshots__/locationbias--primary.png
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--primary.png
Binary file modified .storybook/snapshots/__snapshots__/numericalfacets--primary.png
Binary file modified .storybook/snapshots/__snapshots__/pagination--loading.png
Binary file modified .storybook/snapshots/__snapshots__/pagination--on-mid-page.png
Binary file modified .storybook/snapshots/__snapshots__/pagination--primary.png
Binary file modified .storybook/snapshots/__snapshots__/rangeinput--disabled.png
Binary file modified .storybook/snapshots/__snapshots__/rangeinput--primary.png
Binary file modified .storybook/snapshots/__snapshots__/resultscount--primary.png
Binary file modified .storybook/snapshots/__snapshots__/spellcheck--primary.png
Binary file modified .storybook/snapshots/__snapshots__/standardfacets--primary.png
Binary file modified .storybook/snapshots/__snapshots__/staticfilters--primary.png
Binary file modified .storybook/snapshots/__snapshots__/staticfilters--searchable.png
Binary file modified .storybook/snapshots/__snapshots__/universalresults--primary.png
4 changes: 3 additions & 1 deletion .storybook/yextTheme.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { create } from '@storybook/theming';

module.exports = create({
const yextTheme = create({
base: 'light',
colorPrimary: '#eeeff0',
colorSecondary: '#2563eb',
Expand Down Expand Up @@ -30,3 +30,5 @@ module.exports = create({
brandUrl: 'https://github.com/yext/search-ui-react',
brandImage: './logo.png'
});

export default yextTheme;
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,6 @@ import '@yext/search-ui-react/bundle.css'

## Compatibility Notes

This library and its dependencies use optional chaining and other modern TS syntax that is not inherently supported by Webpack <5 (e.g. via `create-react-app@4`). Additional Babel plugins are needed for transpiling if using legacy versions.
This library and its dependencies use optional chaining and other modern TS syntax that is not inherently supported by Webpack <5 (e.g. via `create-react-app@4`). Additional Babel plugins are needed for transpiling if using legacy versions.

If you need to verify this package against multiple major React releases while developing locally, follow the workflow in [guides/react-compatibility.md](./guides/react-compatibility.md) to install the library into the `test-site` the same way end users consume it.
Loading
Loading