@avenue-ticketing/native 0.1.11 → 0.1.13

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 CHANGED
@@ -1,15 +1,15 @@
1
- import { createContext, useRef, useState, useMemo, isValidElement, useEffect } from 'react';
1
+ import { createContext, forwardRef, useContext, useState, useRef, useMemo, isValidElement, useEffect } from 'react';
2
2
  import { View, TextInput, Pressable, Text, ScrollView } from 'react-native-css/components';
3
3
  import { useNativeVariable } from 'react-native-css';
4
4
  import { CaretDownIcon } from 'phosphor-react-native/src/icons/CaretDown';
5
5
  import { MagnifyingGlassIcon } from 'phosphor-react-native/src/icons/MagnifyingGlass';
6
6
  import { extendTailwindMerge } from 'tailwind-merge';
7
- import { useWindowDimensions, Modal } from 'react-native';
8
- import 'phosphor-react-native/src/icons/Eye';
9
- import 'phosphor-react-native/src/icons/EyeSlash';
10
- import 'phosphor-react-native/src/icons/Info';
11
- import 'phosphor-react-native/src/icons/Question';
12
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
+ import { Platform, useWindowDimensions, Modal } from 'react-native';
8
+ import { EyeIcon } from 'phosphor-react-native/src/icons/Eye';
9
+ import { EyeSlashIcon } from 'phosphor-react-native/src/icons/EyeSlash';
10
+ import { InfoIcon } from 'phosphor-react-native/src/icons/Info';
11
+ import { QuestionIcon } from 'phosphor-react-native/src/icons/Question';
12
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
13
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
14
14
  import Animated, { Easing, FadeIn, FadeOut, FadeInDown, FadeOutDown } from 'react-native-reanimated';
15
15
  import { XIcon } from 'phosphor-react-native/src/icons/X';
@@ -84,8 +84,62 @@ var inputStyles = sortCx({
84
84
  }
85
85
  }
86
86
  });
87
- createContext(null);
88
- createContext(null);
87
+ var inputGroupStyles = sortCx({
88
+ /** Single outer shell — select/button addons only (Figma 85:1269). */
89
+ shell: "w-full flex-row items-stretch overflow-hidden rounded-lg border border-solid border-primary bg-primary shadow-xs",
90
+ shellFocus: inputFocusRingShadow,
91
+ shellInvalid: "border-error_subtle",
92
+ shellInvalidFocus: inputErrorFocusRingShadow,
93
+ shellDisabled: "opacity-50",
94
+ row: "w-full min-h-0 flex-row items-stretch",
95
+ /** Leading select/button segment — compact, flush (no divider). */
96
+ addonLeading: "shrink-0 flex-row items-stretch self-stretch",
97
+ /** Trailing button segment — left divider; trailing select stays flush. */
98
+ addonTrailing: "shrink-0 flex-row items-stretch self-stretch",
99
+ addonTrailingDivider: "border-l border-solid border-primary",
100
+ prefixInline: "shrink-0 flex-row items-center self-stretch text-tertiary",
101
+ fieldSlot: "min-w-0 flex-1 flex-row items-stretch",
102
+ sizes: {
103
+ sm: {
104
+ shellMinH: "min-h-9",
105
+ prefixInline: "pl-3 pr-1.5 text-sm",
106
+ /** Input padding when leading select is present. */
107
+ inputLeadingSelect: "pl-2 pr-3 py-2 text-sm",
108
+ /** Input padding when trailing select + optional $ prefix. */
109
+ inputTrailingSelect: "pl-0 pr-2 py-2 text-sm",
110
+ inputTrailingSelectNoPrefix: "pl-3 pr-2 py-2 text-sm",
111
+ inputTrailingButton: "pl-3 pr-3 py-2 text-sm"
112
+ },
113
+ md: {
114
+ shellMinH: "min-h-10",
115
+ prefixInline: "pl-3 pr-2 text-md",
116
+ inputLeadingSelect: "pl-2.5 pr-3 py-2 text-md",
117
+ inputTrailingSelect: "pl-0 pr-2 py-2 text-md",
118
+ inputTrailingSelectNoPrefix: "pl-3 pr-2 py-2 text-md",
119
+ inputTrailingButton: "pl-3 pr-3 py-2 text-md"
120
+ },
121
+ lg: {
122
+ shellMinH: "min-h-11",
123
+ prefixInline: "pl-3.5 pr-2 text-md",
124
+ inputLeadingSelect: "pl-3 pr-3.5 py-2.5 text-md",
125
+ inputTrailingSelect: "pl-0 pr-2 py-2.5 text-md",
126
+ inputTrailingSelectNoPrefix: "pl-3.5 pr-2 py-2.5 text-md",
127
+ inputTrailingButton: "pl-3.5 pr-3.5 py-2.5 text-md"
128
+ }
129
+ }
130
+ });
131
+ var InputGroupContext = createContext(null);
132
+ var useInputGroupContext = () => useContext(InputGroupContext);
133
+ var ShellFocusContext = createContext(null);
134
+ var useShellFocus = () => useContext(ShellFocusContext);
135
+ var androidInputPad = (size, leading, trailing) => {
136
+ if (Platform.OS !== "android") return void 0;
137
+ const x = size === "lg" ? 14 : 12;
138
+ return {
139
+ paddingStart: leading ? size === "sm" ? 36 : size === "lg" ? 42 : 40 : x,
140
+ paddingEnd: trailing ? size === "lg" ? 38 : 36 : x
141
+ };
142
+ };
89
143
  var Label = ({ children, isRequired, isInvalid, className }) => {
90
144
  return /* @__PURE__ */ jsxs(View, { className: cx(inputStyles.labelRow, className), children: [
91
145
  /* @__PURE__ */ jsx(Text, { className: inputStyles.label, children }),
@@ -110,6 +164,143 @@ var HintText = ({ children, isInvalid, size, className }) => {
110
164
  }
111
165
  );
112
166
  };
167
+ var InputBase = forwardRef(function InputBase2({
168
+ size: sizeProp = "md",
169
+ type = "text",
170
+ placeholder,
171
+ value,
172
+ defaultValue,
173
+ isDisabled: isDisabledProp = false,
174
+ isInvalid: isInvalidProp = false,
175
+ tooltip,
176
+ icon: Icon,
177
+ autoCapitalize,
178
+ keyboardType,
179
+ textContentType: textContentTypeProp,
180
+ autoComplete: autoCompleteProp,
181
+ autoCorrect: autoCorrectProp,
182
+ autoFocus,
183
+ returnKeyType,
184
+ editable,
185
+ className,
186
+ inputClassName,
187
+ wrapperClassName,
188
+ iconClassName,
189
+ onChangeText,
190
+ onFocus,
191
+ onBlur,
192
+ onPress,
193
+ onSubmitEditing
194
+ }, ref) {
195
+ const group = useInputGroupContext();
196
+ const setShellFocus = useShellFocus();
197
+ const size = group?.size ?? sizeProp;
198
+ const isDisabled = Boolean(group?.isDisabled || isDisabledProp);
199
+ const isInvalid = Boolean(group?.isInvalid || isInvalidProp);
200
+ const shellOwnsChrome = Boolean(group?.shellOwnsChrome);
201
+ const joinLeadingPrefix = Boolean(group?.joinLeadingPrefix);
202
+ const groupPad = group ? inputGroupStyles.sizes[size] : null;
203
+ const groupInputPad = groupPad && group?.hasLeadingSelect ? groupPad.inputLeadingSelect : groupPad && group?.hasTrailingSelect ? group?.hasPrefix ? groupPad.inputTrailingSelect : groupPad.inputTrailingSelectNoPrefix : groupPad && group?.hasTrailingButton ? groupPad.inputTrailingButton : null;
204
+ const [isFocused, setIsFocused] = useState(false);
205
+ const [isPasswordVisible, setIsPasswordVisible] = useState(false);
206
+ const isPassword = type === "password";
207
+ const hasLeadingIcon = Boolean(Icon);
208
+ const hasTrailingIcon = Boolean(tooltip) || isInvalid || isPassword;
209
+ const sizeStyles = inputStyles.sizes[size];
210
+ const fgQuaternary = useNativeVariable("--color-fg-quaternary") ?? "#a4a7ae";
211
+ const fgErrorSecondary = useNativeVariable("--color-fg-error-secondary") ?? "#f04438";
212
+ const handleFocus = () => {
213
+ setIsFocused(true);
214
+ setShellFocus?.(true);
215
+ onFocus?.();
216
+ };
217
+ const handleBlur = () => {
218
+ setIsFocused(false);
219
+ setShellFocus?.(false);
220
+ onBlur?.();
221
+ };
222
+ const field = /* @__PURE__ */ jsxs(
223
+ View,
224
+ {
225
+ className: cx(
226
+ shellOwnsChrome ? "relative isolate min-w-0 flex-1 flex-row items-center self-stretch bg-transparent" : cx(inputStyles.field.root, sizeStyles.field),
227
+ joinLeadingPrefix && !shellOwnsChrome && "rounded-l-none",
228
+ !shellOwnsChrome && isFocused && !isInvalid && inputStyles.field.focus,
229
+ !shellOwnsChrome && isInvalid && inputStyles.field.invalid,
230
+ !shellOwnsChrome && isInvalid && isFocused && inputStyles.field.invalidFocus,
231
+ !shellOwnsChrome && isDisabled && inputStyles.field.disabled,
232
+ wrapperClassName,
233
+ className
234
+ ),
235
+ children: [
236
+ Icon && /* @__PURE__ */ jsx(
237
+ View,
238
+ {
239
+ pointerEvents: "none",
240
+ className: cx(inputStyles.iconLeading, iconClassName ?? sizeStyles.iconLeading),
241
+ children: /* @__PURE__ */ jsx(Icon, { className: "text-fg-quaternary", size: sizeStyles.iconPx, color: fgQuaternary })
242
+ }
243
+ ),
244
+ /* @__PURE__ */ jsx(
245
+ TextInput,
246
+ {
247
+ ref,
248
+ accessibilityLabel: placeholder,
249
+ editable: editable ?? !isDisabled,
250
+ placeholder,
251
+ value,
252
+ defaultValue,
253
+ secureTextEntry: isPassword && !isPasswordVisible,
254
+ autoCapitalize: autoCapitalize ?? (type === "email" ? "none" : void 0),
255
+ autoCorrect: autoCorrectProp ?? type !== "email",
256
+ autoFocus,
257
+ returnKeyType,
258
+ keyboardType: keyboardType ?? (type === "email" ? "email-address" : "default"),
259
+ textContentType: textContentTypeProp ?? (isPassword ? "password" : type === "email" ? "emailAddress" : void 0),
260
+ autoComplete: autoCompleteProp ?? (type === "email" ? "email" : isPassword ? "password" : void 0),
261
+ onChangeText,
262
+ onFocus: handleFocus,
263
+ onBlur: handleBlur,
264
+ onSubmitEditing,
265
+ blurOnSubmit: onSubmitEditing ? false : void 0,
266
+ style: {
267
+ includeFontPadding: false,
268
+ paddingVertical: 0,
269
+ ...androidInputPad(size, hasLeadingIcon, hasTrailingIcon)
270
+ },
271
+ className: cx(
272
+ inputStyles.input,
273
+ groupInputPad ?? sizeStyles.input,
274
+ !groupInputPad && hasLeadingIcon && sizeStyles.inputLeading,
275
+ !groupInputPad && hasTrailingIcon && sizeStyles.inputTrailing,
276
+ // Tooltip / invalid icon still need trailing room inside a group shell.
277
+ groupInputPad && hasTrailingIcon && "pr-9",
278
+ inputClassName
279
+ )
280
+ }
281
+ ),
282
+ isPassword && /* @__PURE__ */ jsx(
283
+ Pressable,
284
+ {
285
+ accessibilityRole: "button",
286
+ accessibilityLabel: "Toggle password visibility",
287
+ disabled: isDisabled,
288
+ onPress: () => setIsPasswordVisible((visible) => !visible),
289
+ className: cx(inputStyles.iconTrailing, sizeStyles.iconTrailing),
290
+ children: isPasswordVisible ? /* @__PURE__ */ jsx(EyeSlashIcon, { size: sizeStyles.iconPx, weight: "bold", color: fgQuaternary }) : /* @__PURE__ */ jsx(EyeIcon, { size: sizeStyles.iconPx, weight: "bold", color: fgQuaternary })
291
+ }
292
+ ),
293
+ !isPassword && isInvalid && /* @__PURE__ */ jsx(View, { pointerEvents: "none", className: cx(inputStyles.iconInvalid, sizeStyles.iconTrailing), children: /* @__PURE__ */ jsx(InfoIcon, { size: 16, weight: "bold", color: fgErrorSecondary }) }),
294
+ !isPassword && tooltip && !isInvalid && /* @__PURE__ */ jsx(View, { pointerEvents: "none", className: cx(inputStyles.iconTrailing, sizeStyles.iconTrailing), children: /* @__PURE__ */ jsx(QuestionIcon, { size: 16, weight: "bold", color: fgQuaternary }) })
295
+ ]
296
+ }
297
+ );
298
+ if (onPress) {
299
+ return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", disabled: isDisabled, onPress, className: "min-w-0 flex-1", children: field });
300
+ }
301
+ return field;
302
+ });
303
+ InputBase.displayName = "InputBase";
113
304
 
114
305
  // ../core/src/dialog.ts
115
306
  var DIALOG_SHEET_MOTION_MS = 175;