@tellescope/react-components 1.174.0 → 1.176.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.174.0",
3
+ "version": "1.176.0",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -47,13 +47,13 @@
47
47
  "@reduxjs/toolkit": "^1.6.2",
48
48
  "@stripe/react-stripe-js": "^2.9.0",
49
49
  "@stripe/stripe-js": "^1.52.1",
50
- "@tellescope/constants": "^1.174.0",
51
- "@tellescope/sdk": "^1.174.0",
52
- "@tellescope/types-client": "^1.174.0",
53
- "@tellescope/types-models": "^1.174.0",
54
- "@tellescope/types-utilities": "^1.174.0",
55
- "@tellescope/utilities": "^1.174.0",
56
- "@tellescope/validation": "^1.174.0",
50
+ "@tellescope/constants": "^1.176.0",
51
+ "@tellescope/sdk": "^1.176.0",
52
+ "@tellescope/types-client": "^1.176.0",
53
+ "@tellescope/types-models": "^1.176.0",
54
+ "@tellescope/types-utilities": "^1.176.0",
55
+ "@tellescope/utilities": "^1.176.0",
56
+ "@tellescope/validation": "^1.176.0",
57
57
  "@typescript-eslint/eslint-plugin": "^4.33.0",
58
58
  "@typescript-eslint/parser": "^4.33.0",
59
59
  "css-to-react-native": "^3.0.0",
@@ -84,7 +84,7 @@
84
84
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
85
85
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
86
86
  },
87
- "gitHead": "b18cb31c80f3294f01abeb2bcb2d73c19441f738",
87
+ "gitHead": "0d2bd51eb1418f968d6a11b0376c5e383dbcce34",
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  }
@@ -1755,7 +1755,11 @@ export const DropdownInput = ({ field, value, onChange }: FormInputProps<'Dropdo
1755
1755
  ? onChange(e.target.value ? [e.target.value] : [], field.id)
1756
1756
  : undefined
1757
1757
  )}
1758
- placeholder={field.placeholder + ((!field.title && !field.isOptional) ? '*' : '')}
1758
+ placeholder={
1759
+ field.placeholder
1760
+ ? field.placeholder + ((!field.title && !field.isOptional) ? '*' : '')
1761
+ : undefined
1762
+ }
1759
1763
  label={
1760
1764
  (!field.options?.radio && field.options?.other)
1761
1765
  ? "Press enter to save a custom value"
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useCallback, useMemo, useState, useRef } from "react"
2
2
  import { Indexable, ScoreFilter } from "@tellescope/types-utilities"
3
- import { objects_equivalent, read_local_storage, safeJSONParse, update_local_storage, user_display_name } from "@tellescope/utilities"
3
+ import { objects_equivalent, read_local_storage, safeJSONParse, to_human_readable_phone_number, update_local_storage, user_display_name } from "@tellescope/utilities"
4
4
  import { LoadFunction, LoadFunctionArguments } from "@tellescope/sdk"
5
5
  import { ALL_ACCESS, UNSEARCHABLE_FIELDS } from "@tellescope/constants"
6
6
  import { SearchAPIProps, useSearchAPI } from "./hooks"
@@ -224,6 +224,15 @@ export const filter_for_query = <T,>(query: string, getAdditionalFields?: (v: T)
224
224
  score +=1
225
225
  continue
226
226
  }
227
+ // for phone number search, replace human-readable entries which are not stored
228
+ const onlyNumbers = query.replaceAll(/[^0-9]/g, '')
229
+ if (
230
+ onlyNumbers.length >= 3 &&
231
+ value.toUpperCase().includes(onlyNumbers)
232
+ ) {
233
+ score +=1
234
+ continue
235
+ }
227
236
  }
228
237
 
229
238
  return score
package/src/table.tsx CHANGED
@@ -38,7 +38,7 @@ import { PRIMARY_HEX } from "@tellescope/constants"
38
38
 
39
39
  import CloudDownloadIcon from '@mui/icons-material/CloudDownload';
40
40
  import { Autocomplete } from "@mui/material"
41
- import { SortingField } from "@tellescope/types-models"
41
+ import { ListQueryQualifier, SortingField } from "@tellescope/types-models"
42
42
  // import DragHandleIcon from '@mui/icons-material/DragHandle';
43
43
 
44
44
  const LIGHT_GRAY = "#fafafa"
@@ -101,6 +101,7 @@ const checkboxStyle: React.CSSProperties = {
101
101
  type LocalFilter = {
102
102
  query: string,
103
103
  values?: string[],
104
+ valuesQualifier?: ListQueryQualifier,
104
105
  }
105
106
 
106
107
  // export type SortType = 'infer'
@@ -183,6 +184,19 @@ export const TableHeader = <T extends Item>({
183
184
  <Flex flex={1} justifyContent="center">
184
185
  {fields[openFilter]?.filterType === 'multi'
185
186
  ? (
187
+ <>
188
+ <Autocomplete disableClearable disablePortal size={'small'} options={['One Of', 'All Of']} sx={{ width: 140, mr: 0.5 }}
189
+ onChange={(e, value) => {
190
+ setLocalFilters(fs => fs.map((f, i) => i === openFilter ? { ...f, valuesQualifier: value === 'All Of' ? 'All Of' : 'One Of' } : f))
191
+ }}
192
+ value={localFilters[openFilter]?.valuesQualifier === 'All Of' ? 'All Of' : 'One Of'}
193
+ renderInput={(params) =>
194
+ <TextField {...params} fullWidth autoFocus label={"Qualifier"} size={'small'}
195
+ value={localFilters[openFilter]?.valuesQualifier === 'All Of' ? 'All Of' : 'One Of'}
196
+ />
197
+ }
198
+ />
199
+
186
200
  <Autocomplete size={'small'}
187
201
  disablePortal multiple
188
202
  options={(filterSuggestions?.[fields[openFilter]?.key?.toString()] || []).sort()}
@@ -192,13 +206,14 @@ export const TableHeader = <T extends Item>({
192
206
  }}
193
207
  value={localFilters[openFilter]?.values ?? []}
194
208
  renderInput={(params) =>
195
- <TextField {...params} autoFocus label={"Filter"} size={'small'}
209
+ <TextField {...params} autoFocus label={"Filter by"} size={'small'}
196
210
  style={{ width: 400 }}
197
211
  value={localFilters[openFilter]?.query ?? ''}
198
212
  // onKeyUp={e => e.which === 13 && onEnterPress?.()}
199
213
  />
200
214
  }
201
215
  />
216
+ </>
202
217
  ) : (
203
218
  <Autocomplete size={'small'}
204
219
  disablePortal
@@ -922,13 +937,16 @@ export const Table = <T extends Item>({
922
937
  const { getFilterValue, filterType } = fields[i]
923
938
  if (!getFilterValue) continue
924
939
 
925
- const { query, values } = localFilters[i] ?? {}
940
+ const { query, values, valuesQualifier } = localFilters[i] ?? {}
926
941
 
927
942
  if (filterType === 'multi') {
928
943
  if (!values?.length) continue
929
944
 
930
945
  const filterValueOrValues = getFilterValue(v)
931
946
  const filterValues = Array.isArray(filterValueOrValues) ? filterValueOrValues : [filterValueOrValues]
947
+ if (valuesQualifier === 'All Of') {
948
+ return values.every(v => filterValues.includes(v))
949
+ }
932
950
  if (!filterValues.find(v => values.includes(v))) {
933
951
  return false
934
952
  }