@flipova/foundation 1.13.0 → 2.0.4
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 +181 -0
- package/README.md +53 -178
- package/components/ui/accordion/ANIMATION_CUSTOMIZATION.md +162 -0
- package/components/ui/accordion/AccordionAnimatedHeight.tsx +56 -0
- package/components/ui/accordion/AccordionAnimatedIcon.tsx +41 -0
- package/components/ui/accordion/AnimatedHeight.tsx +56 -0
- package/components/ui/accordion/AnimatedIcon.tsx +41 -0
- package/components/ui/accordion/MIGRATION_SUMMARY.md +250 -0
- package/components/ui/accordion/USAGE_EXAMPLE.tsx +179 -0
- package/components/ui/accordion/animation-config.ts +32 -0
- package/components/ui/accordion/index.tsx +253 -0
- package/components/ui/actionsheet/index.tsx +511 -0
- package/components/ui/alert/index.tsx +158 -0
- package/components/ui/alert-dialog/index.tsx +254 -0
- package/components/ui/avatar/index.tsx +139 -0
- package/components/ui/badge/index.tsx +163 -0
- package/components/ui/bottomsheet/index.tsx +477 -0
- package/components/ui/box/index.tsx +19 -0
- package/components/ui/box/index.web.tsx +19 -0
- package/components/ui/box/styles.tsx +10 -0
- package/components/ui/button/index.tsx +264 -0
- package/components/ui/calendar/creator.tsx +366 -0
- package/components/ui/calendar/index.tsx +462 -0
- package/components/ui/calendar/styles.tsx +140 -0
- package/components/ui/card/index.tsx +23 -0
- package/components/ui/card/index.web.tsx +26 -0
- package/components/ui/card/styles.tsx +16 -0
- package/components/ui/center/index.tsx +22 -0
- package/components/ui/center/index.web.tsx +20 -0
- package/components/ui/center/styles.tsx +8 -0
- package/components/ui/checkbox/index.tsx +184 -0
- package/components/ui/date-time-picker/creator.tsx +109 -0
- package/components/ui/date-time-picker/index.tsx +585 -0
- package/components/ui/date-time-picker/index.web.tsx +217 -0
- package/components/ui/date-time-picker/styles.tsx +56 -0
- package/components/ui/divider/index.tsx +40 -0
- package/components/ui/drawer/index.tsx +362 -0
- package/components/ui/fab/index.tsx +215 -0
- package/components/ui/flat-list/index.tsx +21 -0
- package/components/ui/form-control/index.tsx +352 -0
- package/components/ui/gluestack-ui-provider/config.ts +72 -0
- package/components/ui/gluestack-ui-provider/index.tsx +47 -0
- package/components/ui/gluestack-ui-provider/index.web.tsx +96 -0
- package/components/ui/gluestack-ui-provider/script.ts +19 -0
- package/components/ui/gluestack-ui-provider/tokens.d.ts +17 -0
- package/components/ui/gluestack-ui-provider/tokens.js +188 -0
- package/components/ui/gluestack-ui-provider/useGluestackColors.ts +82 -0
- package/components/ui/grid/index.tsx +283 -0
- package/components/ui/grid/index.web.tsx +66 -0
- package/components/ui/grid/styles.tsx +15 -0
- package/components/ui/heading/index.tsx +220 -0
- package/components/ui/heading/index.web.tsx +202 -0
- package/components/ui/heading/styles.tsx +43 -0
- package/components/ui/hstack/index.tsx +27 -0
- package/components/ui/hstack/index.web.tsx +26 -0
- package/components/ui/hstack/styles.tsx +25 -0
- package/components/ui/icon/index.tsx +1588 -0
- package/components/ui/icon/index.web.tsx +1573 -0
- package/components/ui/image/index.tsx +48 -0
- package/components/ui/image-background/index.tsx +25 -0
- package/components/ui/image-viewer/index.tsx +743 -0
- package/components/ui/image-viewer/index.web.tsx +302 -0
- package/components/ui/index.ts +58 -0
- package/components/ui/input/index.tsx +125 -0
- package/components/ui/input-accessory-view/index.tsx +2 -0
- package/components/ui/keyboard-avoiding-view/index.tsx +2 -0
- package/components/ui/link/index.tsx +102 -0
- package/components/ui/liquid-glass/index.tsx +74 -0
- package/components/ui/menu/index.tsx +186 -0
- package/components/ui/modal/index.tsx +237 -0
- package/components/ui/popover/index.tsx +272 -0
- package/components/ui/portal/index.tsx +17 -0
- package/components/ui/pressable/index.tsx +39 -0
- package/components/ui/progress/index.tsx +83 -0
- package/components/ui/radio/index.tsx +217 -0
- package/components/ui/refresh-control/index.tsx +2 -0
- package/components/ui/safe-area-view/index.tsx +2 -0
- package/components/ui/scroll-view/index.tsx +2 -0
- package/components/ui/section-list/index.tsx +2 -0
- package/components/ui/select/index.tsx +277 -0
- package/components/ui/select/select-actionsheet.tsx +562 -0
- package/components/ui/skeleton/index.tsx +105 -0
- package/components/ui/skeleton/index.web.tsx +103 -0
- package/components/ui/skeleton/styles.tsx +35 -0
- package/components/ui/slider/index.tsx +181 -0
- package/components/ui/spinner/index.tsx +40 -0
- package/components/ui/status-bar/index.tsx +2 -0
- package/components/ui/switch/index.tsx +41 -0
- package/components/ui/table/index.tsx +210 -0
- package/components/ui/table/index.web.tsx +157 -0
- package/components/ui/table/styles.tsx +44 -0
- package/components/ui/tabs/TabsAnimatedIndicator.tsx +160 -0
- package/components/ui/tabs/animation-config.ts +3 -0
- package/components/ui/tabs/creator.tsx +206 -0
- package/components/ui/tabs/index.tsx +484 -0
- package/components/ui/text/index.tsx +48 -0
- package/components/ui/text/index.web.tsx +45 -0
- package/components/ui/text/styles.tsx +47 -0
- package/components/ui/textarea/index.tsx +94 -0
- package/components/ui/toast/index.tsx +252 -0
- package/components/ui/tooltip/index.tsx +131 -0
- package/components/ui/view/index.tsx +2 -0
- package/components/ui/virtualized-list/index.tsx +2 -0
- package/components/ui/vstack/index.tsx +28 -0
- package/components/ui/vstack/index.web.tsx +27 -0
- package/components/ui/vstack/styles.tsx +25 -0
- package/design/canonical.index.txt +53 -0
- package/design/documentation.xml +519 -0
- package/design/manifest.xml +90 -0
- package/design/schema.xsd +639 -0
- package/design/themes.xml +204 -0
- package/design/tokens.xml +510 -0
- package/design/tools/design.js +165 -0
- package/design/tools/npm.js +65 -0
- package/design/tools/requirements.txt +35 -0
- package/design/tools/sources/.checker/__init__.py +81 -0
- package/design/tools/sources/.checker/checks.py +198 -0
- package/design/tools/sources/.checker/cli.py +154 -0
- package/design/tools/sources/.checker/io.py +242 -0
- package/design/tools/sources/.checker/model.py +144 -0
- package/design/tools/sources/.checker/registry.py +115 -0
- package/design/tools/sources/.checker/report.py +21 -0
- package/design/tools/sources/.docgen/__init__.py +45 -0
- package/design/tools/sources/.docgen/cli.py +101 -0
- package/design/tools/sources/.docgen/model.py +147 -0
- package/design/tools/sources/.docgen/reference.py +97 -0
- package/design/tools/sources/.docgen/site.py +145 -0
- package/design/tools/sources/.docgen/xsddoc.py +329 -0
- package/design/tools/sources/.generate/__init__.py +35 -0
- package/design/tools/sources/.generate/cli.py +76 -0
- package/design/tools/sources/.generate/common.py +33 -0
- package/design/tools/sources/.generate/config.py +119 -0
- package/design/tools/sources/.generate/model.py +51 -0
- package/design/tools/sources/.generate/tokens.py +141 -0
- package/design/tools/sources/.linter/__init__.py +9 -0
- package/design/tools/sources/.linter/cli.py +44 -0
- package/design/tools/sources/.linter/discovery.py +30 -0
- package/design/tools/sources/.linter/errors.py +45 -0
- package/design/tools/sources/.linter/linter.py +68 -0
- package/design/tools/sources/.xmleditor/__init__.py +74 -0
- package/design/tools/sources/.xmleditor/blocks.py +185 -0
- package/design/tools/sources/.xmleditor/cli.py +141 -0
- package/design/tools/sources/.xmleditor/editor.py +906 -0
- package/design/tools/sources/.xmleditor/model.py +708 -0
- package/design/tools/sources/.xmleditor/widgets.py +1832 -0
- package/design/tools/sources/.xmleditor/xsdmodel.py +753 -0
- package/design/tools/sources/checker.py +55 -0
- package/design/tools/sources/docgen.py +66 -0
- package/design/tools/sources/generate.py +48 -0
- package/design/tools/sources/linter.py +54 -0
- package/design/tools/sources/ruff.toml +12 -0
- package/design/tools/sources/xmleditor.py +62 -0
- package/design/tools/unix/_venv_python.sh +16 -0
- package/design/tools/unix/check.sh +13 -0
- package/design/tools/unix/doc.sh +14 -0
- package/design/tools/unix/gen.sh +14 -0
- package/design/tools/unix/lint.sh +10 -0
- package/design/tools/unix/run.sh +20 -0
- package/design/tools/unix/verify.sh +12 -0
- package/design/tools/unix/xmledit.sh +12 -0
- package/design/tools/windows/check.cmd +12 -0
- package/design/tools/windows/doc.cmd +12 -0
- package/design/tools/windows/gen.cmd +11 -0
- package/design/tools/windows/lint.cmd +9 -0
- package/design/tools/windows/run.cmd +26 -0
- package/design/tools/windows/verify.cmd +10 -0
- package/design/tools/windows/xmledit.cmd +10 -0
- package/dist/chunk-LV4UIEQN.js +9730 -0
- package/dist/chunk-LV4UIEQN.js.map +1 -0
- package/dist/chunk-WNVU3BM2.mjs +9401 -0
- package/dist/chunk-WNVU3BM2.mjs.map +1 -0
- package/dist/index.d.mts +40 -9
- package/dist/index.d.ts +40 -9
- package/dist/index.js +726 -414
- package/dist/index.mjs +1 -5
- package/dist/ui/index.d.mts +6931 -3070
- package/dist/ui/index.d.ts +6931 -3070
- package/dist/ui/index.js +779 -352
- package/dist/ui/index.mjs +1 -2
- package/package.json +66 -142
- package/dist/chunk-2XORADW6.js +0 -24552
- package/dist/chunk-2XORADW6.js.map +0 -1
- package/dist/chunk-52BHHF5M.js +0 -46
- package/dist/chunk-52BHHF5M.js.map +0 -1
- package/dist/chunk-5647JY7Z.mjs +0 -100
- package/dist/chunk-5647JY7Z.mjs.map +0 -1
- package/dist/chunk-5N5HC4ZA.mjs +0 -3
- package/dist/chunk-5N5HC4ZA.mjs.map +0 -1
- package/dist/chunk-7QFZMGL6.js +0 -8583
- package/dist/chunk-7QFZMGL6.js.map +0 -1
- package/dist/chunk-ASZEP37D.js +0 -423
- package/dist/chunk-ASZEP37D.js.map +0 -1
- package/dist/chunk-BH5SU2JQ.mjs +0 -8282
- package/dist/chunk-BH5SU2JQ.mjs.map +0 -1
- package/dist/chunk-BO65GO53.mjs +0 -422
- package/dist/chunk-BO65GO53.mjs.map +0 -1
- package/dist/chunk-BSVXX52E.mjs +0 -413
- package/dist/chunk-BSVXX52E.mjs.map +0 -1
- package/dist/chunk-DNV5UBNF.mjs +0 -3
- package/dist/chunk-DNV5UBNF.mjs.map +0 -1
- package/dist/chunk-EDTAMUO2.js +0 -8310
- package/dist/chunk-EDTAMUO2.js.map +0 -1
- package/dist/chunk-IJTI6EX4.js +0 -4
- package/dist/chunk-IJTI6EX4.js.map +0 -1
- package/dist/chunk-M3YLASM2.js +0 -428
- package/dist/chunk-M3YLASM2.js.map +0 -1
- package/dist/chunk-OXKOGLXE.js +0 -4
- package/dist/chunk-OXKOGLXE.js.map +0 -1
- package/dist/chunk-RQXQK3ZO.mjs +0 -8486
- package/dist/chunk-RQXQK3ZO.mjs.map +0 -1
- package/dist/chunk-SR25V4EA.mjs +0 -40
- package/dist/chunk-SR25V4EA.mjs.map +0 -1
- package/dist/chunk-UB34WFEQ.js +0 -106
- package/dist/chunk-UB34WFEQ.js.map +0 -1
- package/dist/chunk-ZBRWXKDF.mjs +0 -24431
- package/dist/chunk-ZBRWXKDF.mjs.map +0 -1
- package/dist/cli/ds.d.mts +0 -1
- package/dist/cli/ds.d.ts +0 -1
- package/dist/cli/ds.js +0 -602
- package/dist/cli/ds.js.map +0 -1
- package/dist/cli/ds.mjs +0 -579
- package/dist/cli/ds.mjs.map +0 -1
- package/dist/cli/flipova.d.mts +0 -1
- package/dist/cli/flipova.d.ts +0 -1
- package/dist/cli/flipova.js +0 -161
- package/dist/cli/flipova.js.map +0 -1
- package/dist/cli/flipova.mjs +0 -154
- package/dist/cli/flipova.mjs.map +0 -1
- package/dist/config/index.d.mts +0 -123
- package/dist/config/index.d.ts +0 -123
- package/dist/config/index.js +0 -28
- package/dist/config/index.js.map +0 -1
- package/dist/config/index.mjs +0 -3
- package/dist/config/index.mjs.map +0 -1
- package/dist/index-CuaJA3gM.d.mts +0 -78
- package/dist/index-CuaJA3gM.d.ts +0 -78
- package/dist/registry/index.d.mts +0 -10160
- package/dist/registry/index.d.ts +0 -10160
- package/dist/registry/index.js +0 -392
- package/dist/registry/index.js.map +0 -1
- package/dist/registry/index.mjs +0 -3
- package/dist/registry/index.mjs.map +0 -1
- package/dist/theme/index.d.mts +0 -109
- package/dist/theme/index.d.ts +0 -109
- package/dist/theme/index.js +0 -28
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/index.mjs +0 -3
- package/dist/theme/index.mjs.map +0 -1
- package/dist/tokens/index.d.mts +0 -423
- package/dist/tokens/index.d.ts +0 -423
- package/dist/tokens/index.js +0 -44
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/index.mjs +0 -3
- package/dist/tokens/index.mjs.map +0 -1
- package/dist/types/index.d.mts +0 -202
- package/dist/types/index.d.ts +0 -202
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -3
- package/dist/types/index.mjs.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createAlertDialog } from '@gluestack-ui/core/alert-dialog/creator';
|
|
3
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
4
|
+
import {
|
|
5
|
+
tva,
|
|
6
|
+
useStyleContext,
|
|
7
|
+
withStyleContext,
|
|
8
|
+
} from '@gluestack-ui/utils/nativewind-utils';
|
|
9
|
+
import { cssInterop } from 'nativewind';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Pressable, ScrollView, View } from 'react-native';
|
|
12
|
+
import Animated, {
|
|
13
|
+
Easing,
|
|
14
|
+
FadeIn,
|
|
15
|
+
FadeOut,
|
|
16
|
+
ZoomIn
|
|
17
|
+
} from 'react-native-reanimated';
|
|
18
|
+
|
|
19
|
+
const SCOPE = 'ALERT_DIALOG';
|
|
20
|
+
|
|
21
|
+
const RootComponent = withStyleContext(View, SCOPE);
|
|
22
|
+
|
|
23
|
+
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
24
|
+
const AnimatedView = Animated.createAnimatedComponent(View);
|
|
25
|
+
|
|
26
|
+
const UIAccessibleAlertDialog = createAlertDialog({
|
|
27
|
+
Root: RootComponent,
|
|
28
|
+
Body: ScrollView,
|
|
29
|
+
Content: AnimatedView,
|
|
30
|
+
CloseButton: Pressable,
|
|
31
|
+
Header: View,
|
|
32
|
+
Footer: View,
|
|
33
|
+
Backdrop: AnimatedPressable,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
cssInterop(AnimatedPressable, { className: 'style' });
|
|
37
|
+
cssInterop(AnimatedView, { className: 'style' });
|
|
38
|
+
|
|
39
|
+
const alertDialogStyle = tva({
|
|
40
|
+
base: 'group/modal w-full h-full justify-center items-center web:pointer-events-none',
|
|
41
|
+
parentVariants: {
|
|
42
|
+
size: {
|
|
43
|
+
xs: '',
|
|
44
|
+
sm: '',
|
|
45
|
+
md: '',
|
|
46
|
+
lg: '',
|
|
47
|
+
full: '',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const alertDialogContentStyle = tva({
|
|
53
|
+
base: 'bg-background rounded-lg overflow-hidden border border-border p-6',
|
|
54
|
+
parentVariants: {
|
|
55
|
+
size: {
|
|
56
|
+
xs: 'w-[60%] max-w-[360px]',
|
|
57
|
+
sm: 'w-[70%] max-w-[420px]',
|
|
58
|
+
md: 'w-[80%] max-w-[510px]',
|
|
59
|
+
lg: 'w-[90%] max-w-[640px]',
|
|
60
|
+
full: 'w-full',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const alertDialogCloseButtonStyle = tva({
|
|
66
|
+
base: 'group/alert-dialog-close-button z-10 rounded-sm p-2 data-[focus-visible=true]:bg-background/10 web:cursor-pointer outline-0',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const alertDialogHeaderStyle = tva({
|
|
70
|
+
base: 'justify-between items-center flex-row',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const alertDialogFooterStyle = tva({
|
|
74
|
+
base: 'flex-row justify-end items-center gap-3',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const alertDialogBodyStyle = tva({ base: '' });
|
|
78
|
+
|
|
79
|
+
const alertDialogBackdropStyle = tva({
|
|
80
|
+
base: 'absolute left-0 top-0 right-0 bottom-0 bg-black/50 web:cursor-default',
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
type IAlertDialogProps = React.ComponentPropsWithoutRef<
|
|
84
|
+
typeof UIAccessibleAlertDialog
|
|
85
|
+
> &
|
|
86
|
+
VariantProps<typeof alertDialogStyle>;
|
|
87
|
+
|
|
88
|
+
type IAlertDialogContentProps = React.ComponentPropsWithoutRef<
|
|
89
|
+
typeof UIAccessibleAlertDialog.Content
|
|
90
|
+
> &
|
|
91
|
+
VariantProps<typeof alertDialogContentStyle> & { className?: string };
|
|
92
|
+
|
|
93
|
+
type IAlertDialogCloseButtonProps = React.ComponentPropsWithoutRef<
|
|
94
|
+
typeof UIAccessibleAlertDialog.CloseButton
|
|
95
|
+
> &
|
|
96
|
+
VariantProps<typeof alertDialogCloseButtonStyle>;
|
|
97
|
+
|
|
98
|
+
type IAlertDialogHeaderProps = React.ComponentPropsWithoutRef<
|
|
99
|
+
typeof UIAccessibleAlertDialog.Header
|
|
100
|
+
> &
|
|
101
|
+
VariantProps<typeof alertDialogHeaderStyle>;
|
|
102
|
+
|
|
103
|
+
type IAlertDialogFooterProps = React.ComponentPropsWithoutRef<
|
|
104
|
+
typeof UIAccessibleAlertDialog.Footer
|
|
105
|
+
> &
|
|
106
|
+
VariantProps<typeof alertDialogFooterStyle>;
|
|
107
|
+
|
|
108
|
+
type IAlertDialogBodyProps = React.ComponentPropsWithoutRef<
|
|
109
|
+
typeof UIAccessibleAlertDialog.Body
|
|
110
|
+
> &
|
|
111
|
+
VariantProps<typeof alertDialogBodyStyle>;
|
|
112
|
+
|
|
113
|
+
type IAlertDialogBackdropProps = React.ComponentPropsWithoutRef<
|
|
114
|
+
typeof UIAccessibleAlertDialog.Backdrop
|
|
115
|
+
> &
|
|
116
|
+
VariantProps<typeof alertDialogBackdropStyle> & { className?: string };
|
|
117
|
+
|
|
118
|
+
const AlertDialog = React.forwardRef<
|
|
119
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog>,
|
|
120
|
+
IAlertDialogProps
|
|
121
|
+
>(function AlertDialog({ className, size = 'md', ...props }, ref) {
|
|
122
|
+
return (
|
|
123
|
+
<UIAccessibleAlertDialog
|
|
124
|
+
ref={ref}
|
|
125
|
+
{...props}
|
|
126
|
+
className={alertDialogStyle({ class: className })}
|
|
127
|
+
context={{ size }}
|
|
128
|
+
pointerEvents="box-none"
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const AlertDialogContent = React.forwardRef<
|
|
134
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog.Content>,
|
|
135
|
+
IAlertDialogContentProps
|
|
136
|
+
>(function AlertDialogContent({ className, size, ...props }, ref) {
|
|
137
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<UIAccessibleAlertDialog.Content
|
|
141
|
+
pointerEvents="auto"
|
|
142
|
+
entering={ZoomIn.duration(200).withInitialValues({
|
|
143
|
+
transform: [{ scale: 0.9 }],
|
|
144
|
+
opacity: 0,
|
|
145
|
+
})}
|
|
146
|
+
exiting={FadeOut.duration(200)}
|
|
147
|
+
ref={ref}
|
|
148
|
+
{...props}
|
|
149
|
+
className={alertDialogContentStyle({
|
|
150
|
+
parentVariants: {
|
|
151
|
+
size: parentSize,
|
|
152
|
+
},
|
|
153
|
+
size,
|
|
154
|
+
class: className,
|
|
155
|
+
})}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const AlertDialogCloseButton = React.forwardRef<
|
|
161
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog.CloseButton>,
|
|
162
|
+
IAlertDialogCloseButtonProps
|
|
163
|
+
>(function AlertDialogCloseButton({ className, ...props }, ref) {
|
|
164
|
+
return (
|
|
165
|
+
<UIAccessibleAlertDialog.CloseButton
|
|
166
|
+
ref={ref}
|
|
167
|
+
{...props}
|
|
168
|
+
className={alertDialogCloseButtonStyle({
|
|
169
|
+
class: className,
|
|
170
|
+
})}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const AlertDialogHeader = React.forwardRef<
|
|
176
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog.Header>,
|
|
177
|
+
IAlertDialogHeaderProps
|
|
178
|
+
>(function AlertDialogHeader({ className, ...props }, ref) {
|
|
179
|
+
return (
|
|
180
|
+
<UIAccessibleAlertDialog.Header
|
|
181
|
+
ref={ref}
|
|
182
|
+
{...props}
|
|
183
|
+
className={alertDialogHeaderStyle({
|
|
184
|
+
class: className,
|
|
185
|
+
})}
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const AlertDialogFooter = React.forwardRef<
|
|
191
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog.Footer>,
|
|
192
|
+
IAlertDialogFooterProps
|
|
193
|
+
>(function AlertDialogFooter({ className, ...props }, ref) {
|
|
194
|
+
return (
|
|
195
|
+
<UIAccessibleAlertDialog.Footer
|
|
196
|
+
ref={ref}
|
|
197
|
+
{...props}
|
|
198
|
+
className={alertDialogFooterStyle({
|
|
199
|
+
class: className,
|
|
200
|
+
})}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const AlertDialogBody = React.forwardRef<
|
|
206
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog.Body>,
|
|
207
|
+
IAlertDialogBodyProps
|
|
208
|
+
>(function AlertDialogBody({ className, ...props }, ref) {
|
|
209
|
+
return (
|
|
210
|
+
<UIAccessibleAlertDialog.Body
|
|
211
|
+
ref={ref}
|
|
212
|
+
{...props}
|
|
213
|
+
className={alertDialogBodyStyle({
|
|
214
|
+
class: className,
|
|
215
|
+
})}
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const AlertDialogBackdrop = React.forwardRef<
|
|
221
|
+
React.ComponentRef<typeof UIAccessibleAlertDialog.Backdrop>,
|
|
222
|
+
IAlertDialogBackdropProps
|
|
223
|
+
>(function AlertDialogBackdrop({ className, ...props }, ref) {
|
|
224
|
+
return (
|
|
225
|
+
<UIAccessibleAlertDialog.Backdrop
|
|
226
|
+
ref={ref}
|
|
227
|
+
{...props}
|
|
228
|
+
entering={FadeIn.duration(200).easing(Easing.linear)}
|
|
229
|
+
exiting={FadeOut.duration(200).easing(Easing.linear)}
|
|
230
|
+
className={alertDialogBackdropStyle({
|
|
231
|
+
class: className,
|
|
232
|
+
})}
|
|
233
|
+
/>
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
AlertDialog.displayName = 'AlertDialog';
|
|
238
|
+
AlertDialogContent.displayName = 'AlertDialogContent';
|
|
239
|
+
AlertDialogCloseButton.displayName = 'AlertDialogCloseButton';
|
|
240
|
+
AlertDialogHeader.displayName = 'AlertDialogHeader';
|
|
241
|
+
AlertDialogFooter.displayName = 'AlertDialogFooter';
|
|
242
|
+
AlertDialogBody.displayName = 'AlertDialogBody';
|
|
243
|
+
AlertDialogBackdrop.displayName = 'AlertDialogBackdrop';
|
|
244
|
+
|
|
245
|
+
export {
|
|
246
|
+
AlertDialog,
|
|
247
|
+
AlertDialogBackdrop,
|
|
248
|
+
AlertDialogBody,
|
|
249
|
+
AlertDialogCloseButton,
|
|
250
|
+
AlertDialogContent,
|
|
251
|
+
AlertDialogFooter,
|
|
252
|
+
AlertDialogHeader
|
|
253
|
+
};
|
|
254
|
+
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createAvatar } from '@gluestack-ui/core/avatar/creator';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { Image, Text, View } from 'react-native';
|
|
6
|
+
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
8
|
+
import { tva, withStyleContext } from '@gluestack-ui/utils/nativewind-utils';
|
|
9
|
+
const SCOPE = 'AVATAR';
|
|
10
|
+
|
|
11
|
+
const UIAvatar = createAvatar({
|
|
12
|
+
Root: withStyleContext(View, SCOPE),
|
|
13
|
+
Badge: View,
|
|
14
|
+
Group: View,
|
|
15
|
+
Image: Image,
|
|
16
|
+
FallbackText: Text,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const avatarStyle = tva({
|
|
20
|
+
base: 'relative flex h-12 w-12 shrink-0 rounded-full bg-muted items-center justify-center group-[.avatar-group]/avatar-group:-ml-2.5',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const avatarFallbackTextStyle = tva({
|
|
24
|
+
base: 'text-foreground text-xs font-medium text-transform:uppercase',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const avatarGroupStyle = tva({
|
|
28
|
+
base: 'group/avatar-group flex-row-reverse relative avatar-group',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const avatarBadgeStyle = tva({
|
|
32
|
+
base: 'absolute h-3 w-3 rounded-full border-2 border-background right-0 bottom-0 bg-green-500',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const avatarImageStyle = tva({
|
|
36
|
+
base: 'h-full w-full rounded-full absolute',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
type IAvatarProps = Omit<
|
|
40
|
+
React.ComponentPropsWithoutRef<typeof UIAvatar>,
|
|
41
|
+
'context'
|
|
42
|
+
> &
|
|
43
|
+
VariantProps<typeof avatarStyle>;
|
|
44
|
+
|
|
45
|
+
const Avatar = React.forwardRef<
|
|
46
|
+
React.ComponentRef<typeof UIAvatar>,
|
|
47
|
+
IAvatarProps
|
|
48
|
+
>(function Avatar({ className, ...props }, ref) {
|
|
49
|
+
return (
|
|
50
|
+
<UIAvatar
|
|
51
|
+
ref={ref}
|
|
52
|
+
{...props}
|
|
53
|
+
className={avatarStyle({ class: className })}
|
|
54
|
+
context={{}}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
type IAvatarBadgeProps = React.ComponentPropsWithoutRef<typeof UIAvatar.Badge> &
|
|
60
|
+
VariantProps<typeof avatarBadgeStyle>;
|
|
61
|
+
|
|
62
|
+
const AvatarBadge = React.forwardRef<
|
|
63
|
+
React.ComponentRef<typeof UIAvatar.Badge>,
|
|
64
|
+
IAvatarBadgeProps
|
|
65
|
+
>(function AvatarBadge({ className, ...props }, ref) {
|
|
66
|
+
return (
|
|
67
|
+
<UIAvatar.Badge
|
|
68
|
+
ref={ref}
|
|
69
|
+
{...props}
|
|
70
|
+
className={avatarBadgeStyle({ class: className })}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
type IAvatarFallbackTextProps = React.ComponentPropsWithoutRef<
|
|
76
|
+
typeof UIAvatar.FallbackText
|
|
77
|
+
> &
|
|
78
|
+
VariantProps<typeof avatarFallbackTextStyle>;
|
|
79
|
+
const AvatarFallbackText = React.forwardRef<
|
|
80
|
+
React.ComponentRef<typeof UIAvatar.FallbackText>,
|
|
81
|
+
IAvatarFallbackTextProps
|
|
82
|
+
>(function AvatarFallbackText({ className, ...props }, ref) {
|
|
83
|
+
return (
|
|
84
|
+
<UIAvatar.FallbackText
|
|
85
|
+
ref={ref}
|
|
86
|
+
{...props}
|
|
87
|
+
className={avatarFallbackTextStyle({ class: className })}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
type IAvatarImageProps = React.ComponentPropsWithoutRef<typeof UIAvatar.Image> &
|
|
93
|
+
VariantProps<typeof avatarImageStyle>;
|
|
94
|
+
|
|
95
|
+
const AvatarImage = React.forwardRef<
|
|
96
|
+
React.ComponentRef<typeof UIAvatar.Image>,
|
|
97
|
+
IAvatarImageProps
|
|
98
|
+
>(function AvatarImage({ className, ...props }, ref) {
|
|
99
|
+
return (
|
|
100
|
+
<UIAvatar.Image
|
|
101
|
+
ref={ref}
|
|
102
|
+
{...props}
|
|
103
|
+
className={avatarImageStyle({
|
|
104
|
+
class: className,
|
|
105
|
+
})}
|
|
106
|
+
resizeMode="cover"
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
type IAvatarGroupProps = React.ComponentPropsWithoutRef<typeof UIAvatar.Group> &
|
|
112
|
+
VariantProps<typeof avatarGroupStyle>;
|
|
113
|
+
|
|
114
|
+
const AvatarGroup = React.forwardRef<
|
|
115
|
+
React.ComponentRef<typeof UIAvatar.Group>,
|
|
116
|
+
IAvatarGroupProps
|
|
117
|
+
>(function AvatarGroup({ className, ...props }, ref) {
|
|
118
|
+
return (
|
|
119
|
+
<UIAvatar.Group
|
|
120
|
+
ref={ref}
|
|
121
|
+
{...props}
|
|
122
|
+
className={avatarGroupStyle({
|
|
123
|
+
class: className,
|
|
124
|
+
})}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Alias for shadcn compatibility
|
|
130
|
+
const AvatarFallback = AvatarFallbackText;
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
Avatar,
|
|
134
|
+
AvatarBadge,
|
|
135
|
+
AvatarFallback,
|
|
136
|
+
AvatarFallbackText,
|
|
137
|
+
AvatarGroup,
|
|
138
|
+
AvatarImage,
|
|
139
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
5
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
6
|
+
import {
|
|
7
|
+
withStyleContext,
|
|
8
|
+
useStyleContext,
|
|
9
|
+
} from '@gluestack-ui/utils/nativewind-utils';
|
|
10
|
+
import { cssInterop } from 'nativewind';
|
|
11
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
12
|
+
|
|
13
|
+
import { Svg } from 'react-native-svg';
|
|
14
|
+
const SCOPE = 'BADGE';
|
|
15
|
+
|
|
16
|
+
const badgeStyle = tva({
|
|
17
|
+
base: 'flex-row items-center justify-center rounded-sm px-2 py-0.5',
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: 'bg-primary',
|
|
21
|
+
secondary: 'bg-secondary',
|
|
22
|
+
destructive:
|
|
23
|
+
'bg-destructive dark:bg-destructive/60',
|
|
24
|
+
outline: 'border border-border dark:border-border/90 bg-transparent',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const badgeTextStyle = tva({
|
|
30
|
+
base: 'text-xs font-medium tracking-normal uppercase',
|
|
31
|
+
parentVariants: {
|
|
32
|
+
variant: {
|
|
33
|
+
default: 'text-primary-foreground',
|
|
34
|
+
secondary: 'text-secondary-foreground',
|
|
35
|
+
destructive: 'text-white',
|
|
36
|
+
outline: 'text-foreground',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const badgeIconStyle = tva({
|
|
42
|
+
base: 'fill-none h-3 w-3 pointer-events-none',
|
|
43
|
+
parentVariants: {
|
|
44
|
+
variant: {
|
|
45
|
+
default: 'text-primary-foreground',
|
|
46
|
+
secondary: 'text-secondary-foreground',
|
|
47
|
+
destructive: 'text-white',
|
|
48
|
+
outline: 'text-foreground',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const ContextView = withStyleContext(View, SCOPE);
|
|
54
|
+
|
|
55
|
+
cssInterop(UIIcon, {
|
|
56
|
+
className: {
|
|
57
|
+
target: 'style',
|
|
58
|
+
nativeStyleToProp: {
|
|
59
|
+
height: true,
|
|
60
|
+
width: true,
|
|
61
|
+
fill: true,
|
|
62
|
+
color: 'classNameColor',
|
|
63
|
+
stroke: true,
|
|
64
|
+
} as any,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
type IBadgeProps = React.ComponentPropsWithoutRef<typeof ContextView> &
|
|
69
|
+
VariantProps<typeof badgeStyle>;
|
|
70
|
+
function Badge({
|
|
71
|
+
children,
|
|
72
|
+
variant = 'default',
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}: { className?: string } & IBadgeProps) {
|
|
76
|
+
return (
|
|
77
|
+
<ContextView
|
|
78
|
+
className={badgeStyle({ variant, class: className })}
|
|
79
|
+
{...props}
|
|
80
|
+
context={{ variant }}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</ContextView>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
type IBadgeTextProps = React.ComponentPropsWithoutRef<typeof Text> &
|
|
88
|
+
VariantProps<typeof badgeTextStyle>;
|
|
89
|
+
|
|
90
|
+
const BadgeText = React.forwardRef<
|
|
91
|
+
React.ComponentRef<typeof Text>,
|
|
92
|
+
IBadgeTextProps
|
|
93
|
+
>(function BadgeText({ children, className, ...props }, ref) {
|
|
94
|
+
const { variant: parentVariant } = useStyleContext(SCOPE);
|
|
95
|
+
return (
|
|
96
|
+
<Text
|
|
97
|
+
ref={ref}
|
|
98
|
+
className={badgeTextStyle({
|
|
99
|
+
parentVariants: {
|
|
100
|
+
variant: parentVariant,
|
|
101
|
+
},
|
|
102
|
+
class: className,
|
|
103
|
+
})}
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
{children}
|
|
107
|
+
</Text>
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
type IBadgeIconProps = React.ComponentPropsWithoutRef<typeof UIIcon> &
|
|
112
|
+
VariantProps<typeof badgeIconStyle> & {
|
|
113
|
+
size?: number;
|
|
114
|
+
height?: number;
|
|
115
|
+
width?: number;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const BadgeIcon = React.forwardRef<
|
|
119
|
+
React.ComponentRef<typeof Svg>,
|
|
120
|
+
IBadgeIconProps
|
|
121
|
+
>(function BadgeIcon({ className, size, ...props }, ref) {
|
|
122
|
+
const { variant: parentVariant } = useStyleContext(SCOPE);
|
|
123
|
+
|
|
124
|
+
if (typeof size === 'number') {
|
|
125
|
+
return (
|
|
126
|
+
<UIIcon
|
|
127
|
+
ref={ref as any}
|
|
128
|
+
{...props}
|
|
129
|
+
className={badgeIconStyle({ class: className })}
|
|
130
|
+
size={size}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
} else if (
|
|
134
|
+
(props?.height !== undefined || props?.width !== undefined) &&
|
|
135
|
+
size === undefined
|
|
136
|
+
) {
|
|
137
|
+
return (
|
|
138
|
+
<UIIcon
|
|
139
|
+
ref={ref as any}
|
|
140
|
+
{...props}
|
|
141
|
+
className={badgeIconStyle({ class: className })}
|
|
142
|
+
/>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
return (
|
|
146
|
+
<UIIcon
|
|
147
|
+
className={badgeIconStyle({
|
|
148
|
+
parentVariants: {
|
|
149
|
+
variant: parentVariant,
|
|
150
|
+
},
|
|
151
|
+
class: className,
|
|
152
|
+
})}
|
|
153
|
+
{...props}
|
|
154
|
+
ref={ref as any}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
Badge.displayName = 'Badge';
|
|
160
|
+
BadgeText.displayName = 'BadgeText';
|
|
161
|
+
BadgeIcon.displayName = 'BadgeIcon';
|
|
162
|
+
|
|
163
|
+
export { Badge, BadgeIcon, BadgeText };
|