@tellescope/react-components 1.177.0 → 1.178.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/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +13 -5
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/esm/Forms/forms.d.ts +1 -1
- package/lib/esm/Forms/inputs.d.ts +1 -1
- package/lib/esm/Forms/inputs.native.d.ts +1 -0
- package/lib/esm/Forms/inputs.native.d.ts.map +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +13 -5
- package/lib/esm/inputs_shared.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/inputs_shared.tsx +16 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.178.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.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
54
|
-
"@tellescope/types-utilities": "^1.
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
56
|
-
"@tellescope/validation": "^1.
|
|
50
|
+
"@tellescope/constants": "^1.178.0",
|
|
51
|
+
"@tellescope/sdk": "^1.178.0",
|
|
52
|
+
"@tellescope/types-client": "^1.178.0",
|
|
53
|
+
"@tellescope/types-models": "^1.178.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.178.0",
|
|
55
|
+
"@tellescope/utilities": "^1.178.0",
|
|
56
|
+
"@tellescope/validation": "^1.178.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": "
|
|
87
|
+
"gitHead": "3a19783254252a6a5f81188049d32b519ad47648",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
package/src/inputs_shared.tsx
CHANGED
|
@@ -184,6 +184,13 @@ export const record_matches_for_query = <T,>(records: T[], query: string) => {
|
|
|
184
184
|
return matches
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
const is_phone_prefix = (s: string) => {
|
|
188
|
+
if (s.length <= 3) return false
|
|
189
|
+
|
|
190
|
+
// has ONLY numbers, (), +, - and spaces
|
|
191
|
+
return /^[ 0-9()+-]+$/.test(s)
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
export const filter_for_query = <T,>(query: string, getAdditionalFields?: (v: T) => Indexable | undefined): FilterWithData<T> => {
|
|
188
195
|
const baseFilter = (record: Indexable): number => {
|
|
189
196
|
if (!record) return 0
|
|
@@ -241,13 +248,15 @@ export const filter_for_query = <T,>(query: string, getAdditionalFields?: (v: T)
|
|
|
241
248
|
continue
|
|
242
249
|
}
|
|
243
250
|
// for phone number search, replace human-readable entries which are not stored
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
if (is_phone_prefix(query)) {
|
|
252
|
+
const onlyNumbers = query.replaceAll(/[^0-9]/g, '')
|
|
253
|
+
if (
|
|
254
|
+
onlyNumbers.length >= 3 &&
|
|
255
|
+
value.toUpperCase().includes(onlyNumbers)
|
|
256
|
+
) {
|
|
257
|
+
score +=1
|
|
258
|
+
continue
|
|
259
|
+
}
|
|
251
260
|
}
|
|
252
261
|
}
|
|
253
262
|
|