@medway-ui/native 1.9.1 → 1.10.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 +2 -2
- package/lib/commonjs/components/Alert.js +36 -25
- package/lib/commonjs/components/Alert.js.map +1 -1
- package/lib/commonjs/components/AlertDialog.js +22 -23
- package/lib/commonjs/components/AlertDialog.js.map +1 -1
- package/lib/commonjs/components/Avatar.js +4 -4
- package/lib/commonjs/components/Badge.js +22 -15
- package/lib/commonjs/components/Badge.js.map +1 -1
- package/lib/commonjs/components/Button.js +56 -42
- package/lib/commonjs/components/Button.js.map +1 -1
- package/lib/commonjs/components/CardNews.js +18 -13
- package/lib/commonjs/components/CardNews.js.map +1 -1
- package/lib/commonjs/components/Carousel.js +12 -8
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/Checkbox.js +5 -5
- package/lib/commonjs/components/Checkbox.js.map +1 -1
- package/lib/commonjs/components/Chip.js +52 -23
- package/lib/commonjs/components/Chip.js.map +1 -1
- package/lib/commonjs/components/Choice.js +26 -12
- package/lib/commonjs/components/Choice.js.map +1 -1
- package/lib/commonjs/components/Dialog.js +16 -8
- package/lib/commonjs/components/Dialog.js.map +1 -1
- package/lib/commonjs/components/DropdownMenu.js +35 -14
- package/lib/commonjs/components/DropdownMenu.js.map +1 -1
- package/lib/commonjs/components/EmptyState.js +5 -5
- package/lib/commonjs/components/EmptyState.js.map +1 -1
- package/lib/commonjs/components/FallbackImage.js +42 -35
- package/lib/commonjs/components/FallbackImage.js.map +1 -1
- package/lib/commonjs/components/Feed.js +6 -5
- package/lib/commonjs/components/Feed.js.map +1 -1
- package/lib/commonjs/components/FeedNotice.js +3 -3
- package/lib/commonjs/components/Feedback.js +2 -4
- package/lib/commonjs/components/Feedback.js.map +1 -1
- package/lib/commonjs/components/Filter.js +6 -9
- package/lib/commonjs/components/Filter.js.map +1 -1
- package/lib/commonjs/components/IndexLevel.js +4 -4
- package/lib/commonjs/components/Input.js +25 -20
- package/lib/commonjs/components/Input.js.map +1 -1
- package/lib/commonjs/components/InvitePopover.js +19 -8
- package/lib/commonjs/components/InvitePopover.js.map +1 -1
- package/lib/commonjs/components/Label.js +2 -2
- package/lib/commonjs/components/LeaderboardCard.js +3 -2
- package/lib/commonjs/components/LeaderboardCard.js.map +1 -1
- package/lib/commonjs/components/Loading.js +18 -15
- package/lib/commonjs/components/Loading.js.map +1 -1
- package/lib/commonjs/components/LoadingOverlay.js +36 -43
- package/lib/commonjs/components/LoadingOverlay.js.map +1 -1
- package/lib/commonjs/components/MemberRow.js +7 -6
- package/lib/commonjs/components/MemberRow.js.map +1 -1
- package/lib/commonjs/components/PageHeader.js +3 -2
- package/lib/commonjs/components/PageHeader.js.map +1 -1
- package/lib/commonjs/components/Popover.js +1 -1
- package/lib/commonjs/components/PostForm.js +38 -24
- package/lib/commonjs/components/PostForm.js.map +1 -1
- package/lib/commonjs/components/PrizeCollection.js +5 -5
- package/lib/commonjs/components/PrizeCollection.js.map +1 -1
- package/lib/commonjs/components/RadioGroup.js +65 -15
- package/lib/commonjs/components/RadioGroup.js.map +1 -1
- package/lib/commonjs/components/SectionHeader.js +3 -2
- package/lib/commonjs/components/SectionHeader.js.map +1 -1
- package/lib/commonjs/components/SegmentControl.js +4 -4
- package/lib/commonjs/components/Select.js +7 -6
- package/lib/commonjs/components/Select.js.map +1 -1
- package/lib/commonjs/components/Separator.js +2 -2
- package/lib/commonjs/components/Separator.js.map +1 -1
- package/lib/commonjs/components/Sheet.js +17 -11
- package/lib/commonjs/components/Sheet.js.map +1 -1
- package/lib/commonjs/components/Skeleton.js +2 -2
- package/lib/commonjs/components/Skeleton.js.map +1 -1
- package/lib/commonjs/components/Switch.js +3 -3
- package/lib/commonjs/components/Tabs.js +3 -2
- package/lib/commonjs/components/Tabs.js.map +1 -1
- package/lib/commonjs/components/Tag.js +52 -32
- package/lib/commonjs/components/Tag.js.map +1 -1
- package/lib/commonjs/components/Text.js +1 -1
- package/lib/commonjs/components/ThemedIcon.js +1 -1
- package/lib/commonjs/components/Toast.js +12 -12
- package/lib/commonjs/components/Toast.js.map +1 -1
- package/lib/commonjs/components/Tooltip.js +2 -2
- package/lib/commonjs/editor/NoteEditor.js +190 -67
- package/lib/commonjs/editor/NoteEditor.js.map +1 -1
- package/lib/commonjs/editor/editorHtml.generated.js +1 -1
- package/lib/commonjs/editor/editorHtml.generated.js.map +1 -1
- package/lib/commonjs/editor/index.js.map +1 -1
- package/lib/commonjs/editor/protocol.js +1 -2
- package/lib/commonjs/editor/protocol.js.map +1 -1
- package/lib/commonjs/hooks/useThemeColor.js +41 -19
- package/lib/commonjs/hooks/useThemeColor.js.map +1 -1
- package/lib/commonjs/index.js +46 -46
- package/lib/commonjs/lib/backdrop.js +18 -0
- package/lib/commonjs/lib/backdrop.js.map +1 -0
- package/lib/commonjs/lib/overlay-host.js +5 -3
- package/lib/commonjs/lib/overlay-host.js.map +1 -1
- package/lib/commonjs/lib/raised-surface.js +1 -1
- package/lib/module/components/Alert.js +36 -25
- package/lib/module/components/Alert.js.map +1 -1
- package/lib/module/components/AlertDialog.js +21 -22
- package/lib/module/components/AlertDialog.js.map +1 -1
- package/lib/module/components/Avatar.js +4 -4
- package/lib/module/components/Badge.js +22 -15
- package/lib/module/components/Badge.js.map +1 -1
- package/lib/module/components/Button.js +56 -42
- package/lib/module/components/Button.js.map +1 -1
- package/lib/module/components/CardNews.js +18 -13
- package/lib/module/components/CardNews.js.map +1 -1
- package/lib/module/components/Carousel.js +12 -8
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/Checkbox.js +5 -5
- package/lib/module/components/Checkbox.js.map +1 -1
- package/lib/module/components/Chip.js +52 -23
- package/lib/module/components/Chip.js.map +1 -1
- package/lib/module/components/Choice.js +26 -12
- package/lib/module/components/Choice.js.map +1 -1
- package/lib/module/components/Dialog.js +16 -8
- package/lib/module/components/Dialog.js.map +1 -1
- package/lib/module/components/DropdownMenu.js +36 -15
- package/lib/module/components/DropdownMenu.js.map +1 -1
- package/lib/module/components/EmptyState.js +5 -5
- package/lib/module/components/EmptyState.js.map +1 -1
- package/lib/module/components/FallbackImage.js +42 -35
- package/lib/module/components/FallbackImage.js.map +1 -1
- package/lib/module/components/Feed.js +6 -5
- package/lib/module/components/Feed.js.map +1 -1
- package/lib/module/components/FeedNotice.js +3 -3
- package/lib/module/components/Feedback.js +2 -4
- package/lib/module/components/Feedback.js.map +1 -1
- package/lib/module/components/Filter.js +6 -9
- package/lib/module/components/Filter.js.map +1 -1
- package/lib/module/components/IndexLevel.js +4 -4
- package/lib/module/components/Input.js +24 -18
- package/lib/module/components/Input.js.map +1 -1
- package/lib/module/components/InvitePopover.js +20 -9
- package/lib/module/components/InvitePopover.js.map +1 -1
- package/lib/module/components/Label.js +2 -2
- package/lib/module/components/LeaderboardCard.js +3 -2
- package/lib/module/components/LeaderboardCard.js.map +1 -1
- package/lib/module/components/Loading.js +18 -15
- package/lib/module/components/Loading.js.map +1 -1
- package/lib/module/components/LoadingOverlay.js +37 -44
- package/lib/module/components/LoadingOverlay.js.map +1 -1
- package/lib/module/components/MemberRow.js +7 -6
- package/lib/module/components/MemberRow.js.map +1 -1
- package/lib/module/components/PageHeader.js +3 -2
- package/lib/module/components/PageHeader.js.map +1 -1
- package/lib/module/components/Popover.js +1 -1
- package/lib/module/components/PostForm.js +38 -24
- package/lib/module/components/PostForm.js.map +1 -1
- package/lib/module/components/PrizeCollection.js +5 -5
- package/lib/module/components/PrizeCollection.js.map +1 -1
- package/lib/module/components/RadioGroup.js +65 -15
- package/lib/module/components/RadioGroup.js.map +1 -1
- package/lib/module/components/SectionHeader.js +3 -2
- package/lib/module/components/SectionHeader.js.map +1 -1
- package/lib/module/components/SegmentControl.js +4 -4
- package/lib/module/components/Select.js +6 -5
- package/lib/module/components/Select.js.map +1 -1
- package/lib/module/components/Separator.js +2 -2
- package/lib/module/components/Separator.js.map +1 -1
- package/lib/module/components/Sheet.js +17 -11
- package/lib/module/components/Sheet.js.map +1 -1
- package/lib/module/components/Skeleton.js +2 -2
- package/lib/module/components/Skeleton.js.map +1 -1
- package/lib/module/components/Switch.js +3 -3
- package/lib/module/components/Tabs.js +3 -2
- package/lib/module/components/Tabs.js.map +1 -1
- package/lib/module/components/Tag.js +52 -32
- package/lib/module/components/Tag.js.map +1 -1
- package/lib/module/components/Text.js +1 -1
- package/lib/module/components/ThemedIcon.js +1 -1
- package/lib/module/components/Toast.js +12 -12
- package/lib/module/components/Toast.js.map +1 -1
- package/lib/module/components/Tooltip.js +2 -2
- package/lib/module/editor/NoteEditor.js +193 -69
- package/lib/module/editor/NoteEditor.js.map +1 -1
- package/lib/module/editor/editorHtml.generated.js +1 -1
- package/lib/module/editor/editorHtml.generated.js.map +1 -1
- package/lib/module/editor/index.js.map +1 -1
- package/lib/module/editor/protocol.js +1 -2
- package/lib/module/editor/protocol.js.map +1 -1
- package/lib/module/hooks/useThemeColor.js +41 -19
- package/lib/module/hooks/useThemeColor.js.map +1 -1
- package/lib/module/index.js +46 -46
- package/lib/module/lib/backdrop.js +15 -0
- package/lib/module/lib/backdrop.js.map +1 -0
- package/lib/module/lib/overlay-host.js +6 -4
- package/lib/module/lib/overlay-host.js.map +1 -1
- package/lib/module/lib/raised-surface.js +1 -1
- package/lib/typescript/components/Alert.d.ts +1 -1
- package/lib/typescript/components/Alert.d.ts.map +1 -1
- package/lib/typescript/components/AlertDialog.d.ts +1 -1
- package/lib/typescript/components/AlertDialog.d.ts.map +1 -1
- package/lib/typescript/components/Badge.d.ts.map +1 -1
- package/lib/typescript/components/Button.d.ts +1 -0
- package/lib/typescript/components/Button.d.ts.map +1 -1
- package/lib/typescript/components/CardNews.d.ts +7 -2
- package/lib/typescript/components/CardNews.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox.d.ts +3 -1
- package/lib/typescript/components/Checkbox.d.ts.map +1 -1
- package/lib/typescript/components/Chip.d.ts.map +1 -1
- package/lib/typescript/components/Choice.d.ts +4 -1
- package/lib/typescript/components/Choice.d.ts.map +1 -1
- package/lib/typescript/components/Dialog.d.ts +2 -1
- package/lib/typescript/components/Dialog.d.ts.map +1 -1
- package/lib/typescript/components/DropdownMenu.d.ts +3 -2
- package/lib/typescript/components/DropdownMenu.d.ts.map +1 -1
- package/lib/typescript/components/FallbackImage.d.ts.map +1 -1
- package/lib/typescript/components/Feed.d.ts.map +1 -1
- package/lib/typescript/components/Feedback.d.ts.map +1 -1
- package/lib/typescript/components/Filter.d.ts.map +1 -1
- package/lib/typescript/components/IndexLevel.d.ts +1 -1
- package/lib/typescript/components/Input.d.ts +5 -5
- package/lib/typescript/components/Input.d.ts.map +1 -1
- package/lib/typescript/components/InvitePopover.d.ts +1 -1
- package/lib/typescript/components/InvitePopover.d.ts.map +1 -1
- package/lib/typescript/components/LeaderboardCard.d.ts.map +1 -1
- package/lib/typescript/components/Loading.d.ts +1 -1
- package/lib/typescript/components/Loading.d.ts.map +1 -1
- package/lib/typescript/components/LoadingOverlay.d.ts +9 -9
- package/lib/typescript/components/LoadingOverlay.d.ts.map +1 -1
- package/lib/typescript/components/PageHeader.d.ts.map +1 -1
- package/lib/typescript/components/PostForm.d.ts.map +1 -1
- package/lib/typescript/components/RadioGroup.d.ts +4 -2
- package/lib/typescript/components/RadioGroup.d.ts.map +1 -1
- package/lib/typescript/components/SectionHeader.d.ts.map +1 -1
- package/lib/typescript/components/SegmentControl.d.ts +1 -1
- package/lib/typescript/components/Select.d.ts +2 -1
- package/lib/typescript/components/Select.d.ts.map +1 -1
- package/lib/typescript/components/Separator.d.ts.map +1 -1
- package/lib/typescript/components/Sheet.d.ts +2 -1
- package/lib/typescript/components/Sheet.d.ts.map +1 -1
- package/lib/typescript/components/Tabs.d.ts +4 -3
- package/lib/typescript/components/Tabs.d.ts.map +1 -1
- package/lib/typescript/components/Tag.d.ts +3 -1
- package/lib/typescript/components/Tag.d.ts.map +1 -1
- package/lib/typescript/components/ThemedIcon.d.ts +1 -1
- package/lib/typescript/components/Toast.d.ts +1 -1
- package/lib/typescript/components/Toast.d.ts.map +1 -1
- package/lib/typescript/editor/NoteEditor.d.ts +28 -8
- package/lib/typescript/editor/NoteEditor.d.ts.map +1 -1
- package/lib/typescript/editor/editorHtml.generated.d.ts.map +1 -1
- package/lib/typescript/editor/index.d.ts +1 -1
- package/lib/typescript/editor/index.d.ts.map +1 -1
- package/lib/typescript/editor/protocol.d.ts +4 -14
- package/lib/typescript/editor/protocol.d.ts.map +1 -1
- package/lib/typescript/hooks/use-toast.d.ts +1 -1
- package/lib/typescript/hooks/useThemeColor.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +91 -91
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/lib/backdrop.d.ts +4 -0
- package/lib/typescript/lib/backdrop.d.ts.map +1 -0
- package/lib/typescript/lib/overlay-host.d.ts +1 -0
- package/lib/typescript/lib/overlay-host.d.ts.map +1 -1
- package/package.json +9 -14
- package/setup/metro.js +26 -73
- package/setup/tailwind.js +16 -8
- package/setup/tokens.native.css +51 -20
- package/src/components/Alert.tsx +37 -20
- package/src/components/AlertDialog.tsx +18 -19
- package/src/components/Badge.tsx +16 -15
- package/src/components/Button.tsx +64 -31
- package/src/components/CardNews.tsx +17 -6
- package/src/components/Carousel.tsx +5 -5
- package/src/components/Checkbox.tsx +17 -7
- package/src/components/Chip.tsx +49 -21
- package/src/components/Choice.tsx +34 -14
- package/src/components/Dialog.tsx +15 -5
- package/src/components/DropdownMenu.tsx +62 -14
- package/src/components/EmptyState.tsx +3 -3
- package/src/components/FallbackImage.tsx +32 -23
- package/src/components/Feed.tsx +2 -1
- package/src/components/Feedback.tsx +0 -1
- package/src/components/Filter.tsx +2 -3
- package/src/components/Input.tsx +83 -64
- package/src/components/InvitePopover.tsx +11 -3
- package/src/components/LeaderboardCard.tsx +4 -1
- package/src/components/Loading.tsx +17 -14
- package/src/components/LoadingOverlay.tsx +33 -50
- package/src/components/MemberRow.tsx +3 -3
- package/src/components/PageHeader.tsx +4 -1
- package/src/components/PostForm.tsx +28 -16
- package/src/components/PrizeCollection.tsx +3 -3
- package/src/components/RadioGroup.tsx +69 -12
- package/src/components/SectionHeader.tsx +4 -1
- package/src/components/Select.tsx +4 -3
- package/src/components/Separator.tsx +2 -2
- package/src/components/Sheet.tsx +15 -8
- package/src/components/Skeleton.tsx +1 -1
- package/src/components/Tabs.tsx +5 -4
- package/src/components/Tag.tsx +56 -35
- package/src/components/Toast.tsx +10 -6
- package/src/editor/NoteEditor.tsx +246 -72
- package/src/editor/editorHtml.generated.ts +1 -1
- package/src/editor/index.ts +8 -4
- package/src/editor/protocol.ts +4 -12
- package/src/hooks/useThemeColor.ts +41 -19
- package/src/index.ts +1 -1
- package/src/lib/backdrop.ts +16 -0
- package/src/lib/overlay-host.tsx +5 -5
|
@@ -7,6 +7,7 @@ import { Button } from "@/components/Button";
|
|
|
7
7
|
import { Checkbox } from "@/components/Checkbox";
|
|
8
8
|
import { Input, InputText, inputVariants } from "@/components/Input";
|
|
9
9
|
import { useTrackedText } from "@/hooks/useTrackedText";
|
|
10
|
+
import { fontFamilyMedium } from "@/lib/typography";
|
|
10
11
|
import { cn } from "@/lib/utils";
|
|
11
12
|
|
|
12
13
|
interface PostFormProps extends ViewProps {
|
|
@@ -149,7 +150,7 @@ function PostFormDescription({
|
|
|
149
150
|
)}
|
|
150
151
|
accessibilityLabel={placeholder}
|
|
151
152
|
{...props}
|
|
152
|
-
style={[{ fontFamily:
|
|
153
|
+
style={[{ fontFamily: fontFamilyMedium }, props.style]}
|
|
153
154
|
/>
|
|
154
155
|
<InputText className="text-right text-xs font-medium text-gray-foreground">
|
|
155
156
|
{text.length} / {maxLength}
|
|
@@ -172,7 +173,13 @@ function PostFormDateTimeField({
|
|
|
172
173
|
{label ? (
|
|
173
174
|
<Text className="text-sm font-medium text-gray-foreground">{label}</Text>
|
|
174
175
|
) : null}
|
|
175
|
-
<Pressable
|
|
176
|
+
<Pressable
|
|
177
|
+
accessibilityRole="button"
|
|
178
|
+
accessibilityLabel={label ?? placeholder}
|
|
179
|
+
accessibilityValue={value ? { text: value } : undefined}
|
|
180
|
+
onPress={onPress}
|
|
181
|
+
disabled={!onPress}
|
|
182
|
+
>
|
|
176
183
|
<View pointerEvents="none">
|
|
177
184
|
<Input
|
|
178
185
|
size="lg"
|
|
@@ -216,24 +223,29 @@ function PostFormCheckboxOption({
|
|
|
216
223
|
className={cn("flex-row items-start gap-3", disabled ? "opacity-50" : "", className)}
|
|
217
224
|
{...props}
|
|
218
225
|
>
|
|
219
|
-
<Checkbox
|
|
220
|
-
size="lg"
|
|
221
|
-
checked={isChecked}
|
|
222
|
-
onCheckedChange={handleCheckedChange}
|
|
223
|
-
disabled={disabled}
|
|
224
|
-
/>
|
|
225
226
|
<Pressable
|
|
226
|
-
accessibilityRole="
|
|
227
|
+
accessibilityRole="checkbox"
|
|
228
|
+
accessibilityState={{ checked: isChecked, disabled: !!disabled }}
|
|
227
229
|
disabled={disabled}
|
|
228
230
|
onPress={toggle}
|
|
229
|
-
className="min-w-0 flex-1
|
|
231
|
+
className="min-w-0 flex-1 flex-row items-start gap-3"
|
|
230
232
|
>
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
<Checkbox
|
|
234
|
+
size="lg"
|
|
235
|
+
checked={isChecked}
|
|
236
|
+
onCheckedChange={handleCheckedChange}
|
|
237
|
+
disabled={disabled}
|
|
238
|
+
accessible={false}
|
|
239
|
+
importantForAccessibility="no-hide-descendants"
|
|
240
|
+
/>
|
|
241
|
+
<View className="min-w-0 flex-1 gap-1 pb-2">
|
|
242
|
+
<Text className="text-md font-semibold text-gray-foreground">{title}</Text>
|
|
243
|
+
{description ? (
|
|
244
|
+
<Text className="text-xs font-medium text-gray-foreground">
|
|
245
|
+
{description}
|
|
246
|
+
</Text>
|
|
247
|
+
) : null}
|
|
248
|
+
</View>
|
|
237
249
|
</Pressable>
|
|
238
250
|
</View>
|
|
239
251
|
);
|
|
@@ -35,7 +35,7 @@ interface PrizeItemProps extends ViewProps {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const rankColors: Record<1 | 2 | 3, string> = {
|
|
38
|
-
1: "bg-
|
|
38
|
+
1: "bg-feedback-warning-background-fill",
|
|
39
39
|
2: "bg-gray-background-fill",
|
|
40
40
|
3: "bg-bronze-background-fill",
|
|
41
41
|
};
|
|
@@ -147,8 +147,8 @@ function PrizeItem({
|
|
|
147
147
|
{...props}
|
|
148
148
|
>
|
|
149
149
|
{isNew ? (
|
|
150
|
-
<View className="absolute -right-1 -top-1 rounded-md bg-
|
|
151
|
-
<Text className="text-xs font-semibold text-
|
|
150
|
+
<View className="absolute -right-1 -top-1 rounded-md bg-feedback-success-background-fill px-2 py-1">
|
|
151
|
+
<Text className="text-xs font-semibold text-feedback-success-foreground-onfill">
|
|
152
152
|
Novo
|
|
153
153
|
</Text>
|
|
154
154
|
</View>
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { View, type ViewProps } from "react-native";
|
|
2
2
|
import * as RadioGroupPrimitive from "@rn-primitives/radio-group";
|
|
3
3
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
-
import { type ReactNode } from "react";
|
|
4
|
+
import { createContext, useContext, useMemo, type ReactNode } from "react";
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
import { getMinTouchHitSlop } from "@/lib/touch-target";
|
|
7
7
|
|
|
8
8
|
interface RadioGroupItemProps
|
|
9
9
|
extends RadioGroupPrimitive.ItemProps,
|
|
10
|
-
VariantProps<typeof radioGroupVariants> {}
|
|
10
|
+
Omit<VariantProps<typeof radioGroupVariants>, "checked" | "disabled"> {}
|
|
11
|
+
|
|
12
|
+
interface RadioGroupState {
|
|
13
|
+
value: string | undefined;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const RadioGroupStateContext = createContext<RadioGroupState | null>(null);
|
|
11
18
|
|
|
12
19
|
const INNER_DOT_SIZES: Record<"sm" | "md" | "lg", number> = {
|
|
13
|
-
sm:
|
|
14
|
-
md:
|
|
15
|
-
lg:
|
|
20
|
+
sm: 6,
|
|
21
|
+
md: 6,
|
|
22
|
+
lg: 8,
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
const RADIO_DIMENSIONS: Record<"sm" | "md" | "lg", number> = {
|
|
@@ -33,34 +40,82 @@ const radioGroupVariants = cva(
|
|
|
33
40
|
variant: {
|
|
34
41
|
regular: "",
|
|
35
42
|
},
|
|
43
|
+
checked: {
|
|
44
|
+
true: "bg-primary-background-fill border-primary-background-fill",
|
|
45
|
+
false: "",
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
true: "bg-gray-background-soft-muted border-gray-stroke-muted",
|
|
49
|
+
false: "",
|
|
50
|
+
},
|
|
36
51
|
},
|
|
37
52
|
defaultVariants: {
|
|
38
53
|
size: "md",
|
|
39
54
|
variant: "regular",
|
|
55
|
+
checked: false,
|
|
56
|
+
disabled: false,
|
|
40
57
|
},
|
|
41
58
|
}
|
|
42
59
|
);
|
|
43
60
|
|
|
61
|
+
function getDotClassName(state: { checked: boolean; disabled: boolean }) {
|
|
62
|
+
if (state.disabled) return "bg-gray-background-fill-muted";
|
|
63
|
+
return state.checked ? "bg-primary-foreground-onfill" : "bg-primary-background-fill";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function RadioGroupStateProvider({
|
|
67
|
+
value,
|
|
68
|
+
disabled = false,
|
|
69
|
+
children,
|
|
70
|
+
}: {
|
|
71
|
+
value: string | undefined;
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
}) {
|
|
75
|
+
const state = useMemo(() => ({ value, disabled }), [value, disabled]);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<RadioGroupStateContext.Provider value={state}>{children}</RadioGroupStateContext.Provider>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
44
82
|
function RadioGroup({ className, ...props }: RadioGroupPrimitive.RootProps) {
|
|
45
83
|
return (
|
|
46
|
-
<
|
|
84
|
+
<RadioGroupStateProvider value={props.value} disabled={props.disabled}>
|
|
85
|
+
<RadioGroupPrimitive.Root className={cn("gap-3", className)} {...props} />
|
|
86
|
+
</RadioGroupStateProvider>
|
|
47
87
|
);
|
|
48
88
|
}
|
|
49
89
|
|
|
50
|
-
function RadioGroupItem({
|
|
90
|
+
function RadioGroupItem({
|
|
91
|
+
className,
|
|
92
|
+
size = "md",
|
|
93
|
+
variant,
|
|
94
|
+
value,
|
|
95
|
+
disabled,
|
|
96
|
+
...props
|
|
97
|
+
}: RadioGroupItemProps) {
|
|
98
|
+
const group = useContext(RadioGroupStateContext);
|
|
51
99
|
const resolvedSize = size ?? "md";
|
|
52
100
|
const dotSize = INNER_DOT_SIZES[resolvedSize];
|
|
101
|
+
const checked = group?.value === value;
|
|
102
|
+
const isDisabled = Boolean(group?.disabled || disabled);
|
|
53
103
|
|
|
54
104
|
return (
|
|
55
105
|
<RadioGroupPrimitive.Item
|
|
56
106
|
hitSlop={getMinTouchHitSlop(RADIO_DIMENSIONS[resolvedSize])}
|
|
57
|
-
className={cn(
|
|
107
|
+
className={cn(
|
|
108
|
+
radioGroupVariants({ size, variant, checked, disabled: isDisabled }),
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
value={value}
|
|
112
|
+
disabled={disabled}
|
|
58
113
|
{...props}
|
|
59
114
|
>
|
|
60
115
|
<RadioGroupPrimitive.Indicator className="items-center justify-center">
|
|
61
116
|
<View
|
|
62
117
|
style={{ width: dotSize, height: dotSize, borderRadius: dotSize / 2 }}
|
|
63
|
-
className=
|
|
118
|
+
className={getDotClassName({ checked, disabled: isDisabled })}
|
|
64
119
|
/>
|
|
65
120
|
</RadioGroupPrimitive.Indicator>
|
|
66
121
|
</RadioGroupPrimitive.Item>
|
|
@@ -74,9 +129,11 @@ interface RadioGroupListProps extends RadioGroupPrimitive.RootProps {
|
|
|
74
129
|
|
|
75
130
|
function RadioGroupList({ className, children, ...props }: RadioGroupListProps) {
|
|
76
131
|
return (
|
|
77
|
-
<
|
|
78
|
-
{
|
|
79
|
-
|
|
132
|
+
<RadioGroupStateProvider value={props.value} disabled={props.disabled}>
|
|
133
|
+
<RadioGroupPrimitive.Root className={cn("gap-0", className)} {...props}>
|
|
134
|
+
{children}
|
|
135
|
+
</RadioGroupPrimitive.Root>
|
|
136
|
+
</RadioGroupStateProvider>
|
|
80
137
|
);
|
|
81
138
|
}
|
|
82
139
|
|
|
@@ -25,7 +25,10 @@ function SectionHeader({
|
|
|
25
25
|
{...props}
|
|
26
26
|
>
|
|
27
27
|
<View className="min-w-0 flex-1 gap-0">
|
|
28
|
-
<Text
|
|
28
|
+
<Text
|
|
29
|
+
accessibilityRole="header"
|
|
30
|
+
className="text-title-xs font-semibold text-primary-foreground"
|
|
31
|
+
>
|
|
29
32
|
{title}
|
|
30
33
|
</Text>
|
|
31
34
|
{subtitle != null ? (
|
|
@@ -7,7 +7,8 @@ import React, {
|
|
|
7
7
|
type ReactNode,
|
|
8
8
|
type ReactElement,
|
|
9
9
|
} from "react";
|
|
10
|
-
import { View,
|
|
10
|
+
import { View, type ViewProps } from "react-native";
|
|
11
|
+
import { Text, type TextProps } from "@/components/Text";
|
|
11
12
|
import * as SelectPrimitive from "@rn-primitives/select";
|
|
12
13
|
import { cva } from "class-variance-authority";
|
|
13
14
|
import { cn } from "@/lib/utils";
|
|
@@ -101,7 +102,7 @@ function SelectValue({ className, placeholder, ...props }: SelectPrimitive.Value
|
|
|
101
102
|
return (
|
|
102
103
|
<SelectPrimitive.Value
|
|
103
104
|
className={cn(
|
|
104
|
-
"text-gray-foreground flex-1",
|
|
105
|
+
"text-gray-foreground font-regular flex-1",
|
|
105
106
|
size === "lg" ? "text-md" : "text-sm",
|
|
106
107
|
className
|
|
107
108
|
)}
|
|
@@ -155,7 +156,7 @@ function SelectItem({ className, children, icon, label, ...props }: SelectItemPr
|
|
|
155
156
|
<SelectPrimitive.Item
|
|
156
157
|
label={resolvedLabel}
|
|
157
158
|
className={cn(
|
|
158
|
-
"relative flex-row w-full items-center rounded px-2 gap-3",
|
|
159
|
+
"relative flex-row w-full items-center rounded-sm px-2 gap-3",
|
|
159
160
|
size === "lg" ? "py-2" : "py-1.5",
|
|
160
161
|
"active:bg-secondary-background-soft-emphasis",
|
|
161
162
|
className
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { View, type ViewProps
|
|
1
|
+
import { View, type ViewProps } from "react-native";
|
|
2
2
|
import { cn } from "@/lib/utils";
|
|
3
3
|
|
|
4
4
|
interface SeparatorProps extends ViewProps {
|
|
@@ -9,7 +9,7 @@ interface SeparatorProps extends ViewProps {
|
|
|
9
9
|
function Separator({ className, orientation = "horizontal", decorative = true, ...props }: SeparatorProps) {
|
|
10
10
|
return (
|
|
11
11
|
<View
|
|
12
|
-
|
|
12
|
+
role={decorative ? undefined : "separator"}
|
|
13
13
|
className={cn(
|
|
14
14
|
"shrink-0 bg-gray-stroke-muted",
|
|
15
15
|
orientation === "horizontal" ? "h-px w-full" : "w-px h-full",
|
package/src/components/Sheet.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { View, ScrollView, type ViewProps } from "react-native";
|
|
|
3
3
|
import * as DialogPrimitive from "@rn-primitives/dialog";
|
|
4
4
|
import { CloseMd } from "@medway-ui/icons/native";
|
|
5
5
|
import { useThemeColor } from "@/hooks/useThemeColor";
|
|
6
|
+
import { useBackdropStyle } from "@/lib/backdrop";
|
|
6
7
|
import { cn } from "@/lib/utils";
|
|
7
8
|
import { Separator } from "@/components/Separator";
|
|
8
9
|
|
|
@@ -12,6 +13,7 @@ interface SheetContainerProps extends DialogPrimitive.ContentProps {
|
|
|
12
13
|
side?: SheetSide;
|
|
13
14
|
showCloseButton?: boolean;
|
|
14
15
|
overlayClassName?: string;
|
|
16
|
+
closeOnOverlayPress?: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
interface SheetHeaderProps extends ViewProps {
|
|
@@ -30,10 +32,10 @@ const overlayPositionMap: Record<SheetSide, string> = {
|
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
const contentSizeMap: Record<SheetSide, string> = {
|
|
33
|
-
bottom: "w-full max-h-[90%] rounded-t-
|
|
34
|
-
top: "w-full max-h-[90%] rounded-b-
|
|
35
|
-
left: "h-full max-w-[80%] rounded-r-
|
|
36
|
-
right: "h-full max-w-[80%] rounded-l-
|
|
35
|
+
bottom: "w-full max-h-[90%] rounded-t-lg",
|
|
36
|
+
top: "w-full max-h-[90%] rounded-b-lg",
|
|
37
|
+
left: "h-full max-w-[80%] rounded-r-lg",
|
|
38
|
+
right: "h-full max-w-[80%] rounded-l-lg",
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const closeButtonPositionMap: Record<SheetSide, string> = {
|
|
@@ -61,22 +63,27 @@ function SheetContainer({
|
|
|
61
63
|
children,
|
|
62
64
|
side = "bottom",
|
|
63
65
|
showCloseButton = true,
|
|
66
|
+
closeOnOverlayPress = true,
|
|
64
67
|
...props
|
|
65
68
|
}: SheetContainerProps) {
|
|
66
69
|
const closeIconColor = useThemeColor("gray-foreground");
|
|
70
|
+
const backdropStyle = useBackdropStyle(overlayClassName);
|
|
67
71
|
|
|
68
72
|
return (
|
|
69
73
|
<DialogPrimitive.Portal>
|
|
70
74
|
<DialogPrimitive.Overlay
|
|
71
|
-
className={cn("absolute inset-0
|
|
75
|
+
className={cn("absolute inset-0", overlayClassName)}
|
|
76
|
+
style={backdropStyle}
|
|
77
|
+
closeOnPress={closeOnOverlayPress}
|
|
72
78
|
/>
|
|
73
79
|
<DialogPrimitive.Content
|
|
74
80
|
className={cn(overlayPositionMap[side])}
|
|
81
|
+
pointerEvents="box-none"
|
|
75
82
|
{...props}
|
|
76
83
|
>
|
|
77
84
|
<View
|
|
78
85
|
className={cn(
|
|
79
|
-
"relative flex-col bg-
|
|
86
|
+
"relative flex-col bg-surface-elevated shadow-lg overflow-hidden",
|
|
80
87
|
contentSizeMap[side],
|
|
81
88
|
className
|
|
82
89
|
)}
|
|
@@ -112,7 +119,7 @@ function SheetContent({
|
|
|
112
119
|
}) {
|
|
113
120
|
return (
|
|
114
121
|
<ScrollView
|
|
115
|
-
className={cn(
|
|
122
|
+
className={cn(containerClassName)}
|
|
116
123
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
117
124
|
>
|
|
118
125
|
<View className={cn("px-6 py-4", className)}>{children}</View>
|
|
@@ -154,7 +161,7 @@ function SheetTitle({ className, ...props }: DialogPrimitive.TitleProps) {
|
|
|
154
161
|
function SheetDescription({ className, ...props }: DialogPrimitive.DescriptionProps) {
|
|
155
162
|
return (
|
|
156
163
|
<DialogPrimitive.Description
|
|
157
|
-
className={cn("text-md leading-md text-content-paragraph", className)}
|
|
164
|
+
className={cn("text-md font-regular leading-md text-content-paragraph", className)}
|
|
158
165
|
{...props}
|
|
159
166
|
/>
|
|
160
167
|
);
|
|
@@ -74,7 +74,7 @@ function Skeleton({ className, style, children, ...props }: SkeletonProps) {
|
|
|
74
74
|
<Animated.View style={[StyleSheet.absoluteFill, animatedStyle]}>
|
|
75
75
|
<View
|
|
76
76
|
style={styles.background}
|
|
77
|
-
className={cn("flex-1 bg-gray-150", classes.background)}
|
|
77
|
+
className={cn("flex-1 bg-gray-150 dark:bg-gray-600", classes.background)}
|
|
78
78
|
/>
|
|
79
79
|
</Animated.View>
|
|
80
80
|
{children}
|
package/src/components/Tabs.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Pressable, View } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import { Text } from "@/components/Text";
|
|
5
5
|
import * as TabsPrimitive from "@rn-primitives/tabs";
|
|
6
|
-
import { cva
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
7
|
|
|
8
8
|
import { cn } from "@/lib/utils";
|
|
9
9
|
|
|
@@ -53,12 +53,12 @@ interface TabsListProps extends TabsPrimitive.ListProps {
|
|
|
53
53
|
children?: ReactNode;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
interface TabsTriggerProps
|
|
57
|
-
extends TabsPrimitive.TriggerProps,
|
|
58
|
-
VariantProps<typeof tabsTriggerVariants> {
|
|
56
|
+
interface TabsTriggerProps extends TabsPrimitive.TriggerProps {
|
|
59
57
|
className?: string;
|
|
60
58
|
children?: ReactNode;
|
|
61
59
|
icon?: ReactNode;
|
|
60
|
+
/** @deprecated Ignored: the active tab comes from the `Tabs` value. */
|
|
61
|
+
active?: boolean | null;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
interface TabsContentProps extends TabsPrimitive.ContentProps {
|
|
@@ -109,6 +109,7 @@ function TabsTrigger({
|
|
|
109
109
|
children,
|
|
110
110
|
icon,
|
|
111
111
|
value,
|
|
112
|
+
active,
|
|
112
113
|
...props
|
|
113
114
|
}: TabsTriggerProps) {
|
|
114
115
|
const variant = useTabsVariant();
|
package/src/components/Tag.tsx
CHANGED
|
@@ -14,51 +14,59 @@ const tagVariants = cva(
|
|
|
14
14
|
"flex-row items-center justify-center rounded-md px-2 py-1 gap-1.5 max-h-6 overflow-hidden shrink-0",
|
|
15
15
|
{
|
|
16
16
|
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: "",
|
|
19
|
+
md: "px-2.5 py-1.5 gap-2 max-h-8",
|
|
20
|
+
},
|
|
17
21
|
variant: {
|
|
18
22
|
regular: "bg-primary-background-fill",
|
|
19
23
|
"regular-soft": "bg-primary-background-soft",
|
|
20
|
-
"regular-basic": "bg-transparent",
|
|
24
|
+
"regular-basic": "bg-transparent p-0",
|
|
21
25
|
emphasis: "bg-secondary-background-fill",
|
|
22
26
|
"emphasis-soft": "bg-secondary-background-soft",
|
|
23
|
-
"emphasis-basic": "bg-transparent",
|
|
27
|
+
"emphasis-basic": "bg-transparent p-0",
|
|
24
28
|
gray: "bg-gray-background-fill",
|
|
25
29
|
"gray-soft": "bg-gray-background-soft",
|
|
26
|
-
"gray-basic": "bg-transparent",
|
|
27
|
-
success: "bg-
|
|
28
|
-
"success-soft": "bg-
|
|
29
|
-
"success-basic": "bg-transparent",
|
|
30
|
-
error: "bg-
|
|
31
|
-
"error-soft": "bg-
|
|
32
|
-
"error-basic": "bg-transparent",
|
|
33
|
-
warning: "bg-
|
|
34
|
-
"warning-soft": "bg-
|
|
35
|
-
"warning-basic": "bg-transparent",
|
|
30
|
+
"gray-basic": "bg-transparent p-0",
|
|
31
|
+
success: "bg-feedback-success-background-fill",
|
|
32
|
+
"success-soft": "bg-feedback-success-background-soft",
|
|
33
|
+
"success-basic": "bg-transparent p-0",
|
|
34
|
+
error: "bg-feedback-error-background-fill",
|
|
35
|
+
"error-soft": "bg-feedback-error-background-soft",
|
|
36
|
+
"error-basic": "bg-transparent p-0",
|
|
37
|
+
warning: "bg-feedback-warning-background-fill",
|
|
38
|
+
"warning-soft": "bg-feedback-warning-background-soft",
|
|
39
|
+
"warning-basic": "bg-transparent p-0",
|
|
36
40
|
cm: "bg-cm-background-fill",
|
|
37
41
|
"cm-soft": "bg-cm-background-soft",
|
|
38
|
-
"cm-basic": "bg-transparent",
|
|
42
|
+
"cm-basic": "bg-transparent p-0",
|
|
39
43
|
go: "bg-go-background-fill",
|
|
40
44
|
"go-soft": "bg-go-background-soft",
|
|
41
|
-
"go-basic": "bg-transparent",
|
|
45
|
+
"go-basic": "bg-transparent p-0",
|
|
42
46
|
cir: "bg-cir-background-fill",
|
|
43
47
|
"cir-soft": "bg-cir-background-soft",
|
|
44
|
-
"cir-basic": "bg-transparent",
|
|
48
|
+
"cir-basic": "bg-transparent p-0",
|
|
45
49
|
ped: "bg-ped-background-fill",
|
|
46
50
|
"ped-soft": "bg-ped-background-soft",
|
|
47
|
-
"ped-basic": "bg-transparent",
|
|
51
|
+
"ped-basic": "bg-transparent p-0",
|
|
48
52
|
prev: "bg-prev-background-fill",
|
|
49
53
|
"prev-soft": "bg-prev-background-soft",
|
|
50
|
-
"prev-basic": "bg-transparent",
|
|
54
|
+
"prev-basic": "bg-transparent p-0",
|
|
51
55
|
ia: "bg-secondary-background-fill",
|
|
52
56
|
"ia-soft": "bg-secondary-background-soft",
|
|
53
|
-
"ia-basic": "bg-transparent",
|
|
57
|
+
"ia-basic": "bg-transparent p-0",
|
|
54
58
|
},
|
|
55
59
|
},
|
|
56
|
-
defaultVariants: { variant: "regular" },
|
|
60
|
+
defaultVariants: { size: "sm", variant: "regular" },
|
|
57
61
|
}
|
|
58
62
|
);
|
|
59
63
|
|
|
60
64
|
const tagTextVariants = cva("text-xs font-semibold", {
|
|
61
65
|
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
sm: "",
|
|
68
|
+
md: "text-sm leading-sm",
|
|
69
|
+
},
|
|
62
70
|
variant: {
|
|
63
71
|
regular: "text-primary-foreground-onfill",
|
|
64
72
|
"regular-soft": "text-primary-foreground",
|
|
@@ -69,15 +77,15 @@ const tagTextVariants = cva("text-xs font-semibold", {
|
|
|
69
77
|
gray: "text-gray-foreground-onfill",
|
|
70
78
|
"gray-soft": "text-gray-foreground",
|
|
71
79
|
"gray-basic": "text-gray-foreground",
|
|
72
|
-
success: "text-
|
|
73
|
-
"success-soft": "text-
|
|
74
|
-
"success-basic": "text-
|
|
75
|
-
error: "text-
|
|
76
|
-
"error-soft": "text-
|
|
77
|
-
"error-basic": "text-
|
|
78
|
-
warning: "text-
|
|
79
|
-
"warning-soft": "text-
|
|
80
|
-
"warning-basic": "text-
|
|
80
|
+
success: "text-feedback-success-foreground-onfill",
|
|
81
|
+
"success-soft": "text-feedback-success-foreground",
|
|
82
|
+
"success-basic": "text-feedback-success-foreground",
|
|
83
|
+
error: "text-feedback-error-foreground-onfill",
|
|
84
|
+
"error-soft": "text-feedback-error-foreground",
|
|
85
|
+
"error-basic": "text-feedback-error-foreground",
|
|
86
|
+
warning: "text-feedback-warning-foreground-onfill",
|
|
87
|
+
"warning-soft": "text-feedback-warning-foreground",
|
|
88
|
+
"warning-basic": "text-feedback-warning-foreground",
|
|
81
89
|
cm: "text-cm-foreground-onfill",
|
|
82
90
|
"cm-soft": "text-cm-foreground",
|
|
83
91
|
"cm-basic": "text-cm-foreground",
|
|
@@ -98,18 +106,31 @@ const tagTextVariants = cva("text-xs font-semibold", {
|
|
|
98
106
|
"ia-basic": "text-secondary-foreground",
|
|
99
107
|
},
|
|
100
108
|
},
|
|
101
|
-
defaultVariants: { variant: "regular" },
|
|
109
|
+
defaultVariants: { size: "sm", variant: "regular" },
|
|
102
110
|
});
|
|
103
111
|
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>;
|
|
113
|
+
|
|
114
|
+
const TAG_ICON_SIZE_CLASS_NAME: Record<TagSize, string> = {
|
|
115
|
+
sm: "w-3.5 h-3.5",
|
|
116
|
+
md: "w-5 h-5",
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function TagIcon({ icon, size }: { icon?: ReactNode; size: TagSize }) {
|
|
120
|
+
return (
|
|
121
|
+
<View className={cn(TAG_ICON_SIZE_CLASS_NAME[size], "items-center justify-center")}>
|
|
122
|
+
{icon}
|
|
123
|
+
</View>
|
|
124
|
+
);
|
|
106
125
|
}
|
|
107
126
|
|
|
108
|
-
function Tag({ className, variant, icon, children, ...props }: TagProps) {
|
|
127
|
+
function Tag({ className, variant, size, icon, children, ...props }: TagProps) {
|
|
109
128
|
return (
|
|
110
|
-
<View className={cn(tagVariants({ variant }), className)} {...props}>
|
|
111
|
-
{icon && <TagIcon icon={icon} />}
|
|
112
|
-
<Text className={cn(tagTextVariants({ variant }))}>
|
|
129
|
+
<View className={cn(tagVariants({ size, variant }), className)} {...props}>
|
|
130
|
+
{icon && <TagIcon icon={icon} size={size ?? "sm"} />}
|
|
131
|
+
<Text numberOfLines={1} className={cn(tagTextVariants({ size, variant }))}>
|
|
132
|
+
{children}
|
|
133
|
+
</Text>
|
|
113
134
|
</View>
|
|
114
135
|
);
|
|
115
136
|
}
|
package/src/components/Toast.tsx
CHANGED
|
@@ -109,7 +109,6 @@ const GRADIENT_STYLES: Record<ToastGradientVariant, GradientStyle> = {
|
|
|
109
109
|
underlayClassName: "bg-white",
|
|
110
110
|
},
|
|
111
111
|
"gold-gradient": {
|
|
112
|
-
// Literal hex from Figma replaced by podium tokens on web (#72)
|
|
113
112
|
colorTokens: ["gold", "gold-lighten-6"],
|
|
114
113
|
locations: [0.29, 1],
|
|
115
114
|
angleDeg: 124,
|
|
@@ -318,9 +317,10 @@ function ToastClose({
|
|
|
318
317
|
);
|
|
319
318
|
}
|
|
320
319
|
|
|
320
|
+
const LinearGradient = loadLinearGradient();
|
|
321
|
+
|
|
321
322
|
function ToastGradientFill({ variant }: { variant: ToastGradientVariant }) {
|
|
322
323
|
const style = GRADIENT_STYLES[variant];
|
|
323
|
-
const LinearGradient = loadLinearGradient();
|
|
324
324
|
const borderRadius = useRadiusLg();
|
|
325
325
|
const color0 = useThemeColor(style.colorTokens[0]);
|
|
326
326
|
const color1 = useThemeColor(style.colorTokens[1]);
|
|
@@ -392,8 +392,8 @@ function ToastItem({
|
|
|
392
392
|
const [visible, setVisible] = useState(open);
|
|
393
393
|
const onOpenChangeRef = useRef(onOpenChange);
|
|
394
394
|
onOpenChangeRef.current = onOpenChange;
|
|
395
|
-
const translateY = useSharedValue(
|
|
396
|
-
const opacity = useSharedValue(
|
|
395
|
+
const translateY = useSharedValue(-80);
|
|
396
|
+
const opacity = useSharedValue(0);
|
|
397
397
|
const gradient = isGradientVariant(variant);
|
|
398
398
|
|
|
399
399
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
@@ -433,7 +433,11 @@ function ToastItem({
|
|
|
433
433
|
return (
|
|
434
434
|
<Animated.View style={animatedStyle}>
|
|
435
435
|
<ToastContext.Provider value={{ variant, onOpenChange }}>
|
|
436
|
-
<View
|
|
436
|
+
<View
|
|
437
|
+
accessibilityLiveRegion="polite"
|
|
438
|
+
className={containerClassName}
|
|
439
|
+
{...props}
|
|
440
|
+
>
|
|
437
441
|
{gradient ? <ToastGradientFill variant={variant} /> : null}
|
|
438
442
|
{showIcon && resolvedIcon}
|
|
439
443
|
<View className="min-w-0 flex-1 flex-row items-center justify-between gap-4">
|
|
@@ -474,7 +478,7 @@ function ToastAction({
|
|
|
474
478
|
className,
|
|
475
479
|
variant: variantProp,
|
|
476
480
|
size = "sm",
|
|
477
|
-
altText
|
|
481
|
+
altText,
|
|
478
482
|
children,
|
|
479
483
|
loading,
|
|
480
484
|
iconLeft,
|