From 74f96cc9225c4a5cf805a627a9373a548f66e07d Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Fri, 8 Sep 2023 17:31:03 -0700 Subject: [PATCH] Add documentation toggle for searching plain text/special characters + update faker.js to latest to get string.symbol API --- package.json | 2 +- .../tables/in_memory/in_memory_search.tsx | 61 +++++++++++-------- yarn.lock | 8 +-- 3 files changed, 39 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index f136e9f725f..6d4e8635abc 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "@emotion/eslint-plugin": "^11.11.0", "@emotion/jest": "^11.11.0", "@emotion/react": "^11.11.0", - "@faker-js/faker": "^7.6.0", + "@faker-js/faker": "^8.0.2", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", "@storybook/addon-essentials": "^7.3.1", "@storybook/addon-interactions": "^7.3.1", diff --git a/src-docs/src/views/tables/in_memory/in_memory_search.tsx b/src-docs/src/views/tables/in_memory/in_memory_search.tsx index 7d27f0e5c3a..cc6d95bdfca 100644 --- a/src-docs/src/views/tables/in_memory/in_memory_search.tsx +++ b/src-docs/src/views/tables/in_memory/in_memory_search.tsx @@ -11,7 +11,6 @@ import { EuiSpacer, EuiSwitch, EuiFlexGroup, - EuiFlexItem, EuiCallOut, EuiCode, } from '../../../../../src/components'; @@ -27,16 +26,23 @@ type User = { }; const users: User[] = []; +const usersWithSpecialCharacters: User[] = []; for (let i = 0; i < 20; i++) { - users.push({ + const userData = { id: i + 1, - firstName: faker.name.firstName(), - lastName: faker.name.lastName(), + firstName: faker.person.firstName(), + lastName: faker.person.lastName(), github: faker.internet.userName(), dateOfBirth: faker.date.past(), online: faker.datatype.boolean(), - location: faker.address.country(), + location: faker.location.country(), + }; + users.push(userData); + usersWithSpecialCharacters.push({ + ...userData, + firstName: `${userData.firstName} "${faker.string.symbol(10)}"`, + lastName: `${userData.lastName} ${faker.internet.emoji()}`, }); } @@ -108,6 +114,7 @@ export default () => { const [incremental, setIncremental] = useState(false); const [filters, setFilters] = useState(false); const [contentBetween, setContentBetween] = useState(false); + const [searchPlainText, setSearchPlainText] = useState(false); const search: EuiSearchBarProps = { box: { @@ -138,34 +145,34 @@ export default () => { return ( <> - - setIncremental(!incremental)} - /> - - - setFilters(!filters)} - /> - - - setContentBetween(!contentBetween)} - /> - + setIncremental(!incremental)} + /> + setFilters(!filters)} + /> + setContentBetween(!contentBetween)} + /> + setSearchPlainText(!searchPlainText)} + />