@thewhileloop/whileui 2.0.0 → 4.0.0
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/README.md +135 -70
- package/dist/blocks/commerce/metric-card.d.ts +9 -29
- package/dist/blocks/datepicker/date-range-picker-modal.d.ts +1 -1
- package/dist/blocks/datepicker/date-range-picker-modal.js +6 -14
- package/dist/blocks/datepicker/datepicker-modal.d.ts +1 -1
- package/dist/blocks/datepicker/datepicker-modal.js +6 -12
- package/dist/blocks/datepicker/index.d.ts +1 -0
- package/dist/blocks/datepicker/index.js +1 -0
- package/dist/blocks/datepicker/time-picker-modal.d.ts +43 -0
- package/dist/blocks/datepicker/time-picker-modal.js +187 -0
- package/dist/blocks/layout/smart-input.d.ts +3 -2
- package/dist/blocks/layout/smart-input.js +33 -18
- package/dist/blocks/media/smart-image.d.ts +39 -98
- package/dist/blocks/navigation/drawer-menu.js +88 -72
- package/dist/components/alert/alert.d.ts +23 -55
- package/dist/components/alert/alert.js +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +1 -4
- package/dist/components/avatar/avatar.d.ts +18 -45
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.d.ts +84 -212
- package/dist/components/button/button.d.ts +69 -188
- package/dist/components/card/card.d.ts +29 -73
- package/dist/components/card/card.js +1 -1
- package/dist/components/container/container.d.ts +24 -96
- package/dist/components/data-row/data-row.d.ts +18 -38
- package/dist/components/data-row/data-row.js +1 -1
- package/dist/components/fab/fab.d.ts +87 -0
- package/dist/components/fab/fab.js +59 -0
- package/dist/components/fab/index.d.ts +1 -0
- package/dist/components/fab/index.js +1 -0
- package/dist/components/form-field/form-field.d.ts +31 -87
- package/dist/components/form-field/form-field.js +1 -1
- package/dist/components/hover-card/hover-card.d.ts +3 -2
- package/dist/components/input/input.d.ts +18 -31
- package/dist/components/input/input.js +20 -8
- package/dist/components/label/label.d.ts +3 -3
- package/dist/components/labeled-field/labeled-field.d.ts +3 -2
- package/dist/components/numeric-input/numeric-input.d.ts +27 -82
- package/dist/components/numeric-input/numeric-input.js +79 -80
- package/dist/components/otp-input/otp-input.d.ts +21 -65
- package/dist/components/popover/popover.d.ts +4 -3
- package/dist/components/pressable/pressable.d.ts +3 -3
- package/dist/components/progress/progress.d.ts +15 -39
- package/dist/components/row/row.d.ts +63 -163
- package/dist/components/segmented-control/segmented-control.d.ts +69 -241
- package/dist/components/select/select.d.ts +10 -22
- package/dist/components/select/select.js +2 -7
- package/dist/components/separator/separator.d.ts +3 -3
- package/dist/components/skeleton/skeleton.d.ts +9 -29
- package/dist/components/spinner/spinner.d.ts +12 -36
- package/dist/components/stack/stack.d.ts +63 -163
- package/dist/components/tabs/tabs.d.ts +9 -29
- package/dist/components/text/text.d.ts +51 -131
- package/dist/components/textarea/textarea.d.ts +15 -39
- package/dist/components/textarea/textarea.js +3 -3
- package/dist/components/toast/toast.d.ts +12 -36
- package/dist/components/toggle/toggle.d.ts +42 -138
- package/dist/components/toggle-group/toggle-group.d.ts +42 -138
- package/dist/components/tooltip/tooltip.d.ts +3 -2
- package/dist/components/view/view.d.ts +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/lib/focus-ring.d.ts +10 -0
- package/dist/lib/focus-ring.js +10 -0
- package/dist/lib/interaction-tokens.d.ts +24 -1
- package/dist/lib/interaction-tokens.js +26 -44
- package/dist/lib/motion-policy.js +2 -2
- package/dist/lib/ref-types.d.ts +3 -0
- package/dist/lib/ref-types.js +1 -0
- package/dist/lib/theme-bridge.d.ts +4 -2
- package/dist/lib/theme-bridge.js +13 -9
- package/dist/lib/theme-presets.d.ts +26 -0
- package/dist/lib/theme-presets.js +28 -0
- package/package.json +29 -28
|
@@ -1,104 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View, type ViewProps, type TextProps } from 'react-native';
|
|
1
|
+
import { type ViewInstance, type ViewProps, type TextInstance, type TextProps } from 'react-native';
|
|
3
2
|
import { type VariantProps } from '../../lib/tv';
|
|
4
3
|
import { type FrostedSurfaceProps } from '../../lib/frosted-surface';
|
|
5
4
|
import { type ShadowTier } from '../../lib/recipes';
|
|
5
|
+
import type { ForwardRefComponent } from '../../lib/ref-types';
|
|
6
6
|
declare const cardVariants: import("tailwind-variants").TVReturnType<{
|
|
7
7
|
padding: {
|
|
8
|
-
none:
|
|
9
|
-
sm:
|
|
10
|
-
default:
|
|
11
|
-
lg:
|
|
8
|
+
none: "";
|
|
9
|
+
sm: "";
|
|
10
|
+
default: "";
|
|
11
|
+
lg: "";
|
|
12
12
|
};
|
|
13
13
|
unstyled: {
|
|
14
|
-
true:
|
|
15
|
-
false:
|
|
14
|
+
true: "rounded-none border-0 bg-transparent shadow-none";
|
|
15
|
+
false: "";
|
|
16
16
|
};
|
|
17
|
-
}, undefined, "border border-border bg-card",
|
|
17
|
+
}, undefined, "border border-border bg-card", {
|
|
18
18
|
padding: {
|
|
19
|
-
none:
|
|
20
|
-
sm:
|
|
21
|
-
default:
|
|
22
|
-
lg:
|
|
19
|
+
none: "";
|
|
20
|
+
sm: "";
|
|
21
|
+
default: "";
|
|
22
|
+
lg: "";
|
|
23
23
|
};
|
|
24
24
|
unstyled: {
|
|
25
|
-
true:
|
|
26
|
-
false:
|
|
25
|
+
true: "rounded-none border-0 bg-transparent shadow-none";
|
|
26
|
+
false: "";
|
|
27
27
|
};
|
|
28
|
-
}, {
|
|
28
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
29
29
|
padding: {
|
|
30
|
-
none:
|
|
31
|
-
sm:
|
|
32
|
-
default:
|
|
33
|
-
lg:
|
|
30
|
+
none: "";
|
|
31
|
+
sm: "";
|
|
32
|
+
default: "";
|
|
33
|
+
lg: "";
|
|
34
34
|
};
|
|
35
35
|
unstyled: {
|
|
36
|
-
true:
|
|
37
|
-
false:
|
|
36
|
+
true: "rounded-none border-0 bg-transparent shadow-none";
|
|
37
|
+
false: "";
|
|
38
38
|
};
|
|
39
|
-
}
|
|
40
|
-
padding: {
|
|
41
|
-
none: string;
|
|
42
|
-
sm: string;
|
|
43
|
-
default: string;
|
|
44
|
-
lg: string;
|
|
45
|
-
};
|
|
46
|
-
unstyled: {
|
|
47
|
-
true: string;
|
|
48
|
-
false: string;
|
|
49
|
-
};
|
|
50
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
51
|
-
padding: {
|
|
52
|
-
none: string;
|
|
53
|
-
sm: string;
|
|
54
|
-
default: string;
|
|
55
|
-
lg: string;
|
|
56
|
-
};
|
|
57
|
-
unstyled: {
|
|
58
|
-
true: string;
|
|
59
|
-
false: string;
|
|
60
|
-
};
|
|
61
|
-
}, undefined, "border border-border bg-card", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
62
|
-
padding: {
|
|
63
|
-
none: string;
|
|
64
|
-
sm: string;
|
|
65
|
-
default: string;
|
|
66
|
-
lg: string;
|
|
67
|
-
};
|
|
68
|
-
unstyled: {
|
|
69
|
-
true: string;
|
|
70
|
-
false: string;
|
|
71
|
-
};
|
|
72
|
-
}, {
|
|
73
|
-
padding: {
|
|
74
|
-
none: string;
|
|
75
|
-
sm: string;
|
|
76
|
-
default: string;
|
|
77
|
-
lg: string;
|
|
78
|
-
};
|
|
79
|
-
unstyled: {
|
|
80
|
-
true: string;
|
|
81
|
-
false: string;
|
|
82
|
-
};
|
|
83
|
-
}>, unknown, unknown, undefined>>;
|
|
39
|
+
}, undefined>>;
|
|
84
40
|
export interface CardProps extends ViewProps, VariantProps<typeof cardVariants>, FrostedSurfaceProps {
|
|
85
41
|
/** Elevation tier; 'sm' by default, 'none' for flat cards. */
|
|
86
42
|
shadow?: ShadowTier;
|
|
87
43
|
}
|
|
88
|
-
declare const Card:
|
|
44
|
+
declare const Card: ForwardRefComponent<ViewInstance, CardProps>;
|
|
89
45
|
export interface CardHeaderProps extends ViewProps {
|
|
90
46
|
}
|
|
91
|
-
declare const CardHeader:
|
|
47
|
+
declare const CardHeader: ForwardRefComponent<ViewInstance, CardHeaderProps>;
|
|
92
48
|
export interface CardTitleProps extends TextProps {
|
|
93
49
|
}
|
|
94
|
-
declare const CardTitle:
|
|
50
|
+
declare const CardTitle: ForwardRefComponent<TextInstance, CardTitleProps>;
|
|
95
51
|
export interface CardDescriptionProps extends TextProps {
|
|
96
52
|
}
|
|
97
|
-
declare const CardDescription:
|
|
53
|
+
declare const CardDescription: ForwardRefComponent<TextInstance, CardDescriptionProps>;
|
|
98
54
|
export interface CardContentProps extends ViewProps {
|
|
99
55
|
}
|
|
100
|
-
declare const CardContent:
|
|
56
|
+
declare const CardContent: ForwardRefComponent<ViewInstance, CardContentProps>;
|
|
101
57
|
export interface CardFooterProps extends ViewProps {
|
|
102
58
|
}
|
|
103
|
-
declare const CardFooter:
|
|
59
|
+
declare const CardFooter: ForwardRefComponent<ViewInstance, CardFooterProps>;
|
|
104
60
|
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, cardVariants };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { View } from 'react-native';
|
|
3
|
+
import { View, } from 'react-native';
|
|
4
4
|
import { Text } from '../text';
|
|
5
5
|
import { cn } from '../../lib/cn';
|
|
6
6
|
import { tv } from '../../lib/tv';
|
|
@@ -15,130 +15,58 @@ import { type VariantProps } from '../../lib/tv';
|
|
|
15
15
|
declare const containerVariants: import("tailwind-variants").TVReturnType<{
|
|
16
16
|
size: {
|
|
17
17
|
/** Forms, auth, single-column reading. */
|
|
18
|
-
sm:
|
|
18
|
+
sm: "max-w-xl";
|
|
19
19
|
/** Default. Feeds, dashboards, most app screens. */
|
|
20
|
-
md:
|
|
20
|
+
md: "max-w-3xl";
|
|
21
21
|
/** Multi-column dashboards and wide tables. */
|
|
22
|
-
lg:
|
|
22
|
+
lg: "max-w-5xl";
|
|
23
23
|
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
24
|
-
xl:
|
|
24
|
+
xl: "max-w-7xl";
|
|
25
25
|
/** Opt out — edge-to-edge at every width. */
|
|
26
|
-
full:
|
|
26
|
+
full: "max-w-none";
|
|
27
27
|
};
|
|
28
28
|
/** Fill the available height, for a container used as a screen root. */
|
|
29
29
|
fill: {
|
|
30
|
-
true:
|
|
31
|
-
false:
|
|
30
|
+
true: "flex-1";
|
|
31
|
+
false: "";
|
|
32
32
|
};
|
|
33
|
-
}, undefined, "w-full self-center",
|
|
33
|
+
}, undefined, "w-full self-center", {
|
|
34
34
|
size: {
|
|
35
35
|
/** Forms, auth, single-column reading. */
|
|
36
|
-
sm:
|
|
36
|
+
sm: "max-w-xl";
|
|
37
37
|
/** Default. Feeds, dashboards, most app screens. */
|
|
38
|
-
md:
|
|
38
|
+
md: "max-w-3xl";
|
|
39
39
|
/** Multi-column dashboards and wide tables. */
|
|
40
|
-
lg:
|
|
40
|
+
lg: "max-w-5xl";
|
|
41
41
|
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
42
|
-
xl:
|
|
42
|
+
xl: "max-w-7xl";
|
|
43
43
|
/** Opt out — edge-to-edge at every width. */
|
|
44
|
-
full:
|
|
44
|
+
full: "max-w-none";
|
|
45
45
|
};
|
|
46
46
|
/** Fill the available height, for a container used as a screen root. */
|
|
47
47
|
fill: {
|
|
48
|
-
true:
|
|
49
|
-
false:
|
|
48
|
+
true: "flex-1";
|
|
49
|
+
false: "";
|
|
50
50
|
};
|
|
51
|
-
}, {
|
|
51
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
52
52
|
size: {
|
|
53
53
|
/** Forms, auth, single-column reading. */
|
|
54
|
-
sm:
|
|
54
|
+
sm: "max-w-xl";
|
|
55
55
|
/** Default. Feeds, dashboards, most app screens. */
|
|
56
|
-
md:
|
|
56
|
+
md: "max-w-3xl";
|
|
57
57
|
/** Multi-column dashboards and wide tables. */
|
|
58
|
-
lg:
|
|
58
|
+
lg: "max-w-5xl";
|
|
59
59
|
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
60
|
-
xl:
|
|
60
|
+
xl: "max-w-7xl";
|
|
61
61
|
/** Opt out — edge-to-edge at every width. */
|
|
62
|
-
full:
|
|
62
|
+
full: "max-w-none";
|
|
63
63
|
};
|
|
64
64
|
/** Fill the available height, for a container used as a screen root. */
|
|
65
65
|
fill: {
|
|
66
|
-
true:
|
|
67
|
-
false:
|
|
66
|
+
true: "flex-1";
|
|
67
|
+
false: "";
|
|
68
68
|
};
|
|
69
|
-
}
|
|
70
|
-
size: {
|
|
71
|
-
/** Forms, auth, single-column reading. */
|
|
72
|
-
sm: string;
|
|
73
|
-
/** Default. Feeds, dashboards, most app screens. */
|
|
74
|
-
md: string;
|
|
75
|
-
/** Multi-column dashboards and wide tables. */
|
|
76
|
-
lg: string;
|
|
77
|
-
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
78
|
-
xl: string;
|
|
79
|
-
/** Opt out — edge-to-edge at every width. */
|
|
80
|
-
full: string;
|
|
81
|
-
};
|
|
82
|
-
/** Fill the available height, for a container used as a screen root. */
|
|
83
|
-
fill: {
|
|
84
|
-
true: string;
|
|
85
|
-
false: string;
|
|
86
|
-
};
|
|
87
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
88
|
-
size: {
|
|
89
|
-
/** Forms, auth, single-column reading. */
|
|
90
|
-
sm: string;
|
|
91
|
-
/** Default. Feeds, dashboards, most app screens. */
|
|
92
|
-
md: string;
|
|
93
|
-
/** Multi-column dashboards and wide tables. */
|
|
94
|
-
lg: string;
|
|
95
|
-
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
96
|
-
xl: string;
|
|
97
|
-
/** Opt out — edge-to-edge at every width. */
|
|
98
|
-
full: string;
|
|
99
|
-
};
|
|
100
|
-
/** Fill the available height, for a container used as a screen root. */
|
|
101
|
-
fill: {
|
|
102
|
-
true: string;
|
|
103
|
-
false: string;
|
|
104
|
-
};
|
|
105
|
-
}, undefined, "w-full self-center", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
106
|
-
size: {
|
|
107
|
-
/** Forms, auth, single-column reading. */
|
|
108
|
-
sm: string;
|
|
109
|
-
/** Default. Feeds, dashboards, most app screens. */
|
|
110
|
-
md: string;
|
|
111
|
-
/** Multi-column dashboards and wide tables. */
|
|
112
|
-
lg: string;
|
|
113
|
-
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
114
|
-
xl: string;
|
|
115
|
-
/** Opt out — edge-to-edge at every width. */
|
|
116
|
-
full: string;
|
|
117
|
-
};
|
|
118
|
-
/** Fill the available height, for a container used as a screen root. */
|
|
119
|
-
fill: {
|
|
120
|
-
true: string;
|
|
121
|
-
false: string;
|
|
122
|
-
};
|
|
123
|
-
}, {
|
|
124
|
-
size: {
|
|
125
|
-
/** Forms, auth, single-column reading. */
|
|
126
|
-
sm: string;
|
|
127
|
-
/** Default. Feeds, dashboards, most app screens. */
|
|
128
|
-
md: string;
|
|
129
|
-
/** Multi-column dashboards and wide tables. */
|
|
130
|
-
lg: string;
|
|
131
|
-
/** Near-full width, still stops short of an ultrawide monitor. */
|
|
132
|
-
xl: string;
|
|
133
|
-
/** Opt out — edge-to-edge at every width. */
|
|
134
|
-
full: string;
|
|
135
|
-
};
|
|
136
|
-
/** Fill the available height, for a container used as a screen root. */
|
|
137
|
-
fill: {
|
|
138
|
-
true: string;
|
|
139
|
-
false: string;
|
|
140
|
-
};
|
|
141
|
-
}>, unknown, unknown, undefined>>;
|
|
69
|
+
}, undefined>>;
|
|
142
70
|
export interface ContainerProps extends ViewProps, VariantProps<typeof containerVariants> {
|
|
143
71
|
className?: string;
|
|
144
72
|
}
|
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { type TextInstance, type TextProps, type ViewInstance, type ViewProps } from 'react-native';
|
|
2
|
+
import type { ForwardRefComponent } from '../../lib/ref-types';
|
|
3
3
|
declare const dataRowVariants: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
size: {
|
|
5
|
-
default:
|
|
6
|
-
compact:
|
|
5
|
+
default: "";
|
|
6
|
+
compact: "";
|
|
7
7
|
};
|
|
8
|
-
}, undefined, "w-full flex-row items-center gap-3",
|
|
8
|
+
}, undefined, "w-full flex-row items-center gap-3", {
|
|
9
9
|
size: {
|
|
10
|
-
default:
|
|
11
|
-
compact:
|
|
10
|
+
default: "";
|
|
11
|
+
compact: "";
|
|
12
12
|
};
|
|
13
|
-
}, {
|
|
13
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
14
14
|
size: {
|
|
15
|
-
default:
|
|
16
|
-
compact:
|
|
15
|
+
default: "";
|
|
16
|
+
compact: "";
|
|
17
17
|
};
|
|
18
|
-
}
|
|
19
|
-
size: {
|
|
20
|
-
default: string;
|
|
21
|
-
compact: string;
|
|
22
|
-
};
|
|
23
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
24
|
-
size: {
|
|
25
|
-
default: string;
|
|
26
|
-
compact: string;
|
|
27
|
-
};
|
|
28
|
-
}, undefined, "w-full flex-row items-center gap-3", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
29
|
-
size: {
|
|
30
|
-
default: string;
|
|
31
|
-
compact: string;
|
|
32
|
-
};
|
|
33
|
-
}, {
|
|
34
|
-
size: {
|
|
35
|
-
default: string;
|
|
36
|
-
compact: string;
|
|
37
|
-
};
|
|
38
|
-
}>, unknown, unknown, undefined>>;
|
|
18
|
+
}, undefined>>;
|
|
39
19
|
export interface DataRowProps extends ViewProps {
|
|
40
20
|
size?: 'default' | 'compact';
|
|
41
21
|
className?: string;
|
|
@@ -58,11 +38,11 @@ export interface DataRowDescriptionProps extends TextProps {
|
|
|
58
38
|
export interface DataRowValueProps extends TextProps {
|
|
59
39
|
className?: string;
|
|
60
40
|
}
|
|
61
|
-
declare const DataRow:
|
|
62
|
-
declare const DataRowLeft:
|
|
63
|
-
declare const DataRowCenter:
|
|
64
|
-
declare const DataRowRight:
|
|
65
|
-
declare const DataRowLabel:
|
|
66
|
-
declare const DataRowDescription:
|
|
67
|
-
declare const DataRowValue:
|
|
41
|
+
declare const DataRow: ForwardRefComponent<ViewInstance, DataRowProps>;
|
|
42
|
+
declare const DataRowLeft: ForwardRefComponent<ViewInstance, DataRowLeftProps>;
|
|
43
|
+
declare const DataRowCenter: ForwardRefComponent<ViewInstance, DataRowCenterProps>;
|
|
44
|
+
declare const DataRowRight: ForwardRefComponent<ViewInstance, DataRowRightProps>;
|
|
45
|
+
declare const DataRowLabel: ForwardRefComponent<TextInstance, DataRowLabelProps>;
|
|
46
|
+
declare const DataRowDescription: ForwardRefComponent<TextInstance, DataRowDescriptionProps>;
|
|
47
|
+
declare const DataRowValue: ForwardRefComponent<TextInstance, DataRowValueProps>;
|
|
68
48
|
export { DataRow, DataRowLeft, DataRowCenter, DataRowRight, DataRowLabel, DataRowDescription, DataRowValue, dataRowVariants, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { createContext, useContext, useMemo } from 'react';
|
|
3
|
-
import { Text, View } from 'react-native';
|
|
3
|
+
import { Text, View, } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/cn';
|
|
5
5
|
import { tv } from '../../lib/tv';
|
|
6
6
|
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, type PressableInstance, type ViewProps } from 'react-native';
|
|
3
|
+
import { type PressableProps } from '../pressable';
|
|
4
|
+
import { type VariantProps } from '../../lib/tv';
|
|
5
|
+
import type { ForwardRefComponent } from '../../lib/ref-types';
|
|
6
|
+
declare const fabVariants: import("tailwind-variants").TVReturnType<{
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-primary";
|
|
9
|
+
secondary: "bg-secondary";
|
|
10
|
+
destructive: "bg-destructive";
|
|
11
|
+
surface: "border border-border bg-card";
|
|
12
|
+
};
|
|
13
|
+
size: {
|
|
14
|
+
default: "h-14 w-14";
|
|
15
|
+
sm: "h-12 w-12";
|
|
16
|
+
lg: "h-16 w-16";
|
|
17
|
+
};
|
|
18
|
+
placement: {
|
|
19
|
+
/** Positioned by the caller — inside a toolbar, a row, anywhere. */
|
|
20
|
+
inline: "";
|
|
21
|
+
/** Floating over the nearest positioned ancestor, bottom-right. */
|
|
22
|
+
floating: "absolute bottom-6 right-6";
|
|
23
|
+
'floating-left': "absolute bottom-6 left-6";
|
|
24
|
+
};
|
|
25
|
+
}, undefined, "items-center justify-center rounded-full", {
|
|
26
|
+
variant: {
|
|
27
|
+
default: "bg-primary";
|
|
28
|
+
secondary: "bg-secondary";
|
|
29
|
+
destructive: "bg-destructive";
|
|
30
|
+
surface: "border border-border bg-card";
|
|
31
|
+
};
|
|
32
|
+
size: {
|
|
33
|
+
default: "h-14 w-14";
|
|
34
|
+
sm: "h-12 w-12";
|
|
35
|
+
lg: "h-16 w-16";
|
|
36
|
+
};
|
|
37
|
+
placement: {
|
|
38
|
+
/** Positioned by the caller — inside a toolbar, a row, anywhere. */
|
|
39
|
+
inline: "";
|
|
40
|
+
/** Floating over the nearest positioned ancestor, bottom-right. */
|
|
41
|
+
floating: "absolute bottom-6 right-6";
|
|
42
|
+
'floating-left': "absolute bottom-6 left-6";
|
|
43
|
+
};
|
|
44
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
45
|
+
variant: {
|
|
46
|
+
default: "bg-primary";
|
|
47
|
+
secondary: "bg-secondary";
|
|
48
|
+
destructive: "bg-destructive";
|
|
49
|
+
surface: "border border-border bg-card";
|
|
50
|
+
};
|
|
51
|
+
size: {
|
|
52
|
+
default: "h-14 w-14";
|
|
53
|
+
sm: "h-12 w-12";
|
|
54
|
+
lg: "h-16 w-16";
|
|
55
|
+
};
|
|
56
|
+
placement: {
|
|
57
|
+
/** Positioned by the caller — inside a toolbar, a row, anywhere. */
|
|
58
|
+
inline: "";
|
|
59
|
+
/** Floating over the nearest positioned ancestor, bottom-right. */
|
|
60
|
+
floating: "absolute bottom-6 right-6";
|
|
61
|
+
'floating-left': "absolute bottom-6 left-6";
|
|
62
|
+
};
|
|
63
|
+
}, undefined>>;
|
|
64
|
+
export interface FabProps extends Omit<PressableProps, 'children'>, VariantProps<typeof fabVariants> {
|
|
65
|
+
/**
|
|
66
|
+
* What the action does, for screen readers. Required: a FAB is an icon with no
|
|
67
|
+
* text, so without this it announces as an unlabelled button.
|
|
68
|
+
*/
|
|
69
|
+
label: string;
|
|
70
|
+
/** The glyph. Icon libraries need a concrete colour, so read it from `useIconColors`. */
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
className?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A floating action button: one primary action, raised above the content.
|
|
76
|
+
*
|
|
77
|
+
* It owns no icon dependency. `@expo/vector-icons` and friends need hex colours
|
|
78
|
+
* rather than classes, so the caller passes the glyph and colours it from
|
|
79
|
+
* `useIconColors()` or `useThemeColors()`.
|
|
80
|
+
*/
|
|
81
|
+
declare const FAB: ForwardRefComponent<PressableInstance, FabProps>;
|
|
82
|
+
export interface FabGroupProps extends ViewProps {
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
85
|
+
/** Stacks secondary actions above a FAB, bottom-aligned. */
|
|
86
|
+
declare const FABGroup: ForwardRefComponent<React.ComponentRef<typeof View>, FabGroupProps>;
|
|
87
|
+
export { FAB, FABGroup, fabVariants };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Pressable } from '../pressable';
|
|
5
|
+
import { cn } from '../../lib/cn';
|
|
6
|
+
import { tv } from '../../lib/tv';
|
|
7
|
+
import { useVisualTokens } from '../../lib/visual-tokens';
|
|
8
|
+
import { shadowStyle } from '../../lib/recipes';
|
|
9
|
+
import { useThemeColors } from '../../lib/theme-colors';
|
|
10
|
+
const fabVariants = tv({
|
|
11
|
+
base: 'items-center justify-center rounded-full',
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: 'bg-primary',
|
|
15
|
+
secondary: 'bg-secondary',
|
|
16
|
+
destructive: 'bg-destructive',
|
|
17
|
+
surface: 'border border-border bg-card',
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
// 56 and 40 are Material's FAB and small-FAB sizes. Both clear the iOS 44pt
|
|
21
|
+
// and Android 48dp minimums on their own, so a FAB never needs hitSlop.
|
|
22
|
+
default: 'h-14 w-14',
|
|
23
|
+
sm: 'h-12 w-12',
|
|
24
|
+
lg: 'h-16 w-16',
|
|
25
|
+
},
|
|
26
|
+
placement: {
|
|
27
|
+
/** Positioned by the caller — inside a toolbar, a row, anywhere. */
|
|
28
|
+
inline: '',
|
|
29
|
+
/** Floating over the nearest positioned ancestor, bottom-right. */
|
|
30
|
+
floating: 'absolute bottom-6 right-6',
|
|
31
|
+
'floating-left': 'absolute bottom-6 left-6',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: 'default',
|
|
36
|
+
size: 'default',
|
|
37
|
+
placement: 'floating',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* A floating action button: one primary action, raised above the content.
|
|
42
|
+
*
|
|
43
|
+
* It owns no icon dependency. `@expo/vector-icons` and friends need hex colours
|
|
44
|
+
* rather than classes, so the caller passes the glyph and colours it from
|
|
45
|
+
* `useIconColors()` or `useThemeColors()`.
|
|
46
|
+
*/
|
|
47
|
+
const FAB = React.forwardRef(({ className, variant, size, placement, label, children, style, ...props }, ref) => {
|
|
48
|
+
const visual = useVisualTokens();
|
|
49
|
+
const colors = useThemeColors();
|
|
50
|
+
return (_jsx(Pressable, { ref: ref, accessibilityRole: "button", accessibilityLabel: label, className: cn(fabVariants({ variant, size, placement }), className), style: (state) => [
|
|
51
|
+
shadowStyle(visual, colors, 'lg'),
|
|
52
|
+
typeof style === 'function' ? style(state) : style,
|
|
53
|
+
], ...props, children: children }));
|
|
54
|
+
});
|
|
55
|
+
FAB.displayName = 'FAB';
|
|
56
|
+
/** Stacks secondary actions above a FAB, bottom-aligned. */
|
|
57
|
+
const FABGroup = React.forwardRef(({ className, ...props }, ref) => (_jsx(View, { ref: ref, className: cn('absolute bottom-6 right-6 items-end gap-3', className), ...props })));
|
|
58
|
+
FABGroup.displayName = 'FABGroup';
|
|
59
|
+
export { FAB, FABGroup, fabVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FAB, FABGroup, fabVariants, type FabProps, type FabGroupProps } from './fab';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FAB, FABGroup, fabVariants } from './fab';
|