@molecule/app-ui-react-native 2.1.0 → 2.2.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 +41 -5
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js +2 -3
- package/dist/components/Button.d.ts +3 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +35 -3
- package/dist/components/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton.js +13 -12
- package/dist/components/Spinner.js +2 -2
- package/dist/elements/Box.js +8 -1
- package/dist/elements/Pressable.d.ts.map +1 -1
- package/dist/elements/Pressable.js +1 -0
- package/dist/elements/RangeField.d.ts.map +1 -1
- package/dist/elements/RangeField.js +8 -1
- package/dist/elements/SelectAction.d.ts.map +1 -1
- package/dist/elements/SelectAction.js +4 -0
- package/dist/elements/Svg.d.ts +1 -1
- package/dist/elements/Svg.d.ts.map +1 -1
- package/dist/elements/Svg.js +15 -5
- package/dist/elements/accessibility.d.ts +5 -5
- package/dist/elements/accessibility.d.ts.map +1 -1
- package/dist/elements/accessibility.js +5 -0
- package/dist/elements/drag.d.ts +10 -4
- package/dist/elements/drag.d.ts.map +1 -1
- package/dist/elements/drag.js +221 -63
- package/dist/elements/dragModifiers.d.ts +22 -0
- package/dist/elements/dragModifiers.d.ts.map +1 -0
- package/dist/elements/dragModifiers.js +62 -0
- package/dist/elements/style.d.ts.map +1 -1
- package/dist/elements/style.js +6 -1
- package/dist/elements/wheelZoom.d.ts +2 -1
- package/dist/elements/wheelZoom.d.ts.map +1 -1
- package/dist/elements/wheelZoom.js +2 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/platform/focus.d.ts.map +1 -1
- package/dist/platform/focus.js +13 -6
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-27T20:10:27.153Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-ui-react-native
|
|
@@ -14,8 +14,8 @@ Provides React Native implementations (View/Pressable/Text-based) of the
|
|
|
14
14
|
core `@molecule/app-ui` component interfaces, including Accordion,
|
|
15
15
|
Alert, Avatar, Badge, Button, Card (+ CardHeader/CardTitle/CardDescription/
|
|
16
16
|
CardContent/CardFooter), Checkbox, Container, Dropdown, FileField, Flex, Form,
|
|
17
|
-
FormField, Grid, Input, Label, Modal, Pagination, Progress, RadioGroup,
|
|
18
|
-
Select, Separator, Skeleton, Spacer, Spinner, Switch, Table, Tabs,
|
|
17
|
+
FormArea, FormField, Grid, Input, Label, Modal, Pagination, Progress, RadioGroup,
|
|
18
|
+
Select, Separator, Skeleton, Spacer, Spinner, Switch, Table, Tabs, TextField,
|
|
19
19
|
Textarea, Toast (+ ToastProvider / ToastContainer / useToast), Tooltip.
|
|
20
20
|
Prop types build on `@molecule/app-ui`. Web-only extras (Icon,
|
|
21
21
|
UserMenu, ThemeToggle, PageHeader, …) live in `@molecule/app-ui-react` and
|
|
@@ -1021,7 +1021,8 @@ function Badge({
|
|
|
1021
1021
|
|
|
1022
1022
|
#### `Button(props)`
|
|
1023
1023
|
|
|
1024
|
-
Renders a Button component.
|
|
1024
|
+
Renders a Button component. Submit buttons use the nearest FormArea, or
|
|
1025
|
+
the enclosing HTML form on React Native Web.
|
|
1025
1026
|
|
|
1026
1027
|
```typescript
|
|
1027
1028
|
function Button({
|
|
@@ -1037,6 +1038,7 @@ function Button({
|
|
|
1037
1038
|
className,
|
|
1038
1039
|
testId,
|
|
1039
1040
|
disabled,
|
|
1041
|
+
type = 'button',
|
|
1040
1042
|
onClick,
|
|
1041
1043
|
}: ButtonProps): React.JSX.Element
|
|
1042
1044
|
```
|
|
@@ -1054,6 +1056,7 @@ function Button({
|
|
|
1054
1056
|
- `props.className` — CSS class name override.
|
|
1055
1057
|
- `props.testId` — Test identifier.
|
|
1056
1058
|
- `props.disabled` — Whether disabled.
|
|
1059
|
+
- `props.type` — The button's form action.
|
|
1057
1060
|
- `props.onClick` — Called when the button is pressed.
|
|
1058
1061
|
|
|
1059
1062
|
**Returns:** The rendered Button element.
|
|
@@ -1876,6 +1879,39 @@ function Tooltip({ children, content, className, testId }: TooltipProps): React.
|
|
|
1876
1879
|
|
|
1877
1880
|
**Returns:** The rendered Tooltip element.
|
|
1878
1881
|
|
|
1882
|
+
#### `FormArea(props)`
|
|
1883
|
+
|
|
1884
|
+
Draws a form container and supplies its submit, reset and scoped label associations.
|
|
1885
|
+
|
|
1886
|
+
```typescript
|
|
1887
|
+
function FormArea(props: FormAreaProps<ElementNode> & { ref?: Ref<FormAreaHandle> }): ReactElement
|
|
1888
|
+
```
|
|
1889
|
+
|
|
1890
|
+
- `props` — The form's props and ref.
|
|
1891
|
+
|
|
1892
|
+
**Returns:** The form and its content.
|
|
1893
|
+
|
|
1894
|
+
#### `TextField(props)`
|
|
1895
|
+
|
|
1896
|
+
A text field: a native `TextInput`, multi-line for `textarea`. `onValueChange` receives the new
|
|
1897
|
+
text; `onChange` and `onInput` receive an event whose target's `value` is the new text.
|
|
1898
|
+
|
|
1899
|
+
Each key the device's keyboard sends fires `onKeyDown`, `onKeyPress` and `onKeyUp` in that
|
|
1900
|
+
order, before the text changes; a handler that calls `preventDefault()` on the first two keeps
|
|
1901
|
+
the change from reaching `onChange`, `onInput` and `onValueChange`, as on the web. `onClick`
|
|
1902
|
+
fires on a press, `title` is the accessibility hint, and `tabIndex` decides whether the field
|
|
1903
|
+
takes keyboard focus. A device has no hover or double click on a text field
|
|
1904
|
+
(`onMouseEnter`, `onMouseLeave`, `onDoubleClick`) and no character columns or line-wrap modes
|
|
1905
|
+
(`cols`, `wrap`). Inside a form, Return in a single-line field can submit it.
|
|
1906
|
+
|
|
1907
|
+
```typescript
|
|
1908
|
+
function TextField(props: TextFieldProps & ElementRefProps): ReactElement
|
|
1909
|
+
```
|
|
1910
|
+
|
|
1911
|
+
- `props` — See {@link TextFieldProps}.
|
|
1912
|
+
|
|
1913
|
+
**Returns:** The element.
|
|
1914
|
+
|
|
1879
1915
|
### Constants
|
|
1880
1916
|
|
|
1881
1917
|
#### `Input`
|
|
@@ -1974,7 +2010,7 @@ Peer dependencies:
|
|
|
1974
2010
|
- `@molecule/app-logger` ^1.1.0
|
|
1975
2011
|
- `@molecule/app-react` ^4.17.0
|
|
1976
2012
|
- `@molecule/app-routing` ^1.5.3
|
|
1977
|
-
- `@molecule/app-ui` ^1.
|
|
2013
|
+
- `@molecule/app-ui` ^1.16.0
|
|
1978
2014
|
- `@react-native-community/slider` ^4.5.6 _(optional)_
|
|
1979
2015
|
- `react` ^18.0.0 || ^19.0.0
|
|
1980
2016
|
- `react-native` >=0.72.0 _(optional)_
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAmCtC,CAAA"}
|
package/dist/components/Alert.js
CHANGED
|
@@ -19,8 +19,7 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
19
19
|
export const Alert = ({ children, title, variant: _variant = 'subtle', status, icon, dismissible, onDismiss, className, testId, }) => {
|
|
20
20
|
const { t } = useTranslation();
|
|
21
21
|
const cm = getClassMap();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
}), className);
|
|
22
|
+
const tone = status === 'primary' || status === 'secondary' ? 'default' : (status ?? 'default');
|
|
23
|
+
const classes = cm.cn(cm.alert({ variant: tone }), className);
|
|
25
24
|
return (_jsxs(View, { className: classes, testID: testId, accessibilityRole: "alert", children: [!!icon && _jsx(View, { className: cm.alertIconWrapper, children: icon }), _jsxs(View, { className: cm.alertContent, children: [!!title && _jsx(Text, { className: cm.alertTitle, children: title }), !!children && _jsx(Text, { className: cm.alertDescription, children: children })] }), dismissible && (_jsx(Pressable, { className: cm.alertDismiss, onPress: onDismiss, accessibilityLabel: t('ui.alert.dismiss', undefined, { defaultValue: 'Dismiss' }), accessibilityRole: "button", children: _jsx(Text, { children: t('ui.icon.close', undefined, { defaultValue: '✕' }) }) }))] }));
|
|
26
25
|
};
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import type { ButtonProps } from '../types.js';
|
|
8
8
|
/**
|
|
9
|
-
* Renders a Button component.
|
|
9
|
+
* Renders a Button component. Submit buttons use the nearest FormArea, or
|
|
10
|
+
* the enclosing HTML form on React Native Web.
|
|
10
11
|
* @param root0 - Component props.
|
|
11
12
|
* @param root0.children - Button content.
|
|
12
13
|
* @param root0.variant - Visual variant.
|
|
@@ -20,6 +21,7 @@ import type { ButtonProps } from '../types.js';
|
|
|
20
21
|
* @param root0.className - CSS class name override.
|
|
21
22
|
* @param root0.testId - Test identifier.
|
|
22
23
|
* @param root0.disabled - Whether disabled.
|
|
24
|
+
* @param root0.type - The button's form action.
|
|
23
25
|
* @param root0.onClick - Called when the button is pressed.
|
|
24
26
|
* @returns The rendered Button element.
|
|
25
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkC,MAAM,OAAO,CAAA;AAMtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAiExC,CAAA"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Button component for React Native.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { useCallback, useContext } from 'react';
|
|
2
8
|
import { ActivityIndicator, Pressable, Text, View } from 'react-native';
|
|
3
9
|
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import { DisabledScope, FormScope, useFormRegistration } from '../elements/form.js';
|
|
4
11
|
/**
|
|
5
|
-
* Renders a Button component.
|
|
12
|
+
* Renders a Button component. Submit buttons use the nearest FormArea, or
|
|
13
|
+
* the enclosing HTML form on React Native Web.
|
|
6
14
|
* @param root0 - Component props.
|
|
7
15
|
* @param root0.children - Button content.
|
|
8
16
|
* @param root0.variant - Visual variant.
|
|
@@ -16,11 +24,35 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
16
24
|
* @param root0.className - CSS class name override.
|
|
17
25
|
* @param root0.testId - Test identifier.
|
|
18
26
|
* @param root0.disabled - Whether disabled.
|
|
27
|
+
* @param root0.type - The button's form action.
|
|
19
28
|
* @param root0.onClick - Called when the button is pressed.
|
|
20
29
|
* @returns The rendered Button element.
|
|
21
30
|
*/
|
|
22
|
-
export const Button = ({ children, variant = 'solid', color = 'primary', size = 'md', loading = false, loadingText, fullWidth = false, leftIcon, rightIcon, className, testId, disabled, onClick, }) => {
|
|
31
|
+
export const Button = ({ children, variant = 'solid', color = 'primary', size = 'md', loading = false, loadingText, fullWidth = false, leftIcon, rightIcon, className, testId, disabled, type = 'button', onClick, }) => {
|
|
23
32
|
const cm = getClassMap();
|
|
24
33
|
const classes = cm.cn(cm.button({ variant, color, size, fullWidth }), className);
|
|
25
|
-
|
|
34
|
+
const form = useContext(FormScope);
|
|
35
|
+
const fieldsetDisabled = useContext(DisabledScope);
|
|
36
|
+
const unavailable = Boolean(disabled || loading || fieldsetDisabled);
|
|
37
|
+
const submit = type === 'submit' ? form?.submit : undefined;
|
|
38
|
+
const activate = () => {
|
|
39
|
+
if (unavailable)
|
|
40
|
+
return;
|
|
41
|
+
onClick?.();
|
|
42
|
+
submit?.();
|
|
43
|
+
};
|
|
44
|
+
useFormRegistration(submit ? form?.buttons : undefined, {
|
|
45
|
+
type,
|
|
46
|
+
disabled: unavailable,
|
|
47
|
+
activate,
|
|
48
|
+
});
|
|
49
|
+
// RNW gives the host type="button". Hand the default action back to the browser
|
|
50
|
+
// only when there is no FormArea to perform validation and submit.
|
|
51
|
+
const webType = type === 'submit' && !form ? 'submit' : 'button';
|
|
52
|
+
const setWebType = useCallback((host) => {
|
|
53
|
+
if (typeof HTMLButtonElement !== 'undefined' && host instanceof HTMLButtonElement) {
|
|
54
|
+
host.type = webType;
|
|
55
|
+
}
|
|
56
|
+
}, [webType]);
|
|
57
|
+
return (_jsxs(Pressable, { ref: setWebType, className: classes, disabled: unavailable, onPress: onClick || submit ? activate : undefined, testID: testId, accessibilityRole: "button", accessibilityState: { disabled: unavailable, busy: loading }, children: [loading && _jsx(ActivityIndicator, { size: "small", className: cm.buttonIconLeft }), !loading && !!leftIcon && (_jsx(View, { className: cm.buttonIconLeft, children: leftIcon })), _jsx(Text, { children: loading && loadingText ? loadingText : children }), !loading && !!rightIcon && (_jsx(View, { className: cm.buttonIconRight, children: rightIcon }))] }));
|
|
26
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CASA,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAEA,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
import { useEffect, useState } from 'react';
|
|
8
|
-
import { Animated, View } from 'react-native';
|
|
8
|
+
import { Animated, Platform, View } from 'react-native';
|
|
9
9
|
import { getClassMap } from '@molecule/app-ui';
|
|
10
10
|
/**
|
|
11
11
|
* Renders a Skeleton component.
|
|
@@ -23,24 +23,25 @@ export const Skeleton = ({ width, height, circle, animation = 'pulse', className
|
|
|
23
23
|
// The animated value is created once per mount and kept in state; a ref would
|
|
24
24
|
// have to be read while rendering.
|
|
25
25
|
const [opacity] = useState(() => new Animated.Value(1));
|
|
26
|
+
// Web uses the ClassMap's CSS animation.
|
|
27
|
+
const nativePulse = animation === 'pulse' && Platform.OS !== 'web';
|
|
26
28
|
useEffect(() => {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [animation, opacity]);
|
|
29
|
+
if (!nativePulse)
|
|
30
|
+
return undefined;
|
|
31
|
+
const pulse = Animated.loop(Animated.sequence([
|
|
32
|
+
Animated.timing(opacity, { toValue: 0.5, duration: 1000, useNativeDriver: true }),
|
|
33
|
+
Animated.timing(opacity, { toValue: 1, duration: 1000, useNativeDriver: true }),
|
|
34
|
+
]));
|
|
35
|
+
pulse.start();
|
|
36
|
+
return () => pulse.stop();
|
|
37
|
+
}, [nativePulse, opacity]);
|
|
37
38
|
const classes = cm.cn(cm.skeleton(), animation === 'wave' && cm.skeletonWave, animation === 'none' && cm.skeletonNone, circle && cm.skeletonCircle, className);
|
|
38
39
|
const sizeStyle = {
|
|
39
40
|
...(width !== undefined ? { width: width } : {}),
|
|
40
41
|
...(height !== undefined ? { height: height } : {}),
|
|
41
42
|
...(circle && width ? { borderRadius: typeof width === 'number' ? width / 2 : undefined } : {}),
|
|
42
43
|
};
|
|
43
|
-
return (_jsx(Animated.View, { className: classes, style: [sizeStyle, { opacity:
|
|
44
|
+
return (_jsx(Animated.View, { className: classes, style: [sizeStyle, { opacity: nativePulse ? opacity : 1 }], testID: testId }));
|
|
44
45
|
};
|
|
45
46
|
/**
|
|
46
47
|
* Renders a SkeletonText component.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ActivityIndicator, View } from 'react-native';
|
|
2
|
+
import { ActivityIndicator, Platform, View } from 'react-native';
|
|
3
3
|
import { useTranslation } from '@molecule/app-react';
|
|
4
4
|
import { getClassMap } from '@molecule/app-ui';
|
|
5
5
|
const sizeMap = {
|
|
@@ -21,5 +21,5 @@ export const Spinner = ({ size = 'md', className, testId }) => {
|
|
|
21
21
|
const { t } = useTranslation();
|
|
22
22
|
const cm = getClassMap();
|
|
23
23
|
const classes = cm.cn(cm.spinner({ size }), className);
|
|
24
|
-
return (_jsx(View, { className: classes, testID: testId, accessibilityRole: "progressbar", accessibilityLabel: t('ui.spinner.loading', undefined, { defaultValue: 'Loading' }), children: _jsx(ActivityIndicator, { size: sizeMap[size] || 'small' }) }));
|
|
24
|
+
return (_jsx(View, { className: classes, testID: testId, accessibilityRole: "progressbar", accessibilityLabel: t('ui.spinner.loading', undefined, { defaultValue: 'Loading' }), children: Platform.OS !== 'web' && _jsx(ActivityIndicator, { size: sizeMap[size] || 'small' }) }));
|
|
25
25
|
};
|
package/dist/elements/Box.js
CHANGED
|
@@ -61,6 +61,7 @@ function BoxView(props) {
|
|
|
61
61
|
const delegatedDrag = !ownDrag && secondary ? inheritedDrag : null;
|
|
62
62
|
const responder = useNativeDrag(delegatedDrag?.frame ?? frame, {
|
|
63
63
|
drag: ownDrag ?? delegatedDrag?.drag,
|
|
64
|
+
zoom: hidden ? undefined : props.zoom,
|
|
64
65
|
secondary,
|
|
65
66
|
press: interaction,
|
|
66
67
|
});
|
|
@@ -82,7 +83,6 @@ function BoxView(props) {
|
|
|
82
83
|
importantForAccessibility: hidden ? 'no-hide-descendants' : undefined,
|
|
83
84
|
pointerEvents: hidden ? 'none' : undefined,
|
|
84
85
|
collapsable: ref ? false : undefined,
|
|
85
|
-
onLayout: ref ? layoutChanged : undefined,
|
|
86
86
|
onTouchStart: props.onTouchStart
|
|
87
87
|
? (event) => {
|
|
88
88
|
outside.onTouchStart?.(event);
|
|
@@ -94,6 +94,13 @@ function BoxView(props) {
|
|
|
94
94
|
...responder,
|
|
95
95
|
...dragViewActions(props, interaction, interaction.onPress ? () => activatePress(props.onClick, activateLabel) : undefined, secondary),
|
|
96
96
|
}),
|
|
97
|
+
onLayout: ref || responder
|
|
98
|
+
? (event) => {
|
|
99
|
+
responder?.onLayout?.(event);
|
|
100
|
+
if (ref)
|
|
101
|
+
layoutChanged();
|
|
102
|
+
}
|
|
103
|
+
: undefined,
|
|
97
104
|
className: split.view || undefined,
|
|
98
105
|
style: [
|
|
99
106
|
resolvedStyle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../src/elements/Pressable.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAmC,MAAM,OAAO,CAAA;AAG1E,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,kBAAkB,CAAA;AA0BlE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE9D;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,eAAe,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../src/elements/Pressable.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAmC,MAAM,OAAO,CAAA;AAG1E,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,kBAAkB,CAAA;AA0BlE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE9D;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,eAAe,GAAG,YAAY,CA+G5F"}
|
|
@@ -72,6 +72,7 @@ export function Pressable(props) {
|
|
|
72
72
|
const secondary = disabled ? undefined : props.secondaryAction;
|
|
73
73
|
const responder = useNativeDrag(frame, {
|
|
74
74
|
drag: disabled ? undefined : props.drag,
|
|
75
|
+
zoom: disabled ? undefined : props.zoom,
|
|
75
76
|
secondary,
|
|
76
77
|
press,
|
|
77
78
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeField.d.ts","sourceRoot":"","sources":["../../src/elements/RangeField.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"RangeField.d.ts","sourceRoot":"","sources":["../../src/elements/RangeField.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAuDtE;;GAEG;AACH,eAAO,MAAM,UAAU,2GAgRtB,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
*
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import sliderExport from '@react-native-community/slider';
|
|
9
9
|
import { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
10
10
|
import { AccessibilityInfo, findNodeHandle, Platform, UIManager, View, } from 'react-native';
|
|
11
11
|
import { nativeAccessibility } from './accessibility.js';
|
|
@@ -18,6 +18,11 @@ import { useLabelable } from './labels.js';
|
|
|
18
18
|
import { getNativeKeyboardView, RANGE_DIRECTIONAL_KEYS, rangeKeyboardEvent, } from './rangeKeyboard.js';
|
|
19
19
|
import { finiteRangeNumber, rangeValues } from './rangeValues.js';
|
|
20
20
|
import { nativeStyle } from './style.js';
|
|
21
|
+
/** The slider component, also when Vite's ES module interop exposes its CommonJS exports object. */
|
|
22
|
+
function resolveSlider(exported) {
|
|
23
|
+
return 'default' in exported ? exported.default : exported;
|
|
24
|
+
}
|
|
25
|
+
const Slider = resolveSlider(sliderExport);
|
|
21
26
|
const ADJUST_ACTIONS = [{ name: 'increment' }, { name: 'decrement' }];
|
|
22
27
|
/** Gives the rotated track a vertical layout footprint. */
|
|
23
28
|
function verticalFrame(style) {
|
|
@@ -180,6 +185,8 @@ export const RangeField = forwardRef(function RangeField(props, ref) {
|
|
|
180
185
|
role: android ? 'slider' : undefined,
|
|
181
186
|
accessibilityRole: android ? undefined : 'adjustable',
|
|
182
187
|
accessibilityLabel: props['aria-label'] ?? label,
|
|
188
|
+
accessibilityLanguage: accessibility.accessibilityLanguage,
|
|
189
|
+
lang: accessibility.lang,
|
|
183
190
|
accessibilityLabelledBy: props['aria-labelledby'],
|
|
184
191
|
accessibilityState: { disabled: disabled || accessibility['aria-disabled'] },
|
|
185
192
|
accessibilityValue: exposeNumbers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectAction.d.ts","sourceRoot":"","sources":["../../src/elements/SelectAction.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,qBAAqB,EAG1B,KAAK,cAAc,EAInB,KAAK,SAAS,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAS7F,sFAAsF;AACtF,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAChC;AAED,UAAU,iBAAkB,SAAQ,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,YAAY,CAAC;IAC7F,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,CA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B,KAAK,IAAI,CAAA;CAC/C;AAED,mFAAmF;AACnF,eAAO,MAAM,YAAY,kHA+KvB,CAAA"}
|
|
@@ -56,6 +56,10 @@ export const SelectAction = forwardRef(function SelectAction({ keyboard: useHard
|
|
|
56
56
|
const host = keyboard ? hardware.current : stock.current;
|
|
57
57
|
if (!focusRequest || disabled || !host)
|
|
58
58
|
return;
|
|
59
|
+
if (Platform.OS === 'web') {
|
|
60
|
+
host.focus();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
59
63
|
const tag = findNodeHandle(host);
|
|
60
64
|
if (tag === null)
|
|
61
65
|
return;
|
package/dist/elements/Svg.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export declare function Polygon(props: SvgPolyProps): ReactElement;
|
|
|
109
109
|
* @param props - See {@link SvgGroupProps}.
|
|
110
110
|
* @returns The element.
|
|
111
111
|
*/
|
|
112
|
-
export declare function G({ drag, ...props }: SvgGroupProps<ShapeNode>): ReactElement;
|
|
112
|
+
export declare function G({ drag, zoom, ...props }: SvgGroupProps<ShapeNode>): ReactElement;
|
|
113
113
|
/**
|
|
114
114
|
* SVG text.
|
|
115
115
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Svg.d.ts","sourceRoot":"","sources":["../../src/elements/Svg.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,YAAY,EAOlB,MAAM,OAAO,CAAA;AAiCd,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,cAAc,EAEnB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAA;
|
|
1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,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,SAAS,CAAC,GAAG,YAAY,CAM3F;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,GAAG,YAAY,CAExE"}
|
package/dist/elements/Svg.js
CHANGED
|
@@ -11,7 +11,8 @@ import { getFont } from '@molecule/app-fonts';
|
|
|
11
11
|
import { getClassMap, } from '@molecule/app-ui';
|
|
12
12
|
import { nativeAccessibility } from './accessibility.js';
|
|
13
13
|
import { useImageSource } from './documentUrl.js';
|
|
14
|
-
import {
|
|
14
|
+
import { SvgDragScope, useNativeDrag } from './drag.js';
|
|
15
|
+
import { useDragModifiers } from './dragModifiers.js';
|
|
15
16
|
import { keyboardEvent, mouseEvent } from './events.js';
|
|
16
17
|
import { registerInline } from './flow.js';
|
|
17
18
|
import { useGridCell } from './grid.js';
|
|
@@ -39,8 +40,12 @@ function Canvas(props) {
|
|
|
39
40
|
const forward = useNativeRef(props.elementRef);
|
|
40
41
|
const hover = useSvgHover(props);
|
|
41
42
|
const hoverHost = hover.host;
|
|
43
|
+
const modifiers = useDragModifiers();
|
|
44
|
+
const dragScope = useMemo(() => ({ frame: hoverHost, modifiers }), [hoverHost, modifiers]);
|
|
42
45
|
const responder = useNativeDrag(hoverHost, {
|
|
46
|
+
modifiers,
|
|
43
47
|
drag: props.style?.pointerEvents === 'none' ? undefined : props.drag,
|
|
48
|
+
zoom: props.style?.pointerEvents === 'none' ? undefined : props.zoom,
|
|
44
49
|
press: { onPress: canvas.props.onPress },
|
|
45
50
|
});
|
|
46
51
|
const ref = useCallback((view) => {
|
|
@@ -77,7 +82,10 @@ function Canvas(props) {
|
|
|
77
82
|
? getClassMap().renderNativeTextColor?.(textClasses, renderDrawing)
|
|
78
83
|
: undefined;
|
|
79
84
|
const content = markup === undefined ? (isValidElement(styledDrawing) ? (styledDrawing) : (renderDrawing(undefined))) : (_jsx(SvgXml, { ...drawing, xml: `<svg>${markup}</svg>` }));
|
|
80
|
-
return (_jsxs(View, { ref: ref, collapsable: false, onTouchStart: onTouchStart, pointerEvents: responder ? 'auto' : 'box-none', ...hover.handlers, ...responder,
|
|
85
|
+
return (_jsxs(View, { ref: ref, collapsable: false, onTouchStart: onTouchStart, pointerEvents: responder ? 'auto' : 'box-none', ...hover.handlers, ...responder, ...modifiers.handlers, onPointerMoveCapture: (event) => {
|
|
86
|
+
hover.handlers.onPointerMoveCapture?.(event);
|
|
87
|
+
modifiers.handlers.onPointerMoveCapture?.(event);
|
|
88
|
+
}, accessibilityElementsHidden: hidden, importantForAccessibility: hidden ? 'no-hide-descendants' : undefined, style: canvas.frameStyle, className: canvas.frameClassName, children: [_jsx(SvgDragScope.Provider, { value: dragScope, children: _jsx(SvgFocusScope.Provider, { value: hidden ? null : register, children: _jsx(SvgHoverScope.Provider, { value: hover.register, children: content }) }) }), rootFocusable && _jsx(SvgFocusTarget, { target: focusTarget(props, canvas.accessibility), fill: true }), !hidden &&
|
|
81
89
|
Array.from(targets, ([id, target]) => _jsx(SvgFocusTarget, { target: target }, id))] }));
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
@@ -393,11 +401,13 @@ export function Polygon(props) {
|
|
|
393
401
|
* @param props - See {@link SvgGroupProps}.
|
|
394
402
|
* @returns The element.
|
|
395
403
|
*/
|
|
396
|
-
export function G({ drag, ...props }) {
|
|
397
|
-
const
|
|
404
|
+
export function G({ drag, zoom, ...props }) {
|
|
405
|
+
const scope = useContext(SvgDragScope);
|
|
398
406
|
const shape = useShape(props);
|
|
399
|
-
const responder = useNativeDrag(frame, {
|
|
407
|
+
const responder = useNativeDrag(scope?.frame ?? null, {
|
|
408
|
+
modifiers: scope?.modifiers,
|
|
400
409
|
drag: props.style?.pointerEvents === 'none' ? undefined : drag,
|
|
410
|
+
zoom: props.style?.pointerEvents === 'none' ? undefined : zoom,
|
|
401
411
|
press: { onPress: shape.onPress },
|
|
402
412
|
});
|
|
403
413
|
return (_jsx(NativeG, { ...shape, ...responder, onPress: responder ? undefined : shape.onPress, onLayout: shape.onLayout || responder?.onLayout
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type ReactNode } from 'react';
|
|
7
7
|
import { type ViewProps } from 'react-native';
|
|
8
|
-
import type {
|
|
8
|
+
import type { ElementProps } from '@molecule/app-ui';
|
|
9
9
|
/** The accessibility and identity props every native element receives. */
|
|
10
|
-
export type NativeAccessibility = Pick<ViewProps, 'role' | 'id' | 'testID' | 'aria-label' | 'aria-labelledby' | 'aria-hidden' | 'aria-disabled' | 'aria-expanded' | 'aria-selected' | 'aria-checked' | 'aria-busy' | 'aria-live' | 'aria-modal' | 'aria-valuemax' | 'aria-valuemin' | 'aria-valuenow' | 'aria-valuetext' | 'aria-level' | 'accessibilityHint'> & {
|
|
10
|
+
export type NativeAccessibility = Pick<ViewProps, 'role' | 'id' | 'testID' | 'aria-label' | 'aria-labelledby' | 'aria-hidden' | 'aria-disabled' | 'aria-expanded' | 'aria-selected' | 'aria-checked' | 'aria-busy' | 'aria-live' | 'aria-modal' | 'aria-valuemax' | 'aria-valuemin' | 'aria-valuenow' | 'aria-valuetext' | 'aria-level' | 'accessibilityHint' | 'accessibilityLanguage' | 'accessibilityLiveRegion'> & Pick<ElementProps, 'lang'> & {
|
|
11
11
|
accessibilityCollectionItem?: {
|
|
12
12
|
rowIndex: number;
|
|
13
13
|
columnIndex: number;
|
|
@@ -17,9 +17,7 @@ export type NativeAccessibility = Pick<ViewProps, 'role' | 'id' | 'testID' | 'ar
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
/** The element props {@link nativeAccessibility} reads. */
|
|
20
|
-
export type AccessibilitySource =
|
|
21
|
-
id?: string;
|
|
22
|
-
role?: ElementRole;
|
|
20
|
+
export type AccessibilitySource = ElementProps & {
|
|
23
21
|
children?: ReactNode;
|
|
24
22
|
};
|
|
25
23
|
/**
|
|
@@ -27,6 +25,8 @@ export type AccessibilitySource = AriaAttributes & DataAttributes & {
|
|
|
27
25
|
* implies), the ARIA attributes React Native applies (`aria-pressed` and `aria-current` read as
|
|
28
26
|
* selected), its id, and `data-mol-id` (else `data-testid`) as its `testID`. Other `data-*` attributes and ARIA
|
|
29
27
|
* attributes React Native has no equivalent for are left out.
|
|
28
|
+
* React Native Web forwards `lang` to HTML. Device renderers receive `accessibilityLanguage`,
|
|
29
|
+
* which React Native 0.79 applies on iOS.
|
|
30
30
|
*
|
|
31
31
|
* @param props - The element's props.
|
|
32
32
|
* @param tag - The element's web tag.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/elements/accessibility.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAGvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/elements/accessibility.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAGvD,OAAO,KAAK,EAA+B,YAAY,EAAe,MAAM,kBAAkB,CAAA;AA2H9F,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,SAAS,EACP,MAAM,GACN,IAAI,GACJ,QAAQ,GACR,YAAY,GACZ,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,eAAe,GACf,eAAe,GACf,cAAc,GACd,WAAW,GACX,WAAW,GACX,YAAY,GACZ,eAAe,GACf,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,uBAAuB,GACvB,yBAAyB,CAC5B,GACC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG;IAC3B,2BAA2B,CAAC,EAAE;QAC5B,QAAQ,EAAE,MAAM,CAAA;QAChB,WAAW,EAAE,MAAM,CAAA;QACnB,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,OAAO,CAAA;KACjB,CAAA;CACF,CAAA;AAYH,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AA8FzE;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAmCjG"}
|
|
@@ -201,6 +201,8 @@ function collectionAccessibility(props, role, level) {
|
|
|
201
201
|
* implies), the ARIA attributes React Native applies (`aria-pressed` and `aria-current` read as
|
|
202
202
|
* selected), its id, and `data-mol-id` (else `data-testid`) as its `testID`. Other `data-*` attributes and ARIA
|
|
203
203
|
* attributes React Native has no equivalent for are left out.
|
|
204
|
+
* React Native Web forwards `lang` to HTML. Device renderers receive `accessibilityLanguage`,
|
|
205
|
+
* which React Native 0.79 applies on iOS.
|
|
204
206
|
*
|
|
205
207
|
* @param props - The element's props.
|
|
206
208
|
* @param tag - The element's web tag.
|
|
@@ -216,6 +218,7 @@ export function nativeAccessibility(props, tag) {
|
|
|
216
218
|
const level = props['aria-level'] ?? (tag ? HEADING_LEVEL[tag] : undefined);
|
|
217
219
|
return {
|
|
218
220
|
...collectionAccessibility(props, role, level),
|
|
221
|
+
...(Platform.OS === 'web' ? { lang: props.lang } : { accessibilityLanguage: props.lang }),
|
|
219
222
|
role,
|
|
220
223
|
id: props.id,
|
|
221
224
|
testID: testID === undefined ? undefined : String(testID),
|
|
@@ -229,6 +232,8 @@ export function nativeAccessibility(props, tag) {
|
|
|
229
232
|
'aria-checked': checked === 'mixed' ? 'mixed' : ariaFlag(checked),
|
|
230
233
|
'aria-busy': ariaFlag(props['aria-busy']),
|
|
231
234
|
'aria-live': live,
|
|
235
|
+
// Android Text forwards native props directly without the View aria-live conversion.
|
|
236
|
+
accessibilityLiveRegion: Platform.OS === 'android' ? (live === 'off' ? 'none' : live) : undefined,
|
|
232
237
|
'aria-modal': ariaFlag(props['aria-modal']),
|
|
233
238
|
'aria-valuemax': props['aria-valuemax'],
|
|
234
239
|
'aria-valuemin': props['aria-valuemin'],
|
package/dist/elements/drag.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { type RefCallback, type RefObject } from 'react';
|
|
2
2
|
import type { PressableProps, View, ViewProps } from 'react-native';
|
|
3
|
-
import type { BoxProps, ElementDrag, InteractionProps } from '@molecule/app-ui';
|
|
3
|
+
import type { BoxProps, ElementDrag, ElementZoom, InteractionProps } from '@molecule/app-ui';
|
|
4
|
+
import { type DragModifiers } from './dragModifiers.js';
|
|
4
5
|
type FrameHost = Pick<View, 'measure' | 'measureInWindow'>;
|
|
5
6
|
type FrameRef = RefObject<FrameHost | null>;
|
|
6
7
|
type PressHandlers = Pick<PressableProps, 'onPress' | 'onPressIn' | 'onPressOut' | 'onLongPress'>;
|
|
7
8
|
type AccessiblePressHandlers = Pick<PressableProps, 'onFocus' | 'onBlur' | 'focusable' | 'onPointerDown' | 'accessibilityActions' | 'onAccessibilityAction'>;
|
|
8
9
|
type Options = {
|
|
9
10
|
drag?: ElementDrag;
|
|
11
|
+
zoom?: ElementZoom;
|
|
12
|
+
modifiers?: DragModifiers;
|
|
10
13
|
secondary?: BoxProps['secondaryAction'];
|
|
11
14
|
press?: PressHandlers;
|
|
12
15
|
};
|
|
13
|
-
type Responder = Pick<ViewProps, 'onStartShouldSetResponder' | 'onResponderGrant' | 'onResponderMove' | 'onResponderEnd' | 'onResponderRelease' | 'onResponderTerminate' | 'onResponderTerminationRequest' | 'onLayout'>;
|
|
14
|
-
/** The viewport
|
|
15
|
-
export declare const
|
|
16
|
+
type Responder = Pick<ViewProps, 'onStartShouldSetResponder' | 'onResponderGrant' | 'onResponderStart' | 'onResponderMove' | 'onResponderEnd' | 'onResponderRelease' | 'onResponderTerminate' | 'onResponderTerminationRequest' | 'onLayout' | 'onPointerDownCapture' | 'onPointerMoveCapture' | 'onPointerUpCapture'>;
|
|
17
|
+
/** The viewport and pointer stream shared by the shapes in a native SVG canvas. */
|
|
18
|
+
export declare const SvgDragScope: import("react").Context<{
|
|
19
|
+
frame: FrameRef;
|
|
20
|
+
modifiers: DragModifiers;
|
|
21
|
+
} | null>;
|
|
16
22
|
/** Lets a descendant with a secondary tap action negotiate its ancestor's long-press drag. */
|
|
17
23
|
export declare const LongPressDragScope: import("react").Context<{
|
|
18
24
|
frame: FrameRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../src/elements/drag.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAGV,cAAc,EACd,IAAI,EACJ,SAAS,EACV,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EACV,QAAQ,EAER,WAAW,EAEX,gBAAgB,
|
|
1
|
+
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../src/elements/drag.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAGV,cAAc,EACd,IAAI,EACJ,SAAS,EACV,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EACV,QAAQ,EAER,WAAW,EAEX,WAAW,EACX,gBAAgB,EAEjB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,oBAAoB,CAAA;AAGzE,KAAK,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CA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