panelui-native 0.14.0 → 0.19.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.
- package/README.md +2 -0
- package/lib/module/components/bottom-sheet/index.js +38 -10
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/checkbox/index.js +24 -11
- package/lib/module/components/checkbox/index.js.map +1 -1
- package/lib/module/components/direction/index.js +86 -0
- package/lib/module/components/direction/index.js.map +1 -0
- package/lib/module/components/field/index.js +337 -0
- package/lib/module/components/field/index.js.map +1 -0
- package/lib/module/components/flow/flow-paths.js +378 -0
- package/lib/module/components/flow/flow-paths.js.map +1 -0
- package/lib/module/components/flow/index.js +1598 -0
- package/lib/module/components/flow/index.js.map +1 -0
- package/lib/module/components/form/index.js +77 -0
- package/lib/module/components/form/index.js.map +1 -0
- package/lib/module/components/form/use-field.js +50 -0
- package/lib/module/components/form/use-field.js.map +1 -0
- package/lib/module/components/form/use-form.js +217 -0
- package/lib/module/components/form/use-form.js.map +1 -0
- package/lib/module/components/frame/index.js +124 -22
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/message/index.js +16 -1
- package/lib/module/components/message/index.js.map +1 -1
- package/lib/module/components/otp-input/index.js +303 -0
- package/lib/module/components/otp-input/index.js.map +1 -0
- package/lib/module/components/signature/index.js +500 -0
- package/lib/module/components/signature/index.js.map +1 -0
- package/lib/module/components/soundwave/index.js +813 -0
- package/lib/module/components/soundwave/index.js.map +1 -0
- package/lib/module/components/typography/index.js +196 -5
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/icons/index.js +287 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +8 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +15 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/checkbox/index.d.ts +8 -0
- package/lib/typescript/src/components/checkbox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/direction/index.d.ts +64 -0
- package/lib/typescript/src/components/direction/index.d.ts.map +1 -0
- package/lib/typescript/src/components/field/index.d.ts +94 -0
- package/lib/typescript/src/components/field/index.d.ts.map +1 -0
- package/lib/typescript/src/components/flow/flow-paths.d.ts +89 -0
- package/lib/typescript/src/components/flow/flow-paths.d.ts.map +1 -0
- package/lib/typescript/src/components/flow/index.d.ts +310 -0
- package/lib/typescript/src/components/flow/index.d.ts.map +1 -0
- package/lib/typescript/src/components/form/index.d.ts +64 -0
- package/lib/typescript/src/components/form/index.d.ts.map +1 -0
- package/lib/typescript/src/components/form/use-field.d.ts +16 -0
- package/lib/typescript/src/components/form/use-field.d.ts.map +1 -0
- package/lib/typescript/src/components/form/use-form.d.ts +37 -0
- package/lib/typescript/src/components/form/use-form.d.ts.map +1 -0
- package/lib/typescript/src/components/frame/index.d.ts +39 -2
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message/index.d.ts.map +1 -1
- package/lib/typescript/src/components/otp-input/index.d.ts +141 -0
- package/lib/typescript/src/components/otp-input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/signature/index.d.ts +254 -0
- package/lib/typescript/src/components/signature/index.d.ts.map +1 -0
- package/lib/typescript/src/components/soundwave/index.d.ts +91 -0
- package/lib/typescript/src/components/soundwave/index.d.ts.map +1 -0
- package/lib/typescript/src/components/typography/index.d.ts +154 -1
- package/lib/typescript/src/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/src/icons/index.d.ts +23 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +9 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +9 -1
- package/src/components/bottom-sheet/index.tsx +50 -12
- package/src/components/checkbox/index.tsx +40 -12
- package/src/components/direction/index.tsx +90 -0
- package/src/components/field/index.tsx +329 -0
- package/src/components/flow/flow-paths.ts +348 -0
- package/src/components/flow/index.tsx +1924 -0
- package/src/components/form/index.tsx +85 -0
- package/src/components/form/use-field.ts +65 -0
- package/src/components/form/use-form.ts +252 -0
- package/src/components/frame/index.tsx +162 -14
- package/src/components/message/index.tsx +17 -1
- package/src/components/otp-input/index.tsx +396 -0
- package/src/components/signature/index.tsx +681 -0
- package/src/components/soundwave/index.tsx +1029 -0
- package/src/components/typography/index.tsx +231 -10
- package/src/icons/index.tsx +195 -0
- package/src/index.ts +87 -0
package/README.md
CHANGED
|
@@ -101,6 +101,7 @@ overlays, and the toast viewport.
|
|
|
101
101
|
| `Checkbox` | Animated checkbox, as a row or a selectable card |
|
|
102
102
|
| `Chip` | Interactive pill — a filter, a tag, or a removable token |
|
|
103
103
|
| `Dialog` | Modal dialog with a backdrop and footer actions |
|
|
104
|
+
| `Direction` | Reading direction for everything below it |
|
|
104
105
|
| `EmptyState` | Placeholder for a list or screen with no content |
|
|
105
106
|
| `Frame` | Widget shell — a card of rows sitting in a titled tray |
|
|
106
107
|
| `HeatmapChart` | Contribution grid with a themed colour ramp and a readout |
|
|
@@ -124,6 +125,7 @@ overlays, and the toast viewport.
|
|
|
124
125
|
| `Shimmer` | Animated highlight sweeping across content |
|
|
125
126
|
| `Skeleton` | Shimmer placeholder for loading content |
|
|
126
127
|
| `Slider` | Pick a value by dragging a thumb along a track |
|
|
128
|
+
| `Soundwave` | What a voice looks like while an app listens |
|
|
127
129
|
| `Spinner` | Indeterminate loading indicator |
|
|
128
130
|
| `Steps` | Stepper for multi-step flows |
|
|
129
131
|
| `Surface` | Elevated container with a variant ladder |
|
|
@@ -4,11 +4,13 @@ import { cloneElement, createContext, isValidElement, useCallback, useContext, u
|
|
|
4
4
|
import { Pressable, useWindowDimensions, View } from 'react-native';
|
|
5
5
|
import { useCSSVariable } from 'uniwind';
|
|
6
6
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
7
|
-
import Animated, {
|
|
7
|
+
import Animated, { SlideInDown, SlideOutDown, runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
8
8
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
9
|
+
import { tv } from 'tailwind-variants';
|
|
9
10
|
import { getNativeUI } from "../../native/index.js";
|
|
10
11
|
import { XIcon } from "../../icons/index.js";
|
|
11
12
|
import { Portal } from "../../primitives/portal.js";
|
|
13
|
+
import { Scrim } from "../../primitives/scrim.js";
|
|
12
14
|
import { cn } from "../../utils/cn.js";
|
|
13
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
const SPRING = {
|
|
@@ -18,6 +20,23 @@ const SPRING = {
|
|
|
18
20
|
};
|
|
19
21
|
const DISMISS_DISTANCE = 120;
|
|
20
22
|
const DISMISS_VELOCITY = 800;
|
|
23
|
+
const sheetVariants = tv({
|
|
24
|
+
base: 'border border-border bg-popover px-5 pt-2 shadow-lg',
|
|
25
|
+
variants: {
|
|
26
|
+
detached: {
|
|
27
|
+
// Docked: the sheet is continuous with the bottom of the screen, so the
|
|
28
|
+
// bottom edge is not a real edge and drawing a line along it would be a
|
|
29
|
+
// rule through the middle of nothing.
|
|
30
|
+
false: 'rounded-t-3xl border-b-0',
|
|
31
|
+
// Floating: all four edges are real, so all four are drawn and all four
|
|
32
|
+
// corners are rounded.
|
|
33
|
+
true: 'mx-4 mb-6 rounded-3xl'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
detached: false
|
|
38
|
+
}
|
|
39
|
+
});
|
|
21
40
|
const BottomSheetContext = /*#__PURE__*/createContext(null);
|
|
22
41
|
function useBottomSheet(component) {
|
|
23
42
|
const context = useContext(BottomSheetContext);
|
|
@@ -114,6 +133,8 @@ function BottomSheetContent({
|
|
|
114
133
|
className,
|
|
115
134
|
dismissible = true,
|
|
116
135
|
showClose = true,
|
|
136
|
+
detached = false,
|
|
137
|
+
blur = false,
|
|
117
138
|
children,
|
|
118
139
|
...props
|
|
119
140
|
}) {
|
|
@@ -206,25 +227,32 @@ function BottomSheetContent({
|
|
|
206
227
|
value: context,
|
|
207
228
|
children: /*#__PURE__*/_jsxs(View, {
|
|
208
229
|
className: "absolute inset-0 justify-end",
|
|
209
|
-
children: [/*#__PURE__*/
|
|
210
|
-
entering: FadeIn.duration(180),
|
|
211
|
-
exiting: FadeOut.duration(180),
|
|
230
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
212
231
|
className: "absolute inset-0",
|
|
213
|
-
children: /*#__PURE__*/_jsx(
|
|
232
|
+
children: [/*#__PURE__*/_jsx(Scrim, {
|
|
233
|
+
blur: blur
|
|
234
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
214
235
|
accessibilityLabel: "Close sheet",
|
|
215
|
-
className: "flex-1
|
|
236
|
+
className: "flex-1",
|
|
216
237
|
onPress: dismissible ? close : undefined
|
|
217
|
-
})
|
|
238
|
+
})]
|
|
218
239
|
}), /*#__PURE__*/_jsx(GestureDetector, {
|
|
219
240
|
gesture: pan,
|
|
220
241
|
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
221
242
|
entering: SlideInDown.springify().damping(22).stiffness(240).mass(0.8),
|
|
222
243
|
exiting: SlideOutDown.duration(200),
|
|
223
|
-
style: [sheetStyle,
|
|
224
|
-
|
|
244
|
+
style: [sheetStyle,
|
|
245
|
+
// A detached sheet's own bottom margin already clears the home
|
|
246
|
+
// indicator, so it takes plain padding rather than stacking the
|
|
247
|
+
// inset on top of the gap.
|
|
248
|
+
{
|
|
249
|
+
paddingBottom: detached ? 16 : Math.max(insets.bottom, 16)
|
|
225
250
|
}],
|
|
226
251
|
accessibilityViewIsModal: true,
|
|
227
|
-
className:
|
|
252
|
+
className: sheetVariants({
|
|
253
|
+
detached,
|
|
254
|
+
className
|
|
255
|
+
}),
|
|
228
256
|
...props,
|
|
229
257
|
children: [/*#__PURE__*/_jsx(View, {
|
|
230
258
|
className: "mb-3 self-center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cloneElement","createContext","isValidElement","useCallback","useContext","useMemo","useState","Pressable","useWindowDimensions","View","useCSSVariable","Gesture","GestureDetector","Animated","
|
|
1
|
+
{"version":3,"names":["cloneElement","createContext","isValidElement","useCallback","useContext","useMemo","useState","Pressable","useWindowDimensions","View","useCSSVariable","Gesture","GestureDetector","Animated","SlideInDown","SlideOutDown","runOnJS","useAnimatedStyle","useSharedValue","withSpring","withTiming","useSafeAreaInsets","tv","getNativeUI","XIcon","Portal","Scrim","cn","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","DISMISS_DISTANCE","DISMISS_VELOCITY","sheetVariants","base","variants","detached","false","true","defaultVariants","BottomSheetContext","useBottomSheet","component","context","Error","DETENT_FRACTION","half","full","detentFloor","snapPoints","screenHeight","length","undefined","first","fraction","height","NativeSheetContext","BottomSheetRoot","children","open","onOpenChange","defaultOpen","native","internalOpen","setInternalOpen","isControlled","resolvedOpen","setOpen","next","nativeUI","nativeSheet","Provider","value","BottomSheetTrigger","onPress","args","props","BottomSheetContent","className","dismissible","showClose","blur","width","screenWidth","insets","translateY","closeTint","close","pan","Pan","onChange","event","changeY","onEnd","velocityY","duration","sheetStyle","transform","Host","BottomSheet","NativeBottomSheet","RNHostView","matchContents","style","position","isPresented","onDismiss","minHeight","paddingBottom","Math","max","bottom","accessibilityLabel","gesture","entering","springify","exiting","accessibilityViewIsModal","accessibilityRole","hitSlop","size","color","Object","assign","Trigger","Content"],"sourceRoot":"../../../../src","sources":["components/bottom-sheet/index.tsx"],"mappings":";;AAAA,SACEA,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QAGH,OAAO;AACd,SAASC,SAAS,EAAEC,mBAAmB,EAAEC,IAAI,QAAwB,cAAc;AACnF,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IAGbC,WAAW,EACXC,YAAY,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AC,OAAO;cAC1BtC,OAAO,EAAEa,KAAM;cACfgC,OAAO,EAAE,CAAE;cACXzC,SAAS,EAAC,oGAAoG;cAAApB,QAAA,eAE9GlC,IAAA,CAACL,KAAK;gBAACqG,IAAI,EAAE,EAAG;gBAACC,KAAK,EAAE,OAAOnC,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGlC;cAAU,CAAE;YAAC,CACxE,CAAC,GACV,IAAI,EACPM,QAAQ;UAAA,CACI;QAAC,CACD,CAAC;MAAA,CACZ;IAAC,CACoB;EAAC,CACxB,CAAC;AAEb;AAEA,OAAO,MAAMyC,WAAW,GAAGuB,MAAM,CAACC,MAAM,CAAClE,eAAe,EAAE;EACxDmE,OAAO,EAAEnD,kBAAkB;EAC3BoD,OAAO,EAAEhD;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ import { Pressable, View } from 'react-native';
|
|
|
5
5
|
import Animated, { useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
6
6
|
import { tv } from 'tailwind-variants';
|
|
7
7
|
import { useCSSVariable } from 'uniwind';
|
|
8
|
-
import { CheckIcon } from "../../icons/index.js";
|
|
8
|
+
import { CheckIcon, MinusIcon } from "../../icons/index.js";
|
|
9
9
|
import { Text } from "../../primitives/text.js";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const checkboxVariants = tv({
|
|
@@ -53,55 +53,68 @@ export const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
53
53
|
className,
|
|
54
54
|
checked,
|
|
55
55
|
onCheckedChange,
|
|
56
|
+
indeterminate,
|
|
56
57
|
disabled,
|
|
57
58
|
label,
|
|
58
59
|
description,
|
|
59
60
|
variant
|
|
60
61
|
}, ref) => {
|
|
61
|
-
|
|
62
|
+
// The dash and the tick share one fill, so the box is "on" for either —
|
|
63
|
+
// what changes is the glyph, not whether the fill is shown.
|
|
64
|
+
const on = checked || !!indeterminate;
|
|
65
|
+
const progress = useSharedValue(on ? 1 : 0);
|
|
62
66
|
const slots = checkboxVariants({
|
|
63
67
|
variant,
|
|
64
|
-
checked,
|
|
68
|
+
checked: on,
|
|
65
69
|
disabled: !!disabled
|
|
66
70
|
});
|
|
67
71
|
const checkColor = useCSSVariable('--color-primary-foreground');
|
|
68
72
|
useEffect(() => {
|
|
69
|
-
progress.value =
|
|
73
|
+
progress.value = on ? withSpring(1, {
|
|
70
74
|
damping: 15,
|
|
71
75
|
stiffness: 300,
|
|
72
76
|
mass: 0.5
|
|
73
77
|
}) : withTiming(0, {
|
|
74
78
|
duration: 120
|
|
75
79
|
});
|
|
76
|
-
}, [
|
|
80
|
+
}, [on, progress]);
|
|
77
81
|
const fillStyle = useAnimatedStyle(() => ({
|
|
78
82
|
opacity: progress.value,
|
|
79
83
|
transform: [{
|
|
80
84
|
scale: 0.6 + progress.value * 0.4
|
|
81
85
|
}]
|
|
82
86
|
}));
|
|
87
|
+
const glyphColor = typeof checkColor === 'string' ? checkColor : '#fff';
|
|
83
88
|
const box = /*#__PURE__*/_jsx(View, {
|
|
84
89
|
className: slots.box(),
|
|
85
90
|
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
86
91
|
style: fillStyle,
|
|
87
92
|
className: slots.fill(),
|
|
88
|
-
children: /*#__PURE__*/_jsx(
|
|
93
|
+
children: indeterminate ? /*#__PURE__*/_jsx(MinusIcon, {
|
|
89
94
|
size: 12,
|
|
90
|
-
color:
|
|
95
|
+
color: glyphColor
|
|
96
|
+
}) : /*#__PURE__*/_jsx(CheckIcon, {
|
|
97
|
+
size: 12,
|
|
98
|
+
color: glyphColor
|
|
91
99
|
})
|
|
92
100
|
})
|
|
93
101
|
});
|
|
94
102
|
return /*#__PURE__*/_jsxs(Pressable, {
|
|
95
103
|
ref: ref,
|
|
96
|
-
accessibilityRole: "checkbox"
|
|
104
|
+
accessibilityRole: "checkbox"
|
|
105
|
+
// `mixed` is the a11y state for a box that governs a partly-on group;
|
|
106
|
+
// a plain boolean would tell a screen reader the group is fully one way.
|
|
107
|
+
,
|
|
97
108
|
accessibilityState: {
|
|
98
|
-
checked,
|
|
109
|
+
checked: indeterminate ? 'mixed' : checked,
|
|
99
110
|
disabled: !!disabled
|
|
100
111
|
},
|
|
101
112
|
accessibilityLabel: label,
|
|
102
113
|
accessibilityHint: description,
|
|
103
|
-
disabled: disabled
|
|
104
|
-
|
|
114
|
+
disabled: disabled
|
|
115
|
+
// An indeterminate box resolves upward: the press turns the group on.
|
|
116
|
+
,
|
|
117
|
+
onPress: () => onCheckedChange?.(indeterminate ? true : !checked),
|
|
105
118
|
hitSlop: 8
|
|
106
119
|
// A description makes the row two lines tall — align the box to the
|
|
107
120
|
// label rather than centring it against the whole block.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","Pressable","View","Animated","useAnimatedStyle","useSharedValue","withSpring","withTiming","tv","useCSSVariable","CheckIcon","Text","jsx","_jsx","jsxs","_jsxs","checkboxVariants","slots","row","box","fill","content","label","description","variants","variant","default","card","checked","true","disabled","compoundVariants","class","defaultVariants","Checkbox","className","onCheckedChange","ref","progress","checkColor","value","damping","stiffness","mass","duration","fillStyle","opacity","transform","scale","children","style","size","color","accessibilityRole","accessibilityState","accessibilityLabel","accessibilityHint","onPress","hitSlop","displayName"],"sourceRoot":"../../../../src","sources":["components/checkbox/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC9C,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,QAAQ,sBAAa;
|
|
1
|
+
{"version":3,"names":["forwardRef","useEffect","Pressable","View","Animated","useAnimatedStyle","useSharedValue","withSpring","withTiming","tv","useCSSVariable","CheckIcon","MinusIcon","Text","jsx","_jsx","jsxs","_jsxs","checkboxVariants","slots","row","box","fill","content","label","description","variants","variant","default","card","checked","true","disabled","compoundVariants","class","defaultVariants","Checkbox","className","onCheckedChange","indeterminate","ref","on","progress","checkColor","value","damping","stiffness","mass","duration","fillStyle","opacity","transform","scale","glyphColor","children","style","size","color","accessibilityRole","accessibilityState","accessibilityLabel","accessibilityHint","onPress","hitSlop","displayName"],"sourceRoot":"../../../../src","sources":["components/checkbox/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC9C,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,SAAS,QAAQ,sBAAa;AAClD,SAASC,IAAI,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,gBAAgB,GAAGT,EAAE,CAAC;EAC1BU,KAAK,EAAE;IACLC,GAAG,EAAE,+BAA+B;IACpCC,GAAG,EAAE,kFAAkF;IACvFC,IAAI,EAAE,oEAAoE;IAC1EC,OAAO,EAAE,gBAAgB;IACzBC,KAAK,EAAE,yBAAyB;IAChCC,WAAW,EAAE;EACf,CAAC;EACDC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE,CAAC,CAAC;MACX;AACN;AACA;AACA;MACMC,IAAI,EAAE;QACJT,GAAG,EAAE,sEAAsE;QAC3EI,KAAK,EAAE;MACT;IACF,CAAC;IACDM,OAAO,EAAE;MACPC,IAAI,EAAE,CAAC;IACT,CAAC;IACDC,QAAQ,EAAE;MACRD,IAAI,EAAE;QAAEX,GAAG,EAAE;MAAa;IAC5B;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,gBACnBR,KAAA,CAACd,IAAI;MAACkC,SAAS,EAAElB,KAAK,CAACI,OAAO,CAAC,CAAE;MAAA+B,QAAA,GAC9B9B,KAAK,gBAAGT,IAAA,CAACF,IAAI;QAACwB,SAAS,EAAElB,KAAK,CAACK,KAAK,CAAC,CAAE;QAAA8B,QAAA,EAAE9B;MAAK,CAAO,CAAC,GAAG,IAAI,EAC7DC,WAAW,gBACVV,IAAA,CAACF,IAAI;QAACwB,SAAS,EAAElB,KAAK,CAACM,WAAW,CAAC,CAAE;QAAA6B,QAAA,EAAE7B;MAAW,CAAO,CAAC,GACxD,IAAI;IAAA,CACJ,CAAC,GACL,IAAI,EACPE,OAAO,KAAK,MAAM,GAAGN,GAAG,GAAG,IAAI;EAAA,CACvB,CAAC;AAEhB,CACF,CAAC;AAEDe,QAAQ,CAAC4B,WAAW,GAAG,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direction — reading direction for everything below it.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <Direction dir="rtl">
|
|
8
|
+
* <App />
|
|
9
|
+
* </Direction>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* The layout flip is Yoga's, not ours: the wrapper carries the `direction`
|
|
13
|
+
* style, and every row, `start`/`end` inset and horizontal padding underneath
|
|
14
|
+
* it mirrors natively. That is the whole reason this is a component and not a
|
|
15
|
+
* bare context — `direction` is a *style*, so a subtree is the unit it applies
|
|
16
|
+
* to.
|
|
17
|
+
*
|
|
18
|
+
* It is also the reason to prefer it over flipping the process with
|
|
19
|
+
* `I18nManager.forceRTL`, which needs an app restart to take effect, cannot be
|
|
20
|
+
* scoped to part of a screen, and cannot be previewed side by side. Here the
|
|
21
|
+
* value is a prop: change it and the next frame is mirrored.
|
|
22
|
+
*
|
|
23
|
+
* ## What Yoga does not flip
|
|
24
|
+
*
|
|
25
|
+
* Anything measured in raw pixels rather than laid out — a drag translation, an
|
|
26
|
+
* indicator offset, the direction a sweep travels. Those have to consult the
|
|
27
|
+
* value and negate it themselves, which is what `useDirection()` is for:
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const dir = useDirection();
|
|
31
|
+
* const delta = (dir === 'rtl' ? -event.translationX : event.translationX) / width;
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* With no provider mounted, and for a `<Direction>` given no `dir`, the value
|
|
35
|
+
* comes from the device — so an app that did force RTL the old way still reads
|
|
36
|
+
* back the truth.
|
|
37
|
+
*/
|
|
38
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
39
|
+
import { I18nManager, View } from 'react-native';
|
|
40
|
+
import { cn } from "../../utils/cn.js";
|
|
41
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
|
+
/** What the device is set to, for anything outside a provider. */
|
|
43
|
+
const deviceDirection = () => I18nManager.isRTL ? 'rtl' : 'ltr';
|
|
44
|
+
const DirectionContext = /*#__PURE__*/createContext(null);
|
|
45
|
+
/**
|
|
46
|
+
* Provider. Renders one `View` — it has to, since the flip is a style — which
|
|
47
|
+
* fills its parent by default so it can wrap an app. Pass `className` to change
|
|
48
|
+
* that: `flex-none` or a width class both win over the default.
|
|
49
|
+
*/
|
|
50
|
+
export function Direction({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
dir,
|
|
54
|
+
style,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
const inherited = useContext(DirectionContext);
|
|
58
|
+
const value = dir ?? inherited ?? deviceDirection();
|
|
59
|
+
|
|
60
|
+
// The style object is memoised because it is the thing that invalidates
|
|
61
|
+
// layout for the entire subtree — a fresh one each render would re-run Yoga
|
|
62
|
+
// on every parent render, for a value that almost never changes.
|
|
63
|
+
const directionStyle = useMemo(() => ({
|
|
64
|
+
direction: value
|
|
65
|
+
}), [value]);
|
|
66
|
+
return /*#__PURE__*/_jsx(DirectionContext.Provider, {
|
|
67
|
+
value: value,
|
|
68
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
69
|
+
className: cn('flex-1', className),
|
|
70
|
+
style: [directionStyle, style],
|
|
71
|
+
...props,
|
|
72
|
+
children: children
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
Direction.displayName = 'Direction';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The reading direction in force, for a component that has to flip maths Yoga
|
|
80
|
+
* cannot flip for it. Safe with no provider mounted: it falls back to the
|
|
81
|
+
* device's own setting.
|
|
82
|
+
*/
|
|
83
|
+
export function useDirection() {
|
|
84
|
+
return useContext(DirectionContext) ?? deviceDirection();
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","useMemo","I18nManager","View","cn","jsx","_jsx","deviceDirection","isRTL","DirectionContext","Direction","className","children","dir","style","props","inherited","value","directionStyle","direction","Provider","displayName","useDirection"],"sourceRoot":"../../../../src","sources":["components/direction/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC1E,SAASC,WAAW,EAAEC,IAAI,QAAwB,cAAc;AAChE,SAASC,EAAE,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIpC;AACA,MAAMC,eAAe,GAAGA,CAAA,KAAuBL,WAAW,CAACM,KAAK,GAAG,KAAK,GAAG,KAAM;AAEjF,MAAMC,gBAAgB,gBAAGV,aAAa,CAAwB,IAAI,CAAC;AAanE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,SA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