@campxdev/react-native-blueprint 0.1.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/LICENSE +20 -0
- package/README.md +358 -0
- package/lib/module/app/_layout.js +23 -0
- package/lib/module/app/_layout.js.map +1 -0
- package/lib/module/assets/icons/weather_icons/drizzle.png +0 -0
- package/lib/module/assets/icons/weather_icons/foggy.png +0 -0
- package/lib/module/assets/icons/weather_icons/freezing_rain.png +0 -0
- package/lib/module/assets/icons/weather_icons/partly_cloudy.png +0 -0
- package/lib/module/assets/icons/weather_icons/rainy.png +0 -0
- package/lib/module/assets/icons/weather_icons/showers.png +0 -0
- package/lib/module/assets/icons/weather_icons/sunny_weather.png +0 -0
- package/lib/module/assets/icons/weather_icons/thunderstorm.png +0 -0
- package/lib/module/assets/icons/weather_icons/thunderstorm_hail.png +0 -0
- package/lib/module/components/theme-config.js +265 -0
- package/lib/module/components/theme-config.js.map +1 -0
- package/lib/module/components/ui/Accordion.js +228 -0
- package/lib/module/components/ui/Accordion.js.map +1 -0
- package/lib/module/components/ui/Alert-Dialog.js +266 -0
- package/lib/module/components/ui/Alert-Dialog.js.map +1 -0
- package/lib/module/components/ui/Alert.js +107 -0
- package/lib/module/components/ui/Alert.js.map +1 -0
- package/lib/module/components/ui/AppBar.js +403 -0
- package/lib/module/components/ui/AppBar.js.map +1 -0
- package/lib/module/components/ui/Aspect-Ratio.js +27 -0
- package/lib/module/components/ui/Aspect-Ratio.js.map +1 -0
- package/lib/module/components/ui/Avatar.js +97 -0
- package/lib/module/components/ui/Avatar.js.map +1 -0
- package/lib/module/components/ui/Badge.js +127 -0
- package/lib/module/components/ui/Badge.js.map +1 -0
- package/lib/module/components/ui/Bottom-Sheet.js +144 -0
- package/lib/module/components/ui/Bottom-Sheet.js.map +1 -0
- package/lib/module/components/ui/Button.js +88 -0
- package/lib/module/components/ui/Button.js.map +1 -0
- package/lib/module/components/ui/Card.js +176 -0
- package/lib/module/components/ui/Card.js.map +1 -0
- package/lib/module/components/ui/Checkbox.js +65 -0
- package/lib/module/components/ui/Checkbox.js.map +1 -0
- package/lib/module/components/ui/Collapsible.js +42 -0
- package/lib/module/components/ui/Collapsible.js.map +1 -0
- package/lib/module/components/ui/Context-Menu.js +287 -0
- package/lib/module/components/ui/Context-Menu.js.map +1 -0
- package/lib/module/components/ui/Custom-Card.js +202 -0
- package/lib/module/components/ui/Custom-Card.js.map +1 -0
- package/lib/module/components/ui/Dialog.js +202 -0
- package/lib/module/components/ui/Dialog.js.map +1 -0
- package/lib/module/components/ui/Dropdown-Menu.js +421 -0
- package/lib/module/components/ui/Dropdown-Menu.js.map +1 -0
- package/lib/module/components/ui/Floating-Action.js +50 -0
- package/lib/module/components/ui/Floating-Action.js.map +1 -0
- package/lib/module/components/ui/Greeting-Card.js +392 -0
- package/lib/module/components/ui/Greeting-Card.js.map +1 -0
- package/lib/module/components/ui/Hover-Card.js +96 -0
- package/lib/module/components/ui/Hover-Card.js.map +1 -0
- package/lib/module/components/ui/Icon.js +73 -0
- package/lib/module/components/ui/Icon.js.map +1 -0
- package/lib/module/components/ui/Input.js +74 -0
- package/lib/module/components/ui/Input.js.map +1 -0
- package/lib/module/components/ui/Label.js +44 -0
- package/lib/module/components/ui/Label.js.map +1 -0
- package/lib/module/components/ui/Menubar.js +375 -0
- package/lib/module/components/ui/Menubar.js.map +1 -0
- package/lib/module/components/ui/Native-Only-Animated-View.js +41 -0
- package/lib/module/components/ui/Native-Only-Animated-View.js.map +1 -0
- package/lib/module/components/ui/NavBar.js +352 -0
- package/lib/module/components/ui/NavBar.js.map +1 -0
- package/lib/module/components/ui/Popover.js +101 -0
- package/lib/module/components/ui/Popover.js.map +1 -0
- package/lib/module/components/ui/Progress.js +124 -0
- package/lib/module/components/ui/Progress.js.map +1 -0
- package/lib/module/components/ui/Radio-Group.js +75 -0
- package/lib/module/components/ui/Radio-Group.js.map +1 -0
- package/lib/module/components/ui/Select.js +269 -0
- package/lib/module/components/ui/Select.js.map +1 -0
- package/lib/module/components/ui/Separator.js +58 -0
- package/lib/module/components/ui/Separator.js.map +1 -0
- package/lib/module/components/ui/SizedBox.js +101 -0
- package/lib/module/components/ui/SizedBox.js.map +1 -0
- package/lib/module/components/ui/Skeleton.js +57 -0
- package/lib/module/components/ui/Skeleton.js.map +1 -0
- package/lib/module/components/ui/Slider.js +169 -0
- package/lib/module/components/ui/Slider.js.map +1 -0
- package/lib/module/components/ui/Switch.js +55 -0
- package/lib/module/components/ui/Switch.js.map +1 -0
- package/lib/module/components/ui/Table.js +150 -0
- package/lib/module/components/ui/Table.js.map +1 -0
- package/lib/module/components/ui/Tabs.js +106 -0
- package/lib/module/components/ui/Tabs.js.map +1 -0
- package/lib/module/components/ui/Text.js +69 -0
- package/lib/module/components/ui/Text.js.map +1 -0
- package/lib/module/components/ui/Textarea.js +88 -0
- package/lib/module/components/ui/Textarea.js.map +1 -0
- package/lib/module/components/ui/Theme-Toggle.js +156 -0
- package/lib/module/components/ui/Theme-Toggle.js.map +1 -0
- package/lib/module/components/ui/Toast.js +101 -0
- package/lib/module/components/ui/Toast.js.map +1 -0
- package/lib/module/components/ui/Toggle-Group.js +129 -0
- package/lib/module/components/ui/Toggle-Group.js.map +1 -0
- package/lib/module/components/ui/Toggle.js +106 -0
- package/lib/module/components/ui/Toggle.js.map +1 -0
- package/lib/module/components/ui/Tooltip.js +106 -0
- package/lib/module/components/ui/Tooltip.js.map +1 -0
- package/lib/module/components/ui/index.js +45 -0
- package/lib/module/components/ui/index.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/lib/ThemeProvider.js +173 -0
- package/lib/module/lib/ThemeProvider.js.map +1 -0
- package/lib/module/lib/cornerRadius.js +164 -0
- package/lib/module/lib/cornerRadius.js.map +1 -0
- package/lib/module/lib/fonts.js +25 -0
- package/lib/module/lib/fonts.js.map +1 -0
- package/lib/module/lib/theme.js +212 -0
- package/lib/module/lib/theme.js.map +1 -0
- package/lib/module/lib/utils.js +137 -0
- package/lib/module/lib/utils.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/package.json +208 -0
- package/src/app/_layout.tsx +25 -0
- package/src/assets/icons/weather_icons/drizzle.png +0 -0
- package/src/assets/icons/weather_icons/foggy.png +0 -0
- package/src/assets/icons/weather_icons/freezing_rain.png +0 -0
- package/src/assets/icons/weather_icons/partly_cloudy.png +0 -0
- package/src/assets/icons/weather_icons/rainy.png +0 -0
- package/src/assets/icons/weather_icons/showers.png +0 -0
- package/src/assets/icons/weather_icons/sunny_weather.png +0 -0
- package/src/assets/icons/weather_icons/thunderstorm.png +0 -0
- package/src/assets/icons/weather_icons/thunderstorm_hail.png +0 -0
- package/src/components/theme-config.ts +331 -0
- package/src/components/ui/Accordion.tsx +253 -0
- package/src/components/ui/Alert-Dialog.tsx +295 -0
- package/src/components/ui/Alert.tsx +137 -0
- package/src/components/ui/AppBar.tsx +551 -0
- package/src/components/ui/Aspect-Ratio.tsx +25 -0
- package/src/components/ui/Avatar.tsx +103 -0
- package/src/components/ui/Badge.tsx +121 -0
- package/src/components/ui/Bottom-Sheet.tsx +224 -0
- package/src/components/ui/Button.tsx +100 -0
- package/src/components/ui/Card.tsx +185 -0
- package/src/components/ui/Checkbox.tsx +81 -0
- package/src/components/ui/Collapsible.tsx +40 -0
- package/src/components/ui/Context-Menu.tsx +407 -0
- package/src/components/ui/Custom-Card.tsx +226 -0
- package/src/components/ui/Dialog.tsx +240 -0
- package/src/components/ui/Dropdown-Menu.tsx +544 -0
- package/src/components/ui/Floating-Action.tsx +54 -0
- package/src/components/ui/Greeting-Card.tsx +471 -0
- package/src/components/ui/Hover-Card.tsx +101 -0
- package/src/components/ui/Icon.tsx +75 -0
- package/src/components/ui/Input.tsx +90 -0
- package/src/components/ui/Label.tsx +48 -0
- package/src/components/ui/Menubar.tsx +509 -0
- package/src/components/ui/Native-Only-Animated-View.tsx +37 -0
- package/src/components/ui/NavBar.tsx +397 -0
- package/src/components/ui/Popover.tsx +110 -0
- package/src/components/ui/Progress.tsx +138 -0
- package/src/components/ui/Radio-Group.tsx +79 -0
- package/src/components/ui/Select.tsx +344 -0
- package/src/components/ui/Separator.tsx +68 -0
- package/src/components/ui/SizedBox.tsx +116 -0
- package/src/components/ui/Skeleton.tsx +55 -0
- package/src/components/ui/Slider.tsx +222 -0
- package/src/components/ui/Switch.tsx +67 -0
- package/src/components/ui/Table.tsx +170 -0
- package/src/components/ui/Tabs.tsx +119 -0
- package/src/components/ui/Text.tsx +73 -0
- package/src/components/ui/Textarea.tsx +93 -0
- package/src/components/ui/Theme-Toggle.tsx +204 -0
- package/src/components/ui/Toast.tsx +127 -0
- package/src/components/ui/Toggle-Group.tsx +160 -0
- package/src/components/ui/Toggle.tsx +122 -0
- package/src/components/ui/Tooltip.tsx +117 -0
- package/src/components/ui/index.ts +42 -0
- package/src/index.tsx +24 -0
- package/src/lib/ThemeProvider.tsx +204 -0
- package/src/lib/cornerRadius.ts +160 -0
- package/src/lib/fonts.ts +28 -0
- package/src/lib/theme.ts +151 -0
- package/src/lib/utils.ts +146 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["THEME_COLORS","light","background","foreground","card","cardForeground","popover","popoverForeground","primary","primaryForeground","secondary","secondaryForeground","muted","mutedForeground","accent","accentForeground","destructive","destructiveForeground","border","input","ring","success","successForeground","warning","warningForeground","info","infoForeground","dark","hslToRgb","hsl","match","h","parseInt","s","parseFloat","l","r","g","b","hue2rgb","p","q","t","toHex","x","hex","Math","round","toString","length","getThemeColorValue","colorKey","isDark","asRgb","color","DARK_MODE_CLASSES","text","default","state","hover","active","focus","disabled","withDarkMode","baseClass","darkClass","additionalClasses","filter","Boolean","join","THEME_PRESETS","buttonPrimary","buttonSecondary","buttonOutline","buttonGhost","getNativeThemeColors","isValidThemeColor","key"],"sourceRoot":"../../../src","sources":["components/theme-config.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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B,kBAAkB,CAAC,WAAW,EAAEE,MAAM,CAAW,CAAC;IACtEzC,mBAAmB,EAAEiB,QAAQ,CAC3BsB,kBAAkB,CAAC,qBAAqB,EAAEE,MAAM,CAClD,CAAC;IACDxC,KAAK,EAAEgB,QAAQ,CAACsB,kBAAkB,CAAC,OAAO,EAAEE,MAAM,CAAW,CAAC;IAC9DvC,eAAe,EAAEe,QAAQ,CACvBsB,kBAAkB,CAAC,iBAAiB,EAAEE,MAAM,CAC9C,CAAC;IACDtC,MAAM,EAAEc,QAAQ,CAACsB,kBAAkB,CAAC,QAAQ,EAAEE,MAAM,CAAW,CAAC;IAChErC,gBAAgB,EAAEa,QAAQ,CACxBsB,kBAAkB,CAAC,kBAAkB,EAAEE,MAAM,CAC/C,CAAC;IACDpC,WAAW,EAAEY,QAAQ,CAACsB,kBAAkB,CAAC,aAAa,EAAEE,MAAM,CAAW,CAAC;IAC1EnC,qBAAqB,EAAEW,QAAQ,CAC7BsB,kBAAkB,CAAC,uBAAuB,EAAEE,MAAM,CACpD,CAAC;IACDlC,MAAM,EAAEU,QAAQ,CAACsB,kBAAkB,CAAC,QAAQ,EAAEE,MAAM,CAAW,CAAC;IAChEjC,KAAK,EAAES,QAAQ,CAACsB,kBAAkB,CAAC,OAAO,EAAEE,MAAM,CAAW,CAAC;IAC9DhC,IAAI,EAAEQ,QAAQ,CAACsB,kBAAkB,CAAC,MAAM,EAAEE,MAAM,CAAW;EAC7D,CAAC;AACH;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,SAASwB,iBAAiBA,CAACC,GAAW,EAAwB;EACnE,OAAOA,GAAG,IAAI7E,YAAY,CAACC,KAAK;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as AccordionPrimitive from '@rn-primitives/accordion';
|
|
4
|
+
import { ChevronDown } from 'lucide-react-native';
|
|
5
|
+
import { cssInterop } from 'nativewind';
|
|
6
|
+
import { Platform, Pressable, View } from 'react-native';
|
|
7
|
+
import Animated, { FadeOutUp, LayoutAnimationConfig, LinearTransition, useAnimatedStyle, useDerivedValue, withTiming } from 'react-native-reanimated';
|
|
8
|
+
import { cn } from "../../lib/utils.js";
|
|
9
|
+
import { Icon } from "./Icon.js";
|
|
10
|
+
import { TextClassContext } from "./Text.js";
|
|
11
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
cssInterop(View, {
|
|
13
|
+
className: 'style'
|
|
14
|
+
});
|
|
15
|
+
cssInterop(Pressable, {
|
|
16
|
+
className: 'style'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Root accordion container with smooth animations
|
|
21
|
+
*
|
|
22
|
+
* A vertically stacked set of interactive panels where only one or multiple panels can be expanded at a time.
|
|
23
|
+
* Features smooth layout animations using Reanimated for a polished user experience.
|
|
24
|
+
*
|
|
25
|
+
* @component
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Single selection
|
|
29
|
+
* <Accordion type="single" collapsible defaultValue="item-1">
|
|
30
|
+
* <AccordionItem value="item-1">
|
|
31
|
+
* <AccordionTrigger>
|
|
32
|
+
* <Text>Question 1</Text>
|
|
33
|
+
* </AccordionTrigger>
|
|
34
|
+
* <AccordionContent>
|
|
35
|
+
* <Text>Answer 1</Text>
|
|
36
|
+
* </AccordionContent>
|
|
37
|
+
* </AccordionItem>
|
|
38
|
+
* </Accordion>
|
|
39
|
+
*
|
|
40
|
+
* // Multiple selection
|
|
41
|
+
* <Accordion type="multiple">
|
|
42
|
+
* <AccordionItem value="item-1">
|
|
43
|
+
* <AccordionTrigger><Text>Section 1</Text></AccordionTrigger>
|
|
44
|
+
* <AccordionContent><Text>Content 1</Text></AccordionContent>
|
|
45
|
+
* </AccordionItem>
|
|
46
|
+
* <AccordionItem value="item-2">
|
|
47
|
+
* <AccordionTrigger><Text>Section 2</Text></AccordionTrigger>
|
|
48
|
+
* <AccordionContent><Text>Content 2</Text></AccordionContent>
|
|
49
|
+
* </AccordionItem>
|
|
50
|
+
* </Accordion>
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @accessibility
|
|
54
|
+
* - Implements WAI-ARIA accordion pattern
|
|
55
|
+
* - Keyboard navigation with arrow keys and Enter/Space
|
|
56
|
+
* - Proper ARIA attributes for expanded/collapsed states
|
|
57
|
+
*/
|
|
58
|
+
function Accordion({
|
|
59
|
+
children,
|
|
60
|
+
...props
|
|
61
|
+
}) {
|
|
62
|
+
return /*#__PURE__*/_jsx(LayoutAnimationConfig, {
|
|
63
|
+
skipEntering: true,
|
|
64
|
+
children: /*#__PURE__*/_jsx(AccordionPrimitive.Root, {
|
|
65
|
+
...props,
|
|
66
|
+
asChild: Platform.OS !== 'web',
|
|
67
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
68
|
+
layout: LinearTransition.duration(200),
|
|
69
|
+
children: children
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Individual accordion item with border styling
|
|
77
|
+
*
|
|
78
|
+
* Contains a trigger and content section. Each item must have a unique value prop
|
|
79
|
+
* for identification within the parent Accordion.
|
|
80
|
+
*
|
|
81
|
+
* @component
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <AccordionItem value="item-1">
|
|
85
|
+
* <AccordionTrigger>
|
|
86
|
+
* <Text>Click to expand</Text>
|
|
87
|
+
* </AccordionTrigger>
|
|
88
|
+
* <AccordionContent>
|
|
89
|
+
* <Text>Hidden content revealed on expansion</Text>
|
|
90
|
+
* </AccordionContent>
|
|
91
|
+
* </AccordionItem>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
function AccordionItem({
|
|
95
|
+
children,
|
|
96
|
+
className,
|
|
97
|
+
value,
|
|
98
|
+
...props
|
|
99
|
+
}) {
|
|
100
|
+
return /*#__PURE__*/_jsx(AccordionPrimitive.Item, {
|
|
101
|
+
className: cn('border-border border-b', Platform.select({
|
|
102
|
+
web: 'last:border-b-0'
|
|
103
|
+
}), className),
|
|
104
|
+
value: value,
|
|
105
|
+
asChild: true,
|
|
106
|
+
...props,
|
|
107
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
108
|
+
className: "native:overflow-hidden",
|
|
109
|
+
layout: Platform.select({
|
|
110
|
+
native: LinearTransition.duration(200)
|
|
111
|
+
}),
|
|
112
|
+
children: children
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const Trigger = Platform.OS === 'web' ? View : Pressable;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Clickable trigger button that toggles accordion item expansion
|
|
120
|
+
*
|
|
121
|
+
* Features an animated chevron icon that rotates based on expansion state.
|
|
122
|
+
* Automatically manages focus states and hover effects on web.
|
|
123
|
+
*
|
|
124
|
+
* @component
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* <AccordionTrigger>
|
|
128
|
+
* <Text>Click to toggle</Text>
|
|
129
|
+
* </AccordionTrigger>
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @accessibility
|
|
133
|
+
* - Automatically includes chevron icon for visual expansion indicator
|
|
134
|
+
* - Focus visible states for keyboard navigation on web
|
|
135
|
+
* - Disabled state prevents interaction
|
|
136
|
+
*/
|
|
137
|
+
function AccordionTrigger({
|
|
138
|
+
className,
|
|
139
|
+
children,
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
const {
|
|
143
|
+
isExpanded
|
|
144
|
+
} = AccordionPrimitive.useItemContext();
|
|
145
|
+
const progress = useDerivedValue(() => isExpanded ? withTiming(1, {
|
|
146
|
+
duration: 250
|
|
147
|
+
}) : withTiming(0, {
|
|
148
|
+
duration: 200
|
|
149
|
+
}), [isExpanded]);
|
|
150
|
+
const chevronStyle = useAnimatedStyle(() => ({
|
|
151
|
+
transform: [{
|
|
152
|
+
rotate: `${progress.value * 180}deg`
|
|
153
|
+
}]
|
|
154
|
+
}), [progress]);
|
|
155
|
+
return /*#__PURE__*/_jsx(TextClassContext.Provider, {
|
|
156
|
+
value: cn('text-foreground text-left text-sm font-medium', Platform.select({
|
|
157
|
+
web: 'group-hover:underline'
|
|
158
|
+
})),
|
|
159
|
+
children: /*#__PURE__*/_jsx(AccordionPrimitive.Header, {
|
|
160
|
+
children: /*#__PURE__*/_jsx(AccordionPrimitive.Trigger, {
|
|
161
|
+
...props,
|
|
162
|
+
asChild: true,
|
|
163
|
+
children: /*#__PURE__*/_jsxs(Trigger, {
|
|
164
|
+
className: cn('flex-row items-start justify-between gap-4 rounded-md py-4 disabled:opacity-50', Platform.select({
|
|
165
|
+
web: 'focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 outline-none transition-all hover:underline focus-visible:ring-[3px] disabled:pointer-events-none [&[data-state=open]>svg]:rotate-180'
|
|
166
|
+
}), className),
|
|
167
|
+
children: [/*#__PURE__*/_jsx(_Fragment, {
|
|
168
|
+
children: children
|
|
169
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
170
|
+
style: chevronStyle,
|
|
171
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
172
|
+
as: ChevronDown,
|
|
173
|
+
size: 16,
|
|
174
|
+
className: cn('text-muted-foreground shrink-0', Platform.select({
|
|
175
|
+
web: 'pointer-events-none translate-y-0.5 transition-transform duration-200'
|
|
176
|
+
}))
|
|
177
|
+
})
|
|
178
|
+
})]
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Collapsible content container with smooth animations
|
|
187
|
+
*
|
|
188
|
+
* Automatically animates height changes when expanding/collapsing. Uses platform-specific
|
|
189
|
+
* animations (CSS transitions on web, Reanimated on native).
|
|
190
|
+
*
|
|
191
|
+
* @component
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* <AccordionContent>
|
|
195
|
+
* <Text>This content slides in and out smoothly</Text>
|
|
196
|
+
* <View className="mt-2">
|
|
197
|
+
* <Text>Additional content here</Text>
|
|
198
|
+
* </View>
|
|
199
|
+
* </AccordionContent>
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
function AccordionContent({
|
|
203
|
+
className,
|
|
204
|
+
children,
|
|
205
|
+
...props
|
|
206
|
+
}) {
|
|
207
|
+
const {
|
|
208
|
+
isExpanded
|
|
209
|
+
} = AccordionPrimitive.useItemContext();
|
|
210
|
+
return /*#__PURE__*/_jsx(TextClassContext.Provider, {
|
|
211
|
+
value: "text-foreground text-sm",
|
|
212
|
+
children: /*#__PURE__*/_jsx(AccordionPrimitive.Content, {
|
|
213
|
+
className: cn('overflow-hidden', Platform.select({
|
|
214
|
+
web: isExpanded ? 'animate-accordion-down' : 'animate-accordion-up'
|
|
215
|
+
})),
|
|
216
|
+
...props,
|
|
217
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
218
|
+
exiting: Platform.select({
|
|
219
|
+
native: FadeOutUp.duration(200)
|
|
220
|
+
}),
|
|
221
|
+
className: cn('pb-4', className),
|
|
222
|
+
children: children
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
228
|
+
//# sourceMappingURL=Accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AccordionPrimitive","ChevronDown","cssInterop","Platform","Pressable","View","Animated","FadeOutUp","LayoutAnimationConfig","LinearTransition","useAnimatedStyle","useDerivedValue","withTiming","cn","Icon","TextClassContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","className","Accordion","children","props","skipEntering","Root","asChild","OS","layout","duration","AccordionItem","value","Item","select","web","native","Trigger","AccordionTrigger","isExpanded","useItemContext","progress","chevronStyle","transform","rotate","Provider","Header","style","as","size","AccordionContent","Content","exiting"],"sourceRoot":"../../../../src","sources":["components/ui/Accordion.tsx"],"mappings":";;AAAA,OAAO,KAAKA,kBAAkB,MAAM,0BAA0B;AAC9D,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAAQ,YAAY;AACvC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AACxD,OAAOC,QAAQ,IACbC,SAAS,EACTC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,QACL,yBAAyB;AAChC,SAASC,EAAE,QAAQ,oBAAiB;AACpC,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,gBAAgB,QAAQ,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1CnB,UAAU,CAACG,IAAI,EAAE;EAAEiB,SAAS,EAAE;AAAQ,CAAC,CAAC;AACxCpB,UAAU,CAACE,SAAS,EAAE;EAAEkB,SAAS,EAAE;AAAQ,CAAC,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAAC;EACjBC,QAAQ;EACR,GAAGC;AAE2C,CAAC,EAAE;EACjD,oBACER,IAAA,CAACT,qBAAqB;IAACkB,YAAY;IAAAF,QAAA,eACjCP,IAAA,CAACjB,kBAAkB,CAAC2B,IAAI;MAAA,GACjBF,KAAK;MACVG,OAAO,EAAEzB,QAAQ,CAAC0B,EAAE,KAAK,KAAM;MAAAL,QAAA,eAE/BP,IAAA,CAACX,QAAQ,CAACD,IAAI;QAAC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C,CACH,CAAC;AAEhC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASe,gBAAgBA,CAAC;EACxB7B,SAAS;EACTE,QAAQ;EACR,GAAGC;AAE8C,CAAC,EAAE;EACpD,MAAM;IAAEe;EAAW,CAAC,GAAGxC,kBAAkB,CAACyC,cAAc,CAAC,CAAC;EAC1D,oBACExB,IAAA,CAACF,gBAAgB,CAAC+B,QAAQ;IAACb,KAAK,EAAC,yBAAyB;IAAAT,QAAA,eACxDP,IAAA,CAACjB,kBAAkB,CAACoD,OAAO;MACzB9B,SAAS,EAAET,EAAE,CACX,iBAAiB,EACjBV,QAAQ,CAACgC,MAAM,CAAC;QACdC,GAAG,EAAEI,UAAU,GAAG,wBAAwB,GAAG;MAC/C,CAAC,CACH,CAAE;MAAA,GACEf,KAAK;MAAAD,QAAA,eAETP,IAAA,CAACX,QAAQ,CAACD,IAAI;QACZgD,OAAO,EAAElD,QAAQ,CAACgC,MAAM,CAAC;UAAEE,MAAM,EAAE9B,SAAS,CAACwB,QAAQ,CAAC,GAAG;QAAE,CAAC,CAAE;QAC9DT,SAAS,EAAET,EAAE,CAAC,MAAM,EAAES,SAAS,CAAE;QAAAE,QAAA,EAEhCA;MAAQ,CACI;IAAC,CACU;EAAC,CACJ,CAAC;AAEhC;AAEA,SAASD,SAAS,EAAE4B,gBAAgB,EAAEnB,aAAa,EAAEO,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { buttonTextVariants, buttonVariants } from "./Button.js";
|
|
4
|
+
import { NativeOnlyAnimatedView } from "./Native-Only-Animated-View.js";
|
|
5
|
+
import { TextClassContext } from "./Text.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import * as AlertDialogPrimitive from '@rn-primitives/alert-dialog';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Platform, View } from 'react-native';
|
|
10
|
+
import { cssInterop } from 'nativewind';
|
|
11
|
+
import { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
12
|
+
import { FullWindowOverlay as RNFullWindowOverlay } from 'react-native-screens';
|
|
13
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
cssInterop(View, {
|
|
15
|
+
className: 'style'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Root alert dialog container
|
|
20
|
+
*
|
|
21
|
+
* A modal dialog that interrupts the user with important content and expects a response.
|
|
22
|
+
* Use for critical actions that require user confirmation before proceeding.
|
|
23
|
+
*
|
|
24
|
+
* @component
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <AlertDialog>
|
|
28
|
+
* <AlertDialogTrigger asChild>
|
|
29
|
+
* <Button variant="destructive"><Text>Delete Account</Text></Button>
|
|
30
|
+
* </AlertDialogTrigger>
|
|
31
|
+
* <AlertDialogContent>
|
|
32
|
+
* <AlertDialogHeader>
|
|
33
|
+
* <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
34
|
+
* <AlertDialogDescription>
|
|
35
|
+
* This action cannot be undone.
|
|
36
|
+
* </AlertDialogDescription>
|
|
37
|
+
* </AlertDialogHeader>
|
|
38
|
+
* <AlertDialogFooter>
|
|
39
|
+
* <AlertDialogCancel><Text>Cancel</Text></AlertDialogCancel>
|
|
40
|
+
* <AlertDialogAction><Text>Continue</Text></AlertDialogAction>
|
|
41
|
+
* </AlertDialogFooter>
|
|
42
|
+
* </AlertDialogContent>
|
|
43
|
+
* </AlertDialog>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @accessibility
|
|
47
|
+
* - Traps focus within dialog when open
|
|
48
|
+
* - Closes on Escape key press
|
|
49
|
+
* - Returns focus to trigger on close
|
|
50
|
+
* - Uses appropriate ARIA attributes
|
|
51
|
+
*/
|
|
52
|
+
const AlertDialog = AlertDialogPrimitive.Root;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Trigger button that opens the alert dialog
|
|
56
|
+
*
|
|
57
|
+
* @component
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <AlertDialogTrigger asChild>
|
|
61
|
+
* <Button><Text>Open Dialog</Text></Button>
|
|
62
|
+
* </AlertDialogTrigger>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Portal component for rendering dialog content outside the DOM hierarchy
|
|
69
|
+
*/
|
|
70
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
71
|
+
const FullWindowOverlay = Platform.OS === 'ios' ? RNFullWindowOverlay : React.Fragment;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Semi-transparent overlay behind the alert dialog
|
|
75
|
+
*
|
|
76
|
+
* Provides backdrop that dims background content and handles click-outside behavior.
|
|
77
|
+
* Uses platform-specific full window overlay on iOS for proper z-index layering.
|
|
78
|
+
*
|
|
79
|
+
* @component
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* <AlertDialogOverlay>
|
|
83
|
+
* <AlertDialogContent>...</AlertDialogContent>
|
|
84
|
+
* </AlertDialogOverlay>
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
function AlertDialogOverlay({
|
|
88
|
+
className,
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}) {
|
|
92
|
+
return /*#__PURE__*/_jsx(FullWindowOverlay, {
|
|
93
|
+
children: /*#__PURE__*/_jsx(AlertDialogPrimitive.Overlay, {
|
|
94
|
+
className: cn('absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center bg-black/50 p-2', Platform.select({
|
|
95
|
+
web: 'animate-in fade-in-0 fixed'
|
|
96
|
+
}), className),
|
|
97
|
+
...props,
|
|
98
|
+
children: /*#__PURE__*/_jsx(NativeOnlyAnimatedView, {
|
|
99
|
+
entering: FadeIn.duration(200).delay(50),
|
|
100
|
+
exiting: FadeOut.duration(150),
|
|
101
|
+
children: /*#__PURE__*/_jsx(_Fragment, {
|
|
102
|
+
children: children
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Main alert dialog content container
|
|
111
|
+
*
|
|
112
|
+
* Contains the dialog's title, description, and action buttons. Automatically centered
|
|
113
|
+
* on screen with smooth entrance animations.
|
|
114
|
+
*
|
|
115
|
+
* @component
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <AlertDialogContent>
|
|
119
|
+
* <AlertDialogHeader>
|
|
120
|
+
* <AlertDialogTitle>Confirm Action</AlertDialogTitle>
|
|
121
|
+
* <AlertDialogDescription>Description here</AlertDialogDescription>
|
|
122
|
+
* </AlertDialogHeader>
|
|
123
|
+
* <AlertDialogFooter>
|
|
124
|
+
* <AlertDialogCancel><Text>Cancel</Text></AlertDialogCancel>
|
|
125
|
+
* <AlertDialogAction><Text>Continue</Text></AlertDialogAction>
|
|
126
|
+
* </AlertDialogFooter>
|
|
127
|
+
* </AlertDialogContent>
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
function AlertDialogContent({
|
|
131
|
+
className,
|
|
132
|
+
portalHost,
|
|
133
|
+
...props
|
|
134
|
+
}) {
|
|
135
|
+
return /*#__PURE__*/_jsx(AlertDialogPortal, {
|
|
136
|
+
hostName: portalHost,
|
|
137
|
+
children: /*#__PURE__*/_jsx(AlertDialogOverlay, {
|
|
138
|
+
children: /*#__PURE__*/_jsx(AlertDialogPrimitive.Content, {
|
|
139
|
+
className: cn('bg-background border-border z-50 flex w-full max-w-[calc(100%-2rem)] flex-col gap-4 rounded-lg border p-6 shadow-lg shadow-black/5 sm:max-w-lg', Platform.select({
|
|
140
|
+
web: 'animate-in fade-in-0 zoom-in-95 duration-200'
|
|
141
|
+
}), className),
|
|
142
|
+
...props
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Header section for alert dialog content
|
|
150
|
+
*
|
|
151
|
+
* Groups the title and description with proper spacing and text alignment.
|
|
152
|
+
*
|
|
153
|
+
* @component
|
|
154
|
+
*/
|
|
155
|
+
function AlertDialogHeader({
|
|
156
|
+
className,
|
|
157
|
+
...props
|
|
158
|
+
}) {
|
|
159
|
+
return /*#__PURE__*/_jsx(TextClassContext.Provider, {
|
|
160
|
+
value: "text-center sm:text-left",
|
|
161
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
162
|
+
className: cn('flex flex-col gap-2', className),
|
|
163
|
+
...props
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Footer section for alert dialog action buttons
|
|
170
|
+
*
|
|
171
|
+
* Contains cancel and action buttons with responsive layout (stacked on mobile, row on desktop).
|
|
172
|
+
*
|
|
173
|
+
* @component
|
|
174
|
+
*/
|
|
175
|
+
function AlertDialogFooter({
|
|
176
|
+
className,
|
|
177
|
+
...props
|
|
178
|
+
}) {
|
|
179
|
+
return /*#__PURE__*/_jsx(View, {
|
|
180
|
+
className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className),
|
|
181
|
+
...props
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Title text for the alert dialog
|
|
187
|
+
*
|
|
188
|
+
* Prominently displays the main heading with large, semibold text.
|
|
189
|
+
*
|
|
190
|
+
* @component
|
|
191
|
+
*/
|
|
192
|
+
function AlertDialogTitle({
|
|
193
|
+
className,
|
|
194
|
+
...props
|
|
195
|
+
}) {
|
|
196
|
+
return /*#__PURE__*/_jsx(AlertDialogPrimitive.Title, {
|
|
197
|
+
className: cn('text-foreground text-lg font-semibold', className),
|
|
198
|
+
...props
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Description text for the alert dialog
|
|
204
|
+
*
|
|
205
|
+
* Provides additional context below the title with muted styling.
|
|
206
|
+
*
|
|
207
|
+
* @component
|
|
208
|
+
*/
|
|
209
|
+
function AlertDialogDescription({
|
|
210
|
+
className,
|
|
211
|
+
...props
|
|
212
|
+
}) {
|
|
213
|
+
return /*#__PURE__*/_jsx(AlertDialogPrimitive.Description, {
|
|
214
|
+
className: cn('text-muted-foreground text-sm', className),
|
|
215
|
+
...props
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Primary action button that confirms the alert dialog action
|
|
221
|
+
*
|
|
222
|
+
* Styled as a primary button. Automatically closes dialog on press.
|
|
223
|
+
*
|
|
224
|
+
* @component
|
|
225
|
+
*/
|
|
226
|
+
function AlertDialogAction({
|
|
227
|
+
className,
|
|
228
|
+
...props
|
|
229
|
+
}) {
|
|
230
|
+
return /*#__PURE__*/_jsx(TextClassContext.Provider, {
|
|
231
|
+
value: buttonTextVariants({
|
|
232
|
+
className
|
|
233
|
+
}),
|
|
234
|
+
children: /*#__PURE__*/_jsx(AlertDialogPrimitive.Action, {
|
|
235
|
+
className: cn(buttonVariants(), className),
|
|
236
|
+
...props
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Cancel button that dismisses the alert dialog
|
|
243
|
+
*
|
|
244
|
+
* Styled as an outline button. Automatically closes dialog on press without performing action.
|
|
245
|
+
*
|
|
246
|
+
* @component
|
|
247
|
+
*/
|
|
248
|
+
function AlertDialogCancel({
|
|
249
|
+
className,
|
|
250
|
+
...props
|
|
251
|
+
}) {
|
|
252
|
+
return /*#__PURE__*/_jsx(TextClassContext.Provider, {
|
|
253
|
+
value: buttonTextVariants({
|
|
254
|
+
className,
|
|
255
|
+
variant: 'outline'
|
|
256
|
+
}),
|
|
257
|
+
children: /*#__PURE__*/_jsx(AlertDialogPrimitive.Cancel, {
|
|
258
|
+
className: cn(buttonVariants({
|
|
259
|
+
variant: 'outline'
|
|
260
|
+
}), className),
|
|
261
|
+
...props
|
|
262
|
+
})
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
266
|
+
//# sourceMappingURL=Alert-Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["buttonTextVariants","buttonVariants","NativeOnlyAnimatedView","TextClassContext","cn","AlertDialogPrimitive","React","Platform","View","cssInterop","FadeIn","FadeOut","FullWindowOverlay","RNFullWindowOverlay","Fragment","_Fragment","jsx","_jsx","className","AlertDialog","Root","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","OS","AlertDialogOverlay","children","props","Overlay","select","web","entering","duration","delay","exiting","AlertDialogContent","portalHost","hostName","Content","AlertDialogHeader","Provider","value","AlertDialogFooter","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","Action","AlertDialogCancel","variant","Cancel"],"sourceRoot":"../../../../src","sources":["components/ui/Alert-Dialog.tsx"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,cAAc,QAAQ,aAAU;AAC7D,SAASC,sBAAsB,QAAQ,gCAA6B;AACpE,SAASC,gBAAgB,QAAQ,WAAQ;AACzC,SAASC,EAAE,QAAQ,oBAAiB;AACpC,OAAO,KAAKC,oBAAoB,MAAM,6BAA6B;AACnE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,IAAI,QAAwB,cAAc;AAC7D,SAASC,UAAU,QAAQ,YAAY;AAC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E7DV,IAAA,CAACZ,oBAAoB,CAAC+C,MAAM;MAC1BlC,SAAS,EAAEd,EAAE,CAACH,cAAc,CAAC;QAAEkD,OAAO,EAAE;MAAU,CAAC,CAAC,EAAEjC,SAAS,CAAE;MAAA,GAC7DU;IAAK,CACV;EAAC,CACuB,CAAC;AAEhC;AAEA,SACET,WAAW,EACX6B,iBAAiB,EACjBE,iBAAiB,EACjBd,kBAAkB,EAClBU,sBAAsB,EACtBH,iBAAiB,EACjBH,iBAAiB,EACjBd,kBAAkB,EAClBH,iBAAiB,EACjBqB,gBAAgB,EAChBvB,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Icon } from "./Icon.js";
|
|
4
|
+
import { Text, TextClassContext } from "./Text.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { View } from 'react-native';
|
|
8
|
+
import { cssInterop } from 'nativewind';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
cssInterop(View, {
|
|
11
|
+
className: 'style'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Alert component for displaying important messages or notifications
|
|
16
|
+
*
|
|
17
|
+
* Features an icon on the left side with title and description.
|
|
18
|
+
* Supports default and destructive variants for different severity levels.
|
|
19
|
+
*
|
|
20
|
+
* @component
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Alert icon={AlertCircle} variant="default">
|
|
24
|
+
* <AlertTitle><Text>Heads up!</Text></AlertTitle>
|
|
25
|
+
* <AlertDescription>
|
|
26
|
+
* <Text>You can add components to your app using the cli.</Text>
|
|
27
|
+
* </AlertDescription>
|
|
28
|
+
* </Alert>
|
|
29
|
+
*
|
|
30
|
+
* // Destructive variant
|
|
31
|
+
* <Alert icon={AlertTriangle} variant="destructive">
|
|
32
|
+
* <AlertTitle><Text>Error</Text></AlertTitle>
|
|
33
|
+
* <AlertDescription>
|
|
34
|
+
* <Text>Your session has expired. Please login again.</Text>
|
|
35
|
+
* </AlertDescription>
|
|
36
|
+
* </Alert>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param {LucideIcon} icon - Icon component to display
|
|
40
|
+
* @param {'default' | 'destructive'} [variant='default'] - Alert style variant
|
|
41
|
+
* @param {string} [iconClassName] - Additional classes for the icon
|
|
42
|
+
* @param {string} [className] - Additional classes for the container
|
|
43
|
+
*
|
|
44
|
+
* @accessibility Sets role="alert" for screen reader announcement
|
|
45
|
+
*/
|
|
46
|
+
function Alert({
|
|
47
|
+
className,
|
|
48
|
+
variant,
|
|
49
|
+
children,
|
|
50
|
+
icon,
|
|
51
|
+
iconClassName,
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
return /*#__PURE__*/_jsx(TextClassContext.Provider, {
|
|
55
|
+
value: cn('text-sm text-foreground dark:text-foreground', variant === 'destructive' && 'text-destructive dark:text-destructive', className),
|
|
56
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
57
|
+
role: "alert",
|
|
58
|
+
className: cn('bg-card dark:bg-card border-border dark:border-border relative w-full rounded-lg border px-4 pb-2 pt-3.5', className),
|
|
59
|
+
...props,
|
|
60
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
61
|
+
className: "absolute left-3.5 top-3",
|
|
62
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
63
|
+
as: icon,
|
|
64
|
+
className: cn('size-4 text-foreground dark:text-foreground', variant === 'destructive' && 'text-destructive dark:text-destructive', iconClassName)
|
|
65
|
+
})
|
|
66
|
+
}), children]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* AlertTitle - Title text for the alert
|
|
73
|
+
*
|
|
74
|
+
* Displays as a medium-weight heading with appropriate spacing from the icon.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} [className] - Additional Tailwind classes
|
|
77
|
+
*/
|
|
78
|
+
function AlertTitle({
|
|
79
|
+
className,
|
|
80
|
+
...props
|
|
81
|
+
}) {
|
|
82
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
83
|
+
className: cn('mb-1 ml-0.5 min-h-4 pl-6 font-medium leading-none tracking-tight', className),
|
|
84
|
+
...props
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* AlertDescription - Description text for the alert
|
|
90
|
+
*
|
|
91
|
+
* Displays detailed message content with muted styling and appropriate spacing.
|
|
92
|
+
* Automatically adjusts color for destructive variants.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} [className] - Additional Tailwind classes
|
|
95
|
+
*/
|
|
96
|
+
function AlertDescription({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}) {
|
|
100
|
+
const textClass = React.useContext(TextClassContext);
|
|
101
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
102
|
+
className: cn('text-muted-foreground dark:text-muted-foreground ml-0.5 pb-1.5 pl-6 text-sm leading-relaxed', textClass?.includes('text-destructive') && 'text-destructive/90 dark:text-destructive/90', className),
|
|
103
|
+
...props
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
107
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Icon","Text","TextClassContext","cn","React","View","cssInterop","jsx","_jsx","jsxs","_jsxs","className","Alert","variant","children","icon","iconClassName","props","Provider","value","role","as","AlertTitle","AlertDescription","textClass","useContext","includes"],"sourceRoot":"../../../../src","sources":["components/ui/Alert.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,WAAQ;AAC7B,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,WAAQ;AAC/C,SAASC,EAAE,QAAQ,oBAAiB;AAEpC,OAAO,KAAK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