@fluxus-ui/native 0.1.0 → 0.3.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 (117) hide show
  1. package/README.md +16 -2
  2. package/lib/module/AudioPlayer.js +174 -0
  3. package/lib/module/AudioPlayer.js.map +1 -0
  4. package/lib/module/Bubble.js +182 -0
  5. package/lib/module/Bubble.js.map +1 -0
  6. package/lib/module/Button.js +87 -11
  7. package/lib/module/Button.js.map +1 -1
  8. package/lib/module/Card.js +10 -2
  9. package/lib/module/Card.js.map +1 -1
  10. package/lib/module/EmptyState.js +30 -2
  11. package/lib/module/EmptyState.js.map +1 -1
  12. package/lib/module/Link.js +97 -0
  13. package/lib/module/Link.js.map +1 -0
  14. package/lib/module/ListItem.js +9 -3
  15. package/lib/module/ListItem.js.map +1 -1
  16. package/lib/module/Skeleton.js +2 -1
  17. package/lib/module/Skeleton.js.map +1 -1
  18. package/lib/module/Swap.js +3 -3
  19. package/lib/module/Swap.js.map +1 -1
  20. package/lib/module/Toast.js +58 -9
  21. package/lib/module/Toast.js.map +1 -1
  22. package/lib/module/audio.js +54 -0
  23. package/lib/module/audio.js.map +1 -0
  24. package/lib/module/controls.js +61 -28
  25. package/lib/module/controls.js.map +1 -1
  26. package/lib/module/feel.js +24 -0
  27. package/lib/module/feel.js.map +1 -0
  28. package/lib/module/haptics.js +25 -0
  29. package/lib/module/haptics.js.map +1 -0
  30. package/lib/module/icon-host.js +42 -0
  31. package/lib/module/icon-host.js.map +1 -0
  32. package/lib/module/icon-shape.js +222 -0
  33. package/lib/module/icon-shape.js.map +1 -0
  34. package/lib/module/icon.js +293 -13
  35. package/lib/module/icon.js.map +1 -1
  36. package/lib/module/index.js +7 -1
  37. package/lib/module/index.js.map +1 -1
  38. package/lib/module/marks.js +99 -0
  39. package/lib/module/marks.js.map +1 -0
  40. package/lib/module/motion.js +71 -4
  41. package/lib/module/motion.js.map +1 -1
  42. package/lib/module/overlay.js +2 -2
  43. package/lib/module/overlay.js.map +1 -1
  44. package/lib/module/pending.js +11 -7
  45. package/lib/module/pending.js.map +1 -1
  46. package/lib/module/presence.js +8 -5
  47. package/lib/module/presence.js.map +1 -1
  48. package/lib/module/screen.js +6 -1
  49. package/lib/module/screen.js.map +1 -1
  50. package/lib/module/success.js +59 -0
  51. package/lib/module/success.js.map +1 -0
  52. package/lib/typescript/AudioPlayer.d.ts +26 -0
  53. package/lib/typescript/AudioPlayer.d.ts.map +1 -0
  54. package/lib/typescript/Bubble.d.ts +23 -0
  55. package/lib/typescript/Bubble.d.ts.map +1 -0
  56. package/lib/typescript/Button.d.ts +3 -1
  57. package/lib/typescript/Button.d.ts.map +1 -1
  58. package/lib/typescript/Card.d.ts.map +1 -1
  59. package/lib/typescript/EmptyState.d.ts +5 -3
  60. package/lib/typescript/EmptyState.d.ts.map +1 -1
  61. package/lib/typescript/Link.d.ts +23 -0
  62. package/lib/typescript/Link.d.ts.map +1 -0
  63. package/lib/typescript/ListItem.d.ts.map +1 -1
  64. package/lib/typescript/Skeleton.d.ts.map +1 -1
  65. package/lib/typescript/Toast.d.ts.map +1 -1
  66. package/lib/typescript/audio.d.ts +10 -0
  67. package/lib/typescript/audio.d.ts.map +1 -0
  68. package/lib/typescript/controls.d.ts.map +1 -1
  69. package/lib/typescript/feel.d.ts +10 -0
  70. package/lib/typescript/feel.d.ts.map +1 -0
  71. package/lib/typescript/haptics.d.ts +7 -0
  72. package/lib/typescript/haptics.d.ts.map +1 -0
  73. package/lib/typescript/icon-host.d.ts +30 -0
  74. package/lib/typescript/icon-host.d.ts.map +1 -0
  75. package/lib/typescript/icon-shape.d.ts +28 -0
  76. package/lib/typescript/icon-shape.d.ts.map +1 -0
  77. package/lib/typescript/icon.d.ts +13 -14
  78. package/lib/typescript/icon.d.ts.map +1 -1
  79. package/lib/typescript/index.d.ts +7 -1
  80. package/lib/typescript/index.d.ts.map +1 -1
  81. package/lib/typescript/marks.d.ts +23 -0
  82. package/lib/typescript/marks.d.ts.map +1 -0
  83. package/lib/typescript/motion.d.ts +23 -0
  84. package/lib/typescript/motion.d.ts.map +1 -1
  85. package/lib/typescript/pending.d.ts +3 -2
  86. package/lib/typescript/pending.d.ts.map +1 -1
  87. package/lib/typescript/presence.d.ts.map +1 -1
  88. package/lib/typescript/screen.d.ts +7 -2
  89. package/lib/typescript/screen.d.ts.map +1 -1
  90. package/lib/typescript/success.d.ts +13 -0
  91. package/lib/typescript/success.d.ts.map +1 -0
  92. package/package.json +26 -3
  93. package/src/AudioPlayer.tsx +106 -0
  94. package/src/Bubble.tsx +112 -0
  95. package/src/Button.tsx +65 -14
  96. package/src/Card.tsx +7 -2
  97. package/src/EmptyState.tsx +22 -3
  98. package/src/Link.tsx +61 -0
  99. package/src/ListItem.tsx +8 -3
  100. package/src/Skeleton.tsx +2 -1
  101. package/src/Swap.tsx +3 -3
  102. package/src/Toast.tsx +32 -4
  103. package/src/audio.tsx +56 -0
  104. package/src/controls.tsx +37 -9
  105. package/src/feel.ts +22 -0
  106. package/src/haptics.tsx +26 -0
  107. package/src/icon-host.tsx +46 -0
  108. package/src/icon-shape.ts +213 -0
  109. package/src/icon.tsx +252 -15
  110. package/src/index.ts +7 -1
  111. package/src/marks.tsx +79 -0
  112. package/src/motion.ts +76 -4
  113. package/src/overlay.tsx +2 -2
  114. package/src/pending.tsx +11 -7
  115. package/src/presence.tsx +10 -7
  116. package/src/screen.tsx +8 -3
  117. package/src/success.tsx +48 -0
@@ -1,16 +1,10 @@
1
- /** What an icon of @fluxus-ui/icons is, as far as drawing it at rest goes: outlines on a 16 × 16 grid. */
2
- export interface IconData {
3
- parts: readonly {
4
- id: string;
5
- d: string;
6
- fill?: boolean;
7
- rest?: {
8
- d?: string;
9
- o?: number;
10
- draw?: number | 'p';
11
- };
12
- }[];
13
- }
1
+ import { type IconDef } from '@fluxus-ui/icons';
2
+ /** An icon of @fluxus-ui/icons. */
3
+ export type IconData = {
4
+ name?: string;
5
+ parts: IconDef['parts'];
6
+ kicks?: IconDef['kicks'];
7
+ };
14
8
  export interface IconProps {
15
9
  icon: IconData;
16
10
  /** A size of the theme, or points. Default: 'md'. */
@@ -19,7 +13,12 @@ export interface IconProps {
19
13
  color?: string;
20
14
  /** What it means, for a screen reader. Without it the icon is decoration: the text beside it says it. */
21
15
  label?: string;
16
+ /** A state the icon names. Without it, the control it is in says: 'on' when open or checked, else 'rest'. */
17
+ state?: string;
18
+ /** 0–1, for the parts that follow it (`draw: 'p'`). */
19
+ progress?: number;
22
20
  testID?: string;
23
21
  }
24
- export declare function Icon({ icon, size, color, label, testID }: IconProps): import("react").JSX.Element;
22
+ export declare function Icon({ icon, size, color, label, state, progress, testID }: IconProps): import("react").JSX.Element;
23
+ export { Success, type SuccessProps } from './success.js';
25
24
  //# sourceMappingURL=icon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/icon.tsx"],"names":[],"mappings":"AAOA,0GAA0G;AAC1G,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,CAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;SAAE,CAAA;KAAE,EAAE,CAAC;CACrH;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,qDAAqD;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACnC,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yGAAyG;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,IAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,+BAe1E"}
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/icon.tsx"],"names":[],"mappings":"AASA,OAAO,EAAyC,KAAK,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAMtG,mCAAmC;AACnC,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAE5F,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,qDAAqD;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACnC,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yGAAyG;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6GAA6G;IAC7G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqGD,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,IAAW,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAY,EAAE,MAAM,EAAE,EAAE,SAAS,+BAuB/F;AAwHD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAW,CAAC"}
@@ -1,6 +1,9 @@
1
1
  export { ThemeProvider, useTheme, type Theme, type ThemeProviderProps, type Mode, type Fonts } from './theme.js';
2
2
  export { themes, motion, type ThemeTokens, type AppToken, type ColorToken, type SizeToken, type NumberToken, type WeightToken } from './generated/tokens.js';
3
- export { spring, timing, type SpringPreset, type DurationToken, type EasingToken } from './motion.js';
3
+ export { spring, timing, ms, setMotionScale, withFluxSpring, type SpringPreset, type DurationToken, type EasingToken, type FluxSpringConfig } from './motion.js';
4
+ export { IconHostProvider, useHostFor, useIconHost, isOn, type IconHost } from './icon-host.js';
5
+ export { Mark, TICK, DASH, BANG, type MarkProps } from './marks.js';
6
+ export { setHaptics, feel, type HapticKind } from './feel.js';
4
7
  export { Text, textStyle, type TextProps, type TextVariant, type TextTone, type TextWeight } from './Text.js';
5
8
  export { Button, buttonStyle, type ButtonProps, type ButtonVariant, type ButtonSize } from './Button.js';
6
9
  export { usePress } from './press.js';
@@ -28,4 +31,7 @@ export { Popover, place, type PopoverProps, type Placement, type Rect } from './
28
31
  export { Menu, MenuItem, MenuSeparator, type MenuProps, type MenuItemProps } from './Menu.js';
29
32
  export { Disclosure, Accordion, type DisclosureProps, type AccordionProps, type AccordionItem } from './Disclosure.js';
30
33
  export { Select, type SelectProps, type SelectOption } from './Select.js';
34
+ export { Link, type LinkProps } from './Link.js';
35
+ export { Bubble, type BubbleProps, type BubbleStatus } from './Bubble.js';
36
+ export { AudioPlayer, clock, type AudioPlayerProps } from './AudioPlayer.js';
31
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,KAAK,EAAE,KAAK,kBAAkB,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,MAAM,YAAS,CAAC;AAC9G,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAoB,CAAC;AAC1J,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,aAAU,CAAC;AAC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{ type StyleProp, type ViewStyle } from 'react-native';
2
+ /** x1 y1 x2 y2, on the 16 × 16 grid of the icons. */
3
+ type Segment = readonly [number, number, number, number];
4
+ /** As the icon `tick`. */
5
+ export declare const TICK: readonly Segment[];
6
+ export declare const DASH: readonly Segment[];
7
+ /** A bar, then its dot. */
8
+ export declare const BANG: readonly Segment[];
9
+ export interface MarkProps {
10
+ segments: readonly Segment[];
11
+ /** Drawn, or not; it draws and undraws on the snappy spring. */
12
+ shown: boolean;
13
+ /** Its side, in points. Default: 16. */
14
+ size?: number;
15
+ color: string;
16
+ /** The width of its stroke, in points. Default: 1.5 of every 16. */
17
+ stroke?: number;
18
+ style?: StyleProp<ViewStyle>;
19
+ testID?: string;
20
+ }
21
+ export declare function Mark({ segments, shown, size, color, stroke, style, testID }: MarkProps): import("react").JSX.Element;
22
+ export {};
23
+ //# sourceMappingURL=marks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../../src/marks.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,qDAAqD;AACrD,KAAK,OAAO,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzD,0BAA0B;AAC1B,eAAO,MAAM,IAAI,EAAE,SAAS,OAAO,EAGlC,CAAC;AACF,eAAO,MAAM,IAAI,EAAE,SAAS,OAAO,EAAoB,CAAC;AACxD,2BAA2B;AAC3B,eAAO,MAAM,IAAI,EAAE,SAAS,OAAO,EAGlC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,gEAAgE;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,+BAmB3F"}
@@ -1,7 +1,30 @@
1
+ /**
2
+ * The motion vocabulary of Fluxus on Reanimated: the same names, durations and
3
+ * springs as the web (core/src/tokens.ts). With reduced motion on in the system,
4
+ * a value goes to its end at once. (SPEC §15, §15.12)
5
+ */
6
+ import { type AnimationCallback } from 'react-native-reanimated';
1
7
  import { motion } from './generated/tokens.js';
2
8
  export type SpringPreset = keyof typeof motion.spring;
3
9
  export type DurationToken = keyof typeof motion.duration;
4
10
  export type EasingToken = keyof typeof motion.easing;
11
+ /** For a screen that shows the motion, or to look at it closely: 4 makes everything four times slower. */
12
+ export declare const setMotionScale: (k: number) => void;
13
+ /** A duration in ms, at the speed the motion runs. On the JS thread, and safe while rendering. */
14
+ export declare const ms: (duration: number) => number;
5
15
  export declare const spring: (to: number, preset?: SpringPreset) => number;
6
16
  export declare const timing: (to: number, duration?: DurationToken, easing?: EasingToken) => number;
17
+ export interface FluxSpringConfig {
18
+ stiffness: number;
19
+ damping: number;
20
+ /** Units per second, added to the speed it already has. */
21
+ velocity?: number;
22
+ restDelta?: number;
23
+ restSpeed?: number;
24
+ }
25
+ /**
26
+ * The spring of the web (core/src/spring.ts): semi-implicit Euler in steps of 1/120 s. Started over another,
27
+ * it keeps its speed, wherever that points: a value sent back turns round, as `retarget` does on the web.
28
+ */
29
+ export declare function withFluxSpring(toValue: number, config: FluxSpringConfig, callback?: AnimationCallback): number;
7
30
  //# sourceMappingURL=motion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/motion.ts"],"names":[],"mappings":"AAM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AAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CA+B9G"}
@@ -8,9 +8,10 @@ import { type ReactNode } from 'react';
8
8
  import type { GestureResponderEvent, LayoutChangeEvent } from 'react-native';
9
9
  /**
10
10
  * `onPress` may return a promise: until it settles, what was pressed waits. If it is rejected, it failed: the
11
- * third value is true until the next press. The rejection goes no further: the app has its own `catch`.
11
+ * third value is true until the next press. The rejection goes no further: the app has its own `catch`. `onEnd`
12
+ * hears how it ended, even when it ends before a render shows it waiting.
12
13
  */
13
- export declare function useAsyncPress<E>(onPress: ((event: E) => unknown) | null | undefined): [waiting: boolean, run: (event: E) => void, failed: boolean];
14
+ export declare function useAsyncPress<E>(onPress: ((event: E) => unknown) | null | undefined, onEnd?: (failed: boolean) => void): [waiting: boolean, run: (event: E) => void, failed: boolean];
14
15
  /** `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. */
15
16
  export declare function settle(result: unknown, done: () => void): void | Promise<void>;
16
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pending.d.ts","sourceRoot":"","sources":["../../src/pending.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAU7E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC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E,GAAG,IAAI,EAAE,EAAE,WAAW,+BAEzD"}
@@ -2,7 +2,8 @@
2
2
  * `@fluxus-ui/native/screen`: the ground of a screen, inside the safe area. Its own entry, so that an app that
3
3
  * lays out its screens some other way does not need react-native-safe-area-context. (SPEC §15.5)
4
4
  */
5
- import { type ViewProps } from 'react-native';
5
+ import type { ComponentRef, Ref } from 'react';
6
+ import { ScrollView, type ScrollViewProps, type ViewProps } from 'react-native';
6
7
  import { type Edge } from 'react-native-safe-area-context';
7
8
  export interface ScreenProps extends ViewProps {
8
9
  /** It scrolls, and the keyboard does not cover the field in use. */
@@ -11,6 +12,10 @@ export interface ScreenProps extends ViewProps {
11
12
  edges?: readonly Edge[];
12
13
  /** The gutter of the theme around what it holds, and its gap between. Default: true. */
13
14
  padded?: boolean;
15
+ /** With `scroll`: its ScrollView, to take it somewhere (`scrollToEnd` in a chat). */
16
+ scrollRef?: Ref<ComponentRef<typeof ScrollView>>;
17
+ /** With `scroll`: what else its ScrollView takes (`onScroll`, `testID`…). Its padding stays the one of the theme. */
18
+ scrollProps?: Omit<ScrollViewProps, 'children'>;
14
19
  }
15
- export declare function Screen({ scroll, edges, padded, style, children, ...rest }: ScreenProps): import("react").JSX.Element;
20
+ export declare function Screen({ scroll, edges, padded, scrollRef, scrollProps, style, children, ...rest }: ScreenProps): import("react").JSX.Element;
16
21
  //# sourceMappingURL=screen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/screen.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAGzE,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oHAAoH;IACpH,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACxB,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,MAAM,CAAC,EAAE,MAAc,EAAE,KAAK,EAAE,MAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAcrG"}
1
+ {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/screen.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAQ,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAGzE,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oHAAoH;IACpH,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACxB,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,SAAS,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;IACjD,qHAAqH;IACrH,WAAW,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;CACjD;AAED,wBAAgB,MAAM,CAAC,EAAE,MAAc,EAAE,KAAK,EAAE,MAAa,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAc7H"}
@@ -0,0 +1,13 @@
1
+ export interface SuccessProps {
2
+ /** What went well, for a screen reader. */
3
+ label: string;
4
+ /** Points. Default: 64. */
5
+ size?: number;
6
+ /** Default: the solid colour of success. */
7
+ color?: string;
8
+ /** When the tick is there: after `slow`. */
9
+ onShown?: () => void;
10
+ testID?: string;
11
+ }
12
+ export declare function Success({ label, size, color, onShown, testID }: SuccessProps): import("react").JSX.Element;
13
+ //# sourceMappingURL=success.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../src/success.tsx"],"names":[],"mappings":"AAeA,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,+BAoBjF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxus-ui/native",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Fluxus for React Native: the same tokens and motion vocabulary, on Reanimated.",
5
5
  "license": "MIT",
6
6
  "author": "Jhony0709 (https://github.com/Jhony0709)",
@@ -32,6 +32,14 @@
32
32
  "types": "./lib/typescript/blur.d.ts",
33
33
  "default": "./lib/module/blur.js"
34
34
  },
35
+ "./audio": {
36
+ "types": "./lib/typescript/audio.d.ts",
37
+ "default": "./lib/module/audio.js"
38
+ },
39
+ "./haptics": {
40
+ "types": "./lib/typescript/haptics.d.ts",
41
+ "default": "./lib/module/haptics.js"
42
+ },
35
43
  "./package.json": "./package.json"
36
44
  },
37
45
  "files": [
@@ -45,7 +53,10 @@
45
53
  "react-native-reanimated": ">=4.5",
46
54
  "react-native-safe-area-context": ">=5",
47
55
  "react-native-svg": ">=15",
48
- "react-native-worklets": ">=0.10"
56
+ "react-native-worklets": ">=0.10",
57
+ "expo-audio": ">=58",
58
+ "@fluxus-ui/icons": ">=0.3.0",
59
+ "expo-haptics": ">=58"
49
60
  },
50
61
  "devDependencies": {
51
62
  "@babel/core": "^7.29.13",
@@ -54,7 +65,9 @@
54
65
  "@testing-library/react-native": "14.1.0",
55
66
  "@types/jest": "^29.5.14",
56
67
  "@types/react": "^19.3.3",
68
+ "expo-audio": "~58.0.12",
57
69
  "expo-blur": "~58.0.6",
70
+ "expo-haptics": "~58.0.8",
58
71
  "jest": "^29.7.0",
59
72
  "react": "19.3.0",
60
73
  "react-native": "0.88.1",
@@ -64,7 +77,8 @@
64
77
  "react-native-svg": "15.16.0",
65
78
  "react-native-worklets": "0.14.0",
66
79
  "test-renderer": "^1.3.1",
67
- "typescript": "^5.9.3"
80
+ "typescript": "^5.9.3",
81
+ "@fluxus-ui/icons": "^0.3.0"
68
82
  },
69
83
  "peerDependenciesMeta": {
70
84
  "react-native-safe-area-context": {
@@ -75,6 +89,15 @@
75
89
  },
76
90
  "expo-blur": {
77
91
  "optional": true
92
+ },
93
+ "expo-audio": {
94
+ "optional": true
95
+ },
96
+ "@fluxus-ui/icons": {
97
+ "optional": true
98
+ },
99
+ "expo-haptics": {
100
+ "optional": true
78
101
  }
79
102
  },
80
103
  "react-native-builder-bob": {
@@ -0,0 +1,106 @@
1
+ /**
2
+ * What plays a sound: a round button, how far it is and the time. It plays nothing by itself: the app, or
3
+ * `@fluxus-ui/native/audio`, tells it where the sound is. The triangle and the bars are drawn with edges,
4
+ * and give way to each other without moving anything else. (SPEC §15.10)
5
+ */
6
+ import { useEffect } from 'react';
7
+ import { ActivityIndicator, Pressable, View, type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
8
+ import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
9
+ import { fill } from './layout';
10
+ import { spring } from './motion';
11
+ import { usePress } from './press';
12
+ import { Progress } from './Progress';
13
+ import { Slider } from './Slider';
14
+ import { Text } from './Text';
15
+ import { useTheme } from './theme';
16
+
17
+ export interface AudioPlayerProps extends Omit<ViewProps, 'children' | 'style'> {
18
+ playing: boolean;
19
+ /** Where it is, in seconds. */
20
+ position: number;
21
+ /** How long it is, in seconds; 0 while it is not known. */
22
+ duration: number;
23
+ onToggle: () => void;
24
+ /** With it, the bar is dragged to go to a second; without, it only shows how far it is. */
25
+ onSeek?: (seconds: number) => void;
26
+ /** The names of the button, and of the bar. Default of the bar: 'Position'. */
27
+ labels: { play: string; pause: string; position?: string };
28
+ /** It was asked to play and the sound is not here yet: the button waits, and still takes the press that calls it off. */
29
+ loading?: boolean;
30
+ /** Nothing to play yet. */
31
+ disabled?: boolean;
32
+ style?: StyleProp<ViewStyle>;
33
+ }
34
+
35
+ /** Seconds as `1:04`. */
36
+ export const clock = (seconds: number): string => {
37
+ const whole = Math.max(0, Math.floor(seconds));
38
+ return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, '0')}`;
39
+ };
40
+
41
+ /** What the bar asks for where its row is as wide as what it holds (a bubble); it gives it up where there is no room. */
42
+ const BAR = 160;
43
+
44
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
45
+
46
+ export function AudioPlayer({ playing, position, duration, onToggle, onSeek, labels, loading = false, disabled = false, style, ...rest }: AudioPlayerProps) {
47
+ const theme = useTheme();
48
+ const press = usePress({});
49
+ const on = useSharedValue(playing ? 1 : 0);
50
+ useEffect(() => {
51
+ on.value = spring(playing ? 1 : 0, 'snappy');
52
+ }, [playing, on]);
53
+ const wait = useSharedValue(loading ? 1 : 0);
54
+ useEffect(() => {
55
+ wait.value = spring(loading ? 1 : 0, 'snappy');
56
+ }, [loading, wait]);
57
+ // While it waits, neither mark is seen: the spinner is where they were.
58
+ const play = useAnimatedStyle(() => ({ opacity: (1 - on.value) * (1 - wait.value), transform: [{ scale: 1 - 0.4 * on.value }] }));
59
+ const pause = useAnimatedStyle(() => ({ opacity: on.value * (1 - wait.value), transform: [{ scale: 0.6 + 0.4 * on.value }] }));
60
+ const waiting = useAnimatedStyle(() => ({ opacity: wait.value }));
61
+ const side = theme.size['target.min'];
62
+ const ink = theme.color['button.fg'];
63
+ const unit = theme.size['space.1'];
64
+ const name = labels.position ?? 'Position';
65
+ const told = `${clock(position)} / ${clock(duration)}`;
66
+ const at = Math.min(position, duration);
67
+ return (
68
+ <View {...rest} style={[{ flexDirection: 'row', alignItems: 'center', gap: theme.size['space.3'], opacity: disabled ? 0.5 : 1 }, style]}>
69
+ <AnimatedPressable
70
+ role="button"
71
+ aria-label={playing ? labels.pause : labels.play}
72
+ aria-disabled={disabled}
73
+ aria-busy={loading}
74
+ disabled={disabled}
75
+ onPress={onToggle}
76
+ onPressIn={press.onPressIn}
77
+ onPressOut={press.onPressOut}
78
+ style={[{ width: side, height: side, borderRadius: side / 2, alignItems: 'center', justifyContent: 'center', backgroundColor: theme.color['button.bg'] }, press.style]}
79
+ >
80
+ {/* The triangle: three edges of a box with no size. It leans a little to the right, where its weight is. */}
81
+ <Animated.View style={[{ position: 'absolute', marginLeft: unit / 2, width: 0, height: 0, borderTopWidth: unit * 1.75, borderBottomWidth: unit * 1.75, borderLeftWidth: unit * 2.75, borderTopColor: 'transparent', borderBottomColor: 'transparent', borderLeftColor: ink }, play]} />
82
+ <Animated.View style={[{ position: 'absolute', flexDirection: 'row', gap: unit }, pause]}>
83
+ <View style={{ width: unit, height: unit * 3.5, borderRadius: 1, backgroundColor: ink }} />
84
+ <View style={{ width: unit, height: unit * 3.5, borderRadius: 1, backgroundColor: ink }} />
85
+ </Animated.View>
86
+ {/* The spinner of the system, only while it waits: a thread has many players. */}
87
+ {loading && (
88
+ <Animated.View aria-hidden importantForAccessibility="no-hide-descendants" style={[{ position: 'absolute' }, waiting]}>
89
+ <ActivityIndicator size="small" color={ink} />
90
+ </Animated.View>
91
+ )}
92
+ </AnimatedPressable>
93
+ <View style={[fill, { width: BAR, minWidth: theme.size['space.16'] }]}>
94
+ {onSeek && duration > 0 ? (
95
+ <Slider label={name} min={0} max={Math.max(1, Math.floor(duration))} step={1} value={Math.floor(at)} onChange={onSeek} valueText={() => told} disabled={disabled} />
96
+ ) : (
97
+ <Progress label={name} value={at} max={duration || 1} />
98
+ )}
99
+ </View>
100
+ {/* Figures of one width, and room for the longest: the time does not push the bar as it runs. */}
101
+ <Text variant="caption" tone="muted" aria-hidden={!!onSeek && duration > 0} style={{ fontVariant: ['tabular-nums'], minWidth: theme.size['space.16'], textAlign: 'right' }}>
102
+ {told}
103
+ </Text>
104
+ </View>
105
+ );
106
+ }
package/src/Bubble.tsx ADDED
@@ -0,0 +1,112 @@
1
+ /**
2
+ * A message of a chat: on the side of who wrote it, never wider than most of the screen, with who above and
3
+ * when below. A plain view: a chat has many, and one that arrives is wrapped in `Appear`. With `status`, one's
4
+ * own says how it went: sending, sent (a tick is written), read (a second one), failed (it shakes once).
5
+ * (SPEC §15.10, §15.14)
6
+ */
7
+ import { useEffect, useRef, type ReactNode } from 'react';
8
+ import { View, type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
9
+ import Animated, { useAnimatedStyle, useReducedMotion, useSharedValue } from 'react-native-reanimated';
10
+ import { motion } from './generated/tokens';
11
+ import { BANG, Mark, TICK } from './marks';
12
+ import { withFluxSpring } from './motion';
13
+ import { Text } from './Text';
14
+ import { useTheme } from './theme';
15
+
16
+ export type BubbleStatus = 'sending' | 'sent' | 'read' | 'failed';
17
+
18
+ export interface BubbleProps extends Omit<ViewProps, 'style'> {
19
+ /** 'start': what arrives. 'end': one's own. */
20
+ side: 'start' | 'end';
21
+ /** Who wrote it, above. */
22
+ author?: string;
23
+ /** When, or whether it was read, below. Say the status in it too: the mark is not read out. */
24
+ meta?: string;
25
+ /** How a message of one's own went. With it, the bubble is animated; without, a plain view. */
26
+ status?: BubbleStatus;
27
+ children?: ReactNode;
28
+ style?: StyleProp<ViewStyle>;
29
+ }
30
+
31
+ /** How much of the width it may take. */
32
+ const WIDEST = '88%';
33
+
34
+ export function Bubble({ side, author, meta, status, children, style, ...rest }: BubbleProps) {
35
+ const theme = useTheme();
36
+ const own = side === 'end';
37
+ const radius = theme.size['radius.card'];
38
+ const corner = theme.size['radius.1'];
39
+ const box: StyleProp<ViewStyle> = [
40
+ { alignSelf: own ? 'flex-end' : 'flex-start', maxWidth: WIDEST, gap: theme.size['space.1'], padding: theme.size['space.3'], borderWidth: 1, borderRadius: radius },
41
+ // The corner of its side is tighter: it says whose it is without a tail.
42
+ own ? { borderBottomEndRadius: corner, borderColor: 'transparent', backgroundColor: theme.color['accent.subtle'] } : { borderBottomStartRadius: corner, borderColor: theme.color['border.default'], backgroundColor: theme.color['surface.raised'] },
43
+ style,
44
+ ];
45
+ const body = (
46
+ <>
47
+ {author !== undefined && (
48
+ <Text variant="caption" weight="medium" tone="muted">
49
+ {author}
50
+ </Text>
51
+ )}
52
+ {typeof children === 'string' ? <Text>{children}</Text> : children}
53
+ </>
54
+ );
55
+ if (status === undefined) {
56
+ return (
57
+ <View {...rest} style={box}>
58
+ {body}
59
+ {meta !== undefined && (
60
+ <Text variant="caption" tone="muted" style={{ alignSelf: 'flex-end' }}>
61
+ {meta}
62
+ </Text>
63
+ )}
64
+ </View>
65
+ );
66
+ }
67
+ return (
68
+ <Shaken {...rest} status={status} style={box}>
69
+ {body}
70
+ <View style={{ alignSelf: 'flex-end', flexDirection: 'row', alignItems: 'center', gap: theme.size['space.1'] }}>
71
+ {meta !== undefined && (
72
+ <Text variant="caption" tone="muted">
73
+ {meta}
74
+ </Text>
75
+ )}
76
+ <StatusMark status={status} />
77
+ </View>
78
+ </Shaken>
79
+ );
80
+ }
81
+
82
+ /** It shakes once when it fails: pushed sideways, brought back by the bouncy spring. */
83
+ function Shaken({ status, style, children, ...rest }: ViewProps & { status: BubbleStatus }) {
84
+ const reduced = useReducedMotion();
85
+ const x = useSharedValue(0);
86
+ const was = useRef(status);
87
+ useEffect(() => {
88
+ if (status === 'failed' && was.current !== 'failed' && !reduced) x.value = withFluxSpring(0, { ...motion.spring.bouncy, velocity: 160 });
89
+ was.current = status;
90
+ }, [status, reduced, x]);
91
+ const shake = useAnimatedStyle(() => ({ transform: [{ translateX: x.value }] }));
92
+ return (
93
+ <Animated.View {...rest} style={[style, shake]}>
94
+ {children}
95
+ </Animated.View>
96
+ );
97
+ }
98
+
99
+ /** Sending: a ring, still. Sent: a tick is written. Read: a second one. Failed: an exclamation. */
100
+ function StatusMark({ status }: { status: BubbleStatus }) {
101
+ const theme = useTheme();
102
+ const side = theme.size['icon.sm'];
103
+ const ink = theme.color['text.muted'];
104
+ return (
105
+ <View style={{ width: side * 1.4, height: side }}>
106
+ {status === 'sending' && <View testID="status-sending" style={{ position: 'absolute', left: side * 0.2, top: side * 0.2, width: side * 0.6, height: side * 0.6, borderRadius: side, borderWidth: 1.5, borderColor: ink }} />}
107
+ <Mark testID="status-sent" segments={TICK} shown={status === 'sent' || status === 'read'} size={side} color={ink} style={{ position: 'absolute' }} />
108
+ <Mark testID="status-read" segments={TICK} shown={status === 'read'} size={side} color={ink} style={{ position: 'absolute', left: side * 0.4 }} />
109
+ <Mark testID="status-failed" segments={BANG} shown={status === 'failed'} size={side} color={theme.color['state.danger.text']} style={{ position: 'absolute', left: side * 0.2 }} />
110
+ </View>
111
+ );
112
+ }
package/src/Button.tsx CHANGED
@@ -1,6 +1,11 @@
1
- import { useState, type ComponentRef, type ReactNode, type Ref } from 'react';
1
+ import { useEffect, useRef, useState, type ComponentRef, type ReactNode, type Ref } from 'react';
2
2
  import { ActivityIndicator, Pressable, type GestureResponderEvent, type PressableProps, type StyleProp, type ViewStyle } from 'react-native';
3
- import Animated from 'react-native-reanimated';
3
+ import Animated, { useAnimatedStyle, useReducedMotion, useSharedValue, withDelay } from 'react-native-reanimated';
4
+ import { feel } from './feel';
5
+ import { motion } from './generated/tokens';
6
+ import { IconHostProvider, isOn, useHostFor } from './icon-host';
7
+ import { Mark, TICK } from './marks';
8
+ import { ms, timing, withFluxSpring } from './motion';
4
9
  import { useAsyncPress, usePending } from './pending';
5
10
  import { presence } from './presence';
6
11
  import { usePress } from './press';
@@ -20,6 +25,8 @@ export interface ButtonProps extends Omit<PressableProps, 'children' | 'style' |
20
25
  size?: ButtonSize;
21
26
  /** It is working: it shows a spinner, says so to a screen reader and takes no press. */
22
27
  busy?: boolean;
28
+ /** When what its press returns is fulfilled, a tick is drawn where its text was, and the text comes back; if it fails, the text shakes once. */
29
+ feedback?: boolean;
23
30
  style?: StyleProp<ViewStyle>;
24
31
  ref?: Ref<ComponentRef<typeof Pressable>>;
25
32
  }
@@ -57,13 +64,16 @@ export function buttonStyle(theme: Theme, variant: ButtonVariant = 'secondary',
57
64
  }
58
65
 
59
66
  /** A button with the variants and sizes of the web; pressed, it gives on the snappy spring. */
60
- export function Button({ children, variant = 'secondary', size = 'md', busy = false, disabled, style, onPress, onPressIn, onPressOut, onLayout, onFocus, onBlur, ...rest }: ButtonProps) {
67
+ export function Button({ children, variant = 'secondary', size = 'md', busy = false, feedback = false, disabled, style, onPress, onPressIn, onPressOut, onLayout, onFocus, onBlur, ...rest }: ButtonProps) {
61
68
  const theme = useTheme();
62
69
  const { box, ink, slop } = buttonStyle(theme, variant, size);
63
- const [waiting, run, failed] = useAsyncPress(onPress);
70
+ const answer = useFeedback(feedback);
71
+ const [waiting, run, failed] = useAsyncPress(onPress, answer.ended);
64
72
  const pending = usePending(waiting, ink, failed);
65
73
  const off = !!disabled || busy || waiting;
66
74
  const press = usePress({ onPressIn, onPressOut });
75
+ // An icon inside is open with the button, and is pushed when it is pressed.
76
+ const icons = useHostFor(isOn(rest), ink);
67
77
  const { layout, ...coming } = presence();
68
78
  // With a keyboard or a remote: a ring around it, drawn outside so that nothing moves.
69
79
  const [focused, setFocused] = useState(false);
@@ -76,7 +86,10 @@ export function Button({ children, variant = 'secondary', size = 'md', busy = fa
76
86
  disabled={off}
77
87
  aria-disabled={off}
78
88
  aria-busy={busy || waiting}
79
- onPress={run}
89
+ onPress={(e) => {
90
+ icons.push('press');
91
+ run(e);
92
+ }}
80
93
  onLayout={(e) => {
81
94
  pending.onLayout(e);
82
95
  onLayout?.(e);
@@ -102,16 +115,54 @@ export function Button({ children, variant = 'secondary', size = 'md', busy = fa
102
115
  <ActivityIndicator size="small" color={ink} />
103
116
  </Animated.View>
104
117
  )}
105
- {/* The label makes room for the spinner by gliding, not by jumping. */}
106
- <Animated.View layout={layout}>
107
- {typeof children === 'string' ? (
108
- <Text variant="label" style={{ color: ink }}>
109
- {children}
110
- </Text>
111
- ) : (
112
- children
113
- )}
118
+ {/* The label makes room for the spinner by gliding, not by jumping; an icon and its text sit in a row. */}
119
+ {feedback && <Mark testID="feedback" segments={TICK} shown={answer.done} size={theme.size['icon.md']} color={ink} style={{ position: 'absolute' }} />}
120
+ <Animated.View layout={layout} style={[{ flexDirection: 'row', alignItems: 'center', gap: theme.size['space.2'] }, feedback ? answer.label : null]}>
121
+ <IconHostProvider host={icons.host}>
122
+ {typeof children === 'string' ? (
123
+ <Text variant="label" style={{ color: ink }}>
124
+ {children}
125
+ </Text>
126
+ ) : (
127
+ children
128
+ )}
129
+ </IconHostProvider>
114
130
  </Animated.View>
115
131
  </AnimatedPressable>
116
132
  );
117
133
  }
134
+
135
+ /**
136
+ * Done: the text goes (fast), then a tick is drawn (snappy) and stays for `slow`; it is unwritten (snappy) and the
137
+ * text comes back (fast, after `normal`). Failed:
138
+ * the text is pushed sideways and the bouncy spring brings it back, once. (SPEC §15.14)
139
+ */
140
+ function useFeedback(on: boolean) {
141
+ const reduced = useReducedMotion();
142
+ const [done, setDone] = useState(false);
143
+ const seen = useSharedValue(1);
144
+ const x = useSharedValue(0);
145
+ const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
146
+ useEffect(() => () => clearTimeout(timer.current), []);
147
+ const ended = (failed: boolean): void => {
148
+ if (!on) return;
149
+ if (failed) {
150
+ feel('error');
151
+ if (!reduced) x.value = withFluxSpring(0, { ...motion.spring.bouncy, velocity: 160 });
152
+ return;
153
+ }
154
+ feel('success');
155
+ seen.value = timing(0, 'fast');
156
+ clearTimeout(timer.current);
157
+ // The tick is written once the text has gone, and unwritten before it comes back: never both at once.
158
+ timer.current = setTimeout(() => {
159
+ setDone(true);
160
+ timer.current = setTimeout(() => {
161
+ setDone(false);
162
+ seen.value = withDelay(ms(motion.duration.normal), timing(1, 'fast'));
163
+ }, ms(motion.duration.normal + motion.duration.slow));
164
+ }, ms(motion.duration.fast));
165
+ };
166
+ const label = useAnimatedStyle(() => ({ opacity: seen.value, transform: [{ translateX: x.value }] }));
167
+ return { done, label, ended };
168
+ }