@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,8 @@
|
|
|
1
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
2
|
+
import { isWeb } from '@gluestack-ui/utils/nativewind-utils';
|
|
3
|
+
|
|
4
|
+
const baseStyle = isWeb ? 'flex flex-col relative z-0' : '';
|
|
5
|
+
|
|
6
|
+
export const centerStyle = tva({
|
|
7
|
+
base: `justify-center items-center ${baseStyle}`,
|
|
8
|
+
});
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createCheckbox } from '@gluestack-ui/core/checkbox/creator';
|
|
4
|
+
import { View, Pressable, Text, Platform } from 'react-native';
|
|
5
|
+
import type { TextProps, ViewProps } from 'react-native';
|
|
6
|
+
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
7
|
+
import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
8
|
+
import { withStyleContext } from '@gluestack-ui/utils/nativewind-utils';
|
|
9
|
+
import { cssInterop } from 'nativewind';
|
|
10
|
+
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
11
|
+
|
|
12
|
+
const IndicatorWrapper = React.forwardRef<
|
|
13
|
+
React.ComponentRef<typeof View>,
|
|
14
|
+
ViewProps
|
|
15
|
+
>(function IndicatorWrapper({ ...props }, ref) {
|
|
16
|
+
return <View {...props} ref={ref} />;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const LabelWrapper = React.forwardRef<
|
|
20
|
+
React.ComponentRef<typeof Text>,
|
|
21
|
+
TextProps
|
|
22
|
+
>(function LabelWrapper({ ...props }, ref) {
|
|
23
|
+
return <Text {...props} ref={ref} />;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const IconWrapper = React.forwardRef<
|
|
27
|
+
React.ComponentRef<typeof UIIcon>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof UIIcon>
|
|
29
|
+
>(function IconWrapper({ ...props }, ref) {
|
|
30
|
+
return <UIIcon {...props} ref={ref as any} />;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const SCOPE = 'CHECKBOX';
|
|
34
|
+
const UICheckbox = createCheckbox({
|
|
35
|
+
// @ts-expect-error : internal implementation for r-19/react-native-web
|
|
36
|
+
Root:
|
|
37
|
+
Platform.OS === 'web'
|
|
38
|
+
? withStyleContext(View, SCOPE)
|
|
39
|
+
: withStyleContext(Pressable, SCOPE),
|
|
40
|
+
Group: View,
|
|
41
|
+
Icon: IconWrapper,
|
|
42
|
+
Label: LabelWrapper,
|
|
43
|
+
Indicator: IndicatorWrapper,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
cssInterop(UIIcon, {
|
|
47
|
+
className: {
|
|
48
|
+
target: 'style',
|
|
49
|
+
nativeStyleToProp: {
|
|
50
|
+
height: true,
|
|
51
|
+
width: true,
|
|
52
|
+
fill: true,
|
|
53
|
+
color: 'classNameColor',
|
|
54
|
+
stroke: true,
|
|
55
|
+
} as any,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const checkboxStyle = tva({
|
|
60
|
+
base: 'group/checkbox flex-row items-center justify-start gap-2 web:cursor-pointer data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const checkboxIndicatorStyle = tva({
|
|
64
|
+
base: 'justify-center items-center w-4 h-4 shrink-0 rounded border border-input 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-[checked=true]:bg-primary data-[checked=true]:border-primary dark:data-[checked=true]:bg-primary dark:data-[checked=true]:border-primary data-[invalid=true]:ring-destructive/20 data-[invalid=true]:border-destructive data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const checkboxLabelStyle = tva({
|
|
68
|
+
base: 'text-foreground text-sm font-medium font-body web:select-none web:cursor-pointer data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const checkboxIconStyle = tva({
|
|
72
|
+
base: 'text-primary-foreground fill-none h-3.5 w-3.5',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const CheckboxGroup = UICheckbox.Group;
|
|
76
|
+
|
|
77
|
+
type ICheckboxProps = React.ComponentPropsWithoutRef<typeof UICheckbox> &
|
|
78
|
+
VariantProps<typeof checkboxStyle>;
|
|
79
|
+
|
|
80
|
+
const Checkbox = React.forwardRef<
|
|
81
|
+
React.ComponentRef<typeof UICheckbox>,
|
|
82
|
+
ICheckboxProps
|
|
83
|
+
>(function Checkbox({ className, ...props }, ref) {
|
|
84
|
+
return (
|
|
85
|
+
<UICheckbox
|
|
86
|
+
className={checkboxStyle({ class: className })}
|
|
87
|
+
{...props}
|
|
88
|
+
context={{}}
|
|
89
|
+
ref={ref}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
type ICheckboxIndicatorProps = React.ComponentPropsWithoutRef<
|
|
95
|
+
typeof UICheckbox.Indicator
|
|
96
|
+
> &
|
|
97
|
+
VariantProps<typeof checkboxIndicatorStyle>;
|
|
98
|
+
|
|
99
|
+
const CheckboxIndicator = React.forwardRef<
|
|
100
|
+
React.ComponentRef<typeof UICheckbox.Indicator>,
|
|
101
|
+
ICheckboxIndicatorProps
|
|
102
|
+
>(function CheckboxIndicator({ className, ...props }, ref) {
|
|
103
|
+
return (
|
|
104
|
+
<UICheckbox.Indicator
|
|
105
|
+
className={checkboxIndicatorStyle({ class: className })}
|
|
106
|
+
{...props}
|
|
107
|
+
ref={ref}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
type ICheckboxLabelProps = React.ComponentPropsWithoutRef<
|
|
113
|
+
typeof UICheckbox.Label
|
|
114
|
+
> &
|
|
115
|
+
VariantProps<typeof checkboxLabelStyle>;
|
|
116
|
+
const CheckboxLabel = React.forwardRef<
|
|
117
|
+
React.ComponentRef<typeof UICheckbox.Label>,
|
|
118
|
+
ICheckboxLabelProps
|
|
119
|
+
>(function CheckboxLabel({ className, ...props }, ref) {
|
|
120
|
+
return (
|
|
121
|
+
<UICheckbox.Label
|
|
122
|
+
className={checkboxLabelStyle({ class: className })}
|
|
123
|
+
{...props}
|
|
124
|
+
ref={ref}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
type ICheckboxIconProps = React.ComponentPropsWithoutRef<
|
|
130
|
+
typeof UICheckbox.Icon
|
|
131
|
+
> &
|
|
132
|
+
VariantProps<typeof checkboxIconStyle> & {
|
|
133
|
+
size?: number;
|
|
134
|
+
height?: number;
|
|
135
|
+
width?: number;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const CheckboxIcon = React.forwardRef<
|
|
139
|
+
React.ComponentRef<typeof UICheckbox.Icon>,
|
|
140
|
+
ICheckboxIconProps
|
|
141
|
+
>(function CheckboxIcon({ className, size, ...props }, ref) {
|
|
142
|
+
if (typeof size === 'number') {
|
|
143
|
+
return (
|
|
144
|
+
<UICheckbox.Icon
|
|
145
|
+
ref={ref}
|
|
146
|
+
{...props}
|
|
147
|
+
className={checkboxIconStyle({ class: className })}
|
|
148
|
+
size={size}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
} else if (
|
|
152
|
+
(props.height !== undefined || props.width !== undefined) &&
|
|
153
|
+
size === undefined
|
|
154
|
+
) {
|
|
155
|
+
return (
|
|
156
|
+
<UICheckbox.Icon
|
|
157
|
+
ref={ref}
|
|
158
|
+
{...props}
|
|
159
|
+
className={checkboxIconStyle({ class: className })}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<UICheckbox.Icon
|
|
166
|
+
className={checkboxIconStyle({ class: className })}
|
|
167
|
+
{...props}
|
|
168
|
+
ref={ref}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
Checkbox.displayName = 'Checkbox';
|
|
174
|
+
CheckboxIndicator.displayName = 'CheckboxIndicator';
|
|
175
|
+
CheckboxLabel.displayName = 'CheckboxLabel';
|
|
176
|
+
CheckboxIcon.displayName = 'CheckboxIcon';
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
Checkbox,
|
|
180
|
+
CheckboxIndicator,
|
|
181
|
+
CheckboxLabel,
|
|
182
|
+
CheckboxIcon,
|
|
183
|
+
CheckboxGroup,
|
|
184
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local replacement for the (unpublished) `@gluestack-ui/core/date-time-picker/creator`
|
|
3
|
+
* module. Provides the open/closed + field state shared between the trigger,
|
|
4
|
+
* input, and native picker surfaces via context.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
export interface DateTimePickerContextValue {
|
|
9
|
+
value?: Date;
|
|
10
|
+
onChange?: (date: Date | undefined) => void;
|
|
11
|
+
mode: 'date' | 'time' | 'datetime';
|
|
12
|
+
minimumDate?: Date;
|
|
13
|
+
maximumDate?: Date;
|
|
14
|
+
locale?: string;
|
|
15
|
+
timeZoneOffsetInMinutes?: number;
|
|
16
|
+
is24Hour?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
format?: string;
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
setIsOpen: (open: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DateTimePickerContext = React.createContext<DateTimePickerContextValue | null>(null);
|
|
25
|
+
|
|
26
|
+
export interface DateTimePickerProviderProps {
|
|
27
|
+
value?: Date;
|
|
28
|
+
onChange?: (date: Date | undefined) => void;
|
|
29
|
+
mode: 'date' | 'time' | 'datetime';
|
|
30
|
+
minimumDate?: Date;
|
|
31
|
+
maximumDate?: Date;
|
|
32
|
+
locale?: string;
|
|
33
|
+
timeZoneOffsetInMinutes?: number;
|
|
34
|
+
is24Hour?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
format?: string;
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function DateTimePickerProvider({
|
|
42
|
+
children,
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
mode,
|
|
46
|
+
minimumDate,
|
|
47
|
+
maximumDate,
|
|
48
|
+
locale,
|
|
49
|
+
timeZoneOffsetInMinutes,
|
|
50
|
+
is24Hour,
|
|
51
|
+
disabled,
|
|
52
|
+
placeholder,
|
|
53
|
+
format,
|
|
54
|
+
}: DateTimePickerProviderProps) {
|
|
55
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
56
|
+
|
|
57
|
+
const contextValue = React.useMemo<DateTimePickerContextValue>(
|
|
58
|
+
() => ({
|
|
59
|
+
value,
|
|
60
|
+
onChange,
|
|
61
|
+
mode,
|
|
62
|
+
minimumDate,
|
|
63
|
+
maximumDate,
|
|
64
|
+
locale,
|
|
65
|
+
timeZoneOffsetInMinutes,
|
|
66
|
+
is24Hour,
|
|
67
|
+
disabled,
|
|
68
|
+
placeholder,
|
|
69
|
+
format,
|
|
70
|
+
isOpen,
|
|
71
|
+
setIsOpen,
|
|
72
|
+
}),
|
|
73
|
+
[value, onChange, mode, minimumDate, maximumDate, locale, timeZoneOffsetInMinutes, is24Hour, disabled, placeholder, format, isOpen]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return <DateTimePickerContext.Provider value={contextValue}>{children}</DateTimePickerContext.Provider>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function useDateTimePicker(): DateTimePickerContextValue {
|
|
80
|
+
const context = React.useContext(DateTimePickerContext);
|
|
81
|
+
if (!context) {
|
|
82
|
+
throw new Error('useDateTimePicker must be used within a DateTimePickerProvider');
|
|
83
|
+
}
|
|
84
|
+
return context;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface CreateDateTimePickerConfig {
|
|
88
|
+
Root: React.ComponentType<any>;
|
|
89
|
+
Trigger: React.ComponentType<any>;
|
|
90
|
+
Input: React.ComponentType<any>;
|
|
91
|
+
Icon: React.ComponentType<any>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function createDateTimePicker({ Root, Trigger, Input, Icon }: CreateDateTimePickerConfig) {
|
|
95
|
+
const DateTimePickerRoot = React.forwardRef<any, any>(function DateTimePickerRoot(props, ref) {
|
|
96
|
+
return <Root ref={ref} {...props} />;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const Compound = DateTimePickerRoot as typeof DateTimePickerRoot & {
|
|
100
|
+
Trigger: typeof Trigger;
|
|
101
|
+
Input: typeof Input;
|
|
102
|
+
Icon: typeof Icon;
|
|
103
|
+
};
|
|
104
|
+
Compound.Trigger = Trigger;
|
|
105
|
+
Compound.Input = Input;
|
|
106
|
+
Compound.Icon = Icon;
|
|
107
|
+
|
|
108
|
+
return Compound;
|
|
109
|
+
}
|