@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,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createPressable } from '@gluestack-ui/core/pressable/creator';
|
|
4
|
+
import { Pressable as RNPressable } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
7
|
+
import { withStyleContext } from '@gluestack-ui/utils/nativewind-utils';
|
|
8
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
9
|
+
|
|
10
|
+
const UIPressable = createPressable({
|
|
11
|
+
Root: withStyleContext(RNPressable),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const pressableStyle = tva({
|
|
15
|
+
base: 'data-[focus-visible=true]:outline-none data-[focus-visible=true]:ring-indicator-info data-[focus-visible=true]:ring-2 data-[disabled=true]:opacity-40',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
type IPressableProps = Omit<
|
|
19
|
+
React.ComponentProps<typeof UIPressable>,
|
|
20
|
+
'context'
|
|
21
|
+
> &
|
|
22
|
+
VariantProps<typeof pressableStyle>;
|
|
23
|
+
const Pressable = React.forwardRef<
|
|
24
|
+
React.ComponentRef<typeof UIPressable>,
|
|
25
|
+
IPressableProps
|
|
26
|
+
>(function Pressable({ className, ...props }, ref) {
|
|
27
|
+
return (
|
|
28
|
+
<UIPressable
|
|
29
|
+
{...props}
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={pressableStyle({
|
|
32
|
+
class: className,
|
|
33
|
+
})}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
Pressable.displayName = 'Pressable';
|
|
39
|
+
export { Pressable };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createProgress } from '@gluestack-ui/core/progress/creator';
|
|
4
|
+
import { View } from 'react-native';
|
|
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
|
+
const SCOPE = 'PROGRESS';
|
|
14
|
+
export const UIProgress = createProgress({
|
|
15
|
+
Root: withStyleContext(View, SCOPE),
|
|
16
|
+
FilledTrack: View,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
cssInterop(UIProgress, { className: 'style' });
|
|
20
|
+
cssInterop(UIProgress.FilledTrack, { className: 'style' });
|
|
21
|
+
|
|
22
|
+
const progressStyle = tva({
|
|
23
|
+
base: 'bg-primary/20 relative h-2 w-full overflow-hidden rounded-full',
|
|
24
|
+
variants: {
|
|
25
|
+
orientation: {
|
|
26
|
+
horizontal: 'w-full h-2',
|
|
27
|
+
vertical: 'h-full w-2 justify-end',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const progressFilledTrackStyle = tva({
|
|
33
|
+
base: 'bg-primary transition-all',
|
|
34
|
+
variants: {
|
|
35
|
+
orientation: {
|
|
36
|
+
horizontal: 'h-full',
|
|
37
|
+
vertical: 'w-full',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
type IProgressProps = VariantProps<typeof progressStyle> &
|
|
43
|
+
React.ComponentProps<typeof UIProgress>;
|
|
44
|
+
type IProgressFilledTrackProps = VariantProps<typeof progressFilledTrackStyle> &
|
|
45
|
+
React.ComponentProps<typeof UIProgress.FilledTrack>;
|
|
46
|
+
|
|
47
|
+
const Progress = React.forwardRef<
|
|
48
|
+
React.ComponentRef<typeof UIProgress>,
|
|
49
|
+
IProgressProps
|
|
50
|
+
>(function Progress(
|
|
51
|
+
{ className, orientation = 'horizontal', ...props },
|
|
52
|
+
ref
|
|
53
|
+
) {
|
|
54
|
+
return (
|
|
55
|
+
<UIProgress
|
|
56
|
+
ref={ref}
|
|
57
|
+
{...props}
|
|
58
|
+
className={progressStyle({ orientation, class: className })}
|
|
59
|
+
context={{ orientation }}
|
|
60
|
+
orientation={orientation}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const ProgressFilledTrack = React.forwardRef<
|
|
66
|
+
React.ComponentRef<typeof UIProgress.FilledTrack>,
|
|
67
|
+
IProgressFilledTrackProps
|
|
68
|
+
>(function ProgressFilledTrack({ className, ...props }, ref) {
|
|
69
|
+
const { orientation: parentOrientation } = useStyleContext(SCOPE);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<UIProgress.FilledTrack
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={progressFilledTrackStyle({
|
|
75
|
+
orientation: parentOrientation,
|
|
76
|
+
class: className,
|
|
77
|
+
})}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export { Progress, ProgressFilledTrack };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createRadio } from '@gluestack-ui/core/radio/creator';
|
|
4
|
+
import { Pressable, View, Platform, Text } from 'react-native';
|
|
5
|
+
import { tva, useStyleContext } from '@gluestack-ui/utils/nativewind-utils';
|
|
6
|
+
import { withStyleContext } from '@gluestack-ui/utils/nativewind-utils';
|
|
7
|
+
import { cssInterop } from 'nativewind';
|
|
8
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
9
|
+
import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
10
|
+
|
|
11
|
+
const SCOPE = 'Radio';
|
|
12
|
+
|
|
13
|
+
const UIRadio = createRadio({
|
|
14
|
+
Root: (Platform.OS === 'web'
|
|
15
|
+
? withStyleContext(View, SCOPE)
|
|
16
|
+
: withStyleContext(Pressable, SCOPE)) as ReturnType<
|
|
17
|
+
typeof withStyleContext<typeof Pressable>
|
|
18
|
+
>,
|
|
19
|
+
Group: View,
|
|
20
|
+
Icon: UIIcon,
|
|
21
|
+
Indicator: View,
|
|
22
|
+
Label: Text,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
cssInterop(UIIcon, {
|
|
26
|
+
className: {
|
|
27
|
+
target: 'style',
|
|
28
|
+
nativeStyleToProp: {
|
|
29
|
+
height: true,
|
|
30
|
+
width: true,
|
|
31
|
+
fill: true,
|
|
32
|
+
color: 'classNameColor',
|
|
33
|
+
stroke: true,
|
|
34
|
+
} as any,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const radioStyle = tva({
|
|
39
|
+
base: 'group/radio flex-row justify-start items-center gap-2 web:cursor-pointer data-[disabled=true]:web:cursor-not-allowed data-[disabled=true]:opacity-50',
|
|
40
|
+
variants: {
|
|
41
|
+
size: {
|
|
42
|
+
sm: 'gap-1.5',
|
|
43
|
+
md: 'gap-2',
|
|
44
|
+
lg: 'gap-2',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const radioGroupStyle = tva({
|
|
50
|
+
base: 'gap-3',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const radioIconStyle = tva({
|
|
54
|
+
base: 'rounded-full absolute stroke-none top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 fill-primary h-2 w-2',
|
|
55
|
+
parentVariants: {
|
|
56
|
+
size: {
|
|
57
|
+
sm: 'h-[9px] w-[9px]',
|
|
58
|
+
md: 'h-3 w-3',
|
|
59
|
+
lg: 'h-4 w-4',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const radioIndicatorStyle = tva({
|
|
65
|
+
base: 'relative justify-center items-center aspect-square h-4 w-4 shrink-0 rounded-full border border-border dark:bg-input/30 shadow-xs web:outline-none web:data-[focus-visible=true]:ring-[3px] web:data-[focus-visible=true]:ring-ring/50 web:data-[focus-visible=true]:border-ring data-[invalid=true]:ring-destructive/20 data-[invalid=true]:border-destructive data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
|
|
66
|
+
parentVariants: {
|
|
67
|
+
size: {
|
|
68
|
+
sm: 'h-4 w-4',
|
|
69
|
+
md: 'h-5 w-5',
|
|
70
|
+
lg: 'h-6 w-6',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const radioLabelStyle = tva({
|
|
76
|
+
base: 'text-foreground text-sm font-medium web:select-none web:cursor-pointer data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 font-body',
|
|
77
|
+
parentVariants: {
|
|
78
|
+
size: {
|
|
79
|
+
'2xs': 'text-2xs',
|
|
80
|
+
'xs': 'text-xs',
|
|
81
|
+
'sm': 'text-sm',
|
|
82
|
+
'md': 'text-base',
|
|
83
|
+
'lg': 'text-lg',
|
|
84
|
+
'xl': 'text-xl',
|
|
85
|
+
'2xl': 'text-2xl',
|
|
86
|
+
'3xl': 'text-3xl',
|
|
87
|
+
'4xl': 'text-4xl',
|
|
88
|
+
'5xl': 'text-5xl',
|
|
89
|
+
'6xl': 'text-6xl',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
type IRadioProps = Omit<React.ComponentProps<typeof UIRadio>, 'context'> &
|
|
95
|
+
VariantProps<typeof radioStyle>;
|
|
96
|
+
const Radio = React.forwardRef<React.ComponentRef<typeof UIRadio>, IRadioProps>(
|
|
97
|
+
function Radio({ className, size = 'md', ...props }, ref) {
|
|
98
|
+
return (
|
|
99
|
+
<UIRadio
|
|
100
|
+
className={radioStyle({ class: className, size })}
|
|
101
|
+
{...props}
|
|
102
|
+
ref={ref}
|
|
103
|
+
context={{ size }}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
type IRadioGroupProps = React.ComponentProps<typeof UIRadio.Group> &
|
|
110
|
+
VariantProps<typeof radioGroupStyle>;
|
|
111
|
+
const RadioGroup = React.forwardRef<
|
|
112
|
+
React.ComponentRef<typeof UIRadio.Group>,
|
|
113
|
+
IRadioGroupProps
|
|
114
|
+
>(function RadioGroup({ className, ...props }, ref) {
|
|
115
|
+
return (
|
|
116
|
+
<UIRadio.Group
|
|
117
|
+
className={radioGroupStyle({ class: className })}
|
|
118
|
+
{...props}
|
|
119
|
+
ref={ref}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
type IRadioIndicatorProps = React.ComponentProps<typeof UIRadio.Indicator> &
|
|
125
|
+
VariantProps<typeof radioIndicatorStyle>;
|
|
126
|
+
const RadioIndicator = React.forwardRef<
|
|
127
|
+
React.ComponentRef<typeof UIRadio.Indicator>,
|
|
128
|
+
IRadioIndicatorProps
|
|
129
|
+
>(function RadioIndicator({ className, ...props }, ref) {
|
|
130
|
+
const { size } = useStyleContext(SCOPE);
|
|
131
|
+
return (
|
|
132
|
+
<UIRadio.Indicator
|
|
133
|
+
className={radioIndicatorStyle({
|
|
134
|
+
parentVariants: { size },
|
|
135
|
+
class: className,
|
|
136
|
+
})}
|
|
137
|
+
ref={ref}
|
|
138
|
+
{...props}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
type IRadioLabelProps = React.ComponentProps<typeof UIRadio.Label> &
|
|
144
|
+
VariantProps<typeof radioIndicatorStyle>;
|
|
145
|
+
const RadioLabel = React.forwardRef<
|
|
146
|
+
React.ComponentRef<typeof UIRadio.Label>,
|
|
147
|
+
IRadioLabelProps
|
|
148
|
+
>(function RadioLabel({ className, ...props }, ref) {
|
|
149
|
+
const { size } = useStyleContext(SCOPE);
|
|
150
|
+
return (
|
|
151
|
+
<UIRadio.Label
|
|
152
|
+
className={radioLabelStyle({
|
|
153
|
+
parentVariants: { size },
|
|
154
|
+
class: className,
|
|
155
|
+
})}
|
|
156
|
+
ref={ref}
|
|
157
|
+
{...props}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
type IRadioIconProps = React.ComponentProps<typeof UIRadio.Icon> &
|
|
163
|
+
VariantProps<typeof radioIconStyle> & {
|
|
164
|
+
height?: number;
|
|
165
|
+
width?: number;
|
|
166
|
+
};
|
|
167
|
+
const RadioIcon = React.forwardRef<
|
|
168
|
+
React.ComponentRef<typeof UIRadio.Icon>,
|
|
169
|
+
IRadioIconProps
|
|
170
|
+
>(function RadioIcon({ className, size, ...props }, ref) {
|
|
171
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
172
|
+
|
|
173
|
+
if (typeof size === 'number') {
|
|
174
|
+
return (
|
|
175
|
+
<UIRadio.Icon
|
|
176
|
+
ref={ref}
|
|
177
|
+
{...props}
|
|
178
|
+
className={radioIconStyle({ class: className })}
|
|
179
|
+
size={size}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
} else if (
|
|
183
|
+
(props.height !== undefined || props.width !== undefined) &&
|
|
184
|
+
size === undefined
|
|
185
|
+
) {
|
|
186
|
+
return (
|
|
187
|
+
<UIRadio.Icon
|
|
188
|
+
ref={ref}
|
|
189
|
+
{...props}
|
|
190
|
+
className={radioIconStyle({ class: className })}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<UIRadio.Icon
|
|
197
|
+
{...props}
|
|
198
|
+
className={radioIconStyle({
|
|
199
|
+
parentVariants: {
|
|
200
|
+
size: parentSize,
|
|
201
|
+
},
|
|
202
|
+
size,
|
|
203
|
+
class: className,
|
|
204
|
+
})}
|
|
205
|
+
ref={ref}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
Radio.displayName = 'Radio';
|
|
212
|
+
RadioGroup.displayName = 'RadioGroup';
|
|
213
|
+
RadioIndicator.displayName = 'RadioIndicator';
|
|
214
|
+
RadioLabel.displayName = 'RadioLabel';
|
|
215
|
+
RadioIcon.displayName = 'RadioIcon';
|
|
216
|
+
|
|
217
|
+
export { Radio, RadioGroup, RadioIndicator, RadioLabel, RadioIcon };
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
5
|
+
import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
6
|
+
import {
|
|
7
|
+
withStyleContext,
|
|
8
|
+
useStyleContext,
|
|
9
|
+
} from '@gluestack-ui/utils/nativewind-utils';
|
|
10
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
11
|
+
import { createSelect } from '@gluestack-ui/core/select/creator';
|
|
12
|
+
import { cssInterop } from 'nativewind';
|
|
13
|
+
import {
|
|
14
|
+
Actionsheet,
|
|
15
|
+
ActionsheetContent,
|
|
16
|
+
ActionsheetItem,
|
|
17
|
+
ActionsheetItemText,
|
|
18
|
+
ActionsheetDragIndicator,
|
|
19
|
+
ActionsheetDragIndicatorWrapper,
|
|
20
|
+
ActionsheetBackdrop,
|
|
21
|
+
ActionsheetScrollView,
|
|
22
|
+
ActionsheetVirtualizedList,
|
|
23
|
+
ActionsheetFlatList,
|
|
24
|
+
ActionsheetSectionList,
|
|
25
|
+
ActionsheetSectionHeaderText,
|
|
26
|
+
} from './select-actionsheet';
|
|
27
|
+
import { Pressable, View, TextInput } from 'react-native';
|
|
28
|
+
|
|
29
|
+
const SelectTriggerWrapper = React.forwardRef<
|
|
30
|
+
React.ComponentRef<typeof Pressable>,
|
|
31
|
+
React.ComponentProps<typeof Pressable>
|
|
32
|
+
>(function SelectTriggerWrapper({ ...props }, ref) {
|
|
33
|
+
return <Pressable {...props} ref={ref} />;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const selectIconStyle = tva({
|
|
37
|
+
base: 'text-foreground/50 fill-none',
|
|
38
|
+
parentVariants: {
|
|
39
|
+
size: {
|
|
40
|
+
'2xs': 'h-3 w-3',
|
|
41
|
+
'xs': 'h-3.5 w-3.5',
|
|
42
|
+
'sm': 'h-4 w-4',
|
|
43
|
+
'md': 'h-[18px] w-[18px]',
|
|
44
|
+
'lg': 'h-5 w-5',
|
|
45
|
+
'xl': 'h-6 w-6',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const selectStyle = tva({
|
|
51
|
+
base: '',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const selectTriggerStyle = tva({
|
|
55
|
+
base: 'border border-border rounded flex-row items-center overflow-hidden data-[hover=true]:border-primary/80 data-[focus=true]:border-primary/80 data-[disabled=true]:opacity-40 data-[disabled=true]:data-[hover=true]:border-border/80',
|
|
56
|
+
variants: {
|
|
57
|
+
size: {
|
|
58
|
+
xl: 'h-12',
|
|
59
|
+
lg: 'h-11',
|
|
60
|
+
md: 'h-10',
|
|
61
|
+
sm: 'h-9',
|
|
62
|
+
},
|
|
63
|
+
variant: {
|
|
64
|
+
underlined:
|
|
65
|
+
'border-0 border-b rounded-none data-[hover=true]:border-primary/80 data-[focus=true]:border-primary/80 data-[focus=true]:web:shadow-[inset_0_-1px_0_0] data-[focus=true]:web:shadow-primary/80 data-[invalid=true]:border-destructive data-[invalid=true]:web:shadow-destructive',
|
|
66
|
+
outline:
|
|
67
|
+
'data-[focus=true]:border-primary/80 data-[focus=true]:web:shadow-[inset_0_0_0_1px] data-[focus=true]:data-[hover=true]:web:shadow-primary/80 data-[invalid=true]:web:shadow-[inset_0_0_0_1px] data-[invalid=true]:border-destructive data-[invalid=true]:web:shadow-destructive data-[invalid=true]:data-[hover=true]:border-destructive',
|
|
68
|
+
rounded:
|
|
69
|
+
'rounded-full data-[focus=true]:border-primary/80 data-[focus=true]:web:shadow-[inset_0_0_0_1px] data-[focus=true]:web:shadow-primary/80 data-[invalid=true]:border-destructive data-[invalid=true]:web:shadow-destructive',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const selectInputStyle = tva({
|
|
75
|
+
base: 'px-3 placeholder:text-foreground/50 web:w-full h-full text-foreground/90 pointer-events-none web:outline-none ios:leading-[0px] py-0',
|
|
76
|
+
parentVariants: {
|
|
77
|
+
size: {
|
|
78
|
+
xl: 'text-xl',
|
|
79
|
+
lg: 'text-lg',
|
|
80
|
+
md: 'text-base',
|
|
81
|
+
sm: 'text-sm',
|
|
82
|
+
},
|
|
83
|
+
variant: {
|
|
84
|
+
underlined: 'px-0',
|
|
85
|
+
outline: '',
|
|
86
|
+
rounded: 'px-4',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const UISelect = createSelect(
|
|
92
|
+
{
|
|
93
|
+
Root: View,
|
|
94
|
+
Trigger: withStyleContext(SelectTriggerWrapper),
|
|
95
|
+
Input: TextInput,
|
|
96
|
+
Icon: UIIcon,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
Portal: Actionsheet,
|
|
100
|
+
Backdrop: ActionsheetBackdrop,
|
|
101
|
+
Content: ActionsheetContent,
|
|
102
|
+
DragIndicator: ActionsheetDragIndicator,
|
|
103
|
+
DragIndicatorWrapper: ActionsheetDragIndicatorWrapper,
|
|
104
|
+
Item: ActionsheetItem,
|
|
105
|
+
ItemText: ActionsheetItemText,
|
|
106
|
+
ScrollView: ActionsheetScrollView,
|
|
107
|
+
VirtualizedList: ActionsheetVirtualizedList,
|
|
108
|
+
FlatList: ActionsheetFlatList,
|
|
109
|
+
SectionList: ActionsheetSectionList,
|
|
110
|
+
SectionHeaderText: ActionsheetSectionHeaderText,
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
cssInterop(UISelect, { className: 'style' });
|
|
115
|
+
cssInterop(UISelect.Input, {
|
|
116
|
+
className: { target: 'style', nativeStyleToProp: { textAlign: true } },
|
|
117
|
+
});
|
|
118
|
+
cssInterop(SelectTriggerWrapper, { className: 'style' });
|
|
119
|
+
|
|
120
|
+
cssInterop(UIIcon, {
|
|
121
|
+
className: {
|
|
122
|
+
target: 'style',
|
|
123
|
+
nativeStyleToProp: {
|
|
124
|
+
height: true,
|
|
125
|
+
width: true,
|
|
126
|
+
fill: true,
|
|
127
|
+
color: 'classNameColor',
|
|
128
|
+
stroke: true,
|
|
129
|
+
} as any,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
type ISelectProps = VariantProps<typeof selectStyle> &
|
|
134
|
+
React.ComponentProps<typeof UISelect> & { className?: string };
|
|
135
|
+
|
|
136
|
+
const Select = React.forwardRef<
|
|
137
|
+
React.ComponentRef<typeof UISelect>,
|
|
138
|
+
ISelectProps
|
|
139
|
+
>(function Select({ className, ...props }, ref) {
|
|
140
|
+
return (
|
|
141
|
+
<UISelect
|
|
142
|
+
className={selectStyle({
|
|
143
|
+
class: className,
|
|
144
|
+
})}
|
|
145
|
+
ref={ref}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
type ISelectTriggerProps = VariantProps<typeof selectTriggerStyle> &
|
|
152
|
+
React.ComponentProps<typeof UISelect.Trigger> & { className?: string };
|
|
153
|
+
|
|
154
|
+
const SelectTrigger = React.forwardRef<
|
|
155
|
+
React.ComponentRef<typeof UISelect.Trigger>,
|
|
156
|
+
ISelectTriggerProps
|
|
157
|
+
>(function SelectTrigger(
|
|
158
|
+
{ className, size = 'md', variant = 'outline', ...props },
|
|
159
|
+
ref
|
|
160
|
+
) {
|
|
161
|
+
return (
|
|
162
|
+
<UISelect.Trigger
|
|
163
|
+
className={selectTriggerStyle({
|
|
164
|
+
class: className,
|
|
165
|
+
size,
|
|
166
|
+
variant,
|
|
167
|
+
})}
|
|
168
|
+
ref={ref}
|
|
169
|
+
context={{ size, variant }}
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
type ISelectInputProps = VariantProps<typeof selectInputStyle> &
|
|
176
|
+
React.ComponentProps<typeof UISelect.Input> & { className?: string };
|
|
177
|
+
|
|
178
|
+
const SelectInput = React.forwardRef<
|
|
179
|
+
React.ComponentRef<typeof UISelect.Input>,
|
|
180
|
+
ISelectInputProps
|
|
181
|
+
>(function SelectInput({ className, ...props }, ref) {
|
|
182
|
+
const { size: parentSize, variant: parentVariant } = useStyleContext();
|
|
183
|
+
return (
|
|
184
|
+
<UISelect.Input
|
|
185
|
+
className={selectInputStyle({
|
|
186
|
+
class: className,
|
|
187
|
+
parentVariants: {
|
|
188
|
+
size: parentSize,
|
|
189
|
+
variant: parentVariant,
|
|
190
|
+
},
|
|
191
|
+
})}
|
|
192
|
+
ref={ref}
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
type ISelectIcon = VariantProps<typeof selectIconStyle> &
|
|
199
|
+
React.ComponentProps<typeof UISelect.Icon> & { className?: string };
|
|
200
|
+
|
|
201
|
+
const SelectIcon = React.forwardRef<
|
|
202
|
+
React.ComponentRef<typeof UISelect.Icon>,
|
|
203
|
+
ISelectIcon
|
|
204
|
+
>(function SelectIcon({ className, size, ...props }, ref) {
|
|
205
|
+
const { size: parentSize } = useStyleContext();
|
|
206
|
+
if (typeof size === 'number') {
|
|
207
|
+
return (
|
|
208
|
+
<UISelect.Icon
|
|
209
|
+
ref={ref}
|
|
210
|
+
{...props}
|
|
211
|
+
className={selectIconStyle({ class: className })}
|
|
212
|
+
size={size}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
} else if (
|
|
216
|
+
//@ts-expect-error : web only
|
|
217
|
+
(props?.height !== undefined || props?.width !== undefined) &&
|
|
218
|
+
size === undefined
|
|
219
|
+
) {
|
|
220
|
+
return (
|
|
221
|
+
<UISelect.Icon
|
|
222
|
+
ref={ref}
|
|
223
|
+
{...props}
|
|
224
|
+
className={selectIconStyle({ class: className })}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
return (
|
|
229
|
+
<UISelect.Icon
|
|
230
|
+
className={selectIconStyle({
|
|
231
|
+
class: className,
|
|
232
|
+
size,
|
|
233
|
+
parentVariants: {
|
|
234
|
+
size: parentSize,
|
|
235
|
+
},
|
|
236
|
+
})}
|
|
237
|
+
ref={ref}
|
|
238
|
+
{...props}
|
|
239
|
+
/>
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
Select.displayName = 'Select';
|
|
244
|
+
SelectTrigger.displayName = 'SelectTrigger';
|
|
245
|
+
SelectInput.displayName = 'SelectInput';
|
|
246
|
+
SelectIcon.displayName = 'SelectIcon';
|
|
247
|
+
|
|
248
|
+
// Actionsheet Components
|
|
249
|
+
const SelectPortal = UISelect.Portal;
|
|
250
|
+
const SelectBackdrop = UISelect.Backdrop;
|
|
251
|
+
const SelectContent = UISelect.Content;
|
|
252
|
+
const SelectDragIndicator = UISelect.DragIndicator;
|
|
253
|
+
const SelectDragIndicatorWrapper = UISelect.DragIndicatorWrapper;
|
|
254
|
+
const SelectItem = UISelect.Item;
|
|
255
|
+
const SelectScrollView = UISelect.ScrollView;
|
|
256
|
+
const SelectVirtualizedList = UISelect.VirtualizedList;
|
|
257
|
+
const SelectFlatList = UISelect.FlatList;
|
|
258
|
+
const SelectSectionList = UISelect.SectionList;
|
|
259
|
+
const SelectSectionHeaderText = UISelect.SectionHeaderText;
|
|
260
|
+
|
|
261
|
+
export {
|
|
262
|
+
Select,
|
|
263
|
+
SelectTrigger,
|
|
264
|
+
SelectInput,
|
|
265
|
+
SelectIcon,
|
|
266
|
+
SelectPortal,
|
|
267
|
+
SelectBackdrop,
|
|
268
|
+
SelectContent,
|
|
269
|
+
SelectDragIndicator,
|
|
270
|
+
SelectDragIndicatorWrapper,
|
|
271
|
+
SelectItem,
|
|
272
|
+
SelectScrollView,
|
|
273
|
+
SelectVirtualizedList,
|
|
274
|
+
SelectFlatList,
|
|
275
|
+
SelectSectionList,
|
|
276
|
+
SelectSectionHeaderText,
|
|
277
|
+
};
|