@flipova/foundation 1.14.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 +175 -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 -10
- package/dist/index.d.ts +40 -10
- 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 -149
- 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/createTheme-DQeX3s0I.d.mts +0 -78
- package/dist/createTheme-Y4jfz4-u.d.ts +0 -78
- 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 -35
- package/dist/theme/index.d.ts +0 -35
- 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
- package/dist/web/index.d.mts +0 -316
- package/dist/web/index.d.ts +0 -316
- package/dist/web/index.js +0 -1500
- package/dist/web/index.js.map +0 -1
- package/dist/web/index.mjs +0 -1396
- package/dist/web/index.mjs.map +0 -1
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { H4 } from '@expo/html-elements';
|
|
4
|
+
import { createActionsheet } from '@gluestack-ui/core/actionsheet/creator';
|
|
5
|
+
import {
|
|
6
|
+
Pressable,
|
|
7
|
+
View,
|
|
8
|
+
Text,
|
|
9
|
+
ScrollView,
|
|
10
|
+
VirtualizedList,
|
|
11
|
+
FlatList,
|
|
12
|
+
SectionList,
|
|
13
|
+
ViewStyle,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
16
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
17
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
18
|
+
import { withStyleContext } from '@gluestack-ui/utils/nativewind-utils';
|
|
19
|
+
import { cssInterop } from 'nativewind';
|
|
20
|
+
import {
|
|
21
|
+
Motion,
|
|
22
|
+
AnimatePresence,
|
|
23
|
+
createMotionAnimatedComponent,
|
|
24
|
+
MotionComponentProps,
|
|
25
|
+
} from '@legendapp/motion';
|
|
26
|
+
|
|
27
|
+
import React from 'react';
|
|
28
|
+
|
|
29
|
+
type IAnimatedPressableProps = React.ComponentProps<typeof Pressable> &
|
|
30
|
+
MotionComponentProps<typeof Pressable, ViewStyle, unknown, unknown, unknown>;
|
|
31
|
+
|
|
32
|
+
const AnimatedPressable = createMotionAnimatedComponent(
|
|
33
|
+
Pressable
|
|
34
|
+
) as React.ComponentType<IAnimatedPressableProps>;
|
|
35
|
+
|
|
36
|
+
type IMotionViewProps = React.ComponentProps<typeof View> &
|
|
37
|
+
MotionComponentProps<typeof View, ViewStyle, unknown, unknown, unknown>;
|
|
38
|
+
|
|
39
|
+
const MotionView = Motion.View as React.ComponentType<IMotionViewProps>;
|
|
40
|
+
|
|
41
|
+
export const UIActionsheet = createActionsheet({
|
|
42
|
+
Root: View,
|
|
43
|
+
Content: withStyleContext(MotionView),
|
|
44
|
+
Item: withStyleContext(Pressable),
|
|
45
|
+
ItemText: Text,
|
|
46
|
+
DragIndicator: View,
|
|
47
|
+
IndicatorWrapper: View,
|
|
48
|
+
Backdrop: AnimatedPressable,
|
|
49
|
+
ScrollView: ScrollView,
|
|
50
|
+
VirtualizedList: VirtualizedList,
|
|
51
|
+
FlatList: FlatList,
|
|
52
|
+
SectionList: SectionList,
|
|
53
|
+
SectionHeaderText: H4,
|
|
54
|
+
Icon: UIIcon,
|
|
55
|
+
AnimatePresence: AnimatePresence,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
cssInterop(UIActionsheet, { className: 'style' });
|
|
59
|
+
cssInterop(UIActionsheet.Content, { className: 'style' });
|
|
60
|
+
cssInterop(UIActionsheet.Item, { className: 'style' });
|
|
61
|
+
cssInterop(UIActionsheet.ItemText, { className: 'style' });
|
|
62
|
+
cssInterop(UIActionsheet.DragIndicator, { className: 'style' });
|
|
63
|
+
cssInterop(UIActionsheet.DragIndicatorWrapper, { className: 'style' });
|
|
64
|
+
cssInterop(UIActionsheet.Backdrop, { className: 'style' });
|
|
65
|
+
cssInterop(UIActionsheet.ScrollView, {
|
|
66
|
+
className: 'style',
|
|
67
|
+
contentContainerClassName: 'contentContainerStyle',
|
|
68
|
+
indicatorClassName: 'indicatorStyle',
|
|
69
|
+
});
|
|
70
|
+
cssInterop(UIActionsheet.VirtualizedList, {
|
|
71
|
+
className: 'style',
|
|
72
|
+
ListFooterComponentClassName: 'ListFooterComponentStyle',
|
|
73
|
+
ListHeaderComponentClassName: 'ListHeaderComponentStyle',
|
|
74
|
+
contentContainerClassName: 'contentContainerStyle',
|
|
75
|
+
indicatorClassName: 'indicatorStyle',
|
|
76
|
+
});
|
|
77
|
+
cssInterop(UIActionsheet.FlatList, {
|
|
78
|
+
className: 'style',
|
|
79
|
+
ListFooterComponentClassName: 'ListFooterComponentStyle',
|
|
80
|
+
ListHeaderComponentClassName: 'ListHeaderComponentStyle',
|
|
81
|
+
columnWrapperClassName: 'columnWrapperStyle',
|
|
82
|
+
contentContainerClassName: 'contentContainerStyle',
|
|
83
|
+
indicatorClassName: 'indicatorStyle',
|
|
84
|
+
});
|
|
85
|
+
cssInterop(UIActionsheet.SectionList, { className: 'style' });
|
|
86
|
+
cssInterop(UIActionsheet.SectionHeaderText, { className: 'style' });
|
|
87
|
+
cssInterop(UIIcon, {
|
|
88
|
+
className: {
|
|
89
|
+
target: 'style',
|
|
90
|
+
nativeStyleToProp: {
|
|
91
|
+
height: true,
|
|
92
|
+
width: true,
|
|
93
|
+
fill: true,
|
|
94
|
+
color: 'classNameColor',
|
|
95
|
+
stroke: true,
|
|
96
|
+
} as any,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const actionsheetStyle = tva({ base: 'w-full h-full web:pointer-events-none' });
|
|
101
|
+
|
|
102
|
+
const actionsheetContentStyle = tva({
|
|
103
|
+
base: 'items-center rounded-tl-3xl rounded-tr-3xl p-2 bg-background web:pointer-events-auto web:select-none shadow-lg pb-safe',
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const actionsheetItemStyle = tva({
|
|
107
|
+
base: 'w-full flex-row items-center p-3 rounded-sm data-[disabled=true]:opacity-40 data-[disabled=true]:web:pointer-events-auto data-[disabled=true]:web:cursor-not-allowed hover:bg-background/10 active:bg-background/20 data-[focus=true]:bg-background/20 web:data-[focus-visible=true]:bg-background/20 data-[checked=true]:bg-background/20',
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const actionsheetItemTextStyle = tva({
|
|
111
|
+
base: 'text-foreground/70 font-normal font-body tracking-md text-left mx-2',
|
|
112
|
+
variants: {
|
|
113
|
+
isTruncated: {
|
|
114
|
+
true: '',
|
|
115
|
+
},
|
|
116
|
+
bold: {
|
|
117
|
+
true: 'font-bold',
|
|
118
|
+
},
|
|
119
|
+
underline: {
|
|
120
|
+
true: 'underline',
|
|
121
|
+
},
|
|
122
|
+
strikeThrough: {
|
|
123
|
+
true: 'line-through',
|
|
124
|
+
},
|
|
125
|
+
size: {
|
|
126
|
+
'2xs': 'text-2xs',
|
|
127
|
+
'xs': 'text-xs',
|
|
128
|
+
'sm': 'text-sm',
|
|
129
|
+
'md': 'text-base',
|
|
130
|
+
'lg': 'text-lg',
|
|
131
|
+
'xl': 'text-xl',
|
|
132
|
+
'2xl': 'text-2xl',
|
|
133
|
+
'3xl': 'text-3xl',
|
|
134
|
+
'4xl': 'text-4xl',
|
|
135
|
+
'5xl': 'text-5xl',
|
|
136
|
+
'6xl': 'text-6xl',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
defaultVariants: {
|
|
140
|
+
size: 'md',
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const actionsheetDragIndicatorStyle = tva({
|
|
145
|
+
base: 'w-16 h-1 bg-muted-foreground rounded-full',
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const actionsheetDragIndicatorWrapperStyle = tva({
|
|
149
|
+
base: 'w-full py-1 items-center',
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const actionsheetBackdropStyle = tva({
|
|
153
|
+
base: 'absolute left-0 top-0 right-0 bottom-0 bg-black/50 web:cursor-default web:pointer-events-auto',
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const actionsheetScrollViewStyle = tva({
|
|
157
|
+
base: 'w-full h-auto',
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const actionsheetVirtualizedListStyle = tva({
|
|
161
|
+
base: 'w-full h-auto',
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const actionsheetFlatListStyle = tva({
|
|
165
|
+
base: 'w-full h-auto',
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
const actionsheetSectionListStyle = tva({
|
|
169
|
+
base: 'w-full h-auto',
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const actionsheetSectionHeaderTextStyle = tva({
|
|
173
|
+
base: 'leading-5 font-bold font-heading my-0 text-foreground/50 p-3 uppercase',
|
|
174
|
+
variants: {
|
|
175
|
+
isTruncated: {
|
|
176
|
+
true: '',
|
|
177
|
+
},
|
|
178
|
+
bold: {
|
|
179
|
+
true: 'font-bold',
|
|
180
|
+
},
|
|
181
|
+
underline: {
|
|
182
|
+
true: 'underline',
|
|
183
|
+
},
|
|
184
|
+
strikeThrough: {
|
|
185
|
+
true: 'line-through',
|
|
186
|
+
},
|
|
187
|
+
size: {
|
|
188
|
+
'5xl': 'text-5xl',
|
|
189
|
+
'4xl': 'text-4xl',
|
|
190
|
+
'3xl': 'text-3xl',
|
|
191
|
+
'2xl': 'text-2xl',
|
|
192
|
+
'xl': 'text-xl',
|
|
193
|
+
'lg': 'text-lg',
|
|
194
|
+
'md': 'text-base',
|
|
195
|
+
'sm': 'text-sm',
|
|
196
|
+
'xs': 'text-xs',
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
sub: {
|
|
200
|
+
true: 'text-xs',
|
|
201
|
+
},
|
|
202
|
+
italic: {
|
|
203
|
+
true: 'italic',
|
|
204
|
+
},
|
|
205
|
+
highlight: {
|
|
206
|
+
true: 'bg-yellow500',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
defaultVariants: {
|
|
210
|
+
size: 'xs',
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const actionsheetIconStyle = tva({
|
|
215
|
+
base: 'text-foreground/90',
|
|
216
|
+
variants: {
|
|
217
|
+
size: {
|
|
218
|
+
'2xs': 'h-3 w-3',
|
|
219
|
+
'xs': 'h-3.5 w-3.5',
|
|
220
|
+
'sm': 'h-4 w-4',
|
|
221
|
+
'md': 'w-4 h-4',
|
|
222
|
+
'lg': 'h-5 w-5',
|
|
223
|
+
'xl': 'h-6 w-6',
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
type IActionsheetProps = VariantProps<typeof actionsheetStyle> &
|
|
229
|
+
React.ComponentProps<typeof UIActionsheet> & { className?: string };
|
|
230
|
+
|
|
231
|
+
type IActionsheetContentProps = VariantProps<typeof actionsheetContentStyle> &
|
|
232
|
+
React.ComponentProps<typeof UIActionsheet.Content> & { className?: string };
|
|
233
|
+
|
|
234
|
+
type IActionsheetItemProps = VariantProps<typeof actionsheetItemStyle> &
|
|
235
|
+
React.ComponentProps<typeof UIActionsheet.Item> & { className?: string };
|
|
236
|
+
|
|
237
|
+
type IActionsheetItemTextProps = VariantProps<typeof actionsheetItemTextStyle> &
|
|
238
|
+
React.ComponentProps<typeof UIActionsheet.ItemText> & { className?: string };
|
|
239
|
+
|
|
240
|
+
type IActionsheetDragIndicatorProps = VariantProps<
|
|
241
|
+
typeof actionsheetDragIndicatorStyle
|
|
242
|
+
> &
|
|
243
|
+
React.ComponentProps<typeof UIActionsheet.DragIndicator> & {
|
|
244
|
+
className?: string;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
type IActionsheetDragIndicatorWrapperProps = VariantProps<
|
|
248
|
+
typeof actionsheetDragIndicatorWrapperStyle
|
|
249
|
+
> &
|
|
250
|
+
React.ComponentProps<typeof UIActionsheet.DragIndicatorWrapper> & {
|
|
251
|
+
className?: string;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
type IActionsheetBackdropProps = VariantProps<typeof actionsheetBackdropStyle> &
|
|
255
|
+
React.ComponentProps<typeof UIActionsheet.Backdrop> & {
|
|
256
|
+
className?: string;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
type IActionsheetScrollViewProps = VariantProps<
|
|
260
|
+
typeof actionsheetScrollViewStyle
|
|
261
|
+
> &
|
|
262
|
+
React.ComponentProps<typeof UIActionsheet.ScrollView> & {
|
|
263
|
+
className?: string;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
type IActionsheetVirtualizedListProps = VariantProps<
|
|
267
|
+
typeof actionsheetVirtualizedListStyle
|
|
268
|
+
> &
|
|
269
|
+
React.ComponentProps<typeof UIActionsheet.VirtualizedList> & {
|
|
270
|
+
className?: string;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
type IActionsheetFlatListProps = VariantProps<typeof actionsheetFlatListStyle> &
|
|
274
|
+
React.ComponentProps<typeof UIActionsheet.FlatList> & {
|
|
275
|
+
className?: string;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
type IActionsheetSectionListProps = VariantProps<
|
|
279
|
+
typeof actionsheetSectionListStyle
|
|
280
|
+
> &
|
|
281
|
+
React.ComponentProps<typeof UIActionsheet.SectionList> & {
|
|
282
|
+
className?: string;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
type IActionsheetSectionHeaderTextProps = VariantProps<
|
|
286
|
+
typeof actionsheetSectionHeaderTextStyle
|
|
287
|
+
> &
|
|
288
|
+
React.ComponentProps<typeof UIActionsheet.SectionHeaderText> & {
|
|
289
|
+
className?: string;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
type IActionsheetIconProps = VariantProps<typeof actionsheetIconStyle> &
|
|
293
|
+
React.ComponentProps<typeof UIActionsheet.Icon> & {
|
|
294
|
+
className?: string;
|
|
295
|
+
as?: React.ElementType;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const Actionsheet = React.forwardRef<
|
|
299
|
+
React.ComponentRef<typeof UIActionsheet>,
|
|
300
|
+
IActionsheetProps
|
|
301
|
+
>(function Actionsheet({ className, ...props }, ref) {
|
|
302
|
+
return (
|
|
303
|
+
<UIActionsheet
|
|
304
|
+
className={actionsheetStyle({
|
|
305
|
+
class: className,
|
|
306
|
+
})}
|
|
307
|
+
ref={ref}
|
|
308
|
+
{...props}
|
|
309
|
+
/>
|
|
310
|
+
);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
const ActionsheetContent = React.forwardRef<
|
|
314
|
+
React.ComponentRef<typeof UIActionsheet.Content>,
|
|
315
|
+
IActionsheetContentProps & { className?: string }
|
|
316
|
+
>(function ActionsheetContent({ className, ...props }, ref) {
|
|
317
|
+
return (
|
|
318
|
+
<UIActionsheet.Content
|
|
319
|
+
className={actionsheetContentStyle({
|
|
320
|
+
class: className,
|
|
321
|
+
})}
|
|
322
|
+
ref={ref}
|
|
323
|
+
{...props}
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
const ActionsheetItem = React.forwardRef<
|
|
329
|
+
React.ComponentRef<typeof UIActionsheet.Item>,
|
|
330
|
+
IActionsheetItemProps
|
|
331
|
+
>(function ActionsheetItem({ className, ...props }, ref) {
|
|
332
|
+
return (
|
|
333
|
+
<UIActionsheet.Item
|
|
334
|
+
className={actionsheetItemStyle({
|
|
335
|
+
class: className,
|
|
336
|
+
})}
|
|
337
|
+
ref={ref}
|
|
338
|
+
{...props}
|
|
339
|
+
/>
|
|
340
|
+
);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
const ActionsheetItemText = React.forwardRef<
|
|
344
|
+
React.ComponentRef<typeof UIActionsheet.ItemText>,
|
|
345
|
+
IActionsheetItemTextProps
|
|
346
|
+
>(function ActionsheetItemText(
|
|
347
|
+
{ className, isTruncated, bold, underline, strikeThrough, size, ...props },
|
|
348
|
+
ref
|
|
349
|
+
) {
|
|
350
|
+
return (
|
|
351
|
+
<UIActionsheet.ItemText
|
|
352
|
+
className={actionsheetItemTextStyle({
|
|
353
|
+
class: className,
|
|
354
|
+
isTruncated: isTruncated as boolean,
|
|
355
|
+
bold: bold as boolean,
|
|
356
|
+
underline: underline as boolean,
|
|
357
|
+
strikeThrough: strikeThrough as boolean,
|
|
358
|
+
size,
|
|
359
|
+
})}
|
|
360
|
+
ref={ref}
|
|
361
|
+
{...props}
|
|
362
|
+
/>
|
|
363
|
+
);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
const ActionsheetDragIndicator = React.forwardRef<
|
|
367
|
+
React.ComponentRef<typeof UIActionsheet.DragIndicator>,
|
|
368
|
+
IActionsheetDragIndicatorProps
|
|
369
|
+
>(function ActionsheetDragIndicator({ className, ...props }, ref) {
|
|
370
|
+
return (
|
|
371
|
+
<UIActionsheet.DragIndicator
|
|
372
|
+
className={actionsheetDragIndicatorStyle({
|
|
373
|
+
class: className,
|
|
374
|
+
})}
|
|
375
|
+
ref={ref}
|
|
376
|
+
{...props}
|
|
377
|
+
/>
|
|
378
|
+
);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
const ActionsheetDragIndicatorWrapper = React.forwardRef<
|
|
382
|
+
React.ComponentRef<typeof UIActionsheet.DragIndicatorWrapper>,
|
|
383
|
+
IActionsheetDragIndicatorWrapperProps
|
|
384
|
+
>(function ActionsheetDragIndicatorWrapper({ className, ...props }, ref) {
|
|
385
|
+
return (
|
|
386
|
+
<UIActionsheet.DragIndicatorWrapper
|
|
387
|
+
className={actionsheetDragIndicatorWrapperStyle({
|
|
388
|
+
class: className,
|
|
389
|
+
})}
|
|
390
|
+
ref={ref}
|
|
391
|
+
{...props}
|
|
392
|
+
/>
|
|
393
|
+
);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
const ActionsheetBackdrop = React.forwardRef<
|
|
397
|
+
React.ComponentRef<typeof UIActionsheet.Backdrop>,
|
|
398
|
+
IActionsheetBackdropProps
|
|
399
|
+
>(function ActionsheetBackdrop({ className, ...props }, ref) {
|
|
400
|
+
return (
|
|
401
|
+
<UIActionsheet.Backdrop
|
|
402
|
+
initial={{
|
|
403
|
+
opacity: 0,
|
|
404
|
+
}}
|
|
405
|
+
animate={{
|
|
406
|
+
opacity: 0.5,
|
|
407
|
+
}}
|
|
408
|
+
exit={{
|
|
409
|
+
opacity: 0,
|
|
410
|
+
}}
|
|
411
|
+
{...props}
|
|
412
|
+
className={actionsheetBackdropStyle({
|
|
413
|
+
class: className,
|
|
414
|
+
})}
|
|
415
|
+
ref={ref}
|
|
416
|
+
/>
|
|
417
|
+
);
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
const ActionsheetScrollView = React.forwardRef<
|
|
421
|
+
React.ComponentRef<typeof UIActionsheet.ScrollView>,
|
|
422
|
+
IActionsheetScrollViewProps
|
|
423
|
+
>(function ActionsheetScrollView({ className, ...props }, ref) {
|
|
424
|
+
return (
|
|
425
|
+
<UIActionsheet.ScrollView
|
|
426
|
+
className={actionsheetScrollViewStyle({
|
|
427
|
+
class: className,
|
|
428
|
+
})}
|
|
429
|
+
ref={ref}
|
|
430
|
+
{...props}
|
|
431
|
+
/>
|
|
432
|
+
);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
const ActionsheetVirtualizedList = React.forwardRef<
|
|
436
|
+
React.ComponentRef<typeof UIActionsheet.VirtualizedList>,
|
|
437
|
+
IActionsheetVirtualizedListProps
|
|
438
|
+
>(function ActionsheetVirtualizedList({ className, ...props }, ref) {
|
|
439
|
+
return (
|
|
440
|
+
<UIActionsheet.VirtualizedList
|
|
441
|
+
className={actionsheetVirtualizedListStyle({
|
|
442
|
+
class: className,
|
|
443
|
+
})}
|
|
444
|
+
ref={ref}
|
|
445
|
+
{...props}
|
|
446
|
+
/>
|
|
447
|
+
);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
const ActionsheetFlatList = React.forwardRef<
|
|
451
|
+
React.ComponentRef<typeof UIActionsheet.FlatList>,
|
|
452
|
+
IActionsheetFlatListProps
|
|
453
|
+
>(function ActionsheetFlatList({ className, ...props }, ref) {
|
|
454
|
+
return (
|
|
455
|
+
<UIActionsheet.FlatList
|
|
456
|
+
className={actionsheetFlatListStyle({
|
|
457
|
+
class: className,
|
|
458
|
+
})}
|
|
459
|
+
ref={ref}
|
|
460
|
+
{...props}
|
|
461
|
+
/>
|
|
462
|
+
);
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
const ActionsheetSectionList = React.forwardRef<
|
|
466
|
+
React.ComponentRef<typeof UIActionsheet.SectionList>,
|
|
467
|
+
IActionsheetSectionListProps
|
|
468
|
+
>(function ActionsheetSectionList({ className, ...props }, ref) {
|
|
469
|
+
return (
|
|
470
|
+
<UIActionsheet.SectionList
|
|
471
|
+
className={actionsheetSectionListStyle({
|
|
472
|
+
class: className,
|
|
473
|
+
})}
|
|
474
|
+
ref={ref}
|
|
475
|
+
{...props}
|
|
476
|
+
/>
|
|
477
|
+
);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
const ActionsheetSectionHeaderText = React.forwardRef<
|
|
481
|
+
React.ComponentRef<typeof UIActionsheet.SectionHeaderText>,
|
|
482
|
+
IActionsheetSectionHeaderTextProps
|
|
483
|
+
>(function ActionsheetSectionHeaderText(
|
|
484
|
+
{
|
|
485
|
+
className,
|
|
486
|
+
isTruncated,
|
|
487
|
+
bold,
|
|
488
|
+
underline,
|
|
489
|
+
strikeThrough,
|
|
490
|
+
size,
|
|
491
|
+
sub,
|
|
492
|
+
italic,
|
|
493
|
+
highlight,
|
|
494
|
+
...props
|
|
495
|
+
},
|
|
496
|
+
ref
|
|
497
|
+
) {
|
|
498
|
+
return (
|
|
499
|
+
<UIActionsheet.SectionHeaderText
|
|
500
|
+
className={actionsheetSectionHeaderTextStyle({
|
|
501
|
+
class: className,
|
|
502
|
+
isTruncated: isTruncated as boolean,
|
|
503
|
+
bold: bold as boolean,
|
|
504
|
+
underline: underline as boolean,
|
|
505
|
+
strikeThrough: strikeThrough as boolean,
|
|
506
|
+
size,
|
|
507
|
+
sub: sub as boolean,
|
|
508
|
+
italic: italic as boolean,
|
|
509
|
+
highlight: highlight as boolean,
|
|
510
|
+
})}
|
|
511
|
+
ref={ref}
|
|
512
|
+
{...props}
|
|
513
|
+
/>
|
|
514
|
+
);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
const ActionsheetIcon = React.forwardRef<
|
|
518
|
+
React.ComponentRef<typeof UIActionsheet.Icon>,
|
|
519
|
+
IActionsheetIconProps
|
|
520
|
+
>(function ActionsheetIcon(
|
|
521
|
+
{ className, as: AsComp, size = 'sm', ...props },
|
|
522
|
+
ref
|
|
523
|
+
) {
|
|
524
|
+
if (AsComp) {
|
|
525
|
+
return (
|
|
526
|
+
<AsComp
|
|
527
|
+
className={actionsheetIconStyle({
|
|
528
|
+
class: className,
|
|
529
|
+
size,
|
|
530
|
+
})}
|
|
531
|
+
ref={ref}
|
|
532
|
+
{...props}
|
|
533
|
+
/>
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return (
|
|
537
|
+
<UIActionsheet.Icon
|
|
538
|
+
className={actionsheetIconStyle({
|
|
539
|
+
class: className,
|
|
540
|
+
size,
|
|
541
|
+
})}
|
|
542
|
+
ref={ref}
|
|
543
|
+
{...props}
|
|
544
|
+
/>
|
|
545
|
+
);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
export {
|
|
549
|
+
Actionsheet,
|
|
550
|
+
ActionsheetContent,
|
|
551
|
+
ActionsheetItem,
|
|
552
|
+
ActionsheetItemText,
|
|
553
|
+
ActionsheetDragIndicator,
|
|
554
|
+
ActionsheetDragIndicatorWrapper,
|
|
555
|
+
ActionsheetBackdrop,
|
|
556
|
+
ActionsheetScrollView,
|
|
557
|
+
ActionsheetVirtualizedList,
|
|
558
|
+
ActionsheetFlatList,
|
|
559
|
+
ActionsheetSectionList,
|
|
560
|
+
ActionsheetSectionHeaderText,
|
|
561
|
+
ActionsheetIcon,
|
|
562
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { skeletonStyle, skeletonTextStyle } from './styles';
|
|
5
|
+
|
|
6
|
+
type ISkeletonProps = React.ComponentProps<typeof View> &
|
|
7
|
+
VariantProps<typeof skeletonStyle> & {
|
|
8
|
+
isLoaded?: boolean;
|
|
9
|
+
startColor?: string;
|
|
10
|
+
speed?: number | string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type ISkeletonTextProps = React.ComponentProps<typeof View> &
|
|
14
|
+
VariantProps<typeof skeletonTextStyle> & {
|
|
15
|
+
_lines?: number;
|
|
16
|
+
isLoaded?: boolean;
|
|
17
|
+
startColor?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const Skeleton = forwardRef<React.ComponentRef<typeof View>, ISkeletonProps>(
|
|
21
|
+
function Skeleton(
|
|
22
|
+
{
|
|
23
|
+
className,
|
|
24
|
+
variant,
|
|
25
|
+
children,
|
|
26
|
+
startColor = 'bg-accent',
|
|
27
|
+
isLoaded = false,
|
|
28
|
+
speed = 4,
|
|
29
|
+
...props
|
|
30
|
+
},
|
|
31
|
+
ref
|
|
32
|
+
) {
|
|
33
|
+
if (!isLoaded) {
|
|
34
|
+
return (
|
|
35
|
+
<View
|
|
36
|
+
className={`animate-pulse ${startColor} ${skeletonStyle({
|
|
37
|
+
variant,
|
|
38
|
+
speed: speed as 1 | 2 | 3 | 4,
|
|
39
|
+
class: className,
|
|
40
|
+
})}`}
|
|
41
|
+
{...props}
|
|
42
|
+
ref={ref}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
return children;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const SkeletonText = forwardRef<
|
|
52
|
+
React.ComponentRef<typeof View>,
|
|
53
|
+
ISkeletonTextProps
|
|
54
|
+
>(function SkeletonText(
|
|
55
|
+
{
|
|
56
|
+
className,
|
|
57
|
+
_lines,
|
|
58
|
+
isLoaded = false,
|
|
59
|
+
startColor = 'bg-accent',
|
|
60
|
+
gap = 2,
|
|
61
|
+
children,
|
|
62
|
+
...props
|
|
63
|
+
},
|
|
64
|
+
ref
|
|
65
|
+
) {
|
|
66
|
+
if (!isLoaded) {
|
|
67
|
+
if (_lines) {
|
|
68
|
+
return (
|
|
69
|
+
<View
|
|
70
|
+
className={`flex flex-col ${skeletonTextStyle({
|
|
71
|
+
gap,
|
|
72
|
+
})}`}
|
|
73
|
+
ref={ref}
|
|
74
|
+
>
|
|
75
|
+
{Array.from({ length: _lines }).map((_, index) => (
|
|
76
|
+
<Skeleton
|
|
77
|
+
key={index}
|
|
78
|
+
className={`${startColor} ${skeletonTextStyle({
|
|
79
|
+
class: className,
|
|
80
|
+
})}`}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
))}
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
} else {
|
|
87
|
+
return (
|
|
88
|
+
<Skeleton
|
|
89
|
+
className={`${startColor} ${skeletonTextStyle({
|
|
90
|
+
class: className,
|
|
91
|
+
})}`}
|
|
92
|
+
{...props}
|
|
93
|
+
ref={ref}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
return children;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
Skeleton.displayName = 'Skeleton';
|
|
103
|
+
SkeletonText.displayName = 'SkeletonText';
|
|
104
|
+
|
|
105
|
+
export { Skeleton, SkeletonText };
|