panelui-native 0.111.0 → 0.112.1
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/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/file-upload/file-upload-core.js +317 -0
- package/lib/module/components/file-upload/file-upload-core.js.map +1 -0
- package/lib/module/components/file-upload/index.js +1214 -0
- package/lib/module/components/file-upload/index.js.map +1 -0
- package/lib/module/icons/index.js +10 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/animated-pressable.js +31 -6
- package/lib/module/primitives/animated-pressable.js.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +7 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/file-upload/file-upload-core.d.ts +136 -0
- package/lib/typescript/src/components/file-upload/file-upload-core.d.ts.map +1 -0
- package/lib/typescript/src/components/file-upload/index.d.ts +265 -0
- package/lib/typescript/src/components/file-upload/index.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +2 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/animated-pressable.d.ts +15 -1
- package/lib/typescript/src/primitives/animated-pressable.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/components/button/index.tsx +7 -0
- package/src/components/file-upload/file-upload-core.ts +359 -0
- package/src/components/file-upload/index.tsx +1435 -0
- package/src/icons/index.tsx +4 -0
- package/src/index.ts +24 -0
- package/src/primitives/animated-pressable.tsx +44 -6
package/src/icons/index.tsx
CHANGED
|
@@ -83,6 +83,7 @@ import HgDownload01Icon from '@hugeicons/core-free-icons/Download01Icon';
|
|
|
83
83
|
import HgDragDropVerticalIcon from '@hugeicons/core-free-icons/DragDropVerticalIcon';
|
|
84
84
|
import HgEyeIcon from '@hugeicons/core-free-icons/EyeIcon';
|
|
85
85
|
import HgFavouriteIcon from '@hugeicons/core-free-icons/FavouriteIcon';
|
|
86
|
+
import HgCloudUploadIcon from '@hugeicons/core-free-icons/CloudUploadIcon';
|
|
86
87
|
import HgFile01Icon from '@hugeicons/core-free-icons/File01Icon';
|
|
87
88
|
import HgFolder01Icon from '@hugeicons/core-free-icons/Folder01Icon';
|
|
88
89
|
import HgFolderOpenIcon from '@hugeicons/core-free-icons/FolderOpenIcon';
|
|
@@ -90,6 +91,7 @@ import HgFullScreenIcon from '@hugeicons/core-free-icons/FullScreenIcon';
|
|
|
90
91
|
import HgGlobeIcon from '@hugeicons/core-free-icons/GlobeIcon';
|
|
91
92
|
import HgHeading01Icon from '@hugeicons/core-free-icons/Heading01Icon';
|
|
92
93
|
import HgImage01Icon from '@hugeicons/core-free-icons/Image01Icon';
|
|
94
|
+
import HgVideo01Icon from '@hugeicons/core-free-icons/Video01Icon';
|
|
93
95
|
import HgInformationCircleIcon from '@hugeicons/core-free-icons/InformationCircleIcon';
|
|
94
96
|
import HgKeyboardIcon from '@hugeicons/core-free-icons/KeyboardIcon';
|
|
95
97
|
import HgLeftToRightListBulletIcon from '@hugeicons/core-free-icons/LeftToRightListBulletIcon';
|
|
@@ -357,6 +359,8 @@ export const FolderOpenIcon = icon(HgFolderOpenIcon, { size: 16, color: '#737373
|
|
|
357
359
|
export const ImageIcon = icon(HgImage01Icon, { size: 16, color: '#737373' });
|
|
358
360
|
export const PaperclipIcon = icon(HgAttachment01Icon, { size: 16, color: '#737373' });
|
|
359
361
|
export const CameraIcon = icon(HgCamera01Icon, { size: 16, color: '#737373' });
|
|
362
|
+
export const VideoIcon = icon(HgVideo01Icon, { size: 16, color: '#737373' });
|
|
363
|
+
export const UploadIcon = icon(HgCloudUploadIcon, { size: 16, color: '#737373' });
|
|
360
364
|
export const MicIcon = icon(HgMic01Icon, { size: 16, color: '#737373' });
|
|
361
365
|
export const AudioLinesIcon = icon(HgAudioWave01Icon, { size: 16, color: '#737373' });
|
|
362
366
|
export const PlayIcon = icon(HgPlayIcon, { size: 16, color: '#737373' });
|
package/src/index.ts
CHANGED
|
@@ -267,6 +267,28 @@ export {
|
|
|
267
267
|
type FlowRect,
|
|
268
268
|
type FlowPoint,
|
|
269
269
|
} from './components/flow';
|
|
270
|
+
export {
|
|
271
|
+
FileUpload,
|
|
272
|
+
describeFileStatus,
|
|
273
|
+
describeFileUploadRules,
|
|
274
|
+
formatFileSize,
|
|
275
|
+
hasFileUploadSource,
|
|
276
|
+
useFileUpload,
|
|
277
|
+
type FileUploadDropzoneProps,
|
|
278
|
+
type FileUploadFile,
|
|
279
|
+
type FileUploadGridProps,
|
|
280
|
+
type FileUploadHandler,
|
|
281
|
+
type FileUploadHandlerContext,
|
|
282
|
+
type FileUploadImageOptions,
|
|
283
|
+
type FileUploadItemProps,
|
|
284
|
+
type FileUploadKind,
|
|
285
|
+
type FileUploadListProps,
|
|
286
|
+
type FileUploadProps,
|
|
287
|
+
type FileUploadRejection,
|
|
288
|
+
type FileUploadSource,
|
|
289
|
+
type FileUploadStatus,
|
|
290
|
+
type FileUploadTriggerProps,
|
|
291
|
+
} from './components/file-upload';
|
|
270
292
|
export {
|
|
271
293
|
FlipCard,
|
|
272
294
|
useFlipCard,
|
|
@@ -1627,6 +1649,8 @@ export {
|
|
|
1627
1649
|
SunIcon,
|
|
1628
1650
|
TrashIcon,
|
|
1629
1651
|
UnlockIcon,
|
|
1652
|
+
UploadIcon,
|
|
1653
|
+
VideoIcon,
|
|
1630
1654
|
XIcon,
|
|
1631
1655
|
useIconColor,
|
|
1632
1656
|
type IconProps,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { forwardRef, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Pressable,
|
|
4
|
+
StyleSheet,
|
|
4
5
|
type GestureResponderEvent,
|
|
5
6
|
type PressableProps,
|
|
6
7
|
type View,
|
|
@@ -11,6 +12,7 @@ import Animated, {
|
|
|
11
12
|
withSpring,
|
|
12
13
|
withTiming,
|
|
13
14
|
} from 'react-native-reanimated';
|
|
15
|
+
import { useResolveClassNames } from 'uniwind';
|
|
14
16
|
|
|
15
17
|
const AnimatedPressableBase = Animated.createAnimatedComponent(Pressable);
|
|
16
18
|
|
|
@@ -20,20 +22,53 @@ export interface AnimatedPressableProps extends PressableProps {
|
|
|
20
22
|
className?: string;
|
|
21
23
|
/** Scale applied while pressed. Set to 1 to disable. Default 0.97. */
|
|
22
24
|
pressScale?: number;
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Opacity applied while pressed, as a fraction of the resting opacity. Set
|
|
27
|
+
* to 1 to disable. Default 1.
|
|
28
|
+
*/
|
|
24
29
|
pressOpacity?: number;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
/**
|
|
28
33
|
* Pressable with UI-thread press feedback (scale/opacity via Reanimated).
|
|
29
34
|
* The shared base for every interactive PanelUI component.
|
|
35
|
+
*
|
|
36
|
+
* The animated style is applied after the `className` styles, so any key it
|
|
37
|
+
* writes beats the same key from a class. That is why it writes `opacity` only
|
|
38
|
+
* when the press actually fades: a component that dims itself when disabled
|
|
39
|
+
* (`opacity-[0.64]`, or a caller's `disabled:opacity-50`) does it through the
|
|
40
|
+
* class, and an animated `opacity: 1` at rest would undo it on every render.
|
|
41
|
+
*
|
|
42
|
+
* A pressable that does fade owns its opacity outright, so it reads the
|
|
43
|
+
* resting value from `style` or `className` and fades from there rather than
|
|
44
|
+
* from 1. Keep `pressOpacity` either 1 or not for the life of a component:
|
|
45
|
+
* the style's keys follow it.
|
|
30
46
|
*/
|
|
31
47
|
export const AnimatedPressable = forwardRef<View, AnimatedPressableProps>(
|
|
32
48
|
(
|
|
33
|
-
{
|
|
49
|
+
{
|
|
50
|
+
pressScale = 0.97,
|
|
51
|
+
pressOpacity = 1,
|
|
52
|
+
onPressIn,
|
|
53
|
+
onPressOut,
|
|
54
|
+
style,
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
},
|
|
34
58
|
ref
|
|
35
59
|
) => {
|
|
36
60
|
const pressed = useSharedValue(0);
|
|
61
|
+
const fades = pressOpacity !== 1;
|
|
62
|
+
|
|
63
|
+
// Only resolved when the press fades; an empty class resolves to nothing.
|
|
64
|
+
const classStyle = useResolveClassNames(fades ? (className ?? '') : '');
|
|
65
|
+
const ownStyle = typeof style === 'function' ? undefined : StyleSheet.flatten(style);
|
|
66
|
+
const restingOpacity =
|
|
67
|
+
typeof ownStyle?.opacity === 'number'
|
|
68
|
+
? ownStyle.opacity
|
|
69
|
+
: typeof classStyle.opacity === 'number'
|
|
70
|
+
? classStyle.opacity
|
|
71
|
+
: 1;
|
|
37
72
|
|
|
38
73
|
const handlePressIn = useCallback(
|
|
39
74
|
(event: GestureResponderEvent) => {
|
|
@@ -51,14 +86,17 @@ export const AnimatedPressable = forwardRef<View, AnimatedPressableProps>(
|
|
|
51
86
|
[onPressOut, pressed]
|
|
52
87
|
);
|
|
53
88
|
|
|
54
|
-
const animatedStyle = useAnimatedStyle(() =>
|
|
55
|
-
transform
|
|
56
|
-
|
|
57
|
-
|
|
89
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
90
|
+
const transform = [{ scale: 1 + pressed.value * (pressScale - 1) }];
|
|
91
|
+
return fades
|
|
92
|
+
? { transform, opacity: restingOpacity * (1 + pressed.value * (pressOpacity - 1)) }
|
|
93
|
+
: { transform };
|
|
94
|
+
});
|
|
58
95
|
|
|
59
96
|
return (
|
|
60
97
|
<AnimatedPressableBase
|
|
61
98
|
ref={ref}
|
|
99
|
+
className={className}
|
|
62
100
|
style={[animatedStyle, style as never]}
|
|
63
101
|
onPressIn={handlePressIn}
|
|
64
102
|
onPressOut={handlePressOut}
|