@swan-io/lake 1.0.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 (288) hide show
  1. package/HISTORY.md +3 -0
  2. package/LICENSE +21 -0
  3. package/README.md +49 -0
  4. package/package.json +60 -0
  5. package/src/components/Alert.d.ts +10 -0
  6. package/src/components/Alert.js +36 -0
  7. package/src/components/AppOpeningAnimation.d.ts +10 -0
  8. package/src/components/AppOpeningAnimation.js +50 -0
  9. package/src/components/AutoWidthImage.d.ts +8 -0
  10. package/src/components/AutoWidthImage.js +26 -0
  11. package/src/components/Avatar.d.ts +7 -0
  12. package/src/components/Avatar.js +42 -0
  13. package/src/components/BorderedButton.d.ts +16 -0
  14. package/src/components/BorderedButton.js +98 -0
  15. package/src/components/BorderedIcon.d.ts +12 -0
  16. package/src/components/BorderedIcon.js +25 -0
  17. package/src/components/BottomPanel.d.ts +9 -0
  18. package/src/components/BottomPanel.js +94 -0
  19. package/src/components/Box.d.ts +65 -0
  20. package/src/components/Box.js +31 -0
  21. package/src/components/Breadcrumbs.d.ts +18 -0
  22. package/src/components/Breadcrumbs.js +362 -0
  23. package/src/components/Button.d.ts +15 -0
  24. package/src/components/Button.js +83 -0
  25. package/src/components/Caption.d.ts +6 -0
  26. package/src/components/Caption.js +11 -0
  27. package/src/components/Checkbox.d.ts +12 -0
  28. package/src/components/Checkbox.js +83 -0
  29. package/src/components/ChoicePicker.d.ts +11 -0
  30. package/src/components/ChoicePicker.js +99 -0
  31. package/src/components/Combobox.d.ts +29 -0
  32. package/src/components/Combobox.js +182 -0
  33. package/src/components/FailureIcon.d.ts +8 -0
  34. package/src/components/FailureIcon.js +4 -0
  35. package/src/components/FileTile.d.ts +11 -0
  36. package/src/components/FileTile.js +37 -0
  37. package/src/components/Fill.d.ts +8 -0
  38. package/src/components/Fill.js +24 -0
  39. package/src/components/FilterChooser.d.ts +15 -0
  40. package/src/components/FilterChooser.js +52 -0
  41. package/src/components/Filters.d.ts +57 -0
  42. package/src/components/Filters.js +229 -0
  43. package/src/components/FixedListView.d.ts +104 -0
  44. package/src/components/FixedListView.js +821 -0
  45. package/src/components/FixedListViewCells.d.ts +55 -0
  46. package/src/components/FixedListViewCells.js +157 -0
  47. package/src/components/Flag.d.ts +8 -0
  48. package/src/components/Flag.js +36 -0
  49. package/src/components/FlowPresentation.d.ts +12 -0
  50. package/src/components/FlowPresentation.js +70 -0
  51. package/src/components/FocusTrap.d.ts +16 -0
  52. package/src/components/FocusTrap.js +90 -0
  53. package/src/components/Form.d.ts +8 -0
  54. package/src/components/Form.js +17 -0
  55. package/src/components/FullViewportLayer.d.ts +7 -0
  56. package/src/components/FullViewportLayer.js +91 -0
  57. package/src/components/Grid.d.ts +13 -0
  58. package/src/components/Grid.js +33 -0
  59. package/src/components/Heading.d.ts +61 -0
  60. package/src/components/Heading.js +27 -0
  61. package/src/components/Icon.d.ts +191 -0
  62. package/src/components/Icon.js +11 -0
  63. package/src/components/Input.d.ts +34 -0
  64. package/src/components/Input.js +115 -0
  65. package/src/components/InputError.d.ts +8 -0
  66. package/src/components/InputError.js +16 -0
  67. package/src/components/Label.d.ts +10 -0
  68. package/src/components/Label.js +19 -0
  69. package/src/components/LakeAlert.d.ts +14 -0
  70. package/src/components/LakeAlert.js +75 -0
  71. package/src/components/LakeButton.d.ts +36 -0
  72. package/src/components/LakeButton.js +171 -0
  73. package/src/components/LakeCheckbox.d.ts +16 -0
  74. package/src/components/LakeCheckbox.js +54 -0
  75. package/src/components/LakeCombobox.d.ts +28 -0
  76. package/src/components/LakeCombobox.js +166 -0
  77. package/src/components/LakeCopyButton.d.ts +10 -0
  78. package/src/components/LakeCopyButton.js +16 -0
  79. package/src/components/LakeDownloadButton.d.ts +8 -0
  80. package/src/components/LakeDownloadButton.js +6 -0
  81. package/src/components/LakeHeading.d.ts +10 -0
  82. package/src/components/LakeHeading.js +19 -0
  83. package/src/components/LakeLabel.d.ts +19 -0
  84. package/src/components/LakeLabel.js +43 -0
  85. package/src/components/LakeModal.d.ts +14 -0
  86. package/src/components/LakeModal.js +132 -0
  87. package/src/components/LakeRadio.d.ts +9 -0
  88. package/src/components/LakeRadio.js +44 -0
  89. package/src/components/LakeScrollView.d.ts +10 -0
  90. package/src/components/LakeScrollView.js +35 -0
  91. package/src/components/LakeSearchField.d.ts +10 -0
  92. package/src/components/LakeSearchField.js +111 -0
  93. package/src/components/LakeSelect.d.ts +30 -0
  94. package/src/components/LakeSelect.js +183 -0
  95. package/src/components/LakeSlider.d.ts +12 -0
  96. package/src/components/LakeSlider.js +31 -0
  97. package/src/components/LakeStepper.d.ts +21 -0
  98. package/src/components/LakeStepper.js +134 -0
  99. package/src/components/LakeText.d.ts +19 -0
  100. package/src/components/LakeText.js +20 -0
  101. package/src/components/LakeTextInput.d.ts +36 -0
  102. package/src/components/LakeTextInput.js +154 -0
  103. package/src/components/LakeTooltip.d.ts +24 -0
  104. package/src/components/LakeTooltip.js +188 -0
  105. package/src/components/Link.d.ts +138 -0
  106. package/src/components/Link.js +23 -0
  107. package/src/components/ListRightPanel.d.ts +17 -0
  108. package/src/components/ListRightPanel.js +79 -0
  109. package/src/components/LoadingView.d.ts +9 -0
  110. package/src/components/LoadingView.js +24 -0
  111. package/src/components/Modal.d.ts +12 -0
  112. package/src/components/Modal.js +80 -0
  113. package/src/components/MultiSelect.d.ts +27 -0
  114. package/src/components/MultiSelect.js +223 -0
  115. package/src/components/MultilineInput.d.ts +15 -0
  116. package/src/components/MultilineInput.js +55 -0
  117. package/src/components/Picker.d.ts +26 -0
  118. package/src/components/Picker.js +116 -0
  119. package/src/components/PlainListView.d.ts +36 -0
  120. package/src/components/PlainListView.js +208 -0
  121. package/src/components/Popover.d.ts +23 -0
  122. package/src/components/Popover.js +147 -0
  123. package/src/components/PopoverContent.d.ts +8 -0
  124. package/src/components/PopoverContent.js +9 -0
  125. package/src/components/Portal.d.ts +7 -0
  126. package/src/components/Portal.js +9 -0
  127. package/src/components/Pressable.d.ts +348 -0
  128. package/src/components/Pressable.js +91 -0
  129. package/src/components/ProgressBar.d.ts +11 -0
  130. package/src/components/ProgressBar.js +46 -0
  131. package/src/components/ProjectEnvTag.d.ts +7 -0
  132. package/src/components/ProjectEnvTag.js +12 -0
  133. package/src/components/QuickActions.d.ts +15 -0
  134. package/src/components/QuickActions.js +38 -0
  135. package/src/components/RadioGroup.d.ts +16 -0
  136. package/src/components/RadioGroup.js +34 -0
  137. package/src/components/ReadOnlyFieldList.d.ts +6 -0
  138. package/src/components/ReadOnlyFieldList.js +8 -0
  139. package/src/components/ResponsiveContainer.d.ts +13 -0
  140. package/src/components/ResponsiveContainer.js +23 -0
  141. package/src/components/RightPanel.d.ts +10 -0
  142. package/src/components/RightPanel.js +102 -0
  143. package/src/components/SegmentedControl.d.ts +19 -0
  144. package/src/components/SegmentedControl.js +74 -0
  145. package/src/components/Separator.d.ts +10 -0
  146. package/src/components/Separator.js +19 -0
  147. package/src/components/SidebarNavigationTracker.d.ts +13 -0
  148. package/src/components/SidebarNavigationTracker.js +93 -0
  149. package/src/components/Slider.d.ts +11 -0
  150. package/src/components/Slider.js +119 -0
  151. package/src/components/SmsOpeningAnimation.d.ts +8 -0
  152. package/src/components/SmsOpeningAnimation.js +52 -0
  153. package/src/components/Space.d.ts +10 -0
  154. package/src/components/Space.js +23 -0
  155. package/src/components/Stack.d.ts +12 -0
  156. package/src/components/Stack.js +23 -0
  157. package/src/components/StepDots.d.ts +7 -0
  158. package/src/components/StepDots.js +24 -0
  159. package/src/components/Stepper.d.ts +9 -0
  160. package/src/components/Stepper.js +67 -0
  161. package/src/components/SuccessIcon.d.ts +8 -0
  162. package/src/components/SuccessIcon.js +4 -0
  163. package/src/components/Svg.d.ts +145 -0
  164. package/src/components/Svg.js +24 -0
  165. package/src/components/SwanLogo.d.ts +8 -0
  166. package/src/components/SwanLogo.js +11 -0
  167. package/src/components/Switch.d.ts +9 -0
  168. package/src/components/Switch.js +74 -0
  169. package/src/components/TabView.d.ts +16 -0
  170. package/src/components/TabView.js +398 -0
  171. package/src/components/Table.d.ts +34 -0
  172. package/src/components/Table.js +79 -0
  173. package/src/components/Tag.d.ts +17 -0
  174. package/src/components/Tag.js +76 -0
  175. package/src/components/Tile.d.ts +34 -0
  176. package/src/components/Tile.js +130 -0
  177. package/src/components/TilePlaceholder.d.ts +6 -0
  178. package/src/components/TilePlaceholder.js +51 -0
  179. package/src/components/ToastStack.d.ts +2 -0
  180. package/src/components/ToastStack.js +96 -0
  181. package/src/components/Tooltip.d.ts +18 -0
  182. package/src/components/Tooltip.js +162 -0
  183. package/src/components/TransitionGroupView.d.ts +12 -0
  184. package/src/components/TransitionGroupView.js +43 -0
  185. package/src/components/TransitionView.d.ts +12 -0
  186. package/src/components/TransitionView.js +43 -0
  187. package/src/components/WithCurrentColor.d.ts +12 -0
  188. package/src/components/WithCurrentColor.js +65 -0
  189. package/src/components/WithPartnerAccentColor.d.ts +7 -0
  190. package/src/components/WithPartnerAccentColor.js +91 -0
  191. package/src/constants/colors.d.ts +42 -0
  192. package/src/constants/colors.js +42 -0
  193. package/src/constants/commonStyles.d.ts +66 -0
  194. package/src/constants/commonStyles.js +45 -0
  195. package/src/constants/design.d.ts +168 -0
  196. package/src/constants/design.js +564 -0
  197. package/src/constants/insets.d.ts +10 -0
  198. package/src/constants/insets.js +22 -0
  199. package/src/constants/typography.d.ts +26 -0
  200. package/src/constants/typography.js +54 -0
  201. package/src/hooks/useAnimatedValue.d.ts +2 -0
  202. package/src/hooks/useAnimatedValue.js +3 -0
  203. package/src/hooks/useBodyClassName.d.ts +3 -0
  204. package/src/hooks/useBodyClassName.js +14 -0
  205. package/src/hooks/useBoolean.d.ts +8 -0
  206. package/src/hooks/useBoolean.js +12 -0
  207. package/src/hooks/useComputedColors.d.ts +10 -0
  208. package/src/hooks/useComputedColors.js +42 -0
  209. package/src/hooks/useDebounce.d.ts +1 -0
  210. package/src/hooks/useDebounce.js +12 -0
  211. package/src/hooks/useDisclosure.d.ts +8 -0
  212. package/src/hooks/useDisclosure.js +12 -0
  213. package/src/hooks/useFirstMountState.d.ts +1 -0
  214. package/src/hooks/useFirstMountState.js +9 -0
  215. package/src/hooks/useForceableState.d.ts +1 -0
  216. package/src/hooks/useForceableState.js +6 -0
  217. package/src/hooks/useHover.d.ts +11 -0
  218. package/src/hooks/useHover.js +4 -0
  219. package/src/hooks/useInterval.d.ts +1 -0
  220. package/src/hooks/useInterval.js +11 -0
  221. package/src/hooks/useLazyRef.d.ts +2 -0
  222. package/src/hooks/useLazyRef.js +9 -0
  223. package/src/hooks/useMergeRefs.d.ts +2 -0
  224. package/src/hooks/useMergeRefs.js +5 -0
  225. package/src/hooks/useNativeProp.d.ts +2 -0
  226. package/src/hooks/useNativeProp.js +9 -0
  227. package/src/hooks/useOutsideClick.d.ts +8 -0
  228. package/src/hooks/useOutsideClick.js +54 -0
  229. package/src/hooks/usePersistedState.d.ts +1 -0
  230. package/src/hooks/usePersistedState.js +21 -0
  231. package/src/hooks/usePressEvents.d.ts +31 -0
  232. package/src/hooks/usePressEvents.js +4 -0
  233. package/src/hooks/usePreviousValue.d.ts +1 -0
  234. package/src/hooks/usePreviousValue.js +8 -0
  235. package/src/hooks/useResponsive.d.ts +7 -0
  236. package/src/hooks/useResponsive.js +20 -0
  237. package/src/hooks/useUpdateEffect.d.ts +2 -0
  238. package/src/hooks/useUpdateEffect.js +10 -0
  239. package/src/hooks/useUrqlMutation.d.ts +4 -0
  240. package/src/hooks/useUrqlMutation.js +30 -0
  241. package/src/hooks/useUrqlQuery.d.ts +19 -0
  242. package/src/hooks/useUrqlQuery.js +73 -0
  243. package/src/state/toasts.d.ts +21 -0
  244. package/src/state/toasts.js +61 -0
  245. package/src/utils/__tests__/array.test.d.ts +1 -0
  246. package/src/utils/__tests__/array.test.js +127 -0
  247. package/src/utils/__tests__/base64.test.d.ts +1 -0
  248. package/src/utils/__tests__/base64.test.js +27 -0
  249. package/src/utils/__tests__/function.test.d.ts +1 -0
  250. package/src/utils/__tests__/function.test.js +36 -0
  251. package/src/utils/__tests__/object.test.d.ts +1 -0
  252. package/src/utils/__tests__/object.test.js +17 -0
  253. package/src/utils/__tests__/rifm.test.d.ts +1 -0
  254. package/src/utils/__tests__/rifm.test.js +124 -0
  255. package/src/utils/__tests__/string.test.d.ts +1 -0
  256. package/src/utils/__tests__/string.test.js +16 -0
  257. package/src/utils/a11y.d.ts +1 -0
  258. package/src/utils/a11y.js +18 -0
  259. package/src/utils/array.d.ts +6 -0
  260. package/src/utils/array.js +71 -0
  261. package/src/utils/base64.d.ts +2 -0
  262. package/src/utils/base64.js +20 -0
  263. package/src/utils/file.d.ts +2 -0
  264. package/src/utils/file.js +10 -0
  265. package/src/utils/flagCountry.d.ts +1 -0
  266. package/src/utils/flagCountry.js +1 -0
  267. package/src/utils/function.d.ts +4 -0
  268. package/src/utils/function.js +19 -0
  269. package/src/utils/math.d.ts +16 -0
  270. package/src/utils/math.js +47 -0
  271. package/src/utils/nullish.d.ts +10 -0
  272. package/src/utils/nullish.js +8 -0
  273. package/src/utils/object.d.ts +2 -0
  274. package/src/utils/object.js +7 -0
  275. package/src/utils/popper.d.ts +3 -0
  276. package/src/utils/popper.js +30 -0
  277. package/src/utils/rifm.d.ts +14 -0
  278. package/src/utils/rifm.js +53 -0
  279. package/src/utils/string.d.ts +4 -0
  280. package/src/utils/string.js +233 -0
  281. package/src/utils/timer.d.ts +11 -0
  282. package/src/utils/timer.js +46 -0
  283. package/src/utils/types.d.ts +8 -0
  284. package/src/utils/types.js +1 -0
  285. package/src/utils/userAgent.d.ts +4 -0
  286. package/src/utils/userAgent.js +9 -0
  287. package/src/utils/viewport.d.ts +1 -0
  288. package/src/utils/viewport.js +12 -0
@@ -0,0 +1,138 @@
1
+ /// <reference types="react" />
2
+ import { PressableTextProps } from "@swan-io/lake/src/components/Pressable";
3
+ import { HrefAttrs, PressableStateCallbackType, Text, TextProps } from "react-native";
4
+ import { Except } from "type-fest";
5
+ export type LinkProps = Except<PressableTextProps, "hrefAttrs" | "style" | "onPress" | "children"> & {
6
+ to: string;
7
+ replace?: boolean;
8
+ disabled?: boolean;
9
+ download?: boolean;
10
+ target?: NonNullable<HrefAttrs>["target"];
11
+ style?: TextProps["style"] | ((state: PressableStateCallbackType & {
12
+ active: boolean;
13
+ }) => TextProps["style"]);
14
+ ariaCurrentValue?: "page" | "location";
15
+ onPress?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
16
+ children?: TextProps["children"] | ((state: PressableStateCallbackType & {
17
+ active: boolean;
18
+ }) => TextProps["children"]);
19
+ };
20
+ export declare const Link: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Except<{
21
+ testID?: string | undefined;
22
+ style?: false | import("react-native").TextStyle | import("react-native").RegisteredStyle<import("react-native").TextStyle> | import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").TextStyle>> | ((state: PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").TextStyle>) | null | undefined;
23
+ children?: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal | ((state: PressableStateCallbackType) => import("react").ReactNode) | null | undefined;
24
+ onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
25
+ nativeID?: string | undefined;
26
+ accessibilityRole?: import("react-native").WebAccessibilityRole | undefined;
27
+ onKeyDown?: ((event: import("react-native").NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
28
+ focusable?: boolean | undefined;
29
+ accessible?: boolean | undefined;
30
+ accessibilityActions?: readonly Readonly<{
31
+ name: string;
32
+ label?: string | undefined;
33
+ }>[] | undefined;
34
+ accessibilityLabel?: string | undefined;
35
+ accessibilityState?: import("react-native").AccessibilityState | undefined;
36
+ accessibilityHint?: string | undefined;
37
+ accessibilityValue?: import("react-native").AccessibilityValue | undefined;
38
+ onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
39
+ accessibilityLabelledBy?: string | string[] | undefined;
40
+ accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
41
+ importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
42
+ accessibilityElementsHidden?: boolean | undefined;
43
+ accessibilityLanguage?: string | undefined;
44
+ accessibilityViewIsModal?: boolean | undefined;
45
+ onAccessibilityEscape?: (() => void) | undefined;
46
+ onAccessibilityTap?: (() => void) | undefined;
47
+ onMagicTap?: (() => void) | undefined;
48
+ accessibilityIgnoresInvertColors?: boolean | undefined;
49
+ accessibilityActiveDescendant?: string | undefined;
50
+ accessibilityAtomic?: boolean | undefined;
51
+ accessibilityAutoComplete?: string | undefined;
52
+ accessibilityBusy?: boolean | undefined;
53
+ accessibilityChecked?: boolean | "mixed" | undefined;
54
+ accessibilityColumnCount?: number | undefined;
55
+ accessibilityColumnIndex?: number | undefined;
56
+ accessibilityColumnSpan?: number | undefined;
57
+ accessibilityControls?: string | undefined;
58
+ accessibilityCurrent?: boolean | "page" | "step" | "location" | "date" | "time" | undefined;
59
+ accessibilityDescribedBy?: string | undefined;
60
+ accessibilityDetails?: string | undefined;
61
+ accessibilityDisabled?: boolean | undefined;
62
+ accessibilityErrorMessage?: string | undefined;
63
+ accessibilityExpanded?: boolean | undefined;
64
+ accessibilityFlowTo?: string | undefined;
65
+ accessibilityHasPopup?: string | undefined;
66
+ accessibilityHidden?: boolean | undefined;
67
+ accessibilityInvalid?: boolean | undefined;
68
+ accessibilityKeyShortcuts?: string[] | undefined;
69
+ accessibilityLevel?: number | undefined;
70
+ accessibilityModal?: boolean | undefined;
71
+ accessibilityMultiSelectable?: boolean | undefined;
72
+ accessibilityMultiline?: boolean | undefined;
73
+ accessibilityOrientation?: "horizontal" | "vertical" | undefined;
74
+ accessibilityOwns?: string | undefined;
75
+ accessibilityPlaceholder?: string | undefined;
76
+ accessibilityPosInSet?: number | undefined;
77
+ accessibilityPressed?: boolean | undefined;
78
+ accessibilityReadOnly?: boolean | undefined;
79
+ accessibilityRequired?: boolean | undefined;
80
+ accessibilityRoleDescription?: string | undefined;
81
+ accessibilityRowCount?: number | undefined;
82
+ accessibilityRowIndex?: number | undefined;
83
+ accessibilityRowSpan?: number | undefined;
84
+ accessibilitySelected?: boolean | undefined;
85
+ accessibilitySetSize?: number | undefined;
86
+ accessibilitySort?: "none" | "ascending" | "descending" | "other" | undefined;
87
+ accessibilityValueMax?: number | undefined;
88
+ accessibilityValueMin?: number | undefined;
89
+ accessibilityValueNow?: number | undefined;
90
+ accessibilityValueText?: string | undefined;
91
+ allowFontScaling?: boolean | undefined;
92
+ ellipsizeMode?: "clip" | "head" | "middle" | "tail" | undefined;
93
+ lineBreakMode?: "clip" | "head" | "middle" | "tail" | undefined;
94
+ numberOfLines?: number | undefined;
95
+ onTextLayout?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined;
96
+ onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
97
+ onPressIn?: ((event: unknown) => void) | undefined;
98
+ onPressOut?: ((event: unknown) => void) | undefined;
99
+ onLongPress?: ((event: unknown) => void) | undefined;
100
+ maxFontSizeMultiplier?: number | null | undefined;
101
+ href?: string | undefined;
102
+ hrefAttrs?: HrefAttrs | undefined;
103
+ lang?: string | undefined;
104
+ adjustsFontSizeToFit?: boolean | undefined;
105
+ minimumFontScale?: number | undefined;
106
+ suppressHighlighting?: boolean | undefined;
107
+ disabled?: boolean | undefined;
108
+ selectable?: boolean | undefined;
109
+ selectionColor?: import("react-native").ColorValue | undefined;
110
+ textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
111
+ dataDetectorType?: "none" | "all" | "link" | "phoneNumber" | "email" | null | undefined;
112
+ android_hyphenationFrequency?: "none" | "normal" | "full" | undefined;
113
+ onBlur?: ((event: import("react-native").NativeSyntheticEvent<import("react").FocusEvent<Element, Element>>) => void) | undefined;
114
+ onFocus?: ((event: import("react-native").NativeSyntheticEvent<import("react").FocusEvent<Element, Element>>) => void) | undefined;
115
+ onPressMove?: ((event: unknown) => void) | undefined;
116
+ delayLongPress?: number | undefined;
117
+ delayPressIn?: number | undefined;
118
+ delayPressOut?: number | undefined;
119
+ onContextMenu?: ((event: import("react-native").NativeSyntheticEvent<import("react").SyntheticEvent<Element, Event>>) => void) | undefined;
120
+ onHoverIn?: ((event: unknown) => void) | undefined;
121
+ onHoverOut?: ((event: unknown) => void) | undefined;
122
+ testOnly_hovered?: boolean | undefined;
123
+ testOnly_pressed?: boolean | undefined;
124
+ }, "style" | "children" | "onPress" | "hrefAttrs"> & {
125
+ to: string;
126
+ replace?: boolean | undefined;
127
+ disabled?: boolean | undefined;
128
+ download?: boolean | undefined;
129
+ target?: NonNullable<HrefAttrs>["target"];
130
+ style?: import("react-native").StyleProp<import("react-native").TextStyle> | ((state: PressableStateCallbackType & {
131
+ active: boolean;
132
+ }) => TextProps["style"]);
133
+ ariaCurrentValue?: "page" | "location" | undefined;
134
+ onPress?: ((e: React.MouseEvent<HTMLAnchorElement>) => void) | undefined;
135
+ children?: import("react").ReactNode | ((state: PressableStateCallbackType & {
136
+ active: boolean;
137
+ }) => TextProps["children"]);
138
+ } & import("react").RefAttributes<Text>>>;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useLinkProps } from "@swan-io/chicane";
3
+ import { PressableText } from "@swan-io/lake/src/components/Pressable";
4
+ import { isNotNullish } from "@swan-io/lake/src/utils/nullish";
5
+ import { forwardRef, memo } from "react";
6
+ export const Link = memo(forwardRef(({ accessibilityRole = "link", children, disabled = false, onPress, replace = false, download = false, style, target, to, ariaCurrentValue = "page", focusable, ...props }, forwardedRef) => {
7
+ const { active, onClick } = useLinkProps({ href: to, replace, target });
8
+ return (_jsx(PressableText, { ...props, accessibilityRole: accessibilityRole, accessibilityDisabled: disabled, focusable: isNotNullish(focusable) ? focusable : !disabled, accessibilityCurrent: active ? ariaCurrentValue : undefined, href: to, onPress: (event) => {
9
+ const e = event;
10
+ if (disabled) {
11
+ e.preventDefault();
12
+ }
13
+ else {
14
+ onPress?.(e);
15
+ onClick(e);
16
+ }
17
+ }, ref: forwardedRef, style: typeof style === "function" ? state => style({ ...state, active }) : style, hrefAttrs: {
18
+ rel: target && target !== "self" ? "noopener noreferrer" : undefined,
19
+ download,
20
+ target,
21
+ }, children: typeof children === "function" ? state => children({ ...state, active }) : children }));
22
+ }));
23
+ Link.displayName = "Link";
@@ -0,0 +1,17 @@
1
+ import { MutableRefObject } from "react";
2
+ import { FocusTrapRef } from "./FocusTrap";
3
+ type Props<T> = {
4
+ items: T[];
5
+ keyExtractor: (item: T) => string;
6
+ activeId: string | null;
7
+ onActiveIdChange: (id: string) => void;
8
+ onClose: () => void;
9
+ render: (item: T, large: boolean) => React.ReactNode;
10
+ closeLabel: string;
11
+ previousLabel: string;
12
+ nextLabel: string;
13
+ };
14
+ export declare const ListRightPanel: <T>(props: Props<T> & {
15
+ ref?: MutableRefObject<FocusTrapRef | null>;
16
+ }) => React.ReactElement;
17
+ export {};
@@ -0,0 +1,79 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Array, Option } from "@swan-io/boxed";
4
+ import { forwardRef } from "react";
5
+ import { StyleSheet, View } from "react-native";
6
+ import { match } from "ts-pattern";
7
+ import { animations, spacings } from "../constants/design";
8
+ import { usePreviousValue } from "../hooks/usePreviousValue";
9
+ import { noop } from "../utils/function";
10
+ import { Box } from "./Box";
11
+ import { LakeButton } from "./LakeButton";
12
+ import { RightPanel } from "./RightPanel";
13
+ import { Space } from "./Space";
14
+ import { TransitionView } from "./TransitionView";
15
+ const styles = StyleSheet.create({
16
+ details: {
17
+ padding: spacings[24],
18
+ paddingTop: spacings[12],
19
+ flexGrow: 1,
20
+ },
21
+ detailsLarge: {
22
+ paddingVertical: spacings[24],
23
+ paddingTop: spacings[12],
24
+ paddingHorizontal: spacings[40],
25
+ flexGrow: 1,
26
+ },
27
+ detailsContents: {
28
+ ...StyleSheet.absoluteFillObject,
29
+ },
30
+ detailsContainer: {
31
+ flexGrow: 1,
32
+ },
33
+ });
34
+ const ListRightPanel_ = forwardRef(({ items, keyExtractor, activeId, onActiveIdChange, onClose, render, closeLabel, previousLabel, nextLabel, }, ref) => {
35
+ const activeItem = items.find(item => keyExtractor(item) === activeId);
36
+ // use `Array.getIndexBy` instead of `Array.findIndex` to avoid -1 value
37
+ const activeItemIndex = Array.getIndexBy(items, item => keyExtractor(item) === activeId).toUndefined();
38
+ const previousId = usePreviousValue(activeId);
39
+ const previousItem = usePreviousValue(activeItem);
40
+ const previousIndex = usePreviousValue(activeItemIndex);
41
+ const newDetailDirection = typeof activeItemIndex === "number" && typeof previousIndex === "number"
42
+ ? match({ activeItemIndex, previousIndex })
43
+ .when(({ activeItemIndex, previousIndex }) => activeItemIndex < previousIndex, () => animations.fadeAndSlideInFromTop)
44
+ .when(({ activeItemIndex, previousIndex }) => activeItemIndex > previousIndex, () => animations.fadeAndSlideInFromBottom)
45
+ .otherwise(() => null)
46
+ : null;
47
+ const previousDetailDirection = typeof activeItemIndex === "number" && typeof previousIndex === "number"
48
+ ? match({ activeItemIndex, previousIndex })
49
+ .when(({ activeItemIndex, previousIndex }) => activeItemIndex < previousIndex, () => animations.fadeAndSlideInFromBottom)
50
+ .when(({ activeItemIndex, previousIndex }) => activeItemIndex > previousIndex, () => animations.fadeAndSlideInFromTop)
51
+ .otherwise(() => null)
52
+ : null;
53
+ return (_jsx(RightPanel, { ref: ref, visible: activeItem != null, onPressClose: onClose, children: ({ large }) => (_jsxs(View, { style: large ? styles.detailsLarge : styles.details, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsx(LakeButton, { mode: "tertiary", icon: "lake-close", accessibilityLabel: closeLabel, onPress: onClose }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsx(LakeButton, { mode: "tertiary", accessibilityLabel: previousLabel, icon: "arrow-left-regular", disabled: activeItemIndex === 0, onPress: () => {
54
+ if (typeof activeItemIndex === "number") {
55
+ Option.fromNullable(items[activeItemIndex - 1]).match({
56
+ Some: item => onActiveIdChange(keyExtractor(item)),
57
+ None: noop,
58
+ });
59
+ }
60
+ } }), _jsx(LakeButton, { mode: "tertiary", accessibilityLabel: nextLabel, icon: "arrow-right-regular", disabled: activeItemIndex === items.length - 1, onPress: () => {
61
+ if (typeof activeItemIndex === "number") {
62
+ Option.fromNullable(items[activeItemIndex + 1]).match({
63
+ Some: item => onActiveIdChange(keyExtractor(item)),
64
+ None: noop,
65
+ });
66
+ }
67
+ } })] })] }), _jsx(Space, { height: 12 }), _jsx(View, { style: styles.detailsContainer, children: activeItem != null
68
+ ? [
69
+ _createElement(TransitionView, { ...newDetailDirection, key: activeId, style: styles.detailsContents }, render(activeItem, large)),
70
+ ...(previousItem != null && previousId !== activeId
71
+ ? [
72
+ _createElement(TransitionView, { ...previousDetailDirection, key: previousId, style: styles.detailsContents }, null),
73
+ ]
74
+ : []),
75
+ ]
76
+ : null })] })) }));
77
+ });
78
+ // @ts-expect-error this is the only way I found to use generic props with forwardRef
79
+ export const ListRightPanel = ListRightPanel_;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, View, ViewStyle } from "react-native";
3
+ type Props = {
4
+ color?: string;
5
+ delay?: number;
6
+ style?: StyleProp<ViewStyle>;
7
+ };
8
+ export declare const LoadingView: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<View>>;
9
+ export {};
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { ActivityIndicator, StyleSheet, View } from "react-native";
4
+ import { colors } from "../constants/colors";
5
+ const styles = StyleSheet.create({
6
+ base: {
7
+ alignItems: "center",
8
+ flexGrow: 1,
9
+ flexShrink: 1,
10
+ justifyContent: "center",
11
+ },
12
+ indicator: {
13
+ opacity: 0,
14
+ animationKeyframes: {
15
+ from: { opacity: 0 },
16
+ to: { opacity: 1 },
17
+ },
18
+ animationDuration: "250ms",
19
+ animationFillMode: "forwards",
20
+ animationTimingFunction: "ease",
21
+ },
22
+ });
23
+ const isDev = process.env.NODE_ENV === "development";
24
+ export const LoadingView = forwardRef(({ color = colors.gray[100], delay = isDev ? 0 : 1000, style }, forwardedRef) => (_jsx(View, { ref: forwardedRef, style: [styles.base, style], children: _jsx(ActivityIndicator, { size: "small", color: color, style: [styles.indicator, delay > 0 && { animationDelay: delay.toString() + "ms" }] }) })));
@@ -0,0 +1,12 @@
1
+ import { ReactNode, ReactText } from "react";
2
+ import { Modal as BaseModal, StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ children?: ReactNode;
5
+ onDismiss?: () => void;
6
+ title?: ReactText;
7
+ style?: StyleProp<ViewStyle>;
8
+ visible?: boolean;
9
+ wrapContent?: boolean;
10
+ };
11
+ export declare const Modal: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<BaseModal>>>;
12
+ export {};
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, memo } from "react";
3
+ import { Modal as BaseModal, Pressable, ScrollView, StyleSheet, TouchableOpacity, View, } from "react-native";
4
+ import { backgroundColor, colors, radii } from "../constants/design";
5
+ import { useResponsive } from "../hooks/useResponsive";
6
+ import { Box } from "./Box";
7
+ import { Fill } from "./Fill";
8
+ import { Heading } from "./Heading";
9
+ import { Icon } from "./Icon";
10
+ import { Separator } from "./Separator";
11
+ const styles = StyleSheet.create({
12
+ // eslint-disable-next-line react-native/no-color-literals
13
+ blanket: {
14
+ ...StyleSheet.absoluteFillObject,
15
+ backgroundColor: "rgba(0,0,0,0.5)",
16
+ cursor: "default",
17
+ flexGrow: 1,
18
+ flexShrink: 1,
19
+ },
20
+ outbox: {
21
+ margin: 16,
22
+ flexGrow: 1,
23
+ flexShrink: 1,
24
+ },
25
+ desktopOutbox: {
26
+ margin: 32,
27
+ },
28
+ modal: {
29
+ backgroundColor: backgroundColor.accented,
30
+ borderRadius: radii[8],
31
+ flexGrow: 1,
32
+ flexShrink: 1,
33
+ overflow: "hidden",
34
+ },
35
+ wrapped: {
36
+ flexGrow: 0,
37
+ margin: "auto",
38
+ },
39
+ desktopModal: {
40
+ flexGrow: 0,
41
+ margin: "auto",
42
+ width: 800,
43
+ maxWidth: "100%",
44
+ },
45
+ content: {
46
+ minHeight: "100%",
47
+ padding: 20,
48
+ },
49
+ contentDesktop: {
50
+ padding: 40,
51
+ },
52
+ title: {
53
+ flexGrow: 1,
54
+ flexShrink: 1,
55
+ paddingLeft: 20,
56
+ paddingVertical: 20,
57
+ },
58
+ titleHeader: {
59
+ paddingLeft: 40,
60
+ paddingVertical: 32,
61
+ },
62
+ dismissIcon: {
63
+ padding: 20,
64
+ right: 0,
65
+ },
66
+ dismissIconDesktop: {
67
+ marginVertical: 12,
68
+ marginRight: 20,
69
+ },
70
+ });
71
+ export const Modal = memo(forwardRef(({ children, onDismiss, title = "", style, visible = false, wrapContent = false }, forwardedRef) => {
72
+ const { desktop, media } = useResponsive();
73
+ return (_jsxs(BaseModal, { ref: forwardedRef, animationType: "fade", visible: visible, transparent: true, onDismiss: onDismiss, onRequestClose: onDismiss, children: [_jsx(Pressable, { accessibilityRole: "none", focusable: false, onPress: onDismiss, style: styles.blanket }), _jsx(View, { pointerEvents: "box-none", style: [styles.outbox, desktop && styles.desktopOutbox], children: _jsxs(View, { style: [
74
+ styles.modal,
75
+ desktop && styles.desktopModal,
76
+ wrapContent && styles.wrapped,
77
+ style,
78
+ ], children: [_jsxs(Box, { direction: "row", accessibilityRole: "banner", alignItems: "center", children: [title !== "" ? (_jsx(Heading, { size: media({ mobile: 20, desktop: 24 }), level: 2, style: [styles.title, desktop && styles.titleHeader], children: title })) : (_jsx(Fill, {})), onDismiss && (_jsx(TouchableOpacity, { accessibilityRole: "button", activeOpacity: 0.5, style: [styles.dismissIcon, desktop && styles.dismissIconDesktop], onPress: onDismiss, children: _jsx(Icon, { name: "dismiss-filled", size: 18, color: colors.gray[500] }) }))] }), title !== "" && _jsx(Separator, {}), _jsx(ScrollView, { contentContainerStyle: desktop ? styles.contentDesktop : styles.content, children: children })] }) })] }));
79
+ }));
80
+ Modal.displayName = "Modal";
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import { ColorVariants } from "../constants/design";
4
+ export type MultiSelectItem = {
5
+ disabled?: boolean;
6
+ group: string;
7
+ label: string;
8
+ value: string;
9
+ };
10
+ export type MultiSelectProps<I> = {
11
+ color?: ColorVariants;
12
+ disabled?: boolean;
13
+ error?: string;
14
+ emptyResultText?: string;
15
+ enableGroups?: boolean;
16
+ filterPlaceholder?: string;
17
+ items: I[];
18
+ onValueChange: (values: string[]) => void;
19
+ placeholder?: string;
20
+ renderTagGroup?: (items: readonly MultiSelectItem[]) => string;
21
+ style?: StyleProp<ViewStyle>;
22
+ values: string[];
23
+ nativeID?: string;
24
+ };
25
+ export declare const MultiSelect: (<I extends MultiSelectItem>(props: MultiSelectProps<I>) => JSX.Element | null) & {
26
+ displayName?: string | undefined;
27
+ };
@@ -0,0 +1,223 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Array, Dict, Option } from "@swan-io/boxed";
3
+ import { memo as reactMemo, useEffect, useMemo, useRef, useState } from "react";
4
+ import { FlatList, Pressable, SectionList, StyleSheet, Text, View, } from "react-native";
5
+ import { backgroundColor, colors, radii, shadows, texts } from "../constants/design";
6
+ import { useDisclosure } from "../hooks/useDisclosure";
7
+ import { groupBy } from "../utils/array";
8
+ import { isNotNullish, isNotNullishOrEmpty } from "../utils/nullish";
9
+ import { safeSplitAround } from "../utils/string";
10
+ import { Box } from "./Box";
11
+ import { Icon } from "./Icon";
12
+ import { InputError } from "./InputError";
13
+ import { Popover } from "./Popover";
14
+ import { PressableText, PressableTextInput } from "./Pressable";
15
+ import { Space } from "./Space";
16
+ import { Tag } from "./Tag";
17
+ const MAX_INPUT_HEIGHT = 120;
18
+ const ITEM_ELEMENT_HEIGHT = 32;
19
+ const NB_SUGGESTION_DISPLAYED = 10.5;
20
+ const styles = StyleSheet.create({
21
+ base: {
22
+ ...texts.regular,
23
+ backgroundColor: backgroundColor.accented,
24
+ borderColor: colors.gray[100],
25
+ borderRadius: radii[6],
26
+ borderWidth: 1,
27
+ cursor: "default",
28
+ overflow: "hidden",
29
+ transitionDuration: "150ms",
30
+ transitionProperty: ["border-color", "box-shadow"],
31
+ },
32
+ errored: {
33
+ borderColor: colors.negative[500],
34
+ },
35
+ tag: {
36
+ marginRight: 4,
37
+ marginVertical: 2,
38
+ },
39
+ hovered: {
40
+ boxShadow: shadows.tile,
41
+ },
42
+ focused: {
43
+ borderColor: colors.gray[500],
44
+ boxShadow: shadows.tile,
45
+ outlineStyle: "none",
46
+ },
47
+ disabled: {
48
+ backgroundColor: colors.gray[50],
49
+ borderColor: colors.gray[100],
50
+ cursor: "not-allowed",
51
+ },
52
+ actions: {
53
+ marginVertical: "auto",
54
+ position: "absolute",
55
+ bottom: 0,
56
+ top: 0,
57
+ right: 20,
58
+ },
59
+ placeholder: {
60
+ ...texts.regular,
61
+ color: colors.gray[300],
62
+ },
63
+ list: {
64
+ marginVertical: 4,
65
+ maxHeight: ITEM_ELEMENT_HEIGHT * NB_SUGGESTION_DISPLAYED,
66
+ minHeight: 224,
67
+ },
68
+ filterContainer: {
69
+ flexGrow: 1,
70
+ flexShrink: 1,
71
+ margin: 16,
72
+ },
73
+ filterInput: {
74
+ ...texts.regular,
75
+ backgroundColor: backgroundColor.accented,
76
+ borderColor: colors.gray[100],
77
+ borderRadius: 4,
78
+ borderWidth: 1,
79
+ flexGrow: 1,
80
+ flexShrink: 1,
81
+ height: 40,
82
+ outlineStyle: "none",
83
+ paddingHorizontal: 12,
84
+ paddingLeft: 40,
85
+ placeholderTextColor: colors.gray[300],
86
+ },
87
+ filterfocused: {
88
+ borderColor: colors.gray[200],
89
+ },
90
+ searchIcon: {
91
+ position: "absolute",
92
+ left: 14,
93
+ },
94
+ tagsList: {
95
+ flexWrap: "wrap",
96
+ maxHeight: MAX_INPUT_HEIGHT,
97
+ minHeight: 40,
98
+ overflowY: "auto",
99
+ paddingHorizontal: 16,
100
+ paddingRight: 60,
101
+ paddingVertical: 8,
102
+ },
103
+ groupTitleBase: {
104
+ alignItems: "center",
105
+ flexDirection: "row",
106
+ flexGrow: 1,
107
+ flexShrink: 1,
108
+ justifyContent: "space-between",
109
+ paddingHorizontal: 16,
110
+ paddingVertical: 12,
111
+ transitionDuration: "200ms",
112
+ transitionProperty: "background-color",
113
+ },
114
+ groupTitle: {
115
+ ...texts.semibold,
116
+ },
117
+ line: {
118
+ ...texts.regular,
119
+ paddingHorizontal: 16,
120
+ paddingVertical: 8,
121
+ transitionDuration: "200ms",
122
+ transitionProperty: "background-color",
123
+ },
124
+ lineInGroup: {
125
+ paddingLeft: 24,
126
+ },
127
+ emptyList: {
128
+ height: 136,
129
+ },
130
+ emptyListText: {
131
+ color: colors.gray.primary,
132
+ },
133
+ });
134
+ const memo = reactMemo;
135
+ export const MultiSelect = memo(({ color = "gray", disabled = false, emptyResultText, enableGroups = true, filterPlaceholder, items, onValueChange, placeholder, renderTagGroup, error, style, values, nativeID, }) => {
136
+ const [filter, setFilter] = useState("");
137
+ const shouldScrollToBottomRef = useRef(false);
138
+ const selectedTagListRef = useRef(null);
139
+ const inputRef = useRef(null);
140
+ const listRef = useRef(null);
141
+ const [visible, { open, close }] = useDisclosure(false);
142
+ const tint50 = colors[color][50];
143
+ const tint100 = colors[color][100];
144
+ useEffect(() => {
145
+ if (!visible) {
146
+ setFilter("");
147
+ }
148
+ }, [visible]);
149
+ useEffect(() => {
150
+ if (shouldScrollToBottomRef.current) {
151
+ const top = selectedTagListRef.current?.scrollHeight;
152
+ selectedTagListRef.current?.scrollTo({ top });
153
+ }
154
+ shouldScrollToBottomRef.current = false;
155
+ }, [values]);
156
+ const handleSelectItem = (item) => {
157
+ shouldScrollToBottomRef.current = true;
158
+ onValueChange([...values, item.value]);
159
+ };
160
+ const handleRemoveItem = (item) => {
161
+ onValueChange(values.filter(index => index !== item.value));
162
+ };
163
+ const handleClearAll = () => {
164
+ onValueChange([]);
165
+ };
166
+ const handleSelectGroup = (groupItems) => {
167
+ shouldScrollToBottomRef.current = true;
168
+ const items = groupItems.map(item => item.value);
169
+ const newValue = [...new Set([...values, ...items])];
170
+ onValueChange(newValue);
171
+ };
172
+ // Used to get full selected value informations in O(1).
173
+ const valueItemMapping = useMemo(() => items.reduce((acc, item) => {
174
+ acc[item.value] = item;
175
+ return acc;
176
+ }, {}), [items]);
177
+ const selectedTags = useMemo(() => values.map(value => valueItemMapping[value]).filter(isNotNullish), [values, valueItemMapping]);
178
+ const filteredItems = useMemo(() => {
179
+ const remainingTags = items.filter(item => !values.includes(item.value));
180
+ const cleanedFilter = filter.trim().toLowerCase();
181
+ return cleanedFilter === ""
182
+ ? remainingTags
183
+ : remainingTags.filter(({ label }) => label.toLowerCase().includes(cleanedFilter));
184
+ }, [filter, items, values]);
185
+ const sections = useMemo(() => {
186
+ return Array.keepMap(Dict.entries(groupBy(filteredItems, ({ group }) => group)), ([groupName, data]) => data === undefined ? Option.None() : Option.Some({ title: groupName, data }));
187
+ }, [filteredItems]);
188
+ const ListHeaderComponent = useMemo(() => (_jsxs(Box, { direction: "row", alignItems: "center", style: styles.filterContainer, children: [_jsx(PressableTextInput, { autoComplete: "off", keyboardType: "web-search", multiline: false, numberOfLines: 1, onChangeText: filterValue => setFilter(filterValue), placeholder: filterPlaceholder, value: filter, style: ({ focused }) => [styles.filterInput, focused && styles.filterfocused] }), _jsx(Icon, { name: "search-filled", color: colors[color].primary, size: 20, style: styles.searchIcon })] })), [filter, filterPlaceholder, color]);
189
+ const ListEmptyComponent = useMemo(() => (_jsxs(Box, { justifyContent: "center", alignItems: "center", style: styles.emptyList, children: [_jsx(Icon, { name: "clipboard-search-regular", size: 24, color: colors.gray.primary }), isNotNullishOrEmpty(emptyResultText) && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 8 }), _jsx(Text, { style: styles.emptyListText, children: emptyResultText })] }))] })), [emptyResultText]);
190
+ return (_jsxs(View, { style: style, children: [_jsxs(Pressable, { nativeID: nativeID, ref: inputRef, accessibilityHasPopup: "listbox", accessibilityRole: "button", accessibilityExpanded: visible, disabled: disabled, onPress: open, style: ({ hovered, focused }) => [
191
+ styles.base,
192
+ hovered && styles.hovered,
193
+ (focused || visible) && styles.focused,
194
+ disabled && styles.disabled,
195
+ isNotNullish(error) && styles.errored,
196
+ ], children: [_jsx(Box, { ref: selectedTagListRef, alignItems: "center", direction: "row", style: styles.tagsList, children: selectedTags.length > 0 ? (selectedTags.map(item => (_jsx(Tag, { color: color, onPressRemove: disabled ? undefined : () => handleRemoveItem(item), style: styles.tag, children: item.label }, item.value)))) : placeholder !== "" ? (_jsx(Text, { accessibilityRole: "label", numberOfLines: 1, selectable: false, style: styles.placeholder, children: placeholder })) : null }), _jsxs(Box, { direction: "row", alignItems: "center", style: styles.actions, children: [selectedTags.length >= 1 && !disabled && (_jsxs(_Fragment, { children: [_jsx(Pressable, { accessibilityRole: "button", onPress: handleClearAll, children: _jsx(Icon, { name: "dismiss-filled", color: colors.gray.primary, size: 15 }) }), _jsx(Space, { width: 8 })] })), _jsx(Icon, { color: colors.gray.primary, name: visible ? "chevron-up-filled" : "chevron-down-filled", size: 20 })] })] }), _jsx(Popover, { role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: inputRef, returnFocus: true, visible: visible, children: _jsx(View, { style: styles.list, children: enableGroups ? (_jsx(SectionList, { accessibilityRole: "listbox", accessibilityMultiSelectable: true, keyExtractor: (item, index) => `group-field-${item.value}-${index}`, extraData: filter, ListHeaderComponent: ListHeaderComponent, ListEmptyComponent: ListEmptyComponent, ListFooterComponent: _jsx(Space, { height: 16 }), sections: sections, renderSectionHeader: ({ section: { title, data }, }) => (_jsxs(Pressable, { accessibilityRole: "listitem", onPress: () => handleSelectGroup(data), style: ({ hovered, pressed, focused }) => [
197
+ styles.groupTitleBase,
198
+ (hovered || focused) && { backgroundColor: tint50 },
199
+ pressed && { backgroundColor: tint100 },
200
+ ], children: [_jsx(Text, { numberOfLines: 1, selectable: false, style: styles.groupTitle, children: title }), isNotNullish(renderTagGroup) && (_jsx(Tag, { color: color, children: renderTagGroup(data) }))] })), renderItem: ({ item }) => (_jsx(LineItem, { color: color, filter: filter, item: item, handleSelectItem: handleSelectItem, style: styles.lineInGroup })) })) : (_jsx(FlatList, { ref: listRef, accessibilityRole: "list", data: filteredItems, extraData: filter, keyExtractor: item => `field-${item.value}`, ListHeaderComponent: ListHeaderComponent, ListEmptyComponent: ListEmptyComponent, ListFooterComponent: _jsx(Space, { height: 8 }), renderItem: ({ item }) => (_jsx(LineItem, { color: color, filter: filter, item: item, handleSelectItem: handleSelectItem })) })) }) }), _jsx(InputError, { message: error })] }));
201
+ });
202
+ const LineItem = ({ item, color, filter, handleSelectItem, style }) => {
203
+ const { label, disabled = false } = item;
204
+ const cleanFilter = filter.trim().toLowerCase();
205
+ const tint50 = colors[color][50];
206
+ const tint100 = colors[color][100];
207
+ const tokens = useMemo(() => (disabled || cleanFilter === "" ? label : safeSplitAround(label, cleanFilter)), [label, disabled, cleanFilter]);
208
+ return (_jsx(PressableText, { accessibilityRole: "listitem", disabled: disabled, numberOfLines: 1, selectable: false, onPress: () => handleSelectItem(item), style: ({ hovered, pressed }) => [
209
+ styles.line,
210
+ style,
211
+ hovered && { backgroundColor: tint50 },
212
+ pressed && { backgroundColor: tint100 },
213
+ disabled && { backgroundColor: colors.gray[50], color: colors.gray[100] },
214
+ ], children: typeof tokens === "string"
215
+ ? tokens
216
+ : tokens.map((token, index) => {
217
+ const colored = token.toLowerCase() === cleanFilter;
218
+ if (!colored) {
219
+ return token;
220
+ }
221
+ return (_jsx(Text, { style: { color }, children: token }, index));
222
+ }) }));
223
+ };
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { NativeSyntheticEvent, TextInput, TextInputProps } from "react-native";
3
+ type Props = {
4
+ disabled?: boolean;
5
+ error?: string;
6
+ label: string;
7
+ onBlur?: (event: NativeSyntheticEvent<React.FocusEvent>) => void;
8
+ onSubmitEditing?: TextInputProps["onSubmitEditing"];
9
+ onValueChange?: TextInputProps["onChangeText"];
10
+ placeholder?: string;
11
+ value?: string;
12
+ readOnly?: boolean;
13
+ };
14
+ export declare const MultilineInput: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<TextInput>>>;
15
+ export {};