@thewhileloop/whileui 2.0.0 → 4.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 (74) hide show
  1. package/README.md +135 -70
  2. package/dist/blocks/commerce/metric-card.d.ts +9 -29
  3. package/dist/blocks/datepicker/date-range-picker-modal.d.ts +1 -1
  4. package/dist/blocks/datepicker/date-range-picker-modal.js +6 -14
  5. package/dist/blocks/datepicker/datepicker-modal.d.ts +1 -1
  6. package/dist/blocks/datepicker/datepicker-modal.js +6 -12
  7. package/dist/blocks/datepicker/index.d.ts +1 -0
  8. package/dist/blocks/datepicker/index.js +1 -0
  9. package/dist/blocks/datepicker/time-picker-modal.d.ts +43 -0
  10. package/dist/blocks/datepicker/time-picker-modal.js +187 -0
  11. package/dist/blocks/layout/smart-input.d.ts +3 -2
  12. package/dist/blocks/layout/smart-input.js +33 -18
  13. package/dist/blocks/media/smart-image.d.ts +39 -98
  14. package/dist/blocks/navigation/drawer-menu.js +88 -72
  15. package/dist/components/alert/alert.d.ts +23 -55
  16. package/dist/components/alert/alert.js +1 -1
  17. package/dist/components/alert-dialog/alert-dialog.js +1 -4
  18. package/dist/components/avatar/avatar.d.ts +18 -45
  19. package/dist/components/avatar/avatar.js +1 -1
  20. package/dist/components/badge/badge.d.ts +84 -212
  21. package/dist/components/button/button.d.ts +69 -188
  22. package/dist/components/card/card.d.ts +29 -73
  23. package/dist/components/card/card.js +1 -1
  24. package/dist/components/container/container.d.ts +24 -96
  25. package/dist/components/data-row/data-row.d.ts +18 -38
  26. package/dist/components/data-row/data-row.js +1 -1
  27. package/dist/components/fab/fab.d.ts +87 -0
  28. package/dist/components/fab/fab.js +59 -0
  29. package/dist/components/fab/index.d.ts +1 -0
  30. package/dist/components/fab/index.js +1 -0
  31. package/dist/components/form-field/form-field.d.ts +31 -87
  32. package/dist/components/form-field/form-field.js +1 -1
  33. package/dist/components/hover-card/hover-card.d.ts +3 -2
  34. package/dist/components/input/input.d.ts +18 -31
  35. package/dist/components/input/input.js +20 -8
  36. package/dist/components/label/label.d.ts +3 -3
  37. package/dist/components/labeled-field/labeled-field.d.ts +3 -2
  38. package/dist/components/numeric-input/numeric-input.d.ts +27 -82
  39. package/dist/components/numeric-input/numeric-input.js +79 -80
  40. package/dist/components/otp-input/otp-input.d.ts +21 -65
  41. package/dist/components/popover/popover.d.ts +4 -3
  42. package/dist/components/pressable/pressable.d.ts +3 -3
  43. package/dist/components/progress/progress.d.ts +15 -39
  44. package/dist/components/row/row.d.ts +63 -163
  45. package/dist/components/segmented-control/segmented-control.d.ts +69 -241
  46. package/dist/components/select/select.d.ts +10 -22
  47. package/dist/components/select/select.js +2 -7
  48. package/dist/components/separator/separator.d.ts +3 -3
  49. package/dist/components/skeleton/skeleton.d.ts +9 -29
  50. package/dist/components/spinner/spinner.d.ts +12 -36
  51. package/dist/components/stack/stack.d.ts +63 -163
  52. package/dist/components/tabs/tabs.d.ts +9 -29
  53. package/dist/components/text/text.d.ts +51 -131
  54. package/dist/components/textarea/textarea.d.ts +15 -39
  55. package/dist/components/textarea/textarea.js +3 -3
  56. package/dist/components/toast/toast.d.ts +12 -36
  57. package/dist/components/toggle/toggle.d.ts +42 -138
  58. package/dist/components/toggle-group/toggle-group.d.ts +42 -138
  59. package/dist/components/tooltip/tooltip.d.ts +3 -2
  60. package/dist/components/view/view.d.ts +3 -3
  61. package/dist/index.d.ts +2 -1
  62. package/dist/index.js +2 -1
  63. package/dist/lib/focus-ring.d.ts +10 -0
  64. package/dist/lib/focus-ring.js +10 -0
  65. package/dist/lib/interaction-tokens.d.ts +24 -1
  66. package/dist/lib/interaction-tokens.js +26 -44
  67. package/dist/lib/motion-policy.js +2 -2
  68. package/dist/lib/ref-types.d.ts +3 -0
  69. package/dist/lib/ref-types.js +1 -0
  70. package/dist/lib/theme-bridge.d.ts +4 -2
  71. package/dist/lib/theme-bridge.js +13 -9
  72. package/dist/lib/theme-presets.d.ts +26 -0
  73. package/dist/lib/theme-presets.js +28 -0
  74. package/package.json +29 -28
@@ -3,174 +3,78 @@ import { type PressableProps, type TextProps } from 'react-native';
3
3
  import { type VariantProps } from '../../lib/tv';
4
4
  declare const toggleVariants: import("tailwind-variants").TVReturnType<{
5
5
  variant: {
6
- default: string;
7
- outline: string;
6
+ default: "bg-transparent";
7
+ outline: "border border-input bg-transparent";
8
8
  };
9
9
  size: {
10
- default: string;
11
- sm: string;
12
- lg: string;
10
+ default: "";
11
+ sm: "";
12
+ lg: "";
13
13
  };
14
14
  pressed: {
15
- true: string;
16
- false: string;
15
+ true: "bg-accent";
16
+ false: "";
17
17
  };
18
- }, undefined, "inline-flex items-center justify-center active:bg-accent", import("tailwind-variants/dist/config.js").TVConfig<{
18
+ }, undefined, "inline-flex items-center justify-center active:bg-accent", {
19
19
  variant: {
20
- default: string;
21
- outline: string;
20
+ default: "bg-transparent";
21
+ outline: "border border-input bg-transparent";
22
22
  };
23
23
  size: {
24
- default: string;
25
- sm: string;
26
- lg: string;
24
+ default: "";
25
+ sm: "";
26
+ lg: "";
27
27
  };
28
28
  pressed: {
29
- true: string;
30
- false: string;
29
+ true: "bg-accent";
30
+ false: "";
31
31
  };
32
- }, {
32
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
33
33
  variant: {
34
- default: string;
35
- outline: string;
34
+ default: "bg-transparent";
35
+ outline: "border border-input bg-transparent";
36
36
  };
37
37
  size: {
38
- default: string;
39
- sm: string;
40
- lg: string;
38
+ default: "";
39
+ sm: "";
40
+ lg: "";
41
41
  };
42
42
  pressed: {
43
- true: string;
44
- false: string;
43
+ true: "bg-accent";
44
+ false: "";
45
45
  };
46
- }>, {
47
- variant: {
48
- default: string;
49
- outline: string;
50
- };
51
- size: {
52
- default: string;
53
- sm: string;
54
- lg: string;
55
- };
56
- pressed: {
57
- true: string;
58
- false: string;
59
- };
60
- }, undefined, import("tailwind-variants").TVReturnType<{
61
- variant: {
62
- default: string;
63
- outline: string;
64
- };
65
- size: {
66
- default: string;
67
- sm: string;
68
- lg: string;
69
- };
70
- pressed: {
71
- true: string;
72
- false: string;
73
- };
74
- }, undefined, "inline-flex items-center justify-center active:bg-accent", import("tailwind-variants/dist/config.js").TVConfig<{
75
- variant: {
76
- default: string;
77
- outline: string;
78
- };
79
- size: {
80
- default: string;
81
- sm: string;
82
- lg: string;
83
- };
84
- pressed: {
85
- true: string;
86
- false: string;
87
- };
88
- }, {
89
- variant: {
90
- default: string;
91
- outline: string;
92
- };
93
- size: {
94
- default: string;
95
- sm: string;
96
- lg: string;
97
- };
98
- pressed: {
99
- true: string;
100
- false: string;
101
- };
102
- }>, unknown, unknown, undefined>>;
46
+ }, undefined>>;
103
47
  declare const toggleTextVariants: import("tailwind-variants").TVReturnType<{
104
48
  pressed: {
105
- true: string;
106
- false: string;
107
- };
108
- size: {
109
- default: string;
110
- sm: string;
111
- lg: string;
112
- };
113
- }, undefined, "font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
114
- pressed: {
115
- true: string;
116
- false: string;
117
- };
118
- size: {
119
- default: string;
120
- sm: string;
121
- lg: string;
122
- };
123
- }, {
124
- pressed: {
125
- true: string;
126
- false: string;
127
- };
128
- size: {
129
- default: string;
130
- sm: string;
131
- lg: string;
132
- };
133
- }>, {
134
- pressed: {
135
- true: string;
136
- false: string;
137
- };
138
- size: {
139
- default: string;
140
- sm: string;
141
- lg: string;
142
- };
143
- }, undefined, import("tailwind-variants").TVReturnType<{
144
- pressed: {
145
- true: string;
146
- false: string;
49
+ true: "text-accent-foreground";
50
+ false: "text-muted-foreground";
147
51
  };
148
52
  size: {
149
- default: string;
150
- sm: string;
151
- lg: string;
53
+ default: "";
54
+ sm: "";
55
+ lg: "";
152
56
  };
153
- }, undefined, "font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
57
+ }, undefined, "font-medium", {
154
58
  pressed: {
155
- true: string;
156
- false: string;
59
+ true: "text-accent-foreground";
60
+ false: "text-muted-foreground";
157
61
  };
158
62
  size: {
159
- default: string;
160
- sm: string;
161
- lg: string;
63
+ default: "";
64
+ sm: "";
65
+ lg: "";
162
66
  };
163
- }, {
67
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
164
68
  pressed: {
165
- true: string;
166
- false: string;
69
+ true: "text-accent-foreground";
70
+ false: "text-muted-foreground";
167
71
  };
168
72
  size: {
169
- default: string;
170
- sm: string;
171
- lg: string;
73
+ default: "";
74
+ sm: "";
75
+ lg: "";
172
76
  };
173
- }>, unknown, unknown, undefined>>;
77
+ }, undefined>>;
174
78
  export interface ToggleProps extends Omit<PressableProps, 'children'> {
175
79
  pressed?: boolean;
176
80
  defaultPressed?: boolean;
@@ -3,174 +3,78 @@ import { type ViewProps, type PressableProps, type TextProps } from 'react-nativ
3
3
  type ToggleGroupType = 'single' | 'multiple';
4
4
  declare const toggleGroupItemVariants: import("tailwind-variants").TVReturnType<{
5
5
  variant: {
6
- default: string;
7
- outline: string;
6
+ default: "bg-transparent";
7
+ outline: "border border-input bg-transparent";
8
8
  };
9
9
  size: {
10
- default: string;
11
- sm: string;
12
- lg: string;
10
+ default: "";
11
+ sm: "";
12
+ lg: "";
13
13
  };
14
14
  pressed: {
15
- true: string;
16
- false: string;
15
+ true: "bg-accent";
16
+ false: "";
17
17
  };
18
- }, undefined, "inline-flex items-center justify-center", import("tailwind-variants/dist/config.js").TVConfig<{
18
+ }, undefined, "inline-flex items-center justify-center", {
19
19
  variant: {
20
- default: string;
21
- outline: string;
20
+ default: "bg-transparent";
21
+ outline: "border border-input bg-transparent";
22
22
  };
23
23
  size: {
24
- default: string;
25
- sm: string;
26
- lg: string;
24
+ default: "";
25
+ sm: "";
26
+ lg: "";
27
27
  };
28
28
  pressed: {
29
- true: string;
30
- false: string;
29
+ true: "bg-accent";
30
+ false: "";
31
31
  };
32
- }, {
32
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
33
33
  variant: {
34
- default: string;
35
- outline: string;
34
+ default: "bg-transparent";
35
+ outline: "border border-input bg-transparent";
36
36
  };
37
37
  size: {
38
- default: string;
39
- sm: string;
40
- lg: string;
38
+ default: "";
39
+ sm: "";
40
+ lg: "";
41
41
  };
42
42
  pressed: {
43
- true: string;
44
- false: string;
43
+ true: "bg-accent";
44
+ false: "";
45
45
  };
46
- }>, {
47
- variant: {
48
- default: string;
49
- outline: string;
50
- };
51
- size: {
52
- default: string;
53
- sm: string;
54
- lg: string;
55
- };
56
- pressed: {
57
- true: string;
58
- false: string;
59
- };
60
- }, undefined, import("tailwind-variants").TVReturnType<{
61
- variant: {
62
- default: string;
63
- outline: string;
64
- };
65
- size: {
66
- default: string;
67
- sm: string;
68
- lg: string;
69
- };
70
- pressed: {
71
- true: string;
72
- false: string;
73
- };
74
- }, undefined, "inline-flex items-center justify-center", import("tailwind-variants/dist/config.js").TVConfig<{
75
- variant: {
76
- default: string;
77
- outline: string;
78
- };
79
- size: {
80
- default: string;
81
- sm: string;
82
- lg: string;
83
- };
84
- pressed: {
85
- true: string;
86
- false: string;
87
- };
88
- }, {
89
- variant: {
90
- default: string;
91
- outline: string;
92
- };
93
- size: {
94
- default: string;
95
- sm: string;
96
- lg: string;
97
- };
98
- pressed: {
99
- true: string;
100
- false: string;
101
- };
102
- }>, unknown, unknown, undefined>>;
46
+ }, undefined>>;
103
47
  declare const toggleGroupItemTextVariants: import("tailwind-variants").TVReturnType<{
104
48
  pressed: {
105
- true: string;
106
- false: string;
107
- };
108
- size: {
109
- default: string;
110
- sm: string;
111
- lg: string;
112
- };
113
- }, undefined, "font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
114
- pressed: {
115
- true: string;
116
- false: string;
117
- };
118
- size: {
119
- default: string;
120
- sm: string;
121
- lg: string;
122
- };
123
- }, {
124
- pressed: {
125
- true: string;
126
- false: string;
127
- };
128
- size: {
129
- default: string;
130
- sm: string;
131
- lg: string;
132
- };
133
- }>, {
134
- pressed: {
135
- true: string;
136
- false: string;
137
- };
138
- size: {
139
- default: string;
140
- sm: string;
141
- lg: string;
142
- };
143
- }, undefined, import("tailwind-variants").TVReturnType<{
144
- pressed: {
145
- true: string;
146
- false: string;
49
+ true: "text-accent-foreground";
50
+ false: "text-muted-foreground";
147
51
  };
148
52
  size: {
149
- default: string;
150
- sm: string;
151
- lg: string;
53
+ default: "";
54
+ sm: "";
55
+ lg: "";
152
56
  };
153
- }, undefined, "font-medium", import("tailwind-variants/dist/config.js").TVConfig<{
57
+ }, undefined, "font-medium", {
154
58
  pressed: {
155
- true: string;
156
- false: string;
59
+ true: "text-accent-foreground";
60
+ false: "text-muted-foreground";
157
61
  };
158
62
  size: {
159
- default: string;
160
- sm: string;
161
- lg: string;
63
+ default: "";
64
+ sm: "";
65
+ lg: "";
162
66
  };
163
- }, {
67
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
164
68
  pressed: {
165
- true: string;
166
- false: string;
69
+ true: "text-accent-foreground";
70
+ false: "text-muted-foreground";
167
71
  };
168
72
  size: {
169
- default: string;
170
- sm: string;
171
- lg: string;
73
+ default: "";
74
+ sm: "";
75
+ lg: "";
172
76
  };
173
- }>, unknown, unknown, undefined>>;
77
+ }, undefined>>;
174
78
  export interface ToggleGroupProps extends ViewProps {
175
79
  type?: ToggleGroupType;
176
80
  defaultValue?: string | string[];
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import * as TooltipPrimitive from '@rn-primitives/tooltip';
3
+ import type { ForwardRefComponent } from '../../lib/ref-types';
3
4
  export interface TooltipProps {
4
5
  onOpenChange?: (open: boolean) => void;
5
6
  delayDuration?: number;
@@ -15,6 +16,6 @@ export interface TooltipContentProps extends React.ComponentPropsWithoutRef<type
15
16
  portalHost?: string;
16
17
  }
17
18
  declare function Tooltip({ onOpenChange, delayDuration, skipDelayDuration, disableHoverableContent, children, }: TooltipProps): React.JSX.Element;
18
- declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipTriggerProps & React.RefAttributes<import("@rn-primitives/tooltip").TriggerRef>>;
19
- declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<import("react-native").View>>;
19
+ declare const TooltipTrigger: ForwardRefComponent<TooltipPrimitive.TriggerRef, TooltipTriggerProps>;
20
+ declare const TooltipContent: ForwardRefComponent<TooltipPrimitive.ContentRef, TooltipContentProps>;
20
21
  export { Tooltip, TooltipTrigger, TooltipContent };
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { View as RNView, type ViewProps as RNViewProps } from 'react-native';
1
+ import { type ViewInstance, type ViewProps as RNViewProps } from 'react-native';
2
+ import type { ForwardRefComponent } from '../../lib/ref-types';
3
3
  export interface ViewProps extends RNViewProps {
4
4
  }
5
- declare const View: React.ForwardRefExoticComponent<ViewProps & React.RefAttributes<RNView>>;
5
+ declare const View: ForwardRefComponent<ViewInstance, ViewProps>;
6
6
  export { View };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { PortalHost } from './lib/portal';
7
7
  export { ThemeBridge, applyThemeMode, resolveThemeMode, syncThemeMode, useThemeBridge, type ThemeMode, type ThemeBridgeAdapter, type ThemeBridgeProps, type UseThemeBridgeOptions, type UseThemeBridgeResult, } from './lib/theme-bridge';
8
8
  export { useThemeColors, useThemeTokens, useIconColors, type ThemeColors, } from './lib/theme-colors';
9
9
  export { THEME_TOKEN_SPECS, THEME_TOKEN_GROUPS, WHILEUI_LIGHT_THEME_COLORS, WHILEUI_DARK_THEME_COLORS, type ThemeTokenGroup, type ThemeTokenKey, type ThemeTokenSpec, } from './lib/theme-contract';
10
- export { useInteractionTokens, withInteractivePressableStyle, type InteractionTokens, type InteractivePressableOptions, type PressedVariant, type DisabledVariant, } from './lib/interaction-tokens';
10
+ export { INTERACTION_TOKENS, useInteractionTokens, withInteractivePressableStyle, type InteractionTokens, type InteractivePressableOptions, type PressedVariant, type DisabledVariant, } from './lib/interaction-tokens';
11
11
  export { MotionProvider, useMotionPolicy, type MotionMode, type MotionDuration, type MotionSpring, type MotionSpringConfig, type MotionPolicy, type MotionProviderProps, } from './lib/motion-policy';
12
12
  export { useVisualTokens, type VisualTokens } from './lib/visual-tokens';
13
13
  export { VISUAL_TOKEN_SPECS, VISUAL_TOKEN_GROUPS, type VisualTokenGroup, type VisualTokenKey, type VisualTokenKind, type VisualTokenSpec, } from './lib/visual-token-contract';
@@ -28,6 +28,7 @@ export { OTPInput, otpCellVariants, type OTPInputProps } from './components/otp-
28
28
  export { FormField, FormLabel, FormControl, FormHint, FormMessage, formFieldVariants, formControlVariants, type FormFieldProps, type FormLabelProps, type FormControlProps, type FormHintProps, type FormMessageProps, } from './components/form-field';
29
29
  export { LabeledField, LabeledFieldControl, type LabeledFieldProps, type LabeledFieldControlProps, } from './components/labeled-field';
30
30
  export { Badge, BadgeText, badgeVariants, badgeTextVariants, type BadgeProps, type BadgeTextProps, } from './components/badge';
31
+ export { FAB, FABGroup, fabVariants, type FabProps, type FabGroupProps } from './components/fab';
31
32
  export { Alert, AlertTitle, AlertDescription, alertVariants, type AlertProps, type AlertTitleProps, type AlertDescriptionProps, } from './components/alert';
32
33
  export { Switch, type SwitchProps } from './components/switch';
33
34
  export { Checkbox, type CheckboxProps } from './components/checkbox';
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ export { PortalHost } from './lib/portal';
7
7
  export { ThemeBridge, applyThemeMode, resolveThemeMode, syncThemeMode, useThemeBridge, } from './lib/theme-bridge';
8
8
  export { useThemeColors, useThemeTokens, useIconColors, } from './lib/theme-colors';
9
9
  export { THEME_TOKEN_SPECS, THEME_TOKEN_GROUPS, WHILEUI_LIGHT_THEME_COLORS, WHILEUI_DARK_THEME_COLORS, } from './lib/theme-contract';
10
- export { useInteractionTokens, withInteractivePressableStyle, } from './lib/interaction-tokens';
10
+ export { INTERACTION_TOKENS, useInteractionTokens, withInteractivePressableStyle, } from './lib/interaction-tokens';
11
11
  export { MotionProvider, useMotionPolicy, } from './lib/motion-policy';
12
12
  export { useVisualTokens } from './lib/visual-tokens';
13
13
  export { VISUAL_TOKEN_SPECS, VISUAL_TOKEN_GROUPS, } from './lib/visual-token-contract';
@@ -28,6 +28,7 @@ export { OTPInput, otpCellVariants } from './components/otp-input';
28
28
  export { FormField, FormLabel, FormControl, FormHint, FormMessage, formFieldVariants, formControlVariants, } from './components/form-field';
29
29
  export { LabeledField, LabeledFieldControl, } from './components/labeled-field';
30
30
  export { Badge, BadgeText, badgeVariants, badgeTextVariants, } from './components/badge';
31
+ export { FAB, FABGroup, fabVariants } from './components/fab';
31
32
  export { Alert, AlertTitle, AlertDescription, alertVariants, } from './components/alert';
32
33
  export { Switch } from './components/switch';
33
34
  export { Checkbox } from './components/checkbox';
@@ -23,3 +23,13 @@ export declare const focusRing = "web:outline-none web:focus-visible:ring-2 web:
23
23
  * would be clipped by the parent or collide with a neighbour.
24
24
  */
25
25
  export declare const focusRingInset = "web:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring";
26
+ /**
27
+ * For text fields. Browsers treat every focus on a text field as keyboard focus, so a
28
+ * `:focus-visible` ring fires on a tap too — and an offset ring around a rounded field
29
+ * reads as a second, squarer border. A field shows focus the way the platforms do:
30
+ * its own border takes the ring colour. The class carries the colour; a field whose
31
+ * border lives on a wrapper (`Input`, `NumericInput`) applies it there from focus state.
32
+ */
33
+ export declare const focusField = "web:outline-none web:focus-visible:border-ring";
34
+ /** The wrapper half of `focusField`: the border colour while the inner field has focus. */
35
+ export declare const focusFieldWrapper = "border-ring";
@@ -23,3 +23,13 @@ export const focusRing = 'web:outline-none web:focus-visible:ring-2 web:focus-vi
23
23
  * would be clipped by the parent or collide with a neighbour.
24
24
  */
25
25
  export const focusRingInset = 'web:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring';
26
+ /**
27
+ * For text fields. Browsers treat every focus on a text field as keyboard focus, so a
28
+ * `:focus-visible` ring fires on a tap too — and an offset ring around a rounded field
29
+ * reads as a second, squarer border. A field shows focus the way the platforms do:
30
+ * its own border takes the ring colour. The class carries the colour; a field whose
31
+ * border lives on a wrapper (`Input`, `NumericInput`) applies it there from focus state.
32
+ */
33
+ export const focusField = 'web:outline-none web:focus-visible:border-ring';
34
+ /** The wrapper half of `focusField`: the border colour while the inner field has focus. */
35
+ export const focusFieldWrapper = 'border-ring';
@@ -1,5 +1,28 @@
1
1
  import { type PressableProps } from 'react-native';
2
- /** Motion values used when a `--ui-motion-*` token is absent, and by the provider-less motion policy. */
2
+ /**
3
+ * Press, disabled, and motion timing for the whole package.
4
+ *
5
+ * These are not theme tokens. A generated preset does not emit them, and reading the
6
+ * matching `--ui-*` variables warned in every app on that preset while resolving to
7
+ * these same numbers. One table, no CSS lookup.
8
+ */
9
+ export declare const INTERACTION_TOKENS: {
10
+ readonly pressOpacity: 0.82;
11
+ readonly pressOpacityStrong: 0.92;
12
+ readonly disabledOpacity: 0.46;
13
+ readonly disabledOpacitySoft: 0.56;
14
+ readonly disabledOpacitySubtle: 0.36;
15
+ readonly inactiveOpacity: 0.54;
16
+ readonly motionFast: 140;
17
+ readonly motionNormal: 200;
18
+ readonly motionSlow: 280;
19
+ readonly motionSpringDamping: 20;
20
+ readonly motionSpringStiffness: 260;
21
+ readonly motionSpringMass: 0.8;
22
+ readonly drawerOpenDuration: 260;
23
+ readonly drawerCloseDuration: 180;
24
+ };
25
+ /** Motion slice of {@link INTERACTION_TOKENS}, for the provider-less policy. */
3
26
  export declare const MOTION_TOKEN_DEFAULTS: {
4
27
  readonly motionFast: 140;
5
28
  readonly motionNormal: 200;
@@ -1,55 +1,37 @@
1
- import { useCSSVariable } from 'uniwind';
2
- function parseNumber(value, fallback) {
3
- if (value === undefined || value === null)
4
- return fallback;
5
- const parsed = Number.parseFloat(String(value));
6
- return Number.isFinite(parsed) ? parsed : fallback;
7
- }
8
- function clampOpacity(value) {
9
- return Math.max(0, Math.min(1, value));
10
- }
11
- /** Motion values used when a `--ui-motion-*` token is absent, and by the provider-less motion policy. */
12
- export const MOTION_TOKEN_DEFAULTS = {
1
+ /**
2
+ * Press, disabled, and motion timing for the whole package.
3
+ *
4
+ * These are not theme tokens. A generated preset does not emit them, and reading the
5
+ * matching `--ui-*` variables warned in every app on that preset while resolving to
6
+ * these same numbers. One table, no CSS lookup.
7
+ */
8
+ export const INTERACTION_TOKENS = {
9
+ pressOpacity: 0.82,
10
+ pressOpacityStrong: 0.92,
11
+ disabledOpacity: 0.46,
12
+ disabledOpacitySoft: 0.56,
13
+ disabledOpacitySubtle: 0.36,
14
+ inactiveOpacity: 0.54,
13
15
  motionFast: 140,
14
16
  motionNormal: 200,
15
17
  motionSlow: 280,
16
18
  motionSpringDamping: 20,
17
19
  motionSpringStiffness: 260,
18
20
  motionSpringMass: 0.8,
21
+ drawerOpenDuration: 260,
22
+ drawerCloseDuration: 180,
23
+ };
24
+ /** Motion slice of {@link INTERACTION_TOKENS}, for the provider-less policy. */
25
+ export const MOTION_TOKEN_DEFAULTS = {
26
+ motionFast: INTERACTION_TOKENS.motionFast,
27
+ motionNormal: INTERACTION_TOKENS.motionNormal,
28
+ motionSlow: INTERACTION_TOKENS.motionSlow,
29
+ motionSpringDamping: INTERACTION_TOKENS.motionSpringDamping,
30
+ motionSpringStiffness: INTERACTION_TOKENS.motionSpringStiffness,
31
+ motionSpringMass: INTERACTION_TOKENS.motionSpringMass,
19
32
  };
20
33
  export function useInteractionTokens() {
21
- const [pressOpacity, pressOpacityStrong, disabledOpacity, disabledOpacitySoft, disabledOpacitySubtle, inactiveOpacity, motionFast, motionNormal, motionSlow, motionSpringDamping, motionSpringStiffness, motionSpringMass, drawerOpenDuration, drawerCloseDuration,] = useCSSVariable([
22
- '--ui-press-opacity',
23
- '--ui-press-opacity-strong',
24
- '--ui-disabled-opacity',
25
- '--ui-disabled-opacity-soft',
26
- '--ui-disabled-opacity-subtle',
27
- '--ui-inactive-opacity',
28
- '--ui-motion-fast',
29
- '--ui-motion-normal',
30
- '--ui-motion-slow',
31
- '--ui-motion-spring-damping',
32
- '--ui-motion-spring-stiffness',
33
- '--ui-motion-spring-mass',
34
- '--ui-drawer-open-duration',
35
- '--ui-drawer-close-duration',
36
- ]);
37
- return {
38
- pressOpacity: clampOpacity(parseNumber(pressOpacity, 0.82)),
39
- pressOpacityStrong: clampOpacity(parseNumber(pressOpacityStrong, 0.92)),
40
- disabledOpacity: clampOpacity(parseNumber(disabledOpacity, 0.46)),
41
- disabledOpacitySoft: clampOpacity(parseNumber(disabledOpacitySoft, 0.56)),
42
- disabledOpacitySubtle: clampOpacity(parseNumber(disabledOpacitySubtle, 0.36)),
43
- inactiveOpacity: clampOpacity(parseNumber(inactiveOpacity, 0.54)),
44
- motionFast: Math.max(0, Math.round(parseNumber(motionFast, MOTION_TOKEN_DEFAULTS.motionFast))),
45
- motionNormal: Math.max(0, Math.round(parseNumber(motionNormal, MOTION_TOKEN_DEFAULTS.motionNormal))),
46
- motionSlow: Math.max(0, Math.round(parseNumber(motionSlow, MOTION_TOKEN_DEFAULTS.motionSlow))),
47
- motionSpringDamping: Math.max(0, parseNumber(motionSpringDamping, MOTION_TOKEN_DEFAULTS.motionSpringDamping)),
48
- motionSpringStiffness: Math.max(0, parseNumber(motionSpringStiffness, MOTION_TOKEN_DEFAULTS.motionSpringStiffness)),
49
- motionSpringMass: Math.max(0.01, parseNumber(motionSpringMass, MOTION_TOKEN_DEFAULTS.motionSpringMass)),
50
- drawerOpenDuration: Math.max(0, Math.round(parseNumber(drawerOpenDuration, 260))),
51
- drawerCloseDuration: Math.max(0, Math.round(parseNumber(drawerCloseDuration, 180))),
52
- };
34
+ return INTERACTION_TOKENS;
53
35
  }
54
36
  function resolveDisabledOpacity(tokens, variant) {
55
37
  if (variant === 'none')
@@ -4,8 +4,8 @@ import { AccessibilityInfo } from 'react-native';
4
4
  import { ReduceMotion, useReducedMotion } from 'react-native-reanimated';
5
5
  import { MOTION_TOKEN_DEFAULTS, useInteractionTokens } from './interaction-tokens';
6
6
  // Without a provider, components still render and Reanimated still follows the system
7
- // setting. Only `--ui-motion-*` overrides and the non-Reanimated reduced-motion paths
8
- // need `MotionProvider` at the root.
7
+ // setting. The provider is what switches the non-Reanimated paths to reduced or
8
+ // disabled motion. Durations and the spring come from `INTERACTION_TOKENS` either way.
9
9
  const DEFAULT_MOTION_POLICY = {
10
10
  mode: 'system',
11
11
  reduceMotion: false,
@@ -0,0 +1,3 @@
1
+ import type React from 'react';
2
+ /** A named public shape for ref-forwarding components under React Native's Strict API. */
3
+ export type ForwardRefComponent<TInstance, TProps> = React.ForwardRefExoticComponent<React.PropsWithoutRef<TProps> & React.RefAttributes<TInstance>>;
@@ -0,0 +1 @@
1
+ export {};