@avenue-ticketing/native 0.1.9 → 0.1.11
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/dist/combobox.js.map +1 -1
- package/dist/input.d.ts +45 -1
- package/dist/input.js +175 -189
- package/dist/input.js.map +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/select-native.js.map +1 -1
- package/dist/select.js.map +1 -1
- package/dist/tag-select.js.map +1 -1
- package/dist/textarea.js.map +1 -1
- package/package.json +1 -1
package/dist/input.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ interface InputBaseProps {
|
|
|
27
27
|
icon?: ComponentType<{
|
|
28
28
|
className?: string;
|
|
29
29
|
size?: number;
|
|
30
|
+
color?: string;
|
|
30
31
|
}>;
|
|
31
32
|
autoCapitalize?: "none" | "sentences" | "words" | "characters";
|
|
32
33
|
keyboardType?: "default" | "email-address" | "numeric" | "phone-pad" | "url";
|
|
@@ -294,4 +295,47 @@ interface InputTagsOuterProps {
|
|
|
294
295
|
}
|
|
295
296
|
declare const InputTagsOuter: FC<InputTagsOuterProps>;
|
|
296
297
|
|
|
297
|
-
|
|
298
|
+
interface InputClearButtonProps {
|
|
299
|
+
/** Accessible label for the clear control. */
|
|
300
|
+
label: string;
|
|
301
|
+
onClear: () => void;
|
|
302
|
+
className?: string;
|
|
303
|
+
size?: number;
|
|
304
|
+
}
|
|
305
|
+
/** Clear control for search / filter fields (X-in-circle). */
|
|
306
|
+
declare const InputClearButton: FC<InputClearButtonProps>;
|
|
307
|
+
interface SearchInputProps extends Omit<InputBaseProps, "type" | "icon" | "className"> {
|
|
308
|
+
/** Leading icon. Defaults to magnifying glass. */
|
|
309
|
+
icon?: ComponentType<{
|
|
310
|
+
className?: string;
|
|
311
|
+
size?: number;
|
|
312
|
+
color?: string;
|
|
313
|
+
}>;
|
|
314
|
+
label?: string;
|
|
315
|
+
hint?: ReactNode;
|
|
316
|
+
isRequired?: boolean;
|
|
317
|
+
hideRequiredIndicator?: boolean;
|
|
318
|
+
/** Accessible label for the clear button. */
|
|
319
|
+
clearLabel: string;
|
|
320
|
+
/**
|
|
321
|
+
* Called when the clear button is pressed. Defaults to `onChangeText("")`.
|
|
322
|
+
*/
|
|
323
|
+
onClear?: () => void;
|
|
324
|
+
/**
|
|
325
|
+
* Show the clear button when `value` is non-empty.
|
|
326
|
+
* @default true
|
|
327
|
+
*/
|
|
328
|
+
isClearable?: boolean;
|
|
329
|
+
/** Outer stack class (label + field + hint). */
|
|
330
|
+
className?: string;
|
|
331
|
+
/** Class name for the input field group (radius, border chrome). */
|
|
332
|
+
fieldClassName?: string;
|
|
333
|
+
size?: InputSize;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Search field: leading magnifying glass + clear button when filled.
|
|
337
|
+
* Matches the mobile discover / organizer sheet search chrome.
|
|
338
|
+
*/
|
|
339
|
+
declare const SearchInput: FC<SearchInputProps>;
|
|
340
|
+
|
|
341
|
+
export { ContactInput, type ContactInputProps, type ContactMode, type ContactValue, EmailInput, type EmailInputProps, HintText, Input, InputBase, type InputBaseProps, InputClearButton, type InputClearButtonProps, InputDate, type InputDateProps, InputFile, type InputFileProps, InputGroup, type InputGroupProps, InputNumber, type InputNumberProps, InputPrefix, type InputPrefixProps, type InputProps, InputSize, InputTags, InputTagsOuter, type InputTagsOuterProps, type InputTagsProps, InputType, Label, PaymentInput, type PaymentInputProps, PhoneInput, type PhoneInputProps, SearchInput, type SearchInputProps, emptyContactValue };
|
package/dist/input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useState, useCallback, useEffect, useMemo, useRef, isValidElement } from 'react';
|
|
2
|
-
import { StyleSheet, useColorScheme, Platform, Modal, View as View$1, Pressable as Pressable$1, Linking } from 'react-native';
|
|
2
|
+
import { StyleSheet, useColorScheme, Platform, Modal, View as View$1, Pressable as Pressable$1, StatusBar, Linking } from 'react-native';
|
|
3
3
|
import { useNativeVariable } from 'react-native-css';
|
|
4
4
|
import { View, Text, TextInput, Pressable, FlatList } from 'react-native-css/components';
|
|
5
5
|
import { EyeIcon } from 'phosphor-react-native/src/icons/Eye';
|
|
@@ -24,6 +24,7 @@ import { CalendarBlankIcon } from 'phosphor-react-native/src/icons/CalendarBlank
|
|
|
24
24
|
import { CaretUpIcon } from 'phosphor-react-native/src/icons/CaretUp';
|
|
25
25
|
import { MinusIcon } from 'phosphor-react-native/src/icons/Minus';
|
|
26
26
|
import { PlusIcon } from 'phosphor-react-native/src/icons/Plus';
|
|
27
|
+
import { XCircleIcon } from 'phosphor-react-native/src/icons/XCircle';
|
|
27
28
|
|
|
28
29
|
// ../../native/components/base/input/input.tsx
|
|
29
30
|
var twMerge = extendTailwindMerge({
|
|
@@ -414,7 +415,7 @@ var InputBase = ({
|
|
|
414
415
|
{
|
|
415
416
|
pointerEvents: "none",
|
|
416
417
|
className: cx(inputStyles.iconLeading, iconClassName ?? sizeStyles.iconLeading),
|
|
417
|
-
children: /* @__PURE__ */ jsx(Icon, { className: "text-fg-quaternary", size: sizeStyles.iconPx })
|
|
418
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "text-fg-quaternary", size: sizeStyles.iconPx, color: fgQuaternary })
|
|
418
419
|
}
|
|
419
420
|
),
|
|
420
421
|
/* @__PURE__ */ jsx(
|
|
@@ -5868,135 +5869,35 @@ function resolveDetectedCountry(parsed) {
|
|
|
5868
5869
|
if (mainCountry) return mainCountry;
|
|
5869
5870
|
return void 0;
|
|
5870
5871
|
}
|
|
5871
|
-
function getLocalePhoneCountry() {
|
|
5872
|
-
if (typeof navigator === "undefined") return void 0;
|
|
5873
|
-
try {
|
|
5874
|
-
const region = navigator.language.split("-").pop()?.toUpperCase();
|
|
5875
|
-
if (region?.length === 2 && getCountryData().byIso.has(region)) return region;
|
|
5876
|
-
} catch {
|
|
5877
|
-
}
|
|
5878
|
-
return void 0;
|
|
5879
|
-
}
|
|
5880
|
-
function getCountryDetectionCandidates(currentCountry) {
|
|
5881
|
-
const ordered = [];
|
|
5882
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5883
|
-
const add = (iso) => {
|
|
5884
|
-
if (!iso || seen.has(iso)) return;
|
|
5885
|
-
if (!getCountryData().byIso.has(iso)) return;
|
|
5886
|
-
seen.add(iso);
|
|
5887
|
-
ordered.push(iso);
|
|
5888
|
-
};
|
|
5889
|
-
add(getLocalePhoneCountry());
|
|
5890
|
-
for (const iso of POPULAR_ISO) add(iso);
|
|
5891
|
-
add(currentCountry);
|
|
5892
|
-
for (const iso of getCountries2()) add(iso);
|
|
5893
|
-
return ordered;
|
|
5894
|
-
}
|
|
5895
|
-
function isValidNationalNumber(digits, country) {
|
|
5896
|
-
if (!digits.length) return false;
|
|
5897
|
-
const parsed = parsePhoneNumber4(digits, country);
|
|
5898
|
-
return parsed?.isValid() ?? false;
|
|
5899
|
-
}
|
|
5900
|
-
function parseScore(parsed) {
|
|
5901
|
-
const type = parsed.getType();
|
|
5902
|
-
if (type === "MOBILE") return 30;
|
|
5903
|
-
if (type === "FIXED_LINE_OR_MOBILE") return 20;
|
|
5904
|
-
if (type === "FIXED_LINE") return 10;
|
|
5905
|
-
if (type === "TOLL_FREE" || type === "PREMIUM_RATE") return 5;
|
|
5906
|
-
return 0;
|
|
5907
|
-
}
|
|
5908
|
-
function parseScoreWithContext(digits, parsed, iso, currentCountry) {
|
|
5909
|
-
let score = parseScore(parsed);
|
|
5910
|
-
if (iso === currentCountry) {
|
|
5911
|
-
score += 15;
|
|
5912
|
-
}
|
|
5913
|
-
if (parsed.nationalNumber === digits && digits.length <= 10) {
|
|
5914
|
-
score += 35;
|
|
5915
|
-
}
|
|
5916
|
-
if ((iso === "US" || iso === "CA") && digits.length === 10 && /^[2-9]\d{9}$/.test(digits)) {
|
|
5917
|
-
score += 40;
|
|
5918
|
-
}
|
|
5919
|
-
if (iso === "IN" && digits.length === 10 && /^[6-9]\d{9}$/.test(digits)) {
|
|
5920
|
-
score += 40;
|
|
5921
|
-
}
|
|
5922
|
-
return score;
|
|
5923
|
-
}
|
|
5924
|
-
function intlDigitMatchBonus(digits, parsed) {
|
|
5925
|
-
if (`${parsed.countryCallingCode}${parsed.nationalNumber}` === digits) {
|
|
5926
|
-
return 50;
|
|
5927
|
-
}
|
|
5928
|
-
return 0;
|
|
5929
|
-
}
|
|
5930
5872
|
function partsFromParsed(parsed) {
|
|
5931
5873
|
const country = resolveDetectedCountry(parsed);
|
|
5932
5874
|
if (!country) return null;
|
|
5933
5875
|
return { digits: parsed.nationalNumber, country };
|
|
5934
5876
|
}
|
|
5935
|
-
function
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
const iso = resolveDetectedCountry(parsed);
|
|
5940
|
-
if (!iso) return;
|
|
5877
|
+
function detectPhoneCountryFromPlus(trimmed) {
|
|
5878
|
+
if (!trimmed.startsWith("+")) return null;
|
|
5879
|
+
const parsed = parsePhoneNumber4(trimmed);
|
|
5880
|
+
if (parsed?.isValid()) {
|
|
5941
5881
|
const parts = partsFromParsed(parsed);
|
|
5942
|
-
if (
|
|
5943
|
-
const score = parseScoreWithContext(digits, parsed, iso, currentCountry) + intlDigitMatchBonus(digits, parsed);
|
|
5944
|
-
candidates.push({ ...parts, score, order });
|
|
5945
|
-
order += 1;
|
|
5946
|
-
};
|
|
5947
|
-
const intlParsed = parsePhoneNumber4(`+${digits}`);
|
|
5948
|
-
if (intlParsed?.isValid()) {
|
|
5949
|
-
consider(intlParsed);
|
|
5882
|
+
if (parts) return parts;
|
|
5950
5883
|
}
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
if (!candidates.length) return null;
|
|
5958
|
-
const best = candidates.reduce((top, candidate) => {
|
|
5959
|
-
if (candidate.score > top.score) return candidate;
|
|
5960
|
-
if (candidate.score === top.score && candidate.order < top.order) return candidate;
|
|
5961
|
-
return top;
|
|
5962
|
-
});
|
|
5963
|
-
return { digits: best.digits, country: best.country };
|
|
5964
|
-
}
|
|
5965
|
-
function detectPhoneCountryFromRaw(trimmed, digits, currentCountry) {
|
|
5966
|
-
if (!digits.length) return null;
|
|
5967
|
-
if (trimmed.startsWith("+")) {
|
|
5968
|
-
const parsed = parsePhoneNumber4(trimmed);
|
|
5969
|
-
if (parsed?.isValid()) {
|
|
5970
|
-
const parts = partsFromParsed(parsed);
|
|
5971
|
-
if (parts) return parts;
|
|
5972
|
-
}
|
|
5973
|
-
const formatter = new AsYouType2();
|
|
5974
|
-
formatter.input(trimmed);
|
|
5975
|
-
const detected = formatter.getNumber();
|
|
5976
|
-
const country = resolveDetectedCountry(detected);
|
|
5977
|
-
if (detected && country) {
|
|
5978
|
-
return { digits: detected.nationalNumber, country };
|
|
5979
|
-
}
|
|
5980
|
-
}
|
|
5981
|
-
const best = pickBestPhoneDetection(digits, currentCountry);
|
|
5982
|
-
if (best) return best;
|
|
5983
|
-
if (isValidNationalNumber(digits, currentCountry)) {
|
|
5984
|
-
const parsed = parsePhoneNumber4(digits, currentCountry);
|
|
5985
|
-
return partsFromParsed(parsed);
|
|
5884
|
+
const formatter = new AsYouType2();
|
|
5885
|
+
formatter.input(trimmed);
|
|
5886
|
+
const detected = formatter.getNumber();
|
|
5887
|
+
const country = resolveDetectedCountry(detected);
|
|
5888
|
+
if (detected && country) {
|
|
5889
|
+
return { digits: detected.nationalNumber, country };
|
|
5986
5890
|
}
|
|
5987
5891
|
return null;
|
|
5988
5892
|
}
|
|
5989
|
-
function processPhoneInput(rawInput, currentCountry,
|
|
5893
|
+
function processPhoneInput(rawInput, currentCountry, _detectCountry = false) {
|
|
5990
5894
|
const trimmed = rawInput.trim();
|
|
5991
5895
|
const digits = rawInput.replace(/\D/g, "");
|
|
5992
5896
|
if (!digits.length) {
|
|
5993
5897
|
return { digits: "", country: currentCountry };
|
|
5994
5898
|
}
|
|
5995
|
-
const
|
|
5996
|
-
if (
|
|
5997
|
-
const detected = detectPhoneCountryFromRaw(trimmed, digits, currentCountry);
|
|
5998
|
-
if (detected?.country) return detected;
|
|
5999
|
-
}
|
|
5899
|
+
const detected = detectPhoneCountryFromPlus(trimmed);
|
|
5900
|
+
if (detected) return detected;
|
|
6000
5901
|
const formatter = new AsYouType2(currentCountry);
|
|
6001
5902
|
formatter.input(digits);
|
|
6002
5903
|
const national = formatter.getNumber();
|
|
@@ -6198,78 +6099,85 @@ var PhoneCountrySelect = ({
|
|
|
6198
6099
|
animationType: "slide",
|
|
6199
6100
|
presentationStyle: "pageSheet",
|
|
6200
6101
|
onRequestClose: close,
|
|
6201
|
-
children: /* @__PURE__ */ jsx(InputGroupContext.Provider, { value: null, children: /* @__PURE__ */ jsx(ShellFocusContext.Provider, { value: null, children: /* @__PURE__ */ jsxs(
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
{
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
className: phoneCountryStyles.
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6102
|
+
children: /* @__PURE__ */ jsx(InputGroupContext.Provider, { value: null, children: /* @__PURE__ */ jsx(ShellFocusContext.Provider, { value: null, children: /* @__PURE__ */ jsxs(
|
|
6103
|
+
View,
|
|
6104
|
+
{
|
|
6105
|
+
className: phoneCountryStyles.sheet,
|
|
6106
|
+
style: Platform.OS === "android" ? { paddingTop: StatusBar.currentHeight ?? 0 } : void 0,
|
|
6107
|
+
children: [
|
|
6108
|
+
/* @__PURE__ */ jsxs(View, { className: phoneCountryStyles.header, children: [
|
|
6109
|
+
/* @__PURE__ */ jsx(View, { className: phoneCountryStyles.headerSide }),
|
|
6110
|
+
/* @__PURE__ */ jsx(Text, { className: phoneCountryStyles.headerTitle, children: "Select country" }),
|
|
6111
|
+
/* @__PURE__ */ jsx(
|
|
6112
|
+
Pressable,
|
|
6113
|
+
{
|
|
6114
|
+
accessibilityRole: "button",
|
|
6115
|
+
accessibilityLabel: "Close",
|
|
6116
|
+
onPress: close,
|
|
6117
|
+
className: phoneCountryStyles.headerClose,
|
|
6118
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 20, weight: "regular", color: fgPrimary })
|
|
6119
|
+
}
|
|
6120
|
+
)
|
|
6121
|
+
] }),
|
|
6122
|
+
/* @__PURE__ */ jsxs(View, { className: phoneCountryStyles.body, children: [
|
|
6123
|
+
/* @__PURE__ */ jsx(View, { className: phoneCountryStyles.searchWrap, children: /* @__PURE__ */ jsx(
|
|
6124
|
+
InputBase,
|
|
6125
|
+
{
|
|
6126
|
+
size: "lg",
|
|
6127
|
+
placeholder: "Search countries",
|
|
6128
|
+
icon: MagnifyingGlassIcon,
|
|
6129
|
+
value: search,
|
|
6130
|
+
onChangeText: setSearch,
|
|
6131
|
+
autoCapitalize: "none",
|
|
6132
|
+
autoCorrect: false
|
|
6133
|
+
}
|
|
6134
|
+
) }),
|
|
6135
|
+
/* @__PURE__ */ jsxs(View, { className: phoneCountryStyles.listRow, children: [
|
|
6136
|
+
/* @__PURE__ */ jsx(
|
|
6137
|
+
FlatList,
|
|
6138
|
+
{
|
|
6139
|
+
ref: listRef,
|
|
6140
|
+
className: phoneCountryStyles.listPane,
|
|
6141
|
+
contentContainerClassName: search.trim() ? phoneCountryStyles.listContentSearch : void 0,
|
|
6142
|
+
data: rows,
|
|
6143
|
+
extraData: value,
|
|
6144
|
+
keyboardShouldPersistTaps: "always",
|
|
6145
|
+
showsVerticalScrollIndicator: false,
|
|
6146
|
+
keyExtractor: (item) => item.type === "letter" ? `letter-${item.letter}` : item.country.iso,
|
|
6147
|
+
onScrollToIndexFailed: (info) => {
|
|
6148
|
+
setTimeout(() => {
|
|
6149
|
+
listRef.current?.scrollToIndex({
|
|
6150
|
+
index: info.index,
|
|
6151
|
+
animated: true,
|
|
6152
|
+
viewPosition: 0.1
|
|
6153
|
+
});
|
|
6154
|
+
}, 100);
|
|
6155
|
+
},
|
|
6156
|
+
ListHeaderComponent: search.trim() ? null : /* @__PURE__ */ jsxs(View, { children: [
|
|
6157
|
+
/* @__PURE__ */ jsx(Text, { className: phoneCountryStyles.sectionTitle, children: "Popular" }),
|
|
6158
|
+
popular.map((country) => /* @__PURE__ */ jsx(View, { children: renderCountry(country) }, country.iso)),
|
|
6159
|
+
/* @__PURE__ */ jsx(View, { className: phoneCountryStyles.separator }),
|
|
6160
|
+
/* @__PURE__ */ jsx(Text, { className: phoneCountryStyles.sectionTitle, children: "All countries" })
|
|
6161
|
+
] }),
|
|
6162
|
+
ListEmptyComponent: /* @__PURE__ */ jsx(Text, { className: phoneCountryStyles.empty, children: "No country found." }),
|
|
6163
|
+
renderItem: ({ item }) => item.type === "letter" ? /* @__PURE__ */ jsx(View, { className: phoneCountryStyles.letterHeader, children: /* @__PURE__ */ jsx(Text, { className: phoneCountryStyles.letterHeaderText, children: item.letter }) }) : renderCountry(item.country)
|
|
6164
|
+
}
|
|
6165
|
+
),
|
|
6166
|
+
!search.trim() && /* @__PURE__ */ jsx(View, { className: phoneCountryStyles.alphabet, children: letters.map((letter) => /* @__PURE__ */ jsx(
|
|
6167
|
+
Pressable,
|
|
6168
|
+
{
|
|
6169
|
+
accessibilityRole: "button",
|
|
6170
|
+
onPress: () => scrollToLetter(letter),
|
|
6171
|
+
className: phoneCountryStyles.alphabetItem,
|
|
6172
|
+
children: /* @__PURE__ */ jsx(Text, { className: phoneCountryStyles.alphabetLabel, children: letter })
|
|
6173
|
+
},
|
|
6174
|
+
letter
|
|
6175
|
+
)) })
|
|
6176
|
+
] })
|
|
6177
|
+
] })
|
|
6178
|
+
]
|
|
6179
|
+
}
|
|
6180
|
+
) }) })
|
|
6273
6181
|
}
|
|
6274
6182
|
)
|
|
6275
6183
|
] });
|
|
@@ -7916,7 +7824,85 @@ var InputTagsOuter = ({
|
|
|
7916
7824
|
] });
|
|
7917
7825
|
};
|
|
7918
7826
|
InputTagsOuter.displayName = "InputTagsOuter";
|
|
7827
|
+
var InputClearButton = ({ label, onClear, className, size = 20 }) => {
|
|
7828
|
+
const fgQuaternary = useNativeVariable("--color-fg-quaternary") ?? "#a4a7ae";
|
|
7829
|
+
return /* @__PURE__ */ jsx(
|
|
7830
|
+
Pressable,
|
|
7831
|
+
{
|
|
7832
|
+
accessibilityRole: "button",
|
|
7833
|
+
accessibilityLabel: label,
|
|
7834
|
+
onPress: onClear,
|
|
7835
|
+
className: cx(
|
|
7836
|
+
"flex size-7 shrink-0 items-center justify-center rounded-full active:opacity-80",
|
|
7837
|
+
className
|
|
7838
|
+
),
|
|
7839
|
+
children: /* @__PURE__ */ jsx(XCircleIcon, { size, weight: "regular", color: fgQuaternary })
|
|
7840
|
+
}
|
|
7841
|
+
);
|
|
7842
|
+
};
|
|
7843
|
+
InputClearButton.displayName = "InputClearButton";
|
|
7844
|
+
var SearchInput = ({
|
|
7845
|
+
value,
|
|
7846
|
+
clearLabel,
|
|
7847
|
+
onClear,
|
|
7848
|
+
onChangeText,
|
|
7849
|
+
isClearable = true,
|
|
7850
|
+
icon = MagnifyingGlassIcon,
|
|
7851
|
+
size = "lg",
|
|
7852
|
+
label,
|
|
7853
|
+
hint,
|
|
7854
|
+
isRequired = false,
|
|
7855
|
+
hideRequiredIndicator = false,
|
|
7856
|
+
isInvalid = false,
|
|
7857
|
+
isDisabled = false,
|
|
7858
|
+
className,
|
|
7859
|
+
inputClassName,
|
|
7860
|
+
fieldClassName,
|
|
7861
|
+
wrapperClassName,
|
|
7862
|
+
...baseProps
|
|
7863
|
+
}) => {
|
|
7864
|
+
const showClear = isClearable && typeof value === "string" && value.length > 0;
|
|
7865
|
+
const showRequired = Boolean(label) && isRequired && !hideRequiredIndicator;
|
|
7866
|
+
const handleClear = () => {
|
|
7867
|
+
if (onClear) {
|
|
7868
|
+
onClear();
|
|
7869
|
+
} else {
|
|
7870
|
+
onChangeText?.("");
|
|
7871
|
+
}
|
|
7872
|
+
};
|
|
7873
|
+
return /* @__PURE__ */ jsxs(View, { className: cx(inputStyles.stack, className), children: [
|
|
7874
|
+
label && /* @__PURE__ */ jsx(Label, { isRequired: showRequired, isInvalid, children: label }),
|
|
7875
|
+
/* @__PURE__ */ jsxs(View, { className: "relative w-full", children: [
|
|
7876
|
+
/* @__PURE__ */ jsx(
|
|
7877
|
+
InputBase,
|
|
7878
|
+
{
|
|
7879
|
+
...baseProps,
|
|
7880
|
+
size,
|
|
7881
|
+
icon,
|
|
7882
|
+
value,
|
|
7883
|
+
isInvalid,
|
|
7884
|
+
isDisabled,
|
|
7885
|
+
autoCapitalize: baseProps.autoCapitalize ?? "none",
|
|
7886
|
+
autoCorrect: baseProps.autoCorrect ?? false,
|
|
7887
|
+
onChangeText,
|
|
7888
|
+
wrapperClassName: cx(fieldClassName, wrapperClassName),
|
|
7889
|
+
inputClassName: cx(showClear && "pr-10", inputClassName)
|
|
7890
|
+
}
|
|
7891
|
+
),
|
|
7892
|
+
showClear && /* @__PURE__ */ jsx(
|
|
7893
|
+
InputClearButton,
|
|
7894
|
+
{
|
|
7895
|
+
label: clearLabel,
|
|
7896
|
+
onClear: handleClear,
|
|
7897
|
+
className: "absolute top-1/2 right-3 z-20 -mt-3.5"
|
|
7898
|
+
}
|
|
7899
|
+
)
|
|
7900
|
+
] }),
|
|
7901
|
+
hint != null && hint !== false && hint !== "" && /* @__PURE__ */ jsx(HintText, { isInvalid, size, children: hint })
|
|
7902
|
+
] });
|
|
7903
|
+
};
|
|
7904
|
+
SearchInput.displayName = "SearchInput";
|
|
7919
7905
|
|
|
7920
|
-
export { ContactInput, EmailInput, HintText, Input, InputBase, InputDate, InputFile, InputGroup, InputNumber, InputPrefix, InputTags, InputTagsOuter, Label, NativeSelect, PaymentInput, PhoneInput, emptyContactValue };
|
|
7906
|
+
export { ContactInput, EmailInput, HintText, Input, InputBase, InputClearButton, InputDate, InputFile, InputGroup, InputNumber, InputPrefix, InputTags, InputTagsOuter, Label, NativeSelect, PaymentInput, PhoneInput, SearchInput, emptyContactValue };
|
|
7921
7907
|
//# sourceMappingURL=input.js.map
|
|
7922
7908
|
//# sourceMappingURL=input.js.map
|