@admin-layout/gluestack-ui-mobile 11.0.4-alpha.0 → 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 +60 -4
- package/lib/__tests__/prolayout-layout-feature.test.js +1 -1
- package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -1
- package/lib/components/AuthWrapper.js +5 -3
- package/lib/components/AuthWrapper.js.map +1 -1
- package/lib/components/ErrorBounday.js.map +1 -1
- package/lib/components/NavigationComponent.js.map +1 -1
- package/lib/components/UnAuthenticatedComponent.js.map +1 -1
- package/lib/components/WithConfiguration.js +4 -4
- package/lib/components/WithConfiguration.js.map +1 -1
- package/lib/components/WithPermission.js +1 -1
- package/lib/components/WithPermission.js.map +1 -1
- package/lib/components/WithPolicy.js +2 -2
- package/lib/components/WithPolicy.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/components/usePermissionAutoFetch.d.ts +7 -19
- package/lib/components/with-interactions-lifecycle-managed.js.map +1 -1
- package/lib/components/with-interactions-managed.js +2 -3
- package/lib/components/with-interactions-managed.js.map +1 -1
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +47 -47
- package/lib/containers/layout/DrawerConfig.d.ts +31 -31
- package/lib/containers/layout/module.js +1 -1
- package/lib/containers/layout/module.js.map +1 -1
- package/lib/interfaces/settings.d.ts +1 -0
- package/lib/redux/settings.d.ts +4 -9
- package/lib/utils/routeConfigKeyReplace.test.js +1 -1
- package/lib/utils/routeConfigKeyReplace.test.js.map +1 -1
- package/package.json +7 -4
- package/src/__tests__/prolayout-layout-feature.test.tsx +2 -2
- package/src/components/AuthWrapper.tsx +6 -3
- package/src/components/ErrorBounday.tsx +18 -19
- package/src/components/NavigationComponent.tsx +1 -1
- package/src/components/UnAuthenticatedComponent.tsx +1 -3
- package/src/components/WithConfiguration.tsx +5 -8
- package/src/components/WithPermission.tsx +1 -1
- package/src/components/WithPolicy.tsx +4 -3
- 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/components/with-interactions-lifecycle-managed.tsx +0 -4
- package/src/components/with-interactions-managed.tsx +3 -4
- package/src/containers/layout/module.ts +1 -1
- package/src/interfaces/settings.ts +1 -0
- package/src/utils/routeConfigKeyReplace.test.ts +4 -4
|
@@ -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 };
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Lifecycle } from '../containers/layout/Lifecycle';
|
|
3
|
-
import { LifecyclePhase } from '@workbench-stack/core';
|
|
4
2
|
import Animated from 'react-native-reanimated';
|
|
5
3
|
import { useAfterInteractions } from '../hooks/use-after-interactions';
|
|
6
4
|
import { Spinner, Center } from './ui';
|
|
7
5
|
import { Platform } from 'react-native';
|
|
8
|
-
import { WithPermissionContainer } from './WithPermission';
|
|
9
|
-
import { isUserAuthenticated } from '@adminide-stack/user-auth0-client';
|
|
10
6
|
|
|
11
7
|
const LoadingComponent = () => (
|
|
12
8
|
<Center className="flex-1 justify-center items-center">{<Spinner className="text-blue-500" />}</Center>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
|
-
// import { Transition, Transitioning } from 'react-native-reanimated';
|
|
3
|
-
import { Lifecycle } from '../containers/layout/Lifecycle';
|
|
4
2
|
import { LifecyclePhase } from '@workbench-stack/core';
|
|
5
|
-
import Animated
|
|
3
|
+
import Animated from 'react-native-reanimated';
|
|
6
4
|
import { useAfterInteractions } from '../hooks/use-after-interactions';
|
|
7
|
-
import { Spinner, Center } from './ui';
|
|
8
5
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
6
|
+
import { Spinner, Center } from './ui';
|
|
7
|
+
import { Lifecycle } from '../containers/layout/Lifecycle';
|
|
9
8
|
|
|
10
9
|
export function withInteractionsManaged<Props>(
|
|
11
10
|
Component: ComponentType<Props>,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Feature
|
|
1
|
+
import { Feature } from '@common-stack/client-react';
|
|
2
2
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
3
3
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
|
4
4
|
import { createDrawerNavigator } from '@react-navigation/drawer';
|
|
@@ -100,14 +100,14 @@ describe('route config key replace', () => {
|
|
|
100
100
|
// For layout 'bottom', keyReplaceWith='/bottom_tab/',appLayout=appBottomTabFeature
|
|
101
101
|
// For layout 'host-bottom', keyReplaceWith='/host_tab/',appLayout=appHostBottomTabFeature
|
|
102
102
|
//*******************************************************************/
|
|
103
|
-
const routeConfigFeature = new Feature({ routeConfig: routerConfig });
|
|
103
|
+
const routeConfigFeature = new Feature({ routeConfig: [routerConfig] });
|
|
104
104
|
|
|
105
105
|
let keyReplacedWith = '/bottom_tab/';
|
|
106
106
|
const appLayout = appBottomTabFeature;
|
|
107
107
|
|
|
108
|
-
const {appFeatures} = routeConfigKeyReplace(keyReplacedWith, routeConfigFeature,appLayout);
|
|
108
|
+
const { appFeatures } = routeConfigKeyReplace(keyReplacedWith, routeConfigFeature, appLayout);
|
|
109
109
|
// const appFeatures = new Feature(appLayoutConfig, appLayoutFeatures);
|
|
110
|
-
|
|
110
|
+
const Render = appFeatures.getRoutes2('/', 'MainStack');
|
|
111
111
|
const configuredRoute = appFeatures.getConfiguredRoutes2('/');
|
|
112
112
|
expect(Render).toMatchSnapshot();
|
|
113
113
|
});
|