@fluxus-ui/native 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +75 -2
- package/lib/module/AudioPlayer.js +174 -0
- package/lib/module/AudioPlayer.js.map +1 -0
- package/lib/module/Avatar.js +58 -0
- package/lib/module/Avatar.js.map +1 -0
- package/lib/module/Badge.js +72 -0
- package/lib/module/Badge.js.map +1 -0
- package/lib/module/BottomSheet.js +159 -0
- package/lib/module/BottomSheet.js.map +1 -0
- package/lib/module/Bubble.js +182 -0
- package/lib/module/Bubble.js.map +1 -0
- package/lib/module/Button.js +209 -0
- package/lib/module/Button.js.map +1 -0
- package/lib/module/Card.js +79 -0
- package/lib/module/Card.js.map +1 -0
- package/lib/module/Dialog.js +137 -0
- package/lib/module/Dialog.js.map +1 -0
- package/lib/module/Disclosure.js +153 -0
- package/lib/module/Disclosure.js.map +1 -0
- package/lib/module/EmptyState.js +71 -0
- package/lib/module/EmptyState.js.map +1 -0
- package/lib/module/Link.js +97 -0
- package/lib/module/Link.js.map +1 -0
- package/lib/module/ListItem.js +89 -0
- package/lib/module/ListItem.js.map +1 -0
- package/lib/module/Menu.js +76 -0
- package/lib/module/Menu.js.map +1 -0
- package/lib/module/Message.js +51 -0
- package/lib/module/Message.js.map +1 -0
- package/lib/module/Popover.js +153 -0
- package/lib/module/Popover.js.map +1 -0
- package/lib/module/Progress.js +54 -0
- package/lib/module/Progress.js.map +1 -0
- package/lib/module/Select.js +146 -0
- package/lib/module/Select.js.map +1 -0
- package/lib/module/Skeleton.js +40 -0
- package/lib/module/Skeleton.js.map +1 -0
- package/lib/module/Slider.js +137 -0
- package/lib/module/Slider.js.map +1 -0
- package/lib/module/Spinner.js +30 -0
- package/lib/module/Spinner.js.map +1 -0
- package/lib/module/Swap.js +87 -0
- package/lib/module/Swap.js.map +1 -0
- package/lib/module/Tabs.js +118 -0
- package/lib/module/Tabs.js.map +1 -0
- package/lib/module/Text.js +47 -0
- package/lib/module/Text.js.map +1 -0
- package/lib/module/TextField.js +190 -0
- package/lib/module/TextField.js.map +1 -0
- package/lib/module/Toast.js +157 -0
- package/lib/module/Toast.js.map +1 -0
- package/lib/module/audio.js +54 -0
- package/lib/module/audio.js.map +1 -0
- package/lib/module/blur.js +55 -0
- package/lib/module/blur.js.map +1 -0
- package/lib/module/controls.js +292 -0
- package/lib/module/controls.js.map +1 -0
- package/lib/module/feel.js +24 -0
- package/lib/module/feel.js.map +1 -0
- package/lib/module/generated/tokens.js +484 -0
- package/lib/module/generated/tokens.js.map +1 -0
- package/lib/module/haptics.js +25 -0
- package/lib/module/haptics.js.map +1 -0
- package/lib/module/icon-host.js +42 -0
- package/lib/module/icon-host.js.map +1 -0
- package/lib/module/icon-shape.js +222 -0
- package/lib/module/icon-shape.js.map +1 -0
- package/lib/module/icon.js +331 -0
- package/lib/module/icon.js.map +1 -0
- package/lib/module/index.js +39 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/layout.js +75 -0
- package/lib/module/layout.js.map +1 -0
- package/lib/module/marks.js +99 -0
- package/lib/module/marks.js.map +1 -0
- package/lib/module/motion.js +95 -0
- package/lib/module/motion.js.map +1 -0
- package/lib/module/overlay.js +99 -0
- package/lib/module/overlay.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/pending.js +181 -0
- package/lib/module/pending.js.map +1 -0
- package/lib/module/presence.js +71 -0
- package/lib/module/presence.js.map +1 -0
- package/lib/module/press.js +32 -0
- package/lib/module/press.js.map +1 -0
- package/lib/module/screen.js +50 -0
- package/lib/module/screen.js.map +1 -0
- package/lib/module/success.js +59 -0
- package/lib/module/success.js.map +1 -0
- package/lib/module/theme.js +41 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/typescript/AudioPlayer.d.ts +26 -0
- package/lib/typescript/AudioPlayer.d.ts.map +1 -0
- package/lib/typescript/Avatar.d.ts +17 -0
- package/lib/typescript/Avatar.d.ts.map +1 -0
- package/lib/typescript/Badge.d.ts +21 -0
- package/lib/typescript/Badge.d.ts.map +1 -0
- package/lib/typescript/BottomSheet.d.ts +27 -0
- package/lib/typescript/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/Bubble.d.ts +23 -0
- package/lib/typescript/Bubble.d.ts.map +1 -0
- package/lib/typescript/Button.d.ts +29 -0
- package/lib/typescript/Button.d.ts.map +1 -0
- package/lib/typescript/Card.d.ts +17 -0
- package/lib/typescript/Card.d.ts.map +1 -0
- package/lib/typescript/Dialog.d.ts +34 -0
- package/lib/typescript/Dialog.d.ts.map +1 -0
- package/lib/typescript/Disclosure.d.ts +39 -0
- package/lib/typescript/Disclosure.d.ts.map +1 -0
- package/lib/typescript/EmptyState.d.ts +14 -0
- package/lib/typescript/EmptyState.d.ts.map +1 -0
- package/lib/typescript/Link.d.ts +23 -0
- package/lib/typescript/Link.d.ts.map +1 -0
- package/lib/typescript/ListItem.d.ts +20 -0
- package/lib/typescript/ListItem.d.ts.map +1 -0
- package/lib/typescript/Menu.d.ts +23 -0
- package/lib/typescript/Menu.d.ts.map +1 -0
- package/lib/typescript/Message.d.ts +14 -0
- package/lib/typescript/Message.d.ts.map +1 -0
- package/lib/typescript/Popover.d.ts +71 -0
- package/lib/typescript/Popover.d.ts.map +1 -0
- package/lib/typescript/Progress.d.ts +12 -0
- package/lib/typescript/Progress.d.ts.map +1 -0
- package/lib/typescript/Select.d.ts +30 -0
- package/lib/typescript/Select.d.ts.map +1 -0
- package/lib/typescript/Skeleton.d.ts +13 -0
- package/lib/typescript/Skeleton.d.ts.map +1 -0
- package/lib/typescript/Slider.d.ts +21 -0
- package/lib/typescript/Slider.d.ts.map +1 -0
- package/lib/typescript/Spinner.d.ts +12 -0
- package/lib/typescript/Spinner.d.ts.map +1 -0
- package/lib/typescript/Swap.d.ts +25 -0
- package/lib/typescript/Swap.d.ts.map +1 -0
- package/lib/typescript/Tabs.d.ts +18 -0
- package/lib/typescript/Tabs.d.ts.map +1 -0
- package/lib/typescript/Text.d.ts +20 -0
- package/lib/typescript/Text.d.ts.map +1 -0
- package/lib/typescript/TextField.d.ts +36 -0
- package/lib/typescript/TextField.d.ts.map +1 -0
- package/lib/typescript/Toast.d.ts +25 -0
- package/lib/typescript/Toast.d.ts.map +1 -0
- package/lib/typescript/audio.d.ts +10 -0
- package/lib/typescript/audio.d.ts.map +1 -0
- package/lib/typescript/blur.d.ts +4 -0
- package/lib/typescript/blur.d.ts.map +1 -0
- package/lib/typescript/controls.d.ts +37 -0
- package/lib/typescript/controls.d.ts.map +1 -0
- package/lib/typescript/feel.d.ts +10 -0
- package/lib/typescript/feel.d.ts.map +1 -0
- package/lib/typescript/generated/tokens.d.ts +499 -0
- package/lib/typescript/generated/tokens.d.ts.map +1 -0
- package/lib/typescript/haptics.d.ts +7 -0
- package/lib/typescript/haptics.d.ts.map +1 -0
- package/lib/typescript/icon-host.d.ts +30 -0
- package/lib/typescript/icon-host.d.ts.map +1 -0
- package/lib/typescript/icon-shape.d.ts +28 -0
- package/lib/typescript/icon-shape.d.ts.map +1 -0
- package/lib/typescript/icon.d.ts +24 -0
- package/lib/typescript/icon.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +37 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/layout.d.ts +24 -0
- package/lib/typescript/layout.d.ts.map +1 -0
- package/lib/typescript/marks.d.ts +23 -0
- package/lib/typescript/marks.d.ts.map +1 -0
- package/lib/typescript/motion.d.ts +30 -0
- package/lib/typescript/motion.d.ts.map +1 -0
- package/lib/typescript/overlay.d.ts +33 -0
- package/lib/typescript/overlay.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/pending.d.ts +26 -0
- package/lib/typescript/pending.d.ts.map +1 -0
- package/lib/typescript/presence.d.ts +37 -0
- package/lib/typescript/presence.d.ts.map +1 -0
- package/lib/typescript/press.d.ts +12 -0
- package/lib/typescript/press.d.ts.map +1 -0
- package/lib/typescript/screen.d.ts +21 -0
- package/lib/typescript/screen.d.ts.map +1 -0
- package/lib/typescript/success.d.ts +13 -0
- package/lib/typescript/success.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +32 -0
- package/lib/typescript/theme.d.ts.map +1 -0
- package/package.json +123 -3
- package/src/AudioPlayer.tsx +106 -0
- package/src/Avatar.tsx +44 -0
- package/src/Badge.tsx +45 -0
- package/src/BottomSheet.tsx +109 -0
- package/src/Bubble.tsx +112 -0
- package/src/Button.tsx +168 -0
- package/src/Card.tsx +70 -0
- package/src/Dialog.tsx +93 -0
- package/src/Disclosure.tsx +108 -0
- package/src/EmptyState.tsx +51 -0
- package/src/Link.tsx +61 -0
- package/src/ListItem.tsx +78 -0
- package/src/Menu.tsx +57 -0
- package/src/Message.tsx +43 -0
- package/src/Popover.tsx +145 -0
- package/src/Progress.tsx +33 -0
- package/src/Select.tsx +118 -0
- package/src/Skeleton.tsx +28 -0
- package/src/Slider.tsx +107 -0
- package/src/Spinner.tsx +18 -0
- package/src/Swap.tsx +74 -0
- package/src/Tabs.tsx +84 -0
- package/src/Text.tsx +44 -0
- package/src/TextField.tsx +137 -0
- package/src/Toast.tsx +122 -0
- package/src/audio.tsx +56 -0
- package/src/blur.tsx +33 -0
- package/src/controls.tsx +224 -0
- package/src/feel.ts +22 -0
- package/src/generated/tokens.ts +653 -0
- package/src/haptics.tsx +26 -0
- package/src/icon-host.tsx +46 -0
- package/src/icon-shape.ts +213 -0
- package/src/icon.tsx +276 -0
- package/src/index.ts +36 -0
- package/src/layout.tsx +40 -0
- package/src/marks.tsx +79 -0
- package/src/motion.ts +94 -0
- package/src/overlay.tsx +77 -0
- package/src/pending.tsx +135 -0
- package/src/presence.tsx +68 -0
- package/src/press.ts +23 -0
- package/src/screen.tsx +37 -0
- package/src/success.tsx +48 -0
- package/src/theme.tsx +49 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A panel by what opened it: below if it fits, above if not, never off the screen. It grows from the corner
|
|
5
|
+
* that touches its origin. `Menu` is this with rows to choose. (SPEC §15.8)
|
|
6
|
+
*/
|
|
7
|
+
import { cloneElement, useRef, useState } from 'react';
|
|
8
|
+
import { I18nManager, ScrollView, useWindowDimensions } from 'react-native';
|
|
9
|
+
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
10
|
+
import { floating, focusOn, Overlay } from "./overlay.js";
|
|
11
|
+
import { useTheme } from "./theme.js";
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/** Between it and its origin, and between it and the edge of the screen. */
|
|
14
|
+
const GAP = 4;
|
|
15
|
+
const MARGIN = 8;
|
|
16
|
+
const SMALL = 0.96;
|
|
17
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
18
|
+
|
|
19
|
+
/** Where a panel of `size` goes by `anchor` in a `screen`, in the points of the window, and the corner it grows from. */
|
|
20
|
+
export function place(anchor, size, screen, placement = 'bottom-start', rtl = false) {
|
|
21
|
+
const below = anchor.y + anchor.height + GAP;
|
|
22
|
+
const above = anchor.y - GAP - size.height;
|
|
23
|
+
const fitsBelow = below + size.height <= screen.height - MARGIN;
|
|
24
|
+
const fitsAbove = above >= MARGIN;
|
|
25
|
+
const up = placement.startsWith('top') ? fitsAbove || !fitsBelow : !fitsBelow && fitsAbove;
|
|
26
|
+
// `end` is the right edge in a language written from the left, and the left one in the others.
|
|
27
|
+
const right = placement.endsWith('end') !== rtl;
|
|
28
|
+
return {
|
|
29
|
+
left: clamp(right ? anchor.x + anchor.width - size.width : anchor.x, MARGIN, Math.max(MARGIN, screen.width - MARGIN - size.width)),
|
|
30
|
+
top: clamp(up ? above : below, MARGIN, Math.max(MARGIN, screen.height - MARGIN - size.height)),
|
|
31
|
+
origin: `${right ? 'right' : 'left'} ${up ? 'bottom' : 'top'}`
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** The trigger, opening what it opens, and where it is on the screen. Its own `onPress` and `ref` still work. */
|
|
35
|
+
export function useAnchored(trigger, onOpenChange) {
|
|
36
|
+
const [open, setOpen] = useState(false);
|
|
37
|
+
const [rect, setRect] = useState(null);
|
|
38
|
+
const anchor = useRef(null);
|
|
39
|
+
const set = next => {
|
|
40
|
+
setOpen(next);
|
|
41
|
+
onOpenChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
const own = trigger.props.ref;
|
|
44
|
+
return {
|
|
45
|
+
open,
|
|
46
|
+
rect,
|
|
47
|
+
close: () => {
|
|
48
|
+
set(false);
|
|
49
|
+
focusOn(anchor.current);
|
|
50
|
+
},
|
|
51
|
+
trigger: /*#__PURE__*/cloneElement(trigger, {
|
|
52
|
+
'aria-expanded': open,
|
|
53
|
+
ref: node => {
|
|
54
|
+
anchor.current = node;
|
|
55
|
+
if (typeof own === 'function') own(node);else if (own) own.current = node;
|
|
56
|
+
},
|
|
57
|
+
onPress: event => {
|
|
58
|
+
trigger.props.onPress?.(event);
|
|
59
|
+
// Where it was the last time is not where it is now: the screen may have scrolled.
|
|
60
|
+
setRect(null);
|
|
61
|
+
anchor.current?.measureInWindow?.((x, y, width, height) => setRect({
|
|
62
|
+
x,
|
|
63
|
+
y,
|
|
64
|
+
width,
|
|
65
|
+
height
|
|
66
|
+
}));
|
|
67
|
+
set(true);
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** The panel itself. Until it knows where its origin is and how big it is, it is not seen. */
|
|
73
|
+
export function Floating({
|
|
74
|
+
t,
|
|
75
|
+
rect,
|
|
76
|
+
placement,
|
|
77
|
+
role,
|
|
78
|
+
label,
|
|
79
|
+
padding,
|
|
80
|
+
children,
|
|
81
|
+
testID
|
|
82
|
+
}) {
|
|
83
|
+
const theme = useTheme();
|
|
84
|
+
const screen = useWindowDimensions();
|
|
85
|
+
const [size, setSize] = useState(null);
|
|
86
|
+
const at = rect && size ? place(rect, size, screen, placement, I18nManager.isRTL) : null;
|
|
87
|
+
const ready = !!at;
|
|
88
|
+
const grow = useAnimatedStyle(() => ({
|
|
89
|
+
opacity: ready ? t.value : 0,
|
|
90
|
+
transform: [{
|
|
91
|
+
scale: SMALL + (1 - SMALL) * t.value
|
|
92
|
+
}]
|
|
93
|
+
}));
|
|
94
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
95
|
+
role: role,
|
|
96
|
+
"aria-label": label,
|
|
97
|
+
testID: testID,
|
|
98
|
+
onLayout: e => setSize({
|
|
99
|
+
width: e.nativeEvent.layout.width,
|
|
100
|
+
height: e.nativeEvent.layout.height
|
|
101
|
+
})
|
|
102
|
+
// `left` and `top`: the points of the window, not the direction of the language.
|
|
103
|
+
,
|
|
104
|
+
style: [floating(theme), {
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
left: at?.left ?? 0,
|
|
107
|
+
top: at?.top ?? 0,
|
|
108
|
+
minWidth: Math.min(rect?.width ?? 0, screen.width - 2 * MARGIN),
|
|
109
|
+
maxWidth: screen.width - 2 * MARGIN,
|
|
110
|
+
maxHeight: screen.height - 2 * MARGIN,
|
|
111
|
+
overflow: 'hidden',
|
|
112
|
+
transformOrigin: at?.origin
|
|
113
|
+
}, grow],
|
|
114
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
115
|
+
bounces: false,
|
|
116
|
+
keyboardShouldPersistTaps: "handled",
|
|
117
|
+
contentContainerStyle: {
|
|
118
|
+
padding
|
|
119
|
+
},
|
|
120
|
+
children: children
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** A small panel with anything in it, by what opened it. A press outside closes it. */
|
|
125
|
+
export function Popover({
|
|
126
|
+
trigger,
|
|
127
|
+
children,
|
|
128
|
+
label,
|
|
129
|
+
placement = 'bottom-start',
|
|
130
|
+
onOpenChange,
|
|
131
|
+
testID
|
|
132
|
+
}) {
|
|
133
|
+
const theme = useTheme();
|
|
134
|
+
const anchored = useAnchored(trigger, onOpenChange);
|
|
135
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
136
|
+
children: [anchored.trigger, /*#__PURE__*/_jsx(Overlay, {
|
|
137
|
+
open: anchored.open,
|
|
138
|
+
onClose: anchored.close,
|
|
139
|
+
veil: false,
|
|
140
|
+
children: t => /*#__PURE__*/_jsx(Floating, {
|
|
141
|
+
t: t,
|
|
142
|
+
rect: anchored.rect,
|
|
143
|
+
placement: placement,
|
|
144
|
+
role: "dialog",
|
|
145
|
+
label: label,
|
|
146
|
+
padding: theme.size['space.3'],
|
|
147
|
+
testID: testID,
|
|
148
|
+
children: typeof children === 'function' ? children(anchored.close) : children
|
|
149
|
+
})
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=Popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cloneElement","useRef","useState","I18nManager","ScrollView","useWindowDimensions","Animated","useAnimatedStyle","floating","focusOn","Overlay","useTheme","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","GAP","MARGIN","SMALL","clamp","value","min","max","Math","place","anchor","size","screen","placement","rtl","below","y","height","above","fitsBelow","fitsAbove","up","startsWith","right","endsWith","left","x","width","top","origin","useAnchored","trigger","onOpenChange","open","setOpen","rect","setRect","set","next","own","props","ref","close","current","node","onPress","event","measureInWindow","Floating","t","role","label","padding","children","testID","theme","setSize","at","isRTL","ready","grow","opacity","transform","scale","View","onLayout","e","nativeEvent","layout","style","position","minWidth","maxWidth","maxHeight","overflow","transformOrigin","bounces","keyboardShouldPersistTaps","contentContainerStyle","Popover","anchored","onClose","veil"],"sourceRoot":"../../src","sources":["Popover.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,MAAM,EAAEC,QAAQ,QAAqD,OAAO;AACnG,SAASC,WAAW,EAAEC,UAAU,EAAEC,mBAAmB,QAAoC,cAAc;AACvG,OAAOC,QAAQ,IAAIC,gBAAgB,QAA0B,yB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,KAAK;EAAEtC,SAAS,GAAG,cAAc;EAAEmB,YAAY;EAAEsB;AAAqB,CAAC,EAAE;EACpH,MAAMC,KAAK,GAAG7D,QAAQ,CAAC,CAAC;EACxB,MAAMsF,QAAQ,GAAGlD,WAAW,CAACC,OAAO,EAAEC,YAAY,CAAC;EACnD,oBACEhC,KAAA,CAAAF,SAAA;IAAAuD,QAAA,GACG2B,QAAQ,CAACjD,OAAO,eACjBnC,IAAA,CAACH,OAAO;MAACwC,IAAI,EAAE+C,QAAQ,CAAC/C,IAAK;MAACgD,OAAO,EAAED,QAAQ,CAACtC,KAAM;MAACwC,IAAI,EAAE,KAAM;MAAA7B,QAAA,EAC/DJ,CAAC,iBACDrD,IAAA,CAACoD,QAAQ;QAACC,CAAC,EAAEA,CAAE;QAACd,IAAI,EAAE6C,QAAQ,CAAC7C,IAAK;QAACtB,SAAS,EAAEA,SAAU;QAACqC,IAAI,EAAC,QAAQ;QAACC,KAAK,EAAEA,KAAM;QAACC,OAAO,EAAEG,KAAK,CAAC5C,IAAI,CAAC,SAAS,CAAE;QAAC2C,MAAM,EAAEA,MAAO;QAAAD,QAAA,EACnI,OAAOA,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAAC2B,QAAQ,CAACtC,KAAK,CAAC,GAAGW;MAAQ,CAC7D;IACX,CACM,CAAC;EAAA,CACV,CAAC;AAEP","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { I18nManager, View } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
|
|
6
|
+
import { spring } from "./motion.js";
|
|
7
|
+
import { useTheme } from "./theme.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/** How far something has gone. The bar travels to a new value on the smooth spring, moving only its transform. */
|
|
10
|
+
export function Progress({
|
|
11
|
+
value,
|
|
12
|
+
max = 100,
|
|
13
|
+
label,
|
|
14
|
+
style,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const part = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;
|
|
19
|
+
const shown = useSharedValue(part);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
shown.value = spring(part, 'smooth');
|
|
22
|
+
}, [part, shown]);
|
|
23
|
+
// The whole bar is there, and slides in from the side the language starts on: no layout on each frame.
|
|
24
|
+
const from = I18nManager.isRTL ? 1 : -1;
|
|
25
|
+
const bar = useAnimatedStyle(() => ({
|
|
26
|
+
transform: [{
|
|
27
|
+
translateX: `${from * (1 - shown.value) * 100}%`
|
|
28
|
+
}]
|
|
29
|
+
}));
|
|
30
|
+
const height = theme.size['space.2'];
|
|
31
|
+
return /*#__PURE__*/_jsx(View, {
|
|
32
|
+
accessible: true,
|
|
33
|
+
role: "progressbar",
|
|
34
|
+
"aria-label": label,
|
|
35
|
+
"aria-valuemin": 0,
|
|
36
|
+
"aria-valuemax": max,
|
|
37
|
+
"aria-valuenow": Math.min(max, Math.max(0, value)),
|
|
38
|
+
...rest,
|
|
39
|
+
style: [{
|
|
40
|
+
height,
|
|
41
|
+
borderRadius: height,
|
|
42
|
+
backgroundColor: theme.color['surface.sunken'],
|
|
43
|
+
overflow: 'hidden'
|
|
44
|
+
}, style],
|
|
45
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
46
|
+
style: [{
|
|
47
|
+
height,
|
|
48
|
+
borderRadius: height,
|
|
49
|
+
backgroundColor: theme.color['accent.default']
|
|
50
|
+
}, bar]
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=Progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","I18nManager","View","Animated","useAnimatedStyle","useSharedValue","spring","useTheme","jsx","_jsx","Progress","value","max","label","style","rest","theme","part","Math","min","shown","from","isRTL","bar","transform","translateX","height","size","accessible","role","borderRadius","backgroundColor","color","overflow","children"],"sourceRoot":"../../src","sources":["Progress.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,WAAW,EAAEC,IAAI,QAAwD,cAAc;AAChG,OAAOC,QAAQ,IAAIC,gBAAgB,EAAEC,cAAc,QAAQ,yBAAyB;AACpF,SAASC,MAAM,QAAQ,aAAU;AACjC,SAASC,QAAQ,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWnC;AACA,OAAO,SAASC,QAAQA,CAAC;EAAEC,KAAK;EAAEC,GAAG,GAAG,GAAG;EAAEC,KAAK;EAAEC,KAAK;EAAE,GAAGC;AAAoB,CAAC,EAAE;EACnF,MAAMC,KAAK,GAAGT,QAAQ,CAAC,CAAC;EACxB,MAAMU,IAAI,GAAGL,GAAG,GAAG,CAAC,GAAGM,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACN,GAAG,CAAC,CAAC,EAAED,KAAK,GAAGC,GAAG,CAAC,CAAC,GAAG,CAAC;EAChE,MAAMQ,KAAK,GAAGf,cAAc,CAACY,IAAI,CAAC;EAClCjB,SAAS,CAAC,MAAM;IACdoB,KAAK,CAACT,KAAK,GAAGL,MAAM,CAACW,IAAI,EAAE,QAAQ,CAAC;EACtC,CAAC,EAAE,CAACA,IAAI,EAAEG,KAAK,CAAC,CAAC;EACjB;EACA,MAAMC,IAAI,GAAGpB,WAAW,CAACqB,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;EACvC,MAAMC,GAAG,GAAGnB,gBAAgB,CAAC,OAAO;IAAEoB,SAAS,EAAE,CAAC;MAAEC,UAAU,EAAE,GAAGJ,IAAI,IAAI,CAAC,GAAGD,KAAK,CAACT,KAAK,CAAC,GAAG,GAAG;IAAI,CAAC;EAAE,CAAC,CAAC,CAAC;EAC3G,MAAMe,MAAM,GAAGV,KAAK,CAACW,IAAI,CAAC,SAAS,CAAC;EACpC,oBACElB,IAAA,CAACP,IAAI;IAAC0B,UAAU;IAACC,IAAI,EAAC,aAAa;IAAC,cAAYhB,KAAM;IAAC,iBAAe,CAAE;IAAC,iBAAeD,GAAI;IAAC,iBAAeM,IAAI,CAACC,GAAG,CAACP,GAAG,EAAEM,IAAI,CAACN,GAAG,CAAC,CAAC,EAAED,KAAK,CAAC,CAAE;IAAA,GAAKI,IAAI;IAAED,KAAK,EAAE,CAAC;MAAEY,MAAM;MAAEI,YAAY,EAAEJ,MAAM;MAAEK,eAAe,EAAEf,KAAK,CAACgB,KAAK,CAAC,gBAAgB,CAAC;MAAEC,QAAQ,EAAE;IAAS,CAAC,EAAEnB,KAAK,CAAE;IAAAoB,QAAA,eAC5QzB,IAAA,CAACN,QAAQ,CAACD,IAAI;MAACY,KAAK,EAAE,CAAC;QAAEY,MAAM;QAAEI,YAAY,EAAEJ,MAAM;QAAEK,eAAe,EAAEf,KAAK,CAACgB,KAAK,CAAC,gBAAgB;MAAE,CAAC,EAAET,GAAG;IAAE,CAAE;EAAC,CAC7G,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One of a few, chosen in a sheet. The field looks as a TextField does; the options are radios, which is what
|
|
5
|
+
* they are. If the app takes its time with the choice, the row waits and the sheet closes after. (SPEC §15.8)
|
|
6
|
+
*/
|
|
7
|
+
import { useRef, useState } from 'react';
|
|
8
|
+
import { Pressable, View } from 'react-native';
|
|
9
|
+
import { BottomSheet } from "./BottomSheet.js";
|
|
10
|
+
import { Chevron } from "./Disclosure.js";
|
|
11
|
+
import { fill } from "./layout.js";
|
|
12
|
+
import { ListItem } from "./ListItem.js";
|
|
13
|
+
import { focusOn } from "./overlay.js";
|
|
14
|
+
import { settle } from "./pending.js";
|
|
15
|
+
import { Text } from "./Text.js";
|
|
16
|
+
import { useTheme } from "./theme.js";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
export function Select({
|
|
19
|
+
label,
|
|
20
|
+
options,
|
|
21
|
+
value,
|
|
22
|
+
defaultValue = null,
|
|
23
|
+
onChange,
|
|
24
|
+
placeholder,
|
|
25
|
+
hint,
|
|
26
|
+
error,
|
|
27
|
+
disabled = false,
|
|
28
|
+
inset,
|
|
29
|
+
closeLabel,
|
|
30
|
+
style,
|
|
31
|
+
testID
|
|
32
|
+
}) {
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
const c = theme.color;
|
|
35
|
+
const [own, setOwn] = useState(defaultValue);
|
|
36
|
+
const [open, setOpen] = useState(false);
|
|
37
|
+
const [focused, setFocused] = useState(false);
|
|
38
|
+
const field = useRef(null);
|
|
39
|
+
const now = value === undefined ? own : value;
|
|
40
|
+
const chosen = options.find(o => o.value === now);
|
|
41
|
+
const message = error ?? hint;
|
|
42
|
+
const close = () => {
|
|
43
|
+
setOpen(false);
|
|
44
|
+
focusOn(field.current);
|
|
45
|
+
};
|
|
46
|
+
const choose = next => {
|
|
47
|
+
if (value === undefined) setOwn(next);
|
|
48
|
+
return settle(onChange?.(next), close);
|
|
49
|
+
};
|
|
50
|
+
const radius = theme.size['radius.control'];
|
|
51
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
52
|
+
style: [{
|
|
53
|
+
gap: theme.size['space.1'],
|
|
54
|
+
opacity: disabled ? 0.5 : 1
|
|
55
|
+
}, style],
|
|
56
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
57
|
+
variant: "label",
|
|
58
|
+
"aria-hidden": true,
|
|
59
|
+
children: label
|
|
60
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
61
|
+
style: {
|
|
62
|
+
borderWidth: 1,
|
|
63
|
+
borderRadius: radius + 1,
|
|
64
|
+
borderColor: focused ? c['focus.ring'] : 'transparent'
|
|
65
|
+
},
|
|
66
|
+
children: /*#__PURE__*/_jsxs(Pressable, {
|
|
67
|
+
ref: field,
|
|
68
|
+
role: "combobox",
|
|
69
|
+
"aria-expanded": open,
|
|
70
|
+
"aria-disabled": disabled,
|
|
71
|
+
"aria-label": [label, chosen?.label ?? placeholder].filter(Boolean).join(', '),
|
|
72
|
+
accessibilityHint: message,
|
|
73
|
+
testID: testID,
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
onPress: () => setOpen(true),
|
|
76
|
+
onFocus: () => setFocused(true),
|
|
77
|
+
onBlur: () => setFocused(false),
|
|
78
|
+
style: {
|
|
79
|
+
minHeight: theme.size['target.min'],
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
gap: theme.size['space.2'],
|
|
83
|
+
paddingInline: theme.size['pad.control-x'],
|
|
84
|
+
borderWidth: 1,
|
|
85
|
+
borderRadius: radius,
|
|
86
|
+
borderColor: error ? c['state.danger.solid'] : focused ? c['accent.default'] : c['input.border'],
|
|
87
|
+
backgroundColor: c['input.bg']
|
|
88
|
+
},
|
|
89
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
90
|
+
tone: chosen ? 'default' : 'muted',
|
|
91
|
+
numberOfLines: 1,
|
|
92
|
+
style: fill,
|
|
93
|
+
children: chosen?.label ?? placeholder
|
|
94
|
+
}), /*#__PURE__*/_jsx(Chevron, {})]
|
|
95
|
+
})
|
|
96
|
+
}), message !== undefined && /*#__PURE__*/_jsx(Text, {
|
|
97
|
+
variant: "caption",
|
|
98
|
+
tone: error ? 'default' : 'muted',
|
|
99
|
+
style: error ? {
|
|
100
|
+
color: c['state.danger.text']
|
|
101
|
+
} : undefined,
|
|
102
|
+
children: message
|
|
103
|
+
}), /*#__PURE__*/_jsx(BottomSheet, {
|
|
104
|
+
open: open,
|
|
105
|
+
onClose: close,
|
|
106
|
+
title: label,
|
|
107
|
+
inset: inset,
|
|
108
|
+
closeLabel: closeLabel,
|
|
109
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
110
|
+
role: "radiogroup",
|
|
111
|
+
"aria-label": label,
|
|
112
|
+
style: {
|
|
113
|
+
marginInline: -theme.size['space.4']
|
|
114
|
+
},
|
|
115
|
+
children: options.map(option => {
|
|
116
|
+
const on = option.value === now;
|
|
117
|
+
return /*#__PURE__*/_jsx(ListItem, {
|
|
118
|
+
role: "radio",
|
|
119
|
+
"aria-checked": on,
|
|
120
|
+
title: option.label,
|
|
121
|
+
description: option.description,
|
|
122
|
+
disabled: option.disabled,
|
|
123
|
+
onPress: () => choose(option.value)
|
|
124
|
+
// The mark of the chosen one: the two sides of a rectangle, turned.
|
|
125
|
+
,
|
|
126
|
+
trailing: on ? /*#__PURE__*/_jsx(View, {
|
|
127
|
+
"aria-hidden": true,
|
|
128
|
+
style: {
|
|
129
|
+
width: theme.size['space.2'],
|
|
130
|
+
height: theme.size['space.3'] + 2,
|
|
131
|
+
marginInlineEnd: theme.size['space.1'],
|
|
132
|
+
borderColor: c['accent.default'],
|
|
133
|
+
borderEndWidth: 2,
|
|
134
|
+
borderBottomWidth: 2,
|
|
135
|
+
transform: [{
|
|
136
|
+
rotate: '45deg'
|
|
137
|
+
}]
|
|
138
|
+
}
|
|
139
|
+
}) : null
|
|
140
|
+
}, option.value);
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","useState","Pressable","View","BottomSheet","Chevron","fill","ListItem","focusOn","settle","Text","useTheme","jsx","_jsx","jsxs","_jsxs","Select","label","options","value","defaultValue","onChange","placeholder","hint","error","disabled","inset","closeLabel","style","testID","theme","c","color","own","setOwn","open","setOpen","focused","setFocused","field","now","undefined","chosen","find","o","message","close","current","choose","next","radius","size","gap","opacity","children","variant","borderWidth","borderRadius","borderColor","ref","role","filter","Boolean","join","accessibilityHint","onPress","onFocus","onBlur","minHeight","flexDirection","alignItems","paddingInline","backgroundColor","tone","numberOfLines","onClose","title","marginInline","map","option","on","description","trailing","width","height","marginInlineEnd","borderEndWidth","borderBottomWidth","transform","rotate"],"sourceRoot":"../../src","sources":["Select.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,QAAQ,QAA2B,OAAO;AAC3D,SAASC,SAAS,EAAEC,IAAI,QAAwC,cAAc;AAC9E,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,OAAO,QAAQ,iBAAc;AACtC,SAASC,IAAI,QAAQ,aAAU;AAC/B,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,OAAO,QAAQ,cAAW;AACnC,SAASC,MAAM,QAAQ,cAAW;AAClC,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,QAAQ,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA+BnC,OAAO,SAASC,MAAMA,CAA4B;EAAEC,KAAK;EAAEC,OAAO;EAAEC,KAAK;EAAEC,YAAY,GAAG,IAAI;EAAEC,QAAQ;EAAEC,WAAW;EAAEC,IAAI;EAAEC,KAAK;EAAEC,QAAQ,GAAG,KAAK;EAAEC,KAAK;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAuB,CAAC,EAAE;EACxM,MAAMC,KAAK,GAAGnB,QAAQ,CAAC,CAAC;EACxB,MAAMoB,CAAC,GAAGD,KAAK,CAACE,KAAK;EACrB,MAAM,CAACC,GAAG,EAAEC,MAAM,CAAC,GAAGjC,QAAQ,CAACmB,YAAY,CAAC;EAC5C,MAAM,CAACe,IAAI,EAAEC,OAAO,CAAC,GAAGnC,QAAQ,CAAC,KAAK,CAAC;EACvC,MAAM,CAACoC,OAAO,EAAEC,UAAU,CAAC,GAAGrC,QAAQ,CAAC,KAAK,CAAC;EAC7C,MAAMsC,KAAK,GAAGvC,MAAM,CAAiC,IAAI,CAAC;EAC1D,MAAMwC,GAAG,GAAGrB,KAAK,KAAKsB,SAAS,GAAGR,GAAG,GAAGd,KAAK;E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CAAC,CAAC,gBAAgB,CAAC;gBAAEuD,cAAc,EAAE,CAAC;gBAAEC,iBAAiB,EAAE,CAAC;gBAAEC,SAAS,EAAE,CAAC;kBAAEC,MAAM,EAAE;gBAAQ,CAAC;cAAE;YAAE,CAAE,CAAC,GAAG;UAAK,GARvQV,MAAM,CAAC5D,KASb,CAAC;QAEN,CAAC;MAAC,CACE;IAAC,CACI,CAAC;EAAA,CACV,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import Animated, { ReduceMotion, cancelAnimation, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import { motion } from "./generated/tokens.js";
|
|
6
|
+
import { ms } from "./motion.js";
|
|
7
|
+
import { useTheme } from "./theme.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/** The shape of what is coming, breathing while it loads. Still with reduced motion; not there for a screen reader. */
|
|
10
|
+
export function Skeleton({
|
|
11
|
+
width = '100%',
|
|
12
|
+
height,
|
|
13
|
+
radius,
|
|
14
|
+
style,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const light = useSharedValue(1);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
light.value = withRepeat(withTiming(0.5, {
|
|
21
|
+
duration: ms(motion.duration.slow * 2)
|
|
22
|
+
}), -1, true, undefined, ReduceMotion.System);
|
|
23
|
+
return () => cancelAnimation(light);
|
|
24
|
+
}, [light]);
|
|
25
|
+
const breath = useAnimatedStyle(() => ({
|
|
26
|
+
opacity: light.value
|
|
27
|
+
}));
|
|
28
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
importantForAccessibility: "no-hide-descendants",
|
|
31
|
+
...rest,
|
|
32
|
+
style: [{
|
|
33
|
+
width,
|
|
34
|
+
height: height ?? theme.size['type.body.size'],
|
|
35
|
+
borderRadius: radius ?? theme.size['radius.1'],
|
|
36
|
+
backgroundColor: theme.color['surface.sunken']
|
|
37
|
+
}, style, breath]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","Animated","ReduceMotion","cancelAnimation","useAnimatedStyle","useSharedValue","withRepeat","withTiming","motion","ms","useTheme","jsx","_jsx","Skeleton","width","height","radius","style","rest","theme","light","value","duration","slow","undefined","System","breath","opacity","View","importantForAccessibility","size","borderRadius","backgroundColor","color"],"sourceRoot":"../../src","sources":["Skeleton.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,OAAOC,QAAQ,IAAIC,YAAY,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,EAAEC,UAAU,QAAQ,yBAAyB;AAC3I,SAASC,MAAM,QAAQ,uBAAoB;AAC3C,SAASC,EAAE,QAAQ,aAAU;AAC7B,SAASC,QAAQ,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAYnC;AACA,OAAO,SAASC,QAAQA,CAAC;EAAEC,KAAK,GAAG,MAAM;EAAEC,MAAM;EAAEC,MAAM;EAAEC,KAAK;EAAE,GAAGC;AAAoB,CAAC,EAAE;EAC1F,MAAMC,KAAK,GAAGT,QAAQ,CAAC,CAAC;EACxB,MAAMU,KAAK,GAAGf,cAAc,CAAC,CAAC,CAAC;EAC/BL,SAAS,CAAC,MAAM;IACdoB,KAAK,CAACC,KAAK,GAAGf,UAAU,CAACC,UAAU,CAAC,GAAG,EAAE;MAAEe,QAAQ,EAAEb,EAAE,CAACD,MAAM,CAACc,QAAQ,CAACC,IAAI,GAAG,CAAC;IAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAEC,SAAS,EAAEtB,YAAY,CAACuB,MAAM,CAAC;IAC/H,OAAO,MAAMtB,eAAe,CAACiB,KAAK,CAAC;EACrC,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EACX,MAAMM,MAAM,GAAGtB,gBAAgB,CAAC,OAAO;IAAEuB,OAAO,EAAEP,KAAK,CAACC;EAAM,CAAC,CAAC,CAAC;EACjE,oBAAOT,IAAA,CAACX,QAAQ,CAAC2B,IAAI;IAAC,mBAAW;IAACC,yBAAyB,EAAC,qBAAqB;IAAA,GAAKX,IAAI;IAAED,KAAK,EAAE,CAAC;MAAEH,KAAK;MAAEC,MAAM,EAAEA,MAAM,IAAII,KAAK,CAACW,IAAI,CAAC,gBAAgB,CAAC;MAAEC,YAAY,EAAEf,MAAM,IAAIG,KAAK,CAACW,IAAI,CAAC,UAAU,CAAC;MAAEE,eAAe,EAAEb,KAAK,CAACc,KAAK,CAAC,gBAAgB;IAAE,CAAC,EAAEhB,KAAK,EAAES,MAAM;EAAE,CAAE,CAAC;AACnR","ignoreList":[]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A number with a short run, set by sliding. It takes the touch with React Native's own responder, not with
|
|
5
|
+
* react-native-gesture-handler: its 2 and its 3 have different APIs, and this works with both and with none.
|
|
6
|
+
* A screen reader moves it a step at a time. (SPEC §15.7)
|
|
7
|
+
*/
|
|
8
|
+
import { useEffect, useRef, useState } from 'react';
|
|
9
|
+
import { I18nManager, View } from 'react-native';
|
|
10
|
+
import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
|
|
11
|
+
import { useControlled } from "./controls.js";
|
|
12
|
+
import { spring } from "./motion.js";
|
|
13
|
+
import { useTheme } from "./theme.js";
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
export function Slider({
|
|
16
|
+
label,
|
|
17
|
+
min = 0,
|
|
18
|
+
max = 100,
|
|
19
|
+
step = 1,
|
|
20
|
+
value,
|
|
21
|
+
defaultValue,
|
|
22
|
+
onChange,
|
|
23
|
+
valueText,
|
|
24
|
+
disabled = false,
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
}) {
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
const c = theme.color;
|
|
30
|
+
const [now, set] = useControlled(value, defaultValue ?? min, onChange);
|
|
31
|
+
const [width, setWidth] = useState(0);
|
|
32
|
+
const left = useRef(null);
|
|
33
|
+
const dragging = useRef(false);
|
|
34
|
+
const part = max > min ? Math.min(1, Math.max(0, (now - min) / (max - min))) : 0;
|
|
35
|
+
const at = useSharedValue(part);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
// Under the finger it goes with it; a step from elsewhere travels on the spring.
|
|
38
|
+
at.value = dragging.current ? part : spring(part, 'snappy');
|
|
39
|
+
}, [part, at]);
|
|
40
|
+
const thumb = theme.size['control.h.sm'];
|
|
41
|
+
const rail = theme.size['space.1'];
|
|
42
|
+
const run = Math.max(0, width - thumb);
|
|
43
|
+
const way = I18nManager.isRTL ? -1 : 1;
|
|
44
|
+
const knob = useAnimatedStyle(() => ({
|
|
45
|
+
transform: [{
|
|
46
|
+
translateX: way * at.value * run
|
|
47
|
+
}]
|
|
48
|
+
}));
|
|
49
|
+
const fill = useAnimatedStyle(() => ({
|
|
50
|
+
transform: [{
|
|
51
|
+
translateX: `${-way * (1 - at.value) * 100}%`
|
|
52
|
+
}]
|
|
53
|
+
}));
|
|
54
|
+
const snap = ratio => {
|
|
55
|
+
const raw = min + Math.min(1, Math.max(0, ratio)) * (max - min);
|
|
56
|
+
return Math.min(max, Math.max(min, Number((Math.round((raw - min) / step) * step + min).toFixed(6))));
|
|
57
|
+
};
|
|
58
|
+
const follow = e => {
|
|
59
|
+
// The point is in the window; where the track starts in it is measured when the touch begins.
|
|
60
|
+
const x = left.current === null ? e.nativeEvent.locationX : e.nativeEvent.pageX - left.current;
|
|
61
|
+
const ratio = run ? (x - thumb / 2) / run : 0;
|
|
62
|
+
const next = snap(I18nManager.isRTL ? 1 - ratio : ratio);
|
|
63
|
+
if (next !== now) set(next);
|
|
64
|
+
};
|
|
65
|
+
const nudge = by => set(snap((now + by * step - min) / (max - min)));
|
|
66
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
67
|
+
accessible: true,
|
|
68
|
+
role: "slider",
|
|
69
|
+
"aria-label": label,
|
|
70
|
+
"aria-disabled": disabled,
|
|
71
|
+
"aria-valuemin": min,
|
|
72
|
+
"aria-valuemax": max,
|
|
73
|
+
"aria-valuenow": now,
|
|
74
|
+
"aria-valuetext": valueText?.(now),
|
|
75
|
+
accessibilityActions: [{
|
|
76
|
+
name: 'increment'
|
|
77
|
+
}, {
|
|
78
|
+
name: 'decrement'
|
|
79
|
+
}],
|
|
80
|
+
onAccessibilityAction: e => !disabled && nudge(e.nativeEvent.actionName === 'increment' ? 1 : -1),
|
|
81
|
+
...rest,
|
|
82
|
+
onLayout: e => setWidth(e.nativeEvent.layout.width),
|
|
83
|
+
onStartShouldSetResponder: () => !disabled
|
|
84
|
+
// Once it has the touch it keeps it: a list that scrolls does not take it away halfway.
|
|
85
|
+
,
|
|
86
|
+
onResponderTerminationRequest: () => false,
|
|
87
|
+
onResponderGrant: e => {
|
|
88
|
+
dragging.current = true;
|
|
89
|
+
left.current = null;
|
|
90
|
+
const first = e;
|
|
91
|
+
e.currentTarget?.measureInWindow?.(x => {
|
|
92
|
+
left.current = x;
|
|
93
|
+
});
|
|
94
|
+
follow(first);
|
|
95
|
+
},
|
|
96
|
+
onResponderMove: follow,
|
|
97
|
+
onResponderRelease: () => {
|
|
98
|
+
dragging.current = false;
|
|
99
|
+
},
|
|
100
|
+
onResponderTerminate: () => {
|
|
101
|
+
dragging.current = false;
|
|
102
|
+
},
|
|
103
|
+
style: [{
|
|
104
|
+
height: theme.size['target.min'],
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
opacity: disabled ? 0.5 : 1
|
|
107
|
+
}, style],
|
|
108
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
109
|
+
style: {
|
|
110
|
+
height: rail,
|
|
111
|
+
marginInline: thumb / 2,
|
|
112
|
+
borderRadius: rail,
|
|
113
|
+
backgroundColor: c['surface.sunken'],
|
|
114
|
+
overflow: 'hidden'
|
|
115
|
+
},
|
|
116
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
117
|
+
style: [{
|
|
118
|
+
height: rail,
|
|
119
|
+
borderRadius: rail,
|
|
120
|
+
backgroundColor: c['accent.default']
|
|
121
|
+
}, fill]
|
|
122
|
+
})
|
|
123
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
124
|
+
style: [{
|
|
125
|
+
position: 'absolute',
|
|
126
|
+
start: 0,
|
|
127
|
+
width: thumb,
|
|
128
|
+
height: thumb,
|
|
129
|
+
borderRadius: thumb,
|
|
130
|
+
borderWidth: 1,
|
|
131
|
+
borderColor: c['border.control'],
|
|
132
|
+
backgroundColor: c['surface.base']
|
|
133
|
+
}, knob]
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=Slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","I18nManager","View","Animated","useAnimatedStyle","useSharedValue","useControlled","spring","useTheme","jsx","_jsx","jsxs","_jsxs","Slider","label","min","max","step","value","defaultValue","onChange","valueText","disabled","style","rest","theme","c","color","now","set","width","setWidth","left","dragging","part","Math","at","current","thumb","size","rail","run","way","isRTL","knob","transform","translateX","fill","snap","ratio","raw","Number","round","toFixed","follow","e","x","nativeEvent","locationX","pageX","next","nudge","by","accessible","role","accessibilityActions","name","onAccessibilityAction","actionName","onLayout","layout","onStartShouldSetResponder","onResponderTerminationRequest","onResponderGrant","first","currentTarget","measureInWindow","onResponderMove","onResponderRelease","onResponderTerminate","height","justifyContent","opacity","children","marginInline","borderRadius","backgroundColor","overflow","position","start","borderWidth","borderColor"],"sourceRoot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D,QAAQ,EAAE;MAAS,CAAE;MAAAJ,QAAA,eACnIzE,IAAA,CAACP,QAAQ,CAACD,IAAI;QAACqB,KAAK,EAAE,CAAC;UAAEyD,MAAM,EAAExC,IAAI;UAAE6C,YAAY,EAAE7C,IAAI;UAAE8C,eAAe,EAAE5D,CAAC,CAAC,gBAAgB;QAAE,CAAC,EAAEqB,IAAI;MAAE,CAAE;IAAC,CACxG,CAAC,eACPrC,IAAA,CAACP,QAAQ,CAACD,IAAI;MAACqB,KAAK,EAAE,CAAC;QAAEiE,QAAQ,EAAE,UAAU;QAAEC,KAAK,EAAE,CAAC;QAAE3D,KAAK,EAAEQ,KAAK;QAAE0C,MAAM,EAAE1C,KAAK;QAAE+C,YAAY,EAAE/C,KAAK;QAAEoD,WAAW,EAAE,CAAC;QAAEC,WAAW,EAAEjE,CAAC,CAAC,gBAAgB,CAAC;QAAE4D,eAAe,EAAE5D,CAAC,CAAC,cAAc;MAAE,CAAC,EAAEkB,IAAI;IAAE,CAAE,CAAC;EAAA,CACxM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ActivityIndicator } from 'react-native';
|
|
4
|
+
import { useTheme } from "./theme.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
/** Something is loading. Where there is a layout to show, a Skeleton instead. */
|
|
7
|
+
export function Spinner({
|
|
8
|
+
label,
|
|
9
|
+
size = 'md',
|
|
10
|
+
tone = 'muted',
|
|
11
|
+
...rest
|
|
12
|
+
}) {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const a11y = label ? {
|
|
15
|
+
accessible: true,
|
|
16
|
+
role: 'status',
|
|
17
|
+
'aria-label': label,
|
|
18
|
+
'aria-busy': true
|
|
19
|
+
} : {
|
|
20
|
+
'aria-hidden': true,
|
|
21
|
+
importantForAccessibility: 'no-hide-descendants'
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
24
|
+
...a11y,
|
|
25
|
+
...rest,
|
|
26
|
+
size: size === 'lg' ? 'large' : 'small',
|
|
27
|
+
color: theme.color[tone === 'accent' ? 'accent.default' : 'text.muted']
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActivityIndicator","useTheme","jsx","_jsx","Spinner","label","size","tone","rest","theme","a11y","accessible","role","importantForAccessibility","color"],"sourceRoot":"../../src","sources":["Spinner.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAqC,cAAc;AAC7E,SAASC,QAAQ,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWnC;AACA,OAAO,SAASC,OAAOA,CAAC;EAAEC,KAAK;EAAEC,IAAI,GAAG,IAAI;EAAEC,IAAI,GAAG,OAAO;EAAE,GAAGC;AAAmB,CAAC,EAAE;EACrF,MAAMC,KAAK,GAAGR,QAAQ,CAAC,CAAC;EACxB,MAAMS,IAAI,GAAGL,KAAK,GAAI;IAAEM,UAAU,EAAE,IAAI;IAAEC,IAAI,EAAE,QAAQ;IAAE,YAAY,EAAEP,KAAK;IAAE,WAAW,EAAE;EAAK,CAAC,GAAc;IAAE,aAAa,EAAE,IAAI;IAAEQ,yBAAyB,EAAE;EAAsB,CAAW;EACnM,oBAAOV,IAAA,CAACH,iBAAiB;IAAA,GAAKU,IAAI;IAAA,GAAMF,IAAI;IAAEF,IAAI,EAAEA,IAAI,KAAK,IAAI,GAAG,OAAO,GAAG,OAAQ;IAACQ,KAAK,EAAEL,KAAK,CAACK,KAAK,CAACP,IAAI,KAAK,QAAQ,GAAG,gBAAgB,GAAG,YAAY;EAAE,CAAE,CAAC;AACpK","ignoreList":[]}
|