@admin-layout/gluestack-ui-mobile 11.0.4-alpha.4 → 12.0.16-alpha.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/CHANGELOG.md +63 -13
- package/lib/components/AuthWrapper.js +5 -3
- package/lib/components/AuthWrapper.js.map +1 -1
- package/lib/components/WithConfiguration.js +1 -1
- package/lib/components/WithConfiguration.js.map +1 -1
- package/lib/components/ui/accordion/index.web.d.ts +209 -0
- package/lib/components/ui/accordion/index.web.js +156 -0
- package/lib/components/ui/accordion/index.web.js.map +1 -0
- package/lib/components/ui/actionsheet/index.web.d.ts +872 -0
- package/lib/components/ui/actionsheet/index.web.js +286 -0
- package/lib/components/ui/actionsheet/index.web.js.map +1 -0
- package/lib/components/ui/alert/index.web.d.ts +135 -0
- package/lib/components/ui/alert/index.web.js +38 -0
- package/lib/components/ui/alert/index.web.js.map +1 -0
- package/lib/components/ui/alert-dialog/index.web.d.ts +64 -0
- package/lib/components/ui/alert-dialog/index.web.js +139 -0
- package/lib/components/ui/alert-dialog/index.web.js.map +1 -0
- package/lib/components/ui/avatar/index.web.d.ts +21 -0
- package/lib/components/ui/avatar/index.web.js +92 -0
- package/lib/components/ui/avatar/index.web.js.map +1 -0
- package/lib/components/ui/badge/index.web.d.ts +382 -0
- package/lib/components/ui/badge/index.web.js +138 -0
- package/lib/components/ui/badge/index.web.js.map +1 -0
- package/lib/components/ui/button/index.web.d.ts +247 -0
- package/lib/components/ui/button/index.web.js +57 -0
- package/lib/components/ui/button/index.web.js.map +1 -0
- package/lib/components/ui/checkbox/index.web.d.ts +265 -0
- package/lib/components/ui/checkbox/index.web.js +77 -0
- package/lib/components/ui/checkbox/index.web.js.map +1 -0
- package/lib/components/ui/divider/index.web.d.ts +53 -0
- package/lib/components/ui/divider/index.web.js +21 -0
- package/lib/components/ui/divider/index.web.js.map +1 -0
- package/lib/components/ui/drawer/index.web.d.ts +174 -0
- package/lib/components/ui/drawer/index.web.js +65 -0
- package/lib/components/ui/drawer/index.web.js.map +1 -0
- package/lib/components/ui/fab/index.web.d.ts +520 -0
- package/lib/components/ui/fab/index.web.js +146 -0
- package/lib/components/ui/fab/index.web.js.map +1 -0
- package/lib/components/ui/flat-list/index.web.d.ts +21 -0
- package/lib/components/ui/flat-list/index.web.js +41 -0
- package/lib/components/ui/flat-list/index.web.js.map +1 -0
- package/lib/components/ui/form-control/index.web.d.ts +2071 -0
- package/lib/components/ui/form-control/index.web.js +290 -0
- package/lib/components/ui/form-control/index.web.js.map +1 -0
- package/lib/components/ui/image/index.web.d.ts +142 -0
- package/lib/components/ui/image/index.web.js +29 -0
- package/lib/components/ui/image/index.web.js.map +1 -0
- package/lib/components/ui/image-background/index.web.d.ts +8 -0
- package/lib/components/ui/image-background/index.web.js +23 -0
- package/lib/components/ui/image-background/index.web.js.map +1 -0
- package/lib/components/ui/input/index.web.d.ts +163 -0
- package/lib/components/ui/input/index.web.js +50 -0
- package/lib/components/ui/input/index.web.js.map +1 -0
- package/lib/components/ui/input-accessory-view/index.web.d.ts +9 -0
- package/lib/components/ui/input-accessory-view/index.web.js +16 -0
- package/lib/components/ui/input-accessory-view/index.web.js.map +1 -0
- package/lib/components/ui/keyboard-avoiding-view/index.web.d.ts +9 -0
- package/lib/components/ui/keyboard-avoiding-view/index.web.js +8 -0
- package/lib/components/ui/keyboard-avoiding-view/index.web.js.map +1 -0
- package/lib/components/ui/link/index.web.d.ts +365 -0
- package/lib/components/ui/link/index.web.js +70 -0
- package/lib/components/ui/link/index.web.js.map +1 -0
- package/lib/components/ui/menu/index.web.d.ts +142 -0
- package/lib/components/ui/menu/index.web.js +83 -0
- package/lib/components/ui/menu/index.web.js.map +1 -0
- package/lib/components/ui/modal/index.web.d.ts +111 -0
- package/lib/components/ui/modal/index.web.js +58 -0
- package/lib/components/ui/modal/index.web.js.map +1 -0
- package/lib/components/ui/popover/index.web.d.ts +309 -0
- package/lib/components/ui/popover/index.web.js +184 -0
- package/lib/components/ui/popover/index.web.js.map +1 -0
- package/lib/components/ui/portal/index.web.d.ts +9 -0
- package/lib/components/ui/portal/index.web.js +16 -0
- package/lib/components/ui/portal/index.web.js.map +1 -0
- package/lib/components/ui/pressable/index.web.d.ts +8 -0
- package/lib/components/ui/pressable/index.web.js +44 -0
- package/lib/components/ui/pressable/index.web.js.map +1 -0
- package/lib/components/ui/progress/index.web.d.ts +237 -0
- package/lib/components/ui/progress/index.web.js +73 -0
- package/lib/components/ui/progress/index.web.js.map +1 -0
- package/lib/components/ui/radio/index.web.d.ts +224 -0
- package/lib/components/ui/radio/index.web.js +69 -0
- package/lib/components/ui/radio/index.web.js.map +1 -0
- package/lib/components/ui/refresh-control/index.web.d.ts +14 -0
- package/lib/components/ui/refresh-control/index.web.js +69 -0
- package/lib/components/ui/refresh-control/index.web.js.map +1 -0
- package/lib/components/ui/safe-area-view/index.web.d.ts +6 -0
- package/lib/components/ui/safe-area-view/index.web.js +10 -0
- package/lib/components/ui/safe-area-view/index.web.js.map +1 -0
- package/lib/components/ui/scroll-view/index.web.d.ts +44 -0
- package/lib/components/ui/scroll-view/index.web.js +41 -0
- package/lib/components/ui/scroll-view/index.web.js.map +1 -0
- package/lib/components/ui/section-list/index.web.d.ts +26 -0
- package/lib/components/ui/section-list/index.web.js +35 -0
- package/lib/components/ui/section-list/index.web.js.map +1 -0
- package/lib/components/ui/select/index.web.d.ts +162 -0
- package/lib/components/ui/select/index.web.js +51 -0
- package/lib/components/ui/select/index.web.js.map +1 -0
- package/lib/components/ui/slider/index.web.d.ts +223 -0
- package/lib/components/ui/slider/index.web.js +189 -0
- package/lib/components/ui/slider/index.web.js.map +1 -0
- package/lib/components/ui/spinner/index.web.d.ts +176 -0
- package/lib/components/ui/spinner/index.web.js +55 -0
- package/lib/components/ui/spinner/index.web.js.map +1 -0
- package/lib/components/ui/status-bar/index.web.d.ts +14 -0
- package/lib/components/ui/status-bar/index.web.js +7 -0
- package/lib/components/ui/status-bar/index.web.js.map +1 -0
- package/lib/components/ui/switch/index.web.d.ts +71 -0
- package/lib/components/ui/switch/index.web.js +27 -0
- package/lib/components/ui/switch/index.web.js.map +1 -0
- package/lib/components/ui/tabs/index.web.d.ts +351 -0
- package/lib/components/ui/tabs/index.web.js +120 -0
- package/lib/components/ui/tabs/index.web.js.map +1 -0
- package/lib/components/ui/textarea/index.web.d.ts +162 -0
- package/lib/components/ui/textarea/index.web.js +50 -0
- package/lib/components/ui/textarea/index.web.js.map +1 -0
- package/lib/components/ui/toast/index.web.d.ts +225 -0
- package/lib/components/ui/toast/index.web.js +80 -0
- package/lib/components/ui/toast/index.web.js.map +1 -0
- package/lib/components/ui/tooltip/index.web.d.ts +86 -0
- package/lib/components/ui/tooltip/index.web.js +110 -0
- package/lib/components/ui/tooltip/index.web.js.map +1 -0
- package/lib/components/ui/view/index.web.d.ts +2 -0
- package/lib/components/ui/view/index.web.js +7 -0
- package/lib/components/ui/view/index.web.js.map +1 -0
- package/lib/components/ui/virtualized-list/index.web.d.ts +19 -0
- package/lib/components/ui/virtualized-list/index.web.js +30 -0
- package/lib/components/ui/virtualized-list/index.web.js.map +1 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +47 -47
- package/lib/containers/layout/DrawerConfig.d.ts +31 -31
- package/lib/interfaces/settings.d.ts +1 -0
- package/lib/redux/settings.d.ts +4 -9
- package/lib/utils/generateMobileNavigations.js +8 -8
- package/lib/utils/generateMobileNavigations.js.map +1 -1
- package/package.json +8 -4
- package/src/components/AuthWrapper.tsx +6 -3
- package/src/components/WithConfiguration.tsx +1 -1
- package/src/components/ui/accordion/index.web.tsx +294 -0
- package/src/components/ui/actionsheet/index.web.tsx +555 -0
- package/src/components/ui/alert/index.web.tsx +71 -0
- package/src/components/ui/alert-dialog/index.web.tsx +241 -0
- package/src/components/ui/avatar/index.web.tsx +150 -0
- package/src/components/ui/badge/index.web.tsx +188 -0
- package/src/components/ui/button/index.web.tsx +86 -0
- package/src/components/ui/checkbox/index.web.tsx +151 -0
- package/src/components/ui/divider/index.web.tsx +37 -0
- package/src/components/ui/drawer/index.web.tsx +144 -0
- package/src/components/ui/fab/index.web.tsx +201 -0
- package/src/components/ui/flat-list/index.web.tsx +89 -0
- package/src/components/ui/form-control/index.web.tsx +451 -0
- package/src/components/ui/image/index.web.tsx +43 -0
- package/src/components/ui/image-background/index.web.tsx +43 -0
- package/src/components/ui/input/index.web.tsx +80 -0
- package/src/components/ui/input-accessory-view/index.web.tsx +31 -0
- package/src/components/ui/keyboard-avoiding-view/index.web.tsx +23 -0
- package/src/components/ui/link/index.web.tsx +103 -0
- package/src/components/ui/menu/index.web.tsx +159 -0
- package/src/components/ui/modal/index.web.tsx +135 -0
- package/src/components/ui/popover/index.web.tsx +326 -0
- package/src/components/ui/portal/index.web.tsx +34 -0
- package/src/components/ui/pressable/index.web.tsx +73 -0
- package/src/components/ui/progress/index.web.tsx +123 -0
- package/src/components/ui/radio/index.web.tsx +130 -0
- package/src/components/ui/refresh-control/index.web.tsx +104 -0
- package/src/components/ui/safe-area-view/index.web.tsx +24 -0
- package/src/components/ui/scroll-view/index.web.tsx +142 -0
- package/src/components/ui/section-list/index.web.tsx +93 -0
- package/src/components/ui/select/index.web.tsx +83 -0
- package/src/components/ui/slider/index.web.tsx +283 -0
- package/src/components/ui/spinner/index.web.tsx +81 -0
- package/src/components/ui/status-bar/index.web.tsx +20 -0
- package/src/components/ui/switch/index.web.tsx +44 -0
- package/src/components/ui/tabs/index.web.tsx +205 -0
- package/src/components/ui/textarea/index.web.tsx +86 -0
- package/src/components/ui/toast/index.web.tsx +132 -0
- package/src/components/ui/tooltip/index.web.tsx +155 -0
- package/src/components/ui/view/index.web.tsx +15 -0
- package/src/components/ui/virtualized-list/index.web.tsx +84 -0
- package/src/interfaces/settings.ts +1 -0
- package/src/utils/generateMobileNavigations.ts +23 -23
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { createTextarea } from '@gluestack-ui/textarea';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
6
|
+
import { cssInterop } from 'nativewind';
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
8
|
+
|
|
9
|
+
const SCOPE = 'TEXTAREA';
|
|
10
|
+
|
|
11
|
+
const StyledTextarea = forwardRef<HTMLTextAreaElement, any>(
|
|
12
|
+
({ onChangeText, onChange, placeholder, placeholderTextColor, ...props }, ref) => {
|
|
13
|
+
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
14
|
+
if (onChange) {
|
|
15
|
+
onChange(e);
|
|
16
|
+
}
|
|
17
|
+
if (onChangeText) {
|
|
18
|
+
onChangeText(e.target.value);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<textarea
|
|
24
|
+
ref={ref}
|
|
25
|
+
placeholder={placeholder}
|
|
26
|
+
onChange={handleChange}
|
|
27
|
+
style={{
|
|
28
|
+
...props.style,
|
|
29
|
+
'::placeholder': {
|
|
30
|
+
color: placeholderTextColor,
|
|
31
|
+
},
|
|
32
|
+
}}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
StyledTextarea.displayName = 'StyledTextarea';
|
|
40
|
+
|
|
41
|
+
const textareaStyle = tva({
|
|
42
|
+
base: 'px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent',
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
sm: 'text-sm min-h-[80px]',
|
|
46
|
+
md: 'text-base min-h-[100px]',
|
|
47
|
+
lg: 'text-lg min-h-[120px]',
|
|
48
|
+
},
|
|
49
|
+
variant: {
|
|
50
|
+
outline: 'bg-transparent',
|
|
51
|
+
filled: 'bg-gray-100',
|
|
52
|
+
unstyled: '',
|
|
53
|
+
},
|
|
54
|
+
state: {
|
|
55
|
+
error: 'border-red-500 focus:ring-red-500',
|
|
56
|
+
success: 'border-green-500 focus:ring-green-500',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
size: 'md',
|
|
61
|
+
variant: 'outline',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
type ITextareaProps = React.ComponentProps<typeof StyledTextarea> &
|
|
66
|
+
VariantProps<typeof textareaStyle> & {
|
|
67
|
+
className?: string;
|
|
68
|
+
onChangeText?: (text: string) => void;
|
|
69
|
+
placeholderTextColor?: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, ITextareaProps>(
|
|
73
|
+
({ className, size, variant, state, ...props }, ref) => {
|
|
74
|
+
return (
|
|
75
|
+
<StyledTextarea
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={textareaStyle({ size, variant, state, class: className })}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
Textarea.displayName = 'Textarea';
|
|
85
|
+
|
|
86
|
+
export { Textarea };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
3
|
+
import { createToast } from '@gluestack-ui/toast';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
6
|
+
import { cssInterop } from 'nativewind';
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
8
|
+
import { createPortal } from 'react-dom';
|
|
9
|
+
|
|
10
|
+
const SCOPE = 'TOAST';
|
|
11
|
+
|
|
12
|
+
const toastStyle = tva({
|
|
13
|
+
base: 'fixed flex items-center p-4 mb-4 rounded-lg shadow-lg transition-all duration-300 ease-in-out',
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
solid: 'bg-gray-800 text-white',
|
|
17
|
+
outline: 'bg-white border border-gray-300',
|
|
18
|
+
accent: 'border-l-4 border-blue-500 bg-white',
|
|
19
|
+
},
|
|
20
|
+
position: {
|
|
21
|
+
top: 'top-4 left-1/2 -translate-x-1/2',
|
|
22
|
+
'top-right': 'top-4 right-4',
|
|
23
|
+
'top-left': 'top-4 left-4',
|
|
24
|
+
bottom: 'bottom-4 left-1/2 -translate-x-1/2',
|
|
25
|
+
'bottom-right': 'bottom-4 right-4',
|
|
26
|
+
'bottom-left': 'bottom-4 left-4',
|
|
27
|
+
},
|
|
28
|
+
status: {
|
|
29
|
+
info: 'bg-blue-500 text-white',
|
|
30
|
+
success: 'bg-green-500 text-white',
|
|
31
|
+
warning: 'bg-yellow-500 text-white',
|
|
32
|
+
error: 'bg-red-500 text-white',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: 'solid',
|
|
37
|
+
position: 'bottom',
|
|
38
|
+
status: 'info',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const ToastTitle = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => (
|
|
43
|
+
<div ref={ref} className={`font-semibold ${className || ''}`} {...props} />
|
|
44
|
+
));
|
|
45
|
+
|
|
46
|
+
ToastTitle.displayName = 'ToastTitle';
|
|
47
|
+
|
|
48
|
+
export const ToastDescription = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
49
|
+
({ className, ...props }, ref) => <div ref={ref} className={`mt-1 ${className || ''}`} {...props} />,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
ToastDescription.displayName = 'ToastDescription';
|
|
53
|
+
|
|
54
|
+
type IToastProps = {
|
|
55
|
+
id?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
duration?: number;
|
|
59
|
+
onClose?: () => void;
|
|
60
|
+
isOpen?: boolean;
|
|
61
|
+
className?: string;
|
|
62
|
+
variant?: VariantProps<typeof toastStyle>['variant'];
|
|
63
|
+
position?: VariantProps<typeof toastStyle>['position'];
|
|
64
|
+
status?: VariantProps<typeof toastStyle>['status'];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const Toast = forwardRef<HTMLDivElement, IToastProps>(
|
|
68
|
+
(
|
|
69
|
+
{ id, title, description, duration = 5000, onClose, isOpen, className, variant, position, status, ...props },
|
|
70
|
+
ref,
|
|
71
|
+
) => {
|
|
72
|
+
const [isVisible, setIsVisible] = useState(isOpen);
|
|
73
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
setIsVisible(isOpen);
|
|
77
|
+
if (isOpen) {
|
|
78
|
+
const timer = setTimeout(() => {
|
|
79
|
+
setIsExiting(true);
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
setIsVisible(false);
|
|
82
|
+
setIsExiting(false);
|
|
83
|
+
if (onClose) onClose();
|
|
84
|
+
}, 300);
|
|
85
|
+
}, duration);
|
|
86
|
+
|
|
87
|
+
return () => clearTimeout(timer);
|
|
88
|
+
}
|
|
89
|
+
}, [isOpen, duration, onClose]);
|
|
90
|
+
|
|
91
|
+
if (!isVisible) return null;
|
|
92
|
+
|
|
93
|
+
return createPortal(
|
|
94
|
+
<div
|
|
95
|
+
ref={ref}
|
|
96
|
+
role="alert"
|
|
97
|
+
aria-live="polite"
|
|
98
|
+
className={toastStyle({
|
|
99
|
+
variant,
|
|
100
|
+
position,
|
|
101
|
+
status,
|
|
102
|
+
class: `${className || ''} ${isExiting ? 'opacity-0' : 'opacity-100'}`,
|
|
103
|
+
})}
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
<div>
|
|
107
|
+
{title && <ToastTitle>{title}</ToastTitle>}
|
|
108
|
+
{description && <ToastDescription>{description}</ToastDescription>}
|
|
109
|
+
</div>
|
|
110
|
+
<button
|
|
111
|
+
onClick={() => {
|
|
112
|
+
setIsExiting(true);
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
setIsVisible(false);
|
|
115
|
+
setIsExiting(false);
|
|
116
|
+
if (onClose) onClose();
|
|
117
|
+
}, 300);
|
|
118
|
+
}}
|
|
119
|
+
className="ml-4 text-current opacity-70 hover:opacity-100"
|
|
120
|
+
aria-label="Close toast"
|
|
121
|
+
>
|
|
122
|
+
×
|
|
123
|
+
</button>
|
|
124
|
+
</div>,
|
|
125
|
+
document.body,
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
Toast.displayName = 'Toast';
|
|
131
|
+
|
|
132
|
+
export { Toast };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { createTooltip } from '@gluestack-ui/tooltip';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
6
|
+
import { cssInterop } from 'nativewind';
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
8
|
+
import { createPortal } from 'react-dom';
|
|
9
|
+
|
|
10
|
+
const SCOPE = 'TOOLTIP';
|
|
11
|
+
|
|
12
|
+
const tooltipStyle = tva({
|
|
13
|
+
base: 'absolute z-50 px-3 py-2 text-sm text-white bg-gray-900 rounded-md shadow-sm max-w-xs',
|
|
14
|
+
variants: {
|
|
15
|
+
placement: {
|
|
16
|
+
top: 'bottom-full mb-2',
|
|
17
|
+
bottom: 'top-full mt-2',
|
|
18
|
+
left: 'right-full mr-2',
|
|
19
|
+
right: 'left-full ml-2',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
placement: 'top',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
type ITooltipProps = {
|
|
28
|
+
label: string;
|
|
29
|
+
children: React.ReactElement;
|
|
30
|
+
placement?: VariantProps<typeof tooltipStyle>['placement'];
|
|
31
|
+
className?: string;
|
|
32
|
+
delay?: number;
|
|
33
|
+
isOpen?: boolean;
|
|
34
|
+
onOpen?: () => void;
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const Tooltip = forwardRef<HTMLDivElement, ITooltipProps>(
|
|
39
|
+
(
|
|
40
|
+
{ label, children, placement, className, delay = 0, isOpen: controlledIsOpen, onOpen, onClose, ...props },
|
|
41
|
+
ref,
|
|
42
|
+
) => {
|
|
43
|
+
const [isOpen, setIsOpen] = useState(controlledIsOpen || false);
|
|
44
|
+
const [position, setPosition] = useState({ top: 0, left: 0 });
|
|
45
|
+
const triggerRef = useRef<HTMLDivElement>(null);
|
|
46
|
+
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
47
|
+
const timeoutRef = useRef<NodeJS.Timeout>();
|
|
48
|
+
|
|
49
|
+
const updatePosition = () => {
|
|
50
|
+
if (triggerRef.current && tooltipRef.current) {
|
|
51
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
52
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
53
|
+
let top = 0;
|
|
54
|
+
let left = 0;
|
|
55
|
+
|
|
56
|
+
switch (placement) {
|
|
57
|
+
case 'top':
|
|
58
|
+
top = triggerRect.top - tooltipRect.height - 8;
|
|
59
|
+
left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
|
|
60
|
+
break;
|
|
61
|
+
case 'bottom':
|
|
62
|
+
top = triggerRect.bottom + 8;
|
|
63
|
+
left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
|
|
64
|
+
break;
|
|
65
|
+
case 'left':
|
|
66
|
+
top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
|
|
67
|
+
left = triggerRect.left - tooltipRect.width - 8;
|
|
68
|
+
break;
|
|
69
|
+
case 'right':
|
|
70
|
+
top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
|
|
71
|
+
left = triggerRect.right + 8;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setPosition({ top, left });
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const handleOpen = () => {
|
|
80
|
+
if (delay) {
|
|
81
|
+
timeoutRef.current = setTimeout(() => {
|
|
82
|
+
setIsOpen(true);
|
|
83
|
+
if (onOpen) onOpen();
|
|
84
|
+
}, delay);
|
|
85
|
+
} else {
|
|
86
|
+
setIsOpen(true);
|
|
87
|
+
if (onOpen) onOpen();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const handleClose = () => {
|
|
92
|
+
if (timeoutRef.current) {
|
|
93
|
+
clearTimeout(timeoutRef.current);
|
|
94
|
+
}
|
|
95
|
+
setIsOpen(false);
|
|
96
|
+
if (onClose) onClose();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (controlledIsOpen !== undefined) {
|
|
101
|
+
setIsOpen(controlledIsOpen);
|
|
102
|
+
}
|
|
103
|
+
}, [controlledIsOpen]);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (isOpen) {
|
|
107
|
+
updatePosition();
|
|
108
|
+
window.addEventListener('scroll', updatePosition);
|
|
109
|
+
window.addEventListener('resize', updatePosition);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return () => {
|
|
113
|
+
window.removeEventListener('scroll', updatePosition);
|
|
114
|
+
window.removeEventListener('resize', updatePosition);
|
|
115
|
+
};
|
|
116
|
+
}, [isOpen]);
|
|
117
|
+
|
|
118
|
+
const trigger = React.cloneElement(children, {
|
|
119
|
+
ref: triggerRef,
|
|
120
|
+
onMouseEnter: handleOpen,
|
|
121
|
+
onMouseLeave: handleClose,
|
|
122
|
+
onFocus: handleOpen,
|
|
123
|
+
onBlur: handleClose,
|
|
124
|
+
'aria-describedby': isOpen ? 'tooltip' : undefined,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
{trigger}
|
|
130
|
+
{isOpen &&
|
|
131
|
+
createPortal(
|
|
132
|
+
<div
|
|
133
|
+
ref={tooltipRef}
|
|
134
|
+
id="tooltip"
|
|
135
|
+
role="tooltip"
|
|
136
|
+
className={tooltipStyle({ placement, class: className })}
|
|
137
|
+
style={{
|
|
138
|
+
position: 'fixed',
|
|
139
|
+
top: `${position.top}px`,
|
|
140
|
+
left: `${position.left}px`,
|
|
141
|
+
}}
|
|
142
|
+
{...props}
|
|
143
|
+
>
|
|
144
|
+
{label}
|
|
145
|
+
</div>,
|
|
146
|
+
document.body,
|
|
147
|
+
)}
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
Tooltip.displayName = 'Tooltip';
|
|
154
|
+
|
|
155
|
+
export { Tooltip };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
export const View = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
6
|
+
({ children, style, ...props }, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<div ref={ref} style={style} {...props}>
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
View.displayName = 'View';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { FixedSizeList, ListChildComponentProps } from 'react-window';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
6
|
+
import { cssInterop } from 'nativewind';
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
8
|
+
|
|
9
|
+
const virtualizedListStyle = tva({
|
|
10
|
+
base: 'overflow-auto',
|
|
11
|
+
variants: {
|
|
12
|
+
horizontal: {
|
|
13
|
+
true: 'flex-row',
|
|
14
|
+
false: 'flex-col',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
horizontal: false,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
interface VirtualizedListProps<T> {
|
|
23
|
+
data: ReadonlyArray<T>;
|
|
24
|
+
renderItem: ({ item, index }: { item: T; index: number }) => React.ReactElement;
|
|
25
|
+
itemSize: number;
|
|
26
|
+
horizontal?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
height: number;
|
|
29
|
+
width: number;
|
|
30
|
+
overscanCount?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface ItemData<T> {
|
|
34
|
+
data: ReadonlyArray<T>;
|
|
35
|
+
renderItem: ({ item, index }: { item: T; index: number }) => React.ReactElement;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function VirtualizedListComponent<T>(
|
|
39
|
+
{
|
|
40
|
+
data,
|
|
41
|
+
renderItem,
|
|
42
|
+
itemSize,
|
|
43
|
+
horizontal = false,
|
|
44
|
+
className,
|
|
45
|
+
height,
|
|
46
|
+
width,
|
|
47
|
+
overscanCount = 2,
|
|
48
|
+
...props
|
|
49
|
+
}: VirtualizedListProps<T>,
|
|
50
|
+
ref: React.Ref<FixedSizeList>,
|
|
51
|
+
) {
|
|
52
|
+
const itemData: ItemData<T> = {
|
|
53
|
+
data,
|
|
54
|
+
renderItem,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const Row = ({ index, style }: ListChildComponentProps) => {
|
|
58
|
+
const item = data[index];
|
|
59
|
+
return <div style={style}>{renderItem({ item, index })}</div>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<FixedSizeList
|
|
64
|
+
outerRef={ref}
|
|
65
|
+
className={virtualizedListStyle({ horizontal, class: className })}
|
|
66
|
+
height={height}
|
|
67
|
+
width={width}
|
|
68
|
+
itemCount={data.length}
|
|
69
|
+
itemSize={itemSize}
|
|
70
|
+
layout={horizontal ? 'horizontal' : 'vertical'}
|
|
71
|
+
overscanCount={overscanCount}
|
|
72
|
+
itemData={itemData}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
{Row}
|
|
76
|
+
</FixedSizeList>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const VirtualizedList = React.forwardRef(VirtualizedListComponent) as <T>(
|
|
81
|
+
props: VirtualizedListProps<T> & { ref?: React.Ref<FixedSizeList> },
|
|
82
|
+
) => React.ReactElement;
|
|
83
|
+
|
|
84
|
+
export { VirtualizedList };
|
|
@@ -391,7 +391,7 @@ export class GenerateMobileNavigations {
|
|
|
391
391
|
`.replace(/,(\s*)$/, ''); // Removes trailing comma
|
|
392
392
|
|
|
393
393
|
// Use Prettier to format the code
|
|
394
|
-
classStructure =
|
|
394
|
+
classStructure = prettier.format(classStructure, { parser: 'babel' });
|
|
395
395
|
|
|
396
396
|
const appFeatures = importStatements + '\n' + classStructure;
|
|
397
397
|
|
|
@@ -541,7 +541,7 @@ export class GenerateMobileNavigations {
|
|
|
541
541
|
`.replace(/,(\s*)$/, ''); // Removes trailing comma
|
|
542
542
|
|
|
543
543
|
// Use Prettier to format the code
|
|
544
|
-
classStructure =
|
|
544
|
+
classStructure = prettier.format(classStructure, { parser: 'babel' });
|
|
545
545
|
|
|
546
546
|
const appFeatures = importStatements + '\n' + classStructure;
|
|
547
547
|
|
|
@@ -611,7 +611,7 @@ export class GenerateMobileNavigations {
|
|
|
611
611
|
`.replace(/,(\s*)$/, ''); // Removes trailing comma
|
|
612
612
|
|
|
613
613
|
// Use Prettier to format the code
|
|
614
|
-
classStructure =
|
|
614
|
+
classStructure = prettier.format(classStructure, { parser: 'babel' });
|
|
615
615
|
|
|
616
616
|
const appFeatures = importStatements + '\n' + classStructure;
|
|
617
617
|
|
|
@@ -748,8 +748,8 @@ export class GenerateMobileNavigations {
|
|
|
748
748
|
pkgRouteConfig?.unauthenticatedComponent && customUnauthenticatedComponentPath
|
|
749
749
|
? `unauthenticatedComponent={<${customUnauthenticatedComponentName}/>}`
|
|
750
750
|
: unauthenticatedComponentPath
|
|
751
|
-
|
|
752
|
-
|
|
751
|
+
? 'unauthenticatedComponent={<UnauthenticatedComponent/>}'
|
|
752
|
+
: ''
|
|
753
753
|
}
|
|
754
754
|
${
|
|
755
755
|
pkgRouteConfig?.withLifeCycle
|
|
@@ -798,7 +798,7 @@ export class GenerateMobileNavigations {
|
|
|
798
798
|
}
|
|
799
799
|
stackNavigator = importStatements + '\n' + moduleRender;
|
|
800
800
|
let stackNavigation = stackNavigator;
|
|
801
|
-
stackNavigation =
|
|
801
|
+
stackNavigation = prettier.format(stackNavigation, { parser: 'babel' });
|
|
802
802
|
const stackDirName = path.dirname(stackDirPath);
|
|
803
803
|
try {
|
|
804
804
|
const isDirCreated = await this.#makeDir(stackDirName);
|
|
@@ -870,8 +870,8 @@ export class GenerateMobileNavigations {
|
|
|
870
870
|
//component={Component${moduleNumber}}
|
|
871
871
|
initialParams={${JSON.stringify(pkgRouteConfig?.props?.initialParams || {})}}
|
|
872
872
|
options={{...${options},...{${
|
|
873
|
-
|
|
874
|
-
|
|
873
|
+
pkgRouteConfig?.icon && Object.keys(pkgRouteConfig.icon)?.length && pkgRouteConfig?.icon?.name
|
|
874
|
+
? `drawerIcon: ({ color }) => {
|
|
875
875
|
const focused = color === '${pkgRouteConfig?.props?.options?.tabBarActiveTintColor}' ? true : false;
|
|
876
876
|
const SelectedIcon = DynamicIcons('${pkgRouteConfig?.icon?.name}');
|
|
877
877
|
return (<SelectedIcon
|
|
@@ -901,8 +901,8 @@ export class GenerateMobileNavigations {
|
|
|
901
901
|
}
|
|
902
902
|
}}
|
|
903
903
|
/>)},`
|
|
904
|
-
|
|
905
|
-
|
|
904
|
+
: ''
|
|
905
|
+
}
|
|
906
906
|
${
|
|
907
907
|
pkgRouteConfig?.customHeader &&
|
|
908
908
|
Object.keys(pkgRouteConfig.customHeader)?.length &&
|
|
@@ -924,8 +924,8 @@ export class GenerateMobileNavigations {
|
|
|
924
924
|
pkgRouteConfig?.unauthenticatedComponent && customUnauthenticatedComponentPath
|
|
925
925
|
? `unauthenticatedComponent={<${customUnauthenticatedComponentName}/>}`
|
|
926
926
|
: unauthenticatedComponentPath
|
|
927
|
-
|
|
928
|
-
|
|
927
|
+
? 'unauthenticatedComponent={<UnauthenticatedComponent/>}'
|
|
928
|
+
: ''
|
|
929
929
|
}
|
|
930
930
|
${
|
|
931
931
|
pkgRouteConfig?.withLifeCycle
|
|
@@ -978,7 +978,7 @@ export class GenerateMobileNavigations {
|
|
|
978
978
|
moduleNavigation = importStatements + '\n' + moduleRender;
|
|
979
979
|
const drawerNavigator = moduleNavigation;
|
|
980
980
|
let drawerNavigation = drawerNavigator;
|
|
981
|
-
drawerNavigation =
|
|
981
|
+
drawerNavigation = prettier.format(drawerNavigation, { parser: 'babel' });
|
|
982
982
|
const drawerDirName = path.dirname(drawerDirPath);
|
|
983
983
|
try {
|
|
984
984
|
const isDirCreated = await this.#makeDir(drawerDirName);
|
|
@@ -1136,8 +1136,8 @@ export class GenerateMobileNavigations {
|
|
|
1136
1136
|
//component={Component${moduleNumber}}
|
|
1137
1137
|
initialParams={${JSON.stringify(pkgRouteConfig?.props?.initialParams || {})}}
|
|
1138
1138
|
options={{...${options},...{${
|
|
1139
|
-
|
|
1140
|
-
|
|
1139
|
+
pkgRouteConfig?.icon && Object.keys(pkgRouteConfig.icon)?.length && pkgRouteConfig?.icon?.name
|
|
1140
|
+
? `tabBarIcon: ({ color }) => {
|
|
1141
1141
|
const focused = color === '${pkgRouteConfig?.props?.options?.tabBarActiveTintColor}' ? true : false;
|
|
1142
1142
|
const SelectedIcon = DynamicIcons('${pkgRouteConfig?.icon?.name}');
|
|
1143
1143
|
return (<SelectedIcon
|
|
@@ -1168,8 +1168,8 @@ export class GenerateMobileNavigations {
|
|
|
1168
1168
|
}}
|
|
1169
1169
|
|
|
1170
1170
|
/>)}`
|
|
1171
|
-
|
|
1172
|
-
|
|
1171
|
+
: ''
|
|
1172
|
+
}
|
|
1173
1173
|
${
|
|
1174
1174
|
pkgRouteConfig?.customHeader &&
|
|
1175
1175
|
Object.keys(pkgRouteConfig.customHeader)?.length &&
|
|
@@ -1192,8 +1192,8 @@ export class GenerateMobileNavigations {
|
|
|
1192
1192
|
pkgRouteConfig?.unauthenticatedComponent && customUnauthenticatedComponentPath
|
|
1193
1193
|
? `unauthenticatedComponent={<${customUnauthenticatedComponentName}/>}`
|
|
1194
1194
|
: unauthenticatedComponentPath
|
|
1195
|
-
|
|
1196
|
-
|
|
1195
|
+
? 'unauthenticatedComponent={<UnauthenticatedComponent/>}'
|
|
1196
|
+
: ''
|
|
1197
1197
|
}
|
|
1198
1198
|
${
|
|
1199
1199
|
pkgRouteConfig?.withLifeCycle
|
|
@@ -1248,7 +1248,7 @@ export class GenerateMobileNavigations {
|
|
|
1248
1248
|
moduleNavigation = importStatements + '\n' + moduleRender;
|
|
1249
1249
|
const bottomTabNavigator = moduleNavigation;
|
|
1250
1250
|
let bottomTabNavigation = bottomTabNavigator;
|
|
1251
|
-
bottomTabNavigation =
|
|
1251
|
+
bottomTabNavigation = prettier.format(bottomTabNavigation, { parser: 'babel' });
|
|
1252
1252
|
const bottomDirName = path.dirname(bottomDirPath);
|
|
1253
1253
|
try {
|
|
1254
1254
|
const isDirCreated = await this.#makeDir(bottomDirName);
|
|
@@ -1451,8 +1451,8 @@ export class GenerateMobileNavigations {
|
|
|
1451
1451
|
const initialRouteName = layoutInitialRouteName
|
|
1452
1452
|
? layoutInitialRouteName
|
|
1453
1453
|
: layoutType === 'mixSide'
|
|
1454
|
-
|
|
1455
|
-
|
|
1454
|
+
? appLayout?.[appLayout?.key]?.props?.initialRouteName ?? 'MainStack.Layout.Home'
|
|
1455
|
+
: appLayout?.props?.initialRouteName || 'MainStack.Home';
|
|
1456
1456
|
const isShowTabs = layoutType === 'mixSide' || layoutType === 'bottom' ? true : false;
|
|
1457
1457
|
const isShowDefalutHeader = layoutType === 'mixSide' ? true : false;
|
|
1458
1458
|
const defaultHeaderProps = {
|
|
@@ -1675,7 +1675,7 @@ export class GenerateMobileNavigations {
|
|
|
1675
1675
|
export default AppNavigations;
|
|
1676
1676
|
`;
|
|
1677
1677
|
appNavigation = importStatements + '\n' + rootComponent + '\n' + appComponent;
|
|
1678
|
-
appNavigation =
|
|
1678
|
+
appNavigation = prettier.format(appNavigation, { parser: 'babel' });
|
|
1679
1679
|
try {
|
|
1680
1680
|
await this.#writeFile(navigationDirPath, appNavigation);
|
|
1681
1681
|
} catch (error) {
|