@fluxus-ui/native 0.0.0-stage → 0.1.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 (180) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -2
  3. package/lib/module/Avatar.js +58 -0
  4. package/lib/module/Avatar.js.map +1 -0
  5. package/lib/module/Badge.js +72 -0
  6. package/lib/module/Badge.js.map +1 -0
  7. package/lib/module/BottomSheet.js +159 -0
  8. package/lib/module/BottomSheet.js.map +1 -0
  9. package/lib/module/Button.js +133 -0
  10. package/lib/module/Button.js.map +1 -0
  11. package/lib/module/Card.js +71 -0
  12. package/lib/module/Card.js.map +1 -0
  13. package/lib/module/Dialog.js +137 -0
  14. package/lib/module/Dialog.js.map +1 -0
  15. package/lib/module/Disclosure.js +153 -0
  16. package/lib/module/Disclosure.js.map +1 -0
  17. package/lib/module/EmptyState.js +43 -0
  18. package/lib/module/EmptyState.js.map +1 -0
  19. package/lib/module/ListItem.js +83 -0
  20. package/lib/module/ListItem.js.map +1 -0
  21. package/lib/module/Menu.js +76 -0
  22. package/lib/module/Menu.js.map +1 -0
  23. package/lib/module/Message.js +51 -0
  24. package/lib/module/Message.js.map +1 -0
  25. package/lib/module/Popover.js +153 -0
  26. package/lib/module/Popover.js.map +1 -0
  27. package/lib/module/Progress.js +54 -0
  28. package/lib/module/Progress.js.map +1 -0
  29. package/lib/module/Select.js +146 -0
  30. package/lib/module/Select.js.map +1 -0
  31. package/lib/module/Skeleton.js +39 -0
  32. package/lib/module/Skeleton.js.map +1 -0
  33. package/lib/module/Slider.js +137 -0
  34. package/lib/module/Slider.js.map +1 -0
  35. package/lib/module/Spinner.js +30 -0
  36. package/lib/module/Spinner.js.map +1 -0
  37. package/lib/module/Swap.js +87 -0
  38. package/lib/module/Swap.js.map +1 -0
  39. package/lib/module/Tabs.js +118 -0
  40. package/lib/module/Tabs.js.map +1 -0
  41. package/lib/module/Text.js +47 -0
  42. package/lib/module/Text.js.map +1 -0
  43. package/lib/module/TextField.js +190 -0
  44. package/lib/module/TextField.js.map +1 -0
  45. package/lib/module/Toast.js +108 -0
  46. package/lib/module/Toast.js.map +1 -0
  47. package/lib/module/blur.js +55 -0
  48. package/lib/module/blur.js.map +1 -0
  49. package/lib/module/controls.js +259 -0
  50. package/lib/module/controls.js.map +1 -0
  51. package/lib/module/generated/tokens.js +484 -0
  52. package/lib/module/generated/tokens.js.map +1 -0
  53. package/lib/module/icon.js +51 -0
  54. package/lib/module/icon.js.map +1 -0
  55. package/lib/module/index.js +33 -0
  56. package/lib/module/index.js.map +1 -0
  57. package/lib/module/layout.js +75 -0
  58. package/lib/module/layout.js.map +1 -0
  59. package/lib/module/motion.js +28 -0
  60. package/lib/module/motion.js.map +1 -0
  61. package/lib/module/overlay.js +99 -0
  62. package/lib/module/overlay.js.map +1 -0
  63. package/lib/module/package.json +1 -0
  64. package/lib/module/pending.js +177 -0
  65. package/lib/module/pending.js.map +1 -0
  66. package/lib/module/presence.js +68 -0
  67. package/lib/module/presence.js.map +1 -0
  68. package/lib/module/press.js +32 -0
  69. package/lib/module/press.js.map +1 -0
  70. package/lib/module/screen.js +45 -0
  71. package/lib/module/screen.js.map +1 -0
  72. package/lib/module/theme.js +41 -0
  73. package/lib/module/theme.js.map +1 -0
  74. package/lib/typescript/Avatar.d.ts +17 -0
  75. package/lib/typescript/Avatar.d.ts.map +1 -0
  76. package/lib/typescript/Badge.d.ts +21 -0
  77. package/lib/typescript/Badge.d.ts.map +1 -0
  78. package/lib/typescript/BottomSheet.d.ts +27 -0
  79. package/lib/typescript/BottomSheet.d.ts.map +1 -0
  80. package/lib/typescript/Button.d.ts +27 -0
  81. package/lib/typescript/Button.d.ts.map +1 -0
  82. package/lib/typescript/Card.d.ts +17 -0
  83. package/lib/typescript/Card.d.ts.map +1 -0
  84. package/lib/typescript/Dialog.d.ts +34 -0
  85. package/lib/typescript/Dialog.d.ts.map +1 -0
  86. package/lib/typescript/Disclosure.d.ts +39 -0
  87. package/lib/typescript/Disclosure.d.ts.map +1 -0
  88. package/lib/typescript/EmptyState.d.ts +12 -0
  89. package/lib/typescript/EmptyState.d.ts.map +1 -0
  90. package/lib/typescript/ListItem.d.ts +20 -0
  91. package/lib/typescript/ListItem.d.ts.map +1 -0
  92. package/lib/typescript/Menu.d.ts +23 -0
  93. package/lib/typescript/Menu.d.ts.map +1 -0
  94. package/lib/typescript/Message.d.ts +14 -0
  95. package/lib/typescript/Message.d.ts.map +1 -0
  96. package/lib/typescript/Popover.d.ts +71 -0
  97. package/lib/typescript/Popover.d.ts.map +1 -0
  98. package/lib/typescript/Progress.d.ts +12 -0
  99. package/lib/typescript/Progress.d.ts.map +1 -0
  100. package/lib/typescript/Select.d.ts +30 -0
  101. package/lib/typescript/Select.d.ts.map +1 -0
  102. package/lib/typescript/Skeleton.d.ts +13 -0
  103. package/lib/typescript/Skeleton.d.ts.map +1 -0
  104. package/lib/typescript/Slider.d.ts +21 -0
  105. package/lib/typescript/Slider.d.ts.map +1 -0
  106. package/lib/typescript/Spinner.d.ts +12 -0
  107. package/lib/typescript/Spinner.d.ts.map +1 -0
  108. package/lib/typescript/Swap.d.ts +25 -0
  109. package/lib/typescript/Swap.d.ts.map +1 -0
  110. package/lib/typescript/Tabs.d.ts +18 -0
  111. package/lib/typescript/Tabs.d.ts.map +1 -0
  112. package/lib/typescript/Text.d.ts +20 -0
  113. package/lib/typescript/Text.d.ts.map +1 -0
  114. package/lib/typescript/TextField.d.ts +36 -0
  115. package/lib/typescript/TextField.d.ts.map +1 -0
  116. package/lib/typescript/Toast.d.ts +25 -0
  117. package/lib/typescript/Toast.d.ts.map +1 -0
  118. package/lib/typescript/blur.d.ts +4 -0
  119. package/lib/typescript/blur.d.ts.map +1 -0
  120. package/lib/typescript/controls.d.ts +37 -0
  121. package/lib/typescript/controls.d.ts.map +1 -0
  122. package/lib/typescript/generated/tokens.d.ts +499 -0
  123. package/lib/typescript/generated/tokens.d.ts.map +1 -0
  124. package/lib/typescript/icon.d.ts +25 -0
  125. package/lib/typescript/icon.d.ts.map +1 -0
  126. package/lib/typescript/index.d.ts +31 -0
  127. package/lib/typescript/index.d.ts.map +1 -0
  128. package/lib/typescript/layout.d.ts +24 -0
  129. package/lib/typescript/layout.d.ts.map +1 -0
  130. package/lib/typescript/motion.d.ts +7 -0
  131. package/lib/typescript/motion.d.ts.map +1 -0
  132. package/lib/typescript/overlay.d.ts +33 -0
  133. package/lib/typescript/overlay.d.ts.map +1 -0
  134. package/lib/typescript/package.json +1 -0
  135. package/lib/typescript/pending.d.ts +25 -0
  136. package/lib/typescript/pending.d.ts.map +1 -0
  137. package/lib/typescript/presence.d.ts +37 -0
  138. package/lib/typescript/presence.d.ts.map +1 -0
  139. package/lib/typescript/press.d.ts +12 -0
  140. package/lib/typescript/press.d.ts.map +1 -0
  141. package/lib/typescript/screen.d.ts +16 -0
  142. package/lib/typescript/screen.d.ts.map +1 -0
  143. package/lib/typescript/theme.d.ts +32 -0
  144. package/lib/typescript/theme.d.ts.map +1 -0
  145. package/package.json +100 -3
  146. package/src/Avatar.tsx +44 -0
  147. package/src/Badge.tsx +45 -0
  148. package/src/BottomSheet.tsx +109 -0
  149. package/src/Button.tsx +117 -0
  150. package/src/Card.tsx +65 -0
  151. package/src/Dialog.tsx +93 -0
  152. package/src/Disclosure.tsx +108 -0
  153. package/src/EmptyState.tsx +32 -0
  154. package/src/ListItem.tsx +73 -0
  155. package/src/Menu.tsx +57 -0
  156. package/src/Message.tsx +43 -0
  157. package/src/Popover.tsx +145 -0
  158. package/src/Progress.tsx +33 -0
  159. package/src/Select.tsx +118 -0
  160. package/src/Skeleton.tsx +27 -0
  161. package/src/Slider.tsx +107 -0
  162. package/src/Spinner.tsx +18 -0
  163. package/src/Swap.tsx +74 -0
  164. package/src/Tabs.tsx +84 -0
  165. package/src/Text.tsx +44 -0
  166. package/src/TextField.tsx +137 -0
  167. package/src/Toast.tsx +94 -0
  168. package/src/blur.tsx +33 -0
  169. package/src/controls.tsx +196 -0
  170. package/src/generated/tokens.ts +653 -0
  171. package/src/icon.tsx +39 -0
  172. package/src/index.ts +30 -0
  173. package/src/layout.tsx +40 -0
  174. package/src/motion.ts +22 -0
  175. package/src/overlay.tsx +77 -0
  176. package/src/pending.tsx +131 -0
  177. package/src/presence.tsx +65 -0
  178. package/src/press.ts +23 -0
  179. package/src/screen.tsx +32 -0
  180. package/src/theme.tsx +49 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","useTheme","jsx","_jsx","fill","flexGrow","flexShrink","flexBasis","Stack","gap","align","justify","style","rest","theme","size","alignItems","justifyContent","Row","wrap","flexDirection","flexWrap","Divider","importantForAccessibility","height","backgroundColor","color"],"sourceRoot":"../../src","sources":["layout.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAwC,cAAc;AACnE,SAASC,QAAQ,QAAQ,YAAS;;AAElC;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA;AAIA,OAAO,MAAMC,IAAe,GAAG;EAAEC,QAAQ,EAAE,CAAC;EAAEC,UAAU,EAAE,CAAC;EAAEC,SAAS,EAAE;AAAO,CAAC;;AAEhF;;AASA;AACA,OAAO,SAASC,KAAKA,CAAC;EAAEC,GAAG,GAAG,GAAG;EAAEC,KAAK;EAAEC,OAAO;EAAEC,KAAK;EAAE,GAAGC;AAAiB,CAAC,EAAE;EAC/E,MAAMC,KAAK,GAAGb,QAAQ,CAAC,CAAC;EACxB,oBAAOE,IAAA,CAACH,IAAI;IAAA,GAAKa,IAAI;IAAED,KAAK,EAAE,CAAC;MAAEH,GAAG,EAAEK,KAAK,CAACC,IAAI,CAAC,SAASN,GAAG,EAAE,CAAC;MAAEO,UAAU,EAAEN,KAAK;MAAEO,cAAc,EAAEN;IAAQ,CAAC,EAAEC,KAAK;EAAE,CAAE,CAAC;AAC5H;AAOA;AACA,OAAO,SAASM,GAAGA,CAAC;EAAET,GAAG,GAAG,GAAG;EAAEC,KAAK,GAAG,QAAQ;EAAEC,OAAO;EAAEQ,IAAI;EAAEP,KAAK;EAAE,GAAGC;AAAe,CAAC,EAAE;EAC5F,MAAMC,KAAK,GAAGb,QAAQ,CAAC,CAAC;EACxB,oBAAOE,IAAA,CAACH,IAAI;IAAA,GAAKa,IAAI;IAAED,KAAK,EAAE,CAAC;MAAEQ,aAAa,EAAE,KAAK;MAAEC,QAAQ,EAAEF,IAAI,GAAG,MAAM,GAAG,QAAQ;MAAEV,GAAG,EAAEK,KAAK,CAACC,IAAI,CAAC,SAASN,GAAG,EAAE,CAAC;MAAEO,UAAU,EAAEN,KAAK;MAAEO,cAAc,EAAEN;IAAQ,CAAC,EAAEC,KAAK;EAAE,CAAE,CAAC;AACtL;;AAEA;AACA,OAAO,SAASU,OAAOA,CAAC;EAAEV,KAAK;EAAE,GAAGC;AAAgB,CAAC,EAAE;EACrD,MAAMC,KAAK,GAAGb,QAAQ,CAAC,CAAC;EACxB,oBAAOE,IAAA,CAACH,IAAI;IAAC,mBAAW;IAACuB,yBAAyB,EAAC,IAAI;IAAA,GAAKV,IAAI;IAAED,KAAK,EAAE,CAAC;MAAEY,MAAM,EAAE,CAAC;MAAEC,eAAe,EAAEX,KAAK,CAACY,KAAK,CAAC,gBAAgB;IAAE,CAAC,EAAEd,KAAK;EAAE,CAAE,CAAC;AACrJ","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The motion vocabulary of Fluxus on Reanimated: the same names, durations and
5
+ * springs as the web (core/src/tokens.ts). With reduced motion on in the system,
6
+ * a value goes to its end at once. (SPEC §15)
7
+ */
8
+ import { Easing, ReduceMotion, withSpring, withTiming } from 'react-native-reanimated';
9
+ import { motion } from "./generated/tokens.js";
10
+ export const spring = (to, preset = 'smooth') => {
11
+ 'worklet';
12
+
13
+ return withSpring(to, {
14
+ ...motion.spring[preset],
15
+ reduceMotion: ReduceMotion.System
16
+ });
17
+ };
18
+ export const timing = (to, duration = 'normal', easing = 'standard') => {
19
+ 'worklet';
20
+
21
+ const [a, b, c, d] = motion.easing[easing];
22
+ return withTiming(to, {
23
+ duration: motion.duration[duration],
24
+ easing: Easing.bezier(a, b, c, d),
25
+ reduceMotion: ReduceMotion.System
26
+ });
27
+ };
28
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Easing","ReduceMotion","withSpring","withTiming","motion","spring","to","preset","reduceMotion","System","timing","duration","easing","a","b","c","d","bezier"],"sourceRoot":"../../src","sources":["motion.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAQ,yBAAyB;AACtF,SAASC,MAAM,QAAQ,uBAAoB;AAM3C,OAAO,MAAMC,MAAM,GAAGA,CAACC,EAAU,EAAEC,MAAoB,GAAG,QAAQ,KAAa;EAC7E,SAAS;;EACT,OAAOL,UAAU,CAACI,EAAE,EAAE;IAAE,GAAGF,MAAM,CAACC,MAAM,CAACE,MAAM,CAAC;IAAEC,YAAY,EAAEP,YAAY,CAACQ;EAAO,CAAC,CAAC;AACxF,CAAC;AAED,OAAO,MAAMC,MAAM,GAAGA,CAACJ,EAAU,EAAEK,QAAuB,GAAG,QAAQ,EAAEC,MAAmB,GAAG,UAAU,KAAa;EAClH,SAAS;;EACT,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC,GAAGZ,MAAM,CAACQ,MAAM,CAACA,MAAM,CAAC;EAC1C,OAAOT,UAAU,CAACG,EAAE,EAAE;IAAEK,QAAQ,EAAEP,MAAM,CAACO,QAAQ,CAACA,QAAQ,CAAC;IAAEC,MAAM,EAAEZ,MAAM,CAACiB,MAAM,CAACJ,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;IAAER,YAAY,EAAEP,YAAY,CAACQ;EAAO,CAAC,CAAC;AACtI,CAAC","ignoreList":[]}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * What opens above everything: a window of React Native (`Modal`) that paints and moves nothing of its own,
5
+ * where Fluxus draws the veil and moves the panel. Back on Android, Escape in a browser and the scrub of
6
+ * VoiceOver close it. (SPEC §15.8)
7
+ */
8
+ import { useEffect, useState } from 'react';
9
+ import { AccessibilityInfo, Modal, Platform, Pressable, StyleSheet, View } from 'react-native';
10
+ import Animated, { useAnimatedStyle, useReducedMotion, useSharedValue } from 'react-native-reanimated';
11
+ import { motion } from "./generated/tokens.js";
12
+ import { spring, timing } from "./motion.js";
13
+ import { useTheme } from "./theme.js";
14
+ import { ToastLayer } from "./Toast.js";
15
+
16
+ /** A screen reader goes to it: to the title on opening, back to what opened it on closing. */
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ export const focusOn = target => {
19
+ if (target && Platform.OS !== 'web') AccessibilityInfo.sendAccessibilityEvent(target, 'focus');
20
+ };
21
+
22
+ /** The surface of what floats: raised, edged, and with the one shadow of the package. */
23
+ export const floating = theme => ({
24
+ borderWidth: 1,
25
+ borderColor: theme.color['border.default'],
26
+ borderRadius: theme.size['radius.card'],
27
+ backgroundColor: theme.color['surface.raised'],
28
+ boxShadow: [{
29
+ offsetX: 0,
30
+ offsetY: theme.size['space.2'],
31
+ blurRadius: theme.size['space.6'],
32
+ color: theme.color['shadow.tint']
33
+ }]
34
+ });
35
+
36
+ /** `mounted` outlives `open` by the time it takes to go; `t` goes 0 → 1 as it comes and back as it goes. */
37
+ export function useOverlay(open) {
38
+ const reduced = useReducedMotion();
39
+ const [mounted, setMounted] = useState(open);
40
+ const t = useSharedValue(0);
41
+ useEffect(() => {
42
+ if (open) {
43
+ setMounted(true);
44
+ t.value = spring(1, 'smooth');
45
+ return;
46
+ }
47
+ t.value = timing(0, 'fast', 'accelerate');
48
+ const timer = setTimeout(() => setMounted(false), reduced ? 0 : motion.duration.fast);
49
+ return () => clearTimeout(timer);
50
+ }, [open, reduced, t]);
51
+ return {
52
+ mounted,
53
+ t
54
+ };
55
+ }
56
+ export function Overlay({
57
+ open,
58
+ onClose,
59
+ veil = true,
60
+ dismissible = true,
61
+ onShow,
62
+ children
63
+ }) {
64
+ const theme = useTheme();
65
+ const {
66
+ mounted,
67
+ t
68
+ } = useOverlay(open);
69
+ const fade = useAnimatedStyle(() => ({
70
+ opacity: t.value
71
+ }));
72
+ if (!mounted) return null;
73
+ return /*#__PURE__*/_jsx(Modal, {
74
+ transparent: true,
75
+ visible: true,
76
+ animationType: "none",
77
+ statusBarTranslucent: true,
78
+ navigationBarTranslucent: true,
79
+ onRequestClose: onClose,
80
+ onShow: onShow,
81
+ children: /*#__PURE__*/_jsxs(View, {
82
+ style: StyleSheet.absoluteFill,
83
+ onAccessibilityEscape: onClose,
84
+ children: [veil && /*#__PURE__*/_jsx(Animated.View, {
85
+ pointerEvents: "none",
86
+ style: [StyleSheet.absoluteFill, {
87
+ backgroundColor: theme.color['surface.overlay']
88
+ }, fade]
89
+ }), /*#__PURE__*/_jsx(Pressable, {
90
+ "aria-hidden": true,
91
+ accessible: false,
92
+ tabIndex: -1,
93
+ style: StyleSheet.absoluteFill,
94
+ onPress: dismissible ? onClose : undefined
95
+ }), children(t), /*#__PURE__*/_jsx(ToastLayer, {})]
96
+ })
97
+ });
98
+ }
99
+ //# sourceMappingURL=overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","AccessibilityInfo","Modal","Platform","Pressable","StyleSheet","View","Animated","useAnimatedStyle","useReducedMotion","useSharedValue","motion","spring","timing","useTheme","ToastLayer","jsx","_jsx","jsxs","_jsxs","focusOn","target","OS","sendAccessibilityEvent","floating","theme","borderWidth","borderColor","color","borderRadius","size","backgroundColor","boxShadow","offsetX","offsetY","blurRadius","useOverlay","open","reduced","mounted","setMounted","t","value","timer","setTimeout","duration","fast","clearTimeout","Overlay","onClose","veil","dismissible","onShow","children","fade","opacity","transparent","visible","animationType","statusBarTranslucent","navigationBarTranslucent","onRequestClose","style","absoluteFill","onAccessibilityEscape","pointerEv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AACC,OAAO;IAACC,aAAa,EAAC,MAAM;IAACC,oBAAoB;IAACC,wBAAwB;IAACC,cAAc,EAAEZ,OAAQ;IAACG,MAAM,EAAEA,MAAO;IAAAC,QAAA,eACpIlC,KAAA,CAACb,IAAI;MAACwD,KAAK,EAAEzD,UAAU,CAAC0D,YAAa;MAACC,qBAAqB,EAAEf,OAAQ;MAAAI,QAAA,GAClEH,IAAI,iBAAIjC,IAAA,CAACV,QAAQ,CAACD,IAAI;QAAC2D,aAAa,EAAC,MAAM;QAACH,KAAK,EAAE,CAACzD,UAAU,CAAC0D,YAAY,EAAE;UAAEhC,eAAe,EAAEN,KAAK,CAACG,KAAK,CAAC,iBAAiB;QAAE,CAAC,EAAE0B,IAAI;MAAE,CAAE,CAAC,eAE5IrC,IAAA,CAACb,SAAS;QAAC,mBAAW;QAAC8D,UAAU,EAAE,KAAM;QAACC,QAAQ,EAAE,CAAC,CAAE;QAACL,KAAK,EAAEzD,UAAU,CAAC0D,YAAa;QAACK,OAAO,EAAEjB,WAAW,GAAGF,OAAO,GAAGoB;MAAU,CAAE,CAAC,EACrIhB,QAAQ,CAACZ,CAAC,CAAC,eAEZxB,IAAA,CAACF,UAAU,IAAE,CAAC;IAAA,CACV;EAAC,CACF,CAAC;AAEZ","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The wait is born from the finger, as on the web (core/src/pending.ts, SPEC §14.35): what was pressed and now
5
+ * waits fills slowly from where it was touched, never to the whole; when the answer comes it fills and goes,
6
+ * and if it failed it drains back to the finger. A wait shorter than 150 ms shows nothing; once seen, it lasts
7
+ * 400 ms at least. (SPEC §15.6, §15.9)
8
+ */
9
+ import { useEffect, useRef, useState } from 'react';
10
+ import Animated, { Easing, ReduceMotion, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withTiming } from 'react-native-reanimated';
11
+ import { motion } from "./generated/tokens.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ const DELAY = 150;
14
+ const MIN_VISIBLE = 400;
15
+ /** How far it gets by itself, of the way to the farthest corner, and the weight of its colour. */
16
+ const REACH = 0.9;
17
+ const TINT = 0.14;
18
+
19
+ /**
20
+ * `onPress` may return a promise: until it settles, what was pressed waits. If it is rejected, it failed: the
21
+ * third value is true until the next press. The rejection goes no further: the app has its own `catch`.
22
+ */
23
+ export function useAsyncPress(onPress) {
24
+ const [state, setState] = useState('idle');
25
+ const alive = useRef(true);
26
+ useEffect(() => {
27
+ alive.current = true;
28
+ return () => {
29
+ alive.current = false;
30
+ };
31
+ }, []);
32
+ const run = event => {
33
+ const result = onPress?.(event);
34
+ if (typeof result?.then !== 'function') return;
35
+ setState('waiting');
36
+ const end = next => () => {
37
+ if (alive.current) setState(next);
38
+ };
39
+ result.then(end('idle'), end('failed'));
40
+ };
41
+ return [state === 'waiting', run, state === 'failed'];
42
+ }
43
+
44
+ /** `done` runs once `result` is fulfilled if it is a promise, and at once if it is not. If it fails, it does not run. */
45
+ export function settle(result, done) {
46
+ const promise = result;
47
+ if (typeof promise?.then !== 'function') return done();
48
+ return Promise.resolve(promise).then(done, () => undefined);
49
+ }
50
+ /** Mounted only while something waits: at rest, what can wait carries no animated view. */
51
+ function Fill({
52
+ x,
53
+ y,
54
+ radius,
55
+ ink,
56
+ ending
57
+ }) {
58
+ const reduced = useReducedMotion();
59
+ const grow = useSharedValue(reduced ? 1 : 0);
60
+ const fade = useSharedValue(1);
61
+ useEffect(() => {
62
+ const fast = motion.duration.fast;
63
+ if (ending === 'failed') grow.value = withTiming(0, {
64
+ duration: motion.duration.normal,
65
+ reduceMotion: ReduceMotion.System
66
+ });else if (ending) {
67
+ grow.value = withTiming(1, {
68
+ duration: fast,
69
+ reduceMotion: ReduceMotion.System
70
+ });
71
+ fade.value = withDelay(fast, withTiming(0, {
72
+ duration: fast,
73
+ reduceMotion: ReduceMotion.System
74
+ }));
75
+ // It slows as it goes and never gets there: it does not pretend to know how long.
76
+ } else if (!reduced) grow.value = withTiming(REACH, {
77
+ duration: 4000,
78
+ easing: Easing.out(Easing.exp)
79
+ });
80
+ }, [ending, reduced, grow, fade]);
81
+ const style = useAnimatedStyle(() => ({
82
+ opacity: fade.value * TINT,
83
+ transform: [{
84
+ scale: grow.value
85
+ }]
86
+ }));
87
+ // Where the finger was, in the points of the element: `left` and `top`, not the direction of the language.
88
+ return /*#__PURE__*/_jsx(Animated.View, {
89
+ pointerEvents: "none",
90
+ "aria-hidden": true,
91
+ style: [{
92
+ position: 'absolute',
93
+ left: x - radius,
94
+ top: y - radius,
95
+ width: 2 * radius,
96
+ height: 2 * radius,
97
+ borderRadius: radius,
98
+ backgroundColor: ink
99
+ }, style]
100
+ });
101
+ }
102
+
103
+ /**
104
+ * For what is pressed and may wait. Give it `onPressIn` and `onLayout`, put `fill` first inside it, and clip it
105
+ * (`overflow: 'hidden'`). `ink` is the colour of its text; `failed`, whether the wait that ends now did.
106
+ */
107
+ export function usePending(waiting, ink, failed = false) {
108
+ const [phase, setPhase] = useState('idle');
109
+ const how = useRef(failed);
110
+ how.current = failed;
111
+ const origin = useRef(null);
112
+ const size = useRef({
113
+ w: 0,
114
+ h: 0
115
+ });
116
+ const since = useRef(0);
117
+ useEffect(() => {
118
+ if (waiting) {
119
+ const timer = setTimeout(() => {
120
+ since.current = Date.now();
121
+ setPhase('shown');
122
+ }, DELAY);
123
+ return () => clearTimeout(timer);
124
+ }
125
+ if (phase !== 'shown') return;
126
+ let last;
127
+ const timer = setTimeout(() => {
128
+ setPhase(how.current ? 'failed' : 'done');
129
+ last = setTimeout(() => setPhase('idle'), how.current ? motion.duration.normal : motion.duration.fast * 2);
130
+ }, Math.max(0, MIN_VISIBLE - (Date.now() - since.current)));
131
+ return () => {
132
+ clearTimeout(timer);
133
+ clearTimeout(last);
134
+ };
135
+ // `phase` is read, not followed: only a change of `waiting` moves it on.
136
+ }, [waiting]);
137
+ const {
138
+ w,
139
+ h
140
+ } = size.current;
141
+ const at = origin.current ?? {
142
+ x: w / 2,
143
+ y: h / 2
144
+ };
145
+ return {
146
+ onPressIn(e) {
147
+ // The event gives the point in the window; the element says where it is in it.
148
+ origin.current = null;
149
+ // Pressed with a keyboard there is no point: it fills from the centre.
150
+ if (!e?.nativeEvent) return;
151
+ const {
152
+ pageX,
153
+ pageY
154
+ } = e.nativeEvent;
155
+ e.currentTarget?.measureInWindow?.((x, y) => {
156
+ origin.current = {
157
+ x: pageX - x,
158
+ y: pageY - y
159
+ };
160
+ });
161
+ },
162
+ onLayout(e) {
163
+ size.current = {
164
+ w: e.nativeEvent.layout.width,
165
+ h: e.nativeEvent.layout.height
166
+ };
167
+ },
168
+ fill: phase === 'idle' ? null : /*#__PURE__*/_jsx(Fill, {
169
+ x: at.x,
170
+ y: at.y,
171
+ radius: Math.hypot(Math.max(at.x, w - at.x), Math.max(at.y, h - at.y)),
172
+ ink: ink,
173
+ ending: phase === 'shown' ? false : phase
174
+ })
175
+ };
176
+ }
177
+ //# sourceMappingURL=pending.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","useState","Animated","Easing","ReduceMotion","useAnimatedStyle","useReducedMotion","useSharedValue","withDelay","withTiming","motion","jsx","_jsx","DELAY","MIN_VISIBLE","REACH","TINT","useAsyncPress","onPress","state","setState","alive","current","run","event","result","then","end","next","settle","done","promise","Promise","resolve","undefined","Fill","x","y","radius","ink","ending","reduced","grow","fade","fast","duration","value","normal","reduceMotion","System","easing","out","exp","style","opacity","transform","scale","View","pointerEvents","position","left","top","width","height","borderRadius","backgroundColor","usePending","waiting","failed","phase","setPhase","how","origin","size","w","h","since","timer","setTimeout","Date","now","clearTimeout","last","Math","max","at","onPressIn","e","nativeEvent","pageX","pageY","currentTarget","measureInWindow","onLayout","layout","fill","hypot"],"sourceRoot":"../../src","sources":["pending.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAwB,OAA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: what comes fades in as it rises, what goes fades out, and what
5
+ * stays glides to its new place. The values of the web (core/src/stagger.ts),
6
+ * on the layout animations of Reanimated. With reduced motion on in the system
7
+ * they are immediate. (SPEC §15.4)
8
+ */
9
+
10
+ import { Platform } from 'react-native';
11
+ import Animated, { Easing, FadeInDown, FadeOut, LinearTransition, ReduceMotion } from 'react-native-reanimated';
12
+ import { motion } from "./generated/tokens.js";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ const curve = name => {
15
+ const [a, b, c, d] = motion.easing[name];
16
+ return Easing.bezier(a, b, c, d);
17
+ };
18
+ /** How far it rises as it comes, and how long the nth of a group waits for the one before. */
19
+ export const RISE = 12;
20
+ export const STAGGER = 70;
21
+
22
+ /** For `entering`: it fades in as it rises; `index` is its place in a group that comes together. */
23
+ export const enter = (index = 0) => FadeInDown.duration(motion.duration.normal).delay(index * STAGGER).easing(curve('decelerate')).withInitialValues({
24
+ transform: [{
25
+ translateY: RISE
26
+ }]
27
+ }).reduceMotion(ReduceMotion.System);
28
+
29
+ /** For `exiting`: it fades out, fast. */
30
+ export const exit = () => FadeOut.duration(motion.duration.fast).easing(curve('accelerate')).reduceMotion(ReduceMotion.System);
31
+
32
+ /** For `layout`: it glides to where it is now, on the smooth spring. */
33
+ export const shift = () => {
34
+ const {
35
+ stiffness,
36
+ damping,
37
+ mass
38
+ } = motion.spring.smooth;
39
+ return LinearTransition.springify().stiffness(stiffness).damping(damping).mass(mass).reduceMotion(ReduceMotion.System);
40
+ };
41
+ const MADE = new Map();
42
+
43
+ /**
44
+ * The three, for a view that comes, goes and moves. In a browser they are off: there Reanimated pins a view
45
+ * that has them where it first was (`position: absolute`, seen with 4.7.1), and the layout breaks.
46
+ */
47
+ export const presence = (index = 0) => {
48
+ if (Platform.OS === 'web') return {};
49
+ // One set for each place in a group, made once: a render does not build them again.
50
+ let made = MADE.get(index);
51
+ if (!made) MADE.set(index, made = {
52
+ entering: enter(index),
53
+ exiting: exit(),
54
+ layout: shift()
55
+ });
56
+ return made;
57
+ };
58
+ /** A view that comes, goes and moves without a jump. Its siblings glide too when each is an Appear. */
59
+ export function Appear({
60
+ index = 0,
61
+ ...rest
62
+ }) {
63
+ return /*#__PURE__*/_jsx(Animated.View, {
64
+ ...presence(index),
65
+ ...rest
66
+ });
67
+ }
68
+ //# sourceMappingURL=presence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","Animated","Easing","FadeInDown","FadeOut","LinearTransition","ReduceMotion","motion","jsx","_jsx","curve","name","a","b","c","d","easing","bezier","RISE","STAGGER","enter","index","duration","normal","delay","withInitialValues","transform","translateY","reduceMotion","System","exit","fast","shift","stiffness","damping","mass","spring","smooth","springify","MADE","Map","presence","OS","made","get","set","entering","exiting","layout","Appear","rest","View"],"sourceRoot":"../../src","sources":["presence.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAwB,cAAc;AACvD,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,YAAY,QAAQ,yBAAyB;AAC/G,SAASC,MAAM,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,MAAMC,KAAK,GAAIC,IAAgC,IAAK;EAClD,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC,GAAGR,MAAM,CAACS,MAAM,CAACL,IAAI,CAAC;EACxC,OAAOT,MAAM,CAACe,MAAM,CAACL,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;AAClC,CAAC;AACD;AACA,OAAO,MAAMG,IAAI,GAAG,EAAE;AACtB,OAAO,MAAMC,OAAO,GAAG,EAAE;;AAEzB;AACA,OAAO,MAAMC,KAAK,GAAGA,CAACC,KAAK,GAAG,CAAC,KAC7BlB,UAAU,CAACmB,QAAQ,CAACf,MAAM,CAACe,QAAQ,CAACC,MAAM,CAAC,CACxCC,KAAK,C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C;IAAEkB,MAAM,EAAEhB,KAAK,CAAC;EAAE,CAAE,CAAC;EACjG,OAAOW,IAAI;AACb,CAAC;AAQD;AACA,OAAO,SAASM,MAAMA,CAAC;EAAE5B,KAAK,GAAG,CAAC;EAAE,GAAG6B;AAAkB,CAAC,EAAE;EAC1D,oBAAOzC,IAAA,CAACR,QAAQ,CAACkD,IAAI;IAAA,GAAKV,QAAQ,CAACpB,KAAK,CAAC;IAAA,GAAM6B;EAAI,CAAG,CAAC;AACzD","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ import { useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
4
+ import { spring } from "./motion.js";
5
+
6
+ /** As the web (core/src/press.ts): what is pressed gives a little, on the snappy spring. */
7
+ const PRESSED = 0.97;
8
+
9
+ /** The style and the two handlers of something that gives when pressed; the handlers of the app still run. */
10
+ export function usePress({
11
+ onPressIn,
12
+ onPressOut
13
+ }) {
14
+ const scale = useSharedValue(1);
15
+ const style = useAnimatedStyle(() => ({
16
+ transform: [{
17
+ scale: scale.value
18
+ }]
19
+ }));
20
+ return {
21
+ style,
22
+ onPressIn: e => {
23
+ scale.value = spring(PRESSED, 'snappy');
24
+ onPressIn?.(e);
25
+ },
26
+ onPressOut: e => {
27
+ scale.value = spring(1, 'snappy');
28
+ onPressOut?.(e);
29
+ }
30
+ };
31
+ }
32
+ //# sourceMappingURL=press.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useAnimatedStyle","useSharedValue","spring","PRESSED","usePress","onPressIn","onPressOut","scale","style","transform","value","e"],"sourceRoot":"../../src","sources":["press.ts"],"mappings":";;AACA,SAASA,gBAAgB,EAAEC,cAAc,QAAQ,yBAAyB;AAC1E,SAASC,MAAM,QAAQ,aAAU;;AAEjC;AACA,MAAMC,OAAO,GAAG,IAAI;;AAEpB;AACA,OAAO,SAASC,QAAQA,CAAC;EAAEC,SAAS;EAAEC;AAA6D,CAAC,EAAE;EACpG,MAAMC,KAAK,GAAGN,cAAc,CAAC,CAAC,CAAC;EAC/B,MAAMO,KAAK,GAAGR,gBAAgB,CAAC,OAAO;IAAES,SAAS,EAAE,CAAC;MAAEF,KAAK,EAAEA,KAAK,CAACG;IAAM,CAAC;EAAE,CAAC,CAAC,CAAC;EAC/E,OAAO;IACLF,KAAK;IACLH,SAAS,EAAGM,CAAwB,IAAK;MACvCJ,KAAK,CAACG,KAAK,GAAGR,MAAM,CAACC,OAAO,EAAE,QAAQ,CAAC;MACvCE,SAAS,GAAGM,CAAC,CAAC;IAChB,CAAC;IACDL,UAAU,EAAGK,CAAwB,IAAK;MACxCJ,KAAK,CAACG,KAAK,GAAGR,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC;MACjCI,UAAU,GAAGK,CAAC,CAAC;IACjB;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * `@fluxus-ui/native/screen`: the ground of a screen, inside the safe area. Its own entry, so that an app that
5
+ * lays out its screens some other way does not need react-native-safe-area-context. (SPEC §15.5)
6
+ */
7
+ import { ScrollView, View } from 'react-native';
8
+ import { SafeAreaView } from 'react-native-safe-area-context';
9
+ import { useTheme } from "./theme.js";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ export function Screen({
12
+ scroll = false,
13
+ edges,
14
+ padded = true,
15
+ style,
16
+ children,
17
+ ...rest
18
+ }) {
19
+ const theme = useTheme();
20
+ const inner = padded ? {
21
+ padding: theme.size['layout.gutter'],
22
+ gap: theme.size['space.4']
23
+ } : null;
24
+ return /*#__PURE__*/_jsx(SafeAreaView, {
25
+ edges: edges,
26
+ ...rest,
27
+ style: [{
28
+ flex: 1,
29
+ backgroundColor: theme.color['surface.page']
30
+ }, style],
31
+ children: scroll ? /*#__PURE__*/_jsx(ScrollView, {
32
+ keyboardShouldPersistTaps: "handled",
33
+ keyboardDismissMode: "interactive",
34
+ automaticallyAdjustKeyboardInsets: true,
35
+ contentContainerStyle: inner,
36
+ children: children
37
+ }) : /*#__PURE__*/_jsx(View, {
38
+ style: [{
39
+ flex: 1
40
+ }, inner],
41
+ children: children
42
+ })
43
+ });
44
+ }
45
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ScrollView","View","SafeAreaView","useTheme","jsx","_jsx","Screen","scroll","edges","padded","style","children","rest","theme","inner","padding","size","gap","flex","backgroundColor","color","keyboardShouldPersistTaps","keyboardDismissMode","automaticallyAdjustKeyboardInsets","contentContainerStyle"],"sourceRoot":"../../src","sources":["screen.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,IAAI,QAAwB,cAAc;AAC/D,SAASC,YAAY,QAAmB,gCAAgC;AACxE,SAASC,QAAQ,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWnC,OAAO,SAASC,MAAMA,CAAC;EAAEC,MAAM,GAAG,KAAK;EAAEC,KAAK;EAAEC,MAAM,GAAG,IAAI;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAkB,CAAC,EAAE;EACtG,MAAMC,KAAK,GAAGV,QAAQ,CAAC,CAAC;EACxB,MAAMW,KAAK,GAAGL,MAAM,GAAG;IAAEM,OAAO,EAAEF,KAAK,CAACG,IAAI,CAAC,eAAe,CAAC;IAAEC,GAAG,EAAEJ,KAAK,CAACG,IAAI,CAAC,SAAS;EAAE,CAAC,GAAG,IAAI;EAClG,oBACEX,IAAA,CAACH,YAAY;IAACM,KAAK,EAAEA,KAAM;IAAA,GAAKI,IAAI;IAAEF,KAAK,EAAE,CAAC;MAAEQ,IAAI,EAAE,CAAC;MAAEC,eAAe,EAAEN,KAAK,CAACO,KAAK,CAAC,cAAc;IAAE,CAAC,EAAEV,KAAK,CAAE;IAAAC,QAAA,EAC7GJ,MAAM,gBACLF,IAAA,CAACL,UAAU;MAACqB,yBAAyB,EAAC,SAAS;MAACC,mBAAmB,EAAC,aAAa;MAACC,iCAAiC;MAACC,qBAAqB,EAAEV,KAAM;MAAAH,QAAA,EAC9IA;IAAQ,CACC,CAAC,gBAEbN,IAAA,CAACJ,IAAI;MAACS,KAAK,EAAE,CAAC;QAAEQ,IAAI,EAAE;MAAE,CAAC,EAAEJ,KAAK,CAAE;MAAAH,QAAA,EAAEA;IAAQ,CAAO;EACpD,CACW,CAAC;AAEnB","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ import { createContext, useContext, useMemo } from 'react';
4
+ import { useColorScheme } from 'react-native';
5
+ import { themes } from "./generated/tokens.js";
6
+
7
+ /**
8
+ * The faces the app loaded (with expo-font, or linked), by weight. With a face for a weight, text takes
9
+ * that family and no `fontWeight`: Android would thicken it again. Without, the regular one and the weight.
10
+ */
11
+
12
+ /** A theme in one mode: what a component reads. `Theme<typeof theme>` has the tokens of the app too, by name. */
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ const Context = /*#__PURE__*/createContext(null);
15
+ export function ThemeProvider({
16
+ theme = themes.base,
17
+ mode,
18
+ fonts,
19
+ children
20
+ }) {
21
+ const system = useColorScheme();
22
+ const now = mode ?? (system === 'dark' ? 'dark' : 'light');
23
+ const value = useMemo(() => ({
24
+ ...theme,
25
+ mode: now,
26
+ color: theme.color[now],
27
+ font: fonts
28
+ }), [theme, now, fonts?.regular, fonts?.medium, fonts?.bold]);
29
+ return /*#__PURE__*/_jsx(Context.Provider, {
30
+ value: value,
31
+ children: children
32
+ });
33
+ }
34
+
35
+ /** The theme, in the mode it is in. `useTheme<typeof theme>()` gives the app its own tokens (`app.…`), checked by name. */
36
+ export function useTheme() {
37
+ const theme = useContext(Context);
38
+ if (!theme) throw new Error('@fluxus-ui/native: no theme. Wrap the app in <ThemeProvider>.');
39
+ return theme;
40
+ }
41
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","useContext","useMemo","useColorScheme","themes","jsx","_jsx","Context","ThemeProvider","theme","base","mode","fonts","children","system","now","value","color","font","regular","medium","bold","Provider","useTheme","Error"],"sourceRoot":"../../src","sources":["theme.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC1E,SAASC,cAAc,QAAQ,cAAc;AAC7C,SAASC,MAAM,QAA0B,uBAAoB;;AAI7D;AACA;AACA;AACA;;AAOA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQA,MAAMC,OAAO,gBAAGP,aAAa,CAAe,IAAI,CAAC;AAYjD,OAAO,SAASQ,aAAaA,CAAC;EAAEC,KAAK,GAAGL,MAAM,CAACM,IAAI;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAA6B,CAAC,EAAE;EAChG,MAAMC,MAAM,GAAGX,cAAc,CAAC,CAAC;EAC/B,MAAMY,GAAS,GAAGJ,IAAI,KAAKG,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;EAChE,MAAME,KAAK,GAAGd,OAAO,CAAQ,OAAO;IAAE,GAAGO,KAAK;IAAEE,IAAI,EAAEI,GAAG;IAAEE,KAAK,EAAER,KAAK,CAACQ,KAAK,CAACF,GAAG,CAAC;IAAEG,IAAI,EAAEN;EAAM,CAAC,CAAC,EAAE,CAACH,KAAK,EAAEM,GAAG,EAAEH,KAAK,EAAEO,OAAO,EAAEP,KAAK,EAAEQ,MAAM,EAAER,KAAK,EAAES,IAAI,CAAC,CAAC;EAC7J,oBAAOf,IAAA,CAACC,OAAO,CAACe,QAAQ;IAACN,KAAK,EAAEA,KAAM;IAAAH,QAAA,EAAEA;EAAQ,CAAmB,CAAC;AACtE;;AAEA;AACA,OAAO,SAASU,QAAQA,CAAA,EAAkD;EACxE,MAAMd,KAAK,GAAGR,UAAU,CAACM,OAAO,CAAC;EACjC,IAAI,CAACE,KAAK,EAAE,MAAM,IAAIe,KAAK,CAAC,+DAA+D,CAAC;EAC5F,OAAOf,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import { type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
2
+ export interface AvatarProps extends Omit<ViewProps, 'style' | 'children'> {
3
+ /** Gives the initials. */
4
+ name: string;
5
+ /** A picture over the initials. */
6
+ src?: string;
7
+ /** Who it is, for a screen reader. Without it the avatar is decoration: the name is usually beside it. */
8
+ label?: string;
9
+ /** Default: 'md'. */
10
+ size?: 'sm' | 'md' | 'lg';
11
+ style?: StyleProp<ViewStyle>;
12
+ }
13
+ /** As the web: the first letter of the first two words that start with a letter or a figure. */
14
+ export declare const initials: (name: string) => string;
15
+ /** Who someone is, in a circle: the picture, or the initials. */
16
+ export declare function Avatar({ name, src, label, size, style, ...rest }: AvatarProps): import("react").JSX.Element;
17
+ //# sourceMappingURL=Avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI3F,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,UAAU,CAAC;IACxE,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0GAA0G;IAC1G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,gGAAgG;AAChG,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,MAQtB,CAAC;AAEnB,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAW,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAepF"}
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
3
+ import { type Theme } from './theme.js';
4
+ export type Tone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
5
+ export interface BadgeProps extends Omit<ViewProps, 'style'> {
6
+ children: ReactNode;
7
+ /** Default: 'neutral'. */
8
+ tone?: Tone;
9
+ /** 'dot': a point of the tone before the text, on a quiet ground. Default: 'tint'. */
10
+ look?: 'tint' | 'dot';
11
+ style?: StyleProp<ViewStyle>;
12
+ }
13
+ /** The ground, the ink and the solid colour of a tone. */
14
+ export declare function toneColors(theme: Theme, tone?: Tone): {
15
+ subtle: string;
16
+ ink: string;
17
+ solid: string;
18
+ };
19
+ /** A state in a word. The tone is never the only thing that says it: the text does. */
20
+ export declare function Badge({ children, tone, look, style, ...rest }: BadgeProps): import("react").JSX.Element;
21
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,YAAS,CAAC;AAE/C,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpF,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC1D,QAAQ,EAAE,SAAS,CAAC;IACpB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,IAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAK/G;AAED,uFAAuF;AACvF,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAgB,EAAE,IAAa,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,+BAmB9F"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A sheet that rises from the bottom, moved only by its transform. As tall as what it holds, up to nine tenths
3
+ * of the screen. Dragged down from its header, it goes; so it does with its handle, which is a button with a
4
+ * name for whoever cannot drag. (SPEC §15.8)
5
+ */
6
+ import { type ReactNode } from 'react';
7
+ export interface BottomSheetProps {
8
+ open: boolean;
9
+ /** A press outside, back, the handle, or dragging it down. */
10
+ onClose: () => void;
11
+ /** Its name: at the top, and what a screen reader hears on opening. */
12
+ title: string;
13
+ /** The title is only for a screen reader. */
14
+ titleHidden?: boolean;
15
+ children?: ReactNode;
16
+ /** What the bottom edge of the screen takes: the safe area of the app. It is added to its own padding. Default: 0. */
17
+ inset?: number;
18
+ /** The name of the handle, for a screen reader. Default: 'Close'. */
19
+ closeLabel?: string;
20
+ /** A press outside or a drag closes it, and it has a handle. Default: true. Back always closes. */
21
+ dismissible?: boolean;
22
+ /** What does not fit scrolls. Default: true; false when what it holds scrolls by itself. */
23
+ scroll?: boolean;
24
+ testID?: string;
25
+ }
26
+ export declare function BottomSheet({ open, onClose, dismissible, ...rest }: BottomSheetProps): import("react").JSX.Element;
27
+ //# sourceMappingURL=BottomSheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAuC,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAa5F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sHAAsH;IACtH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mGAAmG;IACnG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAkB,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,+BAO3F"}