@mrmeg/expo-ui 0.23.0 → 0.25.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/LLM_USAGE.md +172 -157
  3. package/README.md +447 -352
  4. package/dist/components/Avatar.js +6 -1
  5. package/dist/components/BottomSheet.js +1 -1
  6. package/dist/components/Button.d.ts +1 -1
  7. package/dist/components/Carousel.js +2 -0
  8. package/dist/components/Dialog.d.ts +15 -93
  9. package/dist/components/Dialog.js +5 -0
  10. package/dist/components/DismissKeyboard.d.ts +14 -3
  11. package/dist/components/DismissKeyboard.js +17 -48
  12. package/dist/components/DropdownMenu.d.ts +5 -34
  13. package/dist/components/DropdownMenu.js +2 -1
  14. package/dist/components/InputOTP.js +6 -1
  15. package/dist/components/Popover.d.ts +11 -11
  16. package/dist/components/Popover.js +3 -2
  17. package/dist/components/Select.d.ts +12 -20
  18. package/dist/components/Select.js +2 -1
  19. package/dist/components/StatusBar.js +2 -6
  20. package/dist/components/StyledText.context.d.ts +1 -1
  21. package/dist/components/StyledText.d.ts +6 -2
  22. package/dist/components/TextInput.d.ts +6 -2
  23. package/dist/components/TextInput.js +189 -42
  24. package/dist/components/Tooltip.d.ts +10 -24
  25. package/dist/components/Tooltip.js +5 -2
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/components/index.js +1 -0
  28. package/dist/components/keyboardController.d.ts +4 -2
  29. package/dist/components/keyboardController.js +4 -0
  30. package/dist/components/keyboardDismiss.d.ts +37 -0
  31. package/dist/components/keyboardDismiss.js +170 -0
  32. package/dist/components/keyboardFocusRegistry.d.ts +10 -14
  33. package/dist/components/keyboardFocusRegistry.js +8 -24
  34. package/dist/design-system.json +2236 -0
  35. package/dist/hooks/useTheme.d.ts +11 -3
  36. package/llms-full.md +134 -124
  37. package/llms.txt +24 -22
  38. package/package.json +11 -8
@@ -1,6 +1,11 @@
1
- import type { GestureResponderEvent } from "react-native";
2
- import type { FocusedInputLayoutChangedEvent } from "react-native-keyboard-controller";
3
- export type KeyboardFocusedInputLayout = FocusedInputLayoutChangedEvent["layout"];
1
+ /**
2
+ * Registry of the currently focused native (`@expo/ui`) text field.
3
+ *
4
+ * React Native's `TextInputState` never learns about SwiftUI / Compose fields,
5
+ * so `Keyboard.dismiss()` cannot blur them. The package `TextInput` registers a
6
+ * blur handle here on focus; tap-away dismissal (`keyboardDismiss.ts`) and the
7
+ * `BottomSheet` overlay resign the field through it.
8
+ */
4
9
  export type KeyboardFocusedInputToken = object;
5
10
  /**
6
11
  * Subscribe to focus presence changes. Pairs with {@link hasKeyboardFocusedInput}
@@ -9,16 +14,8 @@ export type KeyboardFocusedInputToken = object;
9
14
  * keyboards raised inside a native sheet's isolated window.
10
15
  */
11
16
  export declare function subscribeKeyboardFocus(listener: () => void): () => void;
12
- export declare function setKeyboardFocusedInputLayout(token: KeyboardFocusedInputToken, layout: KeyboardFocusedInputLayout, blur?: () => void): void;
13
- export declare function clearKeyboardFocusedInputLayout(token: KeyboardFocusedInputToken): void;
14
- export declare function getKeyboardFocusedInputLayout(): {
15
- x: number;
16
- y: number;
17
- width: number;
18
- height: number;
19
- absoluteX: number;
20
- absoluteY: number;
21
- } | undefined;
17
+ export declare function setKeyboardFocusedInput(token: KeyboardFocusedInputToken, blur: () => void): void;
18
+ export declare function clearKeyboardFocusedInput(token: KeyboardFocusedInputToken): void;
22
19
  /** Whether any native field currently holds focus. Stable boolean for snapshots. */
23
20
  export declare function hasKeyboardFocusedInput(): boolean;
24
21
  /**
@@ -26,4 +23,3 @@ export declare function hasKeyboardFocusedInput(): boolean;
26
23
  * `true` if a field was focused and a blur handle was available.
27
24
  */
28
25
  export declare function dismissKeyboardFocusedInput(): boolean;
29
- export declare function isTouchInsideKeyboardFocusedInput(event: GestureResponderEvent, nativeLayout?: KeyboardFocusedInputLayout | null): boolean;
@@ -1,4 +1,3 @@
1
- const FOCUSED_INPUT_TOUCH_SLOP = 16;
2
1
  let focusedInput = null;
3
2
  const listeners = new Set();
4
3
  function emit() {
@@ -16,23 +15,22 @@ export function subscribeKeyboardFocus(listener) {
16
15
  listeners.delete(listener);
17
16
  };
18
17
  }
19
- export function setKeyboardFocusedInputLayout(token, layout, blur) {
18
+ export function setKeyboardFocusedInput(token, blur) {
20
19
  const wasPresent = focusedInput != null;
21
- focusedInput = { token, layout, blur };
22
- // Only notify subscribers on a presence transition; re-measures (scroll,
23
- // layout) update the layout silently so the overlay doesn't churn.
20
+ focusedInput = { token, blur };
21
+ // Only notify subscribers on a presence transition; a focus handoff between
22
+ // two fields keeps presence true and stays silent.
24
23
  if (!wasPresent)
25
24
  emit();
26
25
  }
27
- export function clearKeyboardFocusedInputLayout(token) {
26
+ export function clearKeyboardFocusedInput(token) {
27
+ // Token-guarded: when focus hops A -> B, B's focus can land before A's blur,
28
+ // and A's late clear must not wipe B's registration.
28
29
  if (focusedInput?.token === token) {
29
30
  focusedInput = null;
30
31
  emit();
31
32
  }
32
33
  }
33
- export function getKeyboardFocusedInputLayout() {
34
- return focusedInput?.layout;
35
- }
36
34
  /** Whether any native field currently holds focus. Stable boolean for snapshots. */
37
35
  export function hasKeyboardFocusedInput() {
38
36
  return focusedInput != null;
@@ -42,23 +40,9 @@ export function hasKeyboardFocusedInput() {
42
40
  * `true` if a field was focused and a blur handle was available.
43
41
  */
44
42
  export function dismissKeyboardFocusedInput() {
45
- if (focusedInput?.blur) {
43
+ if (focusedInput) {
46
44
  focusedInput.blur();
47
45
  return true;
48
46
  }
49
47
  return false;
50
48
  }
51
- function isTouchInsideLayout(event, layout) {
52
- if (!layout)
53
- return false;
54
- const { pageX, pageY } = event.nativeEvent;
55
- const left = layout.absoluteX - FOCUSED_INPUT_TOUCH_SLOP;
56
- const right = layout.absoluteX + layout.width + FOCUSED_INPUT_TOUCH_SLOP;
57
- const top = layout.absoluteY - FOCUSED_INPUT_TOUCH_SLOP;
58
- const bottom = layout.absoluteY + layout.height + FOCUSED_INPUT_TOUCH_SLOP;
59
- return pageX >= left && pageX <= right && pageY >= top && pageY <= bottom;
60
- }
61
- export function isTouchInsideKeyboardFocusedInput(event, nativeLayout) {
62
- return (isTouchInsideLayout(event, getKeyboardFocusedInputLayout()) ||
63
- isTouchInsideLayout(event, nativeLayout));
64
- }