@flipova/foundation 1.14.0 → 2.0.5
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 -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,462 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text, Pressable } from 'react-native';
|
|
5
|
+
import {
|
|
6
|
+
createCalendar,
|
|
7
|
+
type ICalendarProps,
|
|
8
|
+
type CalendarMode,
|
|
9
|
+
type CalendarMarkers,
|
|
10
|
+
} from './creator';
|
|
11
|
+
import { cssInterop } from 'nativewind';
|
|
12
|
+
import {
|
|
13
|
+
calendarStyle,
|
|
14
|
+
calendarHeaderStyle,
|
|
15
|
+
calendarHeaderButtonStyle,
|
|
16
|
+
calendarHeaderTitleStyle,
|
|
17
|
+
calendarHeaderSelectStyle,
|
|
18
|
+
calendarWeekDaysHeaderStyle,
|
|
19
|
+
calendarWeekDayStyle,
|
|
20
|
+
calendarWeekDayTextStyle,
|
|
21
|
+
calendarBodyStyle,
|
|
22
|
+
calendarGridStyle,
|
|
23
|
+
calendarWeekStyle,
|
|
24
|
+
calendarDayStyle,
|
|
25
|
+
calendarDayTextStyle,
|
|
26
|
+
calendarDayIndicatorStyle,
|
|
27
|
+
calendarWeekNumberStyle,
|
|
28
|
+
calendarWeekNumberTextStyle,
|
|
29
|
+
calendarFooterStyle,
|
|
30
|
+
} from './styles';
|
|
31
|
+
import { Menu, MenuItem, MenuItemLabel } from '../menu';
|
|
32
|
+
|
|
33
|
+
// Apply cssInterop for NativeWind support
|
|
34
|
+
cssInterop(View, { className: 'style' });
|
|
35
|
+
cssInterop(Text, { className: 'style' });
|
|
36
|
+
cssInterop(Pressable, { className: 'style' });
|
|
37
|
+
|
|
38
|
+
// Styled Root Component
|
|
39
|
+
const CalendarRoot = React.forwardRef<
|
|
40
|
+
React.ElementRef<typeof View>,
|
|
41
|
+
ICalendarProps & React.ComponentProps<typeof View> & { className?: string }
|
|
42
|
+
>(({ className, ...props }, ref) => {
|
|
43
|
+
return (
|
|
44
|
+
<View
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={calendarStyle({ class: className })}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Styled Header
|
|
53
|
+
const CalendarHeaderRoot = React.forwardRef<
|
|
54
|
+
React.ElementRef<typeof View>,
|
|
55
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
56
|
+
>(({ className, ...props }, ref) => {
|
|
57
|
+
return (
|
|
58
|
+
<View
|
|
59
|
+
ref={ref}
|
|
60
|
+
className={calendarHeaderStyle({ class: className })}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const CalendarHeaderPrevButtonRoot = React.forwardRef<
|
|
67
|
+
React.ElementRef<typeof Pressable>,
|
|
68
|
+
React.ComponentProps<typeof Pressable> & {
|
|
69
|
+
className?: string;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
}
|
|
72
|
+
>(({ className, disabled, ...props }, ref) => {
|
|
73
|
+
return (
|
|
74
|
+
<Pressable
|
|
75
|
+
ref={ref}
|
|
76
|
+
className={calendarHeaderButtonStyle({ class: className })}
|
|
77
|
+
data-disabled={disabled}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const CalendarHeaderNextButtonRoot = React.forwardRef<
|
|
84
|
+
React.ElementRef<typeof Pressable>,
|
|
85
|
+
React.ComponentProps<typeof Pressable> & {
|
|
86
|
+
className?: string;
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
}
|
|
89
|
+
>(({ className, disabled, ...props }, ref) => {
|
|
90
|
+
return (
|
|
91
|
+
<Pressable
|
|
92
|
+
ref={ref}
|
|
93
|
+
className={calendarHeaderButtonStyle({ class: className })}
|
|
94
|
+
data-disabled={disabled}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const CalendarHeaderTitleRoot = React.forwardRef<
|
|
101
|
+
React.ElementRef<typeof Text>,
|
|
102
|
+
React.ComponentProps<typeof Text> & { className?: string }
|
|
103
|
+
>(({ className, ...props }, ref) => {
|
|
104
|
+
return (
|
|
105
|
+
<Text
|
|
106
|
+
ref={ref}
|
|
107
|
+
className={calendarHeaderTitleStyle({ class: className })}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const MONTH_NAMES = [
|
|
114
|
+
'January', 'February', 'March', 'April', 'May', 'June',
|
|
115
|
+
'July', 'August', 'September', 'October', 'November', 'December',
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
type SelectRootProps = React.ComponentProps<typeof View> & {
|
|
119
|
+
className?: string;
|
|
120
|
+
items?: Array<{ label: string; value: number }>;
|
|
121
|
+
selectedValue?: number;
|
|
122
|
+
onValueChange?: (value: number) => void;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const CalendarHeaderMonthSelectRoot = React.forwardRef<
|
|
126
|
+
React.ElementRef<typeof View>,
|
|
127
|
+
SelectRootProps
|
|
128
|
+
>(({ className, items = [], selectedValue, onValueChange, ...props }, ref) => {
|
|
129
|
+
const label = selectedValue !== undefined ? MONTH_NAMES[selectedValue] : 'Month';
|
|
130
|
+
return (
|
|
131
|
+
<View ref={ref} className={calendarHeaderSelectStyle({ class: className })} {...props}>
|
|
132
|
+
<Menu
|
|
133
|
+
placement="bottom"
|
|
134
|
+
offset={4}
|
|
135
|
+
trigger={({ ...triggerProps }) => (
|
|
136
|
+
<Pressable {...triggerProps} className="px-2 py-1 rounded-md flex-row items-center">
|
|
137
|
+
<Text className="text-sm font-medium text-foreground">{label}</Text>
|
|
138
|
+
</Pressable>
|
|
139
|
+
)}
|
|
140
|
+
>
|
|
141
|
+
{items.map((item) => (
|
|
142
|
+
<MenuItem
|
|
143
|
+
key={item.value}
|
|
144
|
+
textValue={item.label}
|
|
145
|
+
onPress={() => onValueChange?.(item.value)}
|
|
146
|
+
>
|
|
147
|
+
<MenuItemLabel
|
|
148
|
+
className={item.value === selectedValue ? 'text-primary font-semibold' : ''}
|
|
149
|
+
>
|
|
150
|
+
{item.label}
|
|
151
|
+
</MenuItemLabel>
|
|
152
|
+
</MenuItem>
|
|
153
|
+
))}
|
|
154
|
+
</Menu>
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const CalendarHeaderYearSelectRoot = React.forwardRef<
|
|
160
|
+
React.ElementRef<typeof View>,
|
|
161
|
+
SelectRootProps
|
|
162
|
+
>(({ className, items = [], selectedValue, onValueChange, ...props }, ref) => {
|
|
163
|
+
const label = selectedValue !== undefined ? String(selectedValue) : 'Year';
|
|
164
|
+
return (
|
|
165
|
+
<View ref={ref} className={calendarHeaderSelectStyle({ class: className })} {...props}>
|
|
166
|
+
<Menu
|
|
167
|
+
placement="bottom"
|
|
168
|
+
offset={4}
|
|
169
|
+
trigger={({ ...triggerProps }) => (
|
|
170
|
+
<Pressable {...triggerProps} className="px-2 py-1 rounded-md flex-row items-center">
|
|
171
|
+
<Text className="text-sm font-medium text-foreground">{label}</Text>
|
|
172
|
+
</Pressable>
|
|
173
|
+
)}
|
|
174
|
+
>
|
|
175
|
+
{items.map((item) => (
|
|
176
|
+
<MenuItem
|
|
177
|
+
key={item.value}
|
|
178
|
+
textValue={item.label}
|
|
179
|
+
onPress={() => onValueChange?.(item.value)}
|
|
180
|
+
>
|
|
181
|
+
<MenuItemLabel
|
|
182
|
+
className={item.value === selectedValue ? 'text-primary font-semibold' : ''}
|
|
183
|
+
>
|
|
184
|
+
{item.label}
|
|
185
|
+
</MenuItemLabel>
|
|
186
|
+
</MenuItem>
|
|
187
|
+
))}
|
|
188
|
+
</Menu>
|
|
189
|
+
</View>
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Styled Week Days Header
|
|
194
|
+
const CalendarWeekDaysHeaderRoot = React.forwardRef<
|
|
195
|
+
React.ElementRef<typeof View>,
|
|
196
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
197
|
+
>(({ className, ...props }, ref) => {
|
|
198
|
+
return (
|
|
199
|
+
<View
|
|
200
|
+
ref={ref}
|
|
201
|
+
className={calendarWeekDaysHeaderStyle({ class: className })}
|
|
202
|
+
{...props}
|
|
203
|
+
/>
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const CalendarWeekDayRoot = React.forwardRef<
|
|
208
|
+
React.ElementRef<typeof View>,
|
|
209
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
210
|
+
>(({ className, children, ...props }, ref) => {
|
|
211
|
+
return (
|
|
212
|
+
<View
|
|
213
|
+
ref={ref}
|
|
214
|
+
className={calendarWeekDayStyle({ class: className })}
|
|
215
|
+
{...props}
|
|
216
|
+
>
|
|
217
|
+
{typeof children === 'string' ? (
|
|
218
|
+
<Text className={calendarWeekDayTextStyle({ class: '' })}>
|
|
219
|
+
{children}
|
|
220
|
+
</Text>
|
|
221
|
+
) : (
|
|
222
|
+
children
|
|
223
|
+
)}
|
|
224
|
+
</View>
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Styled Body & Grid
|
|
229
|
+
const CalendarBodyRoot = React.forwardRef<
|
|
230
|
+
React.ElementRef<typeof View>,
|
|
231
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
232
|
+
>(({ className, ...props }, ref) => {
|
|
233
|
+
return (
|
|
234
|
+
<View
|
|
235
|
+
ref={ref}
|
|
236
|
+
className={calendarBodyStyle({ class: className })}
|
|
237
|
+
{...props}
|
|
238
|
+
/>
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const CalendarGridRoot = React.forwardRef<
|
|
243
|
+
React.ElementRef<typeof View>,
|
|
244
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
245
|
+
>(({ className, ...props }, ref) => {
|
|
246
|
+
return (
|
|
247
|
+
<View
|
|
248
|
+
ref={ref}
|
|
249
|
+
className={calendarGridStyle({ class: className })}
|
|
250
|
+
{...props}
|
|
251
|
+
/>
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const CalendarWeekRoot = React.forwardRef<
|
|
256
|
+
React.ElementRef<typeof View>,
|
|
257
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
258
|
+
>(({ className, ...props }, ref) => {
|
|
259
|
+
return (
|
|
260
|
+
<View
|
|
261
|
+
ref={ref}
|
|
262
|
+
className={calendarWeekStyle({ class: className })}
|
|
263
|
+
{...props}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Styled Day
|
|
269
|
+
const CalendarDayRoot = React.forwardRef<
|
|
270
|
+
React.ElementRef<typeof Pressable>,
|
|
271
|
+
React.ComponentProps<typeof Pressable> & {
|
|
272
|
+
'className'?: string;
|
|
273
|
+
'data-state'?: string;
|
|
274
|
+
}
|
|
275
|
+
>(({ className, 'data-state': dataState, ...props }, ref) => {
|
|
276
|
+
return (
|
|
277
|
+
<Pressable
|
|
278
|
+
ref={ref}
|
|
279
|
+
className={calendarDayStyle({
|
|
280
|
+
state: dataState as any,
|
|
281
|
+
class: className,
|
|
282
|
+
})}
|
|
283
|
+
{...props}
|
|
284
|
+
/>
|
|
285
|
+
);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const CalendarDayTextRoot = React.forwardRef<
|
|
289
|
+
React.ElementRef<typeof Text>,
|
|
290
|
+
React.ComponentProps<typeof Text> & { className?: string; state?: any }
|
|
291
|
+
>(({ className, state, ...props }, ref) => {
|
|
292
|
+
return (
|
|
293
|
+
<Text
|
|
294
|
+
ref={ref}
|
|
295
|
+
className={calendarDayTextStyle({
|
|
296
|
+
state:
|
|
297
|
+
state?.isSelected && state?.isRangeStart
|
|
298
|
+
? 'range-start'
|
|
299
|
+
: state?.isSelected && state?.isRangeEnd
|
|
300
|
+
? 'range-end'
|
|
301
|
+
: state?.isInRange
|
|
302
|
+
? 'range-middle'
|
|
303
|
+
: state?.isSelected
|
|
304
|
+
? 'selected'
|
|
305
|
+
: state?.isToday
|
|
306
|
+
? 'today'
|
|
307
|
+
: state?.isDisabled
|
|
308
|
+
? 'disabled'
|
|
309
|
+
: state?.isOutsideMonth
|
|
310
|
+
? 'outside-month'
|
|
311
|
+
: 'default',
|
|
312
|
+
class: className,
|
|
313
|
+
})}
|
|
314
|
+
{...props}
|
|
315
|
+
/>
|
|
316
|
+
);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
const CalendarDayIndicatorRoot = React.forwardRef<
|
|
320
|
+
React.ElementRef<typeof View>,
|
|
321
|
+
React.ComponentProps<typeof View> & {
|
|
322
|
+
'className'?: string;
|
|
323
|
+
'data-type'?: string;
|
|
324
|
+
}
|
|
325
|
+
>(({ className, 'data-type': dataType, ...props }, ref) => {
|
|
326
|
+
return (
|
|
327
|
+
<View
|
|
328
|
+
ref={ref}
|
|
329
|
+
className={calendarDayIndicatorStyle({
|
|
330
|
+
type: dataType as any,
|
|
331
|
+
class: className,
|
|
332
|
+
})}
|
|
333
|
+
{...props}
|
|
334
|
+
/>
|
|
335
|
+
);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// Styled Week Number
|
|
339
|
+
const CalendarWeekNumberRoot = React.forwardRef<
|
|
340
|
+
React.ElementRef<typeof View>,
|
|
341
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
342
|
+
>(({ className, children, ...props }, ref) => {
|
|
343
|
+
return (
|
|
344
|
+
<View
|
|
345
|
+
ref={ref}
|
|
346
|
+
className={calendarWeekNumberStyle({ class: className })}
|
|
347
|
+
{...props}
|
|
348
|
+
>
|
|
349
|
+
{typeof children === 'string' || typeof children === 'number' ? (
|
|
350
|
+
<Text className={calendarWeekNumberTextStyle({ class: '' })}>
|
|
351
|
+
{children}
|
|
352
|
+
</Text>
|
|
353
|
+
) : (
|
|
354
|
+
children
|
|
355
|
+
)}
|
|
356
|
+
</View>
|
|
357
|
+
);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
// Styled Footer
|
|
361
|
+
const CalendarFooterRoot = React.forwardRef<
|
|
362
|
+
React.ElementRef<typeof View>,
|
|
363
|
+
React.ComponentProps<typeof View> & { className?: string }
|
|
364
|
+
>(({ className, ...props }, ref) => {
|
|
365
|
+
return (
|
|
366
|
+
<View
|
|
367
|
+
ref={ref}
|
|
368
|
+
className={calendarFooterStyle({ class: className })}
|
|
369
|
+
{...props}
|
|
370
|
+
/>
|
|
371
|
+
);
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
// Create Calendar using the factory
|
|
375
|
+
const UICalendar = createCalendar({
|
|
376
|
+
Root: CalendarRoot,
|
|
377
|
+
Header: CalendarHeaderRoot,
|
|
378
|
+
HeaderPrevButton: CalendarHeaderPrevButtonRoot,
|
|
379
|
+
HeaderNextButton: CalendarHeaderNextButtonRoot,
|
|
380
|
+
HeaderTitle: CalendarHeaderTitleRoot,
|
|
381
|
+
HeaderMonthSelect: CalendarHeaderMonthSelectRoot,
|
|
382
|
+
HeaderYearSelect: CalendarHeaderYearSelectRoot,
|
|
383
|
+
WeekDaysHeader: CalendarWeekDaysHeaderRoot,
|
|
384
|
+
WeekDay: CalendarWeekDayRoot,
|
|
385
|
+
Body: CalendarBodyRoot,
|
|
386
|
+
Grid: CalendarGridRoot,
|
|
387
|
+
Week: CalendarWeekRoot,
|
|
388
|
+
Day: CalendarDayRoot,
|
|
389
|
+
DayText: CalendarDayTextRoot,
|
|
390
|
+
DayIndicator: CalendarDayIndicatorRoot,
|
|
391
|
+
WeekNumber: CalendarWeekNumberRoot,
|
|
392
|
+
Footer: CalendarFooterRoot,
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// Mode-specific discriminated union props so onValueChange is correctly
|
|
396
|
+
// narrowed per mode (prevents TypeScript errors when passing setState).
|
|
397
|
+
type OmittedCalendarKeys = 'mode' | 'value' | 'defaultValue' | 'onValueChange';
|
|
398
|
+
|
|
399
|
+
type SingleModeProps = {
|
|
400
|
+
mode?: 'single';
|
|
401
|
+
value?: Date;
|
|
402
|
+
defaultValue?: Date;
|
|
403
|
+
onValueChange?: (value: Date) => void;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
type MultipleModeProps = {
|
|
407
|
+
mode: 'multiple';
|
|
408
|
+
value?: Date[];
|
|
409
|
+
defaultValue?: Date[];
|
|
410
|
+
onValueChange?: (value: Date[]) => void;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
type RangeModeProps = {
|
|
414
|
+
mode: 'range';
|
|
415
|
+
value?: { from: Date; to?: Date };
|
|
416
|
+
defaultValue?: { from: Date; to?: Date };
|
|
417
|
+
onValueChange?: (value: { from: Date; to?: Date }) => void;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
type CalendarProps = (SingleModeProps | MultipleModeProps | RangeModeProps) &
|
|
421
|
+
Omit<ICalendarProps, OmittedCalendarKeys> &
|
|
422
|
+
Omit<React.ComponentProps<typeof View>, OmittedCalendarKeys> & {
|
|
423
|
+
className?: string;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
const CalendarComponent = React.forwardRef<
|
|
427
|
+
React.ElementRef<typeof View>,
|
|
428
|
+
CalendarProps
|
|
429
|
+
>((props, ref) => {
|
|
430
|
+
return <UICalendar ref={ref} {...(props as any)} />;
|
|
431
|
+
});
|
|
432
|
+
CalendarComponent.displayName = 'Calendar';
|
|
433
|
+
|
|
434
|
+
// Export components
|
|
435
|
+
export const Calendar = CalendarComponent;
|
|
436
|
+
export const CalendarHeader = UICalendar.Header;
|
|
437
|
+
export const CalendarHeaderPrevButton = UICalendar.HeaderPrevButton;
|
|
438
|
+
export const CalendarHeaderNextButton = UICalendar.HeaderNextButton;
|
|
439
|
+
export const CalendarHeaderTitle = UICalendar.HeaderTitle;
|
|
440
|
+
export const CalendarHeaderMonthSelect = UICalendar.HeaderMonthSelect;
|
|
441
|
+
export const CalendarHeaderYearSelect = UICalendar.HeaderYearSelect;
|
|
442
|
+
export const CalendarWeekDaysHeader = UICalendar.WeekDaysHeader;
|
|
443
|
+
export const CalendarWeekDay = UICalendar.WeekDay;
|
|
444
|
+
export const CalendarBody = UICalendar.Body;
|
|
445
|
+
export const CalendarGrid = UICalendar.Grid;
|
|
446
|
+
export const CalendarWeek = UICalendar.Week;
|
|
447
|
+
export const CalendarDay = UICalendar.Day;
|
|
448
|
+
export const CalendarDayText = UICalendar.DayText;
|
|
449
|
+
export const CalendarDayIndicator = UICalendar.DayIndicator;
|
|
450
|
+
export const CalendarWeekNumber = UICalendar.WeekNumber;
|
|
451
|
+
export const CalendarFooter = UICalendar.Footer;
|
|
452
|
+
|
|
453
|
+
// Re-export types
|
|
454
|
+
export type {
|
|
455
|
+
ICalendarProps,
|
|
456
|
+
CalendarMode,
|
|
457
|
+
CalendarMarker,
|
|
458
|
+
CalendarMarkers,
|
|
459
|
+
DayState,
|
|
460
|
+
} from './creator';
|
|
461
|
+
|
|
462
|
+
export type { CalendarProps };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
2
|
+
|
|
3
|
+
// Main Calendar container
|
|
4
|
+
// Full width on native, max-width on web
|
|
5
|
+
export const calendarStyle = tva({
|
|
6
|
+
base: 'w-full web:w-fit bg-background border border-border rounded-lg p-4 gap-2',
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: 'p-2 gap-2',
|
|
10
|
+
md: 'p-2 gap-1',
|
|
11
|
+
lg: 'p-6 gap-6',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: 'md',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Header
|
|
20
|
+
export const calendarHeaderStyle = tva({
|
|
21
|
+
base: 'flex-row items-center justify-between mb-2',
|
|
22
|
+
variants: {},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const calendarHeaderButtonStyle = tva({
|
|
26
|
+
base: 'h-9 w-9 flex items-center justify-center rounded-md hover:bg-accent active:bg-accent/80 data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed',
|
|
27
|
+
variants: {},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const calendarHeaderTitleStyle = tva({
|
|
31
|
+
base: 'text-foreground text-base font-semibold',
|
|
32
|
+
variants: {},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Week Days Header
|
|
36
|
+
export const calendarWeekDaysHeaderStyle = tva({
|
|
37
|
+
base: 'flex-row gap-0 mb-2',
|
|
38
|
+
variants: {},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const calendarWeekDayStyle = tva({
|
|
42
|
+
base: 'flex-1 items-center justify-center min-w-[2.0rem] web:max-w-[2.5rem]',
|
|
43
|
+
variants: {},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const calendarWeekDayTextStyle = tva({
|
|
47
|
+
base: 'text-muted-foreground text-xs font-medium uppercase',
|
|
48
|
+
variants: {},
|
|
49
|
+
parentVariants: {},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Body & Grid
|
|
53
|
+
export const calendarBodyStyle = tva({
|
|
54
|
+
base: 'gap-0',
|
|
55
|
+
variants: {},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const calendarGridStyle = tva({
|
|
59
|
+
base: 'gap-0',
|
|
60
|
+
variants: {},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const calendarWeekStyle = tva({
|
|
64
|
+
base: 'flex-row gap-0',
|
|
65
|
+
variants: {},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Day
|
|
69
|
+
export const calendarDayStyle = tva({
|
|
70
|
+
base: 'flex-1 aspect-square items-center justify-center rounded-md web:max-w-[2.25rem] relative transition-colors',
|
|
71
|
+
variants: {
|
|
72
|
+
state: {
|
|
73
|
+
'default': 'hover:bg-accent active:bg-accent/80',
|
|
74
|
+
'selected': 'bg-primary hover:bg-primary/90 active:bg-primary/80',
|
|
75
|
+
'today': 'bg-accent',
|
|
76
|
+
'disabled': 'opacity-40 cursor-not-allowed',
|
|
77
|
+
'outside-month': 'opacity-30',
|
|
78
|
+
'range-start': 'bg-primary rounded-r-md',
|
|
79
|
+
'range-end': 'bg-primary rounded-l-md',
|
|
80
|
+
'range-middle': 'bg-primary/20 rounded-none',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const calendarDayTextStyle = tva({
|
|
86
|
+
base: 'text-foreground text-sm font-normal z-10',
|
|
87
|
+
variants: {
|
|
88
|
+
state: {
|
|
89
|
+
'default': 'text-foreground',
|
|
90
|
+
'selected': 'text-primary-foreground ',
|
|
91
|
+
'today': 'text-accent-foreground',
|
|
92
|
+
'disabled': 'text-muted-foreground',
|
|
93
|
+
'outside-month': 'text-muted-foreground',
|
|
94
|
+
'range-start': 'text-primary-foreground font-semibold',
|
|
95
|
+
'range-end': 'text-primary-foreground font-semibold',
|
|
96
|
+
'range-middle': 'text-foreground',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Day Indicator (markers/dots)
|
|
102
|
+
export const calendarDayIndicatorStyle = tva({
|
|
103
|
+
base: 'absolute bottom-1 flex-row gap-0.5 z-0',
|
|
104
|
+
variants: {
|
|
105
|
+
type: {
|
|
106
|
+
'dot': 'flex-row gap-0.5',
|
|
107
|
+
'multi-dot': 'flex-row gap-0.5',
|
|
108
|
+
'period': 'absolute inset-0 rounded-md opacity-20',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export const calendarDotStyle = tva({
|
|
114
|
+
base: 'w-1 h-1 rounded-full',
|
|
115
|
+
variants: {},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Week Number
|
|
119
|
+
export const calendarWeekNumberStyle = tva({
|
|
120
|
+
base: 'w-8 items-center justify-center mr-1',
|
|
121
|
+
variants: {},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export const calendarWeekNumberTextStyle = tva({
|
|
125
|
+
base: 'text-muted-foreground text-xs font-normal',
|
|
126
|
+
variants: {},
|
|
127
|
+
parentVariants: {},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Footer
|
|
131
|
+
export const calendarFooterStyle = tva({
|
|
132
|
+
base: 'mt-4 pt-4 border-t border-border',
|
|
133
|
+
variants: {},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Month/Year Select
|
|
137
|
+
export const calendarHeaderSelectStyle = tva({
|
|
138
|
+
base: 'bg-transparent border border-border rounded-md px-2 py-1 text-sm text-foreground',
|
|
139
|
+
variants: {},
|
|
140
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { cardStyle } from './styles';
|
|
5
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
6
|
+
|
|
7
|
+
type ICardProps = React.ComponentPropsWithoutRef<typeof View> &
|
|
8
|
+
VariantProps<typeof cardStyle> & {
|
|
9
|
+
className?: string;
|
|
10
|
+
size?: 'default' | 'sm';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Card = React.forwardRef<React.ComponentRef<typeof View>, ICardProps>(
|
|
14
|
+
function Card({ className, size = 'default', ...props }, ref) {
|
|
15
|
+
return (
|
|
16
|
+
<View className={cardStyle({ size, class: className })} {...props} ref={ref} />
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
Card.displayName = 'Card';
|
|
22
|
+
|
|
23
|
+
export { Card };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cardStyle } from './styles';
|
|
3
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
4
|
+
|
|
5
|
+
type ICardProps = React.ComponentPropsWithoutRef<'div'> &
|
|
6
|
+
VariantProps<typeof cardStyle> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
size?: 'default' | 'sm';
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const Card = React.forwardRef<HTMLDivElement, ICardProps>(function Card(
|
|
12
|
+
{ className, size = 'default', ...props },
|
|
13
|
+
ref
|
|
14
|
+
) {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={cardStyle({ size, class: className })}
|
|
18
|
+
{...props}
|
|
19
|
+
ref={ref}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
Card.displayName = 'Card';
|
|
25
|
+
|
|
26
|
+
export { Card };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
2
|
+
import { isWeb } from '@gluestack-ui/utils/nativewind-utils';
|
|
3
|
+
const baseStyle = isWeb ? 'flex flex-col relative z-0' : '';
|
|
4
|
+
|
|
5
|
+
export const cardStyle = tva({
|
|
6
|
+
base: `${baseStyle} flex-col bg-card border border-border rounded-xl shadow-sm`,
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
default: 'p-4 gap-6',
|
|
10
|
+
sm: 'p-3 gap-3',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: 'default',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { View, ViewProps } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { centerStyle } from './styles';
|
|
4
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
5
|
+
|
|
6
|
+
type ICenterProps = ViewProps & VariantProps<typeof centerStyle>;
|
|
7
|
+
|
|
8
|
+
const Center = React.forwardRef<React.ComponentRef<typeof View>, ICenterProps>(
|
|
9
|
+
function Center({ className, ...props }, ref) {
|
|
10
|
+
return (
|
|
11
|
+
<View
|
|
12
|
+
className={centerStyle({ class: className })}
|
|
13
|
+
{...props}
|
|
14
|
+
ref={ref}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
Center.displayName = 'Center';
|
|
21
|
+
|
|
22
|
+
export { Center };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { centerStyle } from './styles';
|
|
3
|
+
|
|
4
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
5
|
+
|
|
6
|
+
type ICenterProps = React.ComponentPropsWithoutRef<'div'> &
|
|
7
|
+
VariantProps<typeof centerStyle>;
|
|
8
|
+
|
|
9
|
+
const Center = React.forwardRef<HTMLDivElement, ICenterProps>(function Center(
|
|
10
|
+
{ className, ...props },
|
|
11
|
+
ref
|
|
12
|
+
) {
|
|
13
|
+
return (
|
|
14
|
+
<div className={centerStyle({ class: className })} {...props} ref={ref} />
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
Center.displayName = 'Center';
|
|
19
|
+
|
|
20
|
+
export { Center };
|